]> git.mdlowis.com Git - projs/tide.git/commitdiff
fixed cursor and selection handling
authorMichael D. Lowis <mike@mdlowis.com>
Mon, 13 May 2019 00:20:13 +0000 (20:20 -0400)
committerMichael D. Lowis <mike@mdlowis.com>
Mon, 13 May 2019 00:20:13 +0000 (20:20 -0400)
inc/x11.h
src/lib/view.c
src/lib/x11_gc.c
src/tframe.c

index 77dce1017a5af137a7b21dd9e5df26a5d40bdd75..3814460f9c5a285a50adf3124128e0dd13061fac 100644 (file)
--- 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);
index 40d28654432cc222beaf0e802c973443f8cfafaf..a77f5e5711a703d1baf98172c339e100e2b5461d 100644 (file)
@@ -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);
index 90e56102c20452d4cad8fabf4b16233ecc6ed52a..bf2fc12b1ba3970f0e67762940553bed2c0e9630 100644 (file)
@@ -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);
 }
index 65e9e3c020110a1610093f7dbcf562267a76418b..3490bd982f4be4297acc725a1ef4b1e4a990ff3c 100644 (file)
@@ -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;
     }
 }