Enlightenment CVS committal
Author : kwo
Project : e16
Module : e
Dir : e16/e/src
Modified Files:
Tag: branch-exp
E.h Makefile.am ecompmgr.c eobj.c ewin-ops.c ewins.c iconify.c
moveresize.c tooltips.c x.c
Removed Files:
Tag: branch-exp
mod-tt.c
Log Message:
Transparent moving, tooltips. Stuff.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v
retrieving revision 1.314.2.72
retrieving revision 1.314.2.73
diff -u -3 -r1.314.2.72 -r1.314.2.73
--- E.h 14 Dec 2004 22:20:38 -0000 1.314.2.72
+++ E.h 15 Dec 2004 22:17:09 -0000 1.314.2.73
@@ -589,8 +589,10 @@
#define EoSetLayer(eo, _l) EobjSetLayer(&((eo)->o), (_l))
#if USE_COMPOSITE
#define EoSetOpacity(eo, _o) (eo)->o.opacity = (_o)
+#define EoChangeOpacity(eo, _o) EobjChangeOpacity(&((eo)->o), _o)
#else
#define EoSetOpacity(eo, _o)
+#define EoChangeOpacity(eo, _o)
#endif
typedef struct _constraints
@@ -1580,13 +1582,16 @@
void EdgeWindowsHide(void);
/* eobj.c */
+#if USE_COMPOSITE
EObj *EobjCreate(Window win);
void EobjDestroy(EObj * eo);
EObj *EobjRegister(Window win);
void EobjUnregister(Window win);
+Pixmap EobjGetPixmap(const EObj * eo);
+void EobjChangeOpacity(EObj * eo, unsigned int opacity);
+#endif
const char *EobjGetName(const EObj * eo);
int EobjGetDesk(const EObj * eo);
-Pixmap EobjGetPixmap(const EObj * eo);
int EobjSetDesk(EObj * eo, int desk);
void EobjSetLayer(EObj * eo, int layer);
@@ -2302,6 +2307,7 @@
int h);
Window ECreateFocusWindow(Window parent, int x, int y, int w,
int h);
+Pixmap EWindowGetShapePixmap(Window win);
void ESetColor(XColor * pxc, int r, int g, int b);
void EGetColor(const XColor * pxc, int *pr, int *pg, int *pb);
void GetWinXY(Window win, int *x, int *y);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/Makefile.am,v
retrieving revision 1.43.2.25
retrieving revision 1.43.2.26
diff -u -3 -r1.43.2.25 -r1.43.2.26
--- Makefile.am 8 Dec 2004 20:06:14 -0000 1.43.2.25
+++ Makefile.am 15 Dec 2004 22:17:09 -0000 1.43.2.26
@@ -73,7 +73,6 @@
mod-desks.c \
mod-misc.c \
mod-trans.c \
- mod-tt.c \
moveresize.c \
mwm.c \
pager.c \
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/Attic/ecompmgr.c,v
retrieving revision 1.1.2.9
retrieving revision 1.1.2.10
diff -u -3 -r1.1.2.9 -r1.1.2.10
--- ecompmgr.c 14 Dec 2004 22:20:38 -0000 1.1.2.9
+++ ecompmgr.c 15 Dec 2004 22:17:09 -0000 1.1.2.10
@@ -56,6 +56,7 @@
* Initially adapted for E16 by Kim Woelders.
*/
#include "E.h"
+#if USE_COMPOSITE
#include "ecompmgr.h"
#include <stdlib.h>
@@ -2061,3 +2062,5 @@
{N_IPC_FUNCS, CompMgrIpcArray},
{N_CFG_ITEMS, CompMgrCfgItems}
};
+
+#endif /* USE_COMPOSITE */
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/Attic/eobj.c,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -u -3 -r1.1.2.5 -r1.1.2.6
--- eobj.c 14 Dec 2004 22:20:39 -0000 1.1.2.5
+++ eobj.c 15 Dec 2004 22:17:09 -0000 1.1.2.6
@@ -45,17 +45,6 @@
return (eo->sticky) ? DesksGetCurrent() : eo->desk;
}
-Pixmap
-EobjGetPixmap(const EObj * eo)
-{
- Pixmap pmap = None;
-
-#if USE_COMPOSITE
- pmap = ECompMgrWinGetPixmap(eo);
-#endif
- return pmap;
-}
-
int
EobjSetDesk(EObj * eo, int desk)
{
@@ -124,6 +113,7 @@
}
}
+#if USE_COMPOSITE
EObj *
EobjCreate(Window win)
{
@@ -199,3 +189,19 @@
EobjListStackDel(eo);
}
+
+Pixmap
+EobjGetPixmap(const EObj * eo)
+{
+ Pixmap pmap = None;
+
+ pmap = ECompMgrWinGetPixmap(eo);
+ return pmap;
+}
+
+void
+EobjChangeOpacity(EObj * eo, unsigned int opacity)
+{
+ ECompMgrWinChangeOpacity(eo, opacity);
+}
+#endif
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/Attic/ewin-ops.c,v
retrieving revision 1.1.2.22
retrieving revision 1.1.2.23
diff -u -3 -r1.1.2.22 -r1.1.2.23
--- ewin-ops.c 13 Dec 2004 21:29:09 -0000 1.1.2.22
+++ ewin-ops.c 15 Dec 2004 22:17:09 -0000 1.1.2.23
@@ -1627,7 +1627,7 @@
EwinOpSetOpacity(EWin * ewin, int opacity)
{
HintsSetWindowOpacity(ewin, opacity);
- ECompMgrWinChangeOpacity(&ewin->o, opacity);
+ EoChangeOpacity(ewin, opacity);
RememberImportantInfoForEwin(ewin);
}
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/Attic/ewins.c,v
retrieving revision 1.1.2.35
retrieving revision 1.1.2.36
diff -u -3 -r1.1.2.35 -r1.1.2.36
--- ewins.c 13 Dec 2004 21:29:09 -0000 1.1.2.35
+++ ewins.c 15 Dec 2004 22:17:10 -0000 1.1.2.36
@@ -110,6 +110,7 @@
EoSetDesk(ewin, DesksGetCurrent());
EoSetLayer(ewin, 4);
EoSetOpacity(ewin, 0xFFFFFFFF);
+ ewin->props.opacity = 0xFFFFFFFF;
att.event_mask = EWIN_CONTAINER_EVENT_MASK;
att.do_not_propagate_mask = ButtonPressMask | ButtonReleaseMask;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/iconify.c,v
retrieving revision 1.116.2.27
retrieving revision 1.116.2.28
diff -u -3 -r1.116.2.27 -r1.116.2.28
--- iconify.c 14 Dec 2004 22:20:39 -0000 1.116.2.27
+++ iconify.c 15 Dec 2004 22:17:10 -0000 1.116.2.28
@@ -750,15 +750,19 @@
h = EoGetH(ewin);
}
-#if 0
- /* FIXME - Need to fix mask */
+#if USE_COMPOSITE
draw = EoGetPixmap(ewin);
if (draw != None)
{
+ Pixmap mask;
+
+ mask = EWindowGetShapePixmap(EoGetWin(ewin));
imlib_context_set_drawable(draw);
- im = imlib_create_scaled_image_from_drawable(None, 0, 0, EoGetW(ewin),
+ im = imlib_create_scaled_image_from_drawable(mask, 0, 0, EoGetW(ewin),
EoGetH(ewin), w, h, 1, 0);
+ ecore_x_pixmap_del(ib->pmap);
imlib_context_set_image(im);
+ imlib_image_set_has_alpha(1); /* Should be set by imlib? */
}
else
#endif
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/moveresize.c,v
retrieving revision 1.22.2.16
retrieving revision 1.22.2.17
diff -u -3 -r1.22.2.16 -r1.22.2.17
--- moveresize.c 13 Dec 2004 21:29:10 -0000 1.22.2.16
+++ moveresize.c 15 Dec 2004 22:17:10 -0000 1.22.2.17
@@ -153,6 +153,7 @@
EoSetFloating(gwins[i], 0);
}
+ EoChangeOpacity(ewin, ewin->props.opacity);
RaiseEwin(gwins[i]);
}
StackDesktop(EoGetDesk(ewin)); /* Restack to "un-float" */
@@ -423,6 +424,7 @@
EoGetY(ewin1), ewin1->client.w, ewin1->client.h, 0);
}
Mode.mode = MODE_MOVE;
+ EoChangeOpacity(ewin, 0xA0000000);
}
dx = Mode.x - Mode.px;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/tooltips.c,v
retrieving revision 1.65.2.6
retrieving revision 1.65.2.7
diff -u -3 -r1.65.2.6 -r1.65.2.7
--- tooltips.c 11 Dec 2004 15:51:36 -0000 1.65.2.6
+++ tooltips.c 15 Dec 2004 22:17:10 -0000 1.65.2.7
@@ -23,6 +23,14 @@
#include "E.h"
#include "conf.h"
+static struct
+{
+ char enable;
+ char showroottooltip;
+ int delay; /* milliseconds */
+ unsigned int opacity;
+} Conf_tooltips;
+
struct _tooltip
{
char *name;
@@ -47,6 +55,10 @@
int i;
ToolTip *tt;
+#if USE_COMPOSITE
+ EObj *eo;
+#endif
+
EDBUG(5, "TooltipCreate");
if (ic0 == NULL || ic1 == NULL || ic2 == NULL || ic3 == NULL || ic4 == NULL
@@ -72,6 +84,10 @@
tt->dist = dist;
tt->win = ECreateWindow(VRoot.win, -10, -100, 1, 1, 1);
tt->iwin = ECreateWindow(tt->win, -10, -100, 1, 1, 1);
+#if USE_COMPOSITE
+ eo = EobjRegister(tt->win);
+ eo->opacity = Conf_tooltips.opacity;
+#endif
for (i = 0; i < 4; i++)
{
@@ -84,6 +100,10 @@
win = ECreateWindow(VRoot.win, -10, -100, wh, wh, 1);
tt->s_iclass[i]->ref_count++;
+#if USE_COMPOSITE
+ eo = EobjRegister(win);
+ eo->opacity = Conf_tooltips.opacity;
+#endif
}
tt->s_win[i] = win;
}
@@ -676,3 +696,240 @@
Efree(lst);
}
}
+
+static ToolTip *ttip = NULL;
+
+static void
+ToolTipTimeout(int val __UNUSED__, void *data __UNUSED__)
+{
+ int x, y, dum;
+ unsigned int mask;
+ Window win, rt, ch;
+ ActionClass *ac;
+ const char *tts;
+
+ EDBUG(5, "ToolTipTimeout");
+
+ /* In the case of multiple screens, check to make sure
+ * the root window is still where the mouse is... */
+ if (False ==
+ XQueryPointer(disp, VRoot.win, &rt, &ch, &dum, &dum, &x, &y, &mask))
+ EDBUG_RETURN_;
+
+ /* In case this is a virtual root */
+ if (x < 0 || y < 0 || x >= VRoot.w || y >= VRoot.h)
+ EDBUG_RETURN_;
+
+ /* dont pop up tooltip is mouse button down */
+ if (mask &
+ (Button1Mask | Button2Mask | Button3Mask | Button4Mask | Button5Mask))
+ EDBUG_RETURN_;
+
+ win = WindowAtXY(x, y);
+ ac = FindActionClass(win);
+ if (!ac)
+ EDBUG_RETURN_;
+
+ if (!ttip)
+ ttip = FindItem("DEFAULT", 0, LIST_FINDBY_NAME, LIST_TYPE_TOOLTIP);
+
+ tts = ActionclassGetTooltipString(ac);
+ if (tts)
+ {
+ if (Conf_tooltips.showroottooltip)
+ {
+ TooltipShow(ttip, tts, ac, x, y);
+ }
+ else
+ {
+ int i;
+ int show = 1;
+
+ for (i = 0; i < Conf.desks.num; i++)
+ {
+ if (win == DeskGetWin(i))
+ show = 0;
+ }
+ if (show)
+ TooltipShow(ttip, tts, ac, x, y);
+ }
+ }
+
+ EDBUG_RETURN_;
+}
+
+/*
+ * We want this on
+ * ButtonPress, ButtonRelease, MotionNotify, EnterNotify, LeaveNotify
+ */
+void
+TooltipsHandleEvent(void)
+{
+ if (ttip)
+ TooltipHide(ttip);
+ RemoveTimerEvent("TOOLTIP_TIMEOUT");
+ if (Conf_tooltips.enable)
+ DoIn("TOOLTIP_TIMEOUT", 0.001 * Conf_tooltips.delay, ToolTipTimeout, 0,
+ NULL);
+}
+
+/*
+ * Tooltips Module
+ */
+
+static void
+TooltipsSighan(int sig, void *prm __UNUSED__)
+{
+ switch (sig)
+ {
+ case ESIGNAL_AREA_SWITCH_START:
+ case ESIGNAL_DESK_SWITCH_START:
+ TooltipsHide();
+ break;
+ }
+}
+
+/*
+ * Configuration dialog
+ */
+static char tmp_tooltips;
+static int tmp_tooltiptime;
+static char tmp_roottip;
+
+static void
+CB_ConfigureTooltips(int val, void *data __UNUSED__)
+{
+ if (val < 2)
+ {
+ Conf_tooltips.enable = tmp_tooltips;
+ Conf_tooltips.delay = tmp_tooltiptime * 10;
+ Conf_tooltips.showroottooltip = tmp_roottip;
+ }
+ autosave();
+}
+
+static void
+SettingsTooltips(void)
+{
+ Dialog *d;
+ DItem *table, *di;
+
+ if ((d =
+ FindItem("CONFIGURE_TOOLTIPS", 0, LIST_FINDBY_NAME, LIST_TYPE_DIALOG)))
+ {
+ SoundPlay("SOUND_SETTINGS_ACTIVE");
+ ShowDialog(d);
+ return;
+ }
+ SoundPlay("SOUND_SETTINGS_TOOLTIPS");
+
+ tmp_tooltips = Conf_tooltips.enable;
+ tmp_tooltiptime = Conf_tooltips.delay / 10;
+ tmp_roottip = Conf_tooltips.showroottooltip;
+
+ d = DialogCreate("CONFIGURE_TOOLTIPS");
+ DialogSetTitle(d, _("Tooltip Settings"));
+
+ table = DialogInitItem(d);
+ DialogItemTableSetOptions(table, 2, 0, 0, 0);
+
+ if (Conf.dialogs.headers)
+ {
+ di = DialogAddItem(table, DITEM_IMAGE);
+ DialogItemSetPadding(di, 2, 2, 2, 2);
+ DialogItemImageSetFile(di, "pix/tips.png");
+
+ di = DialogAddItem(table, DITEM_TEXT);
+ DialogItemSetPadding(di, 2, 2, 2, 2);
+ DialogItemSetFill(di, 1, 0);
+ DialogItemTextSetText(di,
+ _("Enlightenment Tooltip\n" "Settings Dialog\n"));
+
+ di = DialogAddItem(table, DITEM_SEPARATOR);
+ DialogItemSetColSpan(di, 2);
+ DialogItemSetPadding(di, 2, 2, 2, 2);
+ DialogItemSetFill(di, 1, 0);
+ DialogItemSeparatorSetOrientation(di, 0);
+ }
+
+ di = DialogAddItem(table, DITEM_CHECKBUTTON);
+ DialogItemSetPadding(di, 2, 2, 2, 2);
+ DialogItemSetFill(di, 1, 0);
+ DialogItemSetColSpan(di, 2);
+ DialogItemCheckButtonSetText(di, _("Display Tooltips"));
+ DialogItemCheckButtonSetState(di, tmp_tooltips);
+ DialogItemCheckButtonSetPtr(di, &tmp_tooltips);
+
+ di = DialogAddItem(table, DITEM_CHECKBUTTON);
+ DialogItemSetPadding(di, 2, 2, 2, 2);
+ DialogItemSetFill(di, 1, 0);
+ DialogItemSetColSpan(di, 2);
+ DialogItemCheckButtonSetText(di, _("Display Root Window Tips"));
+ DialogItemCheckButtonSetState(di, tmp_roottip);
+ DialogItemCheckButtonSetPtr(di, &tmp_roottip);
+
+ di = DialogAddItem(table, DITEM_TEXT);
+ DialogItemSetPadding(di, 2, 2, 2, 2);
+ DialogItemSetFill(di, 0, 0);
+ DialogItemSetAlign(di, 0, 512);
+ DialogItemTextSetText(di, _("Tooltip Delay:\n"));
+
+ di = DialogAddItem(table, DITEM_SLIDER);
+ DialogItemSetPadding(di, 2, 2, 2, 2);
+ DialogItemSetFill(di, 1, 0);
+ DialogItemSliderSetBounds(di, 0, 300);
+ DialogItemSliderSetUnits(di, 10);
+ DialogItemSliderSetJump(di, 25);
+ DialogItemSliderSetVal(di, tmp_tooltiptime);
+ DialogItemSliderSetValPtr(di, &tmp_tooltiptime);
+
+ di = DialogAddItem(table, DITEM_SEPARATOR);
+ DialogItemSetColSpan(di, 2);
+ DialogItemSetPadding(di, 2, 2, 2, 2);
+ DialogItemSetFill(di, 1, 0);
+ DialogItemSeparatorSetOrientation(di, 0);
+
+ DialogAddButton(d, _("OK"), CB_ConfigureTooltips, 1);
+ DialogAddButton(d, _("Apply"), CB_ConfigureTooltips, 0);
+ DialogAddButton(d, _("Close"), CB_ConfigureTooltips, 1);
+ DialogSetExitFunction(d, CB_ConfigureTooltips, 2, d);
+ DialogBindKey(d, "Escape", DialogCallbackClose, 0, d);
+ DialogBindKey(d, "Return", CB_ConfigureTooltips, 0, d);
+ ShowDialog(d);
+}
+
+static void
+TooltipsIpc(const char *params, Client * c __UNUSED__)
+{
+ if (params && !strncmp(params, "cfg", 3))
+ {
+ SettingsTooltips();
+ }
+}
+
+IpcItem TooltipsIpcArray[] = {
+ {
+ TooltipsIpc,
+ "tooltips", "tt",
+ "Tooltip functions",
+ " tooltips cfg Configure tooltips\n"}
+};
+#define N_IPC_FUNCS (sizeof(TooltipsIpcArray)/sizeof(IpcItem))
+
+static const CfgItem TooltipsCfgItems[] = {
+ CFG_ITEM_BOOL(Conf_tooltips, enable, 1),
+ CFG_ITEM_BOOL(Conf_tooltips, showroottooltip, 1),
+ CFG_ITEM_INT(Conf_tooltips, delay, 1500),
+ CFG_ITEM_INT(Conf_tooltips, opacity, 0xC0000000),
+};
+#define N_CFG_ITEMS (sizeof(TooltipsCfgItems)/sizeof(CfgItem))
+
+/*
+ * Module descriptor
+ */
+EModule ModTooltips = {
+ "tooltips", "tt",
+ TooltipsSighan,
+ {N_IPC_FUNCS, TooltipsIpcArray},
+ {N_CFG_ITEMS, TooltipsCfgItems}
+};
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/x.c,v
retrieving revision 1.71.2.17
retrieving revision 1.71.2.18
diff -u -3 -r1.71.2.17 -r1.71.2.18
--- x.c 13 Dec 2004 21:29:10 -0000 1.71.2.17
+++ x.c 15 Dec 2004 22:17:11 -0000 1.71.2.18
@@ -879,6 +879,39 @@
*pb = pxc->blue >> 8;
}
+/* Build mask from window shape rects */
+/* Snatched from imlib_create_scaled_image_from_drawable() */
+Pixmap
+EWindowGetShapePixmap(Window win)
+{
+ Pixmap mask;
+ GC gc;
+ XRectangle *rect;
+ int i, w, h;
+ int rect_num, rect_ord;
+
+ GetWinWH(win, &w, &h);
+ mask = ecore_x_pixmap_new(win, w, h, 1);
+
+ gc = XCreateGC(disp, mask, 0, NULL);
+ XSetForeground(disp, gc, 0);
+
+ rect = XShapeGetRectangles(disp, win, ShapeBounding, &rect_num, &rect_ord);
+ XFillRectangle(disp, mask, gc, 0, 0, w, h);
+ if (rect)
+ {
+ XSetForeground(disp, gc, 1);
+ for (i = 0; i < rect_num; i++)
+ XFillRectangle(disp, mask, gc, rect[i].x, rect[i].y,
+ rect[i].width, rect[i].height);
+ XFree(rect);
+ }
+
+ XFreeGC(disp, gc);
+
+ return mask;
+}
+
#ifndef USE_ECORE_X
void
ecore_x_grab(void)
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs