]> git.mdlowis.com Git - projs/tide.git/commitdiff
maybe fixed some random issues
authorMichael D. Lowis <mike.lowis@gentex.com>
Thu, 17 Jan 2019 01:38:34 +0000 (20:38 -0500)
committerMichael D. Lowis <mike.lowis@gentex.com>
Thu, 17 Jan 2019 01:38:34 +0000 (20:38 -0500)
TODO.md
log.txt [new file with mode: 0644]
src/lib/x11.c
src/lib/x11_gc.c
src/registrar.c
src/tide.c

diff --git a/TODO.md b/TODO.md
index 1c66a919b8b1ac1330305f0e94581e43fa98d120..5f9989415293f8b951fb8feb82b120c942d71d57 100644 (file)
--- a/TODO.md
+++ b/TODO.md
@@ -7,6 +7,9 @@
 * registrar: doesnt match open windows when new file created and is then opened for edit or line number
 * registrar: group by hostname or group env var in registrar
 * tide: gap buffer does not handle UTF-8 currently
+* tide: sometimes tide starts with white screen until an event occurs
+* tide: highlight current line if jumped to line is 0
+* tide: jumping to line should call XMapRaised
 
 ## BACKLOG
 
diff --git a/log.txt b/log.txt
new file mode 100644 (file)
index 0000000..7878d69
--- /dev/null
+++ b/log.txt
@@ -0,0 +1,117 @@
+syncing
+update start
+get events
+process events
+    process event
+resize
+    process event
+resize
+    process event
+resize
+    process event
+resize
+    process event
+    process event
+resize
+    process event
+resize
+    process event
+resize
+    process event
+resize
+    process event
+    process event
+    process event
+    process event
+    process event
+    process event
+redraw
+flush
+update start
+syncing again
+spawning job
+
+poll()
+done
+
+poll()
+done
+
+poll()
+done
+
+poll()
+done
+
+poll()
+done
+
+poll()
+done
+
+poll()
+done
+
+poll()
+done
+
+poll()
+done
+
+poll()
+done
+
+poll()
+done
+
+poll()
+done
+
+poll()
+done
+
+poll()
+done
+
+poll()
+done
+
+poll()
+update start
+get events
+process events
+    process event
+redraw
+flush
+update start
+update start
+get events
+process events
+redraw
+flush
+update start
+done
+
+poll()
+done
+
+poll()
+update start
+get events
+process events
+    process event
+redraw
+flush
+get events
+process events
+    process event
+redraw
+flush
+update start
+update start
+get events
+process events
+redraw
+flush
+update start
+done
index 9a1730d74a4b0caabb3c45a8d8ec1ea4aa91a2c9..74df7d9309a608529c36572e82a894a890fa5cb1 100644 (file)
@@ -51,9 +51,11 @@ void x11_mkwin(XConf* x, int width, int height, int evmask) {
     XSetWMProtocols(x->display, x->self, &wmDeleteMessage, 1);
     /* setup window attributes and events */
     XSetWindowAttributes swa;
-    swa.backing_store = WhenMapped;
     swa.bit_gravity = NorthWestGravity;
-    XChangeWindowAttributes(x->display, x->self, CWBackingStore|CWBitGravity, &swa);
+    XChangeWindowAttributes(x->display, x->self,
+        CWBackingStore|CWBitGravity,
+//        CWBackPixel | CWBorderPixel | CWBitGravity | CWEventMask | CWColormap,
+        &swa);
     XSelectInput(x->display, x->self, evmask);
 }
 
index 2d59a2210b0ad58b2fb61ddfa618ea727c9f58ff..93b3000a367f1e58703a2b61981644651c353ec1 100644 (file)
@@ -26,7 +26,7 @@ void x11_init_gc(XConf* x) {
     XGCValues gcv;
     gcv.foreground = WhitePixel(x->display, x->screen);
     gcv.graphics_exposures = False;
-    x->gc = XCreateGC(x->display, x->self, GCForeground|GCGraphicsExposures, &gcv);
+    x->gc = XCreateGC(x->display, x->self, GCGraphicsExposures, &gcv);
     x->eventfns[FocusIn] = xfocus;
     x->eventfns[FocusOut] = xfocus;
     x->eventfns[ConfigureNotify] = xresize;
@@ -60,6 +60,16 @@ void x11_show(XConf* x) {
     ce.height = x->height;
     XSendEvent(x->display, x->self, False, StructureNotifyMask, (XEvent *)&ce);
     XMapWindow(x->display, x->self);
+    XSync(x->display, False);
+
+    /* Waiting for window mapping */
+    XEvent ev;
+    do {
+        XNextEvent(x->display, &ev);
+        if (XFilterEvent(&ev, None))
+            continue;
+        xresize(x, &ev);
+    } while (ev.type != MapNotify);
 }
 
 XftFont* x11_font_load(XConf* x, char* name) {
index b7f3a0f1d36c0b516d4b8e0495f97797c69950ca..d956382512bc9dda03ff4407f864b5d661970702 100644 (file)
@@ -147,19 +147,19 @@ void propnotify(XConf* x, XEvent* e) {
         if(file) XFree(file);
         if(addr) XFree(addr);
     }
-    /* cleanup any invalid windows */
-    TWindow* wins = Windows;
-    Windows = NULL;
-    while (wins) {
-        TWindow* curr = wins;
-        wins = curr->next;
-        if (!wins->path) {
-            free(curr);
-        } else {
-            curr->next = Windows;
-            Windows = curr;
-        }
-    }
+//    /* cleanup any invalid windows */
+//    TWindow* wins = Windows;
+//    Windows = NULL;
+//    while (wins) {
+//        TWindow* curr = wins;
+//        wins = curr->next;
+//        if (!wins->path) {
+//            free(curr);
+//        } else {
+//            curr->next = Windows;
+//            Windows = curr;
+//        }
+//    }
 }
 
 void find_windows(XConf* x) {
index 13b2c7a6fd72445104340a01661020f2a1418b03..bb22ec9c799503ea39b6965c0665c3e20b705aef 100644 (file)
@@ -251,11 +251,9 @@ static void xclientmsg(XConf* x, XEvent* e) {
 }
 
 static void xupdate(Job* job) {
-    int nevents, nqueued;
+    int nqueued;
     do {
         nqueued = XEventsQueued(X.display, QueuedAfterFlush);
-        XTimeCoord* coords = XGetMotionEvents(X.display, X.self, CurrentTime, CurrentTime, &nevents);
-        if (coords) XFree(coords);
         for (XEvent e; XPending(X.display);) {
             XNextEvent(X.display, &e);
             if (!XFilterEvent(&e, None) && X.eventfns[e.type])
@@ -280,14 +278,13 @@ static void xupdate(Job* job) {
             draw_scroll(&X, &csr, win_view(EDIT), Divider);
             XCopyArea(X.display, X.pixmap, X.self, X.gc, 0, 0, X.width, X.height, 0, 0);
             SyncMouse = false;
+            XFlush(X.display);
         }
     } while ((nqueued = XEventsQueued(X.display, QueuedAfterFlush)) > 0);
 }
 
 void win_init(KeyBinding* bindings) {
     Keys = bindings;
-    view_init(&Regions[TAGS], NULL);
-    view_init(&Regions[EDIT], NULL);
     signal(SIGPIPE, SIG_IGN); // Ignore the SIGPIPE signal
     setlocale(LC_CTYPE, "");
     XSetLocaleModifiers("");
@@ -306,13 +303,13 @@ void win_init(KeyBinding* bindings) {
         | ButtonPressMask
         | ButtonReleaseMask
         | ButtonMotionMask
-        | StructureNotifyMask
         | PropertyChangeMask
         | ExposureMask
+        | VisibilityChangeMask
+        | StructureNotifyMask
     );
     x11_init_gc(&X);
     x11_sel_init(&X);
-    x11_centerwin(&X);
     x11_show(&X);
 
     /* register event handlers */
@@ -321,12 +318,6 @@ void win_init(KeyBinding* bindings) {
     X.eventfns[ButtonRelease] = xbtnrelease;
     X.eventfns[MotionNotify] = xbtnmotion;
     X.eventfns[ClientMessage] = xclientmsg;
-
-    /* Populate the  tags region */
-    View* view = win_view(TAGS);
-    view_putstr(view, TagString);
-    buf_logclear(&(view->buffer));
-    win_prop_set("TIDE", "", "tide");
 }
 
 void win_title(char* path) {
@@ -356,13 +347,13 @@ void win_prop_set(char* xname, char* ename, char* value) {
 }
 
 void win_loop(void) {
-    X.running = True;
-    XMapWindow(X.display, X.self);
     tide_send("ADD");
     job_spawn(ConnectionNumber(X.display), xupdate, 0, 0);
-    while (X.running)
+    XSync(X.display, False);
+    while (X.running) {
         if (job_poll(Timeout))
             xupdate(NULL);
+    }
 }
 
 void win_quit(void) {
@@ -445,7 +436,6 @@ static void exec(char* cmd, char* arg) {
     if (tag) {
         for (; *cmd && !isspace(*cmd); cmd++); /* strip off tag name */
         for (; *cmd && isspace(*cmd); cmd++);  /* strip off leading space */
-        //tag_exec(tag, (*cmd ? strdup(cmd) : arg));
         arg = (*cmd ? strdup(cmd) : arg);
         tag->action(!arg || !*arg ? NULL : arg);
     } else if (arg) {
@@ -922,6 +912,14 @@ int main(int argc, char** argv) {
     /* create the window */
     win_init(Bindings);
 
+    /* Initialize the views */
+    view_init(&Regions[TAGS], NULL);
+    view_init(&Regions[EDIT], NULL);
+    view_putstr(win_view(TAGS), TagString);
+    view_resize(win_view(TAGS), 640, 1);
+    buf_logclear(win_buf(TAGS));
+    win_prop_set("TIDE", "", "tide");
+
     /* if we still have args left we're going to open it in this instance */
     if (*argv) {
         char* path = realpath(*argv, NULL);
@@ -934,6 +932,7 @@ int main(int argc, char** argv) {
     }
 
     /* now create the window and start the event loop */
+    xupdate(NULL);
     win_loop();
     return 0;
 }