perl-Gtk2 r2103 - in trunk: . xs



Author: tsch
Date: Thu Jan  1 21:40:13 2009
New Revision: 2103
URL: http://svn.gnome.org/viewvc/perl-Gtk2?rev=2103&view=rev

Log:
Use Gtk2::EVENT_STOP and EVENT_PROPAGATE in the synopsis for Gtk2::Window and
in the docs for Gtk2::key_snooper_install.  Patch by Kevin Ryde.


Modified:
   trunk/ChangeLog
   trunk/xs/Gtk2.xs
   trunk/xs/GtkWindow.xs

Modified: trunk/xs/Gtk2.xs
==============================================================================
--- trunk/xs/Gtk2.xs	(original)
+++ trunk/xs/Gtk2.xs	Thu Jan  1 21:40:13 2009
@@ -535,16 +535,20 @@
 
  ##guint gtk_key_snooper_install (GtkKeySnoopFunc snooper, gpointer func_data);
 =for apidoc
-=for arg snooper (subroutine) function to call on every event, must return a boolean
-Install a key "snooper" function, which will get called on all key events
-before those events are delivered normally.  These snoopers can be used to
-implement custom key event handling.  I<snooper> will receive the widget to
-which the event will be delivered and the event, and also I<func_data> (if
-provided).  If I<snooper> returns true, the event propagation will stop
-(just like normal event handlers).
+=for arg snooper (subroutine) function to call on every event
+Install a key "snooper" function which will get called on all key
+events before those events are delivered normally.  These snoopers can
+be used to implement custom key event handling.
 
 C<key_snooper_install> returns an id that may be used with
-C<key_snooper_remove>.
+C<key_snooper_remove> (below).  I<snooper> is called as
+
+    stopbool = &snooper ($widget, $event, $func_data);
+
+It should return true to stop event propagation, the same as
+C<Gtk2::Widget> event signal handlers.  The C<Gtk2::EVENT_STOP> and
+C<Gtk2::EVENT_PROPAGATE> constants can be used for the return (see
+L<Gtk2::Widget>).
 =cut
 guint gtk_key_snooper_install (class, SV * snooper, SV * func_data=NULL)
     CODE:

Modified: trunk/xs/GtkWindow.xs
==============================================================================
--- trunk/xs/GtkWindow.xs	(original)
+++ trunk/xs/GtkWindow.xs	Thu Jan  1 21:40:13 2009
@@ -48,9 +48,10 @@
     $toplevel->signal_connect (delete_event => sub {
        if (any_unsaved_documents()) {
          popup_ask_save_before_exit_dialog();
-         return 1;  # don't propagate to default destroy
+         return Gtk2::EVENT_STOP;  # don't go to default destroy
+       } else {
+         return Gtk2::EVENT_PROPAGATE;
        }
-       return 0;  # do propagate
     });
 
 In a dialog or secondary app window you might not want to destroy but



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