Fix using e16 with xcompmgr.

Various fixes around handling of _NET_WM_WINDOW_OPACITY.
- Propagate client window changes to frame window.
- Let zero value mean "do the default", i.e. use focused/unfocused config values.
- Only set client window property if opacity is set explicitly
  (matches, snaps, or ipc).

SVN revision: 84319
This commit is contained in:
Kim Woelders 2013-02-23 11:35:49 +00:00
parent e00b691454
commit d4f1cd6a78
11 changed files with 58 additions and 31 deletions

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
* Copyright (C) 2006-2011 Kim Woelders
* Copyright (C) 2006-2013 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,7 @@ _CoordsShow(EWin * ewin, int mode)
case 1:
Esnprintf(s, sizeof(s), _("Focused/unfocused opacity: %d/%d %%"),
OpacityToPercent(ewin->props.focused_opacity),
OpacityToPercent(ewin->ewmh.opacity));
OpacityToPercent(ewin->props.opacity));
break;
}
TextSize(tc, 0, 0, 0, s, &cw, &ch, 17);

View File

@ -1682,7 +1682,8 @@ EwinOpSetOpacity(EWin * ewin, int source __UNUSED__, int opacity)
unsigned int op;
op = OpacityFromPercent(opacity);
ewin->ewmh.opacity = op;
ewin->props.opacity = op;
ewin->ewmh.opacity_update = 1; /* Set opacity on client window */
HintsSetWindowOpacity(ewin);
EwinUpdateOpacity(ewin);
SnapshotEwinUpdate(ewin, SNAP_USE_OPACITY);

View File

@ -116,9 +116,6 @@ EwinCreate(int type)
ewin->place.gravity = -1;
ewin->ewmh.opacity = 0; /* If 0, ignore */
ewin->props.focused_opacity = 0;
return ewin;
}
@ -1990,7 +1987,7 @@ EwinUpdateOpacity(EWin * ewin)
else if (ewin->state.active)
opacity = ewin->props.focused_opacity;
if (opacity == 0)
opacity = ewin->ewmh.opacity;
opacity = ewin->props.opacity;
if (opacity == 0)
opacity = ewin->state.active ?
OpacityFromPercent(Conf.opacity.focused) :
@ -2054,7 +2051,8 @@ EwinChangesProcess(EWin * ewin)
if (EWinChanges.flags & EWIN_CHANGE_OPACITY)
{
EoChangeOpacity(ewin, ewin->ewmh.opacity);
EwinUpdateOpacity(ewin);
HintsSetWindowOpacity(ewin);
SnapshotEwinUpdate(ewin, SNAP_USE_OPACITY);
}

View File

@ -132,6 +132,7 @@ struct _ewin {
} state;
struct {
/* User config */
unsigned int opacity;
unsigned int focused_opacity;
unsigned never_use_area:1;
unsigned ignorearrange:1;
@ -210,6 +211,7 @@ struct _ewin {
char *wm_icon_name;
unsigned int *wm_icon, wm_icon_len;
unsigned int opacity;
char opacity_update;
#if USE_XSYNC
char sync_request_enable;
XID sync_request_counter;

View File

@ -446,10 +446,35 @@ EWMH_SetWindowBorder(const EWin * ewin)
}
void
EWMH_SetWindowOpacity(const EWin * ewin)
EWMH_SetWindowOpacity(EWin * ewin)
{
ecore_x_netwm_opacity_set(EwinGetClientXwin(ewin), ewin->ewmh.opacity);
ecore_x_netwm_opacity_set(EoGetXwin(ewin), ewin->ewmh.opacity);
unsigned int opacity;
if (!ewin->ewmh.opacity_update)
return;
opacity = ewin->props.opacity;
if (opacity != 0)
{
if (opacity != ewin->ewmh.opacity)
{
ewin->ewmh.opacity = opacity;
ecore_x_netwm_opacity_set(EwinGetClientXwin(ewin), opacity);
}
ecore_x_netwm_opacity_set(EoGetXwin(ewin), opacity);
}
else
{
if (opacity != ewin->ewmh.opacity)
{
ewin->ewmh.opacity = opacity;
ecore_x_window_prop_del(EwinGetClientXwin(ewin),
ECORE_X_ATOM_NET_WM_WINDOW_OPACITY);
}
ecore_x_window_prop_del(EoGetXwin(ewin),
ECORE_X_ATOM_NET_WM_WINDOW_OPACITY);
ewin->ewmh.opacity_update = 0;
}
}
/*
@ -689,17 +714,16 @@ EWMH_GetWindowMisc(EWin * ewin)
static void
EWMH_GetWindowOpacity(EWin * ewin)
{
int num;
unsigned int opacity;
num = ecore_x_netwm_opacity_get(EwinGetClientXwin(ewin), &opacity);
if (num <= 0)
return;
opacity = 0; /* Value zero is treated as unset, i.e. default */
ecore_x_netwm_opacity_get(EwinGetClientXwin(ewin), &opacity);
if (ewin->ewmh.opacity == opacity)
return;
ewin->ewmh.opacity_update = 1;
ewin->ewmh.opacity = opacity;
ewin->props.opacity = opacity;
EwinChange(ewin, EWIN_CHANGE_OPACITY);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2003-2011 Kim Woelders
* Copyright (C) 2003-2013 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
@ -237,7 +237,7 @@ HintsSetWindowState(const EWin * ewin)
}
void
HintsSetWindowOpacity(const EWin * ewin)
HintsSetWindowOpacity(EWin * ewin)
{
EWMH_SetWindowOpacity(ewin);
}

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
* Copyright (C) 2004-2011 Kim Woelders
* Copyright (C) 2004-2013 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
@ -67,7 +67,7 @@ void EWMH_SetWindowName(Window win, const char *name);
void EWMH_SetWindowDesktop(const EWin * ewin);
void EWMH_SetWindowState(const EWin * ewin);
void EWMH_SetWindowBorder(const EWin * ewin);
void EWMH_SetWindowOpacity(const EWin * ewin);
void EWMH_SetWindowOpacity(EWin * ewin);
void EWMH_SetWindowActions(const EWin * ewin);
void EWMH_GetWindowHints(EWin * ewin);
void EWMH_DelWindowHints(const EWin * ewin);
@ -112,7 +112,7 @@ void HintsSetWindowClass(Win win, const char *name,
void HintsSetWindowDesktop(const EWin * ewin);
void HintsSetWindowArea(const EWin * ewin);
void HintsSetWindowState(const EWin * ewin);
void HintsSetWindowOpacity(const EWin * ewin);
void HintsSetWindowOpacity(EWin * ewin);
void HintsSetWindowBorder(const EWin * ewin);
void HintsGetWindowHints(EWin * ewin);
void HintsDelWindowHints(const EWin * ewin);

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
* Copyright (C) 2004-2012 Kim Woelders
* Copyright (C) 2004-2013 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
@ -690,7 +690,7 @@ IpcWinop(const WinOp * wop, EWin * ewin, const char *prm)
break;
case EWIN_OP_OPACITY:
a = OpacityToPercent(ewin->ewmh.opacity);
a = OpacityToPercent(ewin->props.opacity);
if (!strcmp(param1, "?"))
{
IpcPrintf("opacity: %u\n", a);
@ -1153,7 +1153,7 @@ EwinShowInfo(const EWin * ewin)
ewin->state.iconified, EoIsSticky(ewin), ewin->state.shaded,
ewin->state.docked, ewin->state.state, EoIsShown(ewin),
ewin->state.visibility, ewin->state.active, ewin->num_groups,
OpacityToPercent(ewin->ewmh.opacity)
OpacityToPercent(ewin->props.opacity)
#if USE_COMPOSITE
, EoGetOpacity(ewin),
OpacityToPercent(ewin->props.focused_opacity), EoGetShadow(ewin),

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
* Copyright (C) 2004-2012 Kim Woelders
* Copyright (C) 2004-2013 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
@ -215,7 +215,7 @@ _MenuEwinInit(EWin * ewin)
ewin->icccm.grav = StaticGravity;
EoSetLayer(ewin, 12);
ewin->ewmh.opacity = OpacityFromPercent(Conf.opacity.menus);
ewin->props.opacity = OpacityFromPercent(Conf.opacity.menus);
}
static void

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
* Copyright (C) 2004-2012 Kim Woelders
* Copyright (C) 2004-2013 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
@ -447,7 +447,7 @@ _SnapUpdateEwinGroups(Snapshot * sn, const EWin * ewin, char onoff)
static void
_SnapUpdateEwinOpacity(Snapshot * sn, const EWin * ewin)
{
sn->opacity = OpacityToPercent(ewin->ewmh.opacity);
sn->opacity = OpacityToPercent(ewin->props.opacity);
sn->focused_opacity = OpacityToPercent(ewin->props.focused_opacity);
}
@ -1487,8 +1487,9 @@ SnapshotEwinApply(EWin * ewin)
{
sn->opacity = OpacityFix(sn->opacity, 0);
sn->focused_opacity = OpacityFix(sn->focused_opacity, 0);
ewin->ewmh.opacity = OpacityFromPercent(sn->opacity);
ewin->props.opacity = OpacityFromPercent(sn->opacity);
ewin->props.focused_opacity = OpacityFromPercent(sn->focused_opacity);
ewin->ewmh.opacity_update = 1; /* Set opacity on client window */
}
if (use_flags & SNAP_USE_SHADOW)

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
* Copyright (C) 2005-2012 Kim Woelders
* Copyright (C) 2005-2013 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
@ -712,7 +712,8 @@ WindowMatchEwinOpsAction(EWin * ewin, int op, const char *args)
case EWIN_OP_OPACITY:
a = atoi(args);
ewin->ewmh.opacity = OpacityFromPercent(OpacityFix(a, 0));
ewin->props.opacity = OpacityFromPercent(OpacityFix(a, 0));
ewin->ewmh.opacity_update = 1; /* Set opacity on client window */
break;
case EWIN_OP_FOCUSED_OPACITY: