summaryrefslogtreecommitdiff
path: root/libmate-panel-applet/mate-panel-applet.c
diff options
context:
space:
mode:
authorPablo Barciela <[email protected]>2017-12-07 01:37:08 +0100
committerraveit65 <[email protected]>2017-12-17 12:22:49 +0100
commit10b38211e032738593dfe71176289c275956b476 (patch)
tree26b8b3026ca845e790439449f720c5611747f9ec /libmate-panel-applet/mate-panel-applet.c
parent54a0b4dcb0b2462eea51cdbcbe8306f25e8e4cea (diff)
downloadmate-panel-10b38211e032738593dfe71176289c275956b476.tar.bz2
mate-panel-10b38211e032738593dfe71176289c275956b476.tar.xz
WidthOfScreen and HeightOfScreen implementation
This commit reverts: https://github.com/mate-desktop/mate-panel/commit/7b2bc7d9f98c6ba8c2c31bdf9605faadb42a7e0e And it applies an alternative to fix the deprecated functions: gdk_screen_get_width gdk_screen_get_height
Diffstat (limited to 'libmate-panel-applet/mate-panel-applet.c')
-rw-r--r--libmate-panel-applet/mate-panel-applet.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/libmate-panel-applet/mate-panel-applet.c b/libmate-panel-applet/mate-panel-applet.c
index b60ca71c..6b6d58fb 100644
--- a/libmate-panel-applet/mate-panel-applet.c
+++ b/libmate-panel-applet/mate-panel-applet.c
@@ -796,8 +796,6 @@ mate_panel_applet_position_menu (GtkMenu *menu,
int menu_y = 0;
int pointer_x;
int pointer_y;
- int screen_width;
- int screen_height;
g_return_if_fail (PANEL_IS_APPLET (widget));
@@ -821,9 +819,6 @@ mate_panel_applet_position_menu (GtkMenu *menu,
menu_x += allocation.x;
menu_y += allocation.y;
- gdk_window_get_geometry (gdk_screen_get_root_window (screen), NULL, NULL,
- &screen_width, &screen_height);
-
if (applet->priv->orient == MATE_PANEL_APPLET_ORIENT_UP ||
applet->priv->orient == MATE_PANEL_APPLET_ORIENT_DOWN) {
if (gtk_widget_get_direction (GTK_WIDGET (menu)) != GTK_TEXT_DIR_RTL) {
@@ -839,9 +834,9 @@ mate_panel_applet_position_menu (GtkMenu *menu,
allocation.width - requisition.width);
}
}
- menu_x = MIN (menu_x, screen_width - requisition.width);
+ menu_x = MIN (menu_x, WidthOfScreen (gdk_x11_screen_get_xscreen (screen)) - requisition.width);
- if (menu_y > screen_height / 2)
+ if (menu_y > HeightOfScreen (gdk_x11_screen_get_xscreen (screen)) / 2)
menu_y -= requisition.height;
else
menu_y += allocation.height;
@@ -849,9 +844,9 @@ mate_panel_applet_position_menu (GtkMenu *menu,
if (pointer_y < allocation.height &&
requisition.height < pointer_y)
menu_y += MIN (pointer_y, allocation.height - requisition.height);
- menu_y = MIN (menu_y, screen_height - requisition.height);
+ menu_y = MIN (menu_y, HeightOfScreen (gdk_x11_screen_get_xscreen (screen)) - requisition.height);
- if (menu_x > screen_width / 2)
+ if (menu_x > WidthOfScreen (gdk_x11_screen_get_xscreen (screen)) / 2)
menu_x -= requisition.width;
else
menu_x += allocation.width;