mirror of
https://github.com/fltk/fltk.git
synced 2026-05-31 22:04:26 +08:00
Add preliminary support of Wayland under macOS
Wayland under macOS is WIP at https://github.com/owl-compositor/owl
This commit is contained in:
@@ -169,7 +169,7 @@ public:
|
|||||||
char *get_seat_name();
|
char *get_seat_name();
|
||||||
struct xkb_keymap *get_xkb_keymap();
|
struct xkb_keymap *get_xkb_keymap();
|
||||||
static bool own_output(struct wl_output *output);
|
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
|
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 set_spot(int font, int height, int x, int y, int w, int h, Fl_Window *win) FL_OVERRIDE;
|
||||||
void reset_spot() FL_OVERRIDE;
|
void reset_spot() FL_OVERRIDE;
|
||||||
|
|||||||
@@ -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) {
|
} else if (strcmp(interface, "org_kde_plasma_shell") == 0) {
|
||||||
Fl_Wayland_Screen_Driver::compositor = Fl_Wayland_Screen_Driver::KDE;
|
Fl_Wayland_Screen_Driver::compositor = Fl_Wayland_Screen_Driver::KDE;
|
||||||
//fprintf(stderr, "Running the KDE compositor\n");
|
//fprintf(stderr, "Running the KDE compositor\n");
|
||||||
}
|
} else if (strncmp(interface, "zowl_mach_ipc", 13) == 0) {
|
||||||
else if (strcmp(interface, zwp_text_input_manager_v3_interface.name) == 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);
|
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);
|
//printf("scr_driver->text_input_base=%p version=%d\n",scr_driver->text_input_base,version);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -873,6 +873,16 @@ static void xdg_toplevel_configure(void *data, struct xdg_toplevel *xdg_toplevel
|
|||||||
}
|
}
|
||||||
window->configured_width = ceil(width / f);
|
window->configured_width = ceil(width / f);
|
||||||
window->configured_height = ceil(height / 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
|
if (pWindow->menu_window() || pWindow->tooltip_window()) { // a menu window or tooltip
|
||||||
is_floatingtitle = process_menu_or_tooltip(new_window);
|
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;
|
new_window->kind = DECORATED;
|
||||||
if (!scr_driver->libdecor_context)
|
if (!scr_driver->libdecor_context)
|
||||||
scr_driver->libdecor_context = libdecor_new(Fl_Wayland_Screen_Driver::wl_display, &libdecor_iface);
|
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."
|
// "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_width = pWindow->w();
|
||||||
new_window->configured_height = pWindow->h();
|
new_window->configured_height = pWindow->h();
|
||||||
|
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;
|
wait_for_expose_value = 0;
|
||||||
|
}
|
||||||
pWindow->border(0);
|
pWindow->border(0);
|
||||||
checkSubwindowFrame(); // make sure subwindow doesn't leak outside parent
|
checkSubwindowFrame(); // make sure subwindow doesn't leak outside parent
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user