View previous topic :: View next topic |
Author |
Message |
kberg Agent

Joined: May 28, 2006 Posts: 18
|
Posted: Tue Apr 29, 2008 2:17 am Post subject: Multitouch |
|
This is a further elaboration of
http://trinity.neooffice.org/modules.php?name=Forums&file=viewtopic&p=43334#43334.
As pinch, rotate an swipe are used in nearly all apple apps on Leopard (you can even zoom and swipe neo documents in quicklook ), it would be really nice to have this features in in neo, too.
I just checked out the current source of neo and looked for locations to grab the necessary events.
According to your posts from the link above I did a Code: | find . -name *.m -exec grep -q "sendEvent" '{}' \; -print | and found these files that could fit the bill.
Code: |
./neojava/desktop/source/app/main_cocoa.m
./neojava/vcl/java/source/app/salinst_cocoa.m
|
I'm not very into the neo/ooo code. I had some looks especially at VCLEventQueue(_cocoa.m) and neojava/vcl/java/source generally.
I'm looking into how to implement the pagedown / zoom by swipe and pinch.
A possibility would be to suppress the swipe Event in the NSApp subclass and send an emulated pagedown/up event up the responderchain.
An other would be to call the respective methods in oo.
So my questions:
- is there interest in having these gestures supported
- if yes, what way would be preferred (and could you point a finger at where i find the corresponding methods in oo code)
Mike |
|
Back to top |
|
 |
pluby The Architect


Joined: Jun 16, 2003 Posts: 11949
|
Posted: Tue Apr 29, 2008 8:45 am Post subject: |
|
Your search got very close to the right place. The file you are going to want to put the native handling the event in is the following file:
Code: | ./neojava/vcl/java/source/java/VCLEventQueue_cocoa.m |
Basically, what you want to do is map the native Cocoa events to one or more Java of the following mouse or key events:
mousePressed
mouseReleased
mouseMoved
mouseDragged
mouseWheelScrolled
keyPressed
keyReleased
You can see an example of how I've forced a native mouse wheel scroll Cocoa event into a matching mouseWheelScrolled Java event in that file's in the [VCLWindow sendEvent] selector.
I think the hard part is not grabbing the native event as we have direct access to the window's native event dispatching. Instead, the hard part will be trying to determine which, if any, of the above Java events will cause NeoOffice's underlying OpenOffice.org code to do the behavior that matches the native event.
I do know that vertical mouse scrolling will change the View :: Zoom level of a document, but I don't know the what the full range of gesture events are off the top of my head.
Patrick |
|
Back to top |
|
 |
kberg Agent

Joined: May 28, 2006 Posts: 18
|
Posted: Fri May 02, 2008 5:01 pm Post subject: |
|
txs for the pointers...
...first vanilla build of "my untested office suite" finished... now i'm starting with coding
Mike |
|
Back to top |
|
 |
Samwise Captain Naiobi

Joined: Apr 25, 2006 Posts: 2315 Location: Montpellier, France
|
Posted: Fri May 02, 2008 5:29 pm Post subject: |
|
kberg wrote: | ...first vanilla build of "my untested office suite" finished... now i'm starting with coding  |
It's been a long time since I last built NeoOffice… how long did it take you to build, and do you mind posting your specs (processor, RAM, hard drive)? |
|
Back to top |
|
 |
pluby The Architect


Joined: Jun 16, 2003 Posts: 11949
|
Posted: Fri May 02, 2008 5:56 pm Post subject: |
|
kberg wrote: | txs for the pointers...
...first vanilla build of "my untested office suite" finished... now i'm starting with coding
Mike |
Did you check out the HEAD branch? If so, I have committed a change to vcl/java/source/java/VCLEventQueue_cocoa.m that handles the magnify event. If you are using the HEAD branch, can you cvs update vcl, rebuild vcl, and copy the built libvcl680mx*.dylib into your installation?
How I handled the magnify event was to treat it as a vertical scroll wheel event and using its deltaZ value as deltaY. Since in most of the OpenOffice.org document types, a vertical scroll wheel event will change the View :: Zoom level of the document, this should hopefully do the same.
Patrick |
|
Back to top |
|
 |
pluby The Architect


Joined: Jun 16, 2003 Posts: 11949
|
Posted: Fri May 02, 2008 8:38 pm Post subject: |
|
FYI. I just committed swipe support to the same file so cvs update the file if your build is from the HEAD branch. Otherwise, I'll put it in a test patch in the next day or two.
With my latest commit, downward and left-to-right swipes will be converted to a page down key events and upward and right-to-left swipes will be converted to page up key events.
Patrick |
|
Back to top |
|
 |
kberg Agent

Joined: May 28, 2006 Posts: 18
|
Posted: Fri May 02, 2008 11:33 pm Post subject: |
|
@pluby
Hey,
that was a fast one, as usual, txs
I'd taken the same approach for the swipe.
I'm curious on pinch/zoom ... as deltaZ sometimes need some adjustment.
I'm a little confused about the "vertical scroll wheel event"... this does scroll my document now. Is there a modifier needed?
I co'ed NeoOffice-2_2_3... so I had to update my rep first.
Rebuilding now, so I can give feedbacks a little bit faster.
@samwise
did it on a mac mini 1.83ghz Core 2 Due, 1.5gb RAM, 1.08tb
(my my media/build server )
Used current Tiger, latest of all dependencies and mono 1.9 to build.
Took me the better of a day... maybe less if I'd discover the prompts for the certificates a wee bit earlier.
Mike |
|
Back to top |
|
 |
ovvldc Captain Naiobi

Joined: Sep 13, 2004 Posts: 2352 Location: Zürich, CH
|
Posted: Sat May 03, 2008 1:16 am Post subject: |
|
pluby wrote: | How I handled the magnify event was to treat it as a vertical scroll wheel event and using its deltaZ value as deltaY. Since in most of the OpenOffice.org document types, a vertical scroll wheel event will change the View :: Zoom level of the document, this should hopefully do the same. |
I really hope this will not affect vertical scrolling. Acrobat 7 on windows has this nasty behaviour where a clicking automatically turns into a zoom and it frustrates me to no end. For me, using a scroll wheel to zoom is something that belongs in Neverwinter Nights...
-Oz _________________ "What do you think of Western Civilization?"
"I think it would be a good idea!"
- Mohandas Karamchand Gandhi |
|
Back to top |
|
 |
pluby The Architect


Joined: Jun 16, 2003 Posts: 11949
|
Posted: Sat May 03, 2008 9:14 am Post subject: |
|
ovvldc wrote: | I really hope this will not affect vertical scrolling. Acrobat 7 on windows has this nasty behaviour where a clicking automatically turns into a zoom and it frustrates me to no end. For me, using a scroll wheel to zoom is something that belongs in Neverwinter Nights... |
To be more precise, in NeoOffice and OpenOffice.org will zoom when you use the scroll wheel while the Command key is pressed. This won't change. What will change is that the pinching and spreading finger actions, instead of being ignored, will emulate the scroll with the Command key pressed.
Edit: I wasn't very clear in my post so just to be clear, when I say "this won't change" what I mean is nothing in the existing NeoOffice behavior will change. The only change will be if your tackpad supports the two new magnify and swipe gesture events, we will do something with them instead of doing nothing like we do now.
Patrick |
|
Back to top |
|
 |
ovvldc Captain Naiobi

Joined: Sep 13, 2004 Posts: 2352 Location: Zürich, CH
|
Posted: Sat May 03, 2008 11:38 am Post subject: |
|
Phew! That sounds very good . Another reason to hope for a revised MacBook with the new touchpad .
Best wishes,
Oscar _________________ "What do you think of Western Civilization?"
"I think it would be a good idea!"
- Mohandas Karamchand Gandhi |
|
Back to top |
|
 |
pluby The Architect


Joined: Jun 16, 2003 Posts: 11949
|
|
Back to top |
|
 |
kberg Agent

Joined: May 28, 2006 Posts: 18
|
Posted: Sun May 04, 2008 4:10 am Post subject: |
|
Hello, hello,
build just finished (with some password delays ) and im very happy!
Pinch for Zoom works great. Sensitivity is comparable to other apps for me.
Swipe for pageup/pagedown works, too. There is a little catch, as it looks like the axis is inverted, i.e. if You swipe down, the document goes from page two to page one... same goes for left and right.
This is opposed to default behavior on Apple apps.
Well, one can always discuss, whether in the eye of touchscreen, documents have to scroll in the opposite direction as your gesture...
The other thing is that OO does not really move a full page down with the pagedown key, but that's got nothing todo with Your implementation.
Vertical and horizontal scrolling (with mousewheel and touchpad) still work as expected.
This was tested on HEAD from yesterday... hope it's the same as in the patch. MBA, 10.5.2, java 6 not installed.
Mike |
|
Back to top |
|
 |
ovvldc Captain Naiobi

Joined: Sep 13, 2004 Posts: 2352 Location: Zürich, CH
|
Posted: Sun May 04, 2008 6:18 am Post subject: |
|
Thanks for helping Patrick with this feature, Mike. You must be a busy man (I've been following kju developments with interest) and we appreciate you taking the time to help with this.
Best wishes,
Oscar _________________ "What do you think of Western Civilization?"
"I think it would be a good idea!"
- Mohandas Karamchand Gandhi |
|
Back to top |
|
 |
kberg Agent

Joined: May 28, 2006 Posts: 18
|
Posted: Sun May 04, 2008 7:47 am Post subject: |
|
@ovvldc
txs
I'm driven by need - on all the OS projects I participate. That keeps the motor going... (wish I had a little more need/time to finish Q2 now)
...but I hardly had to point a finger with this one. Patrick beat me on every aspect . So the least I can do is help with testing now.
Mike |
|
Back to top |
|
 |
pluby The Architect


Joined: Jun 16, 2003 Posts: 11949
|
Posted: Sun May 04, 2008 9:40 am Post subject: |
|
kberg wrote: | Swipe for pageup/pagedown works, too. There is a little catch, as it looks like the axis is inverted, i.e. if You swipe down, the document goes from page two to page one... same goes for left and right. |
I have committed a change to VCLEventQueue_cocoa.m that flips the deltaY value. I keep forgetting that Cocoa's Y axis starts at the bottom, not the top.
Does my latest commit fix the problem? You can test the change by doing the following in a tcsh shell:
1. cvs update neojava/vcl
2. source neojava/build/MacOSXX86EnvJava.Set
3. cd neojava/vcl ; build
4. copy neojava/vcl/unxmacx*.pro/lib/libvcl680mx*.dylib to /Applications/YourInstallationName.app/Contents/MacOS
Thank you very much for testing my last commit.
Patrick |
|
Back to top |
|
 |
|