]> git.mdlowis.com Git - projs/tide.git/commitdiff
use XEventsQueued to work around an issue where selection requests are sometimes...
authorMichael D. Lowis <mike.lowis@gentex.com>
Thu, 4 May 2017 18:03:35 +0000 (14:03 -0400)
committerMichael D. Lowis <mike.lowis@gentex.com>
Thu, 4 May 2017 18:03:35 +0000 (14:03 -0400)
TODO.sync-conflict-20170503-192815.md [new file with mode: 0644]
inc/edit.h
inc/x11.h
lib/win.c
lib/x11.c

diff --git a/TODO.sync-conflict-20170503-192815.md b/TODO.sync-conflict-20170503-192815.md
new file mode 100644 (file)
index 0000000..b5753e1
--- /dev/null
@@ -0,0 +1,33 @@
+# Issue List
+
+Up Next:
+
+* refactor x11.c and win.c
+* Make Fn keys execute nth command in the tags buffers
+* Run commands in the background and don't block the main thread.
+* check for file changes on save
+* check for file changes when window regains focus
+* 100% coverage with unit and unit-integration tests
+* right click to fetch file or line
+* Status line should omit characters from beginning of path to make file path fit
+
+Straight-up Bugs:
+
+* double free error on picking a tag with nothing in the buffer
+* fix crash on saving read-only file
+* fix crash on save to file that can't be created
+* tab inserts dont coalesce like one would expect
+
+The Future:
+
+* shortcut to repeat previous operation
+* add command line flags to toggle options (Tabs, Indent, etc..)
+* add command env vars to set options (Tabs, Indent, etc..)
+* implement command diffing logic to optimize the undo/redo log
+
+# Auxillary Programs
+
+* Visual diff tool
+* Win-like terminal emulator
+* File browser
+* Acme-like window manager
index fc39bc7042c031fac7cf1eea4aed7d6c86a902f6..29676382ef9917a8d204866a404d3d9a3677e2e7 100644 (file)
@@ -212,6 +212,7 @@ enum {
     ScrollLines   = 4,    /* number of lines to scroll by for mouse wheel scrolling */
     BufSize       = 8192, /* default buffer size */
     FontCacheSize = 16,   /* Maximum number of fonts allowed in the font cache */
+    EventTimeout  = 100,  /* Maximum blocking wait time for events */
 };
 
 /* choose the font to  use for xft */
index 9d04255655233660f6721a975b291ddce6b2b94e..94986809fc7dfcbb211b5c34cbedd910a6e14dcf 100644 (file)
--- a/inc/x11.h
+++ b/inc/x11.h
@@ -139,6 +139,7 @@ void x11_flip(void);
 void x11_flush(void);
 void x11_finish(void);
 
+int x11_events_queued(void);
 bool x11_events_await(unsigned int ms);
 void x11_events_take(void);
 
index d7d4b36dfac9b99b3ba3fa3b9060eb29d13814ae..00ded98a5737b1c5612c1f82b808352e7bf6b513 100644 (file)
--- a/lib/win.c
+++ b/lib/win.c
@@ -77,14 +77,14 @@ void win_loop(void) {
     x11_show();
     x11_flip();
     while (x11_running()) {
-        bool pending = x11_events_await(200 /* ms */);
-        if (update_focus() || pending) {
+        bool pending = x11_events_await(EventTimeout);
+        int nevents  = x11_events_queued();
+        if (update_focus() || pending || nevents) {
             x11_events_take();
             if (x11_running())
                 x11_flip();
-        } else {
-            x11_flush();
         }
+        x11_flush();
     }
     x11_finish();
 }
index d3bc4de3dda3fddaad71705561568b0ba643e2a5..f0d97e15e5ec225c3cb72075ae019893829fc058 100644 (file)
--- a/lib/x11.c
+++ b/lib/x11.c
@@ -331,6 +331,10 @@ void x11_handle_event(XEvent* e) {
     }
 }
 
+int x11_events_queued(void) {
+    return XEventsQueued(X.display, QueuedAfterFlush);
+}
+
 bool x11_events_await(unsigned int ms) {
     fd_set fds;
     int xfd = ConnectionNumber(X.display), redraw = 1;