Enlightenment CVS committal
Author : kwo
Project : e16
Module : e
Dir : e16/e/src
Modified Files:
init.c session.c tooltips.c
Log Message:
Enable compiling with -Wwrite-strings (code fixups).
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/init.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -3 -r1.14 -r1.15
--- init.c 28 Feb 2004 15:14:00 -0000 1.14
+++ init.c 21 Mar 2004 01:41:00 -0000 1.15
@@ -133,7 +133,7 @@
/* create a fallback textclass in case no textclass is found */
tc = CreateTclass();
- tc->name = "__FALLBACK_TCLASS";
+ tc->name = Estrdup("__FALLBACK_TCLASS");
tc->norm.normal = CreateTextState();
tc->norm.normal->fontname =
Estrdup("-*-helvetica-medium-r-*-*-12-*-*-*-*-*-*-*");
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/session.c,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -3 -r1.60 -r1.61
--- session.c 21 Mar 2004 01:39:40 -0000 1.60
+++ session.c 21 Mar 2004 01:41:00 -0000 1.61
@@ -913,7 +913,7 @@
SetSMID(const char *smid)
{
#ifdef HAVE_X11_SM_SMLIB_H
- sm_client_id = smid;
+ sm_client_id = Estrdup(smid);
#endif /* HAVE_X11_SM_SMLIB_H */
}
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/tooltips.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -3 -r1.59 -r1.60
--- tooltips.c 21 Mar 2004 01:39:40 -0000 1.59
+++ tooltips.c 21 Mar 2004 01:41:00 -0000 1.60
@@ -77,6 +77,36 @@
EDBUG_RETURN(tt);
}
+static ImageClass *
+TooltipCreateIclass(const char *name, const char *file, int *pw, int *ph)
+{
+ ImageClass *ic;
+
+ ic = FindItem(name, 0, LIST_FINDBY_NAME, LIST_TYPE_ICLASS);
+ if (!ic)
+ {
+ ic = CreateIclass();
+ ic->norm.normal = CreateImageState();
+ ic->norm.normal->im_file = Estrdup(file);
+ IclassPopulate(ic);
+ AddItem(ic, name, 0, LIST_TYPE_ICLASS);
+ }
+ if (ic->norm.normal)
+ {
+ ImageStateRealize(ic->norm.normal);
+ if (ic->norm.normal->im)
+ {
+ imlib_context_set_image(ic->norm.normal->im);
+ if (*pw < imlib_image_get_width())
+ *pw = imlib_image_get_width();
+ if (*ph < imlib_image_get_height())
+ *ph = imlib_image_get_height();
+ }
+ }
+
+ return ic;
+}
+
void
ShowToolTip(ToolTip * tt, const char *text, ActionClass * ac, int x, int y)
{
@@ -108,337 +138,104 @@
temp_w = 0;
temp_h = 0;
- if (ac->list[i]->tooltipstring)
- {
- TextSize(tt->tclass, 0, 0, STATE_NORMAL,
- ac->list[i]->tooltipstring, &temp_w, &temp_h, 17);
- if (temp_w > labels_width)
- labels_width = temp_w;
- temp_w = 0;
+ if (!ac->list[i]->tooltipstring)
+ continue;
- if (ac->list[i]->event == EVENT_DOUBLE_DOWN)
- {
- TextSize(tt->tclass, 0, 0, STATE_NORMAL, "2x", &double_w,
- &temp_h, 17);
- if (cols[0] < double_w)
- cols[0] = double_w;
- }
+ TextSize(tt->tclass, 0, 0, STATE_NORMAL,
+ ac->list[i]->tooltipstring, &temp_w, &temp_h, 17);
+ if (temp_w > labels_width)
+ labels_width = temp_w;
+ temp_w = 0;
- if (ac->list[i]->anybutton)
- {
- ic = FindItem("TOOLTIP_MOUSEBUTTON_ANY", 0,
- LIST_FINDBY_NAME, LIST_TYPE_ICLASS);
- if (!ic)
- {
- ic = CreateIclass();
- ic->norm.normal = CreateImageState();
- ic->norm.normal->im_file = "pix/mouse_any.png";
- IclassPopulate(ic);
- AddItem(ic, "TOOLTIP_MOUSEBUTTON_ANY", 0,
- LIST_TYPE_ICLASS);
- }
- if (ic->norm.normal)
- ImageStateRealize(ic->norm.normal);
- }
- else
- switch (ac->list[i]->button)
- {
- case 1:
- ic = FindItem("TOOLTIP_MOUSEBUTTON_1", 0,
- LIST_FINDBY_NAME, LIST_TYPE_ICLASS);
- if (!ic)
- {
- ic = CreateIclass();
- ic->norm.normal = CreateImageState();
- ic->norm.normal->im_file = "pix/mouse_1.png";
- IclassPopulate(ic);
- AddItem(ic, "TOOLTIP_MOUSEBUTTON_1", 0,
- LIST_TYPE_ICLASS);
- }
- if (ic->norm.normal)
- ImageStateRealize(ic->norm.normal);
- break;
- case 2:
- ic = FindItem("TOOLTIP_MOUSEBUTTON_2", 0,
- LIST_FINDBY_NAME, LIST_TYPE_ICLASS);
- if (!ic)
- {
- ic = CreateIclass();
- ic->norm.normal = CreateImageState();
- ic->norm.normal->im_file = "pix/mouse_2.png";
- IclassPopulate(ic);
- AddItem(ic, "TOOLTIP_MOUSEBUTTON_2", 0,
- LIST_TYPE_ICLASS);
- }
- if (ic->norm.normal)
- ImageStateRealize(ic->norm.normal);
- break;
- case 3:
- ic = FindItem("TOOLTIP_MOUSEBUTTON_3", 0,
- LIST_FINDBY_NAME, LIST_TYPE_ICLASS);
- if (!ic)
- {
- ic = CreateIclass();
- ic->norm.normal = CreateImageState();
- ic->norm.normal->im_file = "pix/mouse_3.png";
- IclassPopulate(ic);
- AddItem(ic, "TOOLTIP_MOUSEBUTTON_3", 0,
- LIST_TYPE_ICLASS);
- }
- if (ic->norm.normal)
- ImageStateRealize(ic->norm.normal);
- break;
- case 4:
- ic = FindItem("TOOLTIP_MOUSEBUTTON_4", 0,
- LIST_FINDBY_NAME, LIST_TYPE_ICLASS);
- if (!ic)
- {
- ic = CreateIclass();
- ic->norm.normal = CreateImageState();
- ic->norm.normal->im_file = "pix/mouse_4.png";
- IclassPopulate(ic);
- AddItem(ic, "TOOLTIP_MOUSEBUTTON_4", 0,
- LIST_TYPE_ICLASS);
- }
- if (ic->norm.normal)
- ImageStateRealize(ic->norm.normal);
- break;
- case 5:
- ic = FindItem("TOOLTIP_MOUSEBUTTON_5", 0,
- LIST_FINDBY_NAME, LIST_TYPE_ICLASS);
- if (!ic)
- {
- ic = CreateIclass();
- ic->norm.normal = CreateImageState();
- ic->norm.normal->im_file = "pix/mouse_5.png";
- IclassPopulate(ic);
- AddItem(ic, "TOOLTIP_MOUSEBUTTON_5", 0,
- LIST_TYPE_ICLASS);
- }
- if (ic->norm.normal)
- ImageStateRealize(ic->norm.normal);
- break;
- case 0:
- default:
- break;
- }
+ if (ac->list[i]->event == EVENT_DOUBLE_DOWN)
+ {
+ TextSize(tt->tclass, 0, 0, STATE_NORMAL, "2x", &double_w,
+ &temp_h, 17);
+ if (cols[0] < double_w)
+ cols[0] = double_w;
+ }
- if (ic)
- {
- if (ic->norm.normal->im)
- {
- imlib_context_set_image(ic->norm.normal->im);
- if (cols[1] < imlib_image_get_width())
- cols[1] = imlib_image_get_width();
- if (imlib_image_get_height() > temp_h)
- temp_h = imlib_image_get_height();
- }
- }
- if (ac->list[i]->modifiers)
- {
- if (ac->list[i]->modifiers & ShiftMask)
- {
- ic = FindItem("TOOLTIP_KEY_SHIFT", 0,
- LIST_FINDBY_NAME, LIST_TYPE_ICLASS);
- if (!ic)
- {
- ic = CreateIclass();
- ic->norm.normal = CreateImageState();
- ic->norm.normal->im_file = "pix/key_shift.png";
- IclassPopulate(ic);
- AddItem(ic, "TOOLTIP_KEY_SHIFT", 0,
- LIST_TYPE_ICLASS);
- }
- if (ic->norm.normal)
- ImageStateRealize(ic->norm.normal);
- if (ic->norm.normal->im)
- {
- imlib_context_set_image(ic->norm.normal->im);
- if (cols[2] < imlib_image_get_width())
- cols[2] = imlib_image_get_width();
- if (imlib_image_get_height() > temp_h)
- temp_h = imlib_image_get_height();
- }
- }
- if (ac->list[i]->modifiers & LockMask)
- {
- ic = FindItem("TOOLTIP_KEY_LOCK", 0,
- LIST_FINDBY_NAME, LIST_TYPE_ICLASS);
- if (!ic)
- {
- ic = CreateIclass();
- ic->norm.normal = CreateImageState();
- ic->norm.normal->im_file = "pix/key_lock.png";
- IclassPopulate(ic);
- AddItem(ic, "TOOLTIP_KEY_LOCK", 0,
- LIST_TYPE_ICLASS);
- }
- if (ic->norm.normal)
- ImageStateRealize(ic->norm.normal);
- if (ic->norm.normal->im)
- {
- imlib_context_set_image(ic->norm.normal->im);
- if (cols[3] < imlib_image_get_width())
- cols[3] = imlib_image_get_width();
- if (imlib_image_get_height() > temp_h)
- temp_h = imlib_image_get_height();
- }
- }
- if (ac->list[i]->modifiers & ControlMask)
- {
- ic = FindItem("TOOLTIP_KEY_CTRL", 0,
- LIST_FINDBY_NAME, LIST_TYPE_ICLASS);
- if (!ic)
- {
- ic = CreateIclass();
- ic->norm.normal = CreateImageState();
- ic->norm.normal->im_file = "pix/key_ctrl.png";
- IclassPopulate(ic);
- AddItem(ic, "TOOLTIP_KEY_CTRL", 0,
- LIST_TYPE_ICLASS);
- }
- if (ic->norm.normal)
- ImageStateRealize(ic->norm.normal);
- if (ic->norm.normal->im)
- {
- imlib_context_set_image(ic->norm.normal->im);
- if (cols[4] < imlib_image_get_width())
- cols[4] = imlib_image_get_width();
- if (imlib_image_get_height() > temp_h)
- temp_h = imlib_image_get_height();
- }
- }
- if (ac->list[i]->modifiers & Mod1Mask)
- {
- ic = FindItem("TOOLTIP_KEY_MOD1", 0,
- LIST_FINDBY_NAME, LIST_TYPE_ICLASS);
- if (!ic)
- {
- ic = CreateIclass();
- ic->norm.normal = CreateImageState();
- ic->norm.normal->im_file = "pix/key_mod1.png";
- IclassPopulate(ic);
- AddItem(ic, "TOOLTIP_KEY_MOD1", 0,
- LIST_TYPE_ICLASS);
- }
- if (ic->norm.normal)
- ImageStateRealize(ic->norm.normal);
- if (ic->norm.normal->im)
- {
- imlib_context_set_image(ic->norm.normal->im);
- if (cols[5] < imlib_image_get_width())
- cols[5] = imlib_image_get_width();
- if (imlib_image_get_height() > temp_h)
- temp_h = imlib_image_get_height();
- }
- }
- if (ac->list[i]->modifiers & Mod2Mask)
- {
- ic = FindItem("TOOLTIP_KEY_MOD2", 0,
- LIST_FINDBY_NAME, LIST_TYPE_ICLASS);
- if (!ic)
- {
- ic = CreateIclass();
- ic->norm.normal = CreateImageState();
- ic->norm.normal->im_file = "pix/key_mod2.png";
- IclassPopulate(ic);
- AddItem(ic, "TOOLTIP_KEY_MOD2", 0,
- LIST_TYPE_ICLASS);
- }
- if (ic->norm.normal)
- ImageStateRealize(ic->norm.normal);
- if (ic->norm.normal->im)
- {
- imlib_context_set_image(ic->norm.normal->im);
- if (cols[6] < imlib_image_get_width())
- cols[6] = imlib_image_get_width();
- if (imlib_image_get_height() > temp_h)
- temp_h = imlib_image_get_height();
- }
- }
- if (ac->list[i]->modifiers & Mod3Mask)
- {
- ic = FindItem("TOOLTIP_KEY_MOD3", 0,
- LIST_FINDBY_NAME, LIST_TYPE_ICLASS);
- if (!ic)
- {
- ic = CreateIclass();
- ic->norm.normal = CreateImageState();
- ic->norm.normal->im_file = "pix/key_mod3.png";
- IclassPopulate(ic);
- AddItem(ic, "TOOLTIP_KEY_MOD3", 0,
- LIST_TYPE_ICLASS);
- }
- if (ic->norm.normal)
- ImageStateRealize(ic->norm.normal);
- if (ic->norm.normal->im)
- {
- imlib_context_set_image(ic->norm.normal->im);
- if (cols[7] < imlib_image_get_width())
- cols[7] = imlib_image_get_width();
- if (imlib_image_get_height() > temp_h)
- temp_h = imlib_image_get_height();
- }
- }
- if (ac->list[i]->modifiers & Mod4Mask)
- {
- ic = FindItem("TOOLTIP_KEY_MOD4", 0,
- LIST_FINDBY_NAME, LIST_TYPE_ICLASS);
- if (!ic)
- {
- ic = CreateIclass();
- ic->norm.normal = CreateImageState();
- ic->norm.normal->im_file = "pix/key_mod4.png";
- IclassPopulate(ic);
- AddItem(ic, "TOOLTIP_KEY_MOD4", 0,
- LIST_TYPE_ICLASS);
- }
- if (ic->norm.normal)
- ImageStateRealize(ic->norm.normal);
- if (ic->norm.normal->im)
- {
- imlib_context_set_image(ic->norm.normal->im);
- if (cols[8] < imlib_image_get_width())
- cols[8] = imlib_image_get_width();
- if (imlib_image_get_height() > temp_h)
- temp_h = imlib_image_get_height();
- }
- }
- if (ac->list[i]->modifiers & Mod5Mask)
- {
- ic = FindItem("TOOLTIP_KEY_MOD5", 0,
- LIST_FINDBY_NAME, LIST_TYPE_ICLASS);
- if (!ic)
- {
- ic = CreateIclass();
- ic->norm.normal = CreateImageState();
- ic->norm.normal->im_file = "pix/key_mod5.png";
- IclassPopulate(ic);
- AddItem(ic, "TOOLTIP_KEY_MOD5", 0,
- LIST_TYPE_ICLASS);
- }
- if (ic->norm.normal)
- ImageStateRealize(ic->norm.normal);
- if (ic->norm.normal->im)
- {
- imlib_context_set_image(ic->norm.normal->im);
- if (cols[9] < imlib_image_get_width())
- cols[9] = imlib_image_get_width();
- if (imlib_image_get_height() > temp_h)
- temp_h = imlib_image_get_height();
- }
- }
- }
+ if (ac->list[i]->anybutton)
+ {
+ TooltipCreateIclass("TOOLTIP_MOUSEBUTTON_ANY",
+ "pix/mouse_any.png", &cols[1], &temp_h);
+ }
+ else
+ switch (ac->list[i]->button)
+ {
+ case 1:
+ ic = TooltipCreateIclass("TOOLTIP_MOUSEBUTTON_1",
+ "pix/mouse_1.png", &cols[1],
+ &temp_h);
+ break;
+ case 2:
+ ic = TooltipCreateIclass("TOOLTIP_MOUSEBUTTON_2",
+ "pix/mouse_2.png", &cols[1],
+ &temp_h);
+ break;
+ case 3:
+ ic = TooltipCreateIclass("TOOLTIP_MOUSEBUTTON_3",
+ "pix/mouse_3.png", &cols[1],
+ &temp_h);
+ break;
+ case 4:
+ ic = TooltipCreateIclass("TOOLTIP_MOUSEBUTTON_4",
+ "pix/mouse_4.png", &cols[1],
+ &temp_h);
+ break;
+ case 5:
+ ic = TooltipCreateIclass("TOOLTIP_MOUSEBUTTON_5",
+ "pix/mouse_5.png", &cols[1],
+ &temp_h);
+ break;
+ case 0:
+ default:
+ break;
+ }
- temp_w =
- cols[0] + cols[1] + cols[2] + cols[3] + cols[4] +
- cols[5] + cols[6] + cols[7] + cols[8] + cols[9];
-
- if (temp_w > icons_width)
- icons_width = temp_w;
- heights[i] = temp_h;
- h += temp_h;
+ if (ac->list[i]->modifiers)
+ {
+ if (ac->list[i]->modifiers & ShiftMask)
+ ic = TooltipCreateIclass("TOOLTIP_KEY_SHIFT",
+ "pix/key_shift.png",
+ &cols[2], &temp_h);
+ if (ac->list[i]->modifiers & LockMask)
+ ic = TooltipCreateIclass("TOOLTIP_KEY_LOCK",
+ "pix/key_lock.png",
+ &cols[3], &temp_h);
+ if (ac->list[i]->modifiers & ControlMask)
+ ic = TooltipCreateIclass("TOOLTIP_KEY_CTRL",
+ "pix/key_ctrl.png",
+ &cols[4], &temp_h);
+ if (ac->list[i]->modifiers & Mod1Mask)
+ ic = TooltipCreateIclass("TOOLTIP_KEY_MOD1",
+ "pix/key_mod1.png",
+ &cols[5], &temp_h);
+ if (ac->list[i]->modifiers & Mod2Mask)
+ ic = TooltipCreateIclass("TOOLTIP_KEY_MOD2",
+ "pix/key_mod2.png",
+ &cols[6], &temp_h);
+ if (ac->list[i]->modifiers & Mod3Mask)
+ ic = TooltipCreateIclass("TOOLTIP_KEY_MOD3",
+ "pix/key_mod3.png",
+ &cols[7], &temp_h);
+ if (ac->list[i]->modifiers & Mod4Mask)
+ ic = TooltipCreateIclass("TOOLTIP_KEY_MOD4",
+ "pix/key_mod4.png",
+ &cols[8], &temp_h);
+ if (ac->list[i]->modifiers & Mod5Mask)
+ ic = TooltipCreateIclass("TOOLTIP_KEY_MOD5",
+ "pix/key_mod5.png",
+ &cols[9], &temp_h);
}
+
+ temp_w = cols[0] + cols[1] + cols[2] + cols[3] + cols[4] +
+ cols[5] + cols[6] + cols[7] + cols[8] + cols[9];
+
+ if (temp_w > icons_width)
+ icons_width = temp_w;
+ heights[i] = temp_h;
+ h += temp_h;
}
}
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs