From a6dc7dd2bc60f1cb3b68b96afd05e286fa234417 Mon Sep 17 00:00:00 2001 From: "Michael D. Lowis" Date: Fri, 3 Feb 2017 09:13:34 -0500 Subject: [PATCH] Fixed an issue where dragging with the left button would change the selection in multiple regions --- xedit.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/xedit.c b/xedit.c index 1d2b0a0..8295dae 100644 --- a/xedit.c +++ b/xedit.c @@ -212,18 +212,19 @@ int main(int argc, char** argv) { static void mouse_handler(MouseAct act, MouseBtn btn, int x, int y) { enum RegionId id = getregion(x, y); - if (id != TAGS && id != EDIT) return; - if (Focused != id) Focused = id; size_t row = (y-Regions[id].y) / x11_font_height(Font); size_t col = (x-Regions[id].x) / x11_font_width(Font); if (act == MOUSE_ACT_MOVE) { if (MouseBtns[MOUSE_BTN_LEFT].pressed) { + enum RegionId region = MouseBtns[MOUSE_BTN_LEFT].region; if (MouseBtns[MOUSE_BTN_LEFT].count == 1) { - view_setcursor(getview(id), row, col); + view_setcursor(getview(region), row, col); MouseBtns[MOUSE_BTN_LEFT].count = 0; } else { - view_selext(getview(id), row, col); + view_selext(getview(region), row, col); } + } else if (id == TAGS || id == EDIT) { + Focused = id; } } else { MouseBtns[btn].pressed = (act == MOUSE_ACT_DOWN); -- 2.49.0