@ -302,7 +302,7 @@ static void xwm_send_wm_message(struct wlr_xwayland_surface *surface,
event_mask ,
event_mask ,
& event ,
& event ,
sizeof ( event ) ) ;
sizeof ( event ) ) ;
x cb_flush( xwm - > xcb_conn ) ;
x wm_schedule_flush( xwm ) ;
}
}
static void xwm_set_net_client_list ( struct wlr_xwm * xwm ) {
static void xwm_set_net_client_list ( struct wlr_xwm * xwm ) {
@ -460,7 +460,7 @@ static void xwm_surface_activate(struct wlr_xwm *xwm,
}
}
xwm_set_focused_window ( xwm , xsurface ) ;
xwm_set_focused_window ( xwm , xsurface ) ;
x cb_flush( xwm - > xcb_conn ) ;
x wm_schedule_flush( xwm ) ;
}
}
static void xsurface_set_net_wm_state ( struct wlr_xwayland_surface * xsurface ) {
static void xsurface_set_net_wm_state ( struct wlr_xwayland_surface * xsurface ) {
@ -1187,7 +1187,7 @@ void wlr_xwayland_surface_restack(struct wlr_xwayland_surface *xsurface,
wl_list_insert ( node , & xsurface - > stack_link ) ;
wl_list_insert ( node , & xsurface - > stack_link ) ;
xwm_set_net_client_list_stacking ( xwm ) ;
xwm_set_net_client_list_stacking ( xwm ) ;
x cb_flush( xwm - > xcb_conn ) ;
x wm_schedule_flush( xwm ) ;
}
}
static void xwm_handle_map_request ( struct wlr_xwm * xwm ,
static void xwm_handle_map_request ( struct wlr_xwm * xwm ,
@ -1809,9 +1809,19 @@ static int x11_event_handler(int fd, uint32_t mask, void *data) {
return 0 ;
return 0 ;
}
}
int count = read_x11_events ( xwm ) ;
int count = 0 ;
if ( mask & WL_EVENT_READABLE ) {
count = read_x11_events ( xwm ) ;
if ( count ) {
if ( count ) {
xwm_schedule_flush ( xwm ) ;
}
}
if ( mask & WL_EVENT_WRITABLE ) {
// xcb_flush() always blocks until it's written all pending requests,
// but it's the only thing we have
xcb_flush ( xwm - > xcb_conn ) ;
xcb_flush ( xwm - > xcb_conn ) ;
wl_event_source_fd_update ( xwm - > event_source , WL_EVENT_READABLE ) ;
}
}
return count ;
return count ;
@ -1835,7 +1845,7 @@ static void handle_compositor_new_surface(struct wl_listener *listener,
wl_list_for_each ( xsurface , & xwm - > unpaired_surfaces , unpaired_link ) {
wl_list_for_each ( xsurface , & xwm - > unpaired_surfaces , unpaired_link ) {
if ( xsurface - > surface_id = = surface_id ) {
if ( xsurface - > surface_id = = surface_id ) {
xwayland_surface_associate ( xwm , xsurface , surface ) ;
xwayland_surface_associate ( xwm , xsurface , surface ) ;
x cb_flush( xwm - > xcb_conn ) ;
x wm_schedule_flush( xwm ) ;
return ;
return ;
}
}
}
}
@ -1924,7 +1934,7 @@ void wlr_xwayland_surface_configure(struct wlr_xwayland_surface *xsurface,
sizeof ( configure_notify ) ) ;
sizeof ( configure_notify ) ) ;
}
}
x cb_flush( xwm - > xcb_conn ) ;
x wm_schedule_flush( xwm ) ;
}
}
void wlr_xwayland_surface_close ( struct wlr_xwayland_surface * xsurface ) {
void wlr_xwayland_surface_close ( struct wlr_xwayland_surface * xsurface ) {
@ -1945,7 +1955,7 @@ void wlr_xwayland_surface_close(struct wlr_xwayland_surface *xsurface) {
xwm_send_wm_message ( xsurface , & message_data , XCB_EVENT_MASK_NO_EVENT ) ;
xwm_send_wm_message ( xsurface , & message_data , XCB_EVENT_MASK_NO_EVENT ) ;
} else {
} else {
xcb_kill_client ( xwm - > xcb_conn , xsurface - > window_id ) ;
xcb_kill_client ( xwm - > xcb_conn , xsurface - > window_id ) ;
x cb_flush( xwm - > xcb_conn ) ;
x wm_schedule_flush( xwm ) ;
}
}
}
}
@ -2238,7 +2248,7 @@ void xwm_set_cursor(struct wlr_xwm *xwm, const uint8_t *pixels, uint32_t stride,
uint32_t values [ ] = { xwm - > cursor } ;
uint32_t values [ ] = { xwm - > cursor } ;
xcb_change_window_attributes ( xwm - > xcb_conn , xwm - > screen - > root ,
xcb_change_window_attributes ( xwm - > xcb_conn , xwm - > screen - > root ,
XCB_CW_CURSOR , values ) ;
XCB_CW_CURSOR , values ) ;
x cb_flush( xwm - > xcb_conn ) ;
x wm_schedule_flush( xwm ) ;
}
}
struct wlr_xwm * xwm_create ( struct wlr_xwayland * xwayland , int wm_fd ) {
struct wlr_xwm * xwm_create ( struct wlr_xwayland * xwayland , int wm_fd ) {
@ -2364,7 +2374,7 @@ void wlr_xwayland_surface_set_withdrawn(struct wlr_xwayland_surface *surface,
surface - > withdrawn = withdrawn ;
surface - > withdrawn = withdrawn ;
xsurface_set_wm_state ( surface ) ;
xsurface_set_wm_state ( surface ) ;
xsurface_set_net_wm_state ( surface ) ;
xsurface_set_net_wm_state ( surface ) ;
x cb _flush( surface - > xwm - > xcb_conn ) ;
x wm_schedule _flush( surface - > xwm ) ;
}
}
void wlr_xwayland_surface_set_minimized ( struct wlr_xwayland_surface * surface ,
void wlr_xwayland_surface_set_minimized ( struct wlr_xwayland_surface * surface ,
@ -2372,7 +2382,7 @@ void wlr_xwayland_surface_set_minimized(struct wlr_xwayland_surface *surface,
surface - > minimized = minimized ;
surface - > minimized = minimized ;
xsurface_set_wm_state ( surface ) ;
xsurface_set_wm_state ( surface ) ;
xsurface_set_net_wm_state ( surface ) ;
xsurface_set_net_wm_state ( surface ) ;
x cb _flush( surface - > xwm - > xcb_conn ) ;
x wm_schedule _flush( surface - > xwm ) ;
}
}
void wlr_xwayland_surface_set_maximized ( struct wlr_xwayland_surface * surface ,
void wlr_xwayland_surface_set_maximized ( struct wlr_xwayland_surface * surface ,
@ -2380,14 +2390,14 @@ void wlr_xwayland_surface_set_maximized(struct wlr_xwayland_surface *surface,
surface - > maximized_horz = maximized_horz ;
surface - > maximized_horz = maximized_horz ;
surface - > maximized_vert = maximized_vert ;
surface - > maximized_vert = maximized_vert ;
xsurface_set_net_wm_state ( surface ) ;
xsurface_set_net_wm_state ( surface ) ;
x cb _flush( surface - > xwm - > xcb_conn ) ;
x wm_schedule _flush( surface - > xwm ) ;
}
}
void wlr_xwayland_surface_set_fullscreen ( struct wlr_xwayland_surface * surface ,
void wlr_xwayland_surface_set_fullscreen ( struct wlr_xwayland_surface * surface ,
bool fullscreen ) {
bool fullscreen ) {
surface - > fullscreen = fullscreen ;
surface - > fullscreen = fullscreen ;
xsurface_set_net_wm_state ( surface ) ;
xsurface_set_net_wm_state ( surface ) ;
x cb _flush( surface - > xwm - > xcb_conn ) ;
x wm_schedule _flush( surface - > xwm ) ;
}
}
bool xwm_atoms_contains ( struct wlr_xwm * xwm , xcb_atom_t * atoms ,
bool xwm_atoms_contains ( struct wlr_xwm * xwm , xcb_atom_t * atoms ,
@ -2513,3 +2523,7 @@ xcb_connection_t *wlr_xwayland_get_xwm_connection(
struct wlr_xwayland * wlr_xwayland ) {
struct wlr_xwayland * wlr_xwayland ) {
return wlr_xwayland - > xwm ? wlr_xwayland - > xwm - > xcb_conn : NULL ;
return wlr_xwayland - > xwm ? wlr_xwayland - > xwm - > xcb_conn : NULL ;
}
}
void xwm_schedule_flush ( struct wlr_xwm * xwm ) {
wl_event_source_fd_update ( xwm - > event_source , WL_EVENT_READABLE | WL_EVENT_WRITABLE ) ;
}