2010-01-04 04:27:15 -08:00
|
|
|
#include "e.h"
|
|
|
|
#include "e_mod_main.h"
|
|
|
|
#include "e_mod_comp.h"
|
2010-01-10 19:28:20 -08:00
|
|
|
#include "e_mod_comp_update.h"
|
2010-01-04 04:27:15 -08:00
|
|
|
#include "config.h"
|
|
|
|
|
2010-01-14 20:41:20 -08:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
2010-01-10 18:59:32 -08:00
|
|
|
// TODO (no specific order):
|
|
|
|
// 1. abstract evas object and compwin so we can duplicate the object N times
|
|
|
|
// in N canvases - for winlist, everything, pager etc. too
|
|
|
|
// 2. implement "unmapped composite cache" -> N pixels worth of unmapped
|
|
|
|
// windows to be fully composited. only the most active/recent.
|
|
|
|
// 3. for unmapped windows - when window goes out of unmapped comp cache
|
|
|
|
// make a miniature copy (1/4 width+height?) and set property on window
|
|
|
|
// with pixmap id
|
|
|
|
// 6. other engine fast-paths (gl specifically)!
|
2010-01-10 19:03:08 -08:00
|
|
|
// 8. transparenty property
|
2010-01-11 00:43:24 -08:00
|
|
|
// 9. shortcut lots of stuff to draw inside the compositor - shelf,
|
|
|
|
// wallpaper, efm - hell even menus and anything else in e (this is what
|
|
|
|
// e18 was mostly about)
|
|
|
|
// 10. fullscreen windows need to be able to bypass compositing
|
2010-01-14 21:54:14 -08:00
|
|
|
// 11. handle root window resize!
|
2010-01-14 20:41:20 -08:00
|
|
|
//
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
2010-01-07 05:45:51 -08:00
|
|
|
|
2010-01-14 20:41:20 -08:00
|
|
|
struct _E_Comp
|
2010-01-06 06:18:47 -08:00
|
|
|
{
|
|
|
|
Ecore_X_Window win;
|
|
|
|
Ecore_Evas *ee;
|
|
|
|
Ecore_X_Window ee_win;
|
|
|
|
Evas *evas;
|
|
|
|
E_Manager *man;
|
|
|
|
Eina_Inlist *wins;
|
2010-01-06 22:29:53 -08:00
|
|
|
Eina_List *updates;
|
|
|
|
Ecore_Animator *render_animator;
|
2010-01-31 05:05:56 -08:00
|
|
|
Ecore_Job *update_job;
|
2010-01-27 07:29:51 -08:00
|
|
|
int render_overflow;
|
2010-01-19 06:28:56 -08:00
|
|
|
|
2010-01-24 03:05:18 -08:00
|
|
|
Eina_Bool gl : 1;
|
|
|
|
Eina_Bool grabbed : 1;
|
2010-01-06 06:18:47 -08:00
|
|
|
};
|
|
|
|
|
2010-01-14 20:41:20 -08:00
|
|
|
struct _E_Comp_Win
|
2010-01-06 06:18:47 -08:00
|
|
|
{
|
|
|
|
EINA_INLIST;
|
|
|
|
|
2010-01-14 20:41:20 -08:00
|
|
|
E_Comp *c; // parent compositor
|
2010-01-06 06:18:47 -08:00
|
|
|
Ecore_X_Window win; // raw window - for menus etc.
|
|
|
|
E_Border *bd; // if its a border - later
|
|
|
|
E_Popup *pop; // if its a popup - later
|
2010-01-14 20:41:20 -08:00
|
|
|
E_Menu *menu; // if it is a menu - later
|
2010-01-06 06:18:47 -08:00
|
|
|
int x, y, w, h; // geometry
|
2010-01-08 03:29:32 -08:00
|
|
|
int pw, ph; // pixmap w/h
|
2010-01-06 06:18:47 -08:00
|
|
|
int border; // border width
|
|
|
|
Ecore_X_Pixmap pixmap; // the compositing pixmap
|
|
|
|
Ecore_X_Damage damage; // damage region
|
2010-02-05 04:25:23 -08:00
|
|
|
Ecore_X_Visual vis; // window visual
|
|
|
|
int depth; // window depth
|
2010-01-14 20:41:20 -08:00
|
|
|
Evas_Object *obj; // composite object
|
|
|
|
Evas_Object *shobj; // shadow object
|
2010-01-06 06:18:47 -08:00
|
|
|
Ecore_X_Image *xim; // x image - software fallback
|
2010-01-14 20:41:20 -08:00
|
|
|
E_Update *up; // update handler
|
|
|
|
E_Object_Delfn *dfn; // delete function handle for objects being tracked
|
2010-02-01 06:15:14 -08:00
|
|
|
Ecore_X_Sync_Counter counter; // sync counter for syncronised drawing
|
|
|
|
Ecore_Timer *update_timeout; // max time between damage and "done" event
|
2010-02-05 04:25:23 -08:00
|
|
|
|
|
|
|
Ecore_X_Pixmap cache_pixmap; // the cached pixmap (1/nth the dimensions)
|
|
|
|
int cache_w, cache_h; // cached pixmap size
|
|
|
|
int update_count; // how many updates have happend to this win
|
|
|
|
double last_visible_time; // last time window was visible
|
|
|
|
double last_draw_time; // last time window was damaged
|
|
|
|
|
2010-01-06 06:18:47 -08:00
|
|
|
Eina_Bool visible : 1; // is visible
|
|
|
|
Eina_Bool input_only : 1; // is input_only
|
2010-01-07 05:45:51 -08:00
|
|
|
Eina_Bool argb : 1; // is argb
|
2010-01-10 18:47:59 -08:00
|
|
|
Eina_Bool shaped : 1; // is shaped
|
2010-01-06 22:29:53 -08:00
|
|
|
Eina_Bool update : 1; // has updates to fetch
|
2010-01-08 16:06:53 -08:00
|
|
|
Eina_Bool redirected : 1; // has updates to fetch
|
2010-01-10 18:47:59 -08:00
|
|
|
Eina_Bool shape_changed : 1; // shape changed
|
2010-01-23 05:50:26 -08:00
|
|
|
Eina_Bool native : 1; // native
|
2010-02-01 06:15:14 -08:00
|
|
|
Eina_Bool drawme : 1; // native
|
2010-01-06 06:18:47 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
static Eina_List *handlers = NULL;
|
|
|
|
static Eina_List *compositors = NULL;
|
|
|
|
static Eina_Hash *windows = NULL;
|
2010-02-01 06:15:14 -08:00
|
|
|
static Eina_Hash *borders = NULL;
|
2010-01-06 06:18:47 -08:00
|
|
|
static Eina_Hash *damages = NULL;
|
|
|
|
|
2010-01-07 05:45:51 -08:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2010-01-08 18:45:50 -08:00
|
|
|
#if 0
|
|
|
|
#define DBG(f, x...) printf(f, ##x)
|
|
|
|
#else
|
|
|
|
#define DBG(f, x...)
|
|
|
|
#endif
|
|
|
|
|
2010-01-14 20:41:20 -08:00
|
|
|
static void _e_mod_comp_render_queue(E_Comp *c);
|
|
|
|
static void _e_mod_comp_win_damage(E_Comp_Win *cw, int x, int y, int w, int h, Eina_Bool dmg);
|
2010-01-06 06:18:47 -08:00
|
|
|
|
2010-01-14 20:41:20 -08:00
|
|
|
static void
|
|
|
|
_e_mod_comp_win_shape_rectangles_apply(E_Comp_Win *cw)
|
2010-01-06 22:29:53 -08:00
|
|
|
{
|
2010-01-14 20:41:20 -08:00
|
|
|
Ecore_X_Rectangle *rects;
|
|
|
|
int num, i;
|
2010-01-06 22:29:53 -08:00
|
|
|
|
2010-01-14 20:41:20 -08:00
|
|
|
DBG("SHAPE [0x%x] change\n", cw->win);
|
|
|
|
rects = ecore_x_window_shape_rectangles_get(cw->win, &num);
|
|
|
|
if ((rects) && (num == 1))
|
2010-01-06 22:29:53 -08:00
|
|
|
{
|
2010-01-14 20:41:20 -08:00
|
|
|
DBG("SHAPE [0x%x] rect 1\n", cw->win);
|
|
|
|
if ((rects[0].x == 0) &&
|
|
|
|
(rects[0].y == 0) &&
|
|
|
|
(rects[0].width == cw->w) &&
|
|
|
|
(rects[0].height == cw->h))
|
2010-01-08 03:29:32 -08:00
|
|
|
{
|
2010-01-14 20:41:20 -08:00
|
|
|
DBG("SHAPE [0x%x] rect solid\n", cw->win);
|
|
|
|
free(rects);
|
|
|
|
rects = NULL;
|
2010-01-08 03:29:32 -08:00
|
|
|
}
|
2010-01-14 20:41:20 -08:00
|
|
|
}
|
|
|
|
if (rects)
|
|
|
|
{
|
|
|
|
unsigned int *pix, *p;
|
|
|
|
unsigned char *spix, *sp;
|
|
|
|
int w, h, px, py;
|
|
|
|
|
|
|
|
cw->shaped = 1;
|
|
|
|
evas_object_image_size_get(cw->obj, &w, &h);
|
|
|
|
if ((w > 0) && (h > 0))
|
2010-01-07 05:45:51 -08:00
|
|
|
{
|
2010-01-14 20:41:20 -08:00
|
|
|
pix = evas_object_image_data_get(cw->obj, 1);
|
|
|
|
spix = calloc(w * h, sizeof(unsigned char));
|
|
|
|
if (spix)
|
2010-01-08 18:45:50 -08:00
|
|
|
{
|
2010-01-14 20:41:20 -08:00
|
|
|
DBG("SHAPE [0x%x] rects %i\n", num);
|
|
|
|
for (i = 0; i < num; i++)
|
2010-01-07 06:01:35 -08:00
|
|
|
{
|
2010-01-14 20:41:20 -08:00
|
|
|
int rx, ry, rw, rh;
|
|
|
|
|
|
|
|
rx = rects[i].x; ry = rects[i].y;
|
|
|
|
rw = rects[i].width; rh = rects[i].height;
|
|
|
|
E_RECTS_CLIP_TO_RECT(rx, ry, rw, rh, 0, 0, w, h);
|
|
|
|
sp = spix + (w * ry) + rx;
|
|
|
|
for (py = 0; py < rh; py++)
|
2010-01-10 18:47:59 -08:00
|
|
|
{
|
2010-01-14 20:41:20 -08:00
|
|
|
for (px = 0; px < rw; px++)
|
2010-01-10 18:47:59 -08:00
|
|
|
{
|
2010-01-14 20:41:20 -08:00
|
|
|
*sp = 1; sp++;
|
2010-01-10 18:47:59 -08:00
|
|
|
}
|
2010-01-14 20:41:20 -08:00
|
|
|
sp += w - rw;
|
2010-01-08 18:45:50 -08:00
|
|
|
}
|
2010-01-07 06:01:35 -08:00
|
|
|
}
|
2010-01-14 20:41:20 -08:00
|
|
|
sp = spix;
|
|
|
|
p = pix;
|
|
|
|
for (py = 0; py < h; py++)
|
|
|
|
{
|
|
|
|
for (px = 0; px < w; px++)
|
|
|
|
{
|
|
|
|
if (*sp) *p |= 0xff000000;
|
|
|
|
else *p = 0x00000000;
|
|
|
|
sp++;
|
|
|
|
p++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
free(spix);
|
|
|
|
}
|
|
|
|
evas_object_image_data_set(cw->obj, pix);
|
|
|
|
evas_object_image_alpha_set(cw->obj, 1);
|
|
|
|
evas_object_image_data_update_add(cw->obj, 0, 0, w, h);
|
|
|
|
}
|
|
|
|
free(rects);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cw->shaped = 0;
|
|
|
|
evas_object_image_alpha_set(cw->obj, 0);
|
|
|
|
// dont need to fix alpha chanel as blending
|
|
|
|
// should be totally off here regardless of
|
|
|
|
// alpha channe; content
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_e_mod_comp_win_update(E_Comp_Win *cw)
|
|
|
|
{
|
|
|
|
E_Update_Rect *r;
|
2010-01-22 01:30:16 -08:00
|
|
|
int i, new_pixmap = 0;
|
2010-01-14 20:41:20 -08:00
|
|
|
|
|
|
|
cw->update = 0;
|
|
|
|
if (!cw->pixmap)
|
|
|
|
{
|
|
|
|
cw->pixmap = ecore_x_composite_name_window_pixmap_get(cw->win);
|
|
|
|
if (cw->pixmap)
|
|
|
|
ecore_x_pixmap_geometry_get(cw->pixmap, NULL, NULL, &(cw->pw), &(cw->ph));
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cw->pw = 0;
|
|
|
|
cw->ph = 0;
|
|
|
|
}
|
|
|
|
DBG("REND [0x%x] pixma = [0x%x], %ix%i\n", cw->win, cw->pixmap, cw->pw, cw->ph);
|
|
|
|
if ((cw->pw <= 0) || (cw->ph <= 0))
|
|
|
|
{
|
2010-01-23 05:50:26 -08:00
|
|
|
if (cw->native)
|
|
|
|
{
|
|
|
|
evas_object_image_native_surface_set(cw->obj, NULL);
|
|
|
|
cw->native = 0;
|
|
|
|
}
|
2010-01-14 20:41:20 -08:00
|
|
|
ecore_x_pixmap_free(cw->pixmap);
|
|
|
|
cw->pixmap = 0;
|
|
|
|
cw->pw = 0;
|
|
|
|
cw->ph = 0;
|
|
|
|
}
|
2010-01-22 01:30:16 -08:00
|
|
|
else
|
|
|
|
new_pixmap = 1;
|
2010-01-14 20:41:20 -08:00
|
|
|
}
|
|
|
|
if (!((cw->pw > 0) && (cw->ph > 0))) return;
|
|
|
|
|
2010-01-21 00:44:41 -08:00
|
|
|
if ((cw->pw != cw->w) || (cw->ph != cw->h))
|
2010-01-14 20:41:20 -08:00
|
|
|
{
|
2010-01-21 00:44:41 -08:00
|
|
|
ecore_x_window_geometry_get(cw->win,
|
|
|
|
&(cw->x), &(cw->y),
|
|
|
|
&(cw->w), &(cw->h));
|
|
|
|
evas_object_move(cw->obj, cw->x, cw->y);
|
|
|
|
if (cw->shobj)
|
|
|
|
{
|
|
|
|
evas_object_move(cw->shobj, cw->x, cw->y);
|
|
|
|
}
|
|
|
|
evas_object_resize(cw->obj,
|
|
|
|
cw->w + (cw->border * 2),
|
|
|
|
cw->h + (cw->border * 2));
|
|
|
|
if (cw->shobj)
|
|
|
|
{
|
|
|
|
evas_object_resize(cw->shobj,
|
|
|
|
cw->w + (cw->border * 2),
|
|
|
|
cw->h + (cw->border * 2));
|
|
|
|
}
|
2010-01-14 20:41:20 -08:00
|
|
|
}
|
2010-01-21 00:44:41 -08:00
|
|
|
|
|
|
|
e_mod_comp_update_resize(cw->up, cw->pw, cw->ph);
|
2010-01-25 04:53:43 -08:00
|
|
|
if ((cw->c->gl) && (_comp_mod->conf->texture_from_pixmap) &&
|
|
|
|
(!cw->shaped) && (!cw->shape_changed))
|
2010-01-14 20:41:20 -08:00
|
|
|
{
|
2010-01-22 01:30:16 -08:00
|
|
|
if (new_pixmap)
|
|
|
|
e_mod_comp_update_add(cw->up, 0, 0, cw->pw, cw->ph);
|
2010-01-23 05:50:26 -08:00
|
|
|
|
|
|
|
evas_object_image_size_set(cw->obj, cw->pw, cw->ph);
|
|
|
|
if (!cw->native)
|
|
|
|
{
|
|
|
|
Evas_Native_Surface ns;
|
|
|
|
|
|
|
|
ns.data.x11.visual = cw->vis;
|
|
|
|
ns.data.x11.pixmap = cw->pixmap;
|
|
|
|
evas_object_image_native_surface_set(cw->obj, &ns);
|
|
|
|
}
|
2010-01-21 00:44:41 -08:00
|
|
|
r = e_mod_comp_update_rects_get(cw->up);
|
|
|
|
if (r)
|
2010-01-14 20:41:20 -08:00
|
|
|
{
|
|
|
|
e_mod_comp_update_clear(cw->up);
|
|
|
|
for (i = 0; r[i].w > 0; i++)
|
|
|
|
{
|
|
|
|
int x, y, w, h;
|
2010-01-21 00:44:41 -08:00
|
|
|
|
2010-01-23 05:50:26 -08:00
|
|
|
cw->native = 1;
|
2010-01-14 20:41:20 -08:00
|
|
|
x = r[i].x; y = r[i].y;
|
|
|
|
w = r[i].w; h = r[i].h;
|
|
|
|
DBG("UPDATE [0x%x] %i %i %ix%i\n", cw->win, x, y, w, h);
|
|
|
|
evas_object_image_data_update_add(cw->obj, x, y, w, h);
|
2010-01-08 18:45:50 -08:00
|
|
|
}
|
2010-01-21 00:44:41 -08:00
|
|
|
free(r);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
cw->update = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!cw->xim)
|
|
|
|
{
|
|
|
|
if (cw->xim = ecore_x_image_new(cw->pw, cw->ph, cw->vis, cw->depth))
|
|
|
|
e_mod_comp_update_add(cw->up, 0, 0, cw->pw, cw->ph);
|
|
|
|
}
|
|
|
|
r = e_mod_comp_update_rects_get(cw->up);
|
|
|
|
if (r)
|
|
|
|
{
|
|
|
|
if (cw->xim)
|
2010-01-08 18:45:50 -08:00
|
|
|
{
|
2010-01-21 00:44:41 -08:00
|
|
|
e_mod_comp_update_clear(cw->up);
|
|
|
|
for (i = 0; r[i].w > 0; i++)
|
|
|
|
{
|
|
|
|
unsigned int *pix;
|
|
|
|
int x, y, w, h;
|
|
|
|
|
|
|
|
x = r[i].x; y = r[i].y;
|
|
|
|
w = r[i].w; h = r[i].h;
|
|
|
|
ecore_x_image_get(cw->xim, cw->pixmap, x, y, x, y, w, h);
|
|
|
|
DBG("UPDATE [0x%x] %i %i %ix%i\n", cw->win, x, y, w, h);
|
|
|
|
pix = ecore_x_image_data_get(cw->xim, NULL, NULL, NULL);
|
|
|
|
evas_object_image_size_set(cw->obj, cw->pw, cw->ph);
|
|
|
|
evas_object_image_data_set(cw->obj, pix);
|
|
|
|
evas_object_image_data_update_add(cw->obj, x, y, w, h);
|
|
|
|
if (cw->shaped) cw->shape_changed = 1;
|
|
|
|
}
|
|
|
|
if ((cw->shape_changed) && (!cw->argb))
|
|
|
|
{
|
|
|
|
_e_mod_comp_win_shape_rectangles_apply(cw);
|
|
|
|
cw->shape_changed = 0;
|
|
|
|
}
|
2010-01-07 05:45:51 -08:00
|
|
|
}
|
2010-01-21 00:44:41 -08:00
|
|
|
free(r);
|
2010-01-07 05:45:51 -08:00
|
|
|
}
|
2010-01-21 00:44:41 -08:00
|
|
|
else
|
|
|
|
cw->update = 1;
|
2010-01-14 20:41:20 -08:00
|
|
|
}
|
|
|
|
if (cw->shobj)
|
|
|
|
{
|
|
|
|
if (cw->shaped) evas_object_hide(cw->shobj);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-01-24 03:05:18 -08:00
|
|
|
static void
|
|
|
|
_e_mod_comp_pre_swap(void *data, Evas *e)
|
|
|
|
{
|
|
|
|
E_Comp *c = data;
|
|
|
|
|
2010-02-01 06:38:00 -08:00
|
|
|
if (_comp_mod->conf->grab)
|
|
|
|
{
|
|
|
|
if (c->grabbed)
|
|
|
|
{
|
|
|
|
ecore_x_ungrab();
|
|
|
|
c->grabbed = 0;
|
|
|
|
}
|
|
|
|
}
|
2010-01-24 03:05:18 -08:00
|
|
|
}
|
|
|
|
|
2010-01-14 20:41:20 -08:00
|
|
|
static int
|
2010-01-31 05:05:56 -08:00
|
|
|
_e_mod_comp_cb_update(E_Comp *c)
|
2010-01-14 20:41:20 -08:00
|
|
|
{
|
|
|
|
E_Comp_Win *cw;
|
|
|
|
Eina_List *new_updates = NULL; // for failed pixmap fetches - get them next frame
|
2010-02-01 06:15:14 -08:00
|
|
|
Eina_List *update_done = NULL;
|
2010-02-01 06:38:00 -08:00
|
|
|
|
|
|
|
if (_comp_mod->conf->grab)
|
|
|
|
{
|
|
|
|
ecore_x_grab();
|
|
|
|
ecore_x_sync();
|
|
|
|
c->grabbed = 1;
|
|
|
|
}
|
2010-01-14 20:41:20 -08:00
|
|
|
EINA_LIST_FREE(c->updates, cw)
|
|
|
|
{
|
2010-02-01 06:38:00 -08:00
|
|
|
if (_comp_mod->conf->efl_sync)
|
2010-02-01 06:15:14 -08:00
|
|
|
{
|
|
|
|
if (((cw->counter) && (cw->drawme)) || (!cw->counter))
|
|
|
|
{
|
|
|
|
_e_mod_comp_win_update(cw);
|
|
|
|
if (cw->drawme)
|
|
|
|
update_done = eina_list_append(update_done, cw);
|
|
|
|
cw->drawme = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
cw->update = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
_e_mod_comp_win_update(cw);
|
2010-01-14 20:41:20 -08:00
|
|
|
if (cw->update)
|
|
|
|
new_updates = eina_list_append(new_updates, cw);
|
2010-01-06 22:29:53 -08:00
|
|
|
}
|
2010-01-31 05:05:56 -08:00
|
|
|
if (_comp_mod->conf->lock_fps)
|
|
|
|
ecore_evas_manual_render(c->ee);
|
2010-02-01 06:38:00 -08:00
|
|
|
if (_comp_mod->conf->efl_sync)
|
2010-02-01 06:15:14 -08:00
|
|
|
{
|
|
|
|
EINA_LIST_FREE(update_done, cw)
|
|
|
|
{
|
|
|
|
ecore_x_sync_counter_inc(cw->counter, 1);
|
|
|
|
}
|
|
|
|
}
|
2010-02-01 06:38:00 -08:00
|
|
|
if (_comp_mod->conf->grab)
|
2010-01-24 03:05:18 -08:00
|
|
|
{
|
2010-02-01 06:38:00 -08:00
|
|
|
if (c->grabbed)
|
|
|
|
{
|
|
|
|
c->grabbed = 0;
|
|
|
|
ecore_x_ungrab();
|
|
|
|
}
|
2010-01-24 03:05:18 -08:00
|
|
|
}
|
2010-01-14 20:41:20 -08:00
|
|
|
if (new_updates) _e_mod_comp_render_queue(c);
|
2010-01-08 18:45:50 -08:00
|
|
|
c->updates = new_updates;
|
2010-01-27 07:29:51 -08:00
|
|
|
c->render_overflow--;
|
2010-01-31 05:05:56 -08:00
|
|
|
c->update_job = NULL;
|
2010-01-27 07:29:51 -08:00
|
|
|
if (c->render_overflow == 0)
|
|
|
|
{
|
2010-01-31 05:05:56 -08:00
|
|
|
if (c->render_animator) c->render_animator = NULL;
|
2010-01-27 07:29:51 -08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return 1;
|
2010-01-06 22:29:53 -08:00
|
|
|
}
|
|
|
|
|
2010-01-31 05:05:56 -08:00
|
|
|
static void
|
|
|
|
_e_mod_comp_cb_job(void *data)
|
|
|
|
{
|
|
|
|
_e_mod_comp_cb_update(data);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
_e_mod_comp_cb_animator(void *data)
|
|
|
|
{
|
|
|
|
return _e_mod_comp_cb_update(data);
|
|
|
|
}
|
|
|
|
|
2010-01-06 22:29:53 -08:00
|
|
|
static void
|
2010-01-14 20:41:20 -08:00
|
|
|
_e_mod_comp_render_queue(E_Comp *c)
|
2010-01-06 22:29:53 -08:00
|
|
|
{
|
2010-01-31 05:05:56 -08:00
|
|
|
if (_comp_mod->conf->lock_fps)
|
|
|
|
{
|
|
|
|
if (c->render_animator)
|
|
|
|
{
|
|
|
|
c->render_overflow = 10;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
c->render_animator = ecore_animator_add(_e_mod_comp_cb_animator, c);
|
|
|
|
}
|
|
|
|
else
|
2010-01-27 07:29:51 -08:00
|
|
|
{
|
2010-01-31 05:05:56 -08:00
|
|
|
if (c->update_job)
|
|
|
|
{
|
|
|
|
ecore_job_del(c->update_job);
|
|
|
|
c->render_overflow = 0;
|
|
|
|
}
|
|
|
|
c->update_job = ecore_job_add(_e_mod_comp_cb_job, c);
|
2010-01-27 07:29:51 -08:00
|
|
|
}
|
2010-01-06 22:29:53 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-01-14 20:41:20 -08:00
|
|
|
_e_mod_comp_win_render_queue(E_Comp_Win *cw)
|
2010-01-06 22:29:53 -08:00
|
|
|
{
|
|
|
|
_e_mod_comp_render_queue(cw->c);
|
|
|
|
}
|
|
|
|
|
2010-01-14 20:41:20 -08:00
|
|
|
static E_Comp *
|
2010-01-06 06:18:47 -08:00
|
|
|
_e_mod_comp_find(Ecore_X_Window root)
|
|
|
|
{
|
|
|
|
Eina_List *l;
|
2010-01-14 20:41:20 -08:00
|
|
|
E_Comp *c;
|
2010-01-06 06:18:47 -08:00
|
|
|
|
|
|
|
// fixme: use hash if compositors list > 4
|
|
|
|
EINA_LIST_FOREACH(compositors, l, c)
|
|
|
|
{
|
|
|
|
if (c->man->root == root) return c;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2010-01-14 20:41:20 -08:00
|
|
|
static E_Comp_Win *
|
2010-01-06 06:18:47 -08:00
|
|
|
_e_mod_comp_win_find(Ecore_X_Window win)
|
|
|
|
{
|
2010-02-01 06:15:14 -08:00
|
|
|
return eina_hash_find(windows, e_util_winid_str_get(win));
|
|
|
|
}
|
2010-01-06 06:18:47 -08:00
|
|
|
|
2010-02-01 06:15:14 -08:00
|
|
|
static E_Comp_Win *
|
|
|
|
_e_mod_comp_border_client_find(Ecore_X_Window win)
|
|
|
|
{
|
|
|
|
return eina_hash_find(borders, e_util_winid_str_get(win));
|
2010-01-06 06:18:47 -08:00
|
|
|
}
|
|
|
|
|
2010-01-14 20:41:20 -08:00
|
|
|
static E_Comp_Win *
|
2010-01-06 06:18:47 -08:00
|
|
|
_e_mod_comp_win_damage_find(Ecore_X_Damage damage)
|
|
|
|
{
|
2010-02-01 06:15:14 -08:00
|
|
|
return eina_hash_find(damages, e_util_winid_str_get(damage));
|
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_e_mod_comp_win_is_borderless(E_Comp_Win *cw)
|
|
|
|
{
|
|
|
|
if (!cw->bd) return 1;
|
|
|
|
if ((cw->bd->client.border.name) &&
|
|
|
|
(!strcmp(cw->bd->client.border.name, "borderless")))
|
|
|
|
return 1;
|
|
|
|
return 0;
|
2010-01-06 06:18:47 -08:00
|
|
|
}
|
|
|
|
|
2010-01-31 05:05:56 -08:00
|
|
|
static Eina_Bool
|
|
|
|
_e_mod_comp_win_do_shadow(E_Comp_Win *cw)
|
|
|
|
{
|
|
|
|
if (cw->shaped) return 0;
|
|
|
|
if (cw->argb)
|
|
|
|
{
|
2010-02-01 06:15:14 -08:00
|
|
|
if (_e_mod_comp_win_is_borderless(cw)) return 0;
|
2010-01-31 05:05:56 -08:00
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2010-02-01 06:15:14 -08:00
|
|
|
static int
|
|
|
|
_e_mod_comp_win_damage_timeout(void *data)
|
|
|
|
{
|
|
|
|
E_Comp_Win *cw = data;
|
|
|
|
|
|
|
|
if (!cw->update)
|
|
|
|
{
|
|
|
|
if (cw->update_timeout)
|
|
|
|
{
|
|
|
|
ecore_timer_del(cw->update_timeout);
|
|
|
|
cw->update_timeout = NULL;
|
|
|
|
}
|
|
|
|
cw->update = 1;
|
|
|
|
cw->c->updates = eina_list_append(cw->c->updates, cw);
|
|
|
|
}
|
|
|
|
cw->drawme = 1;
|
|
|
|
_e_mod_comp_win_render_queue(cw);
|
|
|
|
cw->update_timeout = NULL;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-01-14 20:41:20 -08:00
|
|
|
static E_Comp_Win *
|
|
|
|
_e_mod_comp_win_add(E_Comp *c, Ecore_X_Window win)
|
2010-01-06 06:18:47 -08:00
|
|
|
{
|
|
|
|
Ecore_X_Window_Attributes att;
|
2010-01-14 20:41:20 -08:00
|
|
|
E_Comp_Win *cw;
|
2010-01-06 06:18:47 -08:00
|
|
|
|
2010-01-14 20:41:20 -08:00
|
|
|
cw = calloc(1, sizeof(E_Comp_Win));
|
2010-01-06 06:18:47 -08:00
|
|
|
if (!cw) return NULL;
|
|
|
|
cw->win = win;
|
|
|
|
// FIXME: check if bd or pop - track
|
|
|
|
cw->c = c;
|
2010-01-06 07:21:16 -08:00
|
|
|
memset((&att), 0, sizeof(Ecore_X_Window_Attributes));
|
2010-01-14 20:41:20 -08:00
|
|
|
if (!ecore_x_window_attributes_get(cw->win, &att))
|
|
|
|
{
|
|
|
|
free(cw);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
if ((!att.input_only) &&
|
|
|
|
((att.depth != 24) && (att.depth != 32)))
|
2010-01-11 00:43:24 -08:00
|
|
|
{
|
|
|
|
printf("WARNING: window 0x%x not 24/32bpp -> %ibpp\n", cw->win, att.depth);
|
|
|
|
free(cw);
|
|
|
|
return NULL;
|
|
|
|
}
|
2010-01-06 06:18:47 -08:00
|
|
|
cw->input_only = att.input_only;
|
|
|
|
cw->vis = att.visual;
|
|
|
|
cw->depth = att.depth;
|
2010-01-07 05:45:51 -08:00
|
|
|
cw->argb = ecore_x_window_argb_get(cw->win);
|
2010-01-06 06:18:47 -08:00
|
|
|
eina_hash_add(windows, e_util_winid_str_get(cw->win), cw);
|
|
|
|
if (!cw->input_only)
|
|
|
|
{
|
2010-01-10 18:47:59 -08:00
|
|
|
Ecore_X_Rectangle *rects;
|
|
|
|
int num;
|
|
|
|
|
2010-01-06 06:18:47 -08:00
|
|
|
cw->damage = ecore_x_damage_new(cw->win, ECORE_X_DAMAGE_REPORT_DELTA_RECTANGLES);
|
|
|
|
eina_hash_add(damages, e_util_winid_str_get(cw->damage), cw);
|
2010-01-14 20:41:20 -08:00
|
|
|
cw->shobj = edje_object_add(c->evas);
|
2010-01-06 06:18:47 -08:00
|
|
|
cw->obj = evas_object_image_filled_add(c->evas);
|
|
|
|
evas_object_image_colorspace_set(cw->obj, EVAS_COLORSPACE_ARGB8888);
|
2010-01-07 05:45:51 -08:00
|
|
|
if (cw->argb)
|
|
|
|
evas_object_image_alpha_set(cw->obj, 1);
|
|
|
|
else
|
|
|
|
evas_object_image_alpha_set(cw->obj, 0);
|
2010-01-10 18:47:59 -08:00
|
|
|
ecore_x_window_shape_events_select(cw->win, 1);
|
|
|
|
rects = ecore_x_window_shape_rectangles_get(cw->win, &num);
|
|
|
|
if (rects)
|
|
|
|
{
|
|
|
|
if ((rects) && (num == 1))
|
|
|
|
{
|
|
|
|
if ((rects[0].x == 0) &&
|
|
|
|
(rects[0].y == 0) &&
|
|
|
|
(rects[0].width == att.w) &&
|
|
|
|
(rects[0].height == att.h))
|
|
|
|
{
|
|
|
|
free(rects);
|
|
|
|
rects = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (rects)
|
|
|
|
{
|
2010-01-23 05:51:39 -08:00
|
|
|
cw->shaped = 1;
|
|
|
|
cw->shape_changed = 1;
|
2010-01-10 18:47:59 -08:00
|
|
|
free(rects);
|
|
|
|
}
|
|
|
|
}
|
2010-01-06 06:18:47 -08:00
|
|
|
}
|
2010-01-06 22:29:53 -08:00
|
|
|
else
|
|
|
|
{
|
|
|
|
cw->obj = evas_object_rectangle_add(c->evas);
|
|
|
|
evas_object_color_set(cw->obj, 0, 0, 0, 64);
|
|
|
|
}
|
2010-01-11 00:43:24 -08:00
|
|
|
c->wins = eina_inlist_append(c->wins, EINA_INLIST_GET(cw));
|
2010-01-10 19:31:59 -08:00
|
|
|
cw->up = e_mod_comp_update_new();
|
2010-01-11 00:43:24 -08:00
|
|
|
e_mod_comp_update_tile_size_set(cw->up, 32, 32);
|
|
|
|
// for software:
|
2010-01-14 20:41:20 -08:00
|
|
|
e_mod_comp_update_policy_set
|
|
|
|
(cw->up, E_UPDATE_POLICY_HALF_WIDTH_OR_MORE_ROUND_UP_TO_FULL_WIDTH);
|
2010-01-08 18:45:50 -08:00
|
|
|
DBG(" [0x%x] add\n", cw->win);
|
2010-01-06 06:18:47 -08:00
|
|
|
return cw;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-01-14 20:41:20 -08:00
|
|
|
_e_mod_comp_win_del(E_Comp_Win *cw)
|
2010-01-06 06:18:47 -08:00
|
|
|
{
|
2010-01-10 19:31:59 -08:00
|
|
|
e_mod_comp_update_free(cw->up);
|
2010-01-08 18:45:50 -08:00
|
|
|
DBG(" [0x%x] del\n", cw->win);
|
2010-02-01 06:15:14 -08:00
|
|
|
if (cw->update_timeout)
|
|
|
|
{
|
|
|
|
ecore_timer_del(cw->update_timeout);
|
|
|
|
cw->update_timeout = NULL;
|
|
|
|
}
|
2010-01-14 20:41:20 -08:00
|
|
|
if (cw->dfn)
|
|
|
|
{
|
2010-02-01 06:15:14 -08:00
|
|
|
if (cw->bd)
|
|
|
|
{
|
|
|
|
eina_hash_del(borders, e_util_winid_str_get(cw->bd->client.win), cw);
|
|
|
|
e_object_delfn_del(E_OBJECT(cw->bd), cw->dfn);
|
|
|
|
}
|
2010-01-14 20:41:20 -08:00
|
|
|
else if (cw->pop) e_object_delfn_del(E_OBJECT(cw->pop), cw->dfn);
|
|
|
|
else if (cw->menu) e_object_delfn_del(E_OBJECT(cw->menu), cw->dfn);
|
|
|
|
cw->dfn = NULL;
|
|
|
|
}
|
2010-01-23 05:50:26 -08:00
|
|
|
if (cw->native)
|
|
|
|
{
|
|
|
|
evas_object_image_native_surface_set(cw->obj, NULL);
|
|
|
|
cw->native = 0;
|
|
|
|
}
|
2010-01-08 16:06:53 -08:00
|
|
|
if (cw->pixmap)
|
|
|
|
{
|
|
|
|
ecore_x_pixmap_free(cw->pixmap);
|
|
|
|
}
|
2010-01-06 22:29:53 -08:00
|
|
|
if (cw->update)
|
|
|
|
{
|
|
|
|
cw->update = 0;
|
|
|
|
cw->c->updates = eina_list_remove(cw->c->updates, cw);
|
|
|
|
}
|
2010-01-06 06:18:47 -08:00
|
|
|
if (cw->xim)
|
|
|
|
{
|
|
|
|
evas_object_image_data_set(cw->obj, NULL);
|
|
|
|
ecore_x_image_free(cw->xim);
|
2010-02-01 06:15:14 -08:00
|
|
|
cw->xim = NULL;
|
2010-01-06 06:18:47 -08:00
|
|
|
}
|
|
|
|
if (cw->obj)
|
|
|
|
{
|
|
|
|
evas_object_del(cw->obj);
|
2010-02-01 06:15:14 -08:00
|
|
|
cw->obj = NULL;
|
2010-01-06 06:18:47 -08:00
|
|
|
}
|
2010-01-14 20:41:20 -08:00
|
|
|
if (cw->shobj)
|
|
|
|
{
|
|
|
|
evas_object_del(cw->shobj);
|
2010-02-01 06:15:14 -08:00
|
|
|
cw->shobj = NULL;
|
2010-01-14 20:41:20 -08:00
|
|
|
}
|
2010-01-06 06:18:47 -08:00
|
|
|
eina_hash_del(windows, e_util_winid_str_get(cw->win), cw);
|
|
|
|
if (cw->damage)
|
|
|
|
{
|
2010-01-08 16:06:53 -08:00
|
|
|
Ecore_X_Region parts;
|
|
|
|
|
2010-01-06 06:18:47 -08:00
|
|
|
eina_hash_del(damages, e_util_winid_str_get(cw->damage), cw);
|
2010-01-08 16:06:53 -08:00
|
|
|
parts = ecore_x_region_new(NULL, 0);
|
|
|
|
ecore_x_damage_subtract(cw->damage, 0, parts);
|
|
|
|
ecore_x_region_free(parts);
|
2010-01-06 06:18:47 -08:00
|
|
|
ecore_x_damage_free(cw->damage);
|
|
|
|
cw->damage = 0;
|
|
|
|
}
|
|
|
|
cw->c->wins = eina_inlist_remove(cw->c->wins, EINA_INLIST_GET(cw));
|
|
|
|
free(cw);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-01-14 20:41:20 -08:00
|
|
|
_e_mod_comp_object_del(void *data, void *obj)
|
|
|
|
{
|
|
|
|
E_Comp_Win *cw = data;
|
|
|
|
|
2010-02-01 06:15:14 -08:00
|
|
|
if (obj == cw->bd)
|
|
|
|
{
|
|
|
|
eina_hash_del(borders, e_util_winid_str_get(cw->bd->client.win), cw);
|
|
|
|
cw->bd = NULL;
|
|
|
|
cw->counter = 0;
|
|
|
|
}
|
2010-01-14 20:41:20 -08:00
|
|
|
else if (obj == cw->pop) cw->pop = NULL;
|
|
|
|
else if (obj == cw->menu) cw->menu = NULL;
|
|
|
|
if (cw->dfn)
|
|
|
|
{
|
|
|
|
e_object_delfn_del(obj, cw->dfn);
|
|
|
|
cw->dfn = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_e_mod_comp_win_show(E_Comp_Win *cw)
|
2010-01-06 06:18:47 -08:00
|
|
|
{
|
|
|
|
if (cw->visible) return;
|
|
|
|
cw->visible = 1;
|
2010-01-08 18:45:50 -08:00
|
|
|
DBG(" [0x%x] sho ++++++++++\n", cw->win);
|
2010-01-08 16:06:53 -08:00
|
|
|
if (cw->input_only) return;
|
|
|
|
if (!cw->redirected)
|
2010-01-06 06:18:47 -08:00
|
|
|
{
|
2010-01-08 16:06:53 -08:00
|
|
|
cw->redirected = 1;
|
2010-01-06 06:18:47 -08:00
|
|
|
ecore_x_composite_redirect_window(cw->win, ECORE_X_COMPOSITE_UPDATE_MANUAL);
|
2010-01-08 03:29:32 -08:00
|
|
|
_e_mod_comp_win_damage(cw, 0, 0, cw->w, cw->h, 0);
|
2010-01-06 06:18:47 -08:00
|
|
|
}
|
2010-01-14 20:41:20 -08:00
|
|
|
|
|
|
|
if (cw->dfn)
|
|
|
|
{
|
2010-02-01 06:15:14 -08:00
|
|
|
if (cw->bd)
|
|
|
|
{
|
|
|
|
eina_hash_del(borders, e_util_winid_str_get(cw->bd->client.win), cw);
|
|
|
|
e_object_delfn_del(E_OBJECT(cw->bd), cw->dfn);
|
|
|
|
cw->counter = 0;
|
|
|
|
}
|
2010-01-14 20:41:20 -08:00
|
|
|
else if (cw->pop) e_object_delfn_del(E_OBJECT(cw->pop), cw->dfn);
|
|
|
|
else if (cw->menu) e_object_delfn_del(E_OBJECT(cw->menu), cw->dfn);
|
|
|
|
cw->dfn = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
cw->bd = NULL;
|
|
|
|
cw->pop = NULL;
|
|
|
|
cw->menu = NULL;
|
|
|
|
|
|
|
|
cw->bd = e_border_find_by_window(cw->win);
|
|
|
|
if (cw->bd)
|
|
|
|
{
|
2010-02-01 06:15:14 -08:00
|
|
|
Ecore_X_Sync_Counter counter;
|
|
|
|
|
|
|
|
eina_hash_add(borders, e_util_winid_str_get(cw->bd->client.win), cw);
|
2010-01-14 20:41:20 -08:00
|
|
|
cw->dfn = e_object_delfn_add(E_OBJECT(cw->bd),
|
|
|
|
_e_mod_comp_object_del, cw);
|
2010-02-01 06:38:00 -08:00
|
|
|
if (_comp_mod->conf->efl_sync)
|
2010-02-01 06:15:14 -08:00
|
|
|
{
|
2010-02-01 06:38:00 -08:00
|
|
|
if (_e_mod_comp_win_is_borderless(cw) ||
|
|
|
|
(_comp_mod->conf->loose_sync))
|
2010-02-01 06:15:14 -08:00
|
|
|
{
|
|
|
|
counter = ecore_x_e_comp_sync_counter_get(cw->bd->client.win);
|
|
|
|
if (counter)
|
|
|
|
{
|
|
|
|
cw->counter = counter;
|
|
|
|
ecore_x_sync_counter_inc(cw->counter, 1);
|
|
|
|
ecore_x_e_comp_sync_begin_send(cw->bd->client.win);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ecore_x_e_comp_sync_cancel_send(cw->bd->client.win);
|
|
|
|
}
|
|
|
|
}
|
2010-01-14 20:41:20 -08:00
|
|
|
// ref bd
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cw->pop = e_popup_find_by_window(cw->win);
|
|
|
|
if (cw->pop)
|
|
|
|
{
|
|
|
|
cw->dfn = e_object_delfn_add(E_OBJECT(cw->pop),
|
|
|
|
_e_mod_comp_object_del, cw);
|
|
|
|
// ref pop
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cw->menu = e_menu_find_by_window(cw->win);
|
|
|
|
if (cw->menu)
|
|
|
|
{
|
|
|
|
cw->dfn = e_object_delfn_add(E_OBJECT(cw->menu),
|
|
|
|
_e_mod_comp_object_del, cw);
|
|
|
|
// ref menu
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2010-01-06 06:18:47 -08:00
|
|
|
evas_object_show(cw->obj);
|
2010-01-14 20:41:20 -08:00
|
|
|
if (cw->shobj)
|
|
|
|
{
|
|
|
|
if (_comp_mod->conf->use_shadow)
|
|
|
|
{
|
2010-01-31 05:05:56 -08:00
|
|
|
if (_e_mod_comp_win_do_shadow(cw))
|
2010-01-14 20:41:20 -08:00
|
|
|
{
|
|
|
|
int ok = 0;
|
|
|
|
char buf[PATH_MAX];
|
|
|
|
|
|
|
|
// fimxe: maker shadow object configurable - use theme first
|
|
|
|
if (_comp_mod->conf->shadow_file)
|
|
|
|
{
|
|
|
|
ok = 1;
|
|
|
|
if (!edje_object_file_set(cw->shobj,
|
|
|
|
_comp_mod->conf->shadow_file,
|
|
|
|
"shadow"))
|
|
|
|
ok = 0;
|
|
|
|
}
|
|
|
|
if (!ok)
|
|
|
|
{
|
|
|
|
ok = 1;
|
|
|
|
if (!e_theme_edje_object_set(cw->shobj,
|
|
|
|
"base/theme/borders",
|
|
|
|
"e/shadow/box"))
|
|
|
|
ok = 0;
|
|
|
|
}
|
|
|
|
if (!ok)
|
|
|
|
{
|
|
|
|
snprintf(buf, sizeof(buf), "%s/shadow.edj",
|
|
|
|
e_module_dir_get(_comp_mod->module)
|
|
|
|
);
|
|
|
|
edje_object_file_set(cw->shobj, buf, "shadow");
|
|
|
|
}
|
|
|
|
evas_object_show(cw->shobj);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2010-01-06 22:29:53 -08:00
|
|
|
_e_mod_comp_win_render_queue(cw);
|
2010-01-06 06:18:47 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-01-14 20:41:20 -08:00
|
|
|
_e_mod_comp_win_hide(E_Comp_Win *cw)
|
2010-01-06 06:18:47 -08:00
|
|
|
{
|
|
|
|
if (!cw->visible) return;
|
|
|
|
cw->visible = 0;
|
|
|
|
if (cw->input_only) return;
|
2010-01-08 18:45:50 -08:00
|
|
|
DBG(" [0x%x] hid --\n", cw->win);
|
2010-02-01 06:15:14 -08:00
|
|
|
if (cw->update_timeout)
|
|
|
|
{
|
|
|
|
ecore_timer_del(cw->update_timeout);
|
|
|
|
cw->update_timeout = NULL;
|
|
|
|
}
|
2010-02-01 06:38:00 -08:00
|
|
|
if (_comp_mod->conf->efl_sync)
|
2010-02-01 06:15:14 -08:00
|
|
|
{
|
|
|
|
if ((cw->bd) && (cw->counter))
|
|
|
|
ecore_x_e_comp_sync_end_send(cw->bd->client.win);
|
|
|
|
}
|
2010-01-08 16:06:53 -08:00
|
|
|
if (cw->redirected)
|
2010-01-06 06:18:47 -08:00
|
|
|
{
|
|
|
|
ecore_x_composite_unredirect_window(cw->win, ECORE_X_COMPOSITE_UPDATE_MANUAL);
|
2010-01-08 16:06:53 -08:00
|
|
|
cw->redirected = 0;
|
2010-01-08 03:29:32 -08:00
|
|
|
cw->pw = 0;
|
|
|
|
cw->ph = 0;
|
2010-01-06 06:18:47 -08:00
|
|
|
}
|
2010-01-23 05:50:26 -08:00
|
|
|
if (cw->native)
|
|
|
|
{
|
|
|
|
evas_object_image_native_surface_set(cw->obj, NULL);
|
|
|
|
cw->native = 0;
|
|
|
|
}
|
2010-01-08 18:45:50 -08:00
|
|
|
if (cw->pixmap)
|
|
|
|
{
|
|
|
|
ecore_x_pixmap_free(cw->pixmap);
|
|
|
|
cw->pixmap = 0;
|
|
|
|
}
|
2010-01-06 06:18:47 -08:00
|
|
|
evas_object_hide(cw->obj);
|
2010-01-14 20:41:20 -08:00
|
|
|
if (cw->shobj)
|
|
|
|
{
|
|
|
|
evas_object_hide(cw->shobj);
|
|
|
|
}
|
2010-01-21 04:42:33 -08:00
|
|
|
evas_object_image_size_set(cw->obj, 1, 1);
|
|
|
|
if (cw->pixmap)
|
|
|
|
{
|
|
|
|
ecore_x_pixmap_free(cw->pixmap);
|
|
|
|
cw->pixmap = 0;
|
|
|
|
cw->pw = 0;
|
|
|
|
cw->ph = 0;
|
|
|
|
}
|
|
|
|
if (cw->xim)
|
|
|
|
{
|
|
|
|
evas_object_image_data_set(cw->obj, NULL);
|
|
|
|
ecore_x_image_free(cw->xim);
|
|
|
|
cw->xim = NULL;
|
|
|
|
}
|
2010-01-06 22:29:53 -08:00
|
|
|
_e_mod_comp_win_render_queue(cw);
|
2010-01-06 06:18:47 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-01-14 20:41:20 -08:00
|
|
|
_e_mod_comp_win_raise_above(E_Comp_Win *cw, E_Comp_Win *cw2)
|
2010-01-06 06:18:47 -08:00
|
|
|
{
|
2010-01-08 18:45:50 -08:00
|
|
|
DBG(" [0x%x] abv [0x%x]\n", cw->win, cw2->win);
|
2010-01-06 22:29:53 -08:00
|
|
|
cw->c->wins = eina_inlist_remove(cw->c->wins, EINA_INLIST_GET(cw));
|
|
|
|
cw->c->wins = eina_inlist_append_relative(cw->c->wins,
|
|
|
|
EINA_INLIST_GET(cw),
|
|
|
|
EINA_INLIST_GET(cw2));
|
2010-01-06 06:18:47 -08:00
|
|
|
evas_object_stack_above(cw->obj, cw2->obj);
|
2010-01-14 20:41:20 -08:00
|
|
|
if (cw->shobj)
|
|
|
|
{
|
|
|
|
evas_object_stack_below(cw->shobj, cw->obj);
|
|
|
|
}
|
2010-01-06 22:29:53 -08:00
|
|
|
_e_mod_comp_win_render_queue(cw);
|
|
|
|
if (cw->input_only) return;
|
2010-01-06 06:18:47 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-01-14 20:41:20 -08:00
|
|
|
_e_mod_comp_win_raise(E_Comp_Win *cw)
|
2010-01-06 06:18:47 -08:00
|
|
|
{
|
2010-01-08 18:45:50 -08:00
|
|
|
DBG(" [0x%x] rai\n", cw->win);
|
2010-01-06 22:29:53 -08:00
|
|
|
cw->c->wins = eina_inlist_remove(cw->c->wins, EINA_INLIST_GET(cw));
|
|
|
|
cw->c->wins = eina_inlist_append(cw->c->wins, EINA_INLIST_GET(cw));
|
2010-01-06 06:18:47 -08:00
|
|
|
evas_object_raise(cw->obj);
|
2010-01-14 20:41:20 -08:00
|
|
|
if (cw->shobj)
|
|
|
|
{
|
|
|
|
evas_object_stack_below(cw->shobj, cw->obj);
|
|
|
|
}
|
2010-01-06 22:29:53 -08:00
|
|
|
_e_mod_comp_win_render_queue(cw);
|
|
|
|
if (cw->input_only) return;
|
2010-01-06 06:18:47 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-01-14 20:41:20 -08:00
|
|
|
_e_mod_comp_win_lower(E_Comp_Win *cw)
|
2010-01-06 06:18:47 -08:00
|
|
|
{
|
2010-01-08 18:45:50 -08:00
|
|
|
DBG(" [0x%x] low\n", cw->win);
|
2010-01-06 22:29:53 -08:00
|
|
|
cw->c->wins = eina_inlist_remove(cw->c->wins, EINA_INLIST_GET(cw));
|
|
|
|
cw->c->wins = eina_inlist_prepend(cw->c->wins, EINA_INLIST_GET(cw));
|
2010-01-06 06:18:47 -08:00
|
|
|
evas_object_lower(cw->obj);
|
2010-01-14 20:41:20 -08:00
|
|
|
if (cw->shobj)
|
|
|
|
{
|
|
|
|
evas_object_stack_below(cw->shobj, cw->obj);
|
|
|
|
}
|
2010-01-06 22:29:53 -08:00
|
|
|
_e_mod_comp_win_render_queue(cw);
|
|
|
|
if (cw->input_only) return;
|
2010-01-06 06:18:47 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-01-14 20:41:20 -08:00
|
|
|
_e_mod_comp_win_configure(E_Comp_Win *cw, int x, int y, int w, int h, int border)
|
2010-01-06 06:18:47 -08:00
|
|
|
{
|
2010-01-06 07:04:33 -08:00
|
|
|
if (!((x == cw->x) && (y == cw->y)))
|
2010-01-06 06:18:47 -08:00
|
|
|
{
|
2010-01-08 18:45:50 -08:00
|
|
|
DBG(" [0x%x] mov %4i %4i\n", cw->win, x, y);
|
2010-01-06 06:18:47 -08:00
|
|
|
cw->x = x;
|
|
|
|
cw->y = y;
|
|
|
|
evas_object_move(cw->obj, cw->x, cw->y);
|
2010-01-14 20:41:20 -08:00
|
|
|
if (cw->shobj)
|
|
|
|
{
|
|
|
|
evas_object_move(cw->shobj, cw->x, cw->y);
|
|
|
|
}
|
2010-01-06 06:18:47 -08:00
|
|
|
}
|
|
|
|
if (!((w == cw->w) && (h == cw->h)))
|
|
|
|
{
|
2010-01-08 18:45:50 -08:00
|
|
|
DBG(" [0x%x] rsz %4ix%4i\n", cw->win, w, h);
|
2010-01-06 06:18:47 -08:00
|
|
|
// ecore_x_composite_unredirect_window(cw->win, ECORE_X_COMPOSITE_UPDATE_MANUAL);
|
|
|
|
// ecore_x_composite_redirect_window(cw->win, ECORE_X_COMPOSITE_UPDATE_MANUAL);
|
|
|
|
if (cw->pixmap)
|
|
|
|
{
|
|
|
|
ecore_x_pixmap_free(cw->pixmap);
|
|
|
|
cw->pixmap = 0;
|
2010-01-08 03:29:32 -08:00
|
|
|
cw->pw = 0;
|
|
|
|
cw->ph = 0;
|
2010-01-06 06:18:47 -08:00
|
|
|
}
|
|
|
|
cw->w = w;
|
|
|
|
cw->h = h;
|
2010-01-08 16:35:21 -08:00
|
|
|
evas_object_resize(cw->obj,
|
|
|
|
cw->w + (cw->border * 2),
|
|
|
|
cw->h + (cw->border * 2));
|
2010-01-14 20:41:20 -08:00
|
|
|
if (cw->shobj)
|
|
|
|
{
|
|
|
|
evas_object_resize(cw->shobj,
|
|
|
|
cw->w + (cw->border * 2),
|
|
|
|
cw->h + (cw->border * 2));
|
|
|
|
}
|
2010-01-06 06:18:47 -08:00
|
|
|
if (cw->xim)
|
|
|
|
{
|
|
|
|
evas_object_image_data_set(cw->obj, NULL);
|
|
|
|
ecore_x_image_free(cw->xim);
|
|
|
|
cw->xim = NULL;
|
|
|
|
}
|
|
|
|
}
|
2010-01-08 03:29:32 -08:00
|
|
|
if (cw->border != border)
|
|
|
|
{
|
|
|
|
cw->border = border;
|
2010-01-08 16:35:21 -08:00
|
|
|
evas_object_resize(cw->obj,
|
|
|
|
cw->w + (cw->border * 2),
|
|
|
|
cw->h + (cw->border * 2));
|
2010-01-14 20:41:20 -08:00
|
|
|
if (cw->shobj)
|
|
|
|
{
|
|
|
|
evas_object_resize(cw->shobj,
|
|
|
|
cw->w + (cw->border * 2),
|
|
|
|
cw->h + (cw->border * 2));
|
|
|
|
}
|
2010-01-08 03:29:32 -08:00
|
|
|
}
|
2010-01-06 06:18:47 -08:00
|
|
|
if (cw->input_only) return;
|
2010-01-06 22:29:53 -08:00
|
|
|
_e_mod_comp_win_render_queue(cw);
|
2010-01-06 06:18:47 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-01-14 20:41:20 -08:00
|
|
|
_e_mod_comp_win_damage(E_Comp_Win *cw, int x, int y, int w, int h, Eina_Bool dmg)
|
2010-01-06 06:18:47 -08:00
|
|
|
{
|
|
|
|
if (cw->input_only) return;
|
2010-01-08 18:45:50 -08:00
|
|
|
DBG(" [0x%x] dmg %4i %4i %4ix%4i\n", cw->win, x, y, w, h);
|
|
|
|
if ((dmg) && (cw->damage))
|
2010-01-06 06:18:47 -08:00
|
|
|
{
|
2010-01-08 03:29:32 -08:00
|
|
|
Ecore_X_Region parts;
|
|
|
|
|
|
|
|
parts = ecore_x_region_new(NULL, 0);
|
|
|
|
ecore_x_damage_subtract(cw->damage, 0, parts);
|
|
|
|
ecore_x_region_free(parts);
|
2010-01-06 06:18:47 -08:00
|
|
|
}
|
2010-02-01 06:15:14 -08:00
|
|
|
e_mod_comp_update_add(cw->up, x, y, w, h);
|
|
|
|
if (cw->counter)
|
|
|
|
{
|
|
|
|
if (!cw->update_timeout)
|
2010-02-01 06:38:00 -08:00
|
|
|
cw->update_timeout = ecore_timer_add
|
|
|
|
(ecore_animator_frametime_get() * 2,
|
|
|
|
_e_mod_comp_win_damage_timeout, cw);
|
2010-02-01 06:15:14 -08:00
|
|
|
return;
|
|
|
|
}
|
2010-01-06 22:29:53 -08:00
|
|
|
if (!cw->update)
|
|
|
|
{
|
|
|
|
cw->update = 1;
|
|
|
|
cw->c->updates = eina_list_append(cw->c->updates, cw);
|
|
|
|
}
|
2010-01-08 03:29:32 -08:00
|
|
|
_e_mod_comp_win_render_queue(cw);
|
2010-01-06 06:18:47 -08:00
|
|
|
}
|
|
|
|
|
2010-01-10 18:47:59 -08:00
|
|
|
static void
|
2010-01-14 20:41:20 -08:00
|
|
|
_e_mod_comp_win_reshape(E_Comp_Win *cw)
|
2010-01-10 18:47:59 -08:00
|
|
|
{
|
|
|
|
if (cw->shape_changed) return;
|
|
|
|
cw->shape_changed = 1;
|
|
|
|
if (!cw->update)
|
|
|
|
{
|
|
|
|
cw->update = 1;
|
|
|
|
cw->c->updates = eina_list_append(cw->c->updates, cw);
|
|
|
|
}
|
2010-01-10 19:31:59 -08:00
|
|
|
e_mod_comp_update_add(cw->up, 0, 0, cw->w, cw->h);
|
2010-01-10 18:47:59 -08:00
|
|
|
_e_mod_comp_win_render_queue(cw);
|
|
|
|
}
|
|
|
|
|
2010-01-06 06:18:47 -08:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
static int
|
|
|
|
_e_mod_comp_create(void *data, int type, void *event)
|
2010-01-14 20:41:20 -08:00
|
|
|
{
|
2010-01-06 06:18:47 -08:00
|
|
|
Ecore_X_Event_Window_Create *ev = event;
|
2010-01-14 20:41:20 -08:00
|
|
|
E_Comp_Win *cw;
|
|
|
|
E_Comp *c = _e_mod_comp_find(ev->parent);
|
2010-01-06 06:18:47 -08:00
|
|
|
if (!c) return 1;
|
|
|
|
if (_e_mod_comp_win_find(ev->win)) return 1;
|
|
|
|
if (c->win == ev->win) return 1;
|
|
|
|
if (c->ee_win == ev->win) return 1;
|
|
|
|
cw = _e_mod_comp_win_add(c, ev->win);
|
2010-01-11 00:43:24 -08:00
|
|
|
if (cw) _e_mod_comp_win_configure(cw, ev->x, ev->y, ev->w, ev->h, ev->border);
|
2010-01-06 06:18:47 -08:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
_e_mod_comp_destroy(void *data, int type, void *event)
|
2010-01-14 20:41:20 -08:00
|
|
|
{
|
2010-01-06 06:18:47 -08:00
|
|
|
Ecore_X_Event_Window_Destroy *ev = event;
|
2010-01-14 20:41:20 -08:00
|
|
|
E_Comp_Win *cw = _e_mod_comp_win_find(ev->win);
|
2010-01-06 06:18:47 -08:00
|
|
|
if (!cw) return 1;
|
|
|
|
_e_mod_comp_win_del(cw);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
_e_mod_comp_show(void *data, int type, void *event)
|
|
|
|
{
|
|
|
|
Ecore_X_Event_Window_Show *ev = event;
|
2010-01-14 20:41:20 -08:00
|
|
|
E_Comp_Win *cw = _e_mod_comp_win_find(ev->win);
|
2010-01-06 06:18:47 -08:00
|
|
|
if (!cw) return 1;
|
|
|
|
if (cw->visible) return 1;
|
|
|
|
_e_mod_comp_win_show(cw);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
_e_mod_comp_hide(void *data, int type, void *event)
|
|
|
|
{
|
|
|
|
Ecore_X_Event_Window_Hide *ev = event;
|
2010-01-14 20:41:20 -08:00
|
|
|
E_Comp_Win *cw = _e_mod_comp_win_find(ev->win);
|
2010-01-06 06:18:47 -08:00
|
|
|
if (!cw) return 1;
|
|
|
|
if (!cw->visible) return 1;
|
|
|
|
_e_mod_comp_win_hide(cw);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
_e_mod_comp_reparent(void *data, int type, void *event)
|
|
|
|
{
|
|
|
|
Ecore_X_Event_Window_Reparent *ev = event;
|
2010-01-14 20:41:20 -08:00
|
|
|
E_Comp_Win *cw = _e_mod_comp_win_find(ev->win);
|
2010-01-06 06:18:47 -08:00
|
|
|
if (!cw) return 1;
|
2010-01-08 18:45:50 -08:00
|
|
|
DBG("== repar [0x%x] to [0x%x]\n", ev->win, ev->parent);
|
2010-01-06 06:18:47 -08:00
|
|
|
if (ev->parent != cw->c->man->root)
|
|
|
|
_e_mod_comp_win_del(cw);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
_e_mod_comp_configure(void *data, int type, void *event)
|
|
|
|
{
|
|
|
|
Ecore_X_Event_Window_Configure *ev = event;
|
2010-01-14 20:41:20 -08:00
|
|
|
E_Comp_Win *cw = _e_mod_comp_win_find(ev->win);
|
2010-01-06 06:18:47 -08:00
|
|
|
if (!cw) return 1;
|
|
|
|
|
|
|
|
if (ev->abovewin == 0)
|
|
|
|
{
|
|
|
|
if (EINA_INLIST_GET(cw)->prev) _e_mod_comp_win_lower(cw);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2010-01-14 20:41:20 -08:00
|
|
|
E_Comp_Win *cw2 = _e_mod_comp_win_find(ev->abovewin);
|
2010-01-06 06:18:47 -08:00
|
|
|
|
|
|
|
if (cw2)
|
|
|
|
{
|
2010-01-14 20:41:20 -08:00
|
|
|
E_Comp_Win *cw3 = (E_Comp_Win *)(EINA_INLIST_GET(cw)->prev);
|
2010-01-06 22:29:53 -08:00
|
|
|
|
|
|
|
if (cw3 != cw2)
|
2010-01-07 05:45:51 -08:00
|
|
|
_e_mod_comp_win_raise_above(cw, cw2);
|
2010-01-06 06:18:47 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!((cw->x == ev->x) && (cw->y == ev->y) &&
|
|
|
|
(cw->w == ev->h) && (cw->h == ev->h) &&
|
|
|
|
(cw->border == ev->border)))
|
|
|
|
{
|
|
|
|
_e_mod_comp_win_configure(cw, ev->x, ev->y, ev->w, ev->h, ev->border);
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
_e_mod_comp_stack(void *data, int type, void *event)
|
|
|
|
{
|
|
|
|
Ecore_X_Event_Window_Stack *ev = event;
|
2010-01-14 20:41:20 -08:00
|
|
|
E_Comp_Win *cw = _e_mod_comp_win_find(ev->win);
|
2010-01-06 06:18:47 -08:00
|
|
|
if (!cw) return 1;
|
|
|
|
if (ev->detail == ECORE_X_WINDOW_STACK_ABOVE) _e_mod_comp_win_raise(cw);
|
|
|
|
else _e_mod_comp_win_lower(cw);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
_e_mod_comp_property(void *data, int type, void *event)
|
2010-01-14 20:41:20 -08:00
|
|
|
{
|
2010-01-06 06:18:47 -08:00
|
|
|
Ecore_X_Event_Window_Property *ev = event;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
_e_mod_comp_message(void *data, int type, void *event)
|
2010-01-14 20:41:20 -08:00
|
|
|
{
|
2010-01-06 06:18:47 -08:00
|
|
|
Ecore_X_Event_Client_Message *ev = event;
|
2010-02-01 06:15:14 -08:00
|
|
|
E_Comp_Win *cw = NULL;
|
|
|
|
if ((ev->message_type != ECORE_X_ATOM_E_COMP_SYNC_DRAW_DONE) ||
|
|
|
|
(ev->format != 32)) return 1;
|
|
|
|
cw = _e_mod_comp_border_client_find(ev->data.l[0]);
|
|
|
|
if (!cw) return 1;
|
|
|
|
if (!cw->bd) return 1;
|
|
|
|
if (ev->data.l[0] != cw->bd->client.win) return 1;
|
|
|
|
if (cw->bd)
|
|
|
|
{
|
|
|
|
if (cw->counter)
|
|
|
|
{
|
|
|
|
if (!cw->update)
|
|
|
|
{
|
|
|
|
if (cw->update_timeout)
|
|
|
|
{
|
|
|
|
ecore_timer_del(cw->update_timeout);
|
|
|
|
cw->update_timeout = NULL;
|
|
|
|
}
|
|
|
|
cw->update = 1;
|
|
|
|
cw->c->updates = eina_list_append(cw->c->updates, cw);
|
|
|
|
}
|
|
|
|
cw->drawme = 1;
|
|
|
|
_e_mod_comp_win_render_queue(cw);
|
|
|
|
}
|
|
|
|
}
|
2010-01-06 06:18:47 -08:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
_e_mod_comp_shape(void *data, int type, void *event)
|
2010-01-14 20:41:20 -08:00
|
|
|
{
|
2010-01-06 06:18:47 -08:00
|
|
|
Ecore_X_Event_Window_Shape *ev = event;
|
2010-01-14 20:41:20 -08:00
|
|
|
E_Comp_Win *cw = _e_mod_comp_win_find(ev->win);
|
2010-01-10 18:47:59 -08:00
|
|
|
if (!cw) return 1;
|
|
|
|
_e_mod_comp_win_reshape(cw);
|
2010-01-06 06:18:47 -08:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
_e_mod_comp_damage(void *data, int type, void *event)
|
|
|
|
{
|
|
|
|
Ecore_X_Event_Damage *ev = event;
|
2010-01-14 20:41:20 -08:00
|
|
|
E_Comp_Win *cw = _e_mod_comp_win_damage_find(ev->damage);
|
2010-01-06 06:18:47 -08:00
|
|
|
if (!cw) return 1;
|
2010-01-07 05:45:51 -08:00
|
|
|
_e_mod_comp_win_damage(cw,
|
|
|
|
ev->area.x, ev->area.y,
|
2010-01-08 03:29:32 -08:00
|
|
|
ev->area.width, ev->area.height, 1);
|
2010-01-06 06:18:47 -08:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2010-01-14 21:54:14 -08:00
|
|
|
static int
|
|
|
|
_e_mod_comp_randr(void *data, int type, void *event)
|
|
|
|
{
|
|
|
|
Eina_List *l;
|
|
|
|
E_Comp *c;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(compositors, l, c)
|
|
|
|
{
|
|
|
|
ecore_evas_resize(c->ee, c->man->w, c->man->h);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-01-14 20:41:20 -08:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
static E_Comp *
|
2010-01-06 06:18:47 -08:00
|
|
|
_e_mod_comp_add(E_Manager *man)
|
|
|
|
{
|
2010-01-14 20:41:20 -08:00
|
|
|
E_Comp *c;
|
2010-01-06 06:18:47 -08:00
|
|
|
Ecore_X_Window *wins;
|
2010-01-11 00:43:24 -08:00
|
|
|
Ecore_X_Window_Attributes att;
|
2010-01-06 06:18:47 -08:00
|
|
|
int i, num;
|
|
|
|
|
2010-01-14 20:41:20 -08:00
|
|
|
c = calloc(1, sizeof(E_Comp));
|
2010-01-06 06:18:47 -08:00
|
|
|
if (!c) return NULL;
|
2010-02-01 06:15:14 -08:00
|
|
|
|
2010-02-01 06:38:00 -08:00
|
|
|
ecore_x_e_comp_sync_supported_set(man->root, _comp_mod->conf->efl_sync);
|
2010-02-01 06:15:14 -08:00
|
|
|
|
2010-01-06 06:18:47 -08:00
|
|
|
c->man = man;
|
|
|
|
c->win = ecore_x_composite_render_window_enable(man->root);
|
2010-01-11 00:43:24 -08:00
|
|
|
if (!c->win)
|
|
|
|
{
|
|
|
|
e_util_dialog_internal
|
|
|
|
(_("Compositor Error"),
|
|
|
|
_("Your screen does not support the compositor<br>"
|
|
|
|
"overlay window. This is needed for it to<br>"
|
|
|
|
"function."));
|
|
|
|
free(c);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
memset((&att), 0, sizeof(Ecore_X_Window_Attributes));
|
|
|
|
ecore_x_window_attributes_get(c->win, &att);
|
|
|
|
|
2010-01-14 20:41:20 -08:00
|
|
|
if ((att.depth != 24) && (att.depth != 32))
|
2010-01-11 00:43:24 -08:00
|
|
|
{
|
|
|
|
e_util_dialog_internal
|
|
|
|
(_("Compositor Error"),
|
|
|
|
_("Your screen is not in 24/32bit display mode.<br>"
|
|
|
|
"This is required to be your default depth<br>"
|
|
|
|
"setting for the compositor to work properly."));
|
|
|
|
ecore_x_composite_render_window_disable(c->win);
|
|
|
|
free(c);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2010-01-06 07:04:33 -08:00
|
|
|
if (c->man->num == 0) e_alert_composite_win = c->win;
|
2010-01-19 06:28:56 -08:00
|
|
|
|
|
|
|
if (_comp_mod->conf->engine == E_EVAS_ENGINE_GL_X11)
|
|
|
|
{
|
|
|
|
c->ee = ecore_evas_gl_x11_new(NULL, c->win, 0, 0, man->w, man->h);
|
2010-01-24 03:05:18 -08:00
|
|
|
if (c->ee)
|
|
|
|
{
|
|
|
|
c->gl = 1;
|
|
|
|
ecore_evas_gl_x11_pre_post_swap_callback_set
|
|
|
|
(c->ee, c, _e_mod_comp_pre_swap, NULL);
|
|
|
|
}
|
2010-01-19 06:28:56 -08:00
|
|
|
}
|
|
|
|
if (!c->ee)
|
|
|
|
c->ee = ecore_evas_software_x11_new(NULL, c->win, 0, 0, man->w, man->h);
|
|
|
|
|
2010-02-01 06:15:14 -08:00
|
|
|
ecore_evas_comp_sync_set(c->ee, 0);
|
2010-01-31 05:05:56 -08:00
|
|
|
ecore_evas_manual_render_set(c->ee, _comp_mod->conf->lock_fps);
|
2010-01-06 06:18:47 -08:00
|
|
|
c->evas = ecore_evas_get(c->ee);
|
|
|
|
ecore_evas_show(c->ee);
|
|
|
|
|
|
|
|
c->ee_win = ecore_evas_software_x11_window_get(c->ee);
|
2010-01-08 00:24:46 -08:00
|
|
|
ecore_x_screen_is_composited_set(c->man->num, c->ee_win);
|
2010-01-06 06:18:47 -08:00
|
|
|
// ecore_x_composite_unredirect_subwindows
|
|
|
|
// (c->man->root, ECORE_X_COMPOSITE_UPDATE_MANUAL);
|
|
|
|
|
|
|
|
wins = ecore_x_window_children_get(c->man->root, &num);
|
|
|
|
if (wins)
|
|
|
|
{
|
|
|
|
for (i = 0; i < num; i++)
|
|
|
|
{
|
2010-01-14 20:41:20 -08:00
|
|
|
E_Comp_Win *cw;
|
2010-01-06 06:18:47 -08:00
|
|
|
int x, y, w, h, border;
|
|
|
|
|
|
|
|
cw = _e_mod_comp_win_add(c, wins[i]);
|
|
|
|
if (!cw) continue;
|
|
|
|
ecore_x_window_geometry_get(cw->win, &x, &y, &w, &h);
|
|
|
|
border = ecore_x_window_border_width_get(cw->win);
|
|
|
|
if (wins[i] == c->win) continue;
|
|
|
|
_e_mod_comp_win_configure(cw, x, y, w, h, border);
|
|
|
|
if (ecore_x_window_visible_get(wins[i]))
|
|
|
|
{
|
|
|
|
_e_mod_comp_win_show(cw);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
free(wins);
|
|
|
|
}
|
|
|
|
|
|
|
|
return c;
|
|
|
|
}
|
|
|
|
|
2010-01-11 00:43:24 -08:00
|
|
|
static void
|
2010-01-14 20:41:20 -08:00
|
|
|
_e_mod_comp_del(E_Comp *c)
|
2010-01-11 00:43:24 -08:00
|
|
|
{
|
2010-01-14 20:41:20 -08:00
|
|
|
E_Comp_Win *cw;
|
2010-01-11 00:43:24 -08:00
|
|
|
|
2010-01-24 03:05:18 -08:00
|
|
|
if (c->grabbed)
|
|
|
|
{
|
|
|
|
c->grabbed = 0;
|
|
|
|
ecore_x_ungrab();
|
|
|
|
}
|
2010-01-11 00:43:24 -08:00
|
|
|
ecore_x_screen_is_composited_set(c->man->num, 0);
|
|
|
|
while (c->wins)
|
|
|
|
{
|
2010-01-14 20:41:20 -08:00
|
|
|
cw = (E_Comp_Win *)(c->wins);
|
2010-02-01 06:15:14 -08:00
|
|
|
if (cw->counter)
|
|
|
|
{
|
|
|
|
ecore_x_sync_counter_free(cw->counter);
|
|
|
|
cw->counter = 0;
|
|
|
|
}
|
2010-01-11 00:43:24 -08:00
|
|
|
_e_mod_comp_win_hide(cw);
|
|
|
|
_e_mod_comp_win_del(cw);
|
|
|
|
}
|
|
|
|
ecore_evas_free(c->ee);
|
|
|
|
// ecore_x_composite_unredirect_subwindows
|
|
|
|
// (c->man->root, ECORE_X_COMPOSITE_UPDATE_MANUAL);
|
|
|
|
ecore_x_composite_render_window_disable(c->win);
|
|
|
|
if (c->man->num == 0) e_alert_composite_win = 0;
|
|
|
|
if (c->render_animator) ecore_animator_del(c->render_animator);
|
2010-01-31 05:05:56 -08:00
|
|
|
if (c->update_job) ecore_job_del(c->update_job);
|
2010-02-01 06:15:14 -08:00
|
|
|
|
|
|
|
ecore_x_e_comp_sync_supported_set(c->man->root, 0);
|
|
|
|
|
2010-01-11 00:43:24 -08:00
|
|
|
free(c);
|
|
|
|
}
|
|
|
|
|
2010-01-06 06:18:47 -08:00
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2010-01-04 04:27:15 -08:00
|
|
|
Eina_Bool
|
|
|
|
e_mod_comp_init(void)
|
|
|
|
{
|
2010-01-06 06:18:47 -08:00
|
|
|
Eina_List *l;
|
|
|
|
E_Manager *man;
|
|
|
|
|
|
|
|
windows = eina_hash_string_superfast_new(NULL);
|
2010-02-01 06:15:14 -08:00
|
|
|
borders = eina_hash_string_superfast_new(NULL);
|
2010-01-06 06:18:47 -08:00
|
|
|
damages = eina_hash_string_superfast_new(NULL);
|
|
|
|
|
|
|
|
handlers = eina_list_append(handlers, ecore_event_handler_add(ECORE_X_EVENT_WINDOW_CREATE, _e_mod_comp_create, NULL));
|
|
|
|
handlers = eina_list_append(handlers, ecore_event_handler_add(ECORE_X_EVENT_WINDOW_DESTROY, _e_mod_comp_destroy, NULL));
|
|
|
|
handlers = eina_list_append(handlers, ecore_event_handler_add(ECORE_X_EVENT_WINDOW_SHOW, _e_mod_comp_show, NULL));
|
|
|
|
handlers = eina_list_append(handlers, ecore_event_handler_add(ECORE_X_EVENT_WINDOW_HIDE, _e_mod_comp_hide, NULL));
|
|
|
|
handlers = eina_list_append(handlers, ecore_event_handler_add(ECORE_X_EVENT_WINDOW_REPARENT, _e_mod_comp_reparent, NULL));
|
|
|
|
handlers = eina_list_append(handlers, ecore_event_handler_add(ECORE_X_EVENT_WINDOW_CONFIGURE, _e_mod_comp_configure, NULL));
|
|
|
|
handlers = eina_list_append(handlers, ecore_event_handler_add(ECORE_X_EVENT_WINDOW_STACK, _e_mod_comp_stack, NULL));
|
|
|
|
handlers = eina_list_append(handlers, ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROPERTY, _e_mod_comp_property, NULL));
|
|
|
|
handlers = eina_list_append(handlers, ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE, _e_mod_comp_message, NULL));
|
|
|
|
handlers = eina_list_append(handlers, ecore_event_handler_add(ECORE_X_EVENT_WINDOW_SHAPE, _e_mod_comp_shape, NULL));
|
|
|
|
handlers = eina_list_append(handlers, ecore_event_handler_add(ECORE_X_EVENT_DAMAGE_NOTIFY, _e_mod_comp_damage, NULL));
|
|
|
|
|
2010-01-14 21:54:14 -08:00
|
|
|
handlers = eina_list_append(handlers, ecore_event_handler_add(E_EVENT_CONTAINER_RESIZE, _e_mod_comp_randr, NULL));
|
|
|
|
|
2010-01-06 06:18:47 -08:00
|
|
|
EINA_LIST_FOREACH(e_manager_list(), l, man)
|
|
|
|
{
|
2010-01-14 20:41:20 -08:00
|
|
|
E_Comp *c;
|
2010-01-11 00:43:24 -08:00
|
|
|
|
|
|
|
c = _e_mod_comp_add(man);
|
|
|
|
if (c) compositors = eina_list_append(compositors, c);
|
2010-01-06 06:18:47 -08:00
|
|
|
}
|
|
|
|
|
2010-01-04 04:27:15 -08:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
e_mod_comp_shutdown(void)
|
|
|
|
{
|
2010-01-14 20:41:20 -08:00
|
|
|
E_Comp *c;
|
2010-01-06 06:18:47 -08:00
|
|
|
|
2010-01-11 00:43:24 -08:00
|
|
|
EINA_LIST_FREE(compositors, c) _e_mod_comp_del(c);
|
2010-01-06 06:18:47 -08:00
|
|
|
|
|
|
|
E_FREE_LIST(handlers, ecore_event_handler_del);
|
|
|
|
|
|
|
|
eina_hash_free(damages);
|
|
|
|
eina_hash_free(windows);
|
2010-02-01 06:15:14 -08:00
|
|
|
eina_hash_free(borders);
|
2010-01-04 04:27:15 -08:00
|
|
|
}
|
2010-01-14 20:41:20 -08:00
|
|
|
|
|
|
|
void
|
|
|
|
e_mod_comp_shadow_set(void)
|
|
|
|
{
|
|
|
|
Eina_List *l;
|
|
|
|
E_Comp *c;
|
|
|
|
|
|
|
|
EINA_LIST_FOREACH(compositors, l, c)
|
|
|
|
{
|
|
|
|
E_Comp_Win *cw;
|
|
|
|
|
2010-01-31 05:05:56 -08:00
|
|
|
ecore_evas_manual_render_set(c->ee, _comp_mod->conf->lock_fps);
|
2010-01-14 20:41:20 -08:00
|
|
|
EINA_INLIST_FOREACH(c->wins, cw)
|
|
|
|
{
|
2010-01-19 20:45:47 -08:00
|
|
|
if (evas_object_visible_get(cw->obj) && (cw->shobj))
|
2010-01-14 20:41:20 -08:00
|
|
|
{
|
|
|
|
if (_comp_mod->conf->use_shadow)
|
|
|
|
{
|
2010-01-31 05:05:56 -08:00
|
|
|
if (_e_mod_comp_win_do_shadow(cw))
|
2010-01-14 20:41:20 -08:00
|
|
|
{
|
|
|
|
int ok = 0;
|
|
|
|
char buf[PATH_MAX];
|
|
|
|
|
|
|
|
if (_comp_mod->conf->shadow_file)
|
|
|
|
{
|
|
|
|
ok = 1;
|
|
|
|
if (!edje_object_file_set(cw->shobj,
|
|
|
|
_comp_mod->conf->shadow_file,
|
|
|
|
"shadow"))
|
|
|
|
ok = 0;
|
|
|
|
}
|
|
|
|
if (!ok)
|
|
|
|
{
|
|
|
|
ok = 1;
|
|
|
|
if (!e_theme_edje_object_set(cw->shobj,
|
|
|
|
"base/theme/borders",
|
|
|
|
"e/shadow/box"))
|
|
|
|
ok = 0;
|
|
|
|
}
|
|
|
|
if (!ok)
|
|
|
|
{
|
|
|
|
snprintf(buf, sizeof(buf), "%s/shadow.edj",
|
|
|
|
e_module_dir_get(_comp_mod->module)
|
|
|
|
);
|
|
|
|
edje_object_file_set(cw->shobj, buf, "shadow");
|
|
|
|
}
|
|
|
|
evas_object_show(cw->shobj);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
evas_object_hide(cw->shobj);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
E_Comp *
|
|
|
|
e_mod_comp_manager_get(E_Manager *man)
|
|
|
|
{
|
|
|
|
return _e_mod_comp_find(man->root);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
void
|
|
|
|
e_mod_comp_callback_win_add_add(E_Comp *c, void (*func) (void *data, Comp *c, Comp_Win *cw), void *data)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
e_mod_comp_callback_win_add_del(E_Comp *c, void (*func) (void *data, Comp *c, Comp_Win *cw), void *data)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
e_mod_comp_callback_del_add(E_Comp *c, void (*func) (void *data, Comp *c), void *data)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
e_mod_comp_callback_del_delE_Comp *c, void (*func) (void *data, Comp *c), void *data)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
|
|
|
E_Comp_Win *
|
|
|
|
e_mod_comp_win_find_by_window(E_Comp *c, Ecore_X_Window win)
|
|
|
|
{
|
|
|
|
E_Comp_Win *cw;
|
|
|
|
|
|
|
|
EINA_INLIST_FOREACH(c->wins, cw)
|
|
|
|
{
|
|
|
|
if (cw->win == win) return cw;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
E_Comp_Win *
|
|
|
|
e_mod_comp_win_find_by_border(E_Comp *c, E_Border *bd)
|
|
|
|
{
|
|
|
|
E_Comp_Win *cw;
|
|
|
|
|
|
|
|
EINA_INLIST_FOREACH(c->wins, cw)
|
|
|
|
{
|
|
|
|
if (cw->bd == bd) return cw;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
E_Comp_Win *
|
|
|
|
e_mod_comp_win_find_by_popup(E_Comp *c, E_Popup *pop)
|
|
|
|
{
|
|
|
|
E_Comp_Win *cw;
|
|
|
|
|
|
|
|
EINA_INLIST_FOREACH(c->wins, cw)
|
|
|
|
{
|
|
|
|
if (cw->pop == pop) return cw;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
E_Comp_Win *
|
|
|
|
e_mod_comp_win_find_by_menu(E_Comp *c, E_Menu *menu)
|
|
|
|
{
|
|
|
|
E_Comp_Win *cw;
|
|
|
|
|
|
|
|
EINA_INLIST_FOREACH(c->wins, cw)
|
|
|
|
{
|
|
|
|
if (cw->menu == menu) return cw;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
Evas_Object *
|
|
|
|
e_mod_comp_win_evas_object_get(E_Comp_Win *cw)
|
|
|
|
{
|
|
|
|
return cw->obj;
|
|
|
|
}
|
|
|
|
|
|
|
|
Evas_Object *
|
|
|
|
e_mod_comp_win_mirror_object_add(Evas *e, E_Comp_Win *cw)
|
|
|
|
{
|
|
|
|
}
|