//----------------------------------------------------------------------------- // Focus task //FIXME void daisy::focusTask(WId id) { KWindowInfo taskInfo = KWindowSystem::windowInfo( id, NET::WMState, NET::WM2WindowClass ); if ( taskInfo.valid() ) { KWindowSystem::unminimizeWindow( id, true ); KWindowSystem::activateWindow( id ); } }
//----------------------------------------------------------------------------- // Close task //FIXME void daisy::closeTask(WId id) { KWindowInfo taskInfo = KWindowSystem::windowInfo( id, NET::WMState ); if ( taskInfo.valid() ) { NETRootInfo ri( QX11Info::display(), NET::CloseWindow ); ri.closeWindowRequest( id ); } }
void DesktopSwitch::onWindowChanged(WId id, NET::Properties properties, NET::Properties2 properties2) { if (properties.testFlag(NET::WMState) && isWindowHighlightable(id)) { KWindowInfo info = KWindowInfo(id, NET::WMDesktop | NET::WMState); int desktop = info.desktop(); if (!info.valid() || info.onAllDesktops()) return; else { DesktopSwitchButton *button = static_cast<DesktopSwitchButton *>(m_buttons->button(desktop - 1)); if(button) button->setUrgencyHint(id, info.hasState(NET::DemandsAttention)); } } }
//----------------------------------------------------------------------------- // Toggle Shade task //FIXME void daisy::toggShadeTask(WId id) { KWindowInfo taskInfo = KWindowSystem::windowInfo( id, NET::WMState, NET::WM2WindowClass ); if ( taskInfo.valid() ) { if ( taskInfo.hasState( NET::Shaded ) ) { KWindowSystem::clearState( id, NET::Shaded ); KWindowSystem::unminimizeWindow( id, true ); // KWindowSystem::activateWindow( id ); } else { KWindowSystem::setState( id, NET::Shaded ); // KWindowSystem::setState( id, NET::DemandsAttention );//FOR TESTING, COMMENT AFTER } } }
//----------------------------------------------------------------------------- // Toggle task //FIXME void daisy::toggTask(WId id) { KWindowInfo taskInfo = KWindowSystem::windowInfo( id, NET::WMState, NET::WM2WindowClass ); if ( taskInfo.valid() ) { //HACK widget gains focus on click FIXME if ( !taskInfo.isMinimized() && ( m_actwin_save == id ) ) {KWindowSystem::minimizeWindow( id, true );} else { KWindowSystem::unminimizeWindow( id, true ); KWindowSystem::activateWindow( id ); } m_up_tmr->stop();m_up_tmr->setInterval(10);m_up_tmr->start(); } }
void KWD::Decorator::handleWindowAdded (WId id) { QMap <WId, KWD::Window *>::ConstIterator it; KWD::Window *client = 0; WId select, frame = 0; WId oframe = 0, iframe = 0; KWD::Window::Type type = KWD::Window::Normal; QWidgetList widgets; QRect geometry; /* avoid adding any of our own top level windows */ foreach (QWidget *widget, QApplication::topLevelWidgets ()) { if (widget->winId () == id) return; } if (KWD::readWindowProperty (id, Atoms::switchSelectWindow, (long *) &select)) { if (!mSwitcher) mSwitcher = new Switcher (mCompositeWindow, id); if (mSwitcher->xid () != id) { delete mSwitcher; mSwitcher = new Switcher (mCompositeWindow, id); } geometry = mSwitcher->geometry (); frame = None; } else { KWindowInfo wInfo; KWD::trapXError (); wInfo = KWindowSystem::windowInfo (id, NET::WMGeometry); if (KWD::popXError ()) return; if (!wInfo.valid ()) return; KWD::readWindowProperty (id, Atoms::netInputFrameWindow, (long *) &iframe); KWD::readWindowProperty (id, Atoms::netOutputFrameWindow, (long *) &oframe); geometry = wInfo.geometry (); wInfo = KWindowSystem::windowInfo (id, NET::WMWindowType, 0); switch (wInfo.windowType (~0)) { case NET::Normal: case NET::Dialog: case NET::Toolbar: case NET::Menu: case NET::Utility: case NET::Splash: case NET::Unknown: /* decorate these window types */ break; default: return; } if (iframe) { type = KWD::Window::Normal; frame = iframe; } else { type = KWD::Window::Normal2D; frame = oframe; } } KWD::trapXError (); XSelectInput (QX11Info::display (), id, StructureNotifyMask | PropertyChangeMask); KWD::popXError (); if (frame) { XWindowAttributes attr; KWD::trapXError (); XGetWindowAttributes (QX11Info::display (), frame, &attr); if (KWD::popXError ()) frame = None; } if (frame) { if (!mClients.contains (id)) { client = new KWD::Window (mCompositeWindow, id, frame, type, geometry); mClients.insert (id, client); mFrames.insert (frame, client); } else { client = mClients[id]; mFrames.remove (client->frameId ()); mFrames.insert (frame, client); client->updateFrame (frame); } if (mWindowsMenu.removeOne (id)) mClients[id]->setAppMenuAvailable (); } else { if (mClients.contains (id)) client = mClients[id]; if (client) { mClients.remove (client->windowId ()); mFrames.remove (client->frameId ()); delete client; } } }