2009-03-30 Alberto Garcia <agarcia@igalia.com>
authorAlberto Garcia <agarcia@igalia.com>
Wed, 1 Apr 2009 10:13:52 +0000 (10:13 +0000)
committerAlberto Garcia <agarcia@igalia.com>
Wed, 1 Apr 2009 10:13:52 +0000 (10:13 +0000)
* src/hildon-defines.h: Define HILDON_WINDOW_TITLEBAR_HEIGHT

* src/hildon-banner.c
Change HILDON_BANNER_WINDOW_Y to HILDON_WINDOW_TITLEBAR_HEIGHT.
(hildon_banner_map)
Make sure that the banner is correctly placed the first time it's
shown.
(hildon_banner_check_position, -check_fullscreen_state):
Show the banner in the same place no matter if the window is in
fullscreen mode or not.

Fixes: NB#107386 (Odd stacking behaviour for information banners)

ChangeLog
src/hildon-banner.c
src/hildon-defines.h

index 6f70e24..7c2d7f2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2009-03-30  Alberto Garcia  <agarcia@igalia.com>
+
+       * src/hildon-defines.h: Define HILDON_WINDOW_TITLEBAR_HEIGHT
+
+       * src/hildon-banner.c
+       Change HILDON_BANNER_WINDOW_Y to HILDON_WINDOW_TITLEBAR_HEIGHT.
+       (hildon_banner_map)
+       Make sure that the banner is correctly placed the first time it's
+       shown.
+       (hildon_banner_check_position, -check_fullscreen_state):
+       Show the banner in the same place no matter if the window is in
+       fullscreen mode or not.
+
+       Fixes: NB#107386 (Odd stacking behaviour for information banners)
+
 2009-04-01  Claudio Saavedra  <csaavedra@igalia.com>
 
        * src/hildon-touch-selector.c (_default_print_func): reorder
index c6ddb4c..a57769d 100644 (file)
@@ -70,9 +70,7 @@
 
 #define                                         HILDON_BANNER_WINDOW_X 0
 
-#define                                         HILDON_BANNER_WINDOW_Y 73
-
-#define                                         HILDON_BANNER_WINDOW_FULLSCREEN_Y 20
+#define                                         HILDON_BANNER_WINDOW_Y HILDON_WINDOW_TITLEBAR_HEIGHT
 
 /* max widths */
 
@@ -112,9 +110,6 @@ static GtkWidget*                               global_timed_banner = NULL;
 static Window 
 get_current_app_window                          (void);
 
-static gboolean 
-check_fullscreen_state                          (Window window);
-
 static GQuark 
 hildon_banner_timed_quark                       (void);
 
@@ -229,53 +224,6 @@ get_current_app_window                          (void)
     return win_result;
 }
 
-/* Checks if a window is in fullscreen state or not. This
-   information is needed when banners are positioned on screen.
-   copy/paste from old infoprint implementation.  */
-static gboolean 
-check_fullscreen_state                          (Window window)
-{
-    unsigned long n;
-    unsigned long extra;
-    int format, status, i; 
-    guchar *data_return = NULL;
-
-    Atom realType;
-    Atom atom_window_state = gdk_x11_get_xatom_by_name ("_NET_WM_STATE");
-    Atom atom_fullscreen   = gdk_x11_get_xatom_by_name ("_NET_WM_STATE_FULLSCREEN");
-
-    if (window == None)
-        return FALSE;
-
-    /* in some cases XGetWindowProperty seems to generate BadWindow,
-       so at the moment this function does not always work perfectly */
-    gdk_error_trap_push ();
-    status = XGetWindowProperty (GDK_DISPLAY (), window,
-            atom_window_state, 0L, 1000000L,
-            0, XA_ATOM, &realType, &format,
-            &n, &extra, &data_return);
-
-    gdk_flush ();
-
-    if (gdk_error_trap_pop ())
-        return FALSE;
-
-    if (status == Success && realType == XA_ATOM && format == 32 && n > 0)
-    {
-        for (i=0; i < n; i++)
-            if  (((Atom*)data_return)[i] && ((Atom*)data_return)[i] == atom_fullscreen)
-            {
-                if (data_return) XFree (data_return);
-                return TRUE;
-            }
-    }
-
-    if (data_return) 
-        XFree (data_return);
-
-    return FALSE;
-}
-
 static GQuark 
 hildon_banner_timed_quark                       (void)
 {
@@ -605,6 +553,8 @@ hildon_banner_map                               (GtkWidget *widget)
         /* Make the banner non-temporary _after_ mapping it, to avoid
          * being closed by other non-temporary windows */
         gtk_window_set_is_temporary (GTK_WINDOW (widget), FALSE);
+
+        hildon_banner_check_position (widget);
     }
 }
 #endif
@@ -733,8 +683,7 @@ hildon_banner_check_position                    (GtkWidget *widget)
 
     x = HILDON_BANNER_WINDOW_X;
 
-    y = check_fullscreen_state (get_current_app_window ()) ? 
-        HILDON_BANNER_WINDOW_FULLSCREEN_Y : HILDON_BANNER_WINDOW_Y;
+    y = HILDON_BANNER_WINDOW_Y;
 
     gtk_window_move (GTK_WINDOW (widget), x, y);
 }
index 60947b3..bcfec6b 100644 (file)
@@ -90,6 +90,8 @@ G_BEGIN_DECLS
 
 #define                                         HILDON_MARGIN_TRIPLE 24
 
+#define                                         HILDON_WINDOW_TITLEBAR_HEIGHT 56
+
 /* Hard keys */
 
 #define                                         HILDON_HARDKEY_UP GDK_Up