summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZenWalker <[email protected]>2017-08-10 22:50:17 +0200
committerZenWalker <[email protected]>2017-08-10 22:50:17 +0200
commitd809e57c7b09f545f1cf847f514fa738d44ac2b3 (patch)
treef7b59fc3e9f1c04d7a3c8a2fe83e2fddd8201969
parent2f5515815c1f6c9b66f85d6ec228aad7aea0b441 (diff)
downloadmate-applets-d809e57c7b09f545f1cf847f514fa738d44ac2b3.tar.bz2
mate-applets-d809e57c7b09f545f1cf847f514fa738d44ac2b3.tar.xz
avoid deprecated gdk_screen_width/height
-rw-r--r--charpick/charpick.c36
1 files changed, 19 insertions, 17 deletions
diff --git a/charpick/charpick.c b/charpick/charpick.c
index 3b8846da..f7afc9f2 100644
--- a/charpick/charpick.c
+++ b/charpick/charpick.c
@@ -335,30 +335,32 @@ get_menu_pos (GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer data)
gint tempx, tempy, width, height;
gint screen_width, screen_height;
- gtk_widget_get_preferred_size (GTK_WIDGET (menu), NULL, &reqmenu);
+ gtk_widget_get_preferred_size (GTK_WIDGET (menu), NULL, &reqmenu);
gdk_window_get_origin (GDK_WINDOW (gtk_widget_get_window(curr_data->applet)), &tempx, &tempy);
gdk_window_get_geometry (GDK_WINDOW (gtk_widget_get_window(curr_data->applet)), NULL, NULL,
&width, &height
);
- switch (mate_panel_applet_get_orient (MATE_PANEL_APPLET (curr_data->applet))) {
- case MATE_PANEL_APPLET_ORIENT_DOWN:
- tempy += height;
- break;
- case MATE_PANEL_APPLET_ORIENT_UP:
- tempy -= reqmenu.height;
- break;
- case MATE_PANEL_APPLET_ORIENT_LEFT:
- tempx -= reqmenu.width;
+ switch (mate_panel_applet_get_orient (MATE_PANEL_APPLET (curr_data->applet))) {
+ case MATE_PANEL_APPLET_ORIENT_DOWN:
+ tempy += height;
break;
- case MATE_PANEL_APPLET_ORIENT_RIGHT:
- tempx += width;
+ case MATE_PANEL_APPLET_ORIENT_UP:
+ tempy -= reqmenu.height;
break;
- }
- screen_width = gdk_screen_width ();
- screen_height = gdk_screen_height ();
- *x = CLAMP (tempx, 0, MAX (0, screen_width - reqmenu.width));
- *y = CLAMP (tempy, 0, MAX (0, screen_height - reqmenu.height));
+ case MATE_PANEL_APPLET_ORIENT_LEFT:
+ tempx -= reqmenu.width;
+ break;
+ case MATE_PANEL_APPLET_ORIENT_RIGHT:
+ tempx += width;
+ break;
+ }
+
+ gdk_window_get_geometry (gdk_screen_get_root_window (gdk_screen_get_default()),
+ NULL, NULL, &screen_width, &screen_height);
+
+ *x = CLAMP (tempx, 0, MAX (0, screen_width - reqmenu.width));
+ *y = CLAMP (tempy, 0, MAX (0, screen_height - reqmenu.height));
}
static void