[anjuta] anjuta: Special case GtkSourceView in key-press-event
- From: Johannes Schmid <jhs src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] anjuta: Special case GtkSourceView in key-press-event
- Date: Mon, 24 Jan 2011 17:52:30 +0000 (UTC)
commit 3d4f03598e21a11198738f0a000667dae75a3711
Author: Johannes Schmid <jhs gnome org>
Date: Mon Jan 24 18:52:11 2011 +0100
anjuta: Special case GtkSourceView in key-press-event
GtkSourceView takes almost all keyboard shortcuts and we don't want that. Fixes:
bgo#640277 - editor position history doesn't work with shortcut
bgo#640292 - documents navigation usability improvements
src/Makefile.am | 2 ++
src/anjuta-app.c | 11 +++++++++--
2 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 7cbf0e8..ec88df6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -19,6 +19,7 @@ AM_CPPFLAGS = \
-I$(top_srcdir)\
-I.. -I. \
$(LIBANJUTA_CFLAGS) \
+ $(SOURCEVIEW_CFLAGS) \
$(GDL_CFLAGS) \
$(XML_CFLAGS) \
-DPACKAGE_BIN_DIR=\"$(bindir)\" \
@@ -45,6 +46,7 @@ anjuta_SOURCES = \
anjuta_LDADD = \
$(ANJUTA_LIBS) \
+ $(SOURCEVIEW_LIBS) \
$(GDL_LIBS) \
$(LIBANJUTA_LIBS) \
$(XML_LIBS)
diff --git a/src/anjuta-app.c b/src/anjuta-app.c
index 8cf4ef7..0953517 100644
--- a/src/anjuta-app.c
+++ b/src/anjuta-app.c
@@ -31,6 +31,8 @@
#include <gdl/gdl.h>
+#include <gtksourceview/gtksourceview.h>
+
#include <libanjuta/anjuta-shell.h>
#include <libanjuta/anjuta-ui.h>
#include <libanjuta/anjuta-utils.h>
@@ -718,11 +720,16 @@ anjuta_app_key_press_event (GtkWidget *widget,
{
static gpointer grand_parent_class = NULL;
GtkWindow *window = GTK_WINDOW (widget);
+ GtkWidget *focus = gtk_window_get_focus (window);
gboolean handled = FALSE;
if (grand_parent_class == NULL)
grand_parent_class = g_type_class_peek_parent (parent_class);
+ /* Special case the editor - it catches all shortcuts otherwise */
+ if (GTK_IS_SOURCE_VIEW (focus))
+ if (gtk_window_activate_key (window, event))
+ return TRUE;
switch (event->keyval)
{
case GDK_KEY_F1:
@@ -746,11 +753,11 @@ anjuta_app_key_press_event (GtkWidget *widget,
if (!handled)
handled = gtk_window_propagate_key_event (window, event);
}
-
+
/* handle mnemonics and accelerators */
if (!handled)
handled = gtk_window_activate_key (window, event);
-
+
/* Chain up, invokes binding set */
if (!handled)
handled = GTK_WIDGET_CLASS (grand_parent_class)->key_press_event (widget, event);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]