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

noreply at xfce.org noreply at xfce.org
Mon Feb 16 23:53:54 CET 2015


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

gottcode pushed a commit to branch master
in repository panel-plugins/xfce4-whiskermenu-plugin.

commit 195e6177c2d0e520f400a12cefc9353fcb7cd9ea
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 2680d98..7e32008 100644
--- a/src/menu.cpp
+++ b/src/menu.cpp
@@ -248,17 +248,18 @@ void Menu::show(GtkWidget* parent, bool horizontal)
 		gtk_widget_realize(parent);
 	}
 	GdkWindow* window = gtk_widget_get_window(parent);
+	GdkScreen* screen = gdk_window_get_screen(window);
 	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);
@@ -268,7 +269,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);
@@ -279,10 +280,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