Merge lp:~townsend/compiz/fix-gtk-mouse-scrolling into lp:compiz/0.9.11

Proposed by Christopher Townsend
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: 3848
Merged at revision: 3847
Proposed branch: lp:~townsend/compiz/fix-gtk-mouse-scrolling
Merge into: lp:compiz/0.9.11
Diff against target: 70 lines (+29/-11)
2 files modified
src/screen.cpp (+17/-0)
src/window.cpp (+12/-11)
To merge this branch: bzr merge lp:~townsend/compiz/fix-gtk-mouse-scrolling
Reviewer Review Type Date Requested Status
Marco Trevisan (Treviño) Approve
PS Jenkins bot (community) continuous-integration Approve
Brandon Schaefer (community) Approve
Review via email: mp+213930@code.launchpad.net

Commit message

Fix issue where Compiz passively grabs all mouse buttons which severely affects scrolling in Gtk apps. Now only unconditionally grab buttons 1-3 for all windows except the desktop window and only grab other buttons when there is a modifier attached to it.

Description of the change

Fix issue where Compiz passively grabs all mouse buttons which severely affects scrolling in Gtk apps. Now only unconditionally grab buttons 1-3 for all windows except the desktop window and only grab other buttons when there is a modifier attached to it.

To post a comment you must log in.
3848. By Christopher Townsend

Fix indentation formatting.

Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

Hopefully we'll never need to grab the wheels!

LGTM

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Cool, thanks!

review: Approve
Revision history for this message
Sam Spilsbury (smspillaz) wrote :
Download full text (4.1 KiB)

Please manually test this against links in gtk+ applications to check for
no regressions.
On Apr 3, 2014 5:34 AM, "Christopher Townsend" <
<email address hidden>> wrote:

> Christopher Townsend has proposed merging
> lp:~townsend/compiz/fix-gtk-mouse-scrolling into lp:compiz.
>
> Commit message:
> Fix issue where Compiz passively grabs all mouse buttons which severely
> affects scrolling in Gtk apps. Now only unconditionally grab buttons 1-3
> for all windows except the desktop window and only grab other buttons when
> there is a modifier attached to it.
>
> Requested reviews:
> Compiz Maintainers (compiz-team)
> Related bugs:
> Bug #1171342 in Compiz: "mouse scroll wheel not working in gedit &
> System Monitor"
> https://bugs.launchpad.net/compiz/+bug/1171342
> Bug #1184159 in Compiz: "[saucy] scrolling with a touchpad is jerky with
> bindings set in compiz for Desktop-based Viewport Switching"
> https://bugs.launchpad.net/compiz/+bug/1184159
> Bug #1200829 in Compiz: "Regression: Enabling typical bindings in
> "Desktop-based Viewport Switching" breaks scrollwheel scrolling in some
> windows with a usb mouse on a laptop"
> https://bugs.launchpad.net/compiz/+bug/1200829
> Bug #1240957 in Compiz: "Scrolling behaviour and window focus has
> changed and is inconsistent"
> https://bugs.launchpad.net/compiz/+bug/1240957
>
> For more details, see:
>
> https://code.launchpad.net/~townsend/compiz/fix-gtk-mouse-scrolling/+merge/213930
>
> Fix issue where Compiz passively grabs all mouse buttons which severely
> affects scrolling in Gtk apps. Now only unconditionally grab buttons 1-3
> for all windows except the desktop window and only grab other buttons when
> there is a modifier attached to it.
> --
>
> https://code.launchpad.net/~townsend/compiz/fix-gtk-mouse-scrolling/+merge/213930
> Your team Compiz Maintainers is requested to review the proposed merge of
> lp:~townsend/compiz/fix-gtk-mouse-scrolling into lp:compiz.
>
> === modified file 'src/screen.cpp'
> --- src/screen.cpp 2014-03-27 18:40:07 +0000
> +++ src/screen.cpp 2014-04-02 21:33:21 +0000
> @@ -3413,6 +3413,17 @@
>
> void cps::GrabManager::updatePassiveButtonGrabs(Window serverFrame)
> {
> + CompWindow *window = NULL;
> +
> + foreach (CompWindow *w, screen->windows ())
> + {
> + if (w->frame () == serverFrame)
> + {
> + window = w;
> + break;
> + }
> + }
> +
> /* Grab only we have bindings on */
> foreach (ButtonGrab &bind, buttonGrabs)
> {
> @@ -3427,6 +3438,12 @@
> if (ignore & ~modHandler->ignoredModMask ())
> continue;
>
> + if (window &&
> + !(window->type () & CompWindowTypeDesktopMask) &&
> + bind.button > 3 &&
> + !mods)
> + continue;
> +
> XGrabButton (screen->dpy(),
> bind.button,
> mods | ignore,
>
> === modified file 'src/window.cpp'
> --- src/window.cpp 2014-03-27 18:40:07 +0000
> +++ src/window.cpp 2014-04-02 21:33:21 +0000
> @@ -5620,20 +5620,21 @@
> }
> }
>
> - if (onlyActions)
> + if...

Read more...

Revision history for this message
Christopher Townsend (townsend) wrote :

Hey Sam,

Thanks for the suggestion. Could you give a bit more detail on what you mean by "links in gtk+ applications"? I take that as links to URLs that one clicks on to open the page in a web browser, but you might mean something else completely:)

Revision history for this message
Sam Spilsbury (smspillaz) wrote :

Hey Chris,

Yeah, sorry, I was on my phone when I saw that - If you open up
gtk3-demo in the gtk+ source tree, and then open the "Links" demo,
just check if the links are clickable. I put that code in to fix the
behaviour of links in gtk+ and I remember it was quite sensitive to
the way passive grabs worked.

On Thu, Apr 3, 2014 at 8:37 PM, Christopher Townsend
<email address hidden> wrote:
> Hey Sam,
>
> Thanks for the suggestion. Could you give a bit more detail on what you mean by "links in gtk+ applications"? I take that as links to URLs that one clicks on to open the page in a web browser, but you might mean something else completely:)
> --
> https://code.launchpad.net/~townsend/compiz/fix-gtk-mouse-scrolling/+merge/213930
> Your team Compiz Maintainers is subscribed to branch lp:compiz.

--
Sam Spilsbury

Revision history for this message
Christopher Townsend (townsend) wrote :

Hey Sam,

Thanks for the additional info. Yep, the Links demo works fine with this fix.

Revision history for this message
Sam Spilsbury (smspillaz) wrote :

Excellent - that was the only thing I was going to mention :)

On Thu, Apr 3, 2014 at 10:21 PM, Christopher Townsend
<email address hidden> wrote:
> Hey Sam,
>
> Thanks for the additional info. Yep, the Links demo works fine with this fix.
> --
> https://code.launchpad.net/~townsend/compiz/fix-gtk-mouse-scrolling/+merge/213930
> Your team Compiz Maintainers is subscribed to branch lp:compiz.

--
Sam Spilsbury

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/screen.cpp'
2--- src/screen.cpp 2014-03-27 18:40:07 +0000
3+++ src/screen.cpp 2014-04-02 21:45:56 +0000
4@@ -3413,6 +3413,17 @@
5
6 void cps::GrabManager::updatePassiveButtonGrabs(Window serverFrame)
7 {
8+ CompWindow *window = NULL;
9+
10+ foreach (CompWindow *w, screen->windows ())
11+ {
12+ if (w->frame () == serverFrame)
13+ {
14+ window = w;
15+ break;
16+ }
17+ }
18+
19 /* Grab only we have bindings on */
20 foreach (ButtonGrab &bind, buttonGrabs)
21 {
22@@ -3427,6 +3438,12 @@
23 if (ignore & ~modHandler->ignoredModMask ())
24 continue;
25
26+ if (window &&
27+ !(window->type () & CompWindowTypeDesktopMask) &&
28+ bind.button > 3 &&
29+ !mods)
30+ continue;
31+
32 XGrabButton (screen->dpy(),
33 bind.button,
34 mods | ignore,
35
36=== modified file 'src/window.cpp'
37--- src/window.cpp 2014-03-27 18:40:07 +0000
38+++ src/window.cpp 2014-04-02 21:45:56 +0000
39@@ -5620,20 +5620,21 @@
40 }
41 }
42
43- if (onlyActions)
44+ if (onlyActions || priv->type & CompWindowTypeDesktopMask)
45 screen->updatePassiveButtonGrabs(serverFrame);
46 else
47 {
48- /* Grab everything */
49- XGrabButton (screen->dpy (),
50- AnyButton,
51- AnyModifier,
52- serverFrame, false,
53- ButtonPressMask | ButtonReleaseMask | ButtonMotionMask,
54- GrabModeSync,
55- GrabModeAsync,
56- None,
57- None);
58+ /* Only grab buttons 1-3 */
59+ for (int i = 1; i <= 3; i++)
60+ XGrabButton (screen->dpy (),
61+ i,
62+ AnyModifier,
63+ serverFrame, false,
64+ ButtonPressMask | ButtonReleaseMask | ButtonMotionMask,
65+ GrabModeSync,
66+ GrabModeAsync,
67+ None,
68+ None);
69 }
70 }
71

Subscribers

People subscribed via source and target branches