Project

General

Profile

Bug #765941

Gtk3.x automatic initial setting of "Arrange widgets for small displays" is ineffective

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

Status:
Closed
Priority:
Normal
Assignee:
Category:
gui-gtk-3
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:

Description

I wrote in NEWS-2.6.0:

  • (Gtk3) On a completely fresh installation, the Gtk3 client adjusts some of its default settings ("arrange widgets for small displays" and fullscreen) to be suitable for the display size at the time it is first run. (Thereafter, the settings must be changed manually if desired, even if a different size display is used.) GNAPATCH#5459 GNA#23988 There is a new '-- --resolution' option to influence the display size assumed for this and other display-size related adjustments (mainly for debugging).

However, when I tried this with the 2.6.0-RC2 Gtk3 client on Windows with all rc-files cleared away, I found I was always getting "Arrange widgets for small displays" defaulting to True. This was the case even if I override the resolution on first launch:

C:\Users\Jacob Nevins\AppData\Local\Freeciv-2.6.0-RC2-gtk3>.\freeciv-gtk3.exe -l foo.log -- --resolution 1680x1050

The log shows this:

2: in options_load() [../../../../client/options.c::5725]: Didn't find the option file. Creating a new one.
2: in migrate_options_from_gtk2() [../../../../../client/gui-gtk-3.0/gui_main.c::1628]: Migrating options from gtk2 to gtk3 client

I think the migration from Gtk2 is overriding the resolution-dependent default chosen by adjust_default_options(). (That function does manage to set the fullscreen option, I think.)

I think the call tree goes like this:

client_main
  options_load
    "Didn't find the option file. Creating a new one." 
    client_option_adjust_defaults
      adjust_default_options **
  ui_main
    migrate_options_from_gtk2
      "Migrating options from gtk2 to gtk3 client" 
      MIGRATE_OPTION(small_display_layout);
        overwrites gui_gtk3 from .gui_gtk2_small_display_layout = TRUE,
m-gtk-no-migrate-small.patch (4.62 KB) m-gtk-no-migrate-small.patch master (Gtk4 not tested) Jacob Nevins, 2020-02-02 04:34 AM
30-26-gtk-no-migrate-small.patch (3.24 KB) 30-26-gtk-no-migrate-small.patch S3_0, S2_6 Jacob Nevins, 2020-02-02 04:34 AM

Related issues

Related to Freeciv - Bug #856682: Gtk3.22 client doesn't migrate settings from Gtk2Closed

Related to Freeciv - Feature #858179: Change Gtk "Arrange widgets for small displays" default to disabled for new installationsClosed

Related to Freeciv - Bug #858208: Various bugs in GUI option migrationClosed

Blocked by Freeciv - Bug #858203: client_option_adjust_defaults() runs too earlyClosed

Blocked by Freeciv - Bug #857675: Treat client option file load failure as first runClosed

Blocked by Freeciv - Feature #858202: Screen size detection for gui-gtk3.22+Closed

History

#1 Updated by Jacob Nevins 7 months ago

  • Target version changed from 2.6.1 to 2.6.2

#2 Updated by Jacob Nevins 5 months ago

#856682 has probably impinged on this behaviour (this bug is what prompted me to raise that ticket).

Want to get this fixed in 2.6.2, so that Ubuntu and Debian users freshly upgrading from Gtk2 don't run into it.

#3 Updated by Jacob Nevins 5 months ago

  • Related to Bug #856682: Gtk3.22 client doesn't migrate settings from Gtk2 added

#4 Updated by Jacob Nevins 5 months ago

We already ignore "fullscreen" setting during Gtk2-to-Gtk3 migration. Comment:

  /* Fullscreen not migrated as gtk3-client differs from gtk2-client in a way that
   * user is likely to want default even if gtk2-client setting differs. */

and gna bug #23859 (Sep 2015):

better to go by gtk3-client's own default handling than to assume that despite the differences in gtk2- and gtk3-client user wants the same value in gtk3-client as in gtk2-client

I guess that might refer to the client_option_adjust_defaults() behaviour in place at that time, which was just to force fullscreen for tiny screens (gna patch #5459, Dec 2014)?

The screen-size dependent default-to-small-screen didn't come later, until Aug 2016 (gna bug #23988).

So maybe the right answer is to simply never migrate "small_display_layout" from Gtk2 to Gtk3? Both are modified by client_option_adjust_defaults(), after all.

(Both settings are migrated from Gtk3 to Gtk3.22, and I think that is reasonable.)

#5 Updated by Jacob Nevins 5 months ago

Also need to stop gtk3-to-3.22 migration stomping on freshly-adjusted 3.22 defaults.

Except, feh, I'd forgotten that Gtk upstream had stopped us adapting our defaults at all (gna patch #7877). So this is all a bit pointless for Gtk3.22, because only an explicit --resolution command-line option has any effect on defaults adaptation.

Even in Gtk3 client, screen_height() is returning 0 for me. (Maybe due to gdk_screen_get_height deprecation ?) So it seems fresh users on modern systems (of both Gtk3 and Gtk3.22 client) will get the small-screen layout regardless, and I can't test this.

Sigh. Well, I'm writing the patch now, easier to submit it than to decide whether to remove all this adaptation.

#6 Updated by Jacob Nevins 5 months ago

And, sigh again, even --resolution is parsed too late to have any effect on client_option_adjust_defaults().

client_main
  /* parse GUI-independent options */
  options_load()
    client_option_adjust_defaults()
      adjust_default_options()
        /* Gtk: consult screen_height() which reads from vmode */
  ui_main()
    parse_options()
      /* write --resolution to vmode */

#7 Updated by Jacob Nevins 5 months ago

  • Related to Bug #857675: Treat client option file load failure as first run added

#8 Updated by Jacob Nevins 5 months ago

I suspect that "small screen" is still the wrong default for most users, though.

Perhaps we should flip the default, and the adjustment logic, so that non-small-screen is the default, and we only enable small-screen if we get positive confirmation that the screen is small? (In a new bug.)

#9 Updated by Jacob Nevins 5 months ago

Perhaps we should flip the default

-> #858179

#10 Updated by Jacob Nevins 5 months ago

  • Related to Feature #858179: Change Gtk "Arrange widgets for small displays" default to disabled for new installations added

#11 Updated by Jacob Nevins 5 months ago

Even in Gtk3 client, screen_height() is returning 0 for me. (Maybe due to gdk_screen_get_height deprecation ?)

No, it's because it's called too early in this context. When it is later called from create_main_page() it is fine, and returns a real answer.

I'm guessing it's because it's called before gtk_init().

And, sigh again, even --resolution is parsed too late to have any effect on client_option_adjust_defaults().

...this suggests that the answer is to move the functionality of client_option_adjust_defaults() into client-specific code, rather than trying to do it from load_options().

#12 Updated by Marko Lindqvist 5 months ago

Just a quick note that the functionality to get the screen size has been deprecated in later versions of gtk3 (they argue that functionality like that does not belong to a widget set library). The functions of course remain, for API compatibility, but they may always return 0 (can't check just now)

#13 Updated by Jacob Nevins 5 months ago

Indeed. (I also have a WIP patch to restore monitor height awareness to gui-gtk3.22, using a different API which hasn't been deprecated yet; in fact that's how I spotted this.)

#14 Updated by Jacob Nevins 5 months ago

  • Blocked by Bug #858203: client_option_adjust_defaults() runs too early added

#15 Updated by Jacob Nevins 5 months ago

  • Related to deleted (Bug #857675: Treat client option file load failure as first run)

#16 Updated by Jacob Nevins 5 months ago

  • Blocked by Bug #857675: Treat client option file load failure as first run added

#17 Updated by Jacob Nevins 5 months ago

#18 Updated by Jacob Nevins 5 months ago

  • Status changed from New to Resolved
  • Assignee set to Jacob Nevins

After a lot of yak-shaving, something that works.

Patch stack:
  • #857675: needed for a later patch
  • #858202: addresses Gtk3.22 part of note 5
  • #858179: note 8
  • #858203: note 6, note 11
  • (this ticket): note 4
  • #858208: fixes one more case where Gtk2 could override automatic decision (among other things)

#20 Updated by Jacob Nevins 5 months ago

  • Related to Bug #858208: Various bugs in GUI option migration added

#21 Updated by Jacob Nevins 5 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF