loleaflet/reference.html | 29 +++++++++++ loleaflet/src/layer/tile/TileLayer.js | 10 +++ loleaflet/src/map/Map.js | 6 +- loleaflet/src/map/handler/Map.Keyboard.js | 7 ++ loolwsd/LOKitClient.cpp | 1 loolwsd/LOOLSession.cpp | 3 + loolwsd/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h | 23 ++++++++ loolwsd/bundled/include/LibreOfficeKit/LibreOfficeKitInit.h | 5 - loolwsd/protocol.txt | 17 ++++++ 9 files changed, 94 insertions(+), 7 deletions(-)
New commits: commit c016da01dca71f26c48ce1fc7d00993c3f5df108 Author: Pranav Kant <pran...@collabora.com> Date: Mon Apr 11 12:39:21 2016 +0530 loleaflet bccu#1633: listen to composition events Treat 'compositionend' event as 'keypress' event with composited data. Change-Id: Ia1d35e3ce2c583259dc6b6179741050ed173fe64 (cherry picked from commit ef2638298a3fe75ffd34fa82330a7e775090918b) diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js index dc55684..0c4f978 100644 --- a/loleaflet/src/map/Map.js +++ b/loleaflet/src/map/Map.js @@ -652,7 +652,7 @@ L.Map = L.Evented.extend({ L.DomEvent[onOff](this._container, 'click dblclick mousedown mouseup ' + 'mouseover mouseout mousemove contextmenu dragover drop ' + 'keydown keypress keyup trplclick qdrplclick', this._handleDOMEvent, this); - L.DomEvent[onOff](this._textArea, 'copy cut paste keydown keypress keyup', this._handleDOMEvent, this); + L.DomEvent[onOff](this._textArea, 'copy cut paste keydown keypress keyup compositionend', this._handleDOMEvent, this); if (this.options.trackResize && this._resizeDetector.contentWindow) { L.DomEvent[onOff](this._resizeDetector.contentWindow, 'resize', this._onResize, this); @@ -757,7 +757,9 @@ L.Map = L.Evented.extend({ var data = { originalEvent: e }; - if (e.type !== 'keypress' && e.type !== 'keyup' && e.type !== 'keydown' && e.type !== 'copy' && e.type !== 'cut' && e.type !== 'paste') { + if (e.type !== 'keypress' && e.type !== 'keyup' && e.type !== 'keydown' && + e.type !== 'copy' && e.type !== 'cut' && e.type !== 'paste' && + e.type !== 'compositionend') { data.containerPoint = target instanceof L.Marker ? this.latLngToContainerPoint(target.getLatLng()) : this.mouseEventToContainerPoint(e); data.layerPoint = this.containerPointToLayerPoint(data.containerPoint); diff --git a/loleaflet/src/map/handler/Map.Keyboard.js b/loleaflet/src/map/handler/Map.Keyboard.js index b72c246..d6138b2 100644 --- a/loleaflet/src/map/handler/Map.Keyboard.js +++ b/loleaflet/src/map/handler/Map.Keyboard.js @@ -170,11 +170,13 @@ L.Map.Keyboard = L.Handler.extend({ this._map.on('mousedown', this._onMouseDown, this); this._map.on('keydown keyup keypress', this._onKeyDown, this); + this._map.on('compositionend', this._onKeyDown, this); }, removeHooks: function () { this._map.on('mousedown', this._onMouseDown, this); this._map.off('keydown keyup keypress', this._onKeyDown, this); + this._map.off('compositionend', this._onKeyDown, this); }, _setPanOffset: function (pan) { @@ -257,6 +259,9 @@ L.Map.Keyboard = L.Handler.extend({ var charCode = e.originalEvent.charCode; var keyCode = e.originalEvent.keyCode; + if (e.type === 'compositionend') { + charCode = keyCode = e.originalEvent.data.charCodeAt(); + } var unoKeyCode = this._toUNOKeyCode(keyCode); if (this.modifier) { @@ -273,7 +278,7 @@ L.Map.Keyboard = L.Handler.extend({ if (e.type === 'keydown' && this.handleOnKeyDown[keyCode] && charCode === 0) { docLayer._postKeyboardEvent('input', charCode, unoKeyCode); } - else if (e.type === 'keypress' && + else if ((e.type === 'keypress' || e.type === 'compositionend') && (!this.handleOnKeyDown[keyCode] || charCode !== 0)) { if (charCode === keyCode && charCode !== 13) { // Chrome sets keyCode = charCode for printable keys commit 636e68b76dcb1fab70201051dd4582e23e82d4be Author: Jan Holesovsky <ke...@collabora.com> Date: Fri Apr 8 19:13:54 2016 +0200 loleaflet bccu#1587: Trigger locontextmenu event with the context menu structure. (cherry picked from commit b76140cb7b98383ccc5e008a48403c8f235e968a) diff --git a/loleaflet/reference.html b/loleaflet/reference.html index 130b38b..0f85442 100644 --- a/loleaflet/reference.html +++ b/loleaflet/reference.html @@ -1887,6 +1887,12 @@ unexpected behaviour.</h4> <td>Fired when the state of a command such as .uno:Bold changes.</td> </tr> <tr> + <td><code><b>locontextmenu</b></code></td> + <td><code><a href="#locontextmenu-event">LOContextMenuEvent</a></code></td> + <td>Fired when the user's action invoked a context menu (via a + right-click). It contains the structure of the menu.</td> + </tr> + <tr> <td><code><b>docsize</b></code></td> <td><code><a href="#docsize-event">DocumentSizeEvent</a></code></td> <td>Fired when the document size changes.</td> @@ -2030,6 +2036,29 @@ unexpected behaviour.</h4> </tr> </table> +<h3 id="locontextmenu-event">LOContextMenuEvent</h3> + +<table data-id='events'> + <tr> + <th class="width100">property</th> + <th>type</th> + <th>description</th> + </tr> + <tr> + <td><code><b>menu</b></code></td> + <td><code>String</code></td> + <td>List of the menu entries. The structure looks like:<br/> +<code> +{ "text": "label text1", "type": "command", "command": ".uno:Something1", "enabled": "true" }, +{ "text": "label text2", "type": "command", "command": ".uno:Something2", "enabled": "false" }, +{ "type": "separator" }, +{ "text": "label text2", "type": "menu", "menu": [ { ... }, { ... }, ... ] }, +... +</code> + </td> + </tr> +</table> + <h3 id="docsize-event">DocumentSizeEvent</h3> <table data-id='events'> diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js index 572a444..e40de91 100644 --- a/loleaflet/src/layer/tile/TileLayer.js +++ b/loleaflet/src/layer/tile/TileLayer.js @@ -330,6 +330,9 @@ L.TileLayer = L.GridLayer.extend({ else if (textMsg.startsWith('unocommandresult:')) { this._onUnoCommandResultMsg(textMsg); } + else if (textMsg.startsWith('contextmenu:')) { + this._onContextMenuMsg(textMsg); + } }, _onCommandValuesMsg: function (textMsg) { @@ -624,6 +627,13 @@ L.TileLayer = L.GridLayer.extend({ this._map.fire('commandresult', {commandName: commandName, success: success}); }, + _onContextMenuMsg: function (textMsg) { + textMsg = textMsg.substring(13); + var obj = JSON.parse(textMsg); + + this._map.fire('locontextmenu', obj); + }, + _onTextSelectionMsg: function (textMsg) { var strTwips = textMsg.match(/\d+/g); this._selections.clearLayers(); commit 0172d82f3c523f5ae1d60e85d97894f374fe4a56 Author: Jan Holesovsky <ke...@collabora.com> Date: Fri Apr 8 19:13:19 2016 +0200 loolwsd bccu#1587: Add handling of contextmenu: command. (cherry picked from commit 156d52b82eb1a4c00e671bbf88e0d5ce61333609) diff --git a/loolwsd/LOKitClient.cpp b/loolwsd/LOKitClient.cpp index 9542942..16a98e1 100644 --- a/loolwsd/LOKitClient.cpp +++ b/loolwsd/LOKitClient.cpp @@ -67,6 +67,7 @@ extern "C" CASE(DOCUMENT_PASSWORD); CASE(DOCUMENT_PASSWORD_TO_MODIFY); CASE(ERROR); + CASE(CONTEXT_MENU); #undef CASE } std::cout << " payload: " << pPayload << std::endl; diff --git a/loolwsd/LOOLSession.cpp b/loolwsd/LOOLSession.cpp index 16fc4d8..4020725 100644 --- a/loolwsd/LOOLSession.cpp +++ b/loolwsd/LOOLSession.cpp @@ -1091,6 +1091,9 @@ extern "C" " kind=" + object->get("kind").toString() + " code=" + object->get("code").toString()); } break; + case LOK_CALLBACK_CONTEXT_MENU: + srv->sendTextFrame("contextmenu: " + std::string(pPayload)); + break; } } } diff --git a/loolwsd/protocol.txt b/loolwsd/protocol.txt index 0c3db9b..600d361 100644 --- a/loolwsd/protocol.txt +++ b/loolwsd/protocol.txt @@ -120,6 +120,23 @@ clientvisiblearea x=<x> y=<y> width=<width> height=<height> server -> client ================ +contextmenu: <json description of the context menu> + + When the user right-clicks in the document, the content of the context + menu is sent back via this callback. + + The structure of the context menu is a JSON, and looks like: + + { + "menu": [ + { "text": "label text1", "type": "command", "command": ".uno:Something1", "enabled": "true" }, + { "text": "label text2", "type": "command", "command": ".uno:Something2", "enabled": "false" }, + { "type": "separator" }, + { "text": "label text2", "type": "menu", "menu": [ { ... }, { ... }, ... ] }, + ... + ] + } + downloadas: jail=<jail directory> dir=<a tmp dir> name=<name> port=<port> The client should then request http://server:port/jail/dir/name in order to download commit 75f0b6868179c7b5d47c6d777e9dfee2ddd92464 Author: Jan Holesovsky <ke...@collabora.com> Date: Fri Apr 8 16:49:50 2016 +0200 bccu#1587: Update LOK headers to the latest ones. (cherry picked from commit 756cb642038e2d3c255ac8dbf92efecf86625beb) diff --git a/loolwsd/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h b/loolwsd/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h index 901bf6b..7543ff7 100644 --- a/loolwsd/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h +++ b/loolwsd/bundled/include/LibreOfficeKit/LibreOfficeKitEnums.h @@ -280,6 +280,29 @@ typedef enum * } */ LOK_CALLBACK_ERROR, + + /** + * Context menu structure + * + * Returns the structure of context menu. Contains all the separators & + * submenus, example of the returned structure: + * + * { + * "menu": [ + * { "text": "label text1", "type": "command", "command": ".uno:Something1", "enabled": "true" }, + * { "text": "label text2", "type": "command", "command": ".uno:Something2", "enabled": "false" }, + * { "type": "separator" }, + * { "text": "label text2", "type": "menu", "menu": [ { ... }, { ... }, ... ] }, + * ... + * ] + * } + * + * The 'command' can additionally have a checkable status, like: + * + * {"text": "label text3", "type": "command", "command": ".uno:Something3", "checktype": "checkmark|radio|auto", "checked": "true|false"} + */ + LOK_CALLBACK_CONTEXT_MENU, + } LibreOfficeKitCallbackType; diff --git a/loolwsd/bundled/include/LibreOfficeKit/LibreOfficeKitInit.h b/loolwsd/bundled/include/LibreOfficeKit/LibreOfficeKitInit.h index a1b2ddc..f1e513e 100644 --- a/loolwsd/bundled/include/LibreOfficeKit/LibreOfficeKitInit.h +++ b/loolwsd/bundled/include/LibreOfficeKit/LibreOfficeKitInit.h @@ -45,12 +45,9 @@ extern "C" void *lok_loadlib(const char *pFN) { return dlopen(pFN, RTLD_LAZY -#if defined __clang__ && defined __linux__ \ - && defined ENABLE_RUNTIME_OPTIMIZATIONS -#if !ENABLE_RUNTIME_OPTIMIZATIONS +#if defined LOK_LOADLIB_GLOBAL | RTLD_GLOBAL #endif -#endif ); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits