Add preliminary support of Wayland under macOS

Wayland under macOS is WIP at
  https://github.com/owl-compositor/owl
This commit is contained in:
ManoloFLTK 2023-02-02 14:39:11 +01:00
parent 96fd8a5f7a
commit ddc213d91c
3 changed files with 23 additions and 5 deletions

View File

@ -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;

View File

@ -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);
}

View File

@ -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