Fix Child Windows under Wayland are clipped on resizing … (#987)

This commit is contained in:
ManoloFLTK 2024-06-02 08:28:40 +02:00
parent 482da12f71
commit d792ed21f5
5 changed files with 16 additions and 1 deletions

View File

@ -625,6 +625,9 @@ public:
static char show_next_window_iconic() {
return show_next_window_iconic_;
}
void allow_expand_outside_parent();
};
#endif

View File

@ -977,3 +977,11 @@ void Fl_Window::is_maximized_(bool b) {
if (b) set_flag(MAXIMIZED);
else clear_flag(MAXIMIZED);
}
/** Allow this subwindow to expand outside the area of its parent window.
This is presently implemented only for the Wayland platform to help support window docking.
\since 1.4.0
*/
void Fl_Window::allow_expand_outside_parent() {
if (parent()) pWindowDriver->allow_expand_outside_parent();
}

View File

@ -207,6 +207,7 @@ public:
static void scroll_to_selected_item(Fl_Window *);
virtual fl_uintptr_t os_id() { return 0; }
virtual void allow_expand_outside_parent() {}
};
#endif // FL_WINDOW_DRIVER_H

View File

@ -56,6 +56,7 @@ private:
Fl_Image* shape_; ///< shape image
cairo_pattern_t *mask_pattern_;
} *shape_data_;
bool can_expand_outside_parent_; // specially to allow window docking (#987)
cairo_rectangle_int_t *subRect_; // makes sure subwindow remains inside its parent window
static bool in_flush_; // useful for progressive window drawing
Fl_Cursor standard_cursor_; // window's standard custom kind
@ -143,6 +144,7 @@ public:
static bool new_popup; // to support tall menu buttons
bool process_menu_or_tooltip(struct wld_window *);
static Fl_Window *previous_floatingtitle; // to support floating menuwindow w/ title
void allow_expand_outside_parent() FL_OVERRIDE { can_expand_outside_parent_ = true; }
};

View File

@ -70,6 +70,7 @@ Fl_Wayland_Window_Driver::Fl_Wayland_Window_Driver(Fl_Window *win) : Fl_Window_D
gl_start_support_ = NULL;
subRect_ = NULL;
is_popup_window_ = false;
can_expand_outside_parent_ = false;
}
@ -1889,7 +1890,7 @@ static bool crect_equal(cairo_rectangle_int_t *to, cairo_rectangle_int_t *with)
void Fl_Wayland_Window_Driver::checkSubwindowFrame() {
if (!pWindow->parent()) return;
if (!pWindow->parent() || can_expand_outside_parent_) return;
// make sure this subwindow doesn't leak out of its parent window
Fl_Window *from = pWindow, *parent;
cairo_rectangle_int_t full = {0, 0, pWindow->w(), pWindow->h()}; // full subwindow area