[patch] make Bonobo key bindings respect the "handled" flag
- From: Darin Adler <darin bentspoon com>
- To: michael ximian com
- Cc: gnome-components-list gnome org
- Subject: [patch] make Bonobo key bindings respect the "handled" flag
- Date: Thu, 31 May 2001 14:39:58 -0700
Here's a patch that makes the Bonobo key bindings respect the
handled flag properly. The old code connected a handler to
"key_press_event", but it would handle keys even if they were
also handled by the focused widget.
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/bonobo/ChangeLog,v
retrieving revision 1.1068
diff -p -u -r1.1068 ChangeLog
--- ChangeLog 2001/05/30 11:44:31 1.1068
+++ ChangeLog 2001/05/31 21:34:38
@@ -1,3 +1,15 @@
+2001-05-31 Darin Adler <darin bentspoon com>
+
+ * bonobo/bonobo-win.c: (construct_priv): Don't connect
+ a signal handler.
+ (bonobo_window_key_press_event): Use a default handler, and call
+ the inherited one first. This gives the focused widget first
+ crack at the event, and prevents us from having two things that
+ both handle the same event.
+ (bonobo_window_class_init): Point to the default handler.
+
+ * tests/.cvsignore: Ignore more test binaries.
+
2001-05-30 Johan Dahlin <zilch am home se>
* bonobo/bonobo-ui-toolbar-item.h: Removed duplicate prototypes.
Index: bonobo/bonobo-win.c
===================================================================
RCS file: /cvs/gnome/bonobo/bonobo/bonobo-win.c,v
retrieving revision 1.103
diff -p -u -r1.103 bonobo-win.c
--- bonobo/bonobo-win.c 2001/05/24 08:40:07 1.103
+++ bonobo/bonobo-win.c 2001/05/31 21:34:40
@@ -558,10 +558,6 @@ construct_priv (BonoboWindow *win)
/* Keybindings; the gtk_binding stuff is just too evil */
priv->sync_keys = bonobo_ui_sync_keys_new (priv->engine);
bonobo_ui_engine_add_sync (priv->engine, priv->sync_keys);
- gtk_signal_connect (
- GTK_OBJECT (win), "key_press_event",
- (GtkSignalFunc) bonobo_ui_sync_keys_binding_handle,
- priv->sync_keys);
priv->sync_status = bonobo_ui_sync_status_new (
priv->engine, priv->status);
@@ -585,6 +581,24 @@ bonobo_window_show_all (GtkWidget *widge
gtk_widget_show (widget);
}
+static gboolean
+bonobo_window_key_press_event (GtkWidget *widget,
+ GdkEventKey *event)
+{
+ gboolean handled;
+ BonoboUISyncKeys *sync;
+
+ handled = GTK_WIDGET_CLASS (bonobo_window_parent_class)->key_press_event (widget, event);
+ if (handled)
+ return TRUE;
+
+ sync = BONOBO_WINDOW (widget)->priv->sync_keys;
+ if (sync)
+ return bonobo_ui_sync_keys_binding_handle (widget, event, sync);
+
+ return FALSE;
+}
+
static void
bonobo_window_class_init (BonoboWindowClass *klass)
{
@@ -597,6 +611,7 @@ bonobo_window_class_init (BonoboWindowCl
object_class->finalize = bonobo_window_finalize;
widget_class->show_all = bonobo_window_show_all;
+ widget_class->key_press_event = bonobo_window_key_press_event;
}
static void
Index: tests/.cvsignore
===================================================================
RCS file: /cvs/gnome/bonobo/tests/.cvsignore,v
retrieving revision 1.8
diff -p -u -r1.8 .cvsignore
--- tests/.cvsignore 2001/04/12 16:32:58 1.8
+++ tests/.cvsignore 2001/05/31 21:34:40
@@ -4,12 +4,15 @@ Makefile
Makefile.in
selector_test
test-any
+test-event-source
test-focus
test-moniker
test-properties-client
test-properties-server
+test-reparent
+test-sensitivity
test-storage
test-moniker
-test-ui
test-toolbar
-test-event-source
+test-ui
+test-xobject
===================================================================
Permission to commit to bonobo and libbonoboui?
-- Darin
[
Date Prev][Date Next] [
Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]