mirror of https://github.com/fltk/fltk
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."
This commit is contained in:
parent
e133d3af2b
commit
918395e091
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue