[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

grab event further fields



I noticed GdkEventGrabBroken has "implicit" and "grab_window" fields
without accessor methods.

The grab_window is not reffed by the event code (gdk_event_copy,
gdk_event_free) as far as I can see, which makes storing anything there
a little dangerous.

--- GdkEvent.xs	10 Jan 2008 09:51:03 +1100	1.52
+++ GdkEvent.xs	31 May 2008 09:55:17 +1000	
@@ -1847,11 +1847,40 @@
     CODE:
 	RETVAL = event->grab_broken.keyboard;
 
-	if (items == 2 && newvalue != RETVAL)
+	if (items == 2)
 		event->grab_broken.keyboard = newvalue;
     OUTPUT:
 	RETVAL
 
+gboolean
+implicit (GdkEvent * event, gboolean newvalue=0)
+    CODE:
+	RETVAL = event->grab_broken.implicit;
+
+	if (items == 2)
+		event->grab_broken.implicit = newvalue;
+    OUTPUT:
+	RETVAL
+
+GdkWindow_ornull *
+grab_window (GdkEvent * event, GdkWindow_ornull * newvalue=NULL)
+    CODE:
+	RETVAL = event->grab_broken.grab_window;
+
+	/* GdkEventGrabBroken doesn't hold a ref on grab_window, so
+	 * just plonk the new value in, unlike for any.window above.
+         */
+	if (items == 2)
+		event->grab_broken.grab_window = newvalue;
+    OUTPUT:
+	RETVAL
+
+=for apidoc Gtk2::Gdk::Event::GrabBroken::grab_window
+When you set a window into a GrabBroken event make sure you keep a
+reference to it for as long as that event object or any copies exist,
+because the event doesn't add its own reference.
+=cut
+
 #endif
 
 # --------------------------------------------------------------------------- #


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]