File tree Expand file tree Collapse file tree 1 file changed +18
-8
lines changed Expand file tree Collapse file tree 1 file changed +18
-8
lines changed Original file line number Diff line number Diff line change @@ -1163,23 +1163,33 @@ void flush_wayland_fd(void *data)
11631163 struct pollfd fd = {0 };
11641164 input_ctx_wayland_data_t * wl = (input_ctx_wayland_data_t * )data ;
11651165
1166- wl_display_dispatch_pending (wl -> dpy );
1167- wl_display_flush (wl -> dpy );
1168-
11691166 fd .fd = wl -> fd ;
11701167 fd .events = POLLIN | POLLOUT | POLLERR | POLLHUP ;
11711168
1169+ while (wl_display_prepare_read (wl -> dpy ))
1170+ wl_display_dispatch_pending (wl -> dpy );
1171+
1172+ wl_display_flush (wl -> dpy );
1173+
11721174 if (poll (& fd , 1 , 0 ) > 0 )
11731175 {
1174- if (fd .revents & ( POLLERR | POLLHUP ) )
1176+ if (fd .revents & POLLIN )
11751177 {
1176- close (wl -> fd );
1177- frontend_driver_set_signal_handler_state ( 1 );
1178+ wl_display_read_events (wl -> dpy );
1179+ wl_display_dispatch_pending ( wl -> dpy );
11781180 }
1181+ else
1182+ wl_display_cancel_read (wl -> dpy );
11791183
1180- if (fd .revents & POLLIN )
1181- wl_display_dispatch (wl -> dpy );
11821184 if (fd .revents & POLLOUT )
11831185 wl_display_flush (wl -> dpy );
1186+
1187+ if (fd .revents & (POLLERR | POLLHUP ))
1188+ {
1189+ close (wl -> fd );
1190+ frontend_driver_set_signal_handler_state (1 );
1191+ }
11841192 }
1193+ else
1194+ wl_display_cancel_read (wl -> dpy );
11851195}
You can’t perform that action at this time.
0 commit comments