summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2022-10-23 12:19:44 +0200
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2022-10-23 12:19:44 +0200
commite69d45cde88373a32b580745aafae93529a5cc73 (patch)
treeb0671a3bf097505d6118599826bfb52e298545d2 /src
parentc7ffd8e72a3c8ffe12ec546824df48b95bdf790f (diff)
Make Fl::display(const char *) active also for the Wayland platform.
Diffstat (limited to 'src')
-rw-r--r--src/Fl_System_Driver.H2
-rw-r--r--src/Fl_arg.cxx3
-rw-r--r--src/Fl_display.cxx7
-rw-r--r--src/drivers/Wayland/Fl_Wayland_Screen_Driver.H1
-rw-r--r--src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx6
-rw-r--r--src/drivers/X11/Fl_X11_System_Driver.H1
-rw-r--r--src/drivers/X11/Fl_X11_System_Driver.cxx4
7 files changed, 12 insertions, 12 deletions
diff --git a/src/Fl_System_Driver.H b/src/Fl_System_Driver.H
index 15d3d89e5..6f9ed4436 100644
--- a/src/Fl_System_Driver.H
+++ b/src/Fl_System_Driver.H
@@ -91,8 +91,6 @@ public:
virtual int single_arg(const char *) { return 0; }
// implement if the system adds unwanted program argument pair(s)
virtual int arg_and_value(const char * /*name*/, const char * /*value*/) { return 0; }
- // implement to process the -display argument
- virtual void display_arg(const char *) { }
// default implementation should be enough
virtual int XParseGeometry(const char* string, int* x, int* y, unsigned int* width, unsigned int* height);
static void warning(const char* format, ...);
diff --git a/src/Fl_arg.cxx b/src/Fl_arg.cxx
index 531b3d853..978097149 100644
--- a/src/Fl_arg.cxx
+++ b/src/Fl_arg.cxx
@@ -21,6 +21,7 @@
#include <FL/Fl_Window.H>
#include "Fl_Window_Driver.H"
#include "Fl_System_Driver.H"
+#include "Fl_Screen_Driver.H"
#include <FL/Fl_Tooltip.H>
#include <FL/filename.H>
#include <FL/fl_draw.H>
@@ -172,7 +173,7 @@ int Fl::arg(int argc, char **argv, int &i) {
geometry = v;
} else if (fl_match(s, "display", 2)) {
- Fl::system_driver()->display_arg(v);
+ Fl::screen_driver()->display(v);
} else if (Fl::system_driver()->arg_and_value(s, v)) {
// nothing to do
diff --git a/src/Fl_display.cxx b/src/Fl_display.cxx
index 1a78cba68..d91393838 100644
--- a/src/Fl_display.cxx
+++ b/src/Fl_display.cxx
@@ -21,11 +21,10 @@
#include "Fl_Screen_Driver.H"
/**
- \brief Sets the X display to use for all windows.
+ Sets the X or Wayland display to use for all windows.
- Actually this just sets the environment variable $DISPLAY to the passed string,
- so this only works before you show() the first window or otherwise open the
- display.
+ This sets the environment variable $DISPLAY or $WAYLAND_DISPLAY to the passed string,
+ so this only works before you show() the first window or otherwise open the display.
This does nothing on other platforms.
*/
diff --git a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.H b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.H
index 28e5f3655..e55531509 100644
--- a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.H
+++ b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.H
@@ -148,6 +148,7 @@ public:
virtual int get_mouse(int &x, int &y);
virtual void open_display_platform();
virtual void close_display();
+ virtual void display(const char *d);
// --- compute dimensions of an Fl_Offscreen
virtual void offscreen_size(Fl_Offscreen o, int &width, int &height);
virtual int has_marked_text() const;
diff --git a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx
index ec93f1fa9..0f2f24ee0 100644
--- a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx
+++ b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx
@@ -1492,6 +1492,12 @@ void Fl_Wayland_Screen_Driver::reset_spot() {
}
+void Fl_Wayland_Screen_Driver::display(const char *d)
+{
+ if (d) ::setenv("WAYLAND_DISPLAY", d, 1);
+}
+
+
struct wl_display *fl_wl_display() {
if (!Fl_Wayland_Screen_Driver::wl_display || !Fl_Wayland_Screen_Driver::wl_registry) return NULL;
return Fl_Wayland_Screen_Driver::wl_display;
diff --git a/src/drivers/X11/Fl_X11_System_Driver.H b/src/drivers/X11/Fl_X11_System_Driver.H
index a5347d74d..6e94bf44b 100644
--- a/src/drivers/X11/Fl_X11_System_Driver.H
+++ b/src/drivers/X11/Fl_X11_System_Driver.H
@@ -28,7 +28,6 @@ public:
key_table = NULL;
key_table_size = 0;
}
- virtual void display_arg(const char *arg);
virtual int XParseGeometry(const char*, int*, int*, unsigned int*, unsigned int*);
// these 2 are in Fl_get_key.cxx
virtual int event_key(int k);
diff --git a/src/drivers/X11/Fl_X11_System_Driver.cxx b/src/drivers/X11/Fl_X11_System_Driver.cxx
index d3a81c745..4eebee27a 100644
--- a/src/drivers/X11/Fl_X11_System_Driver.cxx
+++ b/src/drivers/X11/Fl_X11_System_Driver.cxx
@@ -70,10 +70,6 @@ extern "C" {
#endif
-void Fl_X11_System_Driver::display_arg(const char *arg) {
- Fl::display(arg);
-}
-
int Fl_X11_System_Driver::XParseGeometry(const char* string, int* x, int* y,
unsigned int* width, unsigned int* height) {
return ::XParseGeometry(string, x, y, width, height);