]> git.mdlowis.com Git - projs/tide.git/commitdiff
Fixed an issue where dragging with the left button would change the selection in...
authorMichael D. Lowis <mike.lowis@gentex.com>
Fri, 3 Feb 2017 14:13:34 +0000 (09:13 -0500)
committerMichael D. Lowis <mike.lowis@gentex.com>
Fri, 3 Feb 2017 14:13:34 +0000 (09:13 -0500)
xedit.c

diff --git a/xedit.c b/xedit.c
index 1d2b0a0e115760651884064c0353f8351e740e62..8295daea8e9ac8437d2601adbc8b7773832939bf 100644 (file)
--- 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);