mirror of https://github.com/fltk/fltk
Make Fl::display(const char *) active also for the Wayland platform.
This commit is contained in:
parent
c7ffd8e72a
commit
e69d45cde8
|
@ -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, ...);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue