From e120f098db8ab3b79f76d33640ac413053a61d71 Mon Sep 17 00:00:00 2001 From: Andreas Bilke Date: Mon, 20 Nov 2017 11:20:16 +0100 Subject: [PATCH] Disble wayland scaling workaround by default Add command line option to enable workaround behavor for affected wayland sessions. --- man/pdfpc.in | 3 +++ src/classes/options.vala | 5 +++++ src/classes/window/fullscreen.vala | 2 +- src/pdfpc.vala | 5 +++++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/man/pdfpc.in b/man/pdfpc.in index 0f06bc4e..48fa418a 100644 --- a/man/pdfpc.in +++ b/man/pdfpc.in @@ -76,6 +76,9 @@ Force to use only one screen .BI "\-t, \-\-start\-time"=T Start time of the presentation to be used as a countdown. (Format: HH:MM (24h)) .TP +.BI "\-W, \-\-wayland-workaround" +Enable Wayland-specific workaround. This might fix HiDPI scaling problems. +.TP .BI "\-w, \-\-windowed" Run in windowed mode .TP diff --git a/src/classes/options.vala b/src/classes/options.vala index 0ffa3018..fd6f79b2 100644 --- a/src/classes/options.vala +++ b/src/classes/options.vala @@ -52,6 +52,11 @@ namespace pdfpc { */ public static bool windowed = false; + /** + * Commandline option to enable Wayland specific scaling workarounds + */ + public static bool wayland_workaround = false; + /** * Commandline option which allows the complete disabling of slide caching */ diff --git a/src/classes/window/fullscreen.vala b/src/classes/window/fullscreen.vala index 86fb685b..ba730af5 100644 --- a/src/classes/window/fullscreen.vala +++ b/src/classes/window/fullscreen.vala @@ -108,7 +108,7 @@ namespace pdfpc.Window { } this.gdk_scale = this.screen_to_use.get_monitor_scale_factor(this.screen_num_to_use); - if (Pdfpc.is_Wayland_backend()) { + if (Pdfpc.is_Wayland_backend() && Options.wayland_workaround) { // See issue 214. Wayland is doing some double scaling therefore // we are lying about the actual screen size this.screen_geometry.width /= this.gdk_scale; diff --git a/src/pdfpc.vala b/src/pdfpc.vala index 774f7e85..23bcb6eb 100644 --- a/src/pdfpc.vala +++ b/src/pdfpc.vala @@ -68,6 +68,7 @@ namespace pdfpc { { "start-time", 't', 0, OptionArg.STRING, ref Options.start_time, "Start time of the presentation to be used as a countdown. (Format: HH:MM (24h))", "T" }, { "version", 'v', 0, 0, ref Options.version, "Print the version string and copyright statement", null }, { "windowed", 'w', 0, 0, ref Options.windowed, "Run in windowed mode (devel tool)", null}, + { "wayland-workaround", 'W', 0, 0, ref Options.wayland_workaround, "Enable Wayland-specific workaround. This might fix HiDPI scaling problems", null}, { "disable-compression", 'z', 0, 0, ref Options.disable_cache_compression, "Disable the compression of slide images to trade memory consumption for speed. (Avg. factor 30)", null }, { "size", 'Z', 0, OptionArg.STRING, ref Options.size, "Size of the presentation window in width:height format (forces windowed mode)", null}, { null } @@ -193,6 +194,10 @@ namespace pdfpc { GLib.printerr("--notes option detected. Disable auto grouping.\n"); } + if (Pdfpc.is_Wayland_backend() && !Options.wayland_workaround) { + GLib.printerr("If you have wrong scaling of the windows, consider using --wayland-workaround\n"); + } + ConfigFileReader configFileReader = new ConfigFileReader(); configFileReader.readConfig(Path.build_filename(Paths.SOURCE_PATH, "rc/pdfpcrc")); configFileReader.readConfig(Path.build_filename(Paths.CONF_PATH, "pdfpcrc"));