diff options
author | ZenWalker <[email protected]> | 2017-08-11 02:51:02 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2017-08-18 08:16:06 +0200 |
commit | f0541e3dfda29c26fe14c9c9117f95c49006c75c (patch) | |
tree | b940028b4eeec173a8697ccf3bb79089a638d32f /src/ui | |
parent | d18c2fb4acb58c408c01700682b9922de86e8b2f (diff) | |
download | marco-f0541e3dfda29c26fe14c9c9117f95c49006c75c.tar.bz2 marco-f0541e3dfda29c26fe14c9c9117f95c49006c75c.tar.xz |
avoid deprecated gdk_screen_width/height
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/menu.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/ui/menu.c b/src/ui/menu.c index 58ed1704..d066ffcb 100644 --- a/src/ui/menu.c +++ b/src/ui/menu.c @@ -103,6 +103,7 @@ 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; @@ -116,9 +117,12 @@ 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, gdk_screen_width() - req.width)); - *y = CLAMP (*y, 0, MAX(0, gdk_screen_height() - req.height)); + *x = CLAMP (*x, 0, MAX(0, sc_width - req.width)); + *y = CLAMP (*y, 0, MAX(0, sc_height - req.height)); } static void menu_closed(GtkMenu* widget, gpointer data) |