]> git.mdlowis.com Git - projs/tide.git/commitdiff
basic window management in place now
authorMichael D. Lowis <mike@mdlowis.com>
Wed, 29 May 2019 02:29:40 +0000 (22:29 -0400)
committerMichael D. Lowis <mike@mdlowis.com>
Wed, 29 May 2019 02:29:40 +0000 (22:29 -0400)
.gitignore
config.mk
src/anvil.c

index 07bd2455315060f8e9b1a5eafebf81ccec024b3d..63af48045ca59824725b900fe4af9dde18ba04f8 100644 (file)
@@ -61,3 +61,4 @@ fetch
 tests/test_tide
 bin/tsed
 bin/tframe
+bin/anvil
index a39e99cfab9e32538652dce4c4f86bed8b53859a..9d91e0a016a63a7ce737eb8933424921bdaa238b 100644 (file)
--- 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
index 7222d53ce8e8e9956d4aea4f9dfaa061ceca0bad..284ca55307ce769b1592d98cec67e2aa7e94bb35 100644 (file)
@@ -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