Fix for bug in Mutter Wayland compositor (#878) - cont'd

Add more tests to do additional operations under stricter conditions
This commit is contained in:
ManoloFLTK
2023-12-28 11:28:47 +01:00
parent 6143764885
commit 30f2ec8185
3 changed files with 15 additions and 12 deletions
+5
View File
@@ -636,6 +636,10 @@ is off and Wayland sends a final resize command which is not skipped. Overall, t
ensures the client program resizes its window as frequently as it can without ensures the client program resizes its window as frequently as it can without
falling behind resize commands sent by the compositor. falling behind resize commands sent by the compositor.
To account for a bug in Mutter (issue #878), the \c window->buffer->cb object is
not created when a toplevel window is being resized and is entirely covered by
one subwindow.
<h3>Progressive window drawing</h3> <h3>Progressive window drawing</h3>
FLTK supports progressive drawing when an app calls function Fl_Window::make_current() FLTK supports progressive drawing when an app calls function Fl_Window::make_current()
at any time and then calls the FLTK drawing API. This is made possible at any time and then calls the FLTK drawing API. This is made possible
@@ -1280,6 +1284,7 @@ struct wld_window {
int floating_width; // helps restoring size after un-maximizing int floating_width; // helps restoring size after un-maximizing
int floating_height; int floating_height;
int state; // indicates whether window is fullscreen, maximized. Used otherwise for POPUPs int state; // indicates whether window is fullscreen, maximized. Used otherwise for POPUPs
bool covered; // specially for Mutter and issue #878
} }
</pre> </pre>
@@ -163,7 +163,7 @@ struct wld_window {
int floating_width; int floating_width;
int floating_height; int floating_height;
int state; int state;
bool covered; bool covered; // specially for Mutter and issue #878
}; };
@@ -1792,22 +1792,20 @@ int Fl_Wayland_Window_Driver::set_cursor_4args(const Fl_RGB_Image *rgb, int hotx
// does win entirely cover its parent ? // does win entirely cover its parent ?
static void does_window_cover_parent(Fl_Window *win) { static void does_window_cover_parent(Fl_Window *win) {
if (win->parent()) { Fl_Window *parent = win->window();
Fl_Window *parent = win->window(); fl_wl_xid(parent)->covered = (win->x() <= 0 && win->y() <= 0 &&
if (win->x() <= 0 && win->y() <= 0 && win->w() >= parent->w() && win->w() >= parent->w() && win->h() >= parent->h());
win->h() >= parent->h()) {
struct wld_window *xid = fl_wl_xid(parent);
xid->covered = true;
}
}
} }
// recursively explore all subwindows in a window // recursively explore all shown subwindows in a window and call f for each
static void scan_subwindows(Fl_Group *g, void (*f)(Fl_Window *)) { static void scan_subwindows(Fl_Group *g, void (*f)(Fl_Window *)) {
for (int i = 0; i < g->children(); i++) { for (int i = 0; i < g->children(); i++) {
Fl_Widget *o = g->child(i); Fl_Widget *o = g->child(i);
if (o->as_window()) f(o->as_window()); if (o->as_window()) {
if (!o->as_window()->shown()) continue;
f(o->as_window());
}
if (o->as_group()) scan_subwindows(o->as_group(), f); if (o->as_group()) scan_subwindows(o->as_group(), f);
} }
} }
@@ -1910,7 +1908,7 @@ void Fl_Wayland_Window_Driver::resize(int X, int Y, int W, int H) {
checkSubwindowFrame(); // make sure subwindow doesn't leak outside parent checkSubwindowFrame(); // make sure subwindow doesn't leak outside parent
if (Fl_Wayland_Screen_Driver::compositor == Fl_Wayland_Screen_Driver::MUTTER && if (Fl_Wayland_Screen_Driver::compositor == Fl_Wayland_Screen_Driver::MUTTER &&
!pWindow->parent()) { // fix for MUTTER bug described in issue #878 fl_win && is_a_resize && fl_win->kind == DECORATED) { // fix for issue #878
scan_subwindows(pWindow, does_window_cover_parent); scan_subwindows(pWindow, does_window_cover_parent);
} }
} }