From: Iain Patterson Date: Sat, 7 Mar 2009 11:49:30 +0000 (+0000) Subject: Drawing tidyup X-Git-Url: http://git.iain.cx/?a=commitdiff_plain;h=2383271efc00185ccb3aa0012427350b8e61c1e1;p=pager.git Drawing tidyup Changed relief colours. Changed background and window colours ... again. Be smarter about drawing windows which scale down to really small sizes. --- diff --git a/pager.c b/pager.c index a8f0e8d..f5f05c0 100644 --- a/pager.c +++ b/pager.c @@ -7,10 +7,8 @@ #define DOCKAPP_SIZE 56 #define SPEED 100 -#define ACTIVE_DESKTOP 1 -#define ACTIVE_WINDOW 2 -static GC lightGrayGC, darkGrayGC, active_desktopGC, inactive_desktopGC, active_windowGC, inactive_windowGC; +static GC dockapp_border1GC, dockapp_border2GC, window_border1GC, window_border2GC, active_desktopGC, inactive_desktopGC, active_windowGC, inactive_windowGC; static Atom num_desktops_atom, current_desktop_atom, client_list_atom, client_desktop_atom, client_state_atom, active_window_atom; static Atom shaded_state, skip_pager_state, hidden_state; static long desktop = -1; @@ -70,33 +68,39 @@ void setup_GCs() { gcv.foreground = DAGetColor("lightGray"); gcv.graphics_exposures = False; - lightGrayGC = XCreateGC(DADisplay, DAWindow, GCForeground|GCGraphicsExposures, &gcv); + dockapp_border1GC = XCreateGC(DADisplay, DAWindow, GCForeground|GCGraphicsExposures, &gcv); gcv.foreground = DAGetColor("#222222"); - darkGrayGC = XCreateGC(DADisplay, DAWindow, GCForeground|GCGraphicsExposures, &gcv); + dockapp_border2GC = XCreateGC(DADisplay, DAWindow, GCForeground|GCGraphicsExposures, &gcv); - gcv.foreground = DAGetColor("#bbbbbb"); + gcv.foreground = DAGetColor("#0088ff"); active_desktopGC = XCreateGC(DADisplay, DAWindow, GCForeground|GCGraphicsExposures, &gcv); - gcv.foreground = DAGetColor("#777777"); + gcv.foreground = DAGetColor("darkGray"); inactive_desktopGC = XCreateGC(DADisplay, DAWindow, GCForeground|GCGraphicsExposures, &gcv); - gcv.foreground = DAGetColor("#20b2ae"); + gcv.foreground = DAGetColor("white"); active_windowGC = XCreateGC(DADisplay, DAWindow, GCForeground|GCGraphicsExposures, &gcv); gcv.foreground = DAGetColor("#999999"); inactive_windowGC = XCreateGC(DADisplay, DAWindow, GCForeground|GCGraphicsExposures, &gcv); + + gcv.foreground = DAGetColor("black"); + window_border1GC = XCreateGC(DADisplay, DAWindow, GCForeground|GCGraphicsExposures, &gcv); + + gcv.foreground = DAGetColor("#333333"); + window_border2GC = XCreateGC(DADisplay, DAWindow, GCForeground|GCGraphicsExposures, &gcv); } void draw_relief(Pixmap pixmap, unsigned int width, unsigned int height, GC desktopGC) { /* Drawing */ XFillRectangle(DADisplay, pixmap, desktopGC, 0, 0, width, height); - XDrawLine(DADisplay, pixmap, darkGrayGC, 0, 0, 0, height - 2); - XDrawLine(DADisplay, pixmap, darkGrayGC, 1, 0, width - 1, 0); + XDrawLine(DADisplay, pixmap, dockapp_border2GC, 0, 0, 0, height - 2); + XDrawLine(DADisplay, pixmap, dockapp_border2GC, 1, 0, width - 1, 0); - XDrawLine(DADisplay, pixmap, lightGrayGC, 0, height - 1, width - 1, height - 1); - XDrawLine(DADisplay, pixmap, lightGrayGC, width - 1, 1, width - 1, height - 2); + XDrawLine(DADisplay, pixmap, dockapp_border1GC, 0, height - 1, width - 1, height - 1); + XDrawLine(DADisplay, pixmap, dockapp_border1GC, width - 1, 1, width - 1, height - 2); } void change() { @@ -164,9 +168,11 @@ void page() { rect.width = (double) width / scale; rect.height = (double) height / scale; - if (clients[i] == active_window) gc = active_windowGC; + if (rect.width < 2 || rect.height < 2) gc = window_border1GC; + else if (clients[i] == active_window) gc = active_windowGC; else gc = inactive_windowGC; XFillRectangle(DADisplay, pixmap, gc, rect.x, rect.y, rect.width, rect.height); + if (rect.width < 2 || rect.height < 2) continue; /* Thumbnail. */ #if 0 @@ -188,10 +194,10 @@ void page() { XSync(DADisplay, False); #endif - XDrawLine(DADisplay, pixmap, darkGrayGC, rect.x, rect.y, rect.x, rect.y + rect.height - 2); - XDrawLine(DADisplay, pixmap, darkGrayGC, rect.x + 1, rect.y, rect.x + rect.width - 1, rect.y); - XDrawLine(DADisplay, pixmap, lightGrayGC, rect.x, rect.y + rect.height - 1, rect.x + rect.width - 1, rect.y + rect.height - 1); - XDrawLine(DADisplay, pixmap, lightGrayGC, rect.x + rect.width - 1, rect.y + 1, rect.x + rect.width - 1, rect.y + rect.height - 2); + XDrawLine(DADisplay, pixmap, window_border1GC, rect.x, rect.y, rect.x, rect.y + rect.height - 2); + XDrawLine(DADisplay, pixmap, window_border1GC, rect.x + 1, rect.y, rect.x + rect.width - 1, rect.y); + XDrawLine(DADisplay, pixmap, window_border2GC, rect.x, rect.y + rect.height - 1, rect.x + rect.width - 1, rect.y + rect.height - 1); + XDrawLine(DADisplay, pixmap, window_border2GC, rect.x + rect.width - 1, rect.y + 1, rect.x + rect.width - 1, rect.y + rect.height - 2); } DASetPixmap(pixmap);