From: Michael D. Lowis Date: Wed, 29 May 2019 02:29:40 +0000 (-0400) Subject: basic window management in place now X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=bc76e158c2ba2fd85fb90c65b14e26dd98fb1a7a;p=projs%2Ftide.git basic window management in place now --- diff --git a/.gitignore b/.gitignore index 07bd245..63af480 100644 --- a/.gitignore +++ b/.gitignore @@ -61,3 +61,4 @@ fetch tests/test_tide bin/tsed bin/tframe +bin/anvil diff --git a/config.mk b/config.mk index a39e99c..9d91e0a 100644 --- a/config.mk +++ b/config.mk @@ -17,7 +17,7 @@ INCS += -I/usr/include/freetype2 # Compiler Setup CC = ./acc -CFLAGS = -O2 -MMD $(INCS) +CFLAGS = -g -O2 -MMD $(INCS) CFLAGS += -Wno-missing-field-initializers -Wno-implicit-fallthrough -Wno-unknown-pragmas # Linker Setup diff --git a/src/anvil.c b/src/anvil.c index 7222d53..284ca55 100644 --- a/src/anvil.c +++ b/src/anvil.c @@ -25,12 +25,9 @@ Client* Clients = NULL; /* Utility Functions *****************************************************************************/ void dbg(char* fmt, ...) { - static FILE* dbgf = NULL; - if (!dbgf) { dbgf = fopen("w", "~/.anvil.log"); } va_list args; va_start(args, fmt); - vfprintf(dbgf, fmt, args); - fflush(dbgf); + vfprintf(stderr, fmt, args); va_end(args); } @@ -89,7 +86,13 @@ void client_add(XConf* x, Window win) { x->display, x->root, 0, 0, 1, 1, 0, x->depth, CopyFromParent, x->visual, CWOverrideRedirect|CWBackPixel|CWBorderPixel|CWEventMask, &pattr); - XSelectInput(x->display, c->win, PropertyChangeMask); + c->xft = XftDrawCreate(x->display, (Drawable) c->frame, x->visual, x->colormap); +// XSetWindowBorderWidth(x->display, c->frame, 1); +// XSetWindowBorderWidth(x->display, c->win, 1); + XSelectInput(x->display, c->frame, + ButtonPressMask|ButtonReleaseMask|FocusChangeMask|StructureNotifyMask); + XSelectInput(x->display, c->win, + EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask); #if 0 XSetWindowBorderWidth(x->display, c->win, 0); @@ -104,7 +107,7 @@ void client_add(XConf* x, Window win) { XMoveResizeWindow(x->display, c->frame, 100, 100 - x->font->height, c->w, x->font->height); XMoveResizeWindow(x->display, c->win, 100, 100, c->w, c->h); client_config(x, c); - XMapWindow(x->display, c->frame); + XMapRaised(x->display, c->frame); XMapRaised(x->display, c->win); #endif @@ -113,11 +116,9 @@ void client_add(XConf* x, Window win) { } Client* client_del(XConf* x, Client* curr, Client* c) { - dbg("%p == %p\n", curr, c); if (!curr) { return NULL; } else if (curr == c) { - dbg("destroy\n", curr, c); Client* next = c->next; XGrabServer(x->display); client_setstate(x, c, WithdrawnState); @@ -149,6 +150,7 @@ Client* client_find(Window win) { #pragma GCC diagnostic ignored "-Wunused-parameter" static void xbtnpress(XConf* x, XEvent* e) { + dbg("btn\n"); } static void xconfigrequest(XConf* x, XEvent* e) { @@ -192,18 +194,25 @@ static void xunmapnotify(XConf* x, XEvent* e) { } static void xdestroynotify(XConf* x, XEvent* e) { + dbg("destroy\n"); + Client* c = client_find(e->xdestroywindow.window); + if (c) Clients = client_del(x, Clients, c); } static void xclientmsg(XConf* x, XEvent* e) { + dbg("client\n"); } static void xpropnotify(XConf* x, XEvent* e) { + dbg("prop\n"); } static void xenternotify(XConf* x, XEvent* e) { + dbg("enter\n"); } static void xexpose(XConf* x, XEvent* e) { + dbg("expose\n"); } #pragma GCC diagnostic pop