void TitleWidget::mouseMoveEvent(QGraphicsSceneMouseEvent* event) { Plasma::IconWidget::mouseMoveEvent(event); if (m_drag && (event->buttons() & Qt::LeftButton)) { WId wid = KWindowSystem::activeWindow(); if (wid) { XUngrabPointer(QX11Info::display(), QX11Info::appTime()); NETRootInfo rootInfo(QX11Info::display(), NET::WMMoveResize); KWindowInfo info = KWindowSystem::windowInfo(wid, NET::WMGeometry); int x; int y; QPointF p = event->screenPos(); if (p.x() > info.geometry().x() && p.x() < info.geometry().x() + info.geometry().width()) x = p.x(); else x = info.geometry().x(); if (p.y() > info.geometry().y() && p.y() < info.geometry().y() + info.geometry().height()) y = p.y(); else y = info.geometry().y(); rootInfo.moveResizeRequest( wid, x, y, NET::Move); } } }
KlipperPopup::KlipperPopup( History* history ) : m_dirty( true ), m_textForEmptyHistory( i18n( "<empty clipboard>" ) ), m_textForNoMatch( i18n( "<no matches>" ) ), m_history( history ), m_helpMenu( new KHelpMenu( this, Klipper::aboutData(), false ) ), m_popupProxy( 0 ), m_filterWidget( 0 ), m_filterWidgetAction( 0 ), m_nHistoryItems( 0 ) { KWindowInfo windowInfo = KWindowSystem::windowInfo( winId(), NET::WMGeometry ); QRect geometry = windowInfo.geometry(); QRect screen = KGlobalSettings::desktopGeometry(geometry.center()); int menuHeight = ( screen.height() ) * 3/4; int menuWidth = ( screen.width() ) * 1/3; m_popupProxy = new PopupProxy( this, menuHeight, menuWidth ); connect( this, SIGNAL(aboutToShow()), SLOT(slotAboutToShow()) ); }
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; } } }