broadway: Fix focus handling with touch events

This commit is contained in:
Alexander Larsson 2013-11-12 22:06:33 +01:00
parent 42bdbd8c30
commit 6917746c8e
4 changed files with 14 additions and 6 deletions

View File

@ -90,7 +90,7 @@ typedef struct {
typedef struct {
BroadwayInputBaseMsg base;
guint32 mouse_window_id; /* The real window, not taking grabs into account */
guint32 window_id;
guint32 state;
gint32 key;
} BroadwayInputKeyMsg;

View File

@ -237,6 +237,14 @@ update_event_state (BroadwayServer *server,
server->real_mouse_in_toplevel_id = message->pointer.mouse_window_id;
break;
case BROADWAY_EVENT_TOUCH:
if (message->touch.touch_type == 0 &&
server->focused_window_id != message->touch.event_window_id)
{
broadway_server_window_raise (server, message->touch.event_window_id);
broadway_server_focus_window (server, message->touch.event_window_id);
broadway_server_flush (server);
}
server->last_state = message->touch.state;
break;
case BROADWAY_EVENT_KEY_PRESS:
@ -460,7 +468,7 @@ parse_input_message (BroadwayInput *input, const unsigned char *message)
case BROADWAY_EVENT_KEY_PRESS:
case BROADWAY_EVENT_KEY_RELEASE:
msg.key.mouse_window_id = ntohl (*p++);
msg.key.window_id = server->focused_window_id;
msg.key.key = ntohl (*p++);
msg.key.state = ntohl (*p++);
break;

View File

@ -2347,7 +2347,7 @@ function handleKeyDown(e) {
// browser behaviors or it has no corresponding keyPress
// event, then send it immediately
if (!ignoreKeyEvent(ev))
sendInput("k", [realWindowWithMouse, keysym, lastState]);
sendInput("k", [keysym, lastState]);
suppress = true;
}
@ -2392,7 +2392,7 @@ function handleKeyPress(e) {
// Send the translated keysym
if (keysym > 0)
sendInput ("k", [realWindowWithMouse, keysym, lastState]);
sendInput ("k", [keysym, lastState]);
// Stop keypress events just in case
return cancelEvent(ev);
@ -2411,7 +2411,7 @@ function handleKeyUp(e) {
}
if (keysym > 0)
sendInput ("K", [realWindowWithMouse, keysym, lastState]);
sendInput ("K", [keysym, lastState]);
return cancelEvent(ev);
}

View File

@ -273,7 +273,7 @@ _gdk_broadway_events_got_input (BroadwayInputMsg *message)
case BROADWAY_EVENT_KEY_PRESS:
case BROADWAY_EVENT_KEY_RELEASE:
window = g_hash_table_lookup (display_broadway->id_ht,
GINT_TO_POINTER (message->key.mouse_window_id));
GINT_TO_POINTER (message->key.window_id));
if (window)
{
event = gdk_event_new (message->base.type == 'k' ? GDK_KEY_PRESS : GDK_KEY_RELEASE);