[gtkhtml] Bug 444709 - Add support for multimedia keys



commit 883e2bea88a974583bcc3aa7dc038de7b9f9dff6
Author: Matthew Barnes <mbarnes redhat com>
Date:   Mon Jun 21 20:22:36 2010 -0400

    Bug 444709 - Add support for multimedia keys

 components/editor/gtkhtml-editor-private.h |    4 ++++
 components/editor/gtkhtml-editor.c         |   21 +++++++++++++++++++++
 configure.ac                               |   10 ++++++++++
 3 files changed, 35 insertions(+), 0 deletions(-)
---
diff --git a/components/editor/gtkhtml-editor-private.h b/components/editor/gtkhtml-editor-private.h
index 0a9667f..79fb758 100644
--- a/components/editor/gtkhtml-editor-private.h
+++ b/components/editor/gtkhtml-editor-private.h
@@ -25,6 +25,10 @@
 
 #include <glib/gi18n-lib.h>
 
+#ifdef HAVE_XFREE
+#include <X11/XF86keysym.h>
+#endif
+
 /* Custom Widgets */
 #include "gtkhtml-color-combo.h"
 #include "gtkhtml-color-palette.h"
diff --git a/components/editor/gtkhtml-editor.c b/components/editor/gtkhtml-editor.c
index 5ec527e..3c4c549 100644
--- a/components/editor/gtkhtml-editor.c
+++ b/components/editor/gtkhtml-editor.c
@@ -747,6 +747,23 @@ editor_finalize (GObject *object)
 	G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
+static gboolean
+editor_key_press_event (GtkWidget *widget,
+                        GdkEventKey *event)
+{
+#ifdef HAVE_XFREE
+	GtkhtmlEditor *editor = GTKHTML_EDITOR (widget);
+
+	if (event->keyval == XF86XK_Spell) {
+		gtk_action_activate (ACTION (SPELL_CHECK));
+		return TRUE;
+	}
+#endif
+
+	/* Chain up to parent's key_press_event() method. */
+	return GTK_WIDGET_CLASS (parent_class)->key_press_event (widget, event);
+}
+
 static void
 editor_cut_clipboard (GtkhtmlEditor *editor)
 {
@@ -775,6 +792,7 @@ static void
 editor_class_init (GtkhtmlEditorClass *class)
 {
 	GObjectClass *object_class;
+	GtkWidgetClass *widget_class;
 
 	parent_class = g_type_class_peek_parent (class);
 	g_type_class_add_private (class, sizeof (GtkhtmlEditorPrivate));
@@ -786,6 +804,9 @@ editor_class_init (GtkhtmlEditorClass *class)
 	object_class->dispose = editor_dispose;
 	object_class->finalize = editor_finalize;
 
+	widget_class = GTK_WIDGET_CLASS (class);
+	widget_class->key_press_event = editor_key_press_event;
+
 	class->cut_clipboard = editor_cut_clipboard;
 	class->copy_clipboard = editor_copy_clipboard;
 	class->paste_clipboard = editor_paste_clipboard;
diff --git a/configure.ac b/configure.ac
index d1ab4f2..e696a2e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -228,6 +228,16 @@ if test "x$have_iso_codes" = "xyes"; then
 fi
 
 dnl **************************************************
+dnl XF86 multimedia keys support
+dnl **************************************************
+AC_CHECK_HEADER([X11/XF86keysym.h],
+	[AC_DEFINE([HAVE_XFREE], 1, [Have <X11/XF86keysym.h>])],,
+	[[	#if HAVE_XFREE
+		#include <X11/XF86keysym.h>
+		#endif
+	]])
+
+dnl **************************************************
 dnl regex library
 dnl **************************************************
 AC_CHECK_FUNCS(regexec,,[AC_CHECK_LIB(regex,regexec,[REGEX_LIBS=-lregex],[AC_MSG_ERROR([No regex library found])])])



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