]> git.0d.be Git - empathy.git/commitdiff
Create EMPATHY_RECT_IS_ON_SCREEN macro instead of duplicating its code.
authorXavier Claessens <xclaesse@gmail.com>
Mon, 23 Nov 2009 15:30:26 +0000 (16:30 +0100)
committerXavier Claessens <xclaesse@gmail.com>
Mon, 23 Nov 2009 16:04:29 +0000 (17:04 +0100)
libempathy-gtk/empathy-geometry.c
libempathy-gtk/empathy-ui-utils.c
libempathy-gtk/empathy-ui-utils.h

index b807425ea27c5fe95982520d0e4e9a6da6a4ca20..abf50d623cf7041e3f56238c9fbb6185a9171f63 100644 (file)
@@ -30,6 +30,7 @@
 
 #include "libempathy/empathy-utils.h"
 #include "empathy-geometry.h"
+#include "empathy-ui-utils.h"
 
 #define DEBUG_FLAG EMPATHY_DEBUG_OTHER
 #include <libempathy/empathy-debug.h>
@@ -147,9 +148,7 @@ empathy_geometry_save (GtkWindow *window,
   maximized = (window_state & GDK_WINDOW_STATE_MAXIMIZED) != 0;
 
   /* Don't save off-screen positioning */
-  if (x + w < 0 || y + h < 0 ||
-      x > gdk_screen_width () ||
-      y > gdk_screen_height ())
+  if (!EMPATHY_RECT_IS_ON_SCREEN (x, y, w, h))
     return;
 
   key_file = geometry_get_key_file ();
index be6aaa24998fa11d7eef4eacc39a810696520619..9ba01738df4d2909513ed0fb3122ebb095ada3e5 100644 (file)
@@ -1313,9 +1313,7 @@ empathy_window_present (GtkWindow *window,
                 * reposition on the current workspace. */
                gtk_window_get_position (window, &x, &y);
                gtk_window_get_size (window, &w, &h);
-               if (x + w < 0 || y + h < 0 ||
-                   x > gdk_screen_width () ||
-                   y > gdk_screen_height ())
+               if (!EMPATHY_RECT_IS_ON_SCREEN (x, y, w, h))
                        gtk_widget_hide (GTK_WIDGET (window));
        }
 
index 486301cb13a22ff5013898044d46e49105de7cd0..7bec0884e9e9f46990e5c3d6f875d1af2046a6c3 100644 (file)
 
 G_BEGIN_DECLS
 
+#define EMPATHY_RECT_IS_ON_SCREEN(x,y,w,h) ((x) + (w) > 0 && \
+                                           (y) + (h) > 0 && \
+                                           (x) < gdk_screen_width () && \
+                                           (y) < gdk_screen_height ())
+
 void            empathy_gtk_init                        (void);
 GRegex *        empathy_uri_regex_dup_singleton         (void);