Hello!
I was always wondering why gerbv starts by default with a good width (1500pix)
but very limited height (450pix) window on my dual-monitor desktop (2x 2048 x
1152, horizontally aligned).
After some digging, I found that some multi monitor detection code does some
odd math, messing up if nmonitors >1 aligned horizontally, touching the height
as well.
Attached patch might fix that for the assumption that monitors are usually
placed next to each other and not stacked on top of each other.
This is off course just an improvisational fix.
It seems that the GTK3 code would be a better solution, but I couldn't verify
that code yet. Is there an configure option to build against GTK 3+?
Please comment if the patch is basically ok and how to test gerbv against GTK3.
Regards,
Clemens
>From 86b2bc63a1ca1cf833fa3a49c700ddf3fe39283b Mon Sep 17 00:00:00 2001
From: Clemens Koller <c...@embeon.de>
Date: Mon, 13 Feb 2017 21:14:44 +0100
Subject: interface: optimize default window size depending on GTK version.
Especially on horizontally aligned multi monitor setups, dividing
the height by the number of monitors leads to very small windows.
diff --git a/src/interface.c b/src/interface.c
index 935eb9b..c5b8abf 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -1578,16 +1578,25 @@ interface_create_gui (int req_width, int req_height)
height = req_height;
}
else {
+#if GTK_CHECK_VERSION(3,22,0)
+ GdkDisplay *display = gdk_display_get_default();
+ GdkMonitor *monitor = gdk_display_get_monitor(display, 0);
+ GdkRectangle rectangle;
+
+ gdk_monitor_get_geometry(monitor, &rectangle);
+ width = rectangle.width * 9/10;
+ height = rectangle.height * 9/10;
+#else
GdkScreen *screen;
int nmonitors;
screen = gdk_screen_get_default();
nmonitors = gdk_screen_get_n_monitors(screen);
-
- width = gdk_screen_get_width(screen) * 3/4 / nmonitors;
- height = gdk_screen_get_height(screen) * 3/4 / nmonitors;
+ /* We assume that multiple screens are aligned horizontally next to each other here. */
+ width = gdk_screen_get_width(screen) * 9/10 / nmonitors;
+ height = gdk_screen_get_height(screen) * 9/10;
+#endif
}
-
gtk_window_set_default_size((GtkWindow *)mainWindow, width, height);
GtkSettings* gtksettings = gtk_settings_get_default ();
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Gerbv-devel mailing list
Gerbv-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gerbv-devel