remove unmapped attribute

this fix a bug when fast-switching between tags and dropping
some windows management as we should not.
Use window_getstate() (moved from awesome.c's getstate()) instead.
This commit is contained in:
Julien Danjou 2007-10-23 16:32:55 +02:00
parent 9b60eb3d06
commit e47e1a4a23
5 changed files with 29 additions and 32 deletions

View File

@ -101,30 +101,6 @@ cleanup(awesome_config *awesomeconf)
p_delete(&awesomeconf);
}
/** Get a window state (WM_STATE)
* \param disp Display ref
* \param w Client window
* \return state
*/
static long
getstate(Display *disp, Window w)
{
int format, status;
long result = -1;
unsigned char *p = NULL;
unsigned long n, extra;
Atom real;
status = XGetWindowProperty(disp, w, XInternAtom(disp, "WM_STATE", False),
0L, 2L, False, XInternAtom(disp, "WM_STATE", False),
&real, &format, &n, &extra, (unsigned char **) &p);
if(status != Success)
return -1;
if(n != 0)
result = *p;
p_delete(&p);
return result;
}
/** Scan X to find windows to manage
* \param screen Screen number
* \param awesomeconf awesome config
@ -148,7 +124,7 @@ scan(awesome_config *awesomeconf)
|| wa.override_redirect
|| XGetTransientForHint(awesomeconf->display, wins[i], &d1))
continue;
if(wa.map_state == IsViewable || getstate(awesomeconf->display, wins[i]) == IconicState)
if(wa.map_state == IsViewable || window_getstate(awesomeconf->display, wins[i]) == IconicState)
{
if(screen == 0)
real_screen = get_screen_bycoord(awesomeconf->display, wa.x, wa.y);
@ -161,7 +137,7 @@ scan(awesome_config *awesomeconf)
if(!XGetWindowAttributes(awesomeconf->display, wins[i], &wa))
continue;
if(XGetTransientForHint(awesomeconf->display, wins[i], &d1)
&& (wa.map_state == IsViewable || getstate(awesomeconf->display, wins[i]) == IconicState))
&& (wa.map_state == IsViewable || window_getstate(awesomeconf->display, wins[i]) == IconicState))
{
if(screen == 0)
real_screen = get_screen_bycoord(awesomeconf->display, wa.x, wa.y);

View File

@ -243,7 +243,6 @@ ban(Client * c)
{
XUnmapWindow(c->display, c->win);
window_setstate(c->display, c->win, IconicState);
c->unmapped = True;
}
/** Configure client
@ -268,6 +267,30 @@ window_configure(Display *disp, Window win, int x, int y, int w, int h, int bord
XSendEvent(disp, win, False, StructureNotifyMask, (XEvent *) & ce);
}
/** Get a window state (WM_STATE)
* \param disp Display ref
* \param w Client window
* \return state
*/
long
window_getstate(Display *disp, Window w)
{
int format, status;
long result = -1;
unsigned char *p = NULL;
unsigned long n, extra;
Atom real;
status = XGetWindowProperty(disp, w, XInternAtom(disp, "WM_STATE", False),
0L, 2L, False, XInternAtom(disp, "WM_STATE", False),
&real, &format, &n, &extra, (unsigned char **) &p);
if(status != Success)
return -1;
if(n != 0)
result = *p;
p_delete(&p);
return result;
}
/** Attach client after another one
* \param client to attach to
* \param c the client
@ -613,7 +636,6 @@ unban(Client *c)
{
XMapWindow(c->display, c->win);
window_setstate(c->display, c->win, NormalState);
c->unmapped = False;
}
void
@ -622,7 +644,6 @@ unmanage(Client *c, long state, awesome_config *awesomeconf)
XWindowChanges wc;
client_untab(c);
c->unmapped = True;
wc.border_width = c->oldborder;
/* The server grab construct avoids race conditions. */
XGrabServer(c->display);

View File

@ -34,6 +34,7 @@ inline void client_detach(Client **, Client *);
void client_reattach_after(Client *, Client *);
void ban(Client *); /* bans c */
void window_configure(Display *, Window, int, int, int, int, int);
long window_getstate(Display *, Window);
void focus(Client *, Bool, awesome_config *);
void manage(Window, XWindowAttributes *, awesome_config *);
void resize(Client *, int, int, int, int, awesome_config *, Bool); /* resize with given coordinates c */

View File

@ -104,8 +104,6 @@ struct Client
int rx, ry, rw, rh;
int basew, baseh, incw, inch, maxw, maxh, minw, minh;
int minax, maxax, minay, maxay;
/** True if client is unmapped */
Bool unmapped;
long flags;
int border, oldborder;
/** Store previous floating state before maximizing */

View File

@ -501,7 +501,8 @@ handle_event_unmapnotify(XEvent * e, awesome_config *awesomeconf)
XUnmapEvent *ev = &e->xunmap;
if((c = get_client_bywin(*awesomeconf->clients, ev->window))
&& ev->event == RootWindow(e->xany.display, c->phys_screen) && (ev->send_event || !c->unmapped))
&& ev->event == RootWindow(e->xany.display, c->phys_screen)
&& ev->send_event && window_getstate(c->display, c->win) == NormalState)
unmanage(c, WithdrawnState, &awesomeconf[c->screen]);
}