[hackers] [wmii] Improved fullscreen support (far from finished). Minor focus improvements. Changed copyright info.

From: Kris Maglione <jg_AT_suckless.org>
Date: Sat Mar 03 05:43:29 2007

changeset: 1985:b8fe0f1230f3
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Fri Mar 02 23:40:24 2007 -0500
summary: Improved fullscreen support (far from finished). Minor focus improvements. Changed copyright info.

diff -r 388c11fc40ea -r b8fe0f1230f3 Makefile
--- a/Makefile Fri Mar 02 17:11:09 2007 -0500
+++ b/Makefile Fri Mar 02 23:40:24 2007 -0500
@@ -1,5 +1,6 @@
 # window manager improved 2 - window manager improved 2
 # (C)opyright MMVI Anselm R. Garbe
+# (C)opyright MMVI-MMVII Kris Maglione
 .POSIX:
 
 include config.mk
diff -r 388c11fc40ea -r b8fe0f1230f3 TODO
--- a/TODO Fri Mar 02 17:11:09 2007 -0500
+++ b/TODO Fri Mar 02 23:40:24 2007 -0500
@@ -1,6 +1,5 @@ 3.6
 3.6
 * Working grab boxes
-* Border based resizals
 * Grow(and shrink?) ctl commands
 * Switch to mk for building
 
diff -r 388c11fc40ea -r b8fe0f1230f3 area.c
--- a/area.c Fri Mar 02 17:11:09 2007 -0500
+++ b/area.c Fri Mar 02 23:40:24 2007 -0500
@@ -1,4 +1,5 @@
 /* (C)opyright MMIV-MMVI Anselm R. Garbe <garbeam at gmail dot com>
+ * (C)opyright MMVI-MMVII Kris Maglione <fbsdaemon_AT_gmail.com>
  * See LICENSE file for license details.
  */
 #include "wmii.h"
diff -r 388c11fc40ea -r b8fe0f1230f3 bar.c
--- a/bar.c Fri Mar 02 17:11:09 2007 -0500
+++ b/bar.c Fri Mar 02 23:40:24 2007 -0500
@@ -1,4 +1,5 @@
 /* (C)opyright MMIV-MMVI Anselm R. Garbe <garbeam at gmail dot com>
+ * (C)opyright MMVI-MMVII Kris Maglione <fbsdaemon_AT_gmail.com>
  * See LICENSE file for license details.
  */
 #include "wmii.h"
diff -r 388c11fc40ea -r b8fe0f1230f3 client.c
--- a/client.c Fri Mar 02 17:11:09 2007 -0500
+++ b/client.c Fri Mar 02 23:40:24 2007 -0500
@@ -1,4 +1,5 @@
 /* (C)opyright MMIV-MMVI Anselm R. Garbe <garbeam at gmail dot com>
+ * (C)opyright MMVI-MMVII Kris Maglione <fbsdaemon_AT_gmail.com>
  * See LICENSE file for license details.
  */
 #include "wmii.h"
@@ -84,6 +85,51 @@ create_client(Window w, XWindowAttribute
         return c;
 }
 
+static int
+dummy_error_handler(Display *dpy, XErrorEvent *error) {
+ return 0;
+}
+
+void
+destroy_client(Client *c) {
+ char *dummy;
+ Client **tc;
+ XEvent ev;
+
+ XGrabServer(blz.dpy);
+ /* In case the client is already unmapped */
+ XSetErrorHandler(dummy_error_handler);
+
+ for(tc=&client; *tc; tc=&(*tc)->next)
+ if(*tc == c) {
+ *tc = c->next;
+ break;
+ }
+
+ dummy = nil;
+ update_client_views(c, &dummy);
+
+ unmap_client(c, WithdrawnState);
+ gravitate_client(c, True);
+ reparent_client(c, blz.root, c->rect.x, c->rect.y);
+
+ XFreeGC(blz.dpy, c->gc);
+ XDestroyWindow(blz.dpy, c->framewin);
+ XSync(blz.dpy, False);
+
+ XSetErrorHandler(wmii_error_handler);
+ XUngrabServer(blz.dpy);
+ flush_masked_events(EnterWindowMask);
+
+ while(XCheckMaskEvent(blz.dpy, StructureNotifyMask, &ev))
+ if(ev.type != UnmapNotify || ev.xunmap.window != c->win)
+ if(handler[ev.type])
+ handler[ev.type](&ev);
+
+ write_event("DestroyClient 0x%x\n", c->win);
+ free(c);
+}
+
 void
 manage_client(Client *c) {
         XTextProperty tags = { 0 };
@@ -470,45 +516,6 @@ gravitate_client(Client *c, Bool invert)
         }
         c->rect.x += dx;
         c->rect.y += dy;
-}
-
-static int
-dummy_error_handler(Display *dpy, XErrorEvent *error) {
- return 0;
-}
-
-void
-destroy_client(Client *c) {
- char *dummy;
- Client **tc;
-
- XGrabServer(blz.dpy);
- /* In case the client is already unmapped */
- XSetErrorHandler(dummy_error_handler);
-
- for(tc=&client; *tc; tc=&(*tc)->next)
- if(*tc == c) {
- *tc = c->next;
- break;
- }
-
- dummy = nil;
- update_client_views(c, &dummy);
-
- unmap_client(c, WithdrawnState);
- gravitate_client(c, True);
- reparent_client(c, blz.root, c->rect.x, c->rect.y);
-
- XFreeGC(blz.dpy, c->gc);
- XDestroyWindow(blz.dpy, c->framewin);
- XSync(blz.dpy, False);
-
- XSetErrorHandler(wmii_error_handler);
- XUngrabServer(blz.dpy);
- flush_masked_events(EnterWindowMask);
-
- write_event("DestroyClient 0x%x\n", c->win);
- free(c);
 }
 
 void
diff -r 388c11fc40ea -r b8fe0f1230f3 column.c
--- a/column.c Fri Mar 02 17:11:09 2007 -0500
+++ b/column.c Fri Mar 02 23:40:24 2007 -0500
@@ -1,4 +1,5 @@
 /* (C)opyright MMIV-MMVI Anselm R. Garbe <garbeam at gmail dot com>
+ * (C)opyright MMVI-MMVII Kris Maglione <fbsdaemon_AT_gmail.com>
  * See LICENSE file for license details.
  */
 #include "wmii.h"
diff -r 388c11fc40ea -r b8fe0f1230f3 event.c
--- a/event.c Fri Mar 02 17:11:09 2007 -0500
+++ b/event.c Fri Mar 02 23:40:24 2007 -0500
@@ -1,4 +1,5 @@
 /* (C)opyright MMIV-MMVI Anselm R. Garbe <garbeam at gmail dot com>
+ * (C)opyright MMVI-MMVII Kris Maglione <fbsdaemon_AT_gmail.com>
  * See LICENSE file for license details.
  */
 #include "wmii.h"
@@ -102,13 +103,7 @@ configurerequest(XEvent *e) {
 
         if(c) {
                 f = c->sel;
- if(0 && verbose)
- fprintf(stderr, "Configure: %s\n\ta: x=%d y=%d w=%d h=%d\n",
- c->name, c->rect.x, c->rect.y, c->rect.width, c->rect.height);
                 gravitate_client(c, True);
- if(0 && verbose)
- fprintf(stderr, "\tb: x=%d y=%d w=%d h=%d\n",
- c->rect.x, c->rect.y, c->rect.width, c->rect.height);
                 if(ev->value_mask & CWX)
                         c->rect.x = ev->x;
                 if(ev->value_mask & CWY)
@@ -119,13 +114,17 @@ configurerequest(XEvent *e) {
                         c->rect.height = ev->height;
                 if(ev->value_mask & CWBorderWidth)
                         c->border = ev->border_width;
- if(0 && verbose)
- fprintf(stderr, "\tb: x=%d y=%d w=%d h=%d\n",
- c->rect.x, c->rect.y, c->rect.width, c->rect.height);
                 gravitate_client(c, False);
- if(0 && verbose)
- fprintf(stderr, "\tb: x=%d y=%d w=%d h=%d\n",
- c->rect.x, c->rect.y, c->rect.width, c->rect.height);
+
+ if((c->rect.height == screen->rect.height)
+ &&(c->rect.width == screen->rect.width)) {
+ c->fullscreen = True;
+ if(c->sel) {
+ if(!c->sel->area->floating)
+ send_to_area(c->sel->view->area, c->sel);
+ restack_view(c->sel->view);
+ }
+ }
 
                 if(c->sel->area->floating)
                         frect=&c->sel->rect;
@@ -137,11 +136,8 @@ configurerequest(XEvent *e) {
                 frect->x -= def.border;
                 frect->width += 2 * def.border;
                 frect->height += frame_delta_h();
- if(0 && verbose)
- fprintf(stderr, "\tb: x=%d y=%d w=%d h=%d\n",
- frect->x, frect->y, frect->width, frect->height);
-
- if(c->sel->area->floating)
+
+ if(c->sel->area->floating || c->fullscreen)
                         resize_client(c, frect);
                 else
                         configure_client(c);
@@ -203,6 +199,17 @@ leavenotify(XEvent *e) {
         }
 }
 
+void
+print_focus(Client *c, char *to) {
+ if(verbose) {
+ fprintf(stderr, "screen->focus: %p => %p\n",
+ screen->focus, c);
+ fprintf(stderr, "\t%s => %s\n",
+ screen->focus ? screen->focus->name : "<nil>",
+ to);
+ }
+}
+
 static void
 focusin(XEvent *e) {
         Client *c, *old;
@@ -216,6 +223,7 @@ focusin(XEvent *e) {
 
         if(!((ev->detail == NotifyNonlinear)
            ||(ev->detail == NotifyNonlinearVirtual)
+ ||(ev->detail == NotifyVirtual)
            ||(ev->detail == NotifyInferior)
            ||(ev->detail == NotifyAncestor)))
                 return;
@@ -225,29 +233,24 @@ focusin(XEvent *e) {
         c = client_of_win(ev->window);
         old = screen->focus;
         if(c) {
- if(verbose) {
- fprintf(stderr, "screen->focus: %p => %p\n", screen->focus, c);
- fprintf(stderr, "\t%s => %s\n", (screen->focus ? screen->focus->name : nil),
- c->name);
- }
+ print_focus(c, c->name);
                 if(ev->mode == NotifyGrab)
                         screen->hasgrab = c;
                 screen->focus = c;
- update_client_grab(c);
- if(c->sel)
- draw_frame(c->sel);
- if(old && old->sel)
- draw_frame(old->sel);
+ if(c != old) {
+ update_client_grab(c);
+ if(c->sel)
+ draw_frame(c->sel);
+ if(old && old->sel)
+ draw_frame(old->sel);
+ }
         }else if(ev->window == screen->barwin) {
- if(verbose) {
- fprintf(stderr, "screen->focus: %p => %p\n", screen->focus, c);
- fprintf(stderr, "\t%s => %s\n", (screen->focus ? screen->focus->name : nil),
- "<nil>");
- }
+ print_focus(nil, "<nil>");
                 screen->focus = nil;
         }else if(ev->mode == NotifyGrab) {
- c = screen->focus;
- if(c) {
+ if((c = screen->focus)) {
+ /* Some unmanaged window has focus */
+ print_focus(&c_magic, "<magic>");
                         screen->focus = &c_magic;
                         if(c->sel)
                                 draw_frame(c->sel);
@@ -269,16 +272,20 @@ focusout(XEvent *e) {
         c = client_of_win(ev->window);
         if(c) {
                 if(ev->mode == NotifyWhileGrabbed) {
- if(screen->focus && screen->hasgrab != screen->focus)
+ if((screen->focus)
+ &&(screen->hasgrab != screen->focus))
                                 screen->hasgrab = screen->focus;
                         if(screen->hasgrab == c)
                                 return;
- }
- if(screen->focus == c)
- screen->focus = &c_magic;
- update_client_grab(c);
- if(c->sel)
- draw_frame(c->sel);
+ }else if(ev->mode != NotifyGrab) {
+ if(screen->focus == c) {
+ print_focus(&c_magic, "<magic>");
+ screen->focus = &c_magic;
+ }
+ update_client_grab(c);
+ if(c->sel)
+ draw_frame(c->sel);
+ }
         }
 }
 
@@ -298,7 +305,6 @@ expose(XEvent *e) {
 
 static void
 keypress(XEvent *e) {
- XEvent me;
         XKeyEvent *ev = &e->xkey;
         Frame *f;
         KeySym k = 0;
@@ -315,9 +321,6 @@ keypress(XEvent *e) {
                 buf[n] = 0;
         }
         else {
- while(XCheckMaskEvent(blz.dpy, FocusChangeMask, &me))
- if(me.xfocus.mode != NotifyGrab)
- handler[me.type](&me);
                 kpress(blz.root, ev->state, (KeyCode) ev->keycode);
         }
 }
@@ -376,6 +379,7 @@ unmapnotify(XEvent *e) {
                 if(!c->unmapped--)
                         destroy_client(c);
 }
+
 void (*handler[LASTEvent]) (XEvent *) = {
         [ButtonPress] = buttonpress,
         [ButtonRelease] = buttonrelease,
diff -r 388c11fc40ea -r b8fe0f1230f3 frame.c
--- a/frame.c Fri Mar 02 17:11:09 2007 -0500
+++ b/frame.c Fri Mar 02 23:40:24 2007 -0500
@@ -1,4 +1,4 @@
-/* (C)opyright MMIV-MMVI Anselm R. Garbe <garbeam at gmail dot com>
+/* (C)opyright MMVI-MMVII Kris Maglione <fbsdaemon_AT_gmail.com>
  * See LICENSE file for license details.
  */
 #include "wmii.h"
@@ -87,9 +87,6 @@ resize_frame(Frame *f, XRectangle *r) {
         c = f->client;
         stickycorner = get_sticky(&f->rect, r);
 
- if(c->fullscreen)
- send_to_area(f->area->view->area, f);
-
         f->rect = *r;
         f->crect = *r;
         apply_sizehints(c, &f->crect, f->area->floating, True, stickycorner);
@@ -118,10 +115,12 @@ resize_frame(Frame *f, XRectangle *r) {
 
         if(f->area->floating) {
                 if(c->fullscreen) {
+ f->crect.width = screen->rect.width;
+ f->crect.height = screen->rect.height;
+ f->rect = f->crect;
+ client2frame(&f->rect);
                         f->rect.x = -def.border;
                         f->rect.y = -labelh(&def.font);
- f->rect.width = screen->rect.width + 2 * def.border;
- f->rect.height = screen->rect.height + frame_delta_h();
                 }else
                         check_frame_constraints(&f->rect);
         }
diff -r 388c11fc40ea -r b8fe0f1230f3 main.c
--- a/main.c Fri Mar 02 17:11:09 2007 -0500
+++ b/main.c Fri Mar 02 23:40:24 2007 -0500
@@ -1,4 +1,5 @@
 /* (C)opyright MMIV-MMVI Anselm R. Garbe <garbeam at gmail dot com>
+ * (C)opyright MMVI-MMVII Kris Maglione <fbsdaemon_AT_gmail.com>
  * See LICENSE file for license details.
  */
 #include "wmii.h"
@@ -20,7 +21,7 @@
 
 static Bool check_other_wm;
 static int (*x_error_handler) (Display *, XErrorEvent *);
-static char version[] = "wmiiwm - " VERSION ", (C)opyright MMIV-MMVI Anselm R. Garbe\n";
+static char version[] = "wmiiwm - " VERSION ", (C)opyright MMVI-MMVII Kris Maglione\n";
 static struct sigaction sa;
 
 static void
diff -r 388c11fc40ea -r b8fe0f1230f3 mouse.c
--- a/mouse.c Fri Mar 02 17:11:09 2007 -0500
+++ b/mouse.c Fri Mar 02 23:40:24 2007 -0500
@@ -1,5 +1,4 @@
-/* (C)opyright MMIV-MMVI Anselm R. Garbe <garbeam at gmail dot com>
- * (C)opyright MMVI Kris Maglione <fbsdaemon_AT_gmail.com>
+/* (C)opyright MMVI Kris Maglione <fbsdaemon_AT_gmail.com>
  * See LICENSE file for license details.
  */
 #include "wmii.h"
diff -r 388c11fc40ea -r b8fe0f1230f3 view.c
--- a/view.c Fri Mar 02 17:11:09 2007 -0500
+++ b/view.c Fri Mar 02 23:40:24 2007 -0500
@@ -1,5 +1,5 @@
-/*
- * (C)opyright MMIV-MMVI Anselm R. Garbe <garbeam at gmail dot com>
+/* (C)opyright MMIV-MMVI Anselm R. Garbe <garbeam at gmail dot com>
+ * (C)opyright MMVI-MMVII Kris Maglione <fbsdaemon_AT_gmail.com>
  * See LICENSE file for license details.
  */
 
@@ -171,7 +171,8 @@ restack_view(View *v) {
         i = 0;
         n = 0;
 
- for(c=client; c; c=c->next, i++);
+ for(c=client; c; c=c->next)
+ i++;
         if(i >= winssz) {
                 winssz = 2 * i;
                 wins = erealloc(wins, sizeof(Window) * winssz);
@@ -179,17 +180,17 @@ restack_view(View *v) {
 
         for(f=v->area->stack; f; f=f->snext)
                 if(f->client->fullscreen)
- wins[n++] = f->client->framewin;;
+ wins[n++] = f->client->framewin;
         wins[n++] = screen->barwin;
         for(f=v->area->stack; f; f=f->snext)
                 if(!f->client->fullscreen)
- wins[n++] = f->client->framewin;;
+ wins[n++] = f->client->framewin;
         for(a=v->area->next; a; a=a->next) {
                 if(a->frame) {
                         wins[n++] = a->sel->client->framewin;
                         for(f=a->frame; f; f=f->anext)
                                 if(f != a->sel)
- wins[n++] = f->client->framewin;;
+ wins[n++] = f->client->framewin;
                 }
         }
         if(n)
Received on Sat Mar 03 2007 - 05:43:29 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:56:06 UTC