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
=== modified file 'src/screen.cpp'
--- src/screen.cpp 2014-03-27 18:40:07 +0000
+++ src/screen.cpp 2014-04-02 21:45:56 +0000
@@ -3413,6 +3413,17 @@
34133413
3414void cps::GrabManager::updatePassiveButtonGrabs(Window serverFrame)3414void cps::GrabManager::updatePassiveButtonGrabs(Window serverFrame)
3415{3415{
3416 CompWindow *window = NULL;
3417
3418 foreach (CompWindow *w, screen->windows ())
3419 {
3420 if (w->frame () == serverFrame)
3421 {
3422 window = w;
3423 break;
3424 }
3425 }
3426
3416 /* Grab only we have bindings on */3427 /* Grab only we have bindings on */
3417 foreach (ButtonGrab &bind, buttonGrabs)3428 foreach (ButtonGrab &bind, buttonGrabs)
3418 {3429 {
@@ -3427,6 +3438,12 @@
3427 if (ignore & ~modHandler->ignoredModMask ())3438 if (ignore & ~modHandler->ignoredModMask ())
3428 continue;3439 continue;
34293440
3441 if (window &&
3442 !(window->type () & CompWindowTypeDesktopMask) &&
3443 bind.button > 3 &&
3444 !mods)
3445 continue;
3446
3430 XGrabButton (screen->dpy(),3447 XGrabButton (screen->dpy(),
3431 bind.button,3448 bind.button,
3432 mods | ignore,3449 mods | ignore,
34333450
=== modified file 'src/window.cpp'
--- src/window.cpp 2014-03-27 18:40:07 +0000
+++ src/window.cpp 2014-04-02 21:45:56 +0000
@@ -5620,20 +5620,21 @@
5620 }5620 }
5621 }5621 }
56225622
5623 if (onlyActions)5623 if (onlyActions || priv->type & CompWindowTypeDesktopMask)
5624 screen->updatePassiveButtonGrabs(serverFrame);5624 screen->updatePassiveButtonGrabs(serverFrame);
5625 else5625 else
5626 {5626 {
5627 /* Grab everything */5627 /* Only grab buttons 1-3 */
5628 XGrabButton (screen->dpy (),5628 for (int i = 1; i <= 3; i++)
5629 AnyButton,5629 XGrabButton (screen->dpy (),
5630 AnyModifier,5630 i,
5631 serverFrame, false,5631 AnyModifier,
5632 ButtonPressMask | ButtonReleaseMask | ButtonMotionMask,5632 serverFrame, false,
5633 GrabModeSync,5633 ButtonPressMask | ButtonReleaseMask | ButtonMotionMask,
5634 GrabModeAsync,5634 GrabModeSync,
5635 None,5635 GrabModeAsync,
5636 None);5636 None,
5637 None);
5637 }5638 }
5638}5639}
56395640

Subscribers

People subscribed via source and target branches