[PATCH 3/3] kernel-shark-qt: Make the Quick Contex menu less touchy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The menu is shifted just a bit so that it is not positioned under
the mouse. This will prevent from an accidental selection of the menu
item under the mouse.

Reported-by: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx>
Signed-off-by: Yordan Karadzhov <ykaradzhov@xxxxxxxxxx>
---
 kernel-shark-qt/src/KsTraceGraph.cpp  | 7 +++++++
 kernel-shark-qt/src/KsTraceViewer.cpp | 7 +++++++
 2 files changed, 14 insertions(+)

diff --git a/kernel-shark-qt/src/KsTraceGraph.cpp b/kernel-shark-qt/src/KsTraceGraph.cpp
index 5144f61..462918f 100644
--- a/kernel-shark-qt/src/KsTraceGraph.cpp
+++ b/kernel-shark-qt/src/KsTraceGraph.cpp
@@ -791,6 +791,13 @@ void KsTraceGraph::_onCustomContextMenu(const QPoint &point)
 		QPoint global = _glWindow.mapToGlobal(point);
 		global.ry() -= menu->sizeHint().height() / 2;
 
+		/*
+		 * Shift the menu so that it is not positioned under the mouse.
+		 * This will prevent from an accidental selection of the menu
+		 * item under the mouse.
+		 */
+		global.rx() += FONT_WIDTH;
+
 		menu->exec(global);
 	}
 }
diff --git a/kernel-shark-qt/src/KsTraceViewer.cpp b/kernel-shark-qt/src/KsTraceViewer.cpp
index 09f6a1e..d64c2af 100644
--- a/kernel-shark-qt/src/KsTraceViewer.cpp
+++ b/kernel-shark-qt/src/KsTraceViewer.cpp
@@ -272,6 +272,13 @@ void KsTraceViewer::_onCustomContextMenu(const QPoint &point)
 		QPoint global = _view.mapToGlobal(point);
 		global.ry() -= menu.sizeHint().height() / 2;
 
+		/*
+		 * Shift the menu so that it is not positioned under the mouse.
+		 * This will prevent from an accidental selection of the menu
+		 * item under the mouse.
+		 */
+		global.rx() += FONT_WIDTH;
+
 		connect(&menu,	&KsQuickContextMenu::addTaskPlot,
 			this,	&KsTraceViewer::addTaskPlot);
 
-- 
2.17.1





[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux