diff options
author | Pablo Barciela <[email protected]> | 2017-12-04 09:31:43 +0100 |
---|---|---|
committer | raveit65 <[email protected]> | 2017-12-20 20:40:01 +0100 |
commit | d094cf0297f28b826ca742379750567750dfee9f (patch) | |
tree | b360036c8649bdfc054ed1e7c0cb96be436b38b2 /src/ui/menu.c | |
parent | 202a8006e2b551ca909c7aa1b67720d699771df3 (diff) | |
download | marco-d094cf0297f28b826ca742379750567750dfee9f.tar.bz2 marco-d094cf0297f28b826ca742379750567750dfee9f.tar.xz |
WidthOfScreen and HeightOfScreen implementation
This commit reverts:
https://github.com/mate-desktop/marco/commit/f0541e3dfda29c26fe14c9c9117f95c49006c75c
https://github.com/mate-desktop/marco/commit/d18c2fb4acb58c408c01700682b9922de86e8b2f
And it applies an alternative to fix the deprecated functions:
gdk_screen_get_width
gdk_screen_width
gdk_screen_height
Diffstat (limited to 'src/ui/menu.c')
-rw-r--r-- | src/ui/menu.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/ui/menu.c b/src/ui/menu.c index d066ffcb..1bea9232 100644 --- a/src/ui/menu.c +++ b/src/ui/menu.c @@ -21,6 +21,7 @@ * 02110-1301, USA. */ +#include <gdk/gdkx.h> #include <config.h> #include <stdio.h> #include <string.h> @@ -103,7 +104,6 @@ static void popup_position_func(GtkMenu* menu, gint* x, gint* y, gboolean* push_ { GtkRequisition req; GdkPoint* pos; - int sc_width, sc_height; pos = user_data; @@ -117,12 +117,9 @@ static void popup_position_func(GtkMenu* menu, gint* x, gint* y, gboolean* push_ *x = MAX (0, *x - req.width); } - gdk_window_get_geometry (gdk_screen_get_root_window (gdk_screen_get_default()), - NULL, NULL, &sc_width, &sc_height); - /* Ensure onscreen */ - *x = CLAMP (*x, 0, MAX(0, sc_width - req.width)); - *y = CLAMP (*y, 0, MAX(0, sc_height - req.height)); + *x = CLAMP (*x, 0, MAX(0, WidthOfScreen (gdk_x11_screen_get_xscreen (gdk_screen_get_default ())) - req.width)); + *y = CLAMP (*y, 0, MAX(0, HeightOfScreen (gdk_x11_screen_get_xscreen (gdk_screen_get_default ())) - req.height)); } static void menu_closed(GtkMenu* widget, gpointer data) |