X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fclient.c;h=a9a9eb5fa1c88e9370ecca098fce4f372b22f10a;hb=795d90c3bc57eaf2c98c447f3af5c1c9e7a52fa3;hp=d1890956e93eade10c06e4f009da0bd5e30798f0;hpb=f7b687487cf26042ac79f2587fb1eaf1760a7a0b;p=chaz%2Fopenbox diff --git a/openbox/client.c b/openbox/client.c index d1890956..a9a9eb5f 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -1,5 +1,6 @@ #include "client.h" #include "dock.h" +#include "xerror.h" #include "startup.h" #include "screen.h" #include "moveresize.h" @@ -1362,6 +1363,7 @@ void client_update_icons(Client *self) if (num == 2) { self->nicons++; self->icons = g_new(Icon, self->nicons); + xerror_set_ignore(TRUE); if (!render_pixmap_to_rgba(data[0], data[1], &self->icons[self->nicons-1].width, &self->icons[self->nicons-1].height, @@ -1369,6 +1371,7 @@ void client_update_icons(Client *self) g_free(&self->icons[self->nicons-1]); self->nicons--; } + xerror_set_ignore(FALSE); } g_free(data); } else { @@ -1378,6 +1381,7 @@ void client_update_icons(Client *self) if (hints->flags & IconPixmapHint) { self->nicons++; self->icons = g_new(Icon, self->nicons); + xerror_set_ignore(TRUE); if (!render_pixmap_to_rgba(hints->icon_pixmap, (hints->flags & IconMaskHint ? hints->icon_mask : None), @@ -1387,6 +1391,7 @@ void client_update_icons(Client *self) g_free(&self->icons[self->nicons-1]); self->nicons--; } + xerror_set_ignore(FALSE); } XFree(hints); } @@ -2234,18 +2239,15 @@ Client *client_focus_target(Client *self) return self; } -gboolean client_focus(Client *self) +gboolean client_can_focus(Client *self) { XEvent ev; /* choose the correct target */ self = client_focus_target(self); - if (!self->frame->visible) { - /* update the focus lists */ - focus_order_to_top(self); + if (!self->frame->visible) return FALSE; - } if (!((self->can_focus || self->focus_notify) && (self->desktop == screen_desktop || @@ -2271,6 +2273,22 @@ gboolean client_focus(Client *self) } } + return TRUE; +} + +gboolean client_focus(Client *self) +{ + /* choose the correct target */ + self = client_focus_target(self); + + if (!client_can_focus(self)) { + if (!self->frame->visible) { + /* update the focus lists */ + focus_order_to_top(self); + } + return FALSE; + } + if (self->can_focus) /* RevertToPointerRoot causes much more headache than RevertToNone, so I choose to use it always, hopefully to find errors quicker, if any