From: Michael D. Lowis Date: Thu, 17 Jan 2019 15:22:45 +0000 (-0500) Subject: updated registrar raise and focus the window with _NET_ACTIVE_WINDOW message X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=1776a9a706d67a425fc25b9aa963504d04524035;p=projs%2Ftide.git updated registrar raise and focus the window with _NET_ACTIVE_WINDOW message --- diff --git a/TODO.md b/TODO.md index 5e3ea2c..1588a2e 100644 --- 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 diff --git a/src/lib/view.c b/src/lib/view.c index 7eb3edc..8166921 100644 --- a/src/lib/view.c +++ b/src/lib/view.c @@ -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) { diff --git a/src/registrar.c b/src/registrar.c index 49e8a72..28bf4b3 100644 --- a/src/registrar.c +++ b/src/registrar.c @@ -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;