From 3728abd1fc325bccf02499e3e363791d6f986ebc Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sun, 15 Apr 2018 10:32:30 +0200 Subject: handle_x11_event: Remove return value This function always returns "false", so its return type can simply be changed to void. Signed-off-by: Uli Schlachter --- backend/x11/backend.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'backend') diff --git a/backend/x11/backend.c b/backend/x11/backend.c index 02f5ef6f..64c6973b 100644 --- a/backend/x11/backend.c +++ b/backend/x11/backend.c @@ -65,10 +65,10 @@ void x11_output_layout_get_box(struct wlr_x11_backend *backend, box->height = max_y - min_y; } -static bool handle_x11_event(struct wlr_x11_backend *x11, +static void handle_x11_event(struct wlr_x11_backend *x11, xcb_generic_event_t *event) { if (x11_handle_input_event(x11, event)) { - return false; + return; } switch (event->response_type & XCB_EVENT_RESPONSE_TYPE_MASK) { @@ -103,8 +103,6 @@ static bool handle_x11_event(struct wlr_x11_backend *x11, break; } } - - return false; } static int x11_event(int fd, uint32_t mask, void *data) { @@ -117,11 +115,8 @@ static int x11_event(int fd, uint32_t mask, void *data) { xcb_generic_event_t *e; while ((e = xcb_poll_for_event(x11->xcb_conn))) { - bool quit = handle_x11_event(x11, e); + handle_x11_event(x11, e); free(e); - if (quit) { - break; - } } return 0; -- cgit v1.2.3 From 98f8ec6a081b215f901a47226c39797260a7d1e1 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sun, 15 Apr 2018 10:33:53 +0200 Subject: x11_handle_input_event: Remove return value handle_x11_event() and x11_handle_input_event() react to different kinds of events, so it does not make much of a difference if x11_handle_input_event() signals if it handled an event or not. Signed-off-by: Uli Schlachter --- backend/x11/backend.c | 4 +--- backend/x11/input_device.c | 18 +++++++----------- include/backend/x11.h | 2 +- 3 files changed, 9 insertions(+), 15 deletions(-) (limited to 'backend') diff --git a/backend/x11/backend.c b/backend/x11/backend.c index 64c6973b..768d00f7 100644 --- a/backend/x11/backend.c +++ b/backend/x11/backend.c @@ -67,9 +67,7 @@ void x11_output_layout_get_box(struct wlr_x11_backend *backend, static void handle_x11_event(struct wlr_x11_backend *x11, xcb_generic_event_t *event) { - if (x11_handle_input_event(x11, event)) { - return; - } + x11_handle_input_event(x11, event); switch (event->response_type & XCB_EVENT_RESPONSE_TYPE_MASK) { case XCB_EXPOSE: { diff --git a/backend/x11/input_device.c b/backend/x11/input_device.c index 55e543e6..4433568d 100644 --- a/backend/x11/input_device.c +++ b/backend/x11/input_device.c @@ -56,7 +56,7 @@ static void x11_handle_pointer_position(struct wlr_x11_output *output, x11->time = time; } -bool x11_handle_input_event(struct wlr_x11_backend *x11, +void x11_handle_input_event(struct wlr_x11_backend *x11, xcb_generic_event_t *event) { switch (event->response_type & XCB_EVENT_RESPONSE_TYPE_MASK) { case XCB_KEY_PRESS: @@ -73,7 +73,7 @@ bool x11_handle_input_event(struct wlr_x11_backend *x11, // TODO use xcb-xkb for more precise modifiers state? wlr_keyboard_notify_key(&x11->keyboard, &key); x11->time = ev->time; - return true; + return; } case XCB_BUTTON_PRESS: { xcb_button_press_event_t *ev = (xcb_button_press_event_t *)event; @@ -110,19 +110,17 @@ bool x11_handle_input_event(struct wlr_x11_backend *x11, wlr_signal_emit_safe(&x11->pointer.events.button, &button); } x11->time = ev->time; - return true; + return; } case XCB_MOTION_NOTIFY: { xcb_motion_notify_event_t *ev = (xcb_motion_notify_event_t *)event; struct wlr_x11_output *output = x11_output_from_window_id(x11, ev->event); - if (output == NULL) { - return false; + if (output != NULL) { + x11_handle_pointer_position(output, ev->event_x, ev->event_y, ev->time); } - - x11_handle_pointer_position(output, ev->event_x, ev->event_y, ev->time); - return true; + return; } default: #ifdef WLR_HAS_XCB_XKB @@ -131,13 +129,11 @@ bool x11_handle_input_event(struct wlr_x11_backend *x11, (xcb_xkb_state_notify_event_t *)event; wlr_keyboard_notify_modifiers(&x11->keyboard, ev->baseMods, ev->latchedMods, ev->lockedMods, ev->lockedGroup); - return true; + return; } #endif break; } - - return false; } const struct wlr_input_device_impl input_device_impl = { 0 }; diff --git a/include/backend/x11.h b/include/backend/x11.h index 1c88cefc..aa946912 100644 --- a/include/backend/x11.h +++ b/include/backend/x11.h @@ -79,7 +79,7 @@ void x11_output_layout_get_box(struct wlr_x11_backend *backend, const struct wlr_input_device_impl input_device_impl; -bool x11_handle_input_event(struct wlr_x11_backend *x11, +void x11_handle_input_event(struct wlr_x11_backend *x11, xcb_generic_event_t *event); void x11_update_pointer_position(struct wlr_x11_output *output, xcb_timestamp_t time); -- cgit v1.2.3 From 52b058c2a31fbcd3014c63506eaa8aff25606bed Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sun, 15 Apr 2018 10:39:32 +0200 Subject: x11 backend: Do not set a back pixel on windows Before this commit, the x11 server would fill any exposed area with white before the wlroots x11 backend got a chance to do anything. This was e.g. visible when running rootston and resizing the window: When the window becomes larger, the new area is filled with black. By just not setting a back pixel value, this commit gets rid of this behaviour. Signed-off-by: Uli Schlachter --- backend/x11/output.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'backend') diff --git a/backend/x11/output.c b/backend/x11/output.c index ff625fbe..df4ff043 100644 --- a/backend/x11/output.c +++ b/backend/x11/output.c @@ -114,9 +114,8 @@ struct wlr_output *wlr_x11_output_create(struct wlr_backend *backend) { wl_list_length(&x11->outputs) + 1); parse_xcb_setup(wlr_output, x11->xcb_conn); - uint32_t mask = XCB_CW_BACK_PIXEL | XCB_CW_EVENT_MASK; - uint32_t values[2] = { - x11->screen->white_pixel, + uint32_t mask = XCB_CW_EVENT_MASK; + uint32_t values[] = { XCB_EVENT_MASK_EXPOSURE | XCB_EVENT_MASK_KEY_PRESS | XCB_EVENT_MASK_KEY_RELEASE | XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE | -- cgit v1.2.3 From e79d924588523732d13b582a46962246c8a9670d Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sun, 15 Apr 2018 10:43:25 +0200 Subject: x11 backend: Ignore expose if frame is pending When resizing rootston with the mouse, the result is really slow. One can see that rootston needs quite a while for drawing the newly visible area. This is because every single expose event is handled on its own and causes (apparently) a full repaint or at least a swap. This commit improves things by only causing a new frame if none is pending already. With this change, there is almost no delay in rootston drawing the newly visible area. Signed-off-by: Uli Schlachter --- backend/x11/backend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'backend') diff --git a/backend/x11/backend.c b/backend/x11/backend.c index 768d00f7..089b3822 100644 --- a/backend/x11/backend.c +++ b/backend/x11/backend.c @@ -74,7 +74,7 @@ static void handle_x11_event(struct wlr_x11_backend *x11, xcb_expose_event_t *ev = (xcb_expose_event_t *)event; struct wlr_x11_output *output = x11_output_from_window_id(x11, ev->window); - if (output != NULL) { + if (output != NULL && !output->wlr_output.frame_pending) { wlr_output_send_frame(&output->wlr_output); } break; -- cgit v1.2.3