speed up workspace switching by causing the minimal number of expose events (none for the hiding windows!)

This commit is contained in:
Dana Jansens 2003-03-17 02:03:45 +00:00
parent 432ac0983e
commit 216a04bdd0
3 changed files with 43 additions and 21 deletions

View file

@ -204,7 +204,7 @@ void client_manage(Window window)
HOOKFIRECLIENT(managed, client); HOOKFIRECLIENT(managed, client);
client_showhide(client, TRUE); client_showhide(client);
/* grab all mouse bindings */ /* grab all mouse bindings */
pointer_grab_all(client, TRUE); pointer_grab_all(client, TRUE);
@ -1223,21 +1223,25 @@ void client_calc_layer(Client *self)
} }
} }
void client_showhide(Client *self, gboolean firehook) gboolean client_should_show(Client *self)
{ {
gboolean show; if (self->iconic) return FALSE;
if (self->iconic) show = FALSE;
else if (!(self->desktop == screen_desktop || else if (!(self->desktop == screen_desktop ||
self->desktop == DESKTOP_ALL)) show = FALSE; self->desktop == DESKTOP_ALL)) return FALSE;
else if (client_normal(self) && screen_showing_desktop) show = FALSE; else if (client_normal(self) && screen_showing_desktop) return FALSE;
else show = TRUE;
if (show) engine_frame_show(self->frame); return TRUE;
else engine_frame_hide(self->frame); }
if (firehook) void client_showhide(Client *self)
HOOKFIRECLIENT(visible, self); {
if (client_should_show(self))
engine_frame_show(self->frame);
else
engine_frame_hide(self->frame);
HOOKFIRECLIENT(visible, self);
} }
gboolean client_normal(Client *self) { gboolean client_normal(Client *self) {
@ -1491,7 +1495,7 @@ void client_iconify(Client *self, gboolean iconic, gboolean curdesk)
XMapWindow(ob_display, self->window); XMapWindow(ob_display, self->window);
} }
client_change_state(self); client_change_state(self);
client_showhide(self, TRUE); client_showhide(self);
screen_update_struts(); screen_update_struts();
} }
@ -1657,7 +1661,7 @@ void client_set_desktop(Client *self, unsigned int target)
/* the frame can display the current desktop state */ /* the frame can display the current desktop state */
engine_frame_adjust_state(self->frame); engine_frame_adjust_state(self->frame);
/* 'move' the window to the new desktop */ /* 'move' the window to the new desktop */
client_showhide(self, TRUE); client_showhide(self);
screen_update_struts(); screen_update_struts();
} }

View file

@ -309,7 +309,12 @@ void client_remaximize(Client *self);
/*! Shows the window if it should be shown, or hides it /*! Shows the window if it should be shown, or hides it
Used when changing desktops, the window's state, etc. */ Used when changing desktops, the window's state, etc. */
void client_showhide(Client *self, gboolean firehook); void client_showhide(Client *self);
/*! Determines if the client should be shown or hidden currently.
@return TRUE if it should be visible; otherwise, FALSE.
*/
gboolean client_should_show(Client *self);
/*! Returns if the window should be treated as a normal window. /*! Returns if the window should be treated as a normal window.
Some windows (desktops, docks, splash screens) have special rules applied Some windows (desktops, docks, splash screens) have special rules applied

View file

@ -2,6 +2,8 @@
#include "prop.h" #include "prop.h"
#include "screen.h" #include "screen.h"
#include "client.h" #include "client.h"
#include "frame.h"
#include "engine.h"
#include "focus.h" #include "focus.h"
#include <X11/Xlib.h> #include <X11/Xlib.h>
@ -251,8 +253,19 @@ void screen_set_desktop(guint num)
if (old == num) return; if (old == num) return;
for (it = stacking_list; it != NULL; it = it->next) /* hide windows from bottom to top */
client_showhide(it->data, FALSE); for (it = g_list_last(stacking_list); it != NULL; it = it->prev) {
Client *c = it->data;
if (c->frame->visible && !client_should_show(c))
engine_frame_hide(c->frame);
}
/* show windows from top to bottom */
for (it = stacking_list; it != NULL; it = it->next) {
Client *c = it->data;
if (!c->frame->visible && client_should_show(c))
engine_frame_show(c->frame);
}
/* force the callbacks to fire */ /* force the callbacks to fire */
if (focus_client == NULL) if (focus_client == NULL)
@ -356,15 +369,15 @@ void screen_show_desktop(gboolean show)
Client *client = it->data; Client *client = it->data;
if (client->type == Type_Desktop) if (client->type == Type_Desktop)
client_focus(client); client_focus(client);
else else if (client->frame->visible && !client_should_show(client))
client_showhide(client, FALSE); engine_frame_hide(client->frame);
} }
} else { } else {
/* top to bottom */ /* top to bottom */
for (it = stacking_list; it != NULL; it = it->next) { for (it = stacking_list; it != NULL; it = it->next) {
Client *client = it->data; Client *client = it->data;
if (client->type != Type_Desktop) if (!client->frame->visible && client_should_show(client))
client_showhide(client, FALSE); engine_frame_show(client->frame);
} }
} }