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

docs using event constants



A couple of spots in the docs where the new EVENT return constants could
be used.  The window one is the expected use, the snooper is more in the
way of advertising.

Index: xs/Gtk2.xs
===================================================================
--- xs/Gtk2.xs	(revision 2095)
+++ xs/Gtk2.xs	(working copy)
@@ -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:
Index: xs/GtkWindow.xs
===================================================================
--- xs/GtkWindow.xs	(revision 2095)
+++ xs/GtkWindow.xs	(working copy)
@@ -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]