fix qt application right-click not work perfectly

fix qt app should double right-click to active popup menu

Change-Id: I6067a19193876ac39ad899b7af5a0b96ccd6f4ee
This commit is contained in:
石博文 2016-08-31 20:55:22 +08:00
parent c301e8cdf7
commit 70d3233400
Notes: Deepin Code Review 2016-08-31 13:04:07 +00:00
Verified+1: Anonymous Coward #1000004
Code-Review+2: 石博文 <sbw@sbw.so>
Submitted-by: 石博文 <sbw@sbw.so>
Submitted-at: Wed, 31 Aug 2016 13:04:07 +0000
Reviewed-on: https://cr.deepin.io/15752
Project: dde/dde-dock
Branch: refs/heads/master
2 changed files with 6 additions and 7 deletions

View File

@ -109,7 +109,7 @@ void FashionTrayItem::mouseReleaseEvent(QMouseEvent *e)
if (!m_enableMouseEvent)
return;
QPoint globalPos = mapToGlobal(QPoint(0, 0));
QPoint globalPos = QCursor::pos();
uint8_t buttonIndex = XCB_BUTTON_INDEX_1;
switch (e->button()) {

View File

@ -125,7 +125,7 @@ void TrayWidget::mouseReleaseEvent(QMouseEvent *e)
if (distance.manhattanLength() > DRAG_THRESHOLD)
return;
QPoint globalPos = mapToGlobal(QPoint(0, 0));
QPoint globalPos = QCursor::pos();
uint8_t buttonIndex = XCB_BUTTON_INDEX_1;
switch (e->button()) {
@ -315,13 +315,12 @@ void TrayWidget::sendClick(uint8_t mouseButton, int x, int y)
if (isBadWindow())
return;
configContainerPosition();
setX11PassMouseEvent(false);
setWindowOnTop(true);
configContainerPosition();
Display *dsp = XOpenDisplay(nullptr);
XTestFakeButtonEvent(dsp, mouseButton, true, CurrentTime);
XTestFakeButtonEvent(dsp, mouseButton, false, CurrentTime);
XCloseDisplay(dsp);
XTestFakeMotionEvent(QX11Info::display(), 0, x, y, CurrentTime);
XTestFakeButtonEvent(QX11Info::display(), mouseButton, true, CurrentTime);
XTestFakeButtonEvent(QX11Info::display(), mouseButton, false, CurrentTime);
setX11PassMouseEvent(true);
setWindowOnTop(false);