From: Michael D. Lowis Date: Mon, 13 May 2019 00:20:13 +0000 (-0400) Subject: fixed cursor and selection handling X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=91c8349abe3447543259282c1b0dec403649a04f;p=projs%2Ftide.git fixed cursor and selection handling --- diff --git a/inc/x11.h b/inc/x11.h index 77dce10..3814460 100644 --- a/inc/x11.h +++ b/inc/x11.h @@ -130,6 +130,7 @@ extern struct XConf X; int x11_init(XConf* x); void x11_error_clear(void); XErrorEvent* x11_error_get(void); +void x11_resize(XConf* x, XEvent* e); void x11_mkwin(XConf* x, int width, int height, int evmask); void x11_mkdialog(XConf* x, int width, int height, int evmask); diff --git a/src/lib/view.c b/src/lib/view.c index 40d2865..a77f5e5 100644 --- a/src/lib/view.c +++ b/src/lib/view.c @@ -22,7 +22,7 @@ static void move_selection(View* view, bool extsel, int move, movefn_t bything) if (bything == buf_byline) buf_setcol(BUF); if (!extsel) - buf_selclr(BUF, RIGHT); + buf_selclr(BUF, (move < 0 ? LEFT : RIGHT)); /* only update column if not moving vertically */ if (bything != buf_byline) buf_getcol(BUF); diff --git a/src/lib/x11_gc.c b/src/lib/x11_gc.c index 90e5610..bf2fc12 100644 --- a/src/lib/x11_gc.c +++ b/src/lib/x11_gc.c @@ -6,7 +6,7 @@ static void xfocus(XConf* x, XEvent* e) { (e->type == FocusIn ? XSetICFocus : XUnsetICFocus)(x->xic); } -static void xresize(XConf* x, XEvent* e) { +void x11_resize(XConf* x, XEvent* e) { if (e->xconfigure.width != x->width || e->xconfigure.height != x->height) { x->width = e->xconfigure.width; x->height = e->xconfigure.height; @@ -30,7 +30,7 @@ void x11_init_gc(XConf* x) { x->gc = XCreateGC(x->display, x->self, GCGraphicsExposures, &gcv); x->eventfns[FocusIn] = xfocus; x->eventfns[FocusOut] = xfocus; - x->eventfns[ConfigureNotify] = xresize; + x->eventfns[ConfigureNotify] = x11_resize; } void x11_centerwin(XConf* x) { @@ -69,7 +69,7 @@ void x11_show(XConf* x) { XNextEvent(x->display, &ev); if (XFilterEvent(&ev, None)) continue; - xresize(x, &ev); + x11_resize(x, &ev); } while (ev.type != MapNotify); XWarpPointer(x->display, None, x->self, 0, 0, x->width, x->height, x->width/2, x->height/2); } diff --git a/src/tframe.c b/src/tframe.c index 65e9e3c..3490bd9 100644 --- a/src/tframe.c +++ b/src/tframe.c @@ -76,11 +76,8 @@ static void xdestroy(XConf* x, XEvent* e) { static void xconfigure(XConf* x, XEvent* e) { if (e->xconfigure.window != x->self) return; + x11_resize(x, e); if (e->xconfigure.width != x->width || e->xconfigure.height != x->height) { - x->width = e->xconfigure.width; - x->height = e->xconfigure.height; - x->pixmap = XCreatePixmap(x->display, x->self, x->width, x->height, x->depth); - x->xft = XftDrawCreate(x->display, x->pixmap, x->visual, x->colormap); retile = 1; } }