From 3fda67f5e545739cc86d1c97a5bed5a84a6e3e91 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Fri, 26 Aug 2011 01:19:46 +0200 Subject: [PATCH] i3-config-wizard: handle mouse button clicks on and --- i3-config-wizard/main.c | 27 +++++++++++++++++++++++++++ i3-config-wizard/xcb.c | 3 ++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/i3-config-wizard/main.c b/i3-config-wizard/main.c index d3a26721..2880ed85 100644 --- a/i3-config-wizard/main.c +++ b/i3-config-wizard/main.c @@ -281,6 +281,29 @@ static int handle_key_press(void *ignored, xcb_connection_t *conn, xcb_key_press return 1; } +/* + * Handle button presses to make clicking on "" and "" work + * + */ +static void handle_button_press(xcb_button_press_event_t* event) { + if (current_step != STEP_GENERATE) + return; + + if (event->event_x >= 32 && event->event_x <= 68 && + event->event_y >= 45 && event->event_y <= 54) { + modifier = MOD_SUPER; + handle_expose(); + } + + if (event->event_x >= 32 && event->event_x <= 68 && + event->event_y >= 56 && event->event_y <= 70) { + modifier = MOD_ALT; + handle_expose(); + } + + return; +} + /* * Creates the config file and tells i3 to reload. * @@ -534,6 +557,10 @@ int main(int argc, char *argv[]) { /* TODO: handle mappingnotify */ + case XCB_BUTTON_PRESS: + handle_button_press((xcb_button_press_event_t*)event); + break; + case XCB_EXPOSE: handle_expose(); break; diff --git a/i3-config-wizard/xcb.c b/i3-config-wizard/xcb.c index d1753d18..461dfd52 100644 --- a/i3-config-wizard/xcb.c +++ b/i3-config-wizard/xcb.c @@ -110,7 +110,8 @@ xcb_window_t open_input_window(xcb_connection_t *conn, uint32_t width, uint32_t values[0] = 0; mask |= XCB_CW_EVENT_MASK; - values[1] = XCB_EVENT_MASK_EXPOSURE; + values[1] = XCB_EVENT_MASK_EXPOSURE | + XCB_EVENT_MASK_BUTTON_PRESS; xcb_create_window(conn, XCB_COPY_FROM_PARENT, -- 2.39.5