Enlightenment CVS committal
Author : kwo
Project : e16
Module : e
Dir : e16/e/src
Modified Files:
ecompmgr.c eobj.c eobj.h ewin-ops.c ewin-ops.h ewins.c ewins.h
ipc.c snaps.c windowmatch.c
Log Message:
Enable setting focused/non-focused opacity independently.
- Based on patch from Grant Wier.
===================================================================
RCS file: /cvs/e/e16/e/src/ecompmgr.c,v
retrieving revision 1.128
retrieving revision 1.129
diff -u -3 -r1.128 -r1.129
--- ecompmgr.c 24 Oct 2006 21:40:51 -0000 1.128
+++ ecompmgr.c 3 Nov 2006 23:44:31 -0000 1.129
@@ -2198,10 +2198,10 @@
Mode_compmgr.shadow_mode = mode;
Conf_compmgr.shadows.blur.opacity =
- OpacityFix(Conf_compmgr.shadows.blur.opacity);
+ OpacityFix(Conf_compmgr.shadows.blur.opacity, 100);
Mode_compmgr.opac_blur = .01 * Conf_compmgr.shadows.blur.opacity;
Conf_compmgr.shadows.sharp.opacity =
- OpacityFix(Conf_compmgr.shadows.sharp.opacity);
+ OpacityFix(Conf_compmgr.shadows.sharp.opacity, 100);
Mode_compmgr.opac_sharp = .01 * Conf_compmgr.shadows.sharp.opacity;
if (gaussianMap)
@@ -2256,7 +2256,7 @@
Conf_compmgr.enable = Mode_compmgr.active = 1;
Conf_compmgr.override_redirect.opacity =
- OpacityFix(Conf_compmgr.override_redirect.opacity);
+ OpacityFix(Conf_compmgr.override_redirect.opacity, 100);
pa.subwindow_mode = IncludeInferiors;
pictfmt = XRenderFindVisualFormat(disp, VRoot.vis);
===================================================================
RCS file: /cvs/e/e16/e/src/eobj.c,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -3 -r1.83 -r1.84
--- eobj.c 8 Sep 2006 23:13:57 -0000 1.83
+++ eobj.c 3 Nov 2006 23:44:32 -0000 1.84
@@ -30,9 +30,11 @@
#include "xwin.h"
int
-OpacityFix(int op)
+OpacityFix(int op, int op_0)
{
- if (op <= 0 || op > 255)
+ if (op <= 0)
+ op = op_0;
+ else if (op > 255)
op = 100;
else if (op > 100) /* Hack to convert old 0-255 range */
op = (100 * op) / 255;
@@ -46,7 +48,7 @@
/* op is 0-100, extend to 32 bit */
/* op <= 0 and op > 100 is mapped to 100 (opaque) */
- if (op == 0 || op >= 100)
+ if (op >= 100)
return 0xffffffff;
return op * 42949672;
}
===================================================================
RCS file: /cvs/e/e16/e/src/eobj.h,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -3 -r1.35 -r1.36
--- eobj.h 7 Oct 2006 12:02:33 -0000 1.35
+++ eobj.h 3 Nov 2006 23:44:32 -0000 1.36
@@ -181,7 +181,7 @@
void EobjListOrderDel(EObj * eo);
/* Hmmm. */
-int OpacityFix(int op);
+int OpacityFix(int op, int op_0);
unsigned int OpacityFromPercent(int op);
int OpacityToPercent(unsigned int opacity);
===================================================================
RCS file: /cvs/e/e16/e/src/ewin-ops.c,v
retrieving revision 1.104
retrieving revision 1.105
diff -u -3 -r1.104 -r1.105
--- ewin-ops.c 29 Oct 2006 15:21:15 -0000 1.104
+++ ewin-ops.c 3 Nov 2006 23:44:32 -0000 1.105
@@ -45,6 +45,7 @@
{"kill", 0, 1, 0, EWIN_OP_KILL},
{"iconify", 2, 1, 1, EWIN_OP_ICONIFY},
{"opacity", 2, 1, 1, EWIN_OP_OPACITY},
+ {"focused_opacity", 0, 1, 1, EWIN_OP_FOCUSED_OPACITY},
{"shadow", 0, 1, 1, EWIN_OP_SHADOW}, /* Place before "shade" */
{"shade", 2, 1, 1, EWIN_OP_SHADE},
{"stick", 2, 1, 1, EWIN_OP_STICK},
@@ -1835,6 +1836,17 @@
op = OpacityFromPercent(opacity);
ewin->ewmh.opacity = op;
HintsSetWindowOpacity(ewin);
+ EwinUpdateOpacity(ewin);
+ SnapshotEwinUpdate(ewin, SNAP_USE_OPACITY);
+}
+
+void
+EwinOpSetFocusedOpacity(EWin * ewin, int source __UNUSED__, int opacity)
+{
+ unsigned int op;
+
+ op = OpacityFromPercent(opacity);
+ ewin->props.focused_opacity = op;
EwinUpdateOpacity(ewin);
SnapshotEwinUpdate(ewin, SNAP_USE_OPACITY);
}
===================================================================
RCS file: /cvs/e/e16/e/src/ewin-ops.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- ewin-ops.h 7 Oct 2006 12:02:33 -0000 1.8
+++ ewin-ops.h 3 Nov 2006 23:44:32 -0000 1.9
@@ -55,6 +55,7 @@
EWIN_OP_LOWER,
EWIN_OP_OPACITY,
+ EWIN_OP_FOCUSED_OPACITY,
EWIN_OP_SNAP,
===================================================================
RCS file: /cvs/e/e16/e/src/ewins.c,v
retrieving revision 1.176
retrieving revision 1.177
diff -u -3 -r1.176 -r1.177
--- ewins.c 3 Nov 2006 19:29:17 -0000 1.176
+++ ewins.c 3 Nov 2006 23:44:32 -0000 1.177
@@ -134,7 +134,7 @@
ewin->place.gravity = -1;
ewin->ewmh.opacity = 0; /* If 0, ignore */
- ewin->props.opaque_when_focused = 1;
+ ewin->props.focused_opacity = 0;
return ewin;
}
@@ -1798,11 +1798,12 @@
{
unsigned int opacity;
+ opacity = 0;
if (ewin->state.moving || ewin->state.resizing)
opacity = OpacityFromPercent(Conf.opacity.movres);
- else if (ewin->state.active && ewin->props.opaque_when_focused)
- opacity = 0xffffffff;
- else
+ else if (ewin->state.active)
+ opacity = ewin->props.focused_opacity;
+ if (opacity == 0)
opacity = ewin->ewmh.opacity;
EoChangeOpacity(ewin, opacity);
===================================================================
RCS file: /cvs/e/e16/e/src/ewins.h,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -3 -r1.57 -r1.58
--- ewins.h 26 Oct 2006 20:25:30 -0000 1.57
+++ ewins.h 3 Nov 2006 23:44:32 -0000 1.58
@@ -139,7 +139,7 @@
unsigned autosave:1;
unsigned no_border:1; /* Never apply border */
unsigned focus_when_mapped:1;
- unsigned opaque_when_focused:1;
+ unsigned int focused_opacity;
} props;
EWinInhibit inh_app;
EWinInhibit inh_user;
@@ -394,6 +394,8 @@
void EwinOpSetLayer(EWin * ewin, int source, int layer);
void EwinOpSetBorder(EWin * ewin, int source, const char *name);
void EwinOpSetOpacity(EWin * ewin, int source, int opacity);
+void EwinOpSetFocusedOpacity(EWin * ewin, int source,
+ int opacity);
void EwinOpMoveToDesk(EWin * ewin, int source, Desk * dsk,
int inc);
void EwinOpFullscreen(EWin * ewin, int source, int on);
===================================================================
RCS file: /cvs/e/e16/e/src/ipc.c,v
retrieving revision 1.278
retrieving revision 1.279
diff -u -3 -r1.278 -r1.279
--- ipc.c 7 Oct 2006 12:02:33 -0000 1.278
+++ ipc.c 3 Nov 2006 23:44:32 -0000 1.279
@@ -45,6 +45,17 @@
static char *bufptr;
static void
+OpacityTimeout(int val, void *data __UNUSED__)
+{
+ EWin *ewin;
+
+ ewin = EwinFindByClient(val);
+ if (ewin)
+ if (ewin->state.active)
+ EoChangeOpacity(ewin, ewin->props.focused_opacity);
+}
+
+static void
IpcPrintInit(void)
{
bufsiz = 0;
@@ -780,22 +791,40 @@
break;
case EWIN_OP_OPACITY:
- val = OpacityToPercent(ewin->ewmh.opacity);
+ a = OpacityToPercent(ewin->ewmh.opacity);
if (!strcmp(param1, "?"))
{
- IpcPrintf("opacity: %u", val);
+ IpcPrintf("opacity: %u", a);
goto done;
}
- if (!strcmp(param1, "opaque_when_focused"))
- {
- ewin->props.opaque_when_focused = !ewin->props.opaque_when_focused;
+ b = a;
+ sscanf(param1, "%i", &b);
+ if ((param1[0] == '+') || (param1[0] == '-'))
+ b += a;
+ a = (b < 0) ? 1 : (b > 100) ? 100 : b;
+ EwinOpSetOpacity(ewin, OPSRC_USER, a);
+ if (ewin->state.active)
+ {
+ EoChangeOpacity(ewin, OpacityFromPercent(a));
+ if (ewin->props.focused_opacity)
+ DoIn("OPACITY_TIMEOUT", 0.001 * 700, OpacityTimeout,
+ EwinGetClientXwin(ewin), NULL);
}
- else
+ break;
+
+ case EWIN_OP_FOCUSED_OPACITY:
+ a = OpacityToPercent(ewin->props.focused_opacity);
+ if (!strcmp(param1, "?"))
{
- sscanf(param1, "%i", &val);
- val = OpacityFix(val);
+ IpcPrintf("focused_opacity: %u", a);
+ goto done;
}
- EwinOpSetOpacity(ewin, OPSRC_USER, val);
+ b = a;
+ sscanf(param1, "%i", &b);
+ if ((param1[0] == '+') || (param1[0] == '-'))
+ b += a;
+ a = (b < 0) ? 0 : (b > 100) ? 100 : b;
+ EwinOpSetFocusedOpacity(ewin, OPSRC_USER, a);
break;
case EWIN_OP_SNAP:
@@ -1140,7 +1169,8 @@
"State %i Shown %i Visibility %i Active
%i\n"
"Member of groups %i\n"
#if USE_COMPOSITE
- "Opacity %3i(%x) Shadow %i Fade %i
NoRedirect %i\n"
+ "Opacity %3i(%x) Focused Opacity %3i\n"
+ "Shadow %i Fade %i NoRedirect %i\n"
#else
"Opacity %3i\n"
#endif
@@ -1186,8 +1216,9 @@
ewin->state.visibility, ewin->state.active, ewin->num_groups,
OpacityToPercent(ewin->ewmh.opacity)
#if USE_COMPOSITE
- , EoGetOpacity(ewin), EoGetShadow(ewin), EoGetFade(ewin),
- EoGetNoRedirect(ewin)
+ , EoGetOpacity(ewin),
+ OpacityToPercent(ewin->props.focused_opacity), EoGetShadow(ewin),
+ EoGetFade(ewin), EoGetNoRedirect(ewin)
#endif
);
}
@@ -1428,7 +1459,8 @@
" win_op <windowid> <fullscreen/zoom>\n"
" win_op <windowid> layer <0-100,4=normal>\n"
" win_op <windowid> <raise/lower>\n"
- " win_op <windowid> opacity <1-100(100=opaque),opaque_when_focused>\n"
+ " win_op <windowid> opacity <1-100(100=opaque)>\n"
+ " win_op <windowid> focused_opacity <0-100(0=follow opacity,
100=opaque)>\n"
" win_op <windowid> snap <what>\n"
" <what>: all, none, border, command, desktop, dialog, group,
icon,\n"
" layer, location, opacity, shade, shadow, size, sticky\n"
===================================================================
RCS file: /cvs/e/e16/e/src/snaps.c,v
retrieving revision 1.124
retrieving revision 1.125
diff -u -3 -r1.124 -r1.125
--- snaps.c 19 Aug 2006 14:58:31 -0000 1.124
+++ snaps.c 3 Nov 2006 23:44:32 -0000 1.125
@@ -65,7 +65,7 @@
char skipwinlist;
#if USE_COMPOSITE
int opacity;
- char opaque_when_focused;
+ int focused_opacity;
char shadow;
#endif
};
@@ -462,7 +462,7 @@
SnapEwinOpacity(Snapshot * sn, const EWin * ewin)
{
sn->opacity = OpacityToPercent(ewin->ewmh.opacity);
- sn->opaque_when_focused = ewin->props.opaque_when_focused;
+ sn->focused_opacity = OpacityToPercent(ewin->props.focused_opacity);
}
static void
@@ -1158,7 +1158,7 @@
fprintf(f, "FLAGS: %#x\n", sn->flags);
#if USE_COMPOSITE
if (sn->use_flags & SNAP_USE_OPACITY)
- fprintf(f, "OPACITY: %i %i\n", sn->opacity, sn->opaque_when_focused);
+ fprintf(f, "OPACITY: %i %i\n", sn->opacity, sn->focused_opacity);
if (sn->use_flags & SNAP_USE_SHADOW)
fprintf(f, "SHADOW: %i\n", sn->shadow);
#endif
@@ -1385,10 +1385,12 @@
{
sn->use_flags |= SNAP_USE_OPACITY;
a = 100;
- b = 1;
+ b = 100;
sscanf(s, "%i %i", &a, &b);
+ if (b == 1)
+ b = 100; /* BW compat - focused is opaque */
sn->opacity = a;
- sn->opaque_when_focused = b;
+ sn->focused_opacity = b;
}
else if (!strcmp(buf, "SHADOW"))
{
@@ -1503,9 +1505,10 @@
#if USE_COMPOSITE
if (use_flags & SNAP_USE_OPACITY)
{
- sn->opacity = OpacityFix(sn->opacity);
+ sn->opacity = OpacityFix(sn->opacity, 100);
+ sn->focused_opacity = OpacityFix(sn->focused_opacity, 0);
ewin->ewmh.opacity = OpacityFromPercent(sn->opacity);
- ewin->props.opaque_when_focused = sn->opaque_when_focused;
+ ewin->props.focused_opacity = OpacityFromPercent(sn->focused_opacity);
}
if (use_flags & SNAP_USE_SHADOW)
===================================================================
RCS file: /cvs/e/e16/e/src/windowmatch.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -3 -r1.51 -r1.52
--- windowmatch.c 7 Oct 2006 12:02:34 -0000 1.51
+++ windowmatch.c 3 Nov 2006 23:44:32 -0000 1.52
@@ -717,7 +717,12 @@
case EWIN_OP_OPACITY:
a = atoi(args);
- ewin->ewmh.opacity = OpacityFromPercent(OpacityFix(a));
+ ewin->ewmh.opacity = OpacityFromPercent(OpacityFix(a, 100));
+ break;
+
+ case EWIN_OP_FOCUSED_OPACITY:
+ a = atoi(args);
+ ewin->props.focused_opacity = OpacityFromPercent(OpacityFix(a, 0));
break;
case EWIN_OP_SKIP_LISTS:
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs