[gtk+] [broadway] Handle keyboard modifiers in state
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] [broadway] Handle keyboard modifiers in state
- Date: Thu, 14 Apr 2011 19:46:06 +0000 (UTC)
commit 887743728f435a5b4ef20deb79feb26f8e525cae
Author: Alexander Larsson <alexl redhat com>
Date: Thu Apr 14 21:35:48 2011 +0200
[broadway] Handle keyboard modifiers in state
gdk/broadway/broadway.js | 14 +++++++++++---
gdk/broadway/gdkdisplay-broadway.c | 2 ++
gdk/broadway/gdkdisplay-broadway.h | 1 +
gdk/broadway/gdkeventsource.c | 3 +++
4 files changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/gdk/broadway/broadway.js b/gdk/broadway/broadway.js
index 683172a..e8e2ea4 100644
--- a/gdk/broadway/broadway.js
+++ b/gdk/broadway/broadway.js
@@ -951,6 +951,14 @@ function getEffectiveEventTarget (id) {
}
function updateForEvent(ev) {
+ lastState &= ~(GDK_SHIFT_MASK|GDK_CONTROL_MASK|GDK_MOD1_MASK);
+ if (ev.shiftKey)
+ lastState |= GDK_SHIFT_MASK;
+ if (ev.ctrlKey)
+ lastState |= GDK_CONTROL_MASK;
+ if (ev.altKey)
+ lastState |= GDK_MOD1_MASK;
+
lastTimeStamp = ev.timeStamp;
if (ev.target.surface && ev.target.surface.window) {
var win = ev.target.surface.window;
@@ -2555,7 +2563,7 @@ function handleKeyDown(e) {
// browser behaviors or it has no corresponding keyPress
// event, then send it immediately
if (!ignoreKeyEvent(ev))
- sendInput("k", [keysym]);
+ sendInput("k", [keysym, lastState]);
suppress = true;
}
@@ -2600,7 +2608,7 @@ function handleKeyPress(e) {
// Send the translated keysym
if (keysym > 0)
- sendInput ("k", [keysym]);
+ sendInput ("k", [keysym, lastState]);
// Stop keypress events just in case
return cancelEvent(ev);
@@ -2619,7 +2627,7 @@ function handleKeyUp(e) {
}
if (keysym > 0)
- sendInput ("K", [keysym]);
+ sendInput ("K", [keysym, lastState]);
return cancelEvent(ev);
}
diff --git a/gdk/broadway/gdkdisplay-broadway.c b/gdk/broadway/gdkdisplay-broadway.c
index 75a639f..cdab101 100644
--- a/gdk/broadway/gdkdisplay-broadway.c
+++ b/gdk/broadway/gdkdisplay-broadway.c
@@ -263,6 +263,8 @@ parse_input_message (BroadwayInput *input, const char *message)
case 'k':
case 'K':
msg.key.key = strtol(p, &p, 10);
+ p++; /* Skip , */
+ msg.key.state = strtol(p, &p, 10);
break;
case 'g':
diff --git a/gdk/broadway/gdkdisplay-broadway.h b/gdk/broadway/gdkdisplay-broadway.h
index 3a414e2..2f60037 100644
--- a/gdk/broadway/gdkdisplay-broadway.h
+++ b/gdk/broadway/gdkdisplay-broadway.h
@@ -79,6 +79,7 @@ typedef struct {
typedef struct {
BroadwayInputBaseMsg base;
+ guint32 state;
int key;
} BroadwayInputKeyMsg;
diff --git a/gdk/broadway/gdkeventsource.c b/gdk/broadway/gdkeventsource.c
index e7f8574..18fbe64 100644
--- a/gdk/broadway/gdkeventsource.c
+++ b/gdk/broadway/gdkeventsource.c
@@ -259,10 +259,13 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
event->key.window = g_object_ref (window);
event->key.time = message->base.time;
event->key.keyval = message->key.key;
+ event->key.state = message->key.state;
event->key.hardware_keycode = message->key.key;
event->key.length = 0;
gdk_event_set_device (event, display->core_pointer);
+ display_broadway->last_state = message->key.state;
+
node = _gdk_event_queue_append (display, event);
_gdk_windowing_got_event (display, node, event, message->base.serial);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]