summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx16
-rw-r--r--src/drivers/Wayland/Fl_Wayland_Screen_Driver.H1
-rw-r--r--src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx35
-rw-r--r--src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx41
-rw-r--r--src/drivers/Wayland/fl_wayland_clipboard_dnd.cxx8
5 files changed, 42 insertions, 59 deletions
diff --git a/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx
index 505709e09..e28588369 100644
--- a/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx
+++ b/src/drivers/Wayland/Fl_Wayland_Gl_Window_Driver.cxx
@@ -62,8 +62,8 @@ Fl_Wayland_Gl_Window_Driver::Fl_Wayland_Gl_Window_Driver(Fl_Gl_Window *win) : Fl
void Fl_Wayland_Gl_Window_Driver::init() {
EGLint major, minor;
- if (!fl_display) Fl::screen_driver()->open_display();
- egl_display = eglGetDisplay((EGLNativeDisplayType) fl_display);
+ if (!Fl_Wayland_Screen_Driver::wl_display) Fl::screen_driver()->open_display();
+ egl_display = eglGetDisplay((EGLNativeDisplayType) Fl_Wayland_Screen_Driver::wl_display);
if (egl_display == EGL_NO_DISPLAY) {
Fl::fatal("Can't create egl display\n");
}
@@ -77,7 +77,7 @@ void Fl_Wayland_Gl_Window_Driver::init() {
//printf("EGL has %d configs\n", configs_count);
eglBindAPI(EGL_OPENGL_API);
- gl_event_queue = wl_display_create_queue(fl_display);
+ gl_event_queue = wl_display_create_queue(Fl_Wayland_Screen_Driver::wl_display);
}
@@ -246,7 +246,7 @@ void Fl_Wayland_Gl_Window_Driver::make_current_before() {
struct wl_callback *callback = wl_surface_frame(surface);
wl_surface_commit(surface);
wl_callback_add_listener(callback, &gl_surface_frame_listener, &done);
- while (!done) wl_display_dispatch(fl_display);
+ while (!done) wl_display_dispatch(Fl_Wayland_Screen_Driver::wl_display);
}
}
}
@@ -301,11 +301,11 @@ void Fl_Wayland_Gl_Window_Driver::swap_buffers() {
if (egl_surface) {
//eglSwapInterval(egl_display, 0); // doesn't seem to have any effect in this context
if (!egl_resize_in_progress) {
- while (wl_display_prepare_read(fl_display) != 0) {
- wl_display_dispatch_pending(fl_display);
+ while (wl_display_prepare_read(Fl_Wayland_Screen_Driver::wl_display) != 0) {
+ wl_display_dispatch_pending(Fl_Wayland_Screen_Driver::wl_display);
}
- wl_display_read_events(fl_display);
- wl_display_dispatch_queue_pending(fl_display, gl_event_queue);
+ wl_display_read_events(Fl_Wayland_Screen_Driver::wl_display);
+ wl_display_dispatch_queue_pending(Fl_Wayland_Screen_Driver::wl_display, gl_event_queue);
}
egl_resize_in_progress = false;
eglSwapBuffers(Fl_Wayland_Gl_Window_Driver::egl_display, egl_surface);
diff --git a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.H b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.H
index 0ce25734f..97395dbef 100644
--- a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.H
+++ b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.H
@@ -63,6 +63,7 @@ class FL_EXPORT Fl_Wayland_Screen_Driver : public Fl_Screen_Driver
static int insertion_point_height;
static bool insertion_point_location_is_valid;
public:
+ static struct wl_display *wl_display;
static void insertion_point_location(int x, int y, int height);
static bool insertion_point_location(int *px, int *py, int *pwidth, int *pheight);
int get_mouse_unscaled(int &xx, int &yy);
diff --git a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx
index 458435756..081edfb50 100644
--- a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx
+++ b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx
@@ -157,8 +157,6 @@ extern const char *fl_bg2;
// end of extern additions workaround
-FL_EXPORT struct wl_display *fl_display = NULL;
-
static bool has_xrgb = false;
@@ -225,6 +223,9 @@ static inline void checkdouble() {
}
+struct wl_display *Fl_Wayland_Screen_Driver::wl_display = NULL;
+
+
Fl_Window *Fl_Wayland_Screen_Driver::surface_to_window(struct wl_surface *surface) {
Fl_X *xp = Fl_X::first;
while (xp) {
@@ -749,7 +750,7 @@ void text_input_enter(void *data, struct zwp_text_input_v3 *zwp_text_input_v3,
zwp_text_input_v3_set_cursor_rectangle(zwp_text_input_v3, x, y, width, height);
}
zwp_text_input_v3_commit(zwp_text_input_v3);
- wl_display_roundtrip(fl_display);
+ wl_display_roundtrip(Fl_Wayland_Screen_Driver::wl_display);
}
void text_input_leave(void *data, struct zwp_text_input_v3 *zwp_text_input_v3,
@@ -1059,7 +1060,6 @@ Fl_Wayland_Screen_Driver::Fl_Wayland_Screen_Driver() : Fl_Screen_Driver() {
}
void Fl_Wayland_Screen_Driver::open_display_platform() {
- struct wl_display *wl_display;
struct wl_registry *wl_registry;
static bool beenHereDoneThat = false;
@@ -1071,7 +1071,6 @@ void Fl_Wayland_Screen_Driver::open_display_platform() {
if (!wl_display) {
Fl::fatal("No Wayland connection\n");
}
- fl_display = wl_display;
wl_list_init(&seats);
wl_list_init(&outputs);
@@ -1090,8 +1089,9 @@ void Fl_Wayland_Screen_Driver::open_display_platform() {
}
void Fl_Wayland_Screen_Driver::close_display() {
- Fl::remove_fd(wl_display_get_fd(fl_display));
- wl_display_disconnect(fl_display);
+ Fl::remove_fd(wl_display_get_fd(Fl_Wayland_Screen_Driver::wl_display));
+ wl_display_disconnect(Fl_Wayland_Screen_Driver::wl_display);
+ Fl_Wayland_Screen_Driver::wl_display = NULL;
}
@@ -1112,7 +1112,7 @@ void Fl_Wayland_Screen_Driver::init_workarea()
int Fl_Wayland_Screen_Driver::x() {
- if (!fl_display) open_display();
+ if (!Fl_Wayland_Screen_Driver::wl_display) open_display();
Fl_Wayland_Screen_Driver::output *output;
wl_list_for_each(output, &outputs, link) {
break;
@@ -1121,7 +1121,7 @@ int Fl_Wayland_Screen_Driver::x() {
}
int Fl_Wayland_Screen_Driver::y() {
- if (!fl_display) open_display();
+ if (!Fl_Wayland_Screen_Driver::wl_display) open_display();
Fl_Wayland_Screen_Driver::output *output;
wl_list_for_each(output, &outputs, link) {
break;
@@ -1130,7 +1130,7 @@ int Fl_Wayland_Screen_Driver::y() {
}
int Fl_Wayland_Screen_Driver::w() {
- if (!fl_display) open_display();
+ if (!Fl_Wayland_Screen_Driver::wl_display) open_display();
Fl_Wayland_Screen_Driver::output *output;
wl_list_for_each(output, &outputs, link) {
break;
@@ -1139,7 +1139,7 @@ int Fl_Wayland_Screen_Driver::w() {
}
int Fl_Wayland_Screen_Driver::h() {
- if (!fl_display) open_display();
+ if (!Fl_Wayland_Screen_Driver::wl_display) open_display();
Fl_Wayland_Screen_Driver::output *output;
wl_list_for_each(output, &outputs, link) {
break;
@@ -1149,7 +1149,7 @@ int Fl_Wayland_Screen_Driver::h() {
void Fl_Wayland_Screen_Driver::init() {
- if (!fl_display) open_display();
+ if (!Fl_Wayland_Screen_Driver::wl_display) open_display();
}
@@ -1219,8 +1219,8 @@ void Fl_Wayland_Screen_Driver::beep(int type)
void Fl_Wayland_Screen_Driver::flush()
{
- if (fl_display) {
- wl_display_flush(fl_display);
+ if (Fl_Wayland_Screen_Driver::wl_display) {
+ wl_display_flush(Fl_Wayland_Screen_Driver::wl_display);
}
}
@@ -1245,13 +1245,6 @@ void Fl_Wayland_Screen_Driver::grab(Fl_Window* win)
} else {
if (Fl::grab()) {
// We must keep the grab in the non-EWMH fullscreen case
- if (!fullscreen_win ) {
- //XUngrabKeyboard(fl_display, fl_event_time);
- }
- //XUngrabPointer(fl_display, fl_event_time);
- // this flush is done in case the picked menu item goes into
- // an infinite loop, so we don't leave the X server locked up:
- //XFlush(fl_display);
Fl::grab_ = 0; // FIXME: Fl::grab_ "should be private", but we need
// a way to *set* the variable from the driver!
fl_fix_focus();
diff --git a/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx
index b1ac7974e..1cf6e084f 100644
--- a/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx
+++ b/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx
@@ -636,21 +636,6 @@ void Fl_Wayland_Window_Driver::show_with_args_begin() {
if (Fl::first_window()) key = Fl::first_window()->xclass();
if (!key) key = "fltk";
-
- /*const char *val = XGetDefault(fl_display, key, "dndTextOps");
- if (val) Fl::dnd_text_ops(strcasecmp(val, "true") == 0 ||
- strcasecmp(val, "on") == 0 ||
- strcasecmp(val, "yes") == 0);
-
- val = XGetDefault(fl_display, key, "tooltips");
- if (val) Fl_Tooltip::enable(strcasecmp(val, "true") == 0 ||
- strcasecmp(val, "on") == 0 ||
- strcasecmp(val, "yes") == 0);
-
- val = XGetDefault(fl_display, key, "visibleFocus");
- if (val) Fl::visible_focus(strcasecmp(val, "true") == 0 ||
- strcasecmp(val, "on") == 0 ||
- strcasecmp(val, "yes") == 0);*/
}
@@ -662,8 +647,6 @@ void Fl_Wayland_Window_Driver::show_with_args_end(int argc, char **argv) {
char *buffer = new char[n];
char *p = buffer;
for (j=0; j<argc; j++) for (const char *q = argv[j]; (*p++ = *q++););
- //XChangeProperty(fl_display, fl_xid(pWindow), XA_WM_COMMAND, XA_STRING, 8, 0,
- // (unsigned char *)buffer, p-buffer-1);
delete[] buffer;
}
}
@@ -875,10 +858,10 @@ void Fl_Wayland_Window_Driver::wait_for_expose()
Window xid = fl_xid(pWindow);
if (xid->kind == DECORATED) {
while (!(xid->state & LIBDECOR_WINDOW_STATE_FULLSCREEN) || !(xid->state & LIBDECOR_WINDOW_STATE_ACTIVE)) {
- wl_display_dispatch(fl_display);
+ wl_display_dispatch(Fl_Wayland_Screen_Driver::wl_display);
}
} else if (xid->kind == UNFRAMED) {
- wl_display_roundtrip(fl_display);
+ wl_display_roundtrip(Fl_Wayland_Screen_Driver::wl_display);
}
}
}
@@ -1114,7 +1097,7 @@ Fl_X *Fl_Wayland_Window_Driver::makeWindow()
} else if ( pWindow->border() && !pWindow->parent() ) { // a decorated window
new_window->kind = DECORATED;
- if (!scr_driver->libdecor_context) scr_driver->libdecor_context = libdecor_new(fl_display, &libdecor_iface);
+ if (!scr_driver->libdecor_context) scr_driver->libdecor_context = libdecor_new(Fl_Wayland_Screen_Driver::wl_display, &libdecor_iface);
new_window->frame = libdecor_decorate(scr_driver->libdecor_context, new_window->wl_surface,
&libdecor_frame_iface, new_window);
//fprintf(stderr, "makeWindow: libdecor_decorate=%p pos:%dx%d\n", new_window->frame, pWindow->x(), pWindow->y());
@@ -1378,8 +1361,8 @@ void Fl_Wayland_Window_Driver::fullscreen_on() {
if (xdg_toplevel()) {
xdg_toplevel_set_fullscreen(xdg_toplevel(), NULL);
pWindow->_set_fullscreen();
- wl_display_roundtrip(fl_display); // OK, but try to find something more specific
- wl_display_roundtrip(fl_display);
+ wl_display_roundtrip(Fl_Wayland_Screen_Driver::wl_display); // OK, but try to find something more specific
+ wl_display_roundtrip(Fl_Wayland_Screen_Driver::wl_display);
Fl::handle(FL_FULLSCREEN, pWindow);
}
}
@@ -1563,12 +1546,12 @@ void Fl_Wayland_Window_Driver::reposition_menu_window(int x, int y) {
xdg_positioner_destroy(positioner);
xdg_popup_add_listener(xid_menu->xdg_popup, &popup_listener, xid_menu);
wl_surface_commit(xid_menu->wl_surface);
- wl_display_roundtrip(fl_display);
+ wl_display_roundtrip(Fl_Wayland_Screen_Driver::wl_display);
// delete the previous popup
xdg_popup_destroy(old_popup);
xdg_surface_destroy(old_xdg);
wl_surface_destroy(old_surface);
- wl_display_roundtrip(fl_display);
+ wl_display_roundtrip(Fl_Wayland_Screen_Driver::wl_display);
this->y(true_y);
}
@@ -1585,10 +1568,16 @@ void Fl_Wayland_Window_Driver::menu_window_area(int &X, int &Y, int &W, int &H,
}
-FL_EXPORT struct wl_surface *fl_wl_surface(Window xid) {
+struct wl_surface *fl_wl_surface(Window xid) {
return xid->wl_surface;
}
-FL_EXPORT struct _cairo *fl_wl_cairo() {
+
+struct _cairo *fl_wl_cairo() {
return ((Fl_Cairo_Graphics_Driver*)fl_graphics_driver)->cr();
}
+
+
+struct wl_display *fl_wl_display() {
+ return Fl_Wayland_Screen_Driver::wl_display;
+}
diff --git a/src/drivers/Wayland/fl_wayland_clipboard_dnd.cxx b/src/drivers/Wayland/fl_wayland_clipboard_dnd.cxx
index 6cfeb092a..315df2919 100644
--- a/src/drivers/Wayland/fl_wayland_clipboard_dnd.cxx
+++ b/src/drivers/Wayland/fl_wayland_clipboard_dnd.cxx
@@ -338,7 +338,7 @@ static void get_clipboard_or_dragged_text(struct wl_data_offer *offer) {
if (pipe(fds)) return;
wl_data_offer_receive(offer, wld_plain_text_clipboard, fds[1]);
close(fds[1]);
- wl_display_flush(fl_display);
+ wl_display_flush(Fl_Wayland_Screen_Driver::wl_display);
// read in fl_selection_buffer
char *to = fl_selection_buffer[1];
ssize_t rest = fl_selection_buffer_length[1];
@@ -370,7 +370,7 @@ static void get_clipboard_or_dragged_text(struct wl_data_offer *offer) {
if (pipe(fds)) return;
wl_data_offer_receive(offer, wld_plain_text_clipboard, fds[1]);
close(fds[1]);
- wl_display_flush(fl_display);
+ wl_display_flush(Fl_Wayland_Screen_Driver::wl_display);
if (rest+1 > fl_selection_buffer_length[1]) {
delete[] fl_selection_buffer[1];
fl_selection_buffer[1] = new char[rest+1000+1];
@@ -431,7 +431,7 @@ static void data_device_handle_motion(void *data, struct wl_data_device *data_de
uint32_t supported_actions = ret ? WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY : WL_DATA_DEVICE_MANAGER_DND_ACTION_NONE;
uint32_t preferred_action = supported_actions;
wl_data_offer_set_actions(current_drag_offer, supported_actions, preferred_action);
- wl_display_roundtrip(fl_display);
+ wl_display_roundtrip(Fl_Wayland_Screen_Driver::wl_display);
if (ret && current_drag_offer) wl_data_offer_accept(current_drag_offer, fl_dnd_serial, "text/plain");
}
@@ -488,7 +488,7 @@ static int get_clipboard_image() {
if (pipe(fds)) return 1;
wl_data_offer_receive(fl_selection_offer, fl_selection_offer_type, fds[1]);
close(fds[1]);
- wl_display_roundtrip(fl_display);
+ wl_display_roundtrip(Fl_Wayland_Screen_Driver::wl_display);
if (strcmp(fl_selection_offer_type, "image/png") == 0) {
char tmp_fname[21];
Fl_Shared_Image *shared = 0;