summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZenWalker <[email protected]>2017-08-11 02:51:02 +0200
committerraveit65 <[email protected]>2017-08-18 08:16:06 +0200
commitf0541e3dfda29c26fe14c9c9117f95c49006c75c (patch)
treeb940028b4eeec173a8697ccf3bb79089a638d32f /src
parentd18c2fb4acb58c408c01700682b9922de86e8b2f (diff)
downloadmarco-f0541e3dfda29c26fe14c9c9117f95c49006c75c.tar.bz2
marco-f0541e3dfda29c26fe14c9c9117f95c49006c75c.tar.xz
avoid deprecated gdk_screen_width/height
Diffstat (limited to 'src')
-rw-r--r--src/tools/marco-window-demo.c17
-rw-r--r--src/ui/menu.c8
-rw-r--r--src/wm-tester/main.c10
3 files changed, 25 insertions, 10 deletions
diff --git a/src/tools/marco-window-demo.c b/src/tools/marco-window-demo.c
index ce4f3f73..97fdd31e 100644
--- a/src/tools/marco-window-demo.c
+++ b/src/tools/marco-window-demo.c
@@ -559,6 +559,8 @@ make_dock (int type)
GtkWidget *image;
GtkWidget *box;
GtkWidget *button;
+ int sc_width;
+ int sc_height;
g_return_if_fail (type != DOCK_ALL);
@@ -593,6 +595,9 @@ make_dock (int type)
gtk_container_add (GTK_CONTAINER (window), box);
+ gdk_window_get_geometry (gdk_screen_get_root_window (gdk_screen_get_default()),
+ NULL, NULL, &sc_width, &sc_height);
+
#define DOCK_SIZE 48
switch (type)
{
@@ -604,7 +609,7 @@ make_dock (int type)
break;
case DOCK_RIGHT:
gtk_widget_set_size_request (window, DOCK_SIZE, 400);
- gtk_window_move (GTK_WINDOW (window), gdk_screen_width () - DOCK_SIZE, 200);
+ gtk_window_move (GTK_WINDOW (window), sc_width - DOCK_SIZE, 200);
set_gtk_window_struts (window, 0, DOCK_SIZE, 0, 0);
gtk_window_set_title (GTK_WINDOW (window), "RightDock");
break;
@@ -616,7 +621,7 @@ make_dock (int type)
break;
case DOCK_BOTTOM:
gtk_widget_set_size_request (window, 600, DOCK_SIZE);
- gtk_window_move (GTK_WINDOW (window), 200, gdk_screen_height () - DOCK_SIZE);
+ gtk_window_move (GTK_WINDOW (window), 200, sc_height - DOCK_SIZE);
set_gtk_window_struts (window, 0, 0, 0, DOCK_SIZE);
gtk_window_set_title (GTK_WINDOW (window), "BottomDock");
break;
@@ -693,12 +698,16 @@ desktop_cb (GSimpleAction *action,
GtkWidget *window;
GtkWidget *label;
GdkRGBA desktop_color;
+ int sc_width;
+ int sc_height;
+
+ gdk_window_get_geometry (gdk_screen_get_root_window (gdk_screen_get_default()),
+ NULL, NULL, &sc_width, &sc_height);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
set_gtk_window_type (GTK_WINDOW (window), "_NET_WM_WINDOW_TYPE_DESKTOP");
gtk_window_set_title (GTK_WINDOW (window), "Desktop");
- gtk_widget_set_size_request (window,
- gdk_screen_width (), gdk_screen_height ());
+ gtk_widget_set_size_request (window, sc_width, sc_height);
gtk_window_move (GTK_WINDOW (window), 0, 0);
desktop_color.red = 0.32;
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)
diff --git a/src/wm-tester/main.c b/src/wm-tester/main.c
index 5a700955..b1cfac6f 100644
--- a/src/wm-tester/main.c
+++ b/src/wm-tester/main.c
@@ -117,14 +117,16 @@ evil_timeout (gpointer data)
GtkWidget *c;
int t;
GtkWidget *parent;
+ int sc_width, sc_height;
+
+ gdk_window_get_geometry (gdk_screen_get_root_window (gdk_screen_get_default()),
+ NULL, NULL, &sc_width, &sc_height);
w = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_move (GTK_WINDOW (w),
- g_random_int_range (0,
- gdk_screen_width ()),
- g_random_int_range (0,
- gdk_screen_height ()));
+ g_random_int_range (0, sc_width),
+ g_random_int_range (0, sc_height));
parent = NULL;