From b5516449a687f8493e5fd9682511e9611a5b4fb7 Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Mon, 1 Jul 2024 17:02:27 +0200 Subject: [PATCH] Wayland: fix interactive moving and resizing of a subwindow - cont'd (#987) This commit removes changes in class Fl_Group introduced in 1c6a0c1. --- FL/Fl_Group.H | 3 +-- src/Fl_Group.cxx | 4 ---- src/Fl_Window_Driver.H | 1 - src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx | 14 ++++++++------ 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/FL/Fl_Group.H b/FL/Fl_Group.H index 9f76b4fd1..173f8754b 100644 --- a/FL/Fl_Group.H +++ b/FL/Fl_Group.H @@ -54,7 +54,7 @@ class Fl_Rect; reason \p FL_REASON_CLOSED. */ class FL_EXPORT Fl_Group : public Fl_Widget { - friend class Fl_Window_Driver; + union { Fl_Widget** array_; // used if group has two or more children or NULL Fl_Widget* child1_; // used if group has one child or NULL @@ -67,7 +67,6 @@ class FL_EXPORT Fl_Group : public Fl_Widget { int navigation(int); static Fl_Group *current_; - static int group_resize_depth_; // unimplemented copy ctor and assignment operator Fl_Group(const Fl_Group&); diff --git a/src/Fl_Group.cxx b/src/Fl_Group.cxx index e6d942e32..2576efea7 100644 --- a/src/Fl_Group.cxx +++ b/src/Fl_Group.cxx @@ -809,8 +809,6 @@ int* Fl_Group::sizes() return sizes_; } -int Fl_Group::group_resize_depth_ = 0; - /** Resizes the Fl_Group widget and all of its children. @@ -859,7 +857,6 @@ void Fl_Group::resize(int X, int Y, int W, int H) { // Part 2: here we definitely have a resizable() widget, resize children else if (children_) { - group_resize_depth_++; // get changes in size/position from the initial size: dx = X - p->x(); @@ -908,7 +905,6 @@ void Fl_Group::resize(int X, int Y, int W, int H) { o->resize(L+dx, T+dy, R-L, B-T); } - group_resize_depth_--; } // End of part 2: we have a resizable() widget } diff --git a/src/Fl_Window_Driver.H b/src/Fl_Window_Driver.H index 9df4c99e8..cec60a2da 100644 --- a/src/Fl_Window_Driver.H +++ b/src/Fl_Window_Driver.H @@ -58,7 +58,6 @@ private: protected: Fl_Window *pWindow; int screen_num_; // number of screen where window is mapped - static int group_resize_depth() { return Fl_Group::group_resize_depth_; } public: Fl_Window_Driver(Fl_Window *); virtual ~Fl_Window_Driver(); diff --git a/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx index 21a02c8f4..8f8eb12b8 100644 --- a/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx +++ b/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx @@ -1459,8 +1459,10 @@ void Fl_Wayland_Window_Driver::makeWindow() // the state of the parent surface is applied." new_window->configured_width = pWindow->w(); new_window->configured_height = pWindow->h(); - parent->fl_win->wait_for_expose(); - wl_surface_commit(parent->wl_surface); + if (!pWindow->as_gl_window()) { + parent->fl_win->wait_for_expose(); + wl_surface_commit(parent->wl_surface); + } wait_for_expose_value = 0; pWindow->border(0); checkSubwindowFrame(); // make sure subwindow doesn't leak outside parent @@ -1791,9 +1793,9 @@ void Fl_Wayland_Window_Driver::resize(int X, int Y, int W, int H) { X = Y = 0; } struct wld_window *parent_xid = parent() ? fl_wl_xid(pWindow->window()) : NULL; - // This condition excludes moving or resizing a subwindow while not changing its parent - // and delays application of new X,Y,W,H values if the parent is being committed. - if (true_rescale || !parent_xid || group_resize_depth() >= 1 || !parent_xid->frame_cb) { + // 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; @@ -1864,7 +1866,7 @@ void Fl_Wayland_Window_Driver::resize(int X, int Y, int W, int H) { } if (fl_win && parent_xid) { - if (group_resize_depth() < 1 && !parent_xid->frame_cb) { + 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);