]> git.mdlowis.com Git - projs/tide.git/commitdiff
rework event processing loop to hopefully fix annoying laggy paste bug
authorMichael D. Lowis <mike@mdlowis.com>
Sun, 30 Dec 2018 03:28:18 +0000 (22:28 -0500)
committerMichael D. Lowis <mike@mdlowis.com>
Sun, 30 Dec 2018 03:28:18 +0000 (22:28 -0500)
TODO.md
src/lib/x11.c

diff --git a/TODO.md b/TODO.md
index 54be6d1e26ba6e4c490e8e51dcc9f7de63a884aa..6360bb94b0c8724a89c4b1f811a1fbd468af6acd 100644 (file)
--- a/TODO.md
+++ b/TODO.md
@@ -1,8 +1,15 @@
 # Issue List
 
+## VERIFYING
+
+* paste of selection doesnt occur till next event
+
 ## STAGING
 
-* selecting last insert no longer handles intermediate edits (copy+paste)
+* group by hostname or group env var in registrar
+* add debug Trace to fetch command
+* daemonize registrar and tide executables
+* simultaneously write and read in tide sub commands
 * Ctrl+D should not pass tag name as arg when executing tag commands
 * 'Get' tag with argument currently segfaults
 * registrar doesnt match open windows when new file created and is then opened for edit or line number
@@ -23,8 +30,6 @@
 * move mouse handlers back into tide.c
 * Add matching logic for "", '', ``, and <>
 * B2+B1 click executes command with selection as argument
-* implement term program
-* implement pick command
 * implement script for toggling between header and source file
 
 Tags:
index 4e58603626924f77150479e0dd754fdbc8cb2d6d..956f70eb7c72715dd01e03bcae7cb15e986a1e31 100644 (file)
@@ -420,36 +420,35 @@ static void xresize(XConf* x, XEvent* e) {
 }
 
 static void xupdate(Job* job) {
-    (void)job;
     int nevents, nqueued;
-    /* process events from the queue */
-    nqueued = XEventsQueued(X.display, QueuedAfterFlush);
-    XGetMotionEvents(X.display, X.self, CurrentTime, CurrentTime, &nevents);
-    for (XEvent e; XPending(X.display);) {
-        XNextEvent(X.display, &e);
-        if (!XFilterEvent(&e, None) && X.eventfns[e.type])
-            (X.eventfns[e.type])(&X, &e);
-        for (int status; waitpid(-1, &status, WNOHANG) > 0;);
-    }
-    if (nqueued || !job) {
-        /* force update the title */
-        win_title(NULL);
-        /* determine the size of the regions */
-        size_t maxtagrows = ((X.height/4) / X.tagfont->height);
-        size_t tagrows = view_limitrows(win_view(TAGS), maxtagrows);
-        size_t tagregsz = (tagrows * X.tagfont->height) + 7;
-        size_t editrows = (X.height - tagregsz) / X.font->height ;
-        /* draw the regions to the window */
-        drawcsr csr = { .w = X.width, .h = X.height };
-        csr.x += ScrollWidth + 1;
-        draw_statbox();
-        draw_view(&Regions[TAGS], X.tagfont, tagrows, &csr, TagsBg, TagsFg, TagsSel);
-        draw_hrule(&csr);
-        draw_view(&Regions[EDIT], X.font, editrows, &csr, EditBg, EditFg, EditSel);
-        draw_scroll(&csr);
-        XCopyArea(X.display, X.pixmap, X.self, X.gc, 0, 0, X.width, X.height, 0, 0);
-    }
-    XFlush(X.display);
+    do {
+        nqueued = XEventsQueued(X.display, QueuedAfterFlush);
+        XGetMotionEvents(X.display, X.self, CurrentTime, CurrentTime, &nevents);
+        for (XEvent e; XPending(X.display);) {
+            XNextEvent(X.display, &e);
+            if (!XFilterEvent(&e, None) && X.eventfns[e.type])
+                (X.eventfns[e.type])(&X, &e);
+            for (int status; waitpid(-1, &status, WNOHANG) > 0;);
+        }
+        if (nqueued || !job) {
+            /* force update the title */
+            win_title(NULL);
+            /* determine the size of the regions */
+            size_t maxtagrows = ((X.height/4) / X.tagfont->height);
+            size_t tagrows = view_limitrows(win_view(TAGS), maxtagrows);
+            size_t tagregsz = (tagrows * X.tagfont->height) + 7;
+            size_t editrows = (X.height - tagregsz) / X.font->height ;
+            /* draw the regions to the window */
+            drawcsr csr = { .w = X.width, .h = X.height };
+            csr.x += ScrollWidth + 1;
+            draw_statbox();
+            draw_view(&Regions[TAGS], X.tagfont, tagrows, &csr, TagsBg, TagsFg, TagsSel);
+            draw_hrule(&csr);
+            draw_view(&Regions[EDIT], X.font, editrows, &csr, EditBg, EditFg, EditSel);
+            draw_scroll(&csr);
+            XCopyArea(X.display, X.pixmap, X.self, X.gc, 0, 0, X.width, X.height, 0, 0);
+        }
+    } while ((nqueued = XEventsQueued(X.display, QueuedAfterFlush)) > 0);
 }
 
 /******************************************************************************/