summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZenWalker <[email protected]>2017-08-09 23:02:31 +0200
committerZenWalker <[email protected]>2017-08-09 23:02:31 +0200
commit2f5515815c1f6c9b66f85d6ec228aad7aea0b441 (patch)
tree1b251baf28e2144e6de9036d0369bc7300acd4ab
parent16e4f93e81dadd64487d7ae5cd589972cf44a063 (diff)
downloadmate-applets-2f5515815c1f6c9b66f85d6ec228aad7aea0b441.tar.bz2
mate-applets-2f5515815c1f6c9b66f85d6ec228aad7aea0b441.tar.xz
avoid deprecated gdk_screen_get_width/height
-rw-r--r--cpufreq/src/cpufreq-applet.c11
-rw-r--r--stickynotes/stickynotes_applet.c7
2 files changed, 14 insertions, 4 deletions
diff --git a/cpufreq/src/cpufreq-applet.c b/cpufreq/src/cpufreq-applet.c
index a726e156..2021a365 100644
--- a/cpufreq/src/cpufreq-applet.c
+++ b/cpufreq/src/cpufreq-applet.c
@@ -414,6 +414,8 @@ cpufreq_applet_popup_position_menu (GtkMenu *menu,
GtkAllocation allocation;
gint menu_xpos;
gint menu_ypos;
+ gint sc_width;
+ gint sc_height;
widget = GTK_WIDGET (gdata);
@@ -421,7 +423,10 @@ cpufreq_applet_popup_position_menu (GtkMenu *menu,
gdk_window_get_origin (gtk_widget_get_window (widget), &menu_xpos, &menu_ypos);
- gtk_widget_get_allocation (widget, &allocation);
+ gtk_widget_get_allocation (widget, &allocation);
+
+ gdk_window_get_geometry (gdk_screen_get_root_window (gtk_widget_get_screen (widget)), NULL, NULL,
+ &sc_width, &sc_height);
menu_xpos += allocation.x;
menu_ypos += allocation.y;
@@ -429,14 +434,14 @@ cpufreq_applet_popup_position_menu (GtkMenu *menu,
switch (mate_panel_applet_get_orient (MATE_PANEL_APPLET (widget))) {
case MATE_PANEL_APPLET_ORIENT_DOWN:
case MATE_PANEL_APPLET_ORIENT_UP:
- if (menu_ypos > gdk_screen_get_height (gtk_widget_get_screen (widget)) / 2)
+ if (menu_ypos > sc_height / 2)
menu_ypos -= requisition.height;
else
menu_ypos += allocation.height;
break;
case MATE_PANEL_APPLET_ORIENT_RIGHT:
case MATE_PANEL_APPLET_ORIENT_LEFT:
- if (menu_xpos > gdk_screen_get_width (gtk_widget_get_screen (widget)) / 2)
+ if (menu_xpos > sc_width / 2)
menu_xpos -= requisition.width;
else
menu_xpos += allocation.width;
diff --git a/stickynotes/stickynotes_applet.c b/stickynotes/stickynotes_applet.c
index 6f39b78b..2f1b4b76 100644
--- a/stickynotes/stickynotes_applet.c
+++ b/stickynotes/stickynotes_applet.c
@@ -154,6 +154,8 @@ stickynotes_destroy (GtkWidget *widget,
void
stickynotes_applet_init (MatePanelApplet *mate_panel_applet)
{
+ gint sc_height;
+
stickynotes = g_new(StickyNotes, 1);
stickynotes->notes = NULL;
@@ -189,7 +191,10 @@ stickynotes_applet_init (MatePanelApplet *mate_panel_applet)
G_CALLBACK (preferences_apply_cb), NULL);
/* Max height for large notes*/
- stickynotes->max_height = 0.8*gdk_screen_get_height( gdk_screen_get_default() );
+ gdk_window_get_geometry (gdk_screen_get_root_window (gdk_screen_get_default()), NULL, NULL,
+ NULL, &sc_height);
+
+ stickynotes->max_height = 0.8 * sc_height;
/* Load sticky notes */
stickynotes_load (gtk_widget_get_screen (GTK_WIDGET (mate_panel_applet)));