2006-09-12 Michael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
[hildon] / hildon-widgets / hildon-program.c
index 798d134..640ed79 100644 (file)
@@ -1,14 +1,14 @@
 /*
  * This file is part of hildon-libs
  *
- * Copyright (C) 2006 Nokia Corporation.
+ * Copyright (C) 2006 Nokia Corporation, all rights reserved.
  *
- * Contact: Luc Pionchon <luc.pionchon@nokia.com>
+ * Contact: Michael Dominic Kostrzewa <michael.kostrzewa@nokia.com>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
+ * as published by the Free Software Foundation; version 2.1 of
+ * the License or any later version.
  *
  * This library is distributed in the hope that it will be useful, but
  * WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -250,26 +250,28 @@ hildon_program_update_top_most (HildonProgram *program)
     
     active_window = hildon_window_get_active_window();
 
-    wm_hints = XGetWMHints (GDK_DISPLAY (), active_window);
-
-    if (wm_hints)
+    if (active_window)
     {
+      wm_hints = XGetWMHints (GDK_DISPLAY (), active_window);
 
-        if (wm_hints->window_group == priv->window_group)
-        {
-            if (!priv->is_topmost)
-            {
-                priv->is_topmost = TRUE;
-                g_object_notify (G_OBJECT (program), "is-topmost");
-            }
-        }
-        else if (priv->is_topmost)
-        {
+      if (wm_hints)
+      {
+
+          if (wm_hints->window_group == priv->window_group)
+          {
+              if (!priv->is_topmost)
+              {
+                  priv->is_topmost = TRUE;
+                  g_object_notify (G_OBJECT (program), "is-topmost");
+              }
+          }
+          else if (priv->is_topmost)
+          {
             priv->is_topmost = FALSE;
             g_object_notify (G_OBJECT (program), "is-topmost");
-        }
-
-        XFree (wm_hints);
+          }
+      }
+      XFree (wm_hints);
     }
 
     /* Check each window if it was is_topmost */