diff options
Diffstat (limited to 'gdk/broadway')
-rw-r--r-- | gdk/broadway/broadway-output.c | 7 | ||||
-rw-r--r-- | gdk/broadway/broadway-output.h | 2 | ||||
-rw-r--r-- | gdk/broadway/broadway-protocol.h | 10 | ||||
-rw-r--r-- | gdk/broadway/broadway-server.c | 17 | ||||
-rw-r--r-- | gdk/broadway/broadway.js | 32 | ||||
-rw-r--r-- | gdk/broadway/broadwayd.c | 3 | ||||
-rw-r--r-- | gdk/broadway/gdkbroadway-server.c | 13 | ||||
-rw-r--r-- | gdk/broadway/gdkbroadway-server.h | 2 | ||||
-rw-r--r-- | gdk/broadway/gdkbroadwaydisplay.h | 5 | ||||
-rw-r--r-- | gdk/broadway/gdkdisplay-broadway.c | 16 |
10 files changed, 106 insertions, 1 deletions
diff --git a/gdk/broadway/broadway-output.c b/gdk/broadway/broadway-output.c index 42ad59f050..631c542890 100644 --- a/gdk/broadway/broadway-output.c +++ b/gdk/broadway/broadway-output.c @@ -237,6 +237,13 @@ broadway_output_destroy_surface(BroadwayOutput *output, int id) append_uint16 (output, id); } +void +broadway_output_set_show_keyboard (BroadwayOutput *output, + gboolean show) +{ + write_header (output, BROADWAY_OP_SET_SHOW_KEYBOARD); + append_uint16 (output, show); +} void broadway_output_move_resize_surface (BroadwayOutput *output, diff --git a/gdk/broadway/broadway-output.h b/gdk/broadway/broadway-output.h index 6d6bb61b31..0ccda2484d 100644 --- a/gdk/broadway/broadway-output.h +++ b/gdk/broadway/broadway-output.h @@ -63,5 +63,7 @@ void broadway_output_grab_pointer (BroadwayOutput *output, gboolean owner_event); guint32 broadway_output_ungrab_pointer (BroadwayOutput *output); void broadway_output_pong (BroadwayOutput *output); +void broadway_output_set_show_keyboard (BroadwayOutput *output, + gboolean show); #endif /* __BROADWAY_H__ */ diff --git a/gdk/broadway/broadway-protocol.h b/gdk/broadway/broadway-protocol.h index 8447bd567a..db0c4f1c93 100644 --- a/gdk/broadway/broadway-protocol.h +++ b/gdk/broadway/broadway-protocol.h @@ -42,6 +42,7 @@ typedef enum { BROADWAY_OP_AUTH_OK = 'L', BROADWAY_OP_DISCONNECTED = 'D', BROADWAY_OP_PUT_BUFFER = 'b', + BROADWAY_OP_SET_SHOW_KEYBOARD = 'k', } BroadwayOpType; typedef struct { @@ -154,7 +155,8 @@ typedef enum { BROADWAY_REQUEST_MOVE_RESIZE, BROADWAY_REQUEST_GRAB_POINTER, BROADWAY_REQUEST_UNGRAB_POINTER, - BROADWAY_REQUEST_FOCUS_WINDOW + BROADWAY_REQUEST_FOCUS_WINDOW, + BROADWAY_REQUEST_SET_SHOW_KEYBOARD } BroadwayRequestType; typedef struct { @@ -223,6 +225,11 @@ typedef struct { guint32 height; } BroadwayRequestMoveResize; +typedef struct { + BroadwayRequestBase base; + guint32 show_keyboard; +} BroadwayRequestSetShowKeyboard; + typedef union { BroadwayRequestBase base; BroadwayRequestNewWindow new_window; @@ -239,6 +246,7 @@ typedef union { BroadwayRequestUngrabPointer ungrab_pointer; BroadwayRequestTranslate translate; BroadwayRequestFocusWindow focus_window; + BroadwayRequestSetShowKeyboard set_show_keyboard; } BroadwayRequest; typedef enum { diff --git a/gdk/broadway/broadway-server.c b/gdk/broadway/broadway-server.c index 6aedd37b55..3b3baa896b 100644 --- a/gdk/broadway/broadway-server.c +++ b/gdk/broadway/broadway-server.c @@ -55,6 +55,7 @@ struct _BroadwayServer { GList *toplevels; BroadwayWindow *root; gint32 focused_window_id; /* -1 => none */ + gint show_keyboard; guint32 screen_width; guint32 screen_height; @@ -1413,6 +1414,19 @@ broadway_server_window_raise (BroadwayServer *server, } void +broadway_server_set_show_keyboard (BroadwayServer *server, + gboolean show) +{ + server->show_keyboard = show; + + if (server->output) + { + broadway_output_set_show_keyboard (server->output, server->show_keyboard); + broadway_server_flush (server); + } +} + +void broadway_server_window_lower (BroadwayServer *server, gint id) { @@ -1783,5 +1797,8 @@ broadway_server_resync_windows (BroadwayServer *server) } } + if (server->show_keyboard) + broadway_output_set_show_keyboard (server->output, TRUE); + broadway_server_flush (server); } diff --git a/gdk/broadway/broadway.js b/gdk/broadway/broadway.js index ed0a9e06eb..f8a944075e 100644 --- a/gdk/broadway/broadway.js +++ b/gdk/broadway/broadway.js @@ -103,6 +103,9 @@ var stackingOrder = []; var outstandingCommands = new Array(); var inputSocket = null; var debugDecoding = false; +var fakeInput = null; +var showKeyboard = false; +var showKeyboardChanged = false; var GDK_CROSSING_NORMAL = 0; var GDK_CROSSING_GRAB = 1; @@ -630,6 +633,12 @@ function handleCommands(cmd) case 'u': // Ungrab cmdUngrabPointer(); break; + + case 'k': // show keyboard + showKeyboard = cmd.get_16() != 0; + showKeyboardChanged = true; + break; + default: alert("Unknown op " + command); } @@ -763,6 +772,16 @@ function getEffectiveEventTarget (id) { return id; } +function updateKeyboardStatus() { + if (fakeInput != null && showKeyboardChanged) { + showKeyboardChanged = false; + if (showKeyboard) + fakeInput.focus(); + else + fakeInput.blur(); + } +} + function updateForEvent(ev) { lastState &= ~(GDK_SHIFT_MASK|GDK_CONTROL_MASK|GDK_MOD1_MASK); if (ev.shiftKey) @@ -2463,6 +2482,7 @@ function onMouseWheel(ev) function onTouchStart(ev) { event.preventDefault(); + updateKeyboardStatus(); updateForEvent(ev); for (var i = 0; i < ev.changedTouches.length; i++) { @@ -2478,6 +2498,7 @@ function onTouchStart(ev) { function onTouchMove(ev) { event.preventDefault(); + updateKeyboardStatus(); updateForEvent(ev); for (var i = 0; i < ev.changedTouches.length; i++) { @@ -2493,6 +2514,7 @@ function onTouchMove(ev) { function onTouchEnd(ev) { event.preventDefault(); + updateKeyboardStatus(); updateForEvent(ev); for (var i = 0; i < ev.changedTouches.length; i++) { @@ -2574,4 +2596,14 @@ function connect() ws.onmessage = function(event) { handleMessage(event.data); }; + + var iOS = /(iPad|iPhone|iPod)/g.test( navigator.userAgent ); + if (iOS) { + fakeInput = document.createElement("input"); + fakeInput.type = "text"; + fakeInput.style.position = "absolute"; + fakeInput.style.left = "-1000px"; + fakeInput.style.top = "-1000px"; + document.body.appendChild(fakeInput); + } } diff --git a/gdk/broadway/broadwayd.c b/gdk/broadway/broadwayd.c index a4bed341c5..84f95eee3e 100644 --- a/gdk/broadway/broadwayd.c +++ b/gdk/broadway/broadwayd.c @@ -297,6 +297,9 @@ client_handle_request (BroadwayClient *client, case BROADWAY_REQUEST_FOCUS_WINDOW: broadway_server_focus_window (server, request->focus_window.id); break; + case BROADWAY_REQUEST_SET_SHOW_KEYBOARD: + broadway_server_set_show_keyboard (server, request->set_show_keyboard.show_keyboard); + break; default: g_warning ("Unknown request of type %d\n", request->base.type); } diff --git a/gdk/broadway/gdkbroadway-server.c b/gdk/broadway/gdkbroadway-server.c index d85cfa522c..6389c7fdb4 100644 --- a/gdk/broadway/gdkbroadway-server.c +++ b/gdk/broadway/gdkbroadway-server.c @@ -794,3 +794,16 @@ _gdk_broadway_server_ungrab_pointer (GdkBroadwayServer *server, return status; } + +void +_gdk_broadway_server_set_show_keyboard (GdkBroadwayServer *server, + gboolean show) +{ + BroadwayRequestSetShowKeyboard msg; + + msg.show_keyboard = show; + gdk_broadway_server_send_message (server, msg, + BROADWAY_REQUEST_SET_SHOW_KEYBOARD); + + return TRUE; +} diff --git a/gdk/broadway/gdkbroadway-server.h b/gdk/broadway/gdkbroadway-server.h index 0ddf39e349..89a3076992 100644 --- a/gdk/broadway/gdkbroadway-server.h +++ b/gdk/broadway/gdkbroadway-server.h @@ -52,6 +52,8 @@ void _gdk_broadway_server_window_focus (GdkBroadwaySer void _gdk_broadway_server_window_set_transient_for (GdkBroadwayServer *server, gint id, gint parent); +void _gdk_broadway_server_set_show_keyboard (GdkBroadwayServer *server, + gboolean show_keyboard); gboolean _gdk_broadway_server_window_translate (GdkBroadwayServer *server, gint id, cairo_region_t *area, diff --git a/gdk/broadway/gdkbroadwaydisplay.h b/gdk/broadway/gdkbroadwaydisplay.h index 805e1deff0..6648a55a07 100644 --- a/gdk/broadway/gdkbroadwaydisplay.h +++ b/gdk/broadway/gdkbroadwaydisplay.h @@ -43,6 +43,11 @@ typedef struct _GdkBroadwayDisplayClass GdkBroadwayDisplayClass; GDK_AVAILABLE_IN_ALL GType gdk_broadway_display_get_type (void); +GDK_AVAILABLE_IN_3_12 +void gdk_broadway_display_show_keyboard (GdkBroadwayDisplay *display); +GDK_AVAILABLE_IN_3_12 +void gdk_broadway_display_hide_keyboard (GdkBroadwayDisplay *display); + G_END_DECLS #endif /* __GDK_BROADWAY_DISPLAY_H__ */ diff --git a/gdk/broadway/gdkdisplay-broadway.c b/gdk/broadway/gdkdisplay-broadway.c index 94a324e071..c4f1d3122a 100644 --- a/gdk/broadway/gdkdisplay-broadway.c +++ b/gdk/broadway/gdkdisplay-broadway.c @@ -346,6 +346,22 @@ gdk_broadway_display_event_data_free (GdkDisplay *display, { } +void +gdk_broadway_display_show_keyboard (GdkBroadwayDisplay *display) +{ + g_return_if_fail (GDK_IS_BROADWAY_DISPLAY (display)); + + _gdk_broadway_server_set_show_keyboard (display->server, TRUE); +} + +void +gdk_broadway_display_hide_keyboard (GdkBroadwayDisplay *display) +{ + g_return_if_fail (GDK_IS_BROADWAY_DISPLAY (display)); + + _gdk_broadway_server_set_show_keyboard (display->server, FALSE); +} + static void gdk_broadway_display_class_init (GdkBroadwayDisplayClass * class) { |