Wayland: fix interactive moving and resizing of a subwindow - cont'd (#1003)
This commit is contained in:
parent
944ae5b040
commit
fc910ae892
@ -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);
|
||||
|
@ -1792,22 +1792,17 @@ 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;
|
||||
if (H < 1) H = 1;
|
||||
}
|
||||
pWindow->Fl_Group::resize(X,Y,W,H);
|
||||
//fprintf(stderr, "resize: win=%p to %dx%d\n", pWindow, W, H);
|
||||
if (shown()) {pWindow->redraw();}
|
||||
} else {
|
||||
x(X); y(Y);
|
||||
//fprintf(stderr, "move win=%p to %dx%d\n", pWindow, X, Y);
|
||||
if (is_a_resize) {
|
||||
if (pWindow->parent()) {
|
||||
if (W < 1) W = 1;
|
||||
if (H < 1) H = 1;
|
||||
}
|
||||
pWindow->Fl_Group::resize(X,Y,W,H);
|
||||
//fprintf(stderr, "resize: win=%p to %dx%d\n", pWindow, W, H);
|
||||
if (shown()) {pWindow->redraw();}
|
||||
} else {
|
||||
x(X); y(Y);
|
||||
//fprintf(stderr, "move win=%p to %dx%d\n", pWindow, X, Y);
|
||||
}
|
||||
|
||||
if (shown()) {
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user