levitation / vwkvasdopager

Automatically exported from code.google.com/p/vwkvasdopager
1 stars 0 forks source link

Mousewheel to switch desktops #1

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Mousewheel on pager should change desktops

Original issue reported on code.google.com by kvasdo...@gmail.com on 29 Oct 2008 at 8:03

GoogleCodeExporter commented 9 years ago
What must we do to enable this? 

Original comment by wallace...@gmail.com on 28 Jun 2010 at 8:16

GoogleCodeExporter commented 9 years ago
The OS sends mousewheel messages only to active window (that currently have 
focus), so it seems that required behaviour can't be achieved as simple as i 
thought.

Original comment by kvasdo...@gmail.com on 29 Jun 2010 at 12:28

GoogleCodeExporter commented 9 years ago
It's possible to catch mousewheel events globally using SetWindowsHookEx().

Unlike some other win32 hooks WH_MOUSE_LL hook doesn't involve any kind of 
complex DLL injection.

To demonstrate this I've made a 36 lines C++ program that display a 
MessageBox() when the the mousewhell is scrolled over a 100 pixels² region at 
the top-left of the screen.

I think the scrollwheel feature should be optional though. It's a Windows 
convention that the active window should receive scroll events and it could be 
confusing to see the desktop change because the mouse cursor happens to be at 
the wrong place.

Any thought on this kvasdopil?

Original comment by alexandre.jasmin on 30 Jun 2010 at 4:03

Attachments:

GoogleCodeExporter commented 9 years ago
Updated main.cpp:
 - Wasn't working on XP because hInstance wasn't passed to SetWindowsHookEx() (Win7 doesn't mind for some reason).

 - Modified hook function to call PostMessage() and return. I think we should avoid complex processing there.

 - use std::cout instead of MessageBox(). It's a console app after all ;-)

It seems that the touchpad software on my laptop prevents the scroll gesture 
from being used unless the mouse cursor is directly over a scrollable area.

That would prevents me from changing desktop using the touchpad.

Not necessarily a bad thing as this "feature" prevents the kind of mistake I 
was worried about in Comment 3.

Original comment by alexandre.jasmin on 30 Jun 2010 at 5:46

GoogleCodeExporter commented 9 years ago

Original comment by alexandre.jasmin on 30 Jun 2010 at 5:46

Attachments:

GoogleCodeExporter commented 9 years ago
I've looked into the way my touchpad works in more details.

It's an ALPS touchpad.

It seems the touchpad driver only generates scroll messages when the mouse 
cursor is over the active Window. There's apparently no way to configure it 
otherwise but plugging a mouse works just fine.

Original comment by alexandre.jasmin on 30 Jun 2010 at 11:43

GoogleCodeExporter commented 9 years ago
@kvasdopil - Would you mind if I write a patch for this? I'll understand if you 
prefer looking into this yourself or if you don't feel like accepting more 
changes right now.

Original comment by alexandre.jasmin on 30 Jun 2010 at 11:48

GoogleCodeExporter commented 9 years ago
@alexandre.jasmin - no, patches are welcomed. I'm currently waiting for bjasspa 
to send me all the patches so i can recompile and publish new binary, so 
another patches are ok now. 

Original comment by kvasdo...@gmail.com on 2 Jul 2010 at 5:25

GoogleCodeExporter commented 9 years ago
Okay. I'll give it a try.

Original comment by alexandre.jasmin on 2 Jul 2010 at 11:37

GoogleCodeExporter commented 9 years ago
I have a working patch.

Added two functions mouseHookRegister() and mouseHookCallback(). I've simply 
put these in an header file include from vwKvasdoPager.cpp which appears to be 
the style you use.

I haven't bother patching the Visual C++ project to add that new header since 
it probably will be replaced soon anyways.

The code is not too complex. mouseHookCallback() just intercepts mouse wheel 
events over the page and PostMessage(VW_CHANGEDESK) to VirtualWin.

I haven't bothered adding an option to disable the mouse wheel. I'm not sure 
that's a good idea anymore and I'm not going to write a preference dialog just 
for this.

Original comment by alexandre.jasmin on 3 Jul 2010 at 6:34

GoogleCodeExporter commented 9 years ago
Attaching a build with the patch applied on top of SVN r10

@wallace.ww - If you want to try this just replace the file in "C:\Program 
Files\VirtuaWin\modules" by that one.

Original comment by alexandre.jasmin on 3 Jul 2010 at 6:39

Attachments:

GoogleCodeExporter commented 9 years ago
Patch with more coherent coding style.

The previous patch one had two cases of "space before an if" and one "open 
brace on the same line". 

Original comment by alexandre.jasmin on 3 Jul 2010 at 7:48

Attachments:

GoogleCodeExporter commented 9 years ago
New patch using WindowFromPoint() to verify if the mouse cursor is over the 
pager.

I was previously checking if the mouse cursor was inside the pager rectangle 
using GetWindowRect() but that was bogus since a window could be covering it.

Original comment by alexandre.jasmin on 3 Jul 2010 at 10:05

Attachments:

GoogleCodeExporter commented 9 years ago
Attaching a new build with the above patch applied on top of SVN r10

Original comment by alexandre.jasmin on 3 Jul 2010 at 10:09

Attachments:

GoogleCodeExporter commented 9 years ago
One renaming problem is that you can't move the mouse all the way to the edge 
of the screen and use the wheel because its are a few pixel outside the pager.

I'm trying to figure out a clean way to fix this.

Original comment by alexandre.jasmin on 4 Jul 2010 at 12:00

GoogleCodeExporter commented 9 years ago
I would like the mouse wheel to work when the mouse cursor is at the edge of 
the screen (i.e. two pixels bellow the pager if the taskbar is at bottom of the 
screen).

It's just much easier to move the mouse at the edge than directly above the 
pager.

However I'd prefer to wait until bjasspa changes are checked-in before looking 
into this. I've noticed that on bjasspa's build with themes are enabled I can 
no longer switch between desktops by clicking at the edge of the screen. It was 
working before and still works when themes are turned off.

So I'd prefer to wait for all the changes to get merged before I look at both 
the "clcking at the edge" and "scrolling at the edge" issues.

I think my mouse wheel patch is still usable in its current form though.

Original comment by alexandre.jasmin on 4 Jul 2010 at 5:45

GoogleCodeExporter commented 9 years ago
the patch is applied
great job!

i'll defer closing this issue until solution for the 'edge problem' will be 
found, is it ok?

Original comment by kvasdo...@gmail.com on 17 Jul 2010 at 1:54

GoogleCodeExporter commented 9 years ago

Original comment by kvasdo...@gmail.com on 17 Jul 2010 at 4:01

GoogleCodeExporter commented 9 years ago
I've opened Issue 30 to track the 'edge problem'. I suppose you can close this 
one.

Original comment by alexandre.jasmin on 25 Jul 2010 at 4:52

GoogleCodeExporter commented 9 years ago
I've also opened Issue 31 to suggest the addition of some configurable 
parameters for the mousewheel.

Original comment by alexandre.jasmin on 25 Jul 2010 at 5:22

GoogleCodeExporter commented 9 years ago

Original comment by kvasdo...@gmail.com on 26 Jul 2010 at 6:21