|
|
commit ddc213d91c28e5f0729a7f397e88104baa7024bc
Author: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
AuthorDate: Thu Feb 2 14:39:11 2023 +0100
Commit: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
CommitDate: Thu Feb 2 14:39:11 2023 +0100
Add preliminary support of Wayland under macOS
Wayland under macOS is WIP at
https://github.com/owl-compositor/owl
src/drivers/Wayland/Fl_Wayland_Screen_Driver.H | 2 +-
src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx | 6 ++++--
src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx | 20 ++++++++++++++++++--
3 files changed, 23 insertions(+), 5 deletions(-)
diff --git src/drivers/Wayland/Fl_Wayland_Screen_Driver.H src/drivers/Wayland/Fl_Wayland_Screen_Driver.H
index bd3edd9..f1a7239 100644
--- src/drivers/Wayland/Fl_Wayland_Screen_Driver.H
+++ src/drivers/Wayland/Fl_Wayland_Screen_Driver.H
@@ -169,7 +169,7 @@ public:
char *get_seat_name();
struct xkb_keymap *get_xkb_keymap();
static bool own_output(struct wl_output *output);
- typedef enum {unspecified, MUTTER, WESTON, KDE} compositor_name;
+ typedef enum {unspecified, MUTTER, WESTON, KDE, OWL} compositor_name;
static compositor_name compositor; // identifies the used Wayland compositor
void set_spot(int font, int height, int x, int y, int w, int h, Fl_Window *win) FL_OVERRIDE;
void reset_spot() FL_OVERRIDE;
diff --git src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx
index 3cd02dc..88a199e 100644
--- src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx
+++ src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx
@@ -1056,8 +1056,10 @@ static void registry_handle_global(void *user_data, struct wl_registry *wl_regis
} else if (strcmp(interface, "org_kde_plasma_shell") == 0) {
Fl_Wayland_Screen_Driver::compositor = Fl_Wayland_Screen_Driver::KDE;
//fprintf(stderr, "Running the KDE compositor\n");
- }
- else if (strcmp(interface, zwp_text_input_manager_v3_interface.name) == 0) {
+ } else if (strncmp(interface, "zowl_mach_ipc", 13) == 0) {
+ Fl_Wayland_Screen_Driver::compositor = Fl_Wayland_Screen_Driver::OWL;
+ //fprintf(stderr, "Running the Owl compositor\n");
+ } else if (strcmp(interface, zwp_text_input_manager_v3_interface.name) == 0) {
scr_driver->text_input_base = (struct zwp_text_input_manager_v3 *) wl_registry_bind(wl_registry, id, &zwp_text_input_manager_v3_interface, 1);
//printf("scr_driver->text_input_base=%p version=%d\n",scr_driver->text_input_base,version);
}
diff --git src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx
index 97a8d34..b54acac 100644
--- src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx
+++ src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx
@@ -873,6 +873,16 @@ static void xdg_toplevel_configure(void *data, struct xdg_toplevel *xdg_toplevel
}
window->configured_width = ceil(width / f);
window->configured_height = ceil(height / f);
+ if (Fl_Wayland_Screen_Driver::compositor == Fl_Wayland_Screen_Driver::OWL) {
+ Fl_Window *sub = Fl::first_window();
+ while (sub) { // search still un-exposed sub-windows
+ if (sub->window() == window->fl_win) {
+ Fl_Window_Driver::driver(sub)->wait_for_expose_value = 0;
+ break;
+ }
+ sub = Fl::next_window(sub);
+ }
+ }
}
@@ -1145,7 +1155,9 @@ void Fl_Wayland_Window_Driver::makeWindow()
if (pWindow->menu_window() || pWindow->tooltip_window()) { // a menu window or tooltip
is_floatingtitle = process_menu_or_tooltip(new_window);
- } else if ( pWindow->border() && !pWindow->parent() ) { // a decorated window
+ // Don't attempt to use libdecor with OWL
+ } else if (Fl_Wayland_Screen_Driver::compositor != Fl_Wayland_Screen_Driver::OWL &&
+ pWindow->border() && !pWindow->parent() ) { // a decorated window
new_window->kind = DECORATED;
if (!scr_driver->libdecor_context)
scr_driver->libdecor_context = libdecor_new(Fl_Wayland_Screen_Driver::wl_display, &libdecor_iface);
@@ -1175,7 +1187,11 @@ void Fl_Wayland_Window_Driver::makeWindow()
// "A sub-surface becomes mapped, when a non-NULL wl_buffer is applied and the parent surface is mapped."
new_window->configured_width = pWindow->w();
new_window->configured_height = pWindow->h();
- wait_for_expose_value = 0;
+ if (Fl_Wayland_Screen_Driver::compositor != Fl_Wayland_Screen_Driver::OWL) {
+ // With OWL, delay zeroing of subwindow's wait_for_expose_value until
+ // after their parent is configured, see xdg_toplevel_configure().
+ wait_for_expose_value = 0;
+ }
pWindow->border(0);
checkSubwindowFrame(); // make sure subwindow doesn't leak outside parent
[ Direct Link to Message ] | |
|
| |