From eed1782f5f78ebbe9770e7fcae2feddc095b96f7 Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Wed, 10 Feb 2010 14:13:29 +0000 Subject: [PATCH] and some more compositor work - now its looking mroe solid. SVN revision: 46045 --- src/bin/e_init.c | 10 +++++ src/bin/e_init.h | 5 ++- src/bin/e_main.c | 16 ++++---- src/modules/comp/e_mod_comp.c | 73 +++++++++++++++++++++++++++-------- src/modules/comp/e_mod_main.c | 26 ++++++++++++- 5 files changed, 103 insertions(+), 27 deletions(-) diff --git a/src/bin/e_init.c b/src/bin/e_init.c index b32f3c01d..291871f06 100644 --- a/src/bin/e_init.c +++ b/src/bin/e_init.c @@ -3,6 +3,8 @@ */ #include "e.h" +EAPI int E_EVENT_INIT_DONE = 0; + /* local function prototypes */ static int _e_init_cb_exe_event_del(void *data __UNUSED__, int type __UNUSED__, void *event); @@ -20,6 +22,7 @@ static Eina_List *stats = NULL; EAPI int e_init_init(void) { + E_EVENT_INIT_DONE = ecore_event_type_new(); exe_del_handler = ecore_event_handler_add(ECORE_EXE_EVENT_DEL, _e_init_cb_exe_event_del, NULL); @@ -122,6 +125,7 @@ e_init_done(void) undone--; if (undone > 0) return; done = 1; + ecore_event_add(E_EVENT_INIT_DONE, NULL, NULL, NULL); // printf("---DONE %p\n", client); if (!client) return; ecore_ipc_client_send(client, E_IPC_DOMAIN_INIT, 2, 0, 0, 0, NULL, 0); @@ -199,6 +203,12 @@ e_init_client_del(Ecore_Ipc_Event_Client_Del *e) } } +EAPI int +e_init_count_get(void) +{ + return undone; +} + /* local functions */ static int _e_init_cb_exe_event_del(void *data __UNUSED__, int type __UNUSED__, void *event) diff --git a/src/bin/e_init.h b/src/bin/e_init.h index 1ea950970..45526054a 100644 --- a/src/bin/e_init.h +++ b/src/bin/e_init.h @@ -17,6 +17,9 @@ EAPI void e_init_done(void); EAPI void e_init_undone(void); EAPI void e_init_client_data(Ecore_Ipc_Event_Client_Data *e); EAPI void e_init_client_del(Ecore_Ipc_Event_Client_Del *e); - +EAPI int e_init_count_get(void); + +extern EAPI int E_EVENT_INIT_DONE; + #endif #endif diff --git a/src/bin/e_main.c b/src/bin/e_main.c index a4e8996b9..7ff0172ea 100644 --- a/src/bin/e_main.c +++ b/src/bin/e_main.c @@ -662,19 +662,19 @@ main(int argc, char **argv) _e_main_shutdown_push(e_moveresize_shutdown); TS("splash"); + /* setup init status window/screen */ + if (!e_init_init()) + { + e_error_message_show(_("Enlightenment cannot set up init screen.\n" + "Perhaps you are out of memory?")); + _e_main_shutdown(-1); + } + _e_main_shutdown_push(e_init_shutdown); if (!((!e_config->show_splash) || (after_restart))) { - /* setup init status window/screen */ - if (!e_init_init()) - { - e_error_message_show(_("Enlightenment cannot set up init screen.\n" - "Perhaps you are out of memory?")); - _e_main_shutdown(-1); - } e_init_title_set(_("Enlightenment")); e_init_version_set(VERSION); e_init_show(); - _e_main_shutdown_push(e_init_shutdown); pause(); } if (!really_know) diff --git a/src/modules/comp/e_mod_comp.c b/src/modules/comp/e_mod_comp.c index 41fdfc21e..257bc7148 100644 --- a/src/modules/comp/e_mod_comp.c +++ b/src/modules/comp/e_mod_comp.c @@ -255,7 +255,7 @@ _e_mod_comp_win_move_effects_add(E_Comp_Win *cw) ////////////////////////////////////////////////////////////////////////// -#if 1 +#if 0 #define DBG(f, x...) printf(f, ##x) #else #define DBG(f, x...) @@ -351,8 +351,9 @@ static void _e_mod_comp_win_update(E_Comp_Win *cw) { E_Update_Rect *r; - int i, new_pixmap = 0; + int i/*, new_pixmap = 0*/; + ecore_x_grab(); cw->update = 0; if (!cw->pixmap) { @@ -382,11 +383,15 @@ _e_mod_comp_win_update(E_Comp_Win *cw) cw->pw = 0; cw->ph = 0; } - else - new_pixmap = 1; +// else +// new_pixmap = 1; cw->native = 0; } - if (!((cw->pw > 0) && (cw->ph > 0))) return; + if (!((cw->pw > 0) && (cw->ph > 0))) + { + ecore_x_ungrab(); + return; + } if ((cw->pw != cw->w) || (cw->ph != cw->h)) { @@ -408,6 +413,7 @@ _e_mod_comp_win_update(E_Comp_Win *cw) cw->h + (cw->border * 2)); } } + ecore_x_ungrab(); if ((cw->c->gl) && (_comp_mod->conf->texture_from_pixmap) && (!cw->shaped) && (!cw->shape_changed)) @@ -415,6 +421,7 @@ _e_mod_comp_win_update(E_Comp_Win *cw) //y if (new_pixmap) //y e_mod_comp_update_add(cw->up, 0, 0, cw->pw, cw->ph); +// DBG("DEBUG - pm now %x\n", ecore_x_composite_name_window_pixmap_get(cw->win)); evas_object_image_size_set(cw->obj, cw->pw, cw->ph); if (!cw->native) { @@ -436,7 +443,7 @@ _e_mod_comp_win_update(E_Comp_Win *cw) 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); + DBG("UPDATE [0x%x] pm [0x%x] %i %i %ix%i\n", cw->win, cw->pixmap, x, y, w, h); evas_object_image_data_update_add(cw->obj, x, y, w, h); } free(r); @@ -764,7 +771,7 @@ _e_mod_comp_win_add(E_Comp *c, Ecore_X_Window win) { cw->redirected = 1; ecore_x_composite_redirect_window(cw->win, ECORE_X_COMPOSITE_UPDATE_MANUAL); - _e_mod_comp_win_damage(cw, 0, 0, cw->w, cw->h, 0); +//z _e_mod_comp_win_damage(cw, 0, 0, cw->w, cw->h, 0); } DBG(" [0x%x] add\n", cw->win); return cw; @@ -873,7 +880,7 @@ _e_mod_comp_win_show(E_Comp_Win *cw) { cw->redirected = 1; ecore_x_composite_redirect_window(cw->win, ECORE_X_COMPOSITE_UPDATE_MANUAL); - _e_mod_comp_win_damage(cw, 0, 0, cw->w, cw->h, 0); +//z _e_mod_comp_win_damage(cw, 0, 0, cw->w, cw->h, 0); } // FIXME: only do this if no bd set @@ -1016,7 +1023,38 @@ _e_mod_comp_win_hide(E_Comp_Win *cw) evas_object_hide(cw->obj); if (cw->shobj) evas_object_hide(cw->shobj); - if (_comp_mod->conf->keep_unmapped) return; + if (_comp_mod->conf->keep_unmapped) + { + // fixme: ask the x homies. why does this need to be done? + // why free pixmap (+texture bound), undriect, then redirect again + // getting pixmap againand well - getting texture too again. why? + if (cw->redirected) + { + if (cw->native) evas_object_image_native_surface_set(cw->obj, NULL); + if (cw->pixmap) ecore_x_pixmap_free(cw->pixmap); + evas_object_image_size_set(cw->obj, 1, 1); + cw->pixmap = 0; + cw->pw = 0; + cw->ph = 0; + cw->native = 0; + ecore_x_composite_unredirect_window(cw->win, ECORE_X_COMPOSITE_UPDATE_MANUAL); + ecore_x_composite_redirect_window(cw->win, ECORE_X_COMPOSITE_UPDATE_MANUAL); + 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; + } + if ((cw->pw <= 0) || (cw->ph <= 0)) + { + ecore_x_pixmap_free(cw->pixmap); + cw->pixmap = 0; + } + } + return; + } if (cw->redirected) { @@ -1161,7 +1199,7 @@ static void _e_mod_comp_win_damage(E_Comp_Win *cw, int x, int y, int w, int h, Eina_Bool dmg) { if ((cw->input_only) || (cw->invalid)) return; - DBG(" [0x%x] dmg %4i %4i %4ix%4i\n", cw->win, x, y, w, h); + DBG(" [0x%x] dmg [%x] %4i %4i %4ix%4i\n", cw->win, cw->damage, x, y, w, h); if ((dmg) && (cw->damage)) { Ecore_X_Region parts; @@ -1171,13 +1209,16 @@ _e_mod_comp_win_damage(E_Comp_Win *cw, int x, int y, int w, int h, Eina_Bool dmg ecore_x_region_free(parts); } e_mod_comp_update_add(cw->up, x, y, w, h); - if (cw->counter) + if (dmg) { - if (!cw->update_timeout) - cw->update_timeout = ecore_timer_add - (ecore_animator_frametime_get() * 2, - _e_mod_comp_win_damage_timeout, cw); - return; + if (cw->counter) + { + if (!cw->update_timeout) + cw->update_timeout = ecore_timer_add + (ecore_animator_frametime_get() * 2, + _e_mod_comp_win_damage_timeout, cw); + return; + } } if (!cw->update) { diff --git a/src/modules/comp/e_mod_main.c b/src/modules/comp/e_mod_main.c index 91f10e79d..022a8aa7f 100644 --- a/src/modules/comp/e_mod_main.c +++ b/src/modules/comp/e_mod_main.c @@ -3,6 +3,20 @@ #include "e_mod_config.h" #include "e_mod_comp.h" +static Ecore_Event_Handler *init_done_handler = NULL; + +static int +_e_init_done(void *data, int type, void *event) +{ + ecore_event_handler_del(init_done_handler); + init_done_handler = NULL; + if (!e_mod_comp_init()) + { + // FIXME: handle if comp init fails + } + return 1; +} + /* module private routines */ Mod *_comp_mod = NULL; @@ -75,9 +89,17 @@ e_modapi_init(E_Module *m) _comp_mod = mod; - if (!e_mod_comp_init()) + if (e_init_count_get() <= 0) { - // FIXME: handle if comp init fails + if (!e_mod_comp_init()) + { + // FIXME: handle if comp init fails + } + } + else + { + init_done_handler = ecore_event_handler_add(E_EVENT_INIT_DONE, + _e_init_done, NULL); } return mod;