From 58d383b1a07a083911343201cb7f9f38a61355a0 Mon Sep 17 00:00:00 2001 From: Orestis Floros Date: Fri, 10 Apr 2020 12:24:18 +0200 Subject: [PATCH] route_click: Remove condition that is always true For reference: typedef enum { CLICK_BORDER = 0, CLICK_DECORATION = 1, CLICK_INSIDE = 2 } click_destination_t; --- src/click.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/click.c b/src/click.c index ee23c9d5..12e391b5 100644 --- a/src/click.c +++ b/src/click.c @@ -162,21 +162,18 @@ static void route_click(Con *con, xcb_button_press_event_t *event, const bool mo /* if the user has bound an action to this click, it should override the * default behavior. */ - if (dest == CLICK_DECORATION || dest == CLICK_INSIDE || dest == CLICK_BORDER) { - Binding *bind = get_binding_from_xcb_event((xcb_generic_event_t *)event); + Binding *bind = get_binding_from_xcb_event((xcb_generic_event_t *)event); + if (bind && ((dest == CLICK_DECORATION && !bind->exclude_titlebar) || + (dest == CLICK_INSIDE && bind->whole_window) || + (dest == CLICK_BORDER && bind->border))) { + CommandResult *result = run_binding(bind, con); - if (bind != NULL && ((dest == CLICK_DECORATION && !bind->exclude_titlebar) || - (dest == CLICK_INSIDE && bind->whole_window) || - (dest == CLICK_BORDER && bind->border))) { - CommandResult *result = run_binding(bind, con); + /* ASYNC_POINTER eats the event */ + xcb_allow_events(conn, XCB_ALLOW_ASYNC_POINTER, event->time); + xcb_flush(conn); - /* ASYNC_POINTER eats the event */ - xcb_allow_events(conn, XCB_ALLOW_ASYNC_POINTER, event->time); - xcb_flush(conn); - - command_result_free(result); - return; - } + command_result_free(result); + return; } /* There is no default behavior for button release events so we are done. */