Cleanups around colormap installation during focus switch.

SVN revision: 47260
This commit is contained in:
Kim Woelders 2010-03-15 22:19:00 +00:00
parent 162f959afc
commit ae1e289a62
3 changed files with 47 additions and 50 deletions

View File

@ -154,7 +154,6 @@ EwinGetAttributes(EWin * ewin, Win win, Window xwin)
ewin->client.w = ewin->save_max.w = ewin->save_fs.w = xwa.width;
ewin->client.h = ewin->save_max.h = ewin->save_fs.h = xwa.height;
ewin->client.bw = xwa.border_width;
ewin->client.cmap = xwa.colormap;
if (EDebug(EDBUG_TYPE_SNAPS))
Eprintf("Snap get attr %#lx: %4d+%4d %4dx%4d: %s\n",

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
* Copyright (C) 2004-2009 Kim Woelders
* Copyright (C) 2004-2010 Kim Woelders
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
@ -74,7 +74,6 @@ struct _ewin {
struct {
Win win;
int x, y, w, h, bw;
Colormap cmap;
long event_mask;
} client;

View File

@ -43,6 +43,8 @@ ICCCM_Init(void)
ecore_x_icccm_init();
#endif
Mode.current_cmap = WinGetCmap(VROOT);
ICCCM_SetIconSizes();
if (Mode.wm.window)
@ -95,17 +97,6 @@ ICCCM_GetTitle(EWin * ewin)
EwinChange(ewin, EWIN_CHANGE_NAME);
}
static void
ICCCM_GetColormap(EWin * ewin)
{
XWindowAttributes xwa;
ewin->client.cmap = None;
if (XGetWindowAttributes(disp, EwinGetClientXwin(ewin), &xwa)
&& xwa.colormap)
ewin->client.cmap = xwa.colormap;
}
void
ICCCM_Delete(const EWin * ewin)
{
@ -328,49 +319,57 @@ ICCCM_Adopt(const EWin * ewin)
void
ICCCM_Cmap(EWin * ewin)
{
Colormap ecmap, dcmap, ccmap;
XWindowAttributes xwa;
int i, num;
Ecore_X_Window *wlist;
ecmap = Mode.current_cmap;
dcmap = WinGetCmap(VROOT);
if (!ewin)
{
if (Mode.current_cmap)
if (ecmap == dcmap)
return;
ccmap = dcmap;
goto set_cmap;
}
ccmap = EwinGetClientWin(ewin)->cmap;
if (ccmap == ecmap || EoGetWin(ewin)->argb)
return;
/* Hack - assume that if client cmap is default cmap it doesn't have
* WM_COLORMAP_WINDOWS */
if (ccmap == dcmap)
goto set_cmap;
num = ecore_x_window_prop_window_list_get(EwinGetClientXwin(ewin),
ECORE_X_ATOM_WM_COLORMAP_WINDOWS,
&wlist);
if (num > 0)
{
for (i = 0; i < num; i++)
{
XUninstallColormap(disp, Mode.current_cmap);
Mode.current_cmap = 0;
if (XGetWindowAttributes(disp, wlist[i], &xwa))
{
if (xwa.colormap != dcmap)
{
XInstallColormap(disp, xwa.colormap);
Mode.current_cmap = xwa.colormap;
}
}
}
Efree(wlist);
return;
}
if (EwinIsInternal(ewin))
return;
ICCCM_GetColormap(ewin);
if ((ewin->client.cmap) && (Mode.current_cmap != ewin->client.cmap))
{
XWindowAttributes xwa;
int i, num;
Ecore_X_Window *wlist;
num = ecore_x_window_prop_window_list_get(EwinGetClientXwin(ewin),
ECORE_X_ATOM_WM_COLORMAP_WINDOWS,
&wlist);
if (num > 0)
{
for (i = 0; i < num; i++)
{
if (XGetWindowAttributes(disp, wlist[i], &xwa))
{
if (xwa.colormap != WinGetCmap(VROOT))
{
XInstallColormap(disp, xwa.colormap);
Mode.current_cmap = xwa.colormap;
}
}
}
Efree(wlist);
return;
}
XInstallColormap(disp, ewin->client.cmap);
Mode.current_cmap = ewin->client.cmap;
}
set_cmap:
if (EDebug(EDBUG_TYPE_FOCUS))
Eprintf("ICCCM_Cmap %#lx\n", ccmap);
XInstallColormap(disp, ccmap);
Mode.current_cmap = ccmap;
}
void