]> git.mdlowis.com Git - projs/tide.git/commitdiff
updated registrar raise and focus the window with _NET_ACTIVE_WINDOW message
authorMichael D. Lowis <mike.lowis@gentex.com>
Thu, 17 Jan 2019 15:22:45 +0000 (10:22 -0500)
committerMichael D. Lowis <mike.lowis@gentex.com>
Thu, 17 Jan 2019 15:22:45 +0000 (10:22 -0500)
TODO.md
src/lib/view.c
src/registrar.c

diff --git a/TODO.md b/TODO.md
index 5e3ea2c7c978fc81229193a89e0747c64299f050..1588a2e84dcc0cd8b7d083a346f991c413595a6a 100644 (file)
--- a/TODO.md
+++ b/TODO.md
@@ -7,8 +7,7 @@
 * registrar: doesnt match open windows when new file created and is then opened for edit or line number
 * registrar: group by hostname or group env var in registrar
 * tide: gap buffer does not handle UTF-8 currently
-* tide: highlight current line if jumped to line is 0
-* tide: jumping to line should call XMapRaised
+* registrar: should cleanup invalid windows
 
 ## BACKLOG
 
index 7eb3edcbd77b1d77bf89ce897257262e95abb736..8166921db222ea4a951b0290cd4a5c9c81c3fbab 100644 (file)
@@ -315,10 +315,11 @@ void view_eof(View* view, bool extsel) {
 }
 
 void view_setln(View* view, size_t line) {
-    if (!line) return;
-    buf_setln(BUF, line);
     view->sync_flags |= CENTER;
-    buf_selln(BUF);
+    if (line) {
+        buf_setln(BUF, line);
+        buf_selln(BUF);
+    }
 }
 
 void view_undo(View* view) {
index 49e8a72dfea369601e68937a6358d7620b04cc00..28bf4b323aa2193749a0a213463149cad68c314e 100644 (file)
@@ -103,16 +103,16 @@ void win_open(XConf* x, Window winid, char* path, char* addr) {
                 break;
             } else {
                 puts("window still valid, raising");
+                XEvent ev = {0};
+                ev.xclient.type = ClientMessage;
+                ev.xclient.send_event = True;
+                ev.xclient.message_type = XInternAtom(x->display, "_NET_ACTIVE_WINDOW", False);
+                ev.xclient.window = win->win;
+                ev.xclient.format = 32;
+                XSendEvent(x->display, x->root, False, SubstructureRedirectMask|SubstructureNotifyMask, &ev);
+                XMapRaised(x->display, win->win);
                 win_send(x, x->self, win->win, 0,  "GOTO", strtoul(addr, NULL, 0));
                 win_send(x, x->self, winid, 0,  "DONE", 0);
-                XMapRaised(x->display, win->win);
-                XSetInputFocus(x->display, win->win, RevertToNone, CurrentTime);
-                XWMHints *hints = XGetWMHints(x->display, win->win);
-                if (hints) {
-                    hints->flags |= XUrgencyHint;
-                    XSetWMHints(x->display, win->win, hints);
-                    XFree(hints);
-                }
                 XSync(x->display, False);
                 free(type);
                 return;