← Back to team overview

ayatana-commits team mailing list archive

[Merge] lp:~ted/indicator-appmenu/right-array-type into lp:indicator-appmenu

 

Ted Gould has proposed merging lp:~ted/indicator-appmenu/right-array-type into lp:indicator-appmenu.

Requested reviews:
  Indicator Applet Developers (indicator-applet-developers)


Fixing the type on the array so the entry gets returned.
-- 
https://code.launchpad.net/~ted/indicator-appmenu/right-array-type/+merge/35745
Your team ayatana-commits is subscribed to branch lp:indicator-appmenu.
=== modified file 'src/gdk-get-func.c'
--- src/gdk-get-func.c	2010-06-25 02:30:47 +0000
+++ src/gdk-get-func.c	2010-09-16 21:29:44 +0000
@@ -80,7 +80,7 @@
      GDK_WINDOW_TYPE (window) != GDK_WINDOW_OFFSCREEN)
 
 static MotifWmHints *
-gdk_window_get_mwm_hints (GdkWindow *window)
+gdk_xid_get_mwm_hints (Window window)
 {
   GdkDisplay *display;
   Atom hints_atom = None;
@@ -90,14 +90,11 @@
   gulong nitems;
   gulong bytes_after;
   
-  if (GDK_WINDOW_DESTROYED (window))
-    return NULL;
-
-  display = gdk_drawable_get_display (window);
+  display = gdk_display_get_default ();
   
   hints_atom = gdk_x11_get_xatom_by_name_for_display (display, _XA_MOTIF_WM_HINTS);
 
-  XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XID (window),
+  XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), window,
 		      hints_atom, 0, sizeof (MotifWmHints)/sizeof (long),
 		      False, AnyPropertyType, &type, &format, &nitems,
 		      &bytes_after, &data);
@@ -110,33 +107,29 @@
 
 /**
  * gdk_window_get_functions:
- * @window: The toplevel #GdkWindow to get the functions from
+ * @window: The toplevel #X11Window to get the functions for
  * @functions: The window functions will be written here
  *
  * Returns the functions set on the GdkWindow with #gdk_window_set_functions
  * Returns: TRUE if the window has functions set, FALSE otherwise.
  **/
 gboolean
-egg_window_get_functions(GdkWindow       *window,
-			   GdkWMFunction *functions)
+egg_xid_get_functions (Window window,
+                       GdkWMFunction *functions)
 {
   MotifWmHints *hints;
   gboolean result = FALSE;
 
-  if (GDK_WINDOW_DESTROYED (window) ||
-      !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window))
-    return FALSE;
-  
-  hints = gdk_window_get_mwm_hints (window);
+  hints = gdk_xid_get_mwm_hints (window);
   
   if (hints)
     {
       if (hints->flags & MWM_HINTS_FUNCTIONS)
-	{
-	  if (functions)
-	    *functions = hints->functions;
-	  result = TRUE;
-	}
+        {
+          if (functions)
+            *functions = hints->functions;
+          result = TRUE;
+        }
       
       XFree (hints);
     }

=== modified file 'src/gdk-get-func.h'
--- src/gdk-get-func.h	2010-06-25 02:30:47 +0000
+++ src/gdk-get-func.h	2010-09-16 21:29:44 +0000
@@ -1,3 +1,1 @@
-
-gboolean egg_window_get_functions(GdkWindow       *window, GdkWMFunction *functions);
-
+gboolean egg_xid_get_functions (Window window, GdkWMFunction *functions);

=== modified file 'src/indicator-appmenu.c'
--- src/indicator-appmenu.c	2010-09-16 15:32:30 +0000
+++ src/indicator-appmenu.c	2010-09-16 21:29:44 +0000
@@ -761,15 +761,9 @@
 	if (xid == 0) {
 		return;
 	}
-
-	GdkWindow * window = gdk_window_foreign_new(xid);
-	if (window == NULL) {
-		g_warning("Unable to get foreign window for: %d", xid);
-		return;
-	}
-
+ 
 	GdkWMFunction functions;
-	if (!egg_window_get_functions(window, &functions)) {
+	if (!egg_xid_get_functions(xid, &functions)) {
 		g_debug("Unable to get MWM functions for: %d", xid);
 		functions = GDK_FUNC_ALL;
 	}
@@ -778,8 +772,6 @@
 		gtk_widget_set_sensitive(GTK_WIDGET(iapp->close_item), TRUE);
 	}
 
-	g_object_unref(window);
-
 	return;
 }
 
@@ -798,6 +790,7 @@
 		switch_active_window(iapp, active_window);
 		return;
 	}
+
 	if (iapp->default_app == NULL && iapp->active_window == active_window && newdef == NULL) {
 		/* There's no application menus, but the active window hasn't
 		   changed.  So there's no change. */
@@ -806,6 +799,7 @@
 
 	entry_head = indicator_object_get_entries(INDICATOR_OBJECT(iapp));
 
+
 	for (entries = entry_head; entries != NULL; entries = g_list_next(entries)) {
 		IndicatorObjectEntry * entry = (IndicatorObjectEntry *)entries->data;
 
@@ -821,6 +815,7 @@
 	}
 
 	g_list_free(entry_head);
+
 	
 	/* Disconnect signals */
 	if (iapp->sig_entry_added != 0) {

=== modified file 'src/window-menus.c'
--- src/window-menus.c	2010-09-14 20:20:02 +0000
+++ src/window-menus.c	2010-09-16 21:29:44 +0000
@@ -326,7 +326,7 @@
 		}
 	}
 
-	IndicatorObjectEntry * entry = &g_array_index(priv->entries, IndicatorObjectEntry, position);
+	IndicatorObjectEntry * entry = g_array_index(priv->entries, IndicatorObjectEntry *, position);
 	g_signal_emit(G_OBJECT(user_data), signals[SHOW_MENU], 0, entry, timestamp, TRUE);
 
 	return;


Follow ups