[hackers] [wmii] Set the focus properly when removing a client from the selected area

From: Kris Maglione <jg_AT_suckless.org>
Date: Tue Feb 13 04:47:36 2007

changeset: 1860:a08a4d2d5e75
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Mon Feb 12 22:44:42 2007 -0500
summary: Set the focus properly when removing a client from the selected area

diff -r e962b2878da1 -r a08a4d2d5e75 Makefile
--- a/Makefile Mon Feb 12 18:18:00 2007 -0500
+++ b/Makefile Mon Feb 12 22:44:42 2007 -0500
@@ -3,8 +3,8 @@
 
 include config.mk
 
-SRC = area.c bar.c client.c column.c draw.c event.c \
- frame.c fs.c geom.c key.c main.c mouse.c rule.c util.c view.c
+SRC = area.c bar.c client.c column.c draw.c event.c frame.c fs.c \
+ geom.c key.c main.c mouse.c rule.c util.c view.c
 OBJ = ${SRC:.c=.o}
 
 all: options wmiiwm
diff -r e962b2878da1 -r a08a4d2d5e75 area.c
--- a/area.c Mon Feb 12 18:18:00 2007 -0500
+++ b/area.c Mon Feb 12 22:44:42 2007 -0500
@@ -171,10 +171,16 @@ detach_from_area(Area *a, Frame *f) {
         for(pr = a->frame; pr; pr = pr->anext)
                 if(pr->anext == f) break;
         remove_frame(f);
- if(a->sel == f)
- a->sel = pr;
- if(a->sel == nil)
- a->sel = a->frame;
+
+ if(a->sel == f) {
+ if(!pr)
+ pr = a->frame;
+ if((a->view == screen->sel) &&
+ (a->view->sel == a) && (pr))
+ focus_frame(pr, False);
+ else
+ a->sel = pr;
+ }
 
         if(!a->floating) {
                 if(a->frame)
@@ -334,7 +340,7 @@ focus_area(Area *a) {
 
         if(f) {
                 draw_frame(f);
- XSetInputFocus(blz.dpy, f->client->win, RevertToPointerRoot, CurrentTime);
+ XSetInputFocus(blz.dpy, f->client->win, RevertToParent, CurrentTime);
         }else
                 XSetInputFocus(blz.dpy, screen->barwin, RevertToPointerRoot, CurrentTime);
 
diff -r e962b2878da1 -r a08a4d2d5e75 client.c
--- a/client.c Mon Feb 12 18:18:00 2007 -0500
+++ b/client.c Mon Feb 12 22:44:42 2007 -0500
@@ -307,9 +307,9 @@ set_urgent(Client *c, Bool urgent, Bool
         XWMHints *wmh;
         char *cwrite;
 
- cwrite = "Manager";
+ cwrite = "Client";
         if(write)
- cwrite = "Client";
+ cwrite = "Manager";
 
         if(urgent != c->urgent) {
                 if(urgent)
@@ -361,7 +361,7 @@ prop_client(Client *c, XPropertyEvent *e
                 break;
         case XA_WM_HINTS:
                 wmh = XGetWMHints(blz.dpy, c->win);
- set_urgent(c, (wmh->flags & XUrgencyHint), False);
+ set_urgent(c, (wmh->flags & XUrgencyHint) != 0, False);
                 XFree(wmh);
                 break;
         }
@@ -454,7 +454,6 @@ destroy_client(Client *c) {
                 }
 
         update_client_views(c, &dummy);
- update_views();
 
         unmap_client(c, WithdrawnState);
         reparent_client(c, blz.root, c->rect.x, c->rect.y);
@@ -591,8 +590,8 @@ resize_client(Client *c, XRectangle *r)
                                 c->rect.width, c->rect.height);
                 map_client(c);
                 map_frame(c);
- }
- configure_client(c);
+ configure_client(c);
+ }
 }
 
 void
diff -r e962b2878da1 -r a08a4d2d5e75 event.c
--- a/event.c Mon Feb 12 18:18:00 2007 -0500
+++ b/event.c Mon Feb 12 22:44:42 2007 -0500
@@ -6,7 +6,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include <X11/keysym.h>
-#include "printevent.h"
 
 uint
 flush_masked_events(long even_mask) {
diff -r e962b2878da1 -r a08a4d2d5e75 frame.c
--- a/frame.c Mon Feb 12 18:18:00 2007 -0500
+++ b/frame.c Mon Feb 12 22:44:42 2007 -0500
@@ -181,7 +181,7 @@ focus_frame(Frame *f, Bool restack) {
                 return;
 
         if(a == old_a) {
- XSetInputFocus(blz.dpy, f->client->win, RevertToPointerRoot, CurrentTime);
+ XSetInputFocus(blz.dpy, f->client->win, RevertToParent, CurrentTime);
                 draw_frame(f);
         }
         else if(old_in_a)
diff -r e962b2878da1 -r a08a4d2d5e75 printevent.c
--- a/printevent.c Mon Feb 12 18:18:00 2007 -0500
+++ b/printevent.c Mon Feb 12 22:44:42 2007 -0500
@@ -43,6 +43,7 @@ can get it touch with me at the followin
                         ken_AT_richsun.UUCP
 */
 
+#include "wmii.h"
 #include <stdio.h>
 #include <X11/Intrinsic.h>
 #include <X11/Xproto.h>
@@ -852,7 +853,10 @@ void printevent(XEvent *e)
 void printevent(XEvent *e)
 {
     XAnyEvent *ev = (void*)e;
-
+ Client *c;
+
+ if(ev->window && (c = client_of_win(ev->window)))
+ printf("title=%s\n", c->name);
     printf("%3ld %-20s ", ev->serial, eventtype(e));
     if(ev->send_event)
         printf("(sendevent) ");
Received on Tue Feb 13 2007 - 04:47:36 UTC

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