Enlightenment CVS committal
Author : raster
Project : e17
Module : apps/e
Dir : e17/apps/e/src/bin
Modified Files:
e_border.c e_border.h e_container.c e_dnd.c e_dnd.h e_menu.c
e_menu.h e_popup.c e_popup.h
Log Message:
minimise cpu hape use if shape hasnt changed
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_border.c,v
retrieving revision 1.288
retrieving revision 1.289
diff -u -3 -r1.288 -r1.289
--- e_border.c 26 Jun 2005 04:41:29 -0000 1.288
+++ e_border.c 27 Jun 2005 10:08:52 -0000 1.289
@@ -647,7 +647,7 @@
ev = calloc(1, sizeof(E_Event_Border_Move));
ev->border = bd;
e_object_ref(E_OBJECT(bd));
- e_object_breadcrumb_add(E_OBJECT(bd), "border_move_event");
+ e_object_breadcrumb_add(E_OBJECT(bd), "border_move_event");
ecore_event_add(E_EVENT_BORDER_MOVE, ev, _e_border_event_border_move_free,
NULL);
}
@@ -1877,6 +1877,8 @@
_e_border_move_end(bd);
/* TODO: Other states to end before dying? */
+ IF_FREE(bd->shape_rects);
+ bd->shape_rects_num = 0;
if (bd->dangling_ref_check)
{
ecore_timer_del(bd->dangling_ref_check);
@@ -4353,18 +4355,53 @@
if (bd->need_shape_export)
{
- Ecore_X_Rectangle *rects;
+ Ecore_X_Rectangle *rects, *orects;
int num;
rects = ecore_x_window_shape_rectangles_get(bd->win, &num);
if (rects)
{
- if (bd->client.shaped)
- e_container_shape_solid_rect_set(bd->shape, 0, 0, 0, 0);
+ int changed;
+
+ changed = 1;
+ if ((num == bd->shape_rects_num) && (bd->shape_rects))
+ {
+ int i;
+
+ orects = bd->shape_rects;
+ for (i = 0; i < num; i++)
+ {
+ if ((orects[i].x != rects[i].x) ||
+ (orects[i].y != rects[i].y) ||
+ (orects[i].width != rects[i].width) ||
+ (orects[i].height != rects[i].height))
+ {
+ changed = 1;
+ break;
+ }
+ }
+ changed = 0;
+ }
+ if (changed)
+ {
+ if (bd->client.shaped)
+ e_container_shape_solid_rect_set(bd->shape, 0, 0, 0, 0);
+ else
+ e_container_shape_solid_rect_set(bd->shape,
bd->client_inset.l, bd->client_inset.t, bd->client.w, bd->client.h);
+ IF_FREE(bd->shape_rects);
+ bd->shape_rects = rects;
+ bd->shape_rects_num = num;
+ e_container_shape_rects_set(bd->shape, rects, num);
+ }
else
- e_container_shape_solid_rect_set(bd->shape, bd->client_inset.l,
bd->client_inset.t, bd->client.w, bd->client.h);
- e_container_shape_rects_set(bd->shape, rects, num);
- free(rects);
+ free(rects);
+ }
+ else
+ {
+ IF_FREE(bd->shape_rects);
+ bd->shape_rects = NULL;
+ bd->shape_rects_num = 0;
+ e_container_shape_rects_set(bd->shape, NULL, 0);
}
bd->need_shape_export = 0;
}
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_border.h,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -3 -r1.83 -r1.84
--- e_border.h 24 Jun 2005 04:10:18 -0000 1.83
+++ e_border.h 27 Jun 2005 10:08:53 -0000 1.84
@@ -324,6 +324,8 @@
Ecore_Timer *raise_timer;
Ecore_Timer *ping_timer;
Ecore_Timer *kill_timer;
+ int shape_rects_num;
+ Ecore_X_Rectangle *shape_rects;
Ecore_Timer *dangling_ref_check;
};
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_container.c,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -3 -r1.70 -r1.71
--- e_container.c 27 Jun 2005 07:57:40 -0000 1.70
+++ e_container.c 27 Jun 2005 10:08:53 -0000 1.71
@@ -465,30 +465,10 @@
{
Evas_List *l;
int i;
- int changed = 1;
E_Rect *r;
E_OBJECT_CHECK(es);
E_OBJECT_TYPE_CHECK(es, E_CONTAINER_SHAPE_TYPE);
-
- if (num == evas_list_count(es->shape))
- {
- for (i = 0, l = es->shape; (i < num) && (l); i++, l = l->next)
- {
- r = l->data;
- if ((r->x != rects[i].x) || (r->y != rects[i].y) ||
- (r->w != rects[i].width) || (r->h != rects[i].height))
- {
- changed = 1;
- break;
- }
- }
- changed = 0;
- }
- if (!changed)
- {
- return;
- }
if (es->shape)
{
for (l = es->shape; l; l = l->next)
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_dnd.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -3 -r1.27 -r1.28
--- e_dnd.c 18 Jun 2005 00:13:04 -0000 1.27
+++ e_dnd.c 27 Jun 2005 10:08:53 -0000 1.28
@@ -23,11 +23,14 @@
/* local subsystem globals */
-typedef struct _XDnd {
- int x, y;
- char *type;
- void *data;
-} XDnd;
+typedef struct _XDnd XDnd;
+
+struct _XDnd
+{
+ int x, y;
+ char *type;
+ void *data;
+};
static Evas_List *_event_handlers = NULL;
static Evas_List *_drop_handlers = NULL;
@@ -495,14 +498,49 @@
drag = l->data;
if (drag->need_shape_export)
{
- Ecore_X_Rectangle *rects;
+ Ecore_X_Rectangle *rects, *orects;
int num;
rects = ecore_x_window_shape_rectangles_get(drag->evas_win, &num);
if (rects)
{
- e_container_shape_rects_set(drag->shape, rects, num);
- free(rects);
+ int changed;
+
+ changed = 1;
+ if ((num == drag->shape_rects_num) && (drag->shape_rects))
+ {
+ int i;
+
+ orects = drag->shape_rects;
+ for (i = 0; i < num; i++)
+ {
+ if ((orects[i].x != rects[i].x) ||
+ (orects[i].y != rects[i].y) ||
+ (orects[i].width != rects[i].width) ||
+ (orects[i].height != rects[i].height))
+ {
+ changed = 1;
+ break;
+ }
+ }
+ changed = 0;
+ }
+ if (changed)
+ {
+ IF_FREE(drag->shape_rects);
+ drag->shape_rects = rects;
+ drag->shape_rects_num = num;
+ e_container_shape_rects_set(drag->shape, rects, num);
+ }
+ else
+ free(rects);
+ }
+ else
+ {
+ IF_FREE(drag->shape_rects);
+ drag->shape_rects = NULL;
+ drag->shape_rects_num = 0;
+ e_container_shape_rects_set(drag->shape, NULL, 0);
}
drag->need_shape_export = 0;
if (drag->visible)
@@ -518,6 +556,8 @@
{
_drag_list = evas_list_remove(_drag_list, drag);
+ IF_FREE(drag->shape_rects);
+ drag->shape_rects_num = 0;
e_object_unref(E_OBJECT(drag->container));
e_container_shape_hide(drag->shape);
e_object_del(E_OBJECT(drag->shape));
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_dnd.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -3 -r1.18 -r1.19
--- e_dnd.h 15 May 2005 05:20:17 -0000 1.18
+++ e_dnd.h 27 Jun 2005 10:08:53 -0000 1.19
@@ -36,6 +36,9 @@
int x, y, w, h;
int dx, dy;
+ int shape_rects_num;
+ Ecore_X_Rectangle *shape_rects;
+
unsigned int layer;
unsigned char visible : 1;
unsigned char need_shape_export : 1;
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_menu.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -3 -r1.35 -r1.36
--- e_menu.c 20 Jun 2005 08:56:54 -0000 1.35
+++ e_menu.c 27 Jun 2005 10:08:53 -0000 1.36
@@ -770,14 +770,49 @@
m = l->data;
if (m->need_shape_export)
{
- Ecore_X_Rectangle *rects;
+ Ecore_X_Rectangle *rects, *orects;
int num;
rects = ecore_x_window_shape_rectangles_get(m->evas_win, &num);
if (rects)
{
- e_container_shape_rects_set(m->shape, rects, num);
- free(rects);
+ int changed;
+
+ changed = 1;
+ if ((num == m->shape_rects_num) && (m->shape_rects))
+ {
+ int i;
+
+ orects = m->shape_rects;
+ for (i = 0; i < num; i++)
+ {
+ if ((orects[i].x != rects[i].x) ||
+ (orects[i].y != rects[i].y) ||
+ (orects[i].width != rects[i].width) ||
+ (orects[i].height != rects[i].height))
+ {
+ changed = 1;
+ break;
+ }
+ }
+ changed = 0;
+ }
+ if (changed)
+ {
+ IF_FREE(m->shape_rects);
+ m->shape_rects = rects;
+ m->shape_rects_num = num;
+ e_container_shape_rects_set(m->shape, rects, num);
+ }
+ else
+ free(rects);
+ }
+ else
+ {
+ IF_FREE(m->shape_rects);
+ m->shape_rects = NULL;
+ m->shape_rects_num = 0;
+ e_container_shape_rects_set(m->shape, NULL, 0);
}
m->need_shape_export = 0;
if (m->cur.visible)
@@ -814,6 +849,8 @@
Evas_List *l, *tmp;
_e_menu_unrealize(m);
+ IF_FREE(m->shape_rects);
+ m->shape_rects_num = 0;
for (l = m->items; l;)
{
tmp = l;
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_menu.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -3 -r1.12 -r1.13
--- e_menu.h 20 May 2005 03:09:44 -0000 1.12
+++ e_menu.h 27 Jun 2005 10:08:53 -0000 1.13
@@ -55,7 +55,9 @@
Evas_Object *container_object;
Evas_Coord container_x, container_y, container_w, container_h;
E_Container_Shape *shape;
-
+ int shape_rects_num;
+ Ecore_X_Rectangle *shape_rects;
+
struct {
void *data;
void (*func) (void *data, E_Menu *m);
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_popup.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- e_popup.c 10 May 2005 22:05:02 -0000 1.3
+++ e_popup.c 27 Jun 2005 10:08:53 -0000 1.4
@@ -173,19 +173,54 @@
pop = l->data;
if (pop->need_shape_export)
{
- Ecore_X_Rectangle *rects;
+ Ecore_X_Rectangle *rects, *orects;
int num;
rects = ecore_x_window_shape_rectangles_get(pop->evas_win, &num);
if (rects)
{
- e_container_shape_rects_set(pop->shape, rects, num);
- free(rects);
+ int changed;
+
+ changed = 1;
+ if ((num == pop->shape_rects_num) && (pop->shape_rects))
+ {
+ int i;
+
+ orects = pop->shape_rects;
+ for (i = 0; i < num; i++)
+ {
+ if ((orects[i].x != rects[i].x) ||
+ (orects[i].y != rects[i].y) ||
+ (orects[i].width != rects[i].width) ||
+ (orects[i].height != rects[i].height))
+ {
+ changed = 1;
+ break;
+ }
+ }
+ changed = 0;
+ }
+ if (changed)
+ {
+ IF_FREE(pop->shape_rects);
+ pop->shape_rects = rects;
+ pop->shape_rects_num = num;
+ e_container_shape_rects_set(pop->shape, rects, num);
+ }
+ else
+ free(rects);
+ }
+ else
+ {
+ IF_FREE(pop->shape_rects);
+ pop->shape_rects = NULL;
+ pop->shape_rects_num = 0;
+ e_container_shape_rects_set(pop->shape, NULL, 0);
}
pop->need_shape_export = 0;
- if (pop->visible)
- e_container_shape_show(pop->shape);
}
+ if (pop->visible)
+ e_container_shape_show(pop->shape);
}
}
@@ -194,6 +229,8 @@
static void
_e_popup_free(E_Popup *pop)
{
+ IF_FREE(pop->shape_rects);
+ pop->shape_rects_num = 0;
e_container_shape_hide(pop->shape);
e_object_del(E_OBJECT(pop->shape));
e_canvas_del(pop->ecore_evas);
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_popup.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- e_popup.h 7 May 2005 04:34:26 -0000 1.1
+++ e_popup.h 27 Jun 2005 10:08:53 -0000 1.2
@@ -26,6 +26,8 @@
Ecore_X_Window evas_win;
E_Container_Shape *shape;
E_Zone *zone;
+ int shape_rects_num;
+ Ecore_X_Rectangle *shape_rects;
};
EAPI int e_popup_init(void);
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs