]> git.mdlowis.com Git - projs/tide.git/commitdiff
added window borders to clearly separate windows embedded in a tframe
authorMichael D. Lowis <mike@mdlowis.com>
Mon, 13 May 2019 01:23:10 +0000 (21:23 -0400)
committerMichael D. Lowis <mike@mdlowis.com>
Mon, 13 May 2019 01:23:10 +0000 (21:23 -0400)
config.h
src/lib/draw.c
src/pick.c
src/tframe.c
src/tide.c

index 0a6a42253a15afed08152d46eea9dd73e6389512..812653778e6bb2b7aaa9f669ae981d6e977b4bad 100644 (file)
--- a/config.h
+++ b/config.h
@@ -8,7 +8,7 @@ enum { /* Color Names */
     EditBg, EditFg, EditSel,
     TagsBg, TagsFg, TagsSel,
     ScrollBg, ScrollFg,
-    VerBdr, HorBdr,
+    VerBdr, HorBdr, WinBdr,
     ClrCount
 };
 
@@ -75,6 +75,7 @@ static int Palette[ClrCount] = {
     [ScrollFg] = 0xF0F0E5, /* Scroll region foreground */
     [VerBdr]   = 0x909047, /* Vertical border */
     [HorBdr]   = 0x000000, /* Horizontal border */
+    [WinBdr]   = 0x000000, /* Window border */
 };
 
 #ifdef FETCH_RULES
index e842491de1b276717886b030aa808163b81bdbe8..24ca7de76f38cc4ed96028ad0319af6962e19d5c 100644 (file)
@@ -17,6 +17,7 @@ void draw_statbox(XConf* x, int status) {
         case OUTDATED: draw_rect(x, Orange, 0, 0, ScrollWidth, x->height/4); break;
         case ERRORED:  draw_rect(x, Red, 0, 0, ScrollWidth, x->height/4);    break;
     }
+    draw_rect(x, WinBdr, 0, 0, 1, x->height/4);
 }
 
 int draw_hrule(XConf* x, drawcsr* csr) {
@@ -86,4 +87,5 @@ void draw_scroll(XConf* x, drawcsr* csr, View* view, int divider) {
     draw_rect(x, VerBdr,   ScrollWidth, divider + 2,  1,           thumbreg);
     draw_rect(x, ScrollBg, 0,           divider + 2,  ScrollWidth, thumbreg);
     draw_rect(x, ScrollFg, 0,           thumboff + 2, ScrollWidth, thumbsz);
+    draw_rect(x, WinBdr,   0,           divider + 2,  1,           thumbreg);
 }
index 503b49d517e191992519d838b3d5c272b3b53a9d..4cb5c6680c86297aa1f6bfd5d79c7d45d57bfe1b 100644 (file)
@@ -161,7 +161,13 @@ int main(int argc, char** argv) {
 }
 
 static void xkeypress(XConf* x, XEvent* e) {
-    KeySym key = x11_getkey(x, e);
+    char buf[8];
+    KeySym key;
+    Status status;
+    if (x->xic)
+        Xutf8LookupString(x->xic, &(e->xkey), buf, sizeof(buf), &key, &status);
+    else
+        XLookupString(&(e->xkey), buf, sizeof(buf), &key, 0);
     if (key == XK_Return) {
         x->running = false;
     } else if (key == XK_Escape) {
index 3490bd982f4be4297acc725a1ef4b1e4a990ff3c..553cfd844a413bc1c2b9491177b0aa4f210f66a5 100644 (file)
@@ -42,6 +42,27 @@ size_t glyph_width(View* view, int c) {
         return extents.xOff;
 }
 
+static Child_T* win_delete(Child_T* child, Window id) {
+    if (!child) return NULL;
+    if (child->wid == id) {
+        Child_T* next = child->next;
+        free(child);
+        return next;
+    } else {
+        child->next = win_delete(child->next, id);
+        return child;
+    }
+}
+
+static void get_position(int x, int y, size_t* row, size_t* col) {
+    int startx = ScrollWidth+3;
+    int maxy = Divider - 4;
+    x = (x < 0 ? 0 : (x > X.width ? X.width : x));
+    y = (y < 0 ? 0 : (y > maxy ? maxy : y));
+    *row = y / X.font->height;
+    *col = (startx <= x ? x - startx : 0);
+}
+
 /* X11 Event Code
  ******************************************************************************/
 static void xmaprequest(XConf* x, XEvent* e) {
@@ -55,18 +76,6 @@ static void xmaprequest(XConf* x, XEvent* e) {
     retile = 1;
 }
 
-static Child_T* win_delete(Child_T* child, Window id) {
-    if (!child) return NULL;
-    if (child->wid == id) {
-        Child_T* next = child->next;
-        free(child);
-        return next;
-    } else {
-        child->next = win_delete(child->next, id);
-        return child;
-    }
-}
-
 static void xdestroy(XConf* x, XEvent* e) {
     (void)x;
     NChildren--;
@@ -98,15 +107,6 @@ static void xkeypress(XConf* x, XEvent* e) {
         view_insert(&Tags, key);
 }
 
-static void get_position(int x, int y, size_t* row, size_t* col) {
-    int startx = ScrollWidth+3;
-    int maxy = Divider - 4;
-    x = (x < 0 ? 0 : (x > X.width ? X.width : x));
-    y = (y < 0 ? 0 : (y > maxy ? maxy : y));
-    *row = y / X.font->height;
-    *col = (startx <= x ? x - startx : 0);
-}
-
 static void xmousebtn(XConf* x, XEvent* e) {
     (void)x;
     size_t row, col;
index 256ba3b30abd0bd4ccd5c8e6247a4539db92ce71..33b04acb202dc58bbfc3f3d01dc6b86ec32f0b63 100644 (file)
@@ -193,6 +193,7 @@ static void xredraw(XConf* x) {
     Divider = draw_hrule(x, &csr);
     draw_view(x, &Regions[EDIT], x->font, editrows, &csr, EditBg, EditFg, EditSel, SyncMouse);
     draw_scroll(x, &csr, win_view(EDIT), Divider);
+    draw_rect(x, WinBdr, 0, x->height-1,  x->width, 1);
     XCopyArea(x->display, x->pixmap, x->self, x->gc, 0, 0, x->width, x->height, 0, 0);
     SyncMouse = false;
     XFlush(x->display);