[Xfce4-commits] [panel-plugins/xfce4-whiskermenu-plugin] 04/08: Fix menu position in mulithead.

noreply at xfce.org noreply at xfce.org
Sat Aug 20 18:33:39 CEST 2016


This is an automated email from the git hooks/post-receive script.

gottcode pushed a commit to annotated tag v1.0.3
in repository panel-plugins/xfce4-whiskermenu-plugin.

commit 6c1c614618f66eebf6d221003875dd556874332e
Author: Graeme Gott <graeme at gottcode.org>
Date:   Thu Jul 4 08:10:46 2013 -0400

    Fix menu position in mulithead.
---
 src/menu.cpp | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/src/menu.cpp b/src/menu.cpp
index a77c275..8c6d23b 100644
--- a/src/menu.cpp
+++ b/src/menu.cpp
@@ -224,18 +224,19 @@ void Menu::show(GtkWidget* parent, bool horizontal)
 
 	// Fetch parent geometry
 	GdkWindow* window = gtk_widget_get_window(parent);
+	GdkScreen* screen = gdk_window_get_screen(window);
 	int parent_x = 0, parent_y = 0;
 	gdk_window_get_origin(window, &parent_x, &parent_y);
 	int parent_w = gdk_window_get_width(window);
 	int parent_h = gdk_window_get_height(window);
 
 	// Fetch screen geomtry
-	GdkScreen* screen = gtk_widget_get_screen(GTK_WIDGET(m_window));
-	int root_w = gdk_screen_get_width(GDK_SCREEN(screen));
-	int root_h = gdk_screen_get_height(GDK_SCREEN(screen));
+	GdkRectangle monitor;
+	int monitor_num = gdk_screen_get_monitor_at_point(screen, parent_x, parent_y);
+	gdk_screen_get_monitor_geometry(screen, monitor_num, &monitor);
 
 	// Find window position
-	bool layout_left = ((2 * parent_x) + parent_w) < root_w;
+	bool layout_left = ((2 * (parent_x - monitor.x)) + parent_w) < monitor.width;
 	if (horizontal)
 	{
 		m_geometry.x = layout_left ? parent_x : (parent_x + parent_w - m_geometry.width);
@@ -245,7 +246,7 @@ void Menu::show(GtkWidget* parent, bool horizontal)
 		m_geometry.x = layout_left ? (parent_x + parent_w) : (parent_x - m_geometry.width);
 	}
 
-	bool layout_bottom = ((2 * parent_y) + parent_h) > root_h;
+	bool layout_bottom = ((2 * (parent_y - monitor.y)) + (parent_h / 2)) > monitor.height;
 	if (horizontal)
 	{
 		m_geometry.y = layout_bottom ? (parent_y - m_geometry.height) : (parent_y + parent_h);
@@ -256,10 +257,6 @@ void Menu::show(GtkWidget* parent, bool horizontal)
 	}
 
 	// Prevent window from leaving screen
-	GdkRectangle monitor;
-	int monitor_num = gdk_screen_get_monitor_at_window(screen, window);
-	gdk_screen_get_monitor_geometry(screen, monitor_num, &monitor);
-
 	int monitor_r = monitor.x + monitor.width;
 	if (m_geometry.x < monitor.x)
 	{

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list