]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Correctly position context menu of the information panel under wayland with a seconda...
authorMéven Car <meven29@gmail.com>
Tue, 12 Mar 2019 14:54:46 +0000 (08:54 -0600)
committerNate Graham <nate@kde.org>
Tue, 12 Mar 2019 15:25:31 +0000 (09:25 -0600)
Summary:
According to my testing this bug occurs because Qcursor::pos() does not work as expected under wayland on a secondary screen, then it returns inaccurate data.
This could hide bugs elsewhere.

BUG: 404799
FIXED-IN: 19.04.0

Test Plan:
Under Wayland test the context menu on both screens.
Do the same under Xorg.

Reviewers: #dolphin, elvisangelaccio

Reviewed By: #dolphin, elvisangelaccio

Subscribers: elvisangelaccio, ngraham, nicolasfella, kfm-devel

Tags: #dolphin

Differential Revision: https://phabricator.kde.org/D19535

src/panels/information/informationpanel.cpp
src/panels/information/informationpanelcontent.cpp
src/panels/information/informationpanelcontent.h

index 1ec2696e31a2d44761b588c4f396d6ed8a660dac..a0aeaaa37651444331e02b867ce99327dd599e1b 100644 (file)
@@ -158,7 +158,7 @@ void InformationPanel::resizeEvent(QResizeEvent* event)
 void InformationPanel::contextMenuEvent(QContextMenuEvent* event)
 {
     // TODO: Move code from InformationPanelContent::configureSettings() here
-    m_content->configureSettings(customContextMenuActions());
+    m_content->configureSettings(customContextMenuActions(), event->globalPos());
     Panel::contextMenuEvent(event);
 }
 
index 6f671e683058f6c6af214d0224404868bcdbe001..bf87f9b5a524f96365323ae754bfc0e400d7b4f2 100644 (file)
@@ -264,7 +264,7 @@ bool InformationPanelContent::eventFilter(QObject* obj, QEvent* event)
     return QWidget::eventFilter(obj, event);
 }
 
-void InformationPanelContent::configureSettings(const QList<QAction*>& customContextMenuActions)
+void InformationPanelContent::configureSettings(const QList<QAction*>& customContextMenuActions, const QPointF& pos)
 {
     QMenu popup(this);
 
@@ -288,7 +288,7 @@ void InformationPanelContent::configureSettings(const QList<QAction*>& customCon
 
     // Open the popup and adjust the settings for the
     // selected action.
-    QAction* action = popup.exec(QCursor::pos());
+    QAction* action = popup.exec(pos.toPoint());
     if (!action) {
         return;
     }
index 9223fcc5a2c722f4300b1c07cfc0503dbc94da60..ca9afab09fd02e6a79d48c3ae35277020f0cc9b1 100644 (file)
@@ -78,7 +78,7 @@ public:
      *
      * TODO: Move this code to the class InformationPanel
      */
-    void configureSettings(const QList<QAction*>& customContextMenuActions);
+    void configureSettings(const QList<QAction*>& customContextMenuActions, const QPointF& pos);
 
 signals:
     void urlActivated( const QUrl& url );