]> git.mdlowis.com Git - projs/tide.git/commitdiff
implemented focus toggle shortcut
authorMichael D. Lowis <mike@mdlowis.com>
Fri, 12 Oct 2018 00:57:50 +0000 (20:57 -0400)
committerMichael D. Lowis <mike@mdlowis.com>
Fri, 12 Oct 2018 00:57:50 +0000 (20:57 -0400)
TODO.md
inc/win.h
src/lib/x11.c
src/tide.c

diff --git a/TODO.md b/TODO.md
index 9347ba51a917d9519eedf9a3f40646055c8e0fc5..42567fd25bd98b5b355df25128ecd7e06971d4fc 100644 (file)
--- a/TODO.md
+++ b/TODO.md
@@ -2,15 +2,15 @@
 
 ## STAGING
 
-* centering logic in view.c seems broken
+* implement mouse warping on search, jump to line, and focus change
 * implement new version of tfetch (plumb)
 * implement tide registrar
 * implement tctl command
-* implement mouse warping on search, jump to line, and focus change
 * gap buffer does not handle UTF-8 currently
 * Line - Get the current line number(s) containing the selection
 * refactor selection handling to avoid swapping manually (use buf_selbeg and buf_selend)
 * encode EOL setting in log entries?
+* centering logic in view.c seems slightly broken
 
 ## BACKLOG
 
index 9610219be46b0dea433e900812d73e2df6ce29b1..342e31ac6206b2eb898ff84150e3c49c0dc14cc3 100644 (file)
--- a/inc/win.h
+++ b/inc/win.h
@@ -138,6 +138,8 @@ void win_prop_set(char* xname, char* ename, char* value);
 void win_update(int ms);
 void win_loop(void);
 void win_quit(void);
+void win_togglefocus(void);
+
 View* win_view(WinRegion id);
 Buf* win_buf(WinRegion id);
 bool win_keymodsset(int mask);
index 0d32430a76f34bf1d5124c9d90288dbb037c3e8a..722629b2978ddff74a14343a96874ec4a747bd92 100644 (file)
@@ -639,6 +639,11 @@ void win_quit(void) {
     before = X.now;
 }
 
+void win_togglefocus(void) {
+    int ypos = (Focused == EDIT ? Divider/2 : (X.height - ((X.height-Divider) / 2)));
+    XWarpPointer(X.display, X.self, X.self, 0, 0, X.width, X.height, X.width/2, ypos);
+}
+
 View* win_view(WinRegion id) {
     return &(Regions[id == FOCUSED ? Focused : id]);
 }
index 4233ddb418ae7d09443e3c236a06df5dec50875c..d71d92bc5bc9545ec666d8c050fc07319b4a2bfe 100644 (file)
@@ -238,7 +238,7 @@ static void select_prev(char* arg) {
 }
 
 static void change_focus(char* arg) {
-    /* move the mouse to the region */
+    win_togglefocus();
 }
 
 static void undo(char* arg) {