[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - 2 commits - filter/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Feb 22 19:57:33 UTC 2019
filter/source/svg/presentation_engine.js | 44 ++++++++++++++++++++++++++++++-
1 file changed, 43 insertions(+), 1 deletion(-)
New commits:
commit 47ecfa0d8bd64ad946b5ec1238f43df5632b1960
Author: Tor Lillqvist <tml at collabora.com>
AuthorDate: Fri Feb 22 20:32:45 2019 +0200
Commit: Tor Lillqvist <tml at collabora.com>
CommitDate: Fri Feb 22 21:48:39 2019 +0200
tdf#122582: Add ways to exit the slideshow in the iOS app
Either going past the end, or pressing the 'q' key on a hardware
keyboard will exit the slideshow by posting an 'EXITSLIDESHOW' message
to the app. (The app will have to handle that, of course, will commit
in a moment.)
Change-Id: I075e5e3fa86cc632cb3071d6546721b010ff77a2
diff --git a/filter/source/svg/presentation_engine.js b/filter/source/svg/presentation_engine.js
index 7e0fdfb87877..fc1049d03260 100644
--- a/filter/source/svg/presentation_engine.js
+++ b/filter/source/svg/presentation_engine.js
@@ -190,6 +190,11 @@ function getDefaultKeyCodeDictionary()
= function() { return aSlideShow.displaySlide( theMetaDoc.nNumberOfSlides - 1, true ); };
keyCodeDict[SLIDE_MODE][SPACE_KEY]
= function() { return dispatchEffects(1); };
+ // The ESC key can't actually be handled on iOS, it seems to be hardcoded to work like the home button? But try anyway.
+ keyCodeDict[SLIDE_MODE][ESCAPE_KEY]
+ = function() { return aSlideShow.exitSlideShowInApp(); };
+ keyCodeDict[SLIDE_MODE][Q_KEY]
+ = function() { return aSlideShow.exitSlideShowInApp(); };
// index mode
keyCodeDict[INDEX_MODE][LEFT_KEY]
@@ -1833,6 +1838,7 @@ var END_KEY = 35; // end keycode
var ENTER_KEY = 13;
var SPACE_KEY = 32;
var ESCAPE_KEY = 27;
+var Q_KEY = 81;
// Visibility Values
var HIDDEN = 0;
@@ -15675,14 +15681,28 @@ SlideShow.prototype.rewindAllEffects = function()
}
};
+SlideShow.prototype.exitSlideShowInApp = function()
+{
+ var ua = navigator.userAgent;
+ if (ua.indexOf(' AppleWebKit/') !== -1 &&
+ ua.indexOf(' Mobile/') !== -1 &&
+ window.webkit !== undefined &&
+ window.webkit.messageHandlers !== undefined &&
+ window.webkit.messageHandlers.lool !== undefined)
+ window.webkit.messageHandlers.lool.postMessage('EXITSLIDESHOW', '*');
+}
+
SlideShow.prototype.displaySlide = function( nNewSlide, bSkipSlideTransition )
{
var aMetaDoc = theMetaDoc;
var nSlides = aMetaDoc.nNumberOfSlides;
if( nNewSlide < 0 && nSlides > 0 )
nNewSlide = nSlides - 1;
- else if( nNewSlide >= nSlides )
+ else if( nNewSlide >= nSlides ) {
nNewSlide = 0;
+ // In the iOS app, exit the slideshow when going past the end.
+ this.exitSlideShowInApp();
+ }
if( ( currentMode === INDEX_MODE ) && ( nNewSlide === nCurSlide ) )
{
commit 06405cae7ccd596f2e0f4dd49a3e7612a883e654
Author: Tor Lillqvist <tml at collabora.com>
AuthorDate: Fri Feb 22 18:27:01 2019 +0200
Commit: Tor Lillqvist <tml at collabora.com>
CommitDate: Fri Feb 22 21:47:41 2019 +0200
Handle arrow keys (from a hardware keyboard) on iOS
Change-Id: Ia5946a77215eba565c3ff8c4dfbc08b95af493c0
diff --git a/filter/source/svg/presentation_engine.js b/filter/source/svg/presentation_engine.js
index cfbbc86f9b69..7e0fdfb87877 100644
--- a/filter/source/svg/presentation_engine.js
+++ b/filter/source/svg/presentation_engine.js
@@ -106,6 +106,28 @@ function onKeyDown( aEvt )
var code = aEvt.keyCode || aEvt.charCode;
+ // console.log('===> onKeyDown: ' + code);
+
+ // Handle arrow keys in iOS WebKit (including Mobile Safari)
+ if (code == 0 && aEvt.key != undefined) {
+ switch (aEvt.key) {
+ case 'UIKeyInputLeftArrow':
+ code = LEFT_KEY;
+ break;
+ case 'UIKeyInputUpArrow':
+ code = UP_KEY;
+ break;
+ case 'UIKeyInputRightArrow':
+ code = RIGHT_KEY;
+ break;
+ case 'UIKeyInputDownArrow':
+ code = DOWN_KEY;
+ break;
+ }
+
+ // console.log(' now: ' + code);
+ }
+
if( !processingEffect && keyCodeDictionary[currentMode] && keyCodeDictionary[currentMode][code] )
{
return keyCodeDictionary[currentMode][code]();
More information about the Libreoffice-commits
mailing list