Wayland: one more fix yet for interactive move of subwindow inside parent

This commit is contained in:
ManoloFLTK 2024-09-09 10:27:04 +02:00
parent 2a87244ae3
commit d70c79b8bc

View File

@ -1788,7 +1788,6 @@ static void surface_frame_done(void *data, struct wl_callback *cb, uint32_t time
xid_rect->win->redraw(); xid_rect->win->redraw();
} else { } else {
xid_rect->win->Fl_Widget::resize(xid_rect->X, xid_rect->Y, xid_rect->W, xid_rect->H); xid_rect->win->Fl_Widget::resize(xid_rect->X, xid_rect->Y, xid_rect->W, xid_rect->H);
wl_surface_commit(xid_rect->xid->wl_surface);
} }
delete xid_rect; delete xid_rect;
} }
@ -1887,8 +1886,7 @@ void Fl_Wayland_Window_Driver::resize(int X, int Y, int W, int H) {
xdg_surface_set_window_geometry(fl_win->xdg_surface, 0, 0, W, H); xdg_surface_set_window_geometry(fl_win->xdg_surface, 0, 0, W, H);
//printf("xdg_surface_set_window_geometry: %dx%d\n",W, H); //printf("xdg_surface_set_window_geometry: %dx%d\n",W, H);
} }
} else { } else if (!in_handle_configure && xdg_toplevel()) {
if (!in_handle_configure && xdg_toplevel()) {
// Wayland doesn't seem to provide a reliable way for the app to set the // Wayland doesn't seem to provide a reliable way for the app to set the
// window position on screen. This is functional when the move is mouse-driven. // window position on screen. This is functional when the move is mouse-driven.
Fl_Wayland_Screen_Driver *scr_driver = (Fl_Wayland_Screen_Driver*)Fl::screen_driver(); Fl_Wayland_Screen_Driver *scr_driver = (Fl_Wayland_Screen_Driver*)Fl::screen_driver();
@ -1897,9 +1895,6 @@ void Fl_Wayland_Window_Driver::resize(int X, int Y, int W, int H) {
Fl::pushed(NULL); Fl::pushed(NULL);
Fl::e_state = 0; Fl::e_state = 0;
} }
} else if (fl_win->kind == SUBWINDOW && fl_win->subsurface) {
wl_subsurface_set_position(fl_win->subsurface, X * f, Y * f);
}
} }
} }
@ -1920,12 +1915,9 @@ void Fl_Wayland_Window_Driver::resize(int X, int Y, int W, int H) {
wl_callback_add_listener(parent_xid->frame_cb, &surface_frame_listener, xid_rect); wl_callback_add_listener(parent_xid->frame_cb, &surface_frame_listener, xid_rect);
xid_rect->X = X; xid_rect->Y = Y; xid_rect->W = W; xid_rect->H = H; xid_rect->X = X; xid_rect->Y = Y; xid_rect->W = W; xid_rect->H = H;
xid_rect->need_resize = is_a_resize; xid_rect->need_resize = is_a_resize;
wl_subsurface_set_position(fl_win->subsurface, X * f, Y * f);
wl_surface_commit(parent_xid->wl_surface); wl_surface_commit(parent_xid->wl_surface);
} else if (xid_rect) { } else if (!xid_rect) {
// update the active frame callback with new X,Y,W,H values
xid_rect->X = X; xid_rect->Y = Y; xid_rect->W = W; xid_rect->H = H;
xid_rect->need_resize |= is_a_resize;
} else {
wl_surface_commit(parent_xid->wl_surface); wl_surface_commit(parent_xid->wl_surface);
} }
} }