Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate

Optimizing touch gestures for scrolling in LO or OO Writer

  • Please log in to reply
No replies to this topic
  • Members
  • 173 posts
  • Last active: Jan 24 2016 05:21 PM
  • Joined: 17 Oct 2014

This is a question addressed only to those who

i) use LibreOffice or OpenOffice Writer

ii) on a touch-screen computer!


These programs unfortunately do not support touch screens, so the content of a document in a Writer window cannot be scrolled by a touch gesture (touch gestures result in selecting text instead).


Using a simple AHK script, I am now able to reproduce (or simulate) the effect of touch gestures in Writer to some extent. So this approach seems to have potential to bring up a really practicable solution for the use of LO/OO Writer on tablet computers.


With this script, the scrolling behavior is not perfect:

- It is not very smooth (which probably is associated to specific limitations of LO and OO).

- A text-selecting effect is sometimes to see for short moments during touch-gesture scrolling.

- The touch gesture also must be limited to the area of the text part of the window to avoid undesired scrolling effects.


My question: How this behavior could be optimized?

; Touch-gesture scrolling should be enabled 
; in a LO/OO Writer window (ahk_class SALFRAME) (1)
; by touch gestures simulating LButton actions (2)
; to send {WheelUp} / {WheelDown} (5)
; {Esc} is used to override the text-selecting effect. (6)
; If Ctrl is pressed during touch gestures, they should produce the LO/OO standard effect (text selection). (3)
; To avoid undesired effects when e.g. touching the title bar of the Writer window, the effect should take place 
; only in the white area. (4) 

#if WinActive("ahk_class SALFRAME") AND !GetKeyState("LButton","P")  ; (1) Writer = active window & (2) LButton not physically pressed
~LButton::SetTimer, MousePos, 30
~^LButton::SetTimer, MousePos, Off		; (3) with Ctrl: selecting text instead of scrolling
~LButton up::SetTimer, MousePos, Off


MouseGetPos, X, Y
PixelGetColor, Color, %X%, %Y% 		; (4) touched in the white area
If Color = 0xFFFFFF
   Sleep 5
   MouseGetPos, A, B
   If (Y-B > 3)
   	Send {WheelDown}		; (5)
   	Send {Esc}			; (6) 
	Sleep 1
   	Send {WheelDown}
   	Send {Esc}
   If (Y-B < -3)
   	Send {WheelUp}
   	Send {Esc}
	Sleep 1
   	Send {WheelUp}
   	Send {Esc}

PS: In programs which support touch gestures, the standard behavior seems to be the following: A more vertical touch gesture results in scrolling, a more horizontal gesture results in selecting text. (You can see this e.g. in a Notepad window.) Such a behavior can be simulated by slight adaptations of the above script, but I decided to limit this first attempts to finding out how the scrolling effect itself could be optimized.