]> git.mdlowis.com Git - projs/tide.git/commitdiff
tweaked redraw logic to call onupdate before and after layout. This is a stop gap...
authorMichael D. Lowis <mike.lowis@gentex.com>
Mon, 1 May 2017 19:10:27 +0000 (15:10 -0400)
committerMichael D. Lowis <mike.lowis@gentex.com>
Mon, 1 May 2017 19:10:27 +0000 (15:10 -0400)
lib/win.c
lib/x11.c
xedit.c

index 69aa0c2c913845b5d83fc0245c8a32bc7ed79455..db1d76b503dc03bb2ebe3777f43fa681ba7c0570 100644 (file)
--- a/lib/win.c
+++ b/lib/win.c
@@ -170,9 +170,12 @@ static void layout(int width, int height) {
 static void onredraw(int width, int height) {
     size_t fheight = x11_font_height(Font);
     size_t fwidth  = x11_font_width(Font);
-    onupdate(); // Let the user program update the status and such
+    
     /* layout and draw the three text regions */
+    onupdate(); // Let the user program update the status and such
     layout(width, height);
+    onupdate(); // Let the user program update the status and such
+    
     for (int i = 0; i < SCROLL; i++) {
         View* view = win_view(i);
         x11_draw_rect((i == TAGS ? CLR_BASE02 : CLR_BASE03), 
@@ -194,7 +197,7 @@ static void onredraw(int width, int height) {
     x11_draw_rect(CLR_BASE01, Regions[SCROLL].width, Regions[SCROLL].y - 2, 1, Regions[SCROLL].height);
     x11_draw_rect(CLR_BASE00, 0, Regions[SCROLL].y - 2, Regions[SCROLL].width, thumbreg);
     x11_draw_rect(CLR_BASE03, 0, thumboff, Regions[SCROLL].width, thumbsz);
-
+    
     /* place the cursor on screen */
     if (Regions[Focused].csrx != SIZE_MAX && Regions[Focused].csry != SIZE_MAX) {
         x11_draw_rect(CLR_BASE3, 
index c56ea63f41def04ad3cef67a177bc16c91ad70e1..7fe2dbee6c5697df376885958e7cfb3420583f53 100644 (file)
--- a/lib/x11.c
+++ b/lib/x11.c
@@ -14,10 +14,6 @@ static void selclear(XEvent* evnt);
 static void selnotify(XEvent* evnt);
 static void selrequest(XEvent* evnt);
 
-#ifndef MAXFONTS
-#define MAXFONTS 16
-#endif
-
 struct XFont {
     struct {
         int height;
@@ -326,21 +322,20 @@ void x11_loop(void) {
     fd_set fds;
     int xfd = ConnectionNumber(X.display);
     for (XEvent e; Running;) {
-        struct timeval tv = { .tv_usec = 100000 };
+        /* configure for 100ms timeout */
+        struct timeval tv = { .tv_usec = 50000 };
         FD_ZERO(&fds);
         FD_SET(xfd, &fds);
-        
+
+        /* wait for events with a timeout, then handle them if we got any */
         int ready = select(xfd+1, &fds, NULL, NULL, &tv); 
-        if (ready > 0)
+        if (ready > 0) {
             x11_handle_events();
-
-        if (Running) {
-            /* redraw the window */
             Config->redraw(X.width, X.height);
             XCopyArea(X.display, X.pixmap, X.window, X.gc, 0, 0, X.width, X.height, 0, 0);
+        } else {
             XFlush(X.display);
         }
-        
     }
     XCloseDisplay(X.display);
     /* we're exiting now. If we own the clipboard, make sure it persists */
diff --git a/xedit.c b/xedit.c
index c0dafa64f94299e1d1f613962d9986ee9c7d6535..dea5613f0526f09f50b10f8d65448b88002de98c 100644 (file)
--- a/xedit.c
+++ b/xedit.c
@@ -541,7 +541,6 @@ void onupdate(void) {
     strncat(status, path, remlen);
     win_settext(STATUS, status_bytes);
     win_view(STATUS)->selection = (Sel){0,0,0};
-
     
     /* calculate and update scroll region */
     View* view = win_view(EDIT);