aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab+samsung@kernel.org>2018-09-05 22:01:52 -0300
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2018-09-06 08:19:09 -0300
commitde9ec52ff1cd52e2aa4d0debcfa3d1b9792459c7 (patch)
treea382de905e2207f1cc4b0a9a684b592ebf5dcb10 /src
parent74267daf2105f6eb22b63f5afea4001df20211c0 (diff)
main: use gdk_monitor_get_geometry() on newer Gtk 3
Since Gtk 3.22, width/height should be obtained per monitor. So, do that, using the default monitor. Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'src')
-rw-r--r--src/main.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c
index 1ceb0a4..efbd126 100644
--- a/src/main.c
+++ b/src/main.c
@@ -44,6 +44,23 @@ static GOptionEntry options[] = {
#pragma GCC diagnostic pop
+static void get_geometry(cam_t *cam)
+{
+#if GTK_MAJOR_VERSION >= 3 && GTK_MINOR_VERSION >= 22
+ GdkRectangle geo;
+
+ GdkDisplay *display = gdk_display_get_default();
+ GdkMonitor *monitor = gdk_display_get_monitor(display, 0);
+ gdk_monitor_get_geometry(monitor, &geo);
+
+ cam->screen_width = geo.width;
+ cam->screen_height = geo.height;
+#else
+ cam->screen_width = gdk_screen_width();
+ cam->screen_height = gdk_screen_height();
+#endif
+}
+
int main(int argc, char *argv[])
{
cam_t cam_object, *cam;
@@ -83,8 +100,7 @@ int main(int argc, char *argv[])
cam->width = x;
cam->height = y;
- cam->screen_width = gdk_screen_width();
- cam->screen_height = gdk_screen_height();
+ get_geometry(cam);
if (ver) {
fprintf(stderr, _("\n\nCamorama version %s\n\n"), PACKAGE_VERSION);

Privacy Policy