Set the focus properly when removing a client from the selected area

This commit is contained in:
Kris Maglione 2007-02-12 22:44:42 -05:00
parent 98d10dccac
commit 0e1cba7e96
6 changed files with 22 additions and 14 deletions

View File

@ -3,8 +3,8 @@
include config.mk include config.mk
SRC = area.c bar.c client.c column.c draw.c event.c \ SRC = area.c bar.c client.c column.c draw.c event.c frame.c fs.c \
frame.c fs.c geom.c key.c main.c mouse.c rule.c util.c view.c geom.c key.c main.c mouse.c rule.c util.c view.c
OBJ = ${SRC:.c=.o} OBJ = ${SRC:.c=.o}
all: options wmiiwm all: options wmiiwm

16
area.c
View File

@ -171,10 +171,16 @@ detach_from_area(Area *a, Frame *f) {
for(pr = a->frame; pr; pr = pr->anext) for(pr = a->frame; pr; pr = pr->anext)
if(pr->anext == f) break; if(pr->anext == f) break;
remove_frame(f); remove_frame(f);
if(a->sel == f)
a->sel = pr; if(a->sel == f) {
if(a->sel == nil) if(!pr)
a->sel = a->frame; 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->floating) {
if(a->frame) if(a->frame)
@ -334,7 +340,7 @@ focus_area(Area *a) {
if(f) { if(f) {
draw_frame(f); draw_frame(f);
XSetInputFocus(blz.dpy, f->client->win, RevertToPointerRoot, CurrentTime); XSetInputFocus(blz.dpy, f->client->win, RevertToParent, CurrentTime);
}else }else
XSetInputFocus(blz.dpy, screen->barwin, RevertToPointerRoot, CurrentTime); XSetInputFocus(blz.dpy, screen->barwin, RevertToPointerRoot, CurrentTime);

View File

@ -307,9 +307,9 @@ set_urgent(Client *c, Bool urgent, Bool write) {
XWMHints *wmh; XWMHints *wmh;
char *cwrite; char *cwrite;
cwrite = "Manager"; cwrite = "Client";
if(write) if(write)
cwrite = "Client"; cwrite = "Manager";
if(urgent != c->urgent) { if(urgent != c->urgent) {
if(urgent) if(urgent)
@ -361,7 +361,7 @@ prop_client(Client *c, XPropertyEvent *e) {
break; break;
case XA_WM_HINTS: case XA_WM_HINTS:
wmh = XGetWMHints(blz.dpy, c->win); wmh = XGetWMHints(blz.dpy, c->win);
set_urgent(c, (wmh->flags & XUrgencyHint), False); set_urgent(c, (wmh->flags & XUrgencyHint) != 0, False);
XFree(wmh); XFree(wmh);
break; break;
} }
@ -454,7 +454,6 @@ destroy_client(Client *c) {
} }
update_client_views(c, &dummy); update_client_views(c, &dummy);
update_views();
unmap_client(c, WithdrawnState); unmap_client(c, WithdrawnState);
reparent_client(c, blz.root, c->rect.x, c->rect.y); 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); c->rect.width, c->rect.height);
map_client(c); map_client(c);
map_frame(c); map_frame(c);
configure_client(c);
} }
configure_client(c);
} }
void void

View File

@ -6,7 +6,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <X11/keysym.h> #include <X11/keysym.h>
#include "printevent.h"
uint uint
flush_masked_events(long even_mask) { flush_masked_events(long even_mask) {

View File

@ -181,7 +181,7 @@ focus_frame(Frame *f, Bool restack) {
return; return;
if(a == old_a) { if(a == old_a) {
XSetInputFocus(blz.dpy, f->client->win, RevertToPointerRoot, CurrentTime); XSetInputFocus(blz.dpy, f->client->win, RevertToParent, CurrentTime);
draw_frame(f); draw_frame(f);
} }
else if(old_in_a) else if(old_in_a)

View File

@ -43,6 +43,7 @@ can get it touch with me at the following location:
ken@richsun.UUCP ken@richsun.UUCP
*/ */
#include "wmii.h"
#include <stdio.h> #include <stdio.h>
#include <X11/Intrinsic.h> #include <X11/Intrinsic.h>
#include <X11/Xproto.h> #include <X11/Xproto.h>
@ -852,7 +853,10 @@ char *eventtype(XEvent *ev)
void printevent(XEvent *e) void printevent(XEvent *e)
{ {
XAnyEvent *ev = (void*)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)); printf("%3ld %-20s ", ev->serial, eventtype(e));
if(ev->send_event) if(ev->send_event)
printf("(sendevent) "); printf("(sendevent) ");