Merge pull request #2 from droyo/wl-ack-configure
Fix race condition on attach and mouse tracking after warp
This commit is contained in:
commit
5636471dff
1 changed files with 24 additions and 9 deletions
|
|
@ -65,6 +65,9 @@ struct WaylandClient {
|
||||||
struct xdg_surface *xdg_surface;
|
struct xdg_surface *xdg_surface;
|
||||||
struct xdg_toplevel *xdg_toplevel;
|
struct xdg_toplevel *xdg_toplevel;
|
||||||
|
|
||||||
|
// Initial configure call is complete
|
||||||
|
int configured;
|
||||||
|
|
||||||
// A callback when wl_surface is ready for the next frame.
|
// A callback when wl_surface is ready for the next frame.
|
||||||
// Currently this is not used for drawing,
|
// Currently this is not used for drawing,
|
||||||
// but as a hack for implementing key repeat
|
// but as a hack for implementing key repeat
|
||||||
|
|
@ -368,10 +371,11 @@ static const struct wl_buffer_listener wl_buffer_listener = {
|
||||||
static void xdg_surface_configure(void *data, struct xdg_surface *xdg_surface, uint32_t serial) {
|
static void xdg_surface_configure(void *data, struct xdg_surface *xdg_surface, uint32_t serial) {
|
||||||
DEBUG("xdg_surface_configure\n");
|
DEBUG("xdg_surface_configure\n");
|
||||||
const Client* c = data;
|
const Client* c = data;
|
||||||
const WaylandClient *wl = c->view;
|
WaylandClient *wl = (WaylandClient*) c->view;
|
||||||
qlock(&wayland_lock);
|
qlock(&wayland_lock);
|
||||||
|
|
||||||
xdg_surface_ack_configure(wl->xdg_surface, serial);
|
xdg_surface_ack_configure(wl->xdg_surface, serial);
|
||||||
|
wl->configured = 1;
|
||||||
|
|
||||||
qunlock(&wayland_lock);
|
qunlock(&wayland_lock);
|
||||||
DEBUG("xdg_surface_configure: returned\n");
|
DEBUG("xdg_surface_configure: returned\n");
|
||||||
|
|
@ -981,7 +985,15 @@ static void rpc_setmouse(Client *c, Point p) {
|
||||||
wl_surface_commit(wl->wl_surface);
|
wl_surface_commit(wl->wl_surface);
|
||||||
zwp_locked_pointer_v1_destroy(lock);
|
zwp_locked_pointer_v1_destroy(lock);
|
||||||
|
|
||||||
|
wl->mouse_x = wl_fixed_to_int(x) * wl_output_scale_factor;
|
||||||
|
wl->mouse_y = wl_fixed_to_int(y) * wl_output_scale_factor;
|
||||||
|
|
||||||
|
int mx = wl->mouse_x;
|
||||||
|
int my = wl->mouse_y;
|
||||||
|
int mb = wl->buttons;
|
||||||
|
|
||||||
qunlock(&wayland_lock);
|
qunlock(&wayland_lock);
|
||||||
|
gfx_mousetrack(c, mx, my, mb, nsec()/1000000);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rpc_topwin(Client*) {
|
static void rpc_topwin(Client*) {
|
||||||
|
|
@ -1017,6 +1029,7 @@ static void rpc_flush(Client *c, Rectangle r) {
|
||||||
WaylandClient *wl = (WaylandClient*) c->view;
|
WaylandClient *wl = (WaylandClient*) c->view;
|
||||||
qlock(&wayland_lock);
|
qlock(&wayland_lock);
|
||||||
|
|
||||||
|
if (wl->configured) {
|
||||||
int w = Dx(wl->memimage->r);
|
int w = Dx(wl->memimage->r);
|
||||||
int h = Dy(wl->memimage->r);
|
int h = Dy(wl->memimage->r);
|
||||||
WaylandBuffer *b = get_xrgb8888_buffer(w, h);
|
WaylandBuffer *b = get_xrgb8888_buffer(w, h);
|
||||||
|
|
@ -1025,6 +1038,7 @@ static void rpc_flush(Client *c, Rectangle r) {
|
||||||
wl_surface_damage_buffer(wl->wl_surface, r.min.x, r.min.y, Dx(r), Dy(r));
|
wl_surface_damage_buffer(wl->wl_surface, r.min.x, r.min.y, Dx(r), Dy(r));
|
||||||
wl_surface_commit(wl->wl_surface);
|
wl_surface_commit(wl->wl_surface);
|
||||||
wl_display_flush(wl_display);
|
wl_display_flush(wl_display);
|
||||||
|
}
|
||||||
|
|
||||||
qunlock(&wayland_lock);
|
qunlock(&wayland_lock);
|
||||||
}
|
}
|
||||||
|
|
@ -1091,6 +1105,7 @@ Memimage *rpc_attach(Client *c, char *label, char *winsize) {
|
||||||
c->displaydpi = 110 * wl_output_scale_factor;
|
c->displaydpi = 110 * wl_output_scale_factor;
|
||||||
wl_surface_set_buffer_scale(wl->wl_surface, wl_output_scale_factor);
|
wl_surface_set_buffer_scale(wl->wl_surface, wl_output_scale_factor);
|
||||||
wl_surface_commit(wl->wl_surface);
|
wl_surface_commit(wl->wl_surface);
|
||||||
|
wl_display_flush(wl_display);
|
||||||
|
|
||||||
qunlock(&wayland_lock);
|
qunlock(&wayland_lock);
|
||||||
return wl->memimage;
|
return wl->memimage;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue