Fix client_gb functions

This commit is contained in:
Martin Duquesnoy 2012-03-08 15:54:37 +01:00
parent f5f97fc442
commit 0d0cb3190a
3 changed files with 32 additions and 15 deletions

View File

@ -23,7 +23,7 @@ barwin_new(Window parent, int x, int y, int w, int h, Color fg, Color bg, bool e
struct barwin *b = (struct barwin*)xcalloc(1, sizeof(struct barwin));
XSetWindowAttributes at =
{
.override_redirect = True,
.override_redirect = true,
.background_pixmap = ParentRelative,
.event_mask = BARWIN_MASK
};

View File

@ -113,10 +113,15 @@ client_gb_win(Window w)
{
struct client *c = SLIST_FIRST(&W->h.client);
while(c && c->win != w)
c = SLIST_NEXT(c, next);
while(c)
{
if(c->win == w)
return c;
return c;
c = SLIST_NEXT(c, next);
}
return NULL;
}
struct client*
@ -124,10 +129,15 @@ client_gb_frame(Window w)
{
struct client *c = SLIST_FIRST(&W->h.client);
while(c && c->frame != w)
c = SLIST_NEXT(c, next);
while(c)
{
if(c->frame == w)
return c;
return c;
c = SLIST_NEXT(c, next);
}
return NULL;
}
struct client*
@ -147,10 +157,18 @@ client_gb_titlebar(Window w)
{
struct client *c = SLIST_FIRST(&W->h.client);
while(c && c->titlebar && c->titlebar->win != w)
c = SLIST_NEXT(c, next);
if(!c->titlebar)
return NULL;
return c;
while(c && c->titlebar->win != w)
{
if(c->titlebar->win == w)
return c;
c = SLIST_NEXT(c, next);
}
return NULL;
}
/*

View File

@ -176,13 +176,11 @@ mouse_move(struct client *c, void (*func)(struct client*, struct client*))
}
else
{
c2 = NULL;
XQueryPointer(W->dpy, W->root, &w, &w, &d, &d, &d, &d, (uint *)&u);
if(!(c2 = client_gb_win(w)))
if(!(c2 = client_gb_frame(w)))
c2 = client_gb_titlebar(w);
if(c2)
if((c2 = client_gb_win(w)) || (c2 = client_gb_frame(w)) || (c2 = client_gb_titlebar(w)))
{
if(c2 != last)
{
@ -240,4 +238,5 @@ uicb_mouse_tab(Uicb cmd)
if(W->client && mouse_check_client(W->client))
mouse_move(W->client, _client_tab);
}