diff --git a/kwin/tabbox/declarative.cpp b/kwin/tabbox/declarative.cpp index 60effb9e..9d00404 100644 --- a/kwin/tabbox/declarative.cpp +++ b/kwin/tabbox/declarative.cpp @@ -45,6 +45,8 @@ along with this program. If not, see . #include "../client.h" #include "../workspace.h" +#include + namespace KWin { namespace TabBox @@ -149,6 +151,7 @@ DeclarativeView::DeclarativeView(QAbstractItemModel *model, TabBoxConfig::TabBox if (m_mode == TabBoxConfig::ClientTabBox) { connect(tabBox, SIGNAL(embeddedChanged(bool)), SLOT(slotEmbeddedChanged(bool))); } + } void DeclarativeView::showEvent(QShowEvent *event) @@ -225,7 +228,39 @@ bool DeclarativeView::x11Event(XEvent *e) } XSendEvent( QX11Info::display(), tabBox->embedded(), False, NoEventMask, &ev ); - } + } else if (e->type == GenericEvent) { + XEvent ev; + XIDeviceEvent *dev = (XIDeviceEvent *)e->xcookie.data; + + memset(&ev, 0x00, sizeof(ev)); + if (e->xcookie.evtype == XI_ButtonPress || e->xcookie.evtype == XI_ButtonRelease) { + if (e->xcookie.evtype == XI_ButtonPress) { + ev.type = ButtonPress; + } else { + ev.type = ButtonRelease; + } + ev.xbutton.button = Button1; + ev.xbutton.same_screen = True; + + XQueryPointer(QX11Info::display(), RootWindow(QX11Info::display(), DefaultScreen(QX11Info::display())), &ev.xbutton.root, &ev.xbutton.window, &ev.xbutton.x_root, &ev.xbutton.y_root, &ev.xbutton.x, &ev.xbutton.y, &ev.xbutton.state); + + ev.xbutton.subwindow = ev.xbutton.window; + ev.xbutton.x = m_relativePos.x() + dev->event_x; + ev.xbutton.y = m_relativePos.y() + dev->event_y; + ev.xbutton.window = tabBox->embedded(); + } else if (e->xcookie.evtype == XI_Motion) { + ev.type = MotionNotify; + ev.xmotion.same_screen = True; + + XQueryPointer(QX11Info::display(), RootWindow(QX11Info::display(), DefaultScreen(QX11Info::display())), &ev.xmotion.root, &ev.xmotion.window, &ev.xmotion.x_root, &ev.xmotion.y_root, &ev.xmotion.x, &ev.xmotion.y, &ev.xmotion.state); + + ev.xmotion.x = m_relativePos.x() + dev->event_x; + ev.xmotion.y = m_relativePos.y() + dev->event_y; + ev.xmotion.window = tabBox->embedded(); + } + XSendEvent( QX11Info::display(), tabBox->embedded(), False, NoEventMask, &ev ); + + } return QDeclarativeView::x11Event(e); }