Gtk3.x automatic initial setting of "Arrange widgets for small displays" is ineffective
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,
#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_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 */
#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.)
#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
And, sigh again, even
--resolutionis parsed too late to have any effect on
...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
#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)
#18 Updated by Jacob Nevins 5 months ago
- Status changed from New to Resolved
- Assignee set to Jacob Nevins