[gtk+/wip/otte/gtk4: 15/127] shooter: Use root window size instead of screen size
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/otte/gtk4: 15/127] shooter: Use root window size instead of screen size
- Date: Sat, 8 Oct 2016 03:11:27 +0000 (UTC)
commit 86afaeff1cf00aa627172d5c897bccf687b16e9d
Author: Benjamin Otte <otte redhat com>
Date: Tue Sep 6 01:24:13 2016 +0200
shooter: Use root window size instead of screen size
Avoids usage deprecated screen size.
docs/tools/shooter.c | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/docs/tools/shooter.c b/docs/tools/shooter.c
index 8cefa8b..8ce1dfc 100644
--- a/docs/tools/shooter.c
+++ b/docs/tools/shooter.c
@@ -136,7 +136,7 @@ static GdkPixbuf *
take_window_shot (Window child,
DecorationType decor)
{
- GdkWindow *window;
+ GdkWindow *window, *root_window;
Window xid;
gint x_orig, y_orig;
gint x = 0, y = 0;
@@ -151,6 +151,7 @@ take_window_shot (Window child,
xid = child;
window = gdk_x11_window_foreign_new_for_display (gdk_display_get_default (), xid);
+ root_window = gdk_screen_get_root_window (gdk_window_get_screen (window));
width = gdk_window_get_width (window);
height = gdk_window_get_height (window);
@@ -170,11 +171,11 @@ take_window_shot (Window child,
y_orig = 0;
}
- if (x_orig + width > gdk_screen_width ())
- width = gdk_screen_width () - x_orig;
+ if (x_orig + width > gdk_window_get_width (root_window))
+ width = gdk_window_get_width (root_window) - x_orig;
- if (y_orig + height > gdk_screen_height ())
- height = gdk_screen_height () - y_orig;
+ if (y_orig + height > gdk_window_get_height (root_window))
+ height = gdk_window_get_height (root_window) - y_orig;
tmp = gdk_pixbuf_get_from_window (window,
x, y, width, height);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]