[Libreoffice-commits] core.git: 4 commits - android/experimental sal/inc vcl/source

Tor Lillqvist tml at iki.fi
Thu Mar 7 11:52:39 PST 2013


 android/experimental/desktop/src/org/libreoffice/experimental/desktop/Desktop.java |   35 +++++-----
 sal/inc/sal/log-areas.dox                                                          |    1 
 vcl/source/control/scrbar.cxx                                                      |    1 
 vcl/source/window/window2.cxx                                                      |    6 +
 vcl/source/window/winproc.cxx                                                      |   21 +++++-
 5 files changed, 46 insertions(+), 18 deletions(-)

New commits:
commit 783d3928b7d935e2a022f92318e00faa3efa6bc7
Author: Tor Lillqvist <tml at iki.fi>
Date:   Thu Mar 7 21:46:30 2013 +0200

    Try to make the scrolling and zooming actions snappier
    
    Now it does work nicely during the gesture when all the action is on the Java
    side (translating and scaling the pre-rendered bitmap). Looks a bit sad, of
    course, that nothing scrolls in to replace the parts of page(s) scrolled out
    during the gesture, and correspondingly for zooming.
    
    To then get the stuff down in the murky depths of the LO code to do what I
    want still is beyond me.
    
    Change-Id: I9ce33ed482013d18a877d1798de3bce5ac608e5e

diff --git a/android/experimental/desktop/src/org/libreoffice/experimental/desktop/Desktop.java b/android/experimental/desktop/src/org/libreoffice/experimental/desktop/Desktop.java
index ace4efe..5fb59f2 100644
--- a/android/experimental/desktop/src/org/libreoffice/experimental/desktop/Desktop.java
+++ b/android/experimental/desktop/src/org/libreoffice/experimental/desktop/Desktop.java
@@ -282,8 +282,10 @@ public class Desktop
 
         @Override public boolean onTouchEvent(MotionEvent event)
         {
-            if (gestureDetector.onTouchEvent(event))
+            if (event.getPointerCount() == 1 &&
+                gestureDetector.onTouchEvent(event)) {
                 return true;
+            }
 
             // There is no callback in SimpleOnGestureListener for end
             // of scroll. Is this a good way to detect it? Assume that
@@ -296,17 +298,14 @@ public class Desktop
                 Desktop.scroll((int) translateX, (int) translateY);
                 translateX = translateY = 0;
                 scrollInProgress = false;
-            }
-
-            // If a scaling gesture is in progress no other touch
-            // processing should be done.
-            if (scaleDetector.onTouchEvent(event) && scalingInProgress)
+                invalidate();
+            } else if (event.getPointerCount() == 2 &&
+                       scaleDetector.onTouchEvent(event) &&
+                       scalingInProgress) {
+                // If a scaling gesture is in progress no other touch
+                // processing should be done.
                 return true;
-
-            if (!renderedOnce)
-                return super.onTouchEvent(event);
-
-            super.onTouchEvent(event);
+            }
 
             // Just temporary hack. We should not show the keyboard
             // unconditionally on a ACTION_UP event here. The LO level
@@ -323,12 +322,14 @@ public class Desktop
                 imm.showSoftInput(this, InputMethodManager.SHOW_FORCED);
             }
 
-            switch (event.getActionMasked()) {
-            case MotionEvent.ACTION_DOWN:
-            case MotionEvent.ACTION_UP:
-            case MotionEvent.ACTION_MOVE:
-                Desktop.touch(event.getActionMasked(), (int) event.getX(), (int) event.getY());
-                break;
+            if (event.getPointerCount() == 1) {
+                switch (event.getActionMasked()) {
+                case MotionEvent.ACTION_DOWN:
+                case MotionEvent.ACTION_UP:
+                case MotionEvent.ACTION_MOVE:
+                    Desktop.touch(event.getActionMasked(), (int) event.getX(), (int) event.getY());
+                    break;
+                }
             }
 
             return true;
commit 847583867903cc7e2dd1abaeaef5245c9310243a
Author: Tor Lillqvist <tml at iki.fi>
Date:   Thu Mar 7 21:36:49 2013 +0200

    Some further hacks for scrolling on touch devices, but no cigar
    
    The scrolling concepts seem quite obscure and firmly tied to concepts like
    "pages" and "lines". For touch devices one would want to be able to request
    scrolling simply in *pixels*.
    
    It is the scrollbar objects (in vcl and toolkit, and yes, UNO is also involved
    over in toolkit) that all the action goes through so they must exist even if
    they should not be displayed.
    
    (Both on Android and iOS we should presumably use these system-specific
    ephemeral scroll indicator thingies that show up only during scrolling but
    otherwise fade away. Hmm, probably the VCL (or toolkit?) scrollbar code should
    use platform-specific code to display those then.)
    
    Change-Id: I1f82648561e41ae25f2427fd0fe60249c927a9a1

diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx
index d4a6fa8..b8f1cde 100644
--- a/vcl/source/window/winproc.cxx
+++ b/vcl/source/window/winproc.cxx
@@ -2621,12 +2621,30 @@ long ImplWindowFrameProc( Window* pWindow, SalFrame* /*pFrame*/,
             aSalWheelMouseEvent.mnX = 0; // ???
             aSalWheelMouseEvent.mnY = 0;
 
-            aSalWheelMouseEvent.mbDeltaIsPixel = sal_False;
+            // Note that it seems that the delta-is-pixels thing is
+            // not actually implemented. The field is just passed on
+            // but its value never tested and has no effect?
+            aSalWheelMouseEvent.mbDeltaIsPixel = sal_True;
 
             // First scroll vertically, then horizontally
             aSalWheelMouseEvent.mnDelta = (long) pScrollEvent->GetYOffset();
+
+            // No way to figure out correct amount of "lines" to
+            // scroll, and for touch devices (for which this
+            // SALEVENBT_EXTERNALSCROLL was introduced) we don't even
+            // display the scroll bars. This means that the scroll
+            // bars (which still exist as objects, all the scrolling
+            // action goes through them) apparently use some dummy
+            // default values for range, line size and page size
+            // anyway, not related to actual contents of scrolled
+            // window. This all is very broken. I really wish the
+            // delta-is-pixels feature (which would be exactly what
+            // one wants for touch devices) would work.
+            aSalWheelMouseEvent.mnScrollLines = aSalWheelMouseEvent.mnDelta;
+
             if (aSalWheelMouseEvent.mnDelta != 0)
             {
+                aSalWheelMouseEvent.mnNotchDelta = (aSalWheelMouseEvent.mnDelta < 0) ? -1 : 1;
                 aSalWheelMouseEvent.mnCode = 0;
                 aSalWheelMouseEvent.mbHorz = sal_False;
                 nRet = ImplHandleWheelEvent( pWindow, aSalWheelMouseEvent );
@@ -2634,6 +2652,7 @@ long ImplWindowFrameProc( Window* pWindow, SalFrame* /*pFrame*/,
             aSalWheelMouseEvent.mnDelta = (long) pScrollEvent->GetXOffset();
             if (aSalWheelMouseEvent.mnDelta != 0)
             {
+                aSalWheelMouseEvent.mnNotchDelta = (aSalWheelMouseEvent.mnDelta < 0) ? -1 : 1;
                 aSalWheelMouseEvent.mnCode = 0;
                 aSalWheelMouseEvent.mbHorz = sal_True;
                 nRet = ImplHandleWheelEvent( pWindow, aSalWheelMouseEvent );
commit a9c6211a5229362b9fb6645d0c3a631caaf59790
Author: Tor Lillqvist <tml at iki.fi>
Date:   Thu Mar 7 21:35:29 2013 +0200

    Add a comment
    
    Change-Id: Id97c8e2bdbea40db4224147eaabe68a87cd9c08d

diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index 906d65b..ba8cc38 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -1197,6 +1197,12 @@ sal_Bool Window::HandleScrollCommand( const CommandEvent& rCmd,
 
 // -----------------------------------------------------------------------
 
+// Not that when called for COMMAND_WHEEL above, despite its name,
+// pVScrl isn't necessarily the vertical scroll bar. Depending on
+// whether the scroll is horizontal or vertical, it is either the
+// horizontal or vertical scroll bar. nY is correspondingly either
+// the horizontal or vertical scroll amount.
+
 void Window::ImplHandleScroll( ScrollBar* pHScrl, long nX,
                                ScrollBar* pVScrl, long nY )
 {
commit e278c023f77180d6e72640f4204269c7d82dda03
Author: Tor Lillqvist <tml at iki.fi>
Date:   Thu Mar 7 21:34:44 2013 +0200

    Add a SAL_INFO()
    
    Change-Id: Ic681a76deb8db931f7868ca00d649cc3cbabe21b

diff --git a/sal/inc/sal/log-areas.dox b/sal/inc/sal/log-areas.dox
index bbe1f1f..0df74eb 100644
--- a/sal/inc/sal/log-areas.dox
+++ b/sal/inc/sal/log-areas.dox
@@ -239,6 +239,7 @@ certain functionality.
 @li @c vcl.gdi - the GDI part of VCL, devices, bitmaps, etc.
 @li @c vcl.gtk - Gtk+ 2/3 plugin
 @li @c vcl.layout - Widget layout
+ at li @c vcl.scrollbar - Scroll Bars
 @li @c vcl.sm - Session Manager
 @li @c vcl.window
 
diff --git a/vcl/source/control/scrbar.cxx b/vcl/source/control/scrbar.cxx
index 961b052..f5677a9 100644
--- a/vcl/source/control/scrbar.cxx
+++ b/vcl/source/control/scrbar.cxx
@@ -1410,6 +1410,7 @@ long ScrollBar::DoScroll( long nNewPos )
     if ( meScrollType != SCROLL_DONTKNOW )
         return 0;
 
+    SAL_INFO("vcl.scrollbar", "DoScroll(" << nNewPos << ")");
     meScrollType = SCROLL_DRAG;
     long nDelta = ImplScroll( nNewPos, sal_True );
     meScrollType = SCROLL_DONTKNOW;


More information about the Libreoffice-commits mailing list