diff options
author | ZenWalker <[email protected]> | 2017-08-07 20:33:08 +0200 |
---|---|---|
committer | lukefromdc <[email protected]> | 2017-08-13 14:34:57 -0400 |
commit | 7b2bc7d9f98c6ba8c2c31bdf9605faadb42a7e0e (patch) | |
tree | b463e4d5b37eaf2e9c34b8b536c2164a6aab5a5b | |
parent | 8a8ca9c24c7b4d9bec8666dd9a17c5541106bd7e (diff) | |
download | mate-panel-7b2bc7d9f98c6ba8c2c31bdf9605faadb42a7e0e.tar.bz2 mate-panel-7b2bc7d9f98c6ba8c2c31bdf9605faadb42a7e0e.tar.xz |
avoid deprecated gdk_screen_get_width/height
-rw-r--r-- | applets/clock/clock.c | 5 | ||||
-rw-r--r-- | applets/fish/fish.c | 4 | ||||
-rw-r--r-- | applets/notification_area/system-tray/fixedtip.c | 4 | ||||
-rw-r--r-- | libmate-panel-applet/mate-panel-applet.c | 13 | ||||
-rw-r--r-- | mate-panel/applet.c | 13 | ||||
-rw-r--r-- | mate-panel/panel-addto.c | 5 | ||||
-rw-r--r-- | mate-panel/panel-force-quit.c | 4 | ||||
-rw-r--r-- | mate-panel/panel-struts.c | 4 | ||||
-rw-r--r-- | mate-panel/panel-toplevel.c | 9 |
9 files changed, 40 insertions, 21 deletions
diff --git a/applets/clock/clock.c b/applets/clock/clock.c index a1c16159..0a325b63 100644 --- a/applets/clock/clock.c +++ b/applets/clock/clock.c @@ -914,8 +914,9 @@ position_calendar_popup (ClockData *cd) monitors */ monitor.x = 0; monitor.y = 0; - monitor.width = gdk_screen_get_width (screen); - monitor.height = gdk_screen_get_height (screen); + + gdk_window_get_geometry (gdk_screen_get_root_window (screen), NULL, NULL, + &monitor.width, &monitor.height); } /* Based on panel orientation, position the popup. diff --git a/applets/fish/fish.c b/applets/fish/fish.c index f434f8a5..95faf402 100644 --- a/applets/fish/fish.c +++ b/applets/fish/fish.c @@ -856,8 +856,8 @@ static void display_fortune_dialog(FishApplet* fish) screen = gtk_widget_get_screen (GTK_WIDGET (fish)); - screen_width = gdk_screen_get_width (screen); - screen_height = gdk_screen_get_height (screen); + gdk_window_get_geometry (gdk_screen_get_root_window (screen), NULL, NULL, + &screen_width, &screen_height); gtk_window_set_default_size (GTK_WINDOW (fish->fortune_dialog), MIN (600, screen_width * 0.9), diff --git a/applets/notification_area/system-tray/fixedtip.c b/applets/notification_area/system-tray/fixedtip.c index 6356de9b..eca42a3f 100644 --- a/applets/notification_area/system-tray/fixedtip.c +++ b/applets/notification_area/system-tray/fixedtip.c @@ -158,8 +158,8 @@ na_fixed_tip_position (NaFixedTip *fixedtip) parent_width = gdk_window_get_width(parent_window); parent_height = gdk_window_get_height(parent_window); - screen_width = gdk_screen_get_width (screen); - screen_height = gdk_screen_get_height (screen); + gdk_window_get_geometry (gdk_screen_get_root_window (screen), NULL, NULL, + &screen_width, &screen_height); /* pad between panel and message window */ #define PAD 5 diff --git a/libmate-panel-applet/mate-panel-applet.c b/libmate-panel-applet/mate-panel-applet.c index 3bbaab82..e4a61cf2 100644 --- a/libmate-panel-applet/mate-panel-applet.c +++ b/libmate-panel-applet/mate-panel-applet.c @@ -792,6 +792,8 @@ 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)); @@ -815,6 +817,9 @@ 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) { @@ -830,9 +835,9 @@ mate_panel_applet_position_menu (GtkMenu *menu, allocation.width - requisition.width); } } - menu_x = MIN (menu_x, gdk_screen_get_width (screen) - requisition.width); + menu_x = MIN (menu_x, screen_width - requisition.width); - if (menu_y > gdk_screen_get_height (screen) / 2) + if (menu_y > screen_height / 2) menu_y -= requisition.height; else menu_y += allocation.height; @@ -840,9 +845,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, gdk_screen_get_height (screen) - requisition.height); + menu_y = MIN (menu_y, screen_height - requisition.height); - if (menu_x > gdk_screen_get_width (screen) / 2) + if (menu_x > screen_width / 2) menu_x -= requisition.width; else menu_x += allocation.width; diff --git a/mate-panel/applet.c b/mate-panel/applet.c index 9ed853fd..85fd3ac1 100644 --- a/mate-panel/applet.c +++ b/mate-panel/applet.c @@ -641,6 +641,8 @@ mate_panel_applet_position_menu (GtkMenu *menu, int menu_y = 0; int pointer_x; int pointer_y; + int screen_width; + int screen_height; parent = gtk_widget_get_parent (applet); @@ -665,6 +667,9 @@ mate_panel_applet_position_menu (GtkMenu *menu, menu_y += allocation.y; } + gdk_window_get_geometry (gdk_screen_get_root_window (screen), NULL, NULL, + &screen_width, &screen_height); + if (PANEL_WIDGET (parent)->orient == GTK_ORIENTATION_HORIZONTAL) { if (gtk_widget_get_direction (GTK_WIDGET (menu)) != GTK_TEXT_DIR_RTL) { if (pointer_x < allocation.width && @@ -679,9 +684,9 @@ mate_panel_applet_position_menu (GtkMenu *menu, allocation.width - requisition.width); } } - menu_x = MIN (menu_x, gdk_screen_get_width (screen) - requisition.width); + menu_x = MIN (menu_x, screen_width - requisition.width); - if (menu_y > gdk_screen_get_height (screen) / 2) + if (menu_y > screen_height / 2) menu_y -= requisition.height; else menu_y += allocation.height; @@ -689,9 +694,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, gdk_screen_get_height (screen) - requisition.height); + menu_y = MIN (menu_y, screen_height - requisition.height); - if (menu_x > gdk_screen_get_width (screen) / 2) + if (menu_x > screen_width / 2) menu_x -= requisition.width; else menu_x += allocation.width; diff --git a/mate-panel/panel-addto.c b/mate-panel/panel-addto.c index 7f9a3f6e..2e2ff712 100644 --- a/mate-panel/panel-addto.c +++ b/mate-panel/panel-addto.c @@ -1373,7 +1373,10 @@ panel_addto_present (GtkMenuItem *item, panel_addto_dialog_quark); screen = gtk_window_get_screen (GTK_WINDOW (toplevel)); - screen_height = gdk_screen_get_height (screen); + + gdk_window_get_geometry (gdk_screen_get_root_window (screen), NULL, NULL, + NULL, &screen_height); + height = MIN (MAX_ADDTOPANEL_HEIGHT, 3 * (screen_height / 4)); if (!dialog) { diff --git a/mate-panel/panel-force-quit.c b/mate-panel/panel-force-quit.c index 8f99d5f1..71ec4f8c 100644 --- a/mate-panel/panel-force-quit.c +++ b/mate-panel/panel-force-quit.c @@ -86,8 +86,8 @@ display_popup_window (GdkScreen *screen) gtk_widget_realize (retval); - screen_width = gdk_screen_get_width (screen); - screen_height = gdk_screen_get_height (screen); + gdk_window_get_geometry (gdk_screen_get_root_window (screen), NULL, NULL, + &screen_width, &screen_height); gtk_widget_get_allocation (retval, &allocation); diff --git a/mate-panel/panel-struts.c b/mate-panel/panel-struts.c index e83ede10..76e5c655 100644 --- a/mate-panel/panel-struts.c +++ b/mate-panel/panel-struts.c @@ -268,8 +268,8 @@ panel_struts_set_window_hint (PanelToplevel *toplevel) strut_size = strut->allocated_strut_size; - screen_width = gdk_screen_get_width (strut->screen); - screen_height = gdk_screen_get_height (strut->screen); + gdk_window_get_geometry (gdk_screen_get_root_window (strut->screen), NULL, NULL, + &screen_width, &screen_height); panel_struts_get_monitor_geometry (strut->screen, strut->monitor, diff --git a/mate-panel/panel-toplevel.c b/mate-panel/panel-toplevel.c index badc595d..8d257a41 100644 --- a/mate-panel/panel-toplevel.c +++ b/mate-panel/panel-toplevel.c @@ -277,14 +277,19 @@ gboolean panel_toplevel_is_last_unattached(PanelToplevel* toplevel) static GdkScreen* panel_toplevel_get_screen_geometry(PanelToplevel* toplevel, int* width, int* height) { GdkScreen* screen; + gint screen_width; + gint screen_height; g_return_val_if_fail(PANEL_IS_TOPLEVEL (toplevel), NULL); g_return_val_if_fail(width != NULL && height != NULL, NULL); screen = gtk_window_get_screen(GTK_WINDOW(toplevel)); - *width = gdk_screen_get_width(screen); - *height = gdk_screen_get_height(screen); + gdk_window_get_geometry (gdk_screen_get_root_window (screen), NULL, NULL, + &screen_width, &screen_height); + + *width = screen_width; + *height = screen_height; return screen; } |