if (cit == c) break;
if (client_normal(cit) == client_normal(c) &&
- cit->layer == c->layer &&
- frame_visible(cit->frame) &&
- !client_search_transient(c, cit))
+ cit->layer == c->layer &&
+ cit->frame->visible &&
+ !client_search_transient(c, cit))
{
if (RECT_INTERSECTS_RECT(cit->frame->area, c->frame->area)) {
raise = TRUE;
old = self->wmstate;
- if (self->shaded || self->iconic || !frame_visible(self->frame))
+ if (self->shaded || !self->frame->visible)
self->wmstate = IconicState;
else
self->wmstate = NormalState;
if (changed) {
client_change_state(self);
- if (iconic) {
- if (ob_state() != OB_STATE_STARTING && config_animate_iconify) {
- /* delay the showhide until the window is done the animation */
- frame_begin_iconify_animation
- (self->frame, iconic,
- (ObFrameIconifyAnimateFunc)client_showhide, self);
- /* but focus a new window now please */
- focus_fallback(FALSE);
- } else
- client_showhide(self);
- } else {
- if (config_animate_iconify)
- /* the animation will show the window when it is hidden,
- but the window state needs to be adjusted after the
- animation finishes, so call showhide when it's done to make
- sure everything is updated appropriately
- */
- frame_begin_iconify_animation
- (self->frame, iconic,
- (ObFrameIconifyAnimateFunc)client_showhide, self);
- }
+ if (ob_state() != OB_STATE_STARTING && config_animate_iconify)
+ frame_begin_iconify_animation(self->frame, iconic);
+ /* do this after starting the animation so it doesn't flash */
+ client_showhide(self);
}
/* iconify all direct transients, and deiconify all transients
/* choose the correct target */
self = client_focus_target(self);
- if (!frame_visible(self->frame))
+ if (!self->frame->visible)
return FALSE;
if (!(self->can_focus || self->focus_notify))
self = client_focus_target(self);
if (!client_can_focus(self)) {
- if (!frame_visible(self->frame)) {
+ if (!self->frame->visible) {
/* update the focus lists */
focus_order_to_top(self);
}
client_set_desktop(self, screen_desktop, FALSE);
else
screen_set_desktop(self->desktop);
- } else if (!frame_visible(self->frame))
+ } else if (!self->frame->visible)
/* if its not visible for other reasons, then don't mess
with it */
return;
for (it = stacking_list; it; it = g_list_next(it)) {
if (WINDOW_IS_CLIENT(it->data)) {
ObClient *c = WINDOW_AS_CLIENT(it->data);
- if (frame_visible(c->frame) &&
+ if (c->frame->visible &&
/* ignore all animating windows */
!frame_iconify_animating(c->frame) &&
RECT_CONTAINS(c->frame->area, x, y))
{
/* the frame may not be "visible" but they can still click on it
in the case where it is animating before disappearing */
- if (client && frame_visible(client->frame))
+ if (client && client->frame->visible)
mouse_event(client, e);
} else if (e->type == KeyPress) {
keyboard_event((focus_cycle_target ? focus_cycle_target :
{
if (self->visible) {
self->visible = FALSE;
- self->client->ignore_unmaps += 1;
+ if (!frame_iconify_animating(self))
+ XUnmapWindow(ob_display, self->window);
/* we unmap the client itself so that we can get MapRequest
events, and because the ICCCM tells us to! */
- XUnmapWindow(ob_display, self->window);
XUnmapWindow(ob_display, self->client->window);
+ self->client->ignore_unmaps += 1;
}
}
/* see if there is an animation going */
if (self->iconify_animation_going == 0) return;
- /* call the callback when it's done */
- if (self->iconify_animation_cb)
- self->iconify_animation_cb(self->iconify_animation_data);
+ if (!self->visible)
+ XUnmapWindow(ob_display, self->window);
+
/* we're not animating any more ! */
self->iconify_animation_going = 0;
- /* move after the callback for the animation ending */
XMoveResizeWindow(ob_display, self->window,
self->area.x, self->area.y,
self->area.width - self->bwidth * 2,
XFlush(ob_display);
}
-void frame_begin_iconify_animation(ObFrame *self, gboolean iconifying,
- ObFrameIconifyAnimateFunc callback,
- gpointer data)
+void frame_begin_iconify_animation(ObFrame *self, gboolean iconifying)
{
gulong time;
gboolean new_anim = FALSE;
/* if there is no titlebar, just don't animate for now
XXX it would be nice tho.. */
- if (!(self->decorations & OB_FRAME_DECOR_TITLEBAR)) {
- if (callback) callback(data);
+ if (!(self->decorations & OB_FRAME_DECOR_TITLEBAR))
return;
- }
/* get the current time */
g_get_current_time(&now);
new_anim = TRUE;
self->iconify_animation_going = iconifying ? 1 : -1;
- self->iconify_animation_cb = callback;
- self->iconify_animation_data = data;
-
/* set the ending time */
if (set_end) {
self->iconify_animation_end.tv_sec = now.tv_sec;
/* do the first step */
frame_animate_iconify(self);
+ /* show it during the animation even if it is not "visible" */
if (!self->visible)
- frame_show(self);
+ XMapWindow(ob_display, self->window);
}
}
-
-gboolean frame_visible(ObFrame *self)
-{
- /* if it is animating back from iconic state then it is considered
- visible. but if it is iconifying then it is not visible. */
- return self->visible && self->iconify_animation_going <= 0;
-}
Strut size;
Rect area;
- /*! Is the frame visible? Don't read this directly ! Use frame_visible()
- instead, because that takes into account if the frame is visible but
- animating to the iconic (invisible) state. */
gboolean visible;
guint decorations;
*/
gint iconify_animation_going;
GTimeVal iconify_animation_end;
- ObFrameIconifyAnimateFunc iconify_animation_cb;
- gpointer iconify_animation_data;
};
ObFrame *frame_new(struct _ObClient *c);
/*! Start an animation for iconifying or restoring a frame. The callback
will be called when the animation finishes. But if another animation is
started in the meantime, the callback will never get called. */
-void frame_begin_iconify_animation(ObFrame *self, gboolean iconifying,
- ObFrameIconifyAnimateFunc callback,
- gpointer data);
+void frame_begin_iconify_animation(ObFrame *self, gboolean iconifying);
void frame_end_iconify_animation(ObFrame *self);
-/* Returns true if the frame is visible (but false if it is only visible
- because it is animating */
-gboolean frame_visible(ObFrame *self);
-
#define frame_iconify_animating(f) (f->iconify_animation_going != 0)
#endif
moving = (cnr == prop_atoms.net_wm_moveresize_move ||
cnr == prop_atoms.net_wm_moveresize_move_keyboard);
- if (moveresize_in_progress || !frame_visible(c->frame) ||
+ if (moveresize_in_progress || !c->frame->visible ||
!(moving ?
(c->functions & OB_CLIENT_FUNC_MOVE) :
(c->functions & OB_CLIENT_FUNC_RESIZE)))
} ObSmartType;
#define SMART_IGNORE(placer, c) \
- (placer == c || c->shaded || !client_normal(c) || \
- !frame_visible(c->frame) || \
+ (placer == c || c->shaded || !client_normal(c) || !c->frame->visible || \
(c->desktop != DESKTOP_ALL && \
c->desktop != (placer->desktop == DESKTOP_ALL ? \
screen_desktop : placer->desktop)))
target = it->data;
/* don't snap to self or non-visibles */
- if (!frame_visible(target->frame) || target == c) continue;
+ if (!target->frame->visible || target == c) continue;
/* don't snap to windows in layers beneath */
if(target->layer < c->layer && !config_resist_layers_below)
target = it->data;
/* don't snap to invisibles or ourself */
- if (!frame_visible(target->frame) || target == c) continue;
+ if (!target->frame->visible || target == c) continue;
/* don't snap to windows in layers beneath */
if(target->layer < c->layer && !config_resist_layers_below)