all repos — openbox @ 378adaa94f0fac07dc65f0531e950c7ec8944cdf

openbox fork - make it a bit more like ryudo

yay. way way cleaner code for iconify animations. let people show/hide the frame logically and it will do everything except during animations the frame will show what it needs to for visual display.
Dana Jansens danakj@orodu.net
commit

378adaa94f0fac07dc65f0531e950c7ec8944cdf

parent

ac56fe1602af7f4a4ae5c10cfe83e3d9eaf02b4d

M openbox/action.copenbox/action.c

@@ -1263,9 +1263,9 @@ ObClient *cit = it->data;

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;
M openbox/client.copenbox/client.c

@@ -2061,7 +2061,7 @@ glong old;

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;

@@ -2724,27 +2724,10 @@ }

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

@@ -3188,7 +3171,7 @@

/* 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))

@@ -3221,7 +3204,7 @@ /* choose the correct target */

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); }

@@ -3306,7 +3289,7 @@ if (here)

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;

@@ -3733,7 +3716,7 @@ if (screen_pointer_pos(&x, &y)) {

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))
M openbox/event.copenbox/event.c

@@ -1386,7 +1386,7 @@ e->type == MotionNotify)

{ /* 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 :
M openbox/frame.copenbox/frame.c

@@ -258,11 +258,12 @@ void frame_hide(ObFrame *self)

{ 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; } }

@@ -1121,13 +1122,12 @@ {

/* 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,

@@ -1135,9 +1135,7 @@ self->area.height - 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;

@@ -1146,10 +1144,8 @@ GTimeVal now;

/* 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);

@@ -1166,9 +1162,6 @@ set_end = FALSE;

} else 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) {

@@ -1188,14 +1181,8 @@

/* 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; -}
M openbox/frame.hopenbox/frame.h

@@ -77,9 +77,6 @@ Window plate;

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;

@@ -154,8 +151,6 @@ < 0 means it is animating a restore.

*/ gint iconify_animation_going; GTimeVal iconify_animation_end; - ObFrameIconifyAnimateFunc iconify_animation_cb; - gpointer iconify_animation_data; }; ObFrame *frame_new(struct _ObClient *c);

@@ -195,14 +190,8 @@

/*! 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)
M openbox/moveresize.copenbox/moveresize.c

@@ -153,7 +153,7 @@

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)))
M openbox/place.copenbox/place.c

@@ -251,8 +251,7 @@ SMART_FOCUSED

} 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)))
M openbox/resist.copenbox/resist.c

@@ -57,7 +57,7 @@ continue;

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)

@@ -199,7 +199,7 @@ continue;

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)