Wayland: fix interactive moving and resizing of a subwindow - cont'd (#1003)

This commit is contained in:
ManoloFLTK 2024-07-03 17:57:55 +02:00
parent 944ae5b040
commit fc910ae892
2 changed files with 16 additions and 24 deletions

View File

@ -328,7 +328,7 @@ void Fl_Wayland_Gl_Window_Driver::swap_buffers() {
}
if (egl_surface) {
if (pWindow->parent()) {
if (pWindow->parent()) { // issue #976
struct wld_window *xid = fl_wl_xid(pWindow);
if (xid->frame_cb) return;
xid->frame_cb = wl_surface_frame(xid->wl_surface);

View File

@ -1792,10 +1792,6 @@ void Fl_Wayland_Window_Driver::resize(int X, int Y, int W, int H) {
if (shown() && !(parent() || popup_window())) {
X = Y = 0;
}
struct wld_window *parent_xid = parent() ? fl_wl_xid(pWindow->window()) : NULL;
// This condition delays application of new X,Y,W,H values if
// a non-GL subwindow is being committed.
if (!parent_xid || !parent_xid->frame_cb || pWindow->as_gl_window()) {
if (is_a_resize) {
if (pWindow->parent()) {
if (W < 1) W = 1;
@ -1808,7 +1804,6 @@ void Fl_Wayland_Window_Driver::resize(int X, int Y, int W, int H) {
x(X); y(Y);
//fprintf(stderr, "move win=%p to %dx%d\n", pWindow, X, Y);
}
}
if (shown()) {
if (is_a_resize) {
@ -1865,15 +1860,12 @@ void Fl_Wayland_Window_Driver::resize(int X, int Y, int W, int H) {
}
}
struct wld_window *parent_xid = parent() ? fl_wl_xid(pWindow->window()) : NULL;
if (fl_win && parent_xid) {
if (!parent_xid->frame_cb && !pWindow->as_gl_window()) {
// Interactive move or resize of a subwindow requires to commit the parent surface
// and requires to make sure the parent surface is ready to accept a new commit (#987).
parent_xid->frame_cb = wl_surface_frame(parent_xid->wl_surface);
wl_callback_add_listener(parent_xid->frame_cb,
Fl_Wayland_Graphics_Driver::p_surface_frame_listener, parent_xid);
wl_surface_commit(parent_xid->wl_surface);
}
if (pWindow->as_gl_window() && fl_win->frame_cb) {
wl_callback_destroy(fl_win->frame_cb);
fl_win->frame_cb = NULL;
} else wl_surface_commit(parent_xid->wl_surface);
checkSubwindowFrame(); // make sure subwindow doesn't leak outside parent
}
}