diff options
author | infirit <[email protected]> | 2014-06-02 22:42:37 +0200 |
---|---|---|
committer | infirit <[email protected]> | 2014-06-02 22:42:37 +0200 |
commit | 9bf73874d45075aad80303e9c0ee96cdc9f3c450 (patch) | |
tree | 1be1670be2ea9e872cd4c444652ff697b2753726 | |
parent | 53a1fe800f9f0c90dc298ba228b29852147794bb (diff) | |
download | mate-applets-9bf73874d45075aad80303e9c0ee96cdc9f3c450.tar.bz2 mate-applets-9bf73874d45075aad80303e9c0ee96cdc9f3c450.tar.xz |
Cleanup GTK_CHECK_VERSION and unify where possible
gdk_x11_window_foreign_new_for_display | since 2.24
gdk_window_get_width | since 2.24
gdk_window_get_height | since 2.24
gdk_x11_display_get_xdisplay | since 2.2
gdk_window_get_display | since 2.24
gdk_x11_window_foreign_new_for_display | since 2.24
GDK_WINDOW_XID | since always
GDK_SCREEN_XDISPLAY | since always
-rw-r--r-- | battstat/battstat_applet.c | 4 | ||||
-rw-r--r-- | stickynotes/stickynotes.c | 9 | ||||
-rw-r--r-- | stickynotes/stickynotes_applet_callbacks.c | 9 | ||||
-rw-r--r-- | stickynotes/util.c | 10 | ||||
-rw-r--r-- | trashapplet/src/xstuff.c | 33 |
5 files changed, 15 insertions, 50 deletions
diff --git a/battstat/battstat_applet.c b/battstat/battstat_applet.c index 25a83d06..1c9d10c9 100644 --- a/battstat/battstat_applet.c +++ b/battstat/battstat_applet.c @@ -1004,12 +1004,8 @@ copy_gdk_pixmap( GdkPixmap *src, GdkGC *gc ) gint height, width; GdkPixmap *dest; - #if GTK_CHECK_VERSION(3, 0, 0) width = gdk_window_get_width(GDK_WINDOW(src)); height = gdk_window_get_height(GDK_WINDOW(src)); - #else - gdk_drawable_get_size(GDK_DRAWABLE(src), &width, &height); - #endif dest = gdk_pixmap_new( GDK_DRAWABLE( src ), width, height, -1 ); diff --git a/stickynotes/stickynotes.c b/stickynotes/stickynotes.c index 77439795..2a2cad17 100644 --- a/stickynotes/stickynotes.c +++ b/stickynotes/stickynotes.c @@ -54,12 +54,7 @@ set_icon_geometry (GdkWindow *window, int height) { gulong data[4]; -#if GTK_CHECK_VERSION (3, 0, 0) Display *dpy = gdk_x11_display_get_xdisplay (gdk_window_get_display (window)); -#else - Display *dpy = gdk_x11_drawable_get_xdisplay (window); -#endif - data[0] = x; data[1] = y; data[2] = width; @@ -68,11 +63,7 @@ set_icon_geometry (GdkWindow *window, XChangeProperty (dpy, GDK_WINDOW_XID (window), gdk_x11_get_xatom_by_name_for_display ( -#if GTK_CHECK_VERSION (3, 0, 0) gdk_window_get_display (window), -#else - gdk_drawable_get_display (window), -#endif "_NET_WM_ICON_GEOMETRY"), XA_CARDINAL, 32, PropModeReplace, (guchar *)&data, 4); diff --git a/stickynotes/stickynotes_applet_callbacks.c b/stickynotes/stickynotes_applet_callbacks.c index 6efece25..038509eb 100644 --- a/stickynotes/stickynotes_applet_callbacks.c +++ b/stickynotes/stickynotes_applet_callbacks.c @@ -168,14 +168,9 @@ void install_check_click_on_desktop (void) return; } -#if GTK_CHECK_VERSION (3, 0, 0) /* Access the desktop window. desktop_window is the root window for the * default screen, so we know using gdk_display_get_default() is correct. */ window = gdk_x11_window_foreign_new_for_display (gdk_display_get_default (), desktop_window); -#else - /* Access the desktop window */ - window = gdk_window_foreign_new (desktop_window); -#endif /* It may contain an atom to tell us which other window to monitor */ user_time_window = gdk_x11_get_xatom_by_name ("_NET_WM_USER_TIME_WINDOW"); @@ -203,11 +198,7 @@ void install_check_click_on_desktop (void) { /* We have another window to monitor */ desktop_window = *data; -#if GTK_CHECK_VERSION (3, 0, 0) window = gdk_x11_window_foreign_new_for_display (gdk_window_get_display (window), desktop_window); -#else - window = gdk_window_foreign_new (desktop_window); -#endif } } } diff --git a/stickynotes/util.c b/stickynotes/util.c index 6748c7fc..9f395093 100644 --- a/stickynotes/util.c +++ b/stickynotes/util.c @@ -28,10 +28,6 @@ #include <gdk/gdkx.h> #include <gtk/gtk.h> -#if GTK_CHECK_VERSION (3, 0, 0) -#define GDK_WINDOW_XWINDOW GDK_WINDOW_XID -#endif - /* Returns the current date in a customizable form, the default * looks like this: "Nov 30, '78" */ gchar * get_current_date(const gchar *format) @@ -92,9 +88,9 @@ xstuff_get_current_workspace (GtkWindow *window) int retval; Display *gdk_display; - root_window = GDK_WINDOW_XWINDOW (gdk_screen_get_root_window ( + root_window = GDK_WINDOW_XID (gdk_screen_get_root_window ( gtk_widget_get_screen (GTK_WIDGET (window)))); - root_window = GDK_WINDOW_XWINDOW (gtk_widget_get_window (GTK_WIDGET (window))); + root_window = GDK_WINDOW_XID (gtk_widget_get_window (GTK_WIDGET (window))); gdk_display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); gdk_error_trap_push (); @@ -129,7 +125,7 @@ xstuff_change_workspace (GtkWindow *window, Screen *screen; gdk_display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); - xwindow = GDK_WINDOW_XWINDOW (GDK_WINDOW (gtk_widget_get_window (GTK_WIDGET (window)))); + xwindow = GDK_WINDOW_XID (GDK_WINDOW (gtk_widget_get_window (GTK_WIDGET (window)))); screen = GDK_SCREEN_XSCREEN (gtk_widget_get_screen (GTK_WIDGET (window))); xev.xclient.type = ClientMessage; diff --git a/trashapplet/src/xstuff.c b/trashapplet/src/xstuff.c index 75ae8eb3..62f7c6bc 100644 --- a/trashapplet/src/xstuff.c +++ b/trashapplet/src/xstuff.c @@ -24,11 +24,6 @@ #include "xstuff.h" -#if GTK_CHECK_VERSION (3, 0, 0) -#define GDK_WINDOW_XWINDOW(x) GDK_WINDOW_XID(x) -#define gdk_x11_drawable_get_xid(x) GDK_WINDOW_XID(x) -#endif - static Atom panel_atom_get (const char *atom_name) { @@ -162,7 +157,7 @@ xstuff_is_compliant_wm (void) int size; xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()); - root_window = GDK_WINDOW_XWINDOW ( + root_window = GDK_WINDOW_XID ( gdk_get_default_root_window ()); /* FIXME this is totally broken; should be using @@ -197,11 +192,11 @@ xstuff_set_no_group (GdkWindow *win) XWMHints wmhints = {0}; XDeleteProperty (GDK_WINDOW_XDISPLAY (win), - GDK_WINDOW_XWINDOW (win), + GDK_WINDOW_XID (win), panel_atom_get ("WM_CLIENT_LEADER")); old_wmhints = XGetWMHints (GDK_WINDOW_XDISPLAY (win), - GDK_WINDOW_XWINDOW (win)); + GDK_WINDOW_XID (win)); /* General paranoia */ if (old_wmhints != NULL) { memcpy (&wmhints, old_wmhints, sizeof (XWMHints)); @@ -217,7 +212,7 @@ xstuff_set_no_group (GdkWindow *win) } XSetWMHints (GDK_WINDOW_XDISPLAY (win), - GDK_WINDOW_XWINDOW (win), + GDK_WINDOW_XID (win), &wmhints); } @@ -250,7 +245,7 @@ xstuff_set_pos_size (GdkWindow *window, int x, int y, int w, int h) gdk_error_trap_push (); XSetWMNormalHints (GDK_WINDOW_XDISPLAY (window), - GDK_WINDOW_XWINDOW (window), + GDK_WINDOW_XID (window), &size_hints); gdk_window_move_resize (window, x, y, w, h); @@ -278,7 +273,7 @@ xstuff_set_wmspec_dock_hints (GdkWindow *window, } XChangeProperty (GDK_WINDOW_XDISPLAY (window), - GDK_WINDOW_XWINDOW (window), + GDK_WINDOW_XID (window), panel_atom_get ("_NET_WM_WINDOW_TYPE"), XA_ATOM, 32, PropModeReplace, (unsigned char *) atoms, @@ -300,7 +295,7 @@ xstuff_set_wmspec_strut (GdkWindow *window, vals [3] = bottom; XChangeProperty (GDK_WINDOW_XDISPLAY (window), - GDK_WINDOW_XWINDOW (window), + GDK_WINDOW_XID (window), panel_atom_get ("_NET_WM_STRUT"), XA_CARDINAL, 32, PropModeReplace, (unsigned char *) vals, 4); @@ -310,7 +305,7 @@ void xstuff_delete_property (GdkWindow *window, const char *name) { Display *xdisplay = GDK_WINDOW_XDISPLAY (window); - Window xwindow = GDK_WINDOW_XWINDOW (window); + Window xwindow = GDK_WINDOW_XID (window); XDeleteProperty (xdisplay, xwindow, panel_atom_get (name)); @@ -342,7 +337,7 @@ draw_zoom_animation (GdkScreen *gscreen, int depth; dpy = gdk_x11_display_get_xdisplay (gdk_screen_get_display (gscreen)); - root_win = gdk_x11_drawable_get_xid (gdk_screen_get_root_window (gscreen)); + root_win = GDK_WINDOW_XID (gdk_screen_get_root_window (gscreen)); screen = gdk_screen_get_number (gscreen); #if GTK_CHECK_VERSION (3, 0, 0) depth = DefaultDepth(dpy,screen); @@ -495,15 +490,11 @@ xstuff_get_current_workspace (GdkScreen *screen) int result; int retval; - root_window = gdk_x11_drawable_get_xid ( + root_window = GDK_WINDOW_XID ( gdk_screen_get_root_window (screen)); gdk_error_trap_push (); -#if GTK_CHECK_VERSION (3, 0, 0) result = XGetWindowProperty (GDK_SCREEN_XDISPLAY (screen), -#else - result = XGetWindowProperty (gdk_display, -#endif root_window, panel_atom_get ("_NET_CURRENT_DESKTOP"), 0, G_MAXLONG, @@ -545,11 +536,11 @@ xstuff_grab_key_on_all_screens (int keycode, if (grab) XGrabKey (gdk_x11_display_get_xdisplay (display), keycode, modifiers, - gdk_x11_drawable_get_xid (root), + GDK_WINDOW_XID (root), True, GrabModeAsync, GrabModeAsync); else XUngrabKey (gdk_x11_display_get_xdisplay (display), keycode, modifiers, - gdk_x11_drawable_get_xid (root)); + GDK_WINDOW_XID (root)); } } |