[gnome-boxes] Enable key navigation
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] Enable key navigation
- Date: Mon, 1 Oct 2012 08:12:22 +0000 (UTC)
commit cb2467845972328302dc004c12b424f9542537a6
Author: Alexander Larsson <alexl redhat com>
Date: Thu Sep 27 19:50:25 2012 +0200
Enable key navigation
We derive from GtkClutterEmbed and remove focusability and key event
handling. This means that to Gtk+ it looks like a dumb container
which never gets any key events. This makes Gtk+ keynav work just
like in any other container, although it means there will never
be any Clutter key events. Thats fine though, as we just use
Clutter as a rendering layer.
https://bugzilla.gnome.org/show_bug.cgi?id=684988
src/Makefile.am | 1 +
src/app.vala | 4 ++--
src/clutter-widget.vala | 25 +++++++++++++++++++++++++
3 files changed, 28 insertions(+), 2 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 46ee57e..d61310c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -77,6 +77,7 @@ EXTRA_DIST += $(libcommon_a_DEPENDENCIES) $(libcommon_a_VALASOURCES)
bin_PROGRAMS = gnome-boxes
gnome_boxes_SOURCES = \
+ clutter-widget.vala \
app.vala \
collection-view.vala \
collection.vala \
diff --git a/src/app.vala b/src/app.vala
index 7c58d0c..6324f39 100644
--- a/src/app.vala
+++ b/src/app.vala
@@ -23,7 +23,7 @@ private class Boxes.App: Boxes.UI {
}
private bool maximized { get { return WindowState.MAXIMIZED in window.get_window ().get_state (); } }
public Gtk.Notebook notebook;
- public GtkClutter.Embed embed;
+ public ClutterWidget embed;
public Clutter.Stage stage;
public Clutter.BinLayout stage_bin;
public Clutter.Actor overlay_bin_actor;
@@ -407,7 +407,7 @@ private class Boxes.App: Boxes.UI {
notebook.show_border = false;
notebook.show_tabs = false;
window.add (notebook);
- embed = new GtkClutter.Embed ();
+ embed = new ClutterWidget ();
notebook.append_page (embed, null);
display_page = new DisplayPage ();
diff --git a/src/clutter-widget.vala b/src/clutter-widget.vala
new file mode 100644
index 0000000..5404cab
--- /dev/null
+++ b/src/clutter-widget.vala
@@ -0,0 +1,25 @@
+// This file is part of GNOME Boxes. License: LGPLv2+
+using Gtk;
+using Clutter;
+
+/* We overide all keyboard handling of GtkClutter.Embed, as it interfers
+ with the key event propagation and thus focus navigation in gtk+.
+ We also make the embed itself non-focusable, as we want to treat it
+ like a container of Gtk+ widget rather than an edge widget which gets
+ keyboard events.
+ This means we will never get any Clutter key events, but that is
+ fine, as all our keyboard input is into GtkClutterActors, and clutter
+ is just used as a nice way of animating and rendering Gtk+ widgets
+ and some non-active graphical things.
+*/
+private class Boxes.ClutterWidget: GtkClutter.Embed {
+ public ClutterWidget () {
+ set_can_focus (false);
+ }
+ public override bool key_press_event (Gdk.EventKey event) {
+ return false;
+ }
+ public override bool key_release_event (Gdk.EventKey event) {
+ return false;
+ }
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]