forked from enlightenment/enlightenment
parent
5c62163103
commit
85a6497b96
|
@ -1,7 +1,7 @@
|
|||
#include "e.h"
|
||||
|
||||
/* local subsystem functions */
|
||||
static void _e_popup_free(E_Popup *pop);
|
||||
static void _e_popup_free(E_Popup *pop);
|
||||
static Eina_Bool _e_popup_idle_enterer(void *data);
|
||||
static Eina_Bool _e_popup_cb_window_shape(void *data, int ev_type, void *ev);
|
||||
|
||||
|
@ -17,7 +17,7 @@ e_popup_init(void)
|
|||
{
|
||||
_e_popup_window_shape_handler =
|
||||
ecore_event_handler_add(ECORE_X_EVENT_WINDOW_SHAPE,
|
||||
_e_popup_cb_window_shape, NULL);
|
||||
_e_popup_cb_window_shape, NULL);
|
||||
if (!_e_popup_hash) _e_popup_hash = eina_hash_string_superfast_new(NULL);
|
||||
return 1;
|
||||
}
|
||||
|
@ -50,12 +50,12 @@ e_popup_new(E_Zone *zone, int x, int y, int w, int h)
|
|||
pop->h = h;
|
||||
pop->layer = 250;
|
||||
pop->ecore_evas = e_canvas_new(pop->zone->container->win,
|
||||
pop->zone->x + pop->x, pop->zone->y + pop->y, pop->w, pop->h, 1, 1,
|
||||
&(pop->evas_win));
|
||||
pop->zone->x + pop->x, pop->zone->y + pop->y, pop->w, pop->h, 1, 1,
|
||||
&(pop->evas_win));
|
||||
if (!pop->ecore_evas)
|
||||
{
|
||||
free(pop);
|
||||
return NULL;
|
||||
free(pop);
|
||||
return NULL;
|
||||
}
|
||||
/* avoid excess exposes when shaped - set damage avoid to 1 */
|
||||
// ecore_evas_avoid_damage_set(pop->ecore_evas, 1);
|
||||
|
@ -102,8 +102,8 @@ e_popup_show(E_Popup *pop)
|
|||
else
|
||||
{
|
||||
ecore_evas_show(pop->ecore_evas);
|
||||
if (!(pop->shaped && e_config->use_composite))
|
||||
e_container_shape_show(pop->shape);
|
||||
if (!(pop->shaped && e_config->use_composite))
|
||||
e_container_shape_show(pop->shape);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -132,11 +132,11 @@ e_popup_move(E_Popup *pop, int x, int y)
|
|||
pop->x = x;
|
||||
pop->y = y;
|
||||
ecore_evas_move(pop->ecore_evas,
|
||||
pop->zone->x + pop->x,
|
||||
pop->zone->y + pop->y);
|
||||
pop->zone->x + pop->x,
|
||||
pop->zone->y + pop->y);
|
||||
e_container_shape_move(pop->shape,
|
||||
pop->zone->x + pop->x,
|
||||
pop->zone->y + pop->y);
|
||||
pop->zone->x + pop->x,
|
||||
pop->zone->y + pop->y);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
|
@ -166,12 +166,12 @@ e_popup_move_resize(E_Popup *pop, int x, int y, int w, int h)
|
|||
pop->w = w;
|
||||
pop->h = h;
|
||||
ecore_evas_move_resize(pop->ecore_evas,
|
||||
pop->zone->x + pop->x,
|
||||
pop->zone->y + pop->y,
|
||||
pop->w, pop->h);
|
||||
pop->zone->x + pop->x,
|
||||
pop->zone->y + pop->y,
|
||||
pop->w, pop->h);
|
||||
e_container_shape_move(pop->shape,
|
||||
pop->zone->x + pop->x,
|
||||
pop->zone->y + pop->y);
|
||||
pop->zone->x + pop->x,
|
||||
pop->zone->y + pop->y);
|
||||
e_container_shape_resize(pop->shape, pop->w, pop->h);
|
||||
}
|
||||
|
||||
|
@ -191,20 +191,20 @@ e_popup_edje_bg_object_set(E_Popup *pop, Evas_Object *o)
|
|||
shape_option = edje_object_data_get(o, "shaped");
|
||||
if (shape_option)
|
||||
{
|
||||
if (!strcmp(shape_option, "1"))
|
||||
pop->shaped = 1;
|
||||
else
|
||||
pop->shaped = 0;
|
||||
if (e_config->use_composite)
|
||||
{
|
||||
ecore_evas_alpha_set(pop->ecore_evas, pop->shaped);
|
||||
if (!strcmp(shape_option, "1"))
|
||||
pop->shaped = 1;
|
||||
else
|
||||
pop->shaped = 0;
|
||||
if (e_config->use_composite)
|
||||
{
|
||||
ecore_evas_alpha_set(pop->ecore_evas, pop->shaped);
|
||||
eina_hash_del(_e_popup_hash, e_util_winid_str_get(pop->evas_win), pop);
|
||||
pop->evas_win = ecore_evas_software_x11_window_get(pop->ecore_evas);
|
||||
pop->evas_win = ecore_evas_software_x11_window_get(pop->ecore_evas);
|
||||
eina_hash_add(_e_popup_hash, e_util_winid_str_get(pop->evas_win), pop);
|
||||
e_container_window_raise(pop->zone->container, pop->evas_win, pop->layer);
|
||||
}
|
||||
else
|
||||
ecore_evas_shaped_set(pop->ecore_evas, pop->shaped);
|
||||
e_container_window_raise(pop->zone->container, pop->evas_win, pop->layer);
|
||||
}
|
||||
else
|
||||
ecore_evas_shaped_set(pop->ecore_evas, pop->shaped);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -225,72 +225,72 @@ e_popup_idler_before(void)
|
|||
|
||||
EINA_LIST_FOREACH(_e_popup_list, l, pop)
|
||||
{
|
||||
if (pop->need_shape_export)
|
||||
{
|
||||
if (pop->need_shape_export)
|
||||
{
|
||||
Ecore_X_Rectangle *rects, *orects;
|
||||
int num;
|
||||
int num;
|
||||
|
||||
rects = ecore_x_window_shape_rectangles_get(pop->evas_win, &num);
|
||||
if (rects)
|
||||
{
|
||||
int changed;
|
||||
rects = ecore_x_window_shape_rectangles_get(pop->evas_win, &num);
|
||||
if (rects)
|
||||
{
|
||||
int changed;
|
||||
|
||||
changed = 1;
|
||||
if ((num == pop->shape_rects_num) && (pop->shape_rects))
|
||||
{
|
||||
int i;
|
||||
changed = 1;
|
||||
if ((num == pop->shape_rects_num) && (pop->shape_rects))
|
||||
{
|
||||
int i;
|
||||
|
||||
orects = pop->shape_rects;
|
||||
changed = 0;
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
if (rects[i].x < 0)
|
||||
{
|
||||
rects[i].width -= rects[i].x;
|
||||
rects[i].x = 0;
|
||||
}
|
||||
if ((rects[i].x + (int) rects[i].width) > pop->w)
|
||||
rects[i].width = rects[i].width - rects[i].x;
|
||||
if (rects[i].y < 0)
|
||||
{
|
||||
rects[i].height -= rects[i].y;
|
||||
rects[i].y = 0;
|
||||
}
|
||||
if ((rects[i].y + (int) rects[i].height) > pop->h)
|
||||
rects[i].height = rects[i].height - rects[i].y;
|
||||
orects = pop->shape_rects;
|
||||
changed = 0;
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
if (rects[i].x < 0)
|
||||
{
|
||||
rects[i].width -= rects[i].x;
|
||||
rects[i].x = 0;
|
||||
}
|
||||
if ((rects[i].x + (int)rects[i].width) > pop->w)
|
||||
rects[i].width = rects[i].width - rects[i].x;
|
||||
if (rects[i].y < 0)
|
||||
{
|
||||
rects[i].height -= rects[i].y;
|
||||
rects[i].y = 0;
|
||||
}
|
||||
if ((rects[i].y + (int)rects[i].height) > pop->h)
|
||||
rects[i].height = rects[i].height - rects[i].y;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (changed)
|
||||
{
|
||||
E_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
|
||||
{
|
||||
E_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) && (!pop->idle_enterer) &&
|
||||
(!pop->shaped && e_config->use_composite))
|
||||
e_container_shape_show(pop->shape);
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (changed)
|
||||
{
|
||||
E_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
|
||||
{
|
||||
E_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) && (!pop->idle_enterer) &&
|
||||
(!pop->shaped && e_config->use_composite))
|
||||
e_container_shape_show(pop->shape);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -333,8 +333,8 @@ _e_popup_idle_enterer(void *data)
|
|||
|
||||
if (!(pop = data)) return ECORE_CALLBACK_CANCEL;
|
||||
ecore_evas_move(pop->ecore_evas,
|
||||
pop->zone->x + pop->x,
|
||||
pop->zone->y + pop->y);
|
||||
pop->zone->x + pop->x,
|
||||
pop->zone->y + pop->y);
|
||||
e_container_shape_show(pop->shape);
|
||||
pop->idle_enterer = NULL;
|
||||
return ECORE_CALLBACK_CANCEL;
|
||||
|
@ -351,3 +351,4 @@ _e_popup_cb_window_shape(void *data __UNUSED__, int ev_type __UNUSED__, void *ev
|
|||
if (pop) pop->need_shape_export = 1;
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue