Enlightenment CVS committal
Author : kwo
Project : e16
Module : e
Dir : e16/e/src
Modified Files:
menus.c text.c
Log Message:
Simplify MenuDrawItem(). Fixes a number of menu drawing issues.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/menus.c,v
retrieving revision 1.142
retrieving revision 1.143
diff -u -3 -r1.142 -r1.143
--- menus.c 30 Jun 2004 13:04:18 -0000 1.142
+++ menus.c 4 Jul 2004 13:27:42 -0000 1.143
@@ -840,118 +840,76 @@
static void
MenuDrawItem(Menu * m, MenuItem * mi, char shape)
{
- GC gc;
- XGCValues gcv;
- unsigned int w, h;
- int x, y;
- char pq;
PmapMask *mi_pmm;
+ char pq;
EDBUG(5, "MenuDrawItem");
pq = Mode.queue_up;
Mode.queue_up = 0;
mi_pmm = &(mi->pmm[(int)(mi->state)]);
+
if (m->redraw)
FreePmapMask(mi_pmm);
- if (!mi_pmm->pmap)
- {
- if (mi->text)
- {
- GetWinWH(mi->win, &w, &h);
- GetWinXY(mi->win, &x, &y);
- if (!m->style->use_item_bg)
- {
- mi_pmm->type = 0;
- mi_pmm->pmap =
- ECreatePixmap(disp, mi->win, w, h, VRoot.depth);
- gc = XCreateGC(disp, m->pmm.pmap, 0, &gcv);
- XCopyArea(disp, m->pmm.pmap, mi_pmm->pmap, gc, x, y, w, h, 0,
- 0);
- mi_pmm->mask = None;
- if ((mi->state != STATE_NORMAL) || (mi->child))
- {
- PmapMask pmm;
- if (mi->child)
- IclassApplyCopy(m->style->sub_iclass, mi->win, w, h,
- 0, 0, mi->state, &pmm, 1,
- ST_MENU_ITEM);
- else
- IclassApplyCopy(m->style->item_iclass, mi->win, w,
- h, 0, 0, mi->state, &pmm, 1,
- ST_MENU_ITEM);
- if (pmm.mask)
- {
- XSetClipMask(disp, gc, pmm.mask);
- XSetClipOrigin(disp, gc, 0, 0);
- }
- XCopyArea(disp, pmm.pmap, mi_pmm->pmap, gc, 0, 0, w, h,
- 0, 0);
- FreePmapMask(&pmm);
- }
- XFreeGC(disp, gc);
- }
- else
- {
- if (mi->child)
- IclassApplyCopy(m->style->sub_iclass, mi->win, w, h, 0,
- 0, mi->state, mi_pmm, 1, ST_MENU_ITEM);
- else
- IclassApplyCopy(m->style->item_iclass, mi->win, w, h, 0,
- 0, mi->state, mi_pmm, 1, ST_MENU_ITEM);
- }
- }
- }
-
- if ((m->style->tclass) && (mi->text))
+ if (!mi_pmm->pmap)
{
- TextDraw(m->style->tclass, mi_pmm->pmap, 0, 0, mi->state,
- mi->text, mi->text_x, mi->text_y, mi->text_w, mi->text_h, 17,
- m->style->tclass->justification);
- }
+ GC gc;
+ XGCValues gcv;
+ unsigned int w, h;
+ int x, y;
+ int item_type;
+ ImageClass *ic;
- if (mi->text)
- {
- ESetWindowBackgroundPixmap(disp, mi->win, mi_pmm->pmap);
- EShapeCombineMask(disp, mi->win, ShapeBounding, 0, 0, mi_pmm->mask,
- ShapeSet);
- XClearWindow(disp, mi->win);
- }
- else
- {
GetWinWH(mi->win, &w, &h);
GetWinXY(mi->win, &x, &y);
+
+ mi_pmm->type = 0;
+ mi_pmm->pmap = ECreatePixmap(disp, mi->win, w, h, VRoot.depth);
+ mi_pmm->mask = None;
+
+ ic = (mi->child) ? m->style->sub_iclass : m->style->item_iclass;
+ item_type = (mi->state != STATE_NORMAL) ? ST_MENU_ITEM : ST_MENU;
+
if (!m->style->use_item_bg)
{
+ gc = XCreateGC(disp, m->pmm.pmap, 0, &gcv);
+ XCopyArea(disp, m->pmm.pmap, mi_pmm->pmap, gc, x, y, w, h, 0, 0);
if ((mi->state != STATE_NORMAL) || (mi->child))
{
- IclassApply(m->style->item_iclass, mi->win, w, h, 0, 0,
- mi->state, 0, ST_MENU);
- }
- else
- {
- ESetWindowBackgroundPixmap(disp, mi->win, ParentRelative);
- EShapeCombineMask(disp, mi->win, ShapeBounding, 0, 0, None,
- ShapeSet);
- XClearWindow(disp, mi->win);
+ PmapMask pmm;
+
+ IclassApplyCopy(ic, mi->win, w, h, 0, 0, mi->state, &pmm, 1,
+ item_type);
+ if (pmm.mask)
+ {
+ XSetClipMask(disp, gc, pmm.mask);
+ XSetClipOrigin(disp, gc, 0, 0);
+ }
+ XCopyArea(disp, pmm.pmap, mi_pmm->pmap, gc, 0, 0, w, h, 0, 0);
+ FreePmapMask(&pmm);
}
+ XFreeGC(disp, gc);
}
else
{
- if (mi->child)
- {
- IclassApply(m->style->sub_iclass, mi->win, w, h, 0, 0,
- mi->state, 0, ST_MENU);
- }
- else
- {
- IclassApply(m->style->item_iclass, mi->win, w, h, 0, 0,
- mi->state, 0, ST_MENU);
- }
+ IclassApplyCopy(ic, mi_pmm->pmap, w, h, 0, 0, mi->state, mi_pmm, 1,
+ item_type);
+ }
+
+ if (mi->text)
+ {
+ TextDraw(m->style->tclass, mi_pmm->pmap, 0, 0, mi->state,
+ mi->text, mi->text_x, mi->text_y, mi->text_w, mi->text_h,
+ 17, m->style->tclass->justification);
}
}
+ ESetWindowBackgroundPixmap(disp, mi->win, mi_pmm->pmap);
+ EShapeCombineMask(disp, mi->win, ShapeBounding, 0, 0, mi_pmm->mask,
+ ShapeSet);
+ XClearWindow(disp, mi->win);
+
if ((shape) && (m->style->use_item_bg))
PropagateShapes(m->win);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/text.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -3 -r1.41 -r1.42
--- text.c 26 May 2004 21:40:03 -0000 1.41
+++ text.c 4 Jul 2004 13:27:42 -0000 1.42
@@ -355,7 +355,7 @@
EDBUG(4, "TextDraw");
- if (!text)
+ if (!tclass || !text)
EDBUG_RETURN_;
ts = TextGetState(tclass, active, sticky, state);
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
digital self defense, top technical experts, no vendor pitches,
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs