From bc7274266ab56311e7a6b0fdbd872433d0c3d366 Mon Sep 17 00:00:00 2001 From: "Michael D. Lowis" Date: Fri, 16 Aug 2019 22:47:30 -0400 Subject: [PATCH] fixed tide bugs on drawing when window is too small --- Rsconscript | 6 +++++- src/anvil.c | 10 +--------- src/tide.c | 10 ++++++++-- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/Rsconscript b/Rsconscript index 670f7e1..6ce25f4 100644 --- a/Rsconscript +++ b/Rsconscript @@ -6,6 +6,7 @@ end build do env = Environment.new env["CC"] = "./acc" + env["CFLAGS"] << "-g" env["CPPPATH"] += %w[. inc /usr/X11/include] env["LIBPATH"] += %w[. /usr/X11/lib] @@ -21,4 +22,7 @@ build do env.Command("", "tests/libedit", "CMD" => ["${_SOURCES}"], "CMD_DESC" => "TEST") -end \ No newline at end of file + env.depends("${prefix}/bin", "") + # Install the compiled binaries + Dir.glob("bin/*").each{|bin| env.Install("${prefix}/bin", bin) } +end diff --git a/src/anvil.c b/src/anvil.c index f9364a5..1cb4912 100644 --- a/src/anvil.c +++ b/src/anvil.c @@ -32,8 +32,6 @@ typedef struct Node { typedef void* (*Reducer)(Node* node, void* accum); -typedef void (*Iterator)(Node* node); - typedef struct Client { Node mnode, tnode; Window win; @@ -49,7 +47,7 @@ typedef struct { } GrowState; typedef struct Column { - struct Column *next; + struct Column* next; struct Client* clients; int flags, x, w; } Column; @@ -120,12 +118,6 @@ void* list_reduce(Node* list, Reducer rfn, void* accum) { return (list ? list_reduce(list->next, rfn, rfn(list, accum)) : accum); } -void list_each(Node* list, Iterator ifn) { - if (!list) return; - ifn(list); - list_each(list->next, ifn); -} - size_t list_count(Node* curr) { size_t nclients = 0; for (; curr; curr = curr->next, nclients++); diff --git a/src/tide.c b/src/tide.c index 4f19478..41349bf 100644 --- a/src/tide.c +++ b/src/tide.c @@ -186,11 +186,17 @@ void xresize(XConf* x, XEvent* e) { static void xredraw(XConf* x) { /* force update the title */ win_title(NULL); + + /* determine draw height such that we can draw both regions */ + int height = x->tagfont->height * 2 + 7; + if (height < x->height) height = x->height; + /* determine the size of the regions */ - size_t maxtagrows = ((x->height/4) / x->tagfont->height); + size_t maxtagrows = ((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 ; + size_t editrows = (height - tagregsz) / x->font->height ; + /* draw the regions to the window */ int olddiv = Divider; drawcsr csr = { .w = x->width, .h = x->height }; -- 2.49.0