Bug 414777

Summary: Top-right-most pixel does not trigger right-most button in a GTK3 CSD headerbar app
Product: [Plasma] Breeze Reporter: Nate Graham <nate>
Component: gtk themeAssignee: Janet Blackquill <uhhadd>
Status: RESOLVED FIXED    
Severity: normal CC: bugseforuns, david.cortes.rivera, emilio, guimarcalsilva, jchevarley, lv215bd5, null, toadfield
Priority: HI    
Version: 5.21.4   
Target Milestone: ---   
Platform: Other   
OS: Linux   
URL: https://gitlab.gnome.org/GNOME/gtk/-/issues/583
Latest Commit: Version Fixed In: 5.27.4
Sentry Crash Report:
Attachments: bug
margin

Description Nate Graham 2019-12-02 23:32:07 UTC
When you maximize or right-tile a GTK3 CSD headerbar app, the top-right-most pixel in the screen doesn'r trigger the button on the far right position on the headerbar--usually the close button. It does do this for apps using the Breeze QWidgets theme, but this does not work for CSD-using GTK3 apps using the Breeze-GTK theme
Comment 1 Nate Graham 2020-08-09 13:33:39 UTC
*** Bug 421937 has been marked as a duplicate of this bug. ***
Comment 2 Nate Graham 2021-01-05 16:57:44 UTC
*** Bug 430632 has been marked as a duplicate of this bug. ***
Comment 3 Nate Graham 2021-03-22 01:50:04 UTC
*** Bug 434734 has been marked as a duplicate of this bug. ***
Comment 4 Nate Graham 2021-03-24 19:20:10 UTC
*** Bug 434897 has been marked as a duplicate of this bug. ***
Comment 5 Lua 2021-04-19 01:26:04 UTC
Created attachment 137696 [details]
bug

It seems that there are some margins preventing the buttons to fully expand.
Comment 6 Lua 2021-04-19 01:26:52 UTC
I forgot to mention: I opened Spectacle and Firefox to show this bug while I'm using Qogir window decoration theme.
Comment 7 Lua 2021-04-19 17:39:29 UTC
Also, this still happens in KDE 5.21.4
Comment 8 Lua 2021-04-29 20:09:24 UTC
Created attachment 138012 [details]
margin

This still happens in KDE 5.21.4. It seems that there's a margin in the window buttons panel. If Qogir theme (square version) is applied, this problem gets more noticeable.
Comment 9 guimarcalsilva 2022-01-19 17:39:51 UTC
After reading Nate's blog post about the 15-Minute Bug Initiative (https://pointieststick.com/2022/01/18/the-15-minute-bug-initiative/), I believe this bug is a nice candidate for the list. GTK apps are a big part of the Linux desktop and this issue can be seen pretty quickly by any user who switches to using Plasma from other GTK DEs and want to keep using the programs they were used to. This also has 4 duplicates, so it's something that has been affecting a considerable amount of people.
Comment 10 Nate Graham 2022-01-19 17:41:05 UTC
Fair enough!
Comment 11 Nate Graham 2022-03-21 04:28:37 UTC
*** Bug 450946 has been marked as a duplicate of this bug. ***
Comment 12 Nate Graham 2022-05-17 19:04:34 UTC
Unfortunately this is an upstream bug in GTK itself that we can't work around in the Breeze GTK theme. See https://gitlab.gnome.org/GNOME/gtk/-/issues/583
Comment 13 Nate Graham 2023-03-13 15:28:29 UTC
*** Bug 467021 has been marked as a duplicate of this bug. ***
Comment 14 Nate Graham 2023-03-13 15:35:05 UTC
In progress with https://invent.kde.org/plasma/breeze-gtk/-/merge_requests/71 since it turns out we *can* work around it in breeze-gtk and the GTK folks don't seem interested in fixing it generically.
Comment 15 Fushan Wen 2023-03-29 16:53:23 UTC
Git commit 0f887127b929ac2d50b22af1bb97fc25411b40aa by Fushan Wen.
Committed on 29/03/2023 at 16:52.
Pushed by fusionfuture into branch 'master'.

gtk4/windowcontrols: extend control area to window borders

This makes GTK4 window control buttons follow Fitts' law.

M  +42   -152  src/gtk4/widgets/_window_decorations.scss

https://invent.kde.org/plasma/breeze-gtk/commit/0f887127b929ac2d50b22af1bb97fc25411b40aa
Comment 16 Fushan Wen 2023-03-29 16:53:31 UTC
Git commit d11333a830a4fdf6482c176e9a036e236bc80134 by Fushan Wen.
Committed on 29/03/2023 at 16:52.
Pushed by fusionfuture into branch 'master'.

gtk3/titlebutton: extend control area to window borders

M  +21   -9    src/gtk3/widgets/_window_decorations.scss
M  +7    -3    src/gtk4/widgets/_window_decorations.scss

https://invent.kde.org/plasma/breeze-gtk/commit/d11333a830a4fdf6482c176e9a036e236bc80134
Comment 17 Fushan Wen 2023-03-30 00:21:56 UTC
Git commit 59448164f7df462ae4a2c1119f6be59146d60399 by Fushan Wen.
Committed on 29/03/2023 at 16:56.
Pushed by fusionfuture into branch 'Plasma/5.27'.

gtk3/titlebutton: extend control area to window borders
(cherry picked from commit d11333a830a4fdf6482c176e9a036e236bc80134)

M  +21   -9    src/gtk3/widgets/_window_decorations.scss
M  +7    -3    src/gtk4/widgets/_window_decorations.scss

https://invent.kde.org/plasma/breeze-gtk/commit/59448164f7df462ae4a2c1119f6be59146d60399
Comment 18 Fushan Wen 2023-03-30 00:22:05 UTC
Git commit 83f4f7c184954eb89aaea52684f1ce076873e8c3 by Fushan Wen.
Committed on 29/03/2023 at 16:56.
Pushed by fusionfuture into branch 'Plasma/5.27'.

gtk4/windowcontrols: extend control area to window borders

This makes GTK4 window control buttons follow Fitts' law.
(cherry picked from commit 0f887127b929ac2d50b22af1bb97fc25411b40aa)

M  +42   -152  src/gtk4/widgets/_window_decorations.scss

https://invent.kde.org/plasma/breeze-gtk/commit/83f4f7c184954eb89aaea52684f1ce076873e8c3
Comment 19 Bug Janitor Service 2023-05-10 04:31:35 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/breeze-gtk/-/merge_requests/83
Comment 20 Fushan Wen 2023-05-22 14:37:21 UTC
Git commit cbab51eebfe21827830ada2ee4b339c43371ca86 by Fushan Wen.
Committed on 10/05/2023 at 04:28.
Pushed by fusionfuture into branch 'master'.

gtk3: revert button padding hack

When Firefox draws its window controls, margins and paddings are
also considered, so we can't use button padding hack to expand the
control areas of window controls.

M  +0    -35   src/gtk3/widgets/_window_decorations.scss

https://invent.kde.org/plasma/breeze-gtk/commit/cbab51eebfe21827830ada2ee4b339c43371ca86
Comment 21 Fushan Wen 2023-05-22 14:39:23 UTC
Git commit 2f2923c2a5ce8b656e2f531bb0791c1ec105873a by Fushan Wen.
Committed on 22/05/2023 at 14:39.
Pushed by fusionfuture into branch 'Plasma/5.27'.

gtk3: revert button padding hack

When Firefox draws its window controls, margins and paddings are
also considered, so we can't use button padding hack to expand the
control areas of window controls.


(cherry picked from commit cbab51eebfe21827830ada2ee4b339c43371ca86)

M  +0    -35   src/gtk3/widgets/_window_decorations.scss

https://invent.kde.org/plasma/breeze-gtk/commit/2f2923c2a5ce8b656e2f531bb0791c1ec105873a
Comment 22 Emilio Cobos Álvarez (:emilio) 2023-05-29 18:19:05 UTC
(In reply to Fushan Wen from comment #21)
> When Firefox draws its window controls, margins and paddings are
> also considered, so we can't use button padding hack to expand the
> control areas of window controls.

FWIW if Firefox was the only app affected I'd be happy to help making it work.

Negative margins aren't considered [here](https://searchfox.org/mozilla-central/rev/f4d3fe187cf7dffa4c13b354bbde9bc47b5ccd3f/widget/gtk/gtk3drawing.cpp#285-297), so probably it's a matter of tweaking that code appropriately.
Comment 23 Emilio Cobos Álvarez (:emilio) 2023-05-29 18:53:07 UTC
(In reply to Emilio Cobos Álvarez (:emilio) from comment #22)
> (In reply to Fushan Wen from comment #21)
> Negative margins aren't considered
> [here](https://searchfox.org/mozilla-central/rev/
> f4d3fe187cf7dffa4c13b354bbde9bc47b5ccd3f/widget/gtk/gtk3drawing.cpp#285-297),
> so probably it's a matter of tweaking that code appropriately.

I was wrong and margins are accounted for elsewhere (see `buttonMargin` in that file), so it needs some more debugging, but I'd be happy to help either way.