From 918395e0916a6ae48663b41173f5c0d887dcc347 Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Sat, 5 Nov 2022 15:28:39 +0100 Subject: Wayland: simpler handling of the z-order of subwindows It's not necessary to call wl_subsurface_place_above() because "A new sub-surface is initially added as the top-most in the stack of its siblings and parent." --- src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) (limited to 'src') diff --git a/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx index b7c07a38b..d3df1494b 100644 --- a/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx +++ b/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx @@ -953,25 +953,8 @@ static Fl_Window *calc_transient_parent(int ¢er_x, int ¢er_y) { Fl_Window *top = Fl::first_window()->top_window(); while (top && top->user_data() == &Fl_Screen_Driver::transient_scale_display) top = Fl::next_window(top); - Fl_Window *target = top; - // search if top's center belongs to one of its subwindows center_x = top->w()/2; center_y = top->h()/2; - while (target) { - Fl_Window *child = Fl::first_window(); - while (child) { - if (child->window() == target && child->user_data() != &Fl_Screen_Driver::transient_scale_display && - child->x() <= center_x && child->x()+child->w() > center_x && - child->y() <= center_y && child->y()+child->h() > center_y) { - break; // child contains the center of top - } - child = Fl::next_window(child); - } - if (!child) break; // no more subwindow contains the center of top - target = child; - center_x -= child->x(); // express center coordinates relatively to child - center_y -= child->y(); - } - return target; + return top; } @@ -1084,7 +1067,6 @@ Fl_X *Fl_Wayland_Window_Driver::makeWindow() float f = Fl::screen_scale(pWindow->top_window()->screen_num()); wl_subsurface_set_position(new_window->subsurface, pWindow->x() * f, pWindow->y() * f); wl_subsurface_set_desync(new_window->subsurface); // important - wl_subsurface_place_above(new_window->subsurface, parent->wl_surface); // next 3 statements ensure the subsurface will be mapped because: // "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(); -- cgit v1.2.3