aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2021-11-18 21:51:12 +0100
committerPřemysl Eric Janouch <p@janouch.name>2021-11-18 22:08:36 +0100
commitb23198f675f593573974ea39f1ec86042925802e (patch)
tree292b602f8574b1eb2d5c77d4e5bf4fc09b94601a
parent411f0b3e91e25cf896d745fc783f93a64e720ba0 (diff)
downloadfiv-b23198f675f593573974ea39f1ec86042925802e.tar.gz
fiv-b23198f675f593573974ea39f1ec86042925802e.tar.xz
fiv-b23198f675f593573974ea39f1ec86042925802e.zip
Try to use more screen real estate by default
-rw-r--r--fastiv.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/fastiv.c b/fastiv.c
index 8a70a0c..8597a03 100644
--- a/fastiv.c
+++ b/fastiv.c
@@ -518,7 +518,6 @@ main(int argc, char *argv[])
gtk_container_add(GTK_CONTAINER(g.stack), g.browser_paned);
g.window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
- gtk_window_set_default_size (GTK_WINDOW (g.window), 800, 600);
g_signal_connect(g.window, "destroy",
G_CALLBACK(gtk_main_quit), NULL);
g_signal_connect(g.window, "key-press-event",
@@ -555,6 +554,23 @@ main(int argc, char *argv[])
gtk_widget_grab_focus(g.browser_scroller);
}
+ // Try to get half of the screen vertically, in 4:3 aspect ratio.
+ //
+ // We need the GdkMonitor before the GtkWindow has a GdkWindow (i.e.,
+ // before it is realized). Take the smallest dimensions, out of desperation.
+ GdkDisplay *display = gtk_widget_get_display(g.window);
+ int unit = G_MAXINT;
+ for (int i = gdk_display_get_n_monitors(display); i--; ) {
+ GdkRectangle geometry = {};
+ gdk_monitor_get_geometry(
+ gdk_display_get_monitor(display, i), &geometry);
+ unit = MIN(unit, MIN(geometry.width, geometry.height) / 6);
+ }
+
+ // Ask for at least 800x600, to cover ridiculously heterogenous setups.
+ unit = MAX(200, unit);
+ gtk_window_set_default_size(GTK_WINDOW(g.window), 4 * unit, 3 * unit);
+
gtk_widget_show_all(g.window);
gtk_main();
return 0;