Project

Profile

Help

HostedRedmine.com has moved to the Planio platform. All logins and passwords remained the same. All users will be able to login and use Redmine just as before. Read more...

Bug #853912

open

Gtk3 detachable widget handles are too large with recent Gtk

Added by Jacob Nevins almost 5 years ago. Updated 8 months ago.

Status:
New
Priority:
Low
Assignee:
-
Category:
gui-gtk-3
Sprint/Milestone:
Start date:
Due date:
% Done:

0%

Estimated time:

Description

Split out from bug #693382:

The vertical handles which allow you to detach UI components are far too wide, with recent Gtk3. An example is attached to that bug. In that screenshot they were 34px wide. On my Debian buster system (Gtk 3.24.5) they are 36px wide. In comparison, gui-gtk2 on the same system has them 8px wide, which is reasonable.

Bug #693382 indicates this changed some time between 3.10.8 and 3.22.16.


Files

m-gtk3-huge-detach-handles.patch (4.63 KB) m-gtk3-huge-detach-handles.patch Jacob Nevins, 2019-12-26 05:50 PM
30-26-gtk3-huge-detach-handles.patch (3.22 KB) 30-26-gtk3-huge-detach-handles.patch Jacob Nevins, 2019-12-26 05:50 PM
Screenshot #853912.png (38.5 KB) Screenshot #853912.png Marko Lindqvist, 2019-12-26 07:34 PM
Screenshot #853912 Xenial, before.png (129 KB) Screenshot #853912 Xenial, before.png Marko Lindqvist, 2019-12-26 08:01 PM
Screenshot #853912 Xenial, after.png (103 KB) Screenshot #853912 Xenial, after.png Marko Lindqvist, 2019-12-26 08:01 PM
m-gtk3-huge-detach-handles-bis.patch (4.63 KB) m-gtk3-huge-detach-handles-bis.patch revised master patch addressing comment 15 Jacob Nevins, 2019-12-27 10:17 AM
m-30-26-gtk30-huge-detach-handles.patch (1.87 KB) m-30-26-gtk30-huge-detach-handles.patch Jacob Nevins, 2019-12-27 04:46 PM

Related issues

Related to Freeciv - Bug #854002: Gtk3.22/4 detachable widget handles are too largeClosedJacob Nevins

Actions
Actions #1

Updated by Jacob Nevins almost 5 years ago

  • Blocks Bug #693382: Gtk3/3.22 theme is not good with recent Gtk3 added
Actions #2

Updated by Jacob Nevins almost 5 years ago

As far as I can tell, these handles are just GtkToggleButtons, without anything particularly special for theming engines to select on. (In Gtk2 and Gtk3.)

On my system, I can get them a bit smaller by hacking with the CSS: if I start
GTK_DEBUG=interactive inst/bin/freeciv-gtk3
and then enter this hack on the "CSS" tab of the debug window:
button.toggle { padding: 0px 0px 0px 0px; }
I can get them down from 36px to 18px wide. Reducing "margin" (space outside control) to 0px makes no difference. Reducing "border-width" to 0px only saves a couple of pixels. "Objects" tab doesn't show any interesting objects inside the GtkToggleButton.

Actions #3

Updated by Jacob Nevins almost 5 years ago

I notice that data/themes/gui-gtk-3.0/Freeciv/gtk-3.0/gtk.css is setting these:

-GtkButton-default-border: 1;
-GtkButton-default-outside-border: 2;

But the Gtk3 docs say they

...been deprecated since version 3.14 and should not be used in newly-written code.
Use CSS margins and padding instead; the value of this style property is ignored.

And indeed with my Gtk3.24.5 I get these runtime warnings (among many others):

(freeciv-gtk3:12531): Gtk-WARNING **: 15:59:37.988: Theme parsing error: gtk.css:5:29: The style property GtkButton:default-border is deprecated and shouldn't be used anymore. It will be removed in a future version

(freeciv-gtk3:12531): Gtk-WARNING **: 15:59:37.988: Theme parsing error: gtk.css:6:37: The style property GtkButton:default-outside-border is deprecated and shouldn't be used anymore. It will be removed in a future version

I wonder if this has anything to do with the behaviour difference between old and new Gtk libraries -- perhaps we were somehow relying on these properties and they are no longer doing anything?

Actions #4

Updated by Jacob Nevins almost 5 years ago

Modifying my CSS hackery to

button.toggle { padding: 0px 0px 0px 0px; min-width:6px; }

gets me controls that are 8px wide, including the border.

I think the way to productionise this is probably to put some special selectable property on the button created by detached_widget_fill(), and attach the above style to it in gtk.css.

I no longer have any direct ability to build and test against old Gtk3, so I guess the way to find out how it affects that will be to commit it and test the next msys1 build.

Actions #5

Updated by Jacob Nevins almost 5 years ago

and attach the above style to it in gtk.css

That doesn't work for people who want to use a system theme. (Also, I can't figure out how to make it work.)

I suspect instead I should add it with some gtk_style_context_add_provider_for_screen() faff, like gui_update_font(). (Hopefully that will be overrideable with themes if anyone cares to.)

Actions #6

Updated by Jacob Nevins almost 5 years ago

  • Category set to gui-gtk-3
  • Status changed from New to In Progress
  • Assignee set to Jacob Nevins
Actions #7

Updated by Jacob Nevins almost 5 years ago

Any pre-commit testing of this with ancient Gtk3 would be appreciated. (Although at this stage I'm probably content with "not catastrophically worse than before" rather than "looks perfect".)

Actions #8

Updated by Jacob Nevins almost 5 years ago

With this patch and GTK_DEBUG=interactive, entering this in the debugger CSS tab:

.detach_button {
  min-width: 10px;
}

did cause the detach handles to grow wider again, so I'm reasonably confident that a custom theme could override the embedded CSS if it tried hard enough.

Actions #9

Updated by Marko Lindqvist almost 5 years ago

Jacob Nevins wrote:

Any pre-commit testing of this with ancient Gtk3 would be appreciated. (Although at this stage I'm probably content with "not catastrophically worse than before" rather than "looks perfect".)

At my Ubuntu Trusty virtual machine handles turned unusable. I don't know if they disappeared completely or are they hidden by the border of the window.

Actions #10

Updated by Marko Lindqvist almost 5 years ago

Marko Lindqvist wrote:

At my Ubuntu Trusty virtual machine handles turned unusable.

Same with Xenial. From the "before" screenshot you can also see that original issue is not there with gtk+-3.18.9

Actions #11

Updated by Jacob Nevins almost 5 years ago

  • Status changed from Resolved to In Progress

Oh, dear. Thanks for testing.

From the "before" screenshot you can also see that original issue is not there with gtk+-3.18.9

(handle width is 13-15 pixels or so)

Actions #12

Updated by Jacob Nevins almost 5 years ago

There's a bunch of stuff in our Gtk3 gtk.css that I can't square with the docs (like .button selector syntax), so I don't know what it's meant to do; and with Gtk 3.24.5 I get a bunch of deprecation warnings about stuff in gtk.css. Perhaps that stuff is being ignored on my system, and not on older systems, and interacts with my new styling in some bad way.

Actions #13

Updated by Jacob Nevins almost 5 years ago

...if this drags on, perhaps I'll need to split out the Gtk3.22 patch? That should be safe, right?

Actions #14

Updated by Marko Lindqvist almost 5 years ago

Jacob Nevins wrote:

...if this drags on, perhaps I'll need to split out the Gtk3.22 patch? That should be safe, right?

At least it's promising that Ubuntu Bionic (gtk+-3.22.30) gtk3.22-client works with the patch, though it didn't have the original issue without. So broken "before" state is not a prerequisite for the patched version to work. It seems the patch can be used with both gtk+-3.22 and gtk+-3.24 that are the only versions that gtk3.22-client may use.

Actions #15

Updated by Marko Lindqvist almost 5 years ago

This causes gtk3x-client compile error.

../../../../src/client/gui-gtk-4.0/gui_main.c: In function ‘detached_widget_fill’:
../../../../src/client/gui-gtk-4.0/gui_main.c:878:5: error: too many arguments to function ‘gtk_css_provider_load_from_data’
878 | gtk_css_provider_load_from_data(detach_button_provider, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Actions #16

Updated by Jacob Nevins almost 5 years ago

Oops. (Cf feature #647927.) Thanks. Should be fixed in attached patch. (Not currently commit candidate due to Gtk3 issues.)

Actions #17

Updated by Jacob Nevins almost 5 years ago

  • Related to Bug #854002: Gtk3.22/4 detachable widget handles are too large added
Actions #18

Updated by Jacob Nevins almost 5 years ago

Revised patch covers just gui-gtk-3.0. It's not a commit candidate because it will still have the same problems with old libraries.

(Of course, investigating why it's bad with older library versions may yet yield a better solution for all Gtk versions.)

Actions #19

Updated by Jacob Nevins almost 5 years ago

  • Sprint/Milestone changed from 2.6.2 to 2.6.3

I don't have a clear plan for resolving the remaining gtk3-client issue; it's probably going to involve messing around with VMs. I'm certainly not going to get to it for 2.6.2.

Actions #20

Updated by Marko Lindqvist almost 4 years ago

  • Sprint/Milestone changed from 2.6.3 to 2.6.4
Actions #21

Updated by Marko Lindqvist over 3 years ago

  • Sprint/Milestone changed from 2.6.4 to 2.6.5
Actions #22

Updated by Marko Lindqvist over 3 years ago

  • Assignee deleted (Jacob Nevins)
  • Sprint/Milestone changed from 2.6.5 to 2.6.6
Actions #23

Updated by Marko Lindqvist almost 3 years ago

  • Sprint/Milestone changed from 2.6.6 to 3.0.1
Actions #24

Updated by Marko Lindqvist over 2 years ago

  • Sprint/Milestone changed from 3.0.1 to 3.0.2
Actions #25

Updated by Marko Lindqvist over 2 years ago

While it's not going to completely resolve this ticket, I got an idea that maybe our configure should informa a user who has gtk+-3.22 / 3.24, but does --enable-client=gtk3 anyway that gtk3.22-client might be better suited for them.

Actions #26

Updated by Marko Lindqvist over 2 years ago

  • Sprint/Milestone changed from 3.0.2 to 3.0.3

Marko Lindqvist wrote:

While it's not going to completely resolve this ticket, I got an idea that maybe our configure should informa a user who has gtk+-3.22 / 3.24, but does --enable-client=gtk3 anyway that gtk3.22-client might be better suited for them.

-> https://osdn.net/projects/freeciv/ticket/44792

Actions #27

Updated by Marko Lindqvist over 2 years ago

  • Sprint/Milestone changed from 3.0.3 to 3.0.4
Actions #28

Updated by Marko Lindqvist about 2 years ago

  • Sprint/Milestone changed from 3.0.4 to 3.0.5
Actions #29

Updated by Marko Lindqvist almost 2 years ago

  • Status changed from In Progress to New
  • Sprint/Milestone changed from 3.0.5 to 3.0.6
Actions #30

Updated by Marko Lindqvist almost 2 years ago

  • Sprint/Milestone changed from 3.0.6 to 3.0.7
Actions #31

Updated by Marko Lindqvist over 1 year ago

  • Sprint/Milestone changed from 3.0.7 to 3.0.8
Actions #32

Updated by Marko Lindqvist over 1 year ago

  • Priority changed from Normal to Low

Lowering priority as gtk3-client has not much lifetime left anyway.

Actions #33

Updated by Marko Lindqvist 8 months ago

  • Sprint/Milestone changed from 3.0.8 to 3.1.1
Actions #34

Updated by Marko Lindqvist 8 months ago

  • Blocks deleted (Bug #693382: Gtk3/3.22 theme is not good with recent Gtk3)

Also available in: Atom PDF