After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 773747 - GtkFileChooser dialog size can be gigantic
GtkFileChooser dialog size can be gigantic
Status: RESOLVED DUPLICATE of bug 779218
Product: gtk+
Classification: Platform
Component: Widget: GtkFileChooser
3.20.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2016-10-31 20:46 UTC by Martin Abente Lahaye
Modified: 2017-08-29 23:43 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Martin Abente Lahaye 2016-10-31 20:46:02 UTC
Sometimes the dialog will take gigantic dimensions, to the point where we can only see a completely white window (just a small part of the GtkTreeView drawing area, actually).

I personally notice this effect on low screen resolutions, when the dialog doesn't fit in the screen in the first place, but I was puzzled seeing these exaggerated sizes.

A quick research to determine where these gigantic values are coming from showed the following issues:

1) When a GtkFileChooserWidget shown for the first time it will try to estimate its default size using an heuristic based on the current font-size, DPI, and two constants NUM_LINES(45) and NUM_CHARS(60), but:

e.g, having font-size 16 and DPI 96 would result in:

cairo_units(?) = 21.83 = 16.0 * 96.0 / 72.0 + 0.5;
default_width = 1310 = 21.83 * 60; 
default_height = 982 = 21.84 * 45;

Is already bigger than a commonly used resolution like 1366x768, and these dimensions could be increased more when using a preview widget or extra filters widgets.

2) When a GtkFileChooser dialog is opened a next time it takes the width and height values from gsettings as-is.

e.g. opening the dialog on 1920x1080, closing it, and then reducing the screen resolution (by switching to another output device), will result in the same effect when the dialog is re-opened.

What these two issues have in common is that the current screen resolution is not taken into account.

A quick fix I am trying for this is to contrast the values coming the heuristic and gsettings against the screen/monitor size to default to something smaller.
Comment 1 Daniel Boles 2017-08-15 16:33:39 UTC

*** This bug has been marked as a duplicate of bug 773596 ***
Comment 2 Daniel Boles 2017-08-29 23:43:40 UTC

*** This bug has been marked as a duplicate of bug 779218 ***