save windows' colormaps rather than querying them from the server every time you focus it
This commit is contained in:
parent
3595da62ca
commit
7ae95e4660
4 changed files with 32 additions and 12 deletions
|
@ -49,7 +49,8 @@
|
||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
|
|
||||||
/*! The event mask to grab on client windows */
|
/*! The event mask to grab on client windows */
|
||||||
#define CLIENT_EVENTMASK (PropertyChangeMask | StructureNotifyMask)
|
#define CLIENT_EVENTMASK (PropertyChangeMask | StructureNotifyMask | \
|
||||||
|
ColormapChangeMask)
|
||||||
|
|
||||||
#define CLIENT_NOPROPAGATEMASK (ButtonPressMask | ButtonReleaseMask | \
|
#define CLIENT_NOPROPAGATEMASK (ButtonPressMask | ButtonReleaseMask | \
|
||||||
ButtonMotionMask)
|
ButtonMotionMask)
|
||||||
|
@ -75,6 +76,7 @@ static void client_get_shaped(ObClient *self);
|
||||||
static void client_get_mwm_hints(ObClient *self);
|
static void client_get_mwm_hints(ObClient *self);
|
||||||
static void client_get_gravity(ObClient *self);
|
static void client_get_gravity(ObClient *self);
|
||||||
static void client_get_client_machine(ObClient *self);
|
static void client_get_client_machine(ObClient *self);
|
||||||
|
static void client_get_colormap(ObClient *self);
|
||||||
static void client_change_allowed_actions(ObClient *self);
|
static void client_change_allowed_actions(ObClient *self);
|
||||||
static void client_change_state(ObClient *self);
|
static void client_change_state(ObClient *self);
|
||||||
static void client_change_wm_state(ObClient *self);
|
static void client_change_wm_state(ObClient *self);
|
||||||
|
@ -939,6 +941,7 @@ static void client_get_all(ObClient *self)
|
||||||
client_setup_decor_and_functions(self);
|
client_setup_decor_and_functions(self);
|
||||||
|
|
||||||
client_get_client_machine(self);
|
client_get_client_machine(self);
|
||||||
|
client_get_colormap(self);
|
||||||
client_update_title(self);
|
client_update_title(self);
|
||||||
client_update_class(self);
|
client_update_class(self);
|
||||||
client_update_sm_client_id(self);
|
client_update_sm_client_id(self);
|
||||||
|
@ -1310,6 +1313,19 @@ static void client_get_gravity(ObClient *self)
|
||||||
self->gravity = wattrib.win_gravity;
|
self->gravity = wattrib.win_gravity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void client_get_colormap(ObClient *self)
|
||||||
|
{
|
||||||
|
XWindowAttributes wa;
|
||||||
|
|
||||||
|
if (XGetWindowAttributes(ob_display, self->window, &wa))
|
||||||
|
client_update_colormap(self, wa.colormap);
|
||||||
|
}
|
||||||
|
|
||||||
|
void client_update_colormap(ObClient *self, Colormap colormap)
|
||||||
|
{
|
||||||
|
self->colormap = colormap;
|
||||||
|
}
|
||||||
|
|
||||||
void client_update_normal_hints(ObClient *self)
|
void client_update_normal_hints(ObClient *self)
|
||||||
{
|
{
|
||||||
XSizeHints size;
|
XSizeHints size;
|
||||||
|
|
|
@ -194,6 +194,9 @@ struct _ObClient
|
||||||
/*! Window decoration and functionality hints */
|
/*! Window decoration and functionality hints */
|
||||||
ObMwmHints mwmhints;
|
ObMwmHints mwmhints;
|
||||||
|
|
||||||
|
/*! The client's specified colormap */
|
||||||
|
Colormap colormap;
|
||||||
|
|
||||||
/*! Where to place the decorated window in relation to the undecorated
|
/*! Where to place the decorated window in relation to the undecorated
|
||||||
window */
|
window */
|
||||||
gint gravity;
|
gint gravity;
|
||||||
|
@ -543,6 +546,8 @@ void client_update_transient_for(ObClient *self);
|
||||||
/*! Update the protocols that the window supports and adjusts things if they
|
/*! Update the protocols that the window supports and adjusts things if they
|
||||||
change */
|
change */
|
||||||
void client_update_protocols(ObClient *self);
|
void client_update_protocols(ObClient *self);
|
||||||
|
/*! Updates the window's colormap */
|
||||||
|
void client_update_colormap(ObClient *self, Colormap colormap);
|
||||||
/*! Updates the WMNormalHints and adjusts things if they change */
|
/*! Updates the WMNormalHints and adjusts things if they change */
|
||||||
void client_update_normal_hints(ObClient *self);
|
void client_update_normal_hints(ObClient *self);
|
||||||
|
|
||||||
|
|
|
@ -1175,6 +1175,9 @@ static void event_handle_client(ObClient *client, XEvent *e)
|
||||||
else if (msgtype == prop_atoms.sm_client_id) {
|
else if (msgtype == prop_atoms.sm_client_id) {
|
||||||
client_update_sm_client_id(client);
|
client_update_sm_client_id(client);
|
||||||
}
|
}
|
||||||
|
case ColormapNotify:
|
||||||
|
client_update_colormap(client, e->xcolormap.colormap);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
;
|
;
|
||||||
#ifdef SHAPE
|
#ifdef SHAPE
|
||||||
|
|
|
@ -907,23 +907,19 @@ void screen_show_desktop(gboolean show)
|
||||||
|
|
||||||
void screen_install_colormap(ObClient *client, gboolean install)
|
void screen_install_colormap(ObClient *client, gboolean install)
|
||||||
{
|
{
|
||||||
XWindowAttributes wa;
|
|
||||||
|
|
||||||
if (client == NULL) {
|
if (client == NULL) {
|
||||||
if (install)
|
if (install)
|
||||||
XInstallColormap(RrDisplay(ob_rr_inst), RrColormap(ob_rr_inst));
|
XInstallColormap(RrDisplay(ob_rr_inst), RrColormap(ob_rr_inst));
|
||||||
else
|
else
|
||||||
XUninstallColormap(RrDisplay(ob_rr_inst), RrColormap(ob_rr_inst));
|
XUninstallColormap(RrDisplay(ob_rr_inst), RrColormap(ob_rr_inst));
|
||||||
} else {
|
} else {
|
||||||
if (XGetWindowAttributes(ob_display, client->window, &wa) &&
|
xerror_set_ignore(TRUE);
|
||||||
wa.colormap != None) {
|
if (install) {
|
||||||
xerror_set_ignore(TRUE);
|
if (client->colormap != None)
|
||||||
if (install)
|
XInstallColormap(RrDisplay(ob_rr_inst), client->colormap);
|
||||||
XInstallColormap(RrDisplay(ob_rr_inst), wa.colormap);
|
} else
|
||||||
else
|
XUninstallColormap(RrDisplay(ob_rr_inst), client->colormap);
|
||||||
XUninstallColormap(RrDisplay(ob_rr_inst), wa.colormap);
|
xerror_set_ignore(FALSE);
|
||||||
xerror_set_ignore(FALSE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue