summaryrefslogtreecommitdiff
path: root/src/drivers
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2022-11-08 08:16:55 +0100
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2022-11-08 08:16:55 +0100
commit1a41178e7763bcfb9739323b800365834d936205 (patch)
treeb6f9258117b1b10acf503e2a7154817cc35ce238 /src/drivers
parent402b08cb6ec70861f5931a39d0b4509a4d7a4e1d (diff)
Wayland: improve processing of the -display command line argument
Diffstat (limited to 'src/drivers')
-rw-r--r--src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx
index cd067883a..bc3c67c72 100644
--- a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx
+++ b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx
@@ -1473,7 +1473,18 @@ void Fl_Wayland_Screen_Driver::reset_spot() {
void Fl_Wayland_Screen_Driver::display(const char *d)
{
- if (d) ::setenv("WAYLAND_DISPLAY", d, 1);
+ if (d && !seat) { // if display was opened, it's too late
+ if (wl_display) {
+ // only the wl_display_connect() call was done, redo it because the target
+ // Wayland compositor may be different
+ wl_display_disconnect(wl_display);
+ }
+ wl_display = wl_display_connect(d);
+ if (!wl_display) {
+ fprintf(stderr, "Error: '%s' is not an active Wayland socket\n", d);
+ exit(1);
+ }
+ }
}