forked from enlightenment/efl
ecore-evas-x: set draw_block until the window receives a configure event (#2)
Summary: drawing a non-override window before receiving a configure event results in an unsized window, breaking spec. it also prevents ecore-evas resize callbacks from triggering, yielding undefined returns from functions which attempt to get the geometry of the ecore-evas this patch improves upon the previous version by handling the case of windows which are created with the correct initial size, bypassing an initial configure event there is still a lot of work to be done in this engine to improve/consolidate resize-related code and ensure protocol correctness ref T7008 fix T6907 Reviewers: devilhorns, ManMower Subscribers: cedric, #committers Tags: #efl Maniphest Tasks: T7008, T6907 Differential Revision: https://phab.enlightenment.org/D6275
This commit is contained in:
parent
cc726c011e
commit
4aad39ce03
|
@ -53,7 +53,7 @@
|
|||
|
||||
static int _ecore_evas_init_count = 0;
|
||||
|
||||
static Ecore_Event_Handler *ecore_evas_event_handlers[13];
|
||||
static Ecore_Event_Handler *ecore_evas_event_handlers[14];
|
||||
|
||||
static int leader_ref = 0;
|
||||
static Ecore_X_Window leader_win = 0;
|
||||
|
@ -131,6 +131,8 @@ struct _Ecore_Evas_Engine_Data_X11 {
|
|||
unsigned long colormap; // store colormap used to create pixmap
|
||||
} pixmap;
|
||||
Eina_Bool destroyed : 1; // X window has been deleted and cannot be used
|
||||
Eina_Bool fully_obscured : 1; // X window is fully obscured
|
||||
Eina_Bool configured : 1; // X window has been configured
|
||||
};
|
||||
|
||||
static Ecore_Evas_Interface_X11 * _ecore_evas_x_interface_x11_new(void);
|
||||
|
@ -1065,17 +1067,43 @@ _ecore_evas_x_event_visibility_change(void *data EINA_UNUSED, int type EINA_UNUS
|
|||
edata = ee->engine.data;
|
||||
if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
|
||||
// printf("VIS CHANGE OBSCURED: %p %i\n", ee, e->fully_obscured);
|
||||
edata->fully_obscured = e->fully_obscured;
|
||||
if (e->fully_obscured)
|
||||
{
|
||||
/* FIXME: round trip */
|
||||
if (!ecore_x_screen_is_composited(edata->screen_num))
|
||||
ee->draw_block = EINA_TRUE;
|
||||
ee->draw_block = !edata->configured;
|
||||
}
|
||||
else if (ee->draw_block)
|
||||
{
|
||||
if (!edata->configure_coming)
|
||||
edata->configured = 1;
|
||||
ee->draw_block = !edata->configured;
|
||||
}
|
||||
else
|
||||
ee->draw_block = EINA_FALSE;
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_ecore_evas_x_event_window_create(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
|
||||
{
|
||||
Ecore_X_Event_Window_Create *e = event;
|
||||
Ecore_Evas *ee;
|
||||
Ecore_Evas_Engine_Data_X11 *edata;
|
||||
|
||||
ee = ecore_event_window_match(e->win);
|
||||
if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */
|
||||
edata = ee->engine.data;
|
||||
if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
|
||||
if (!ee->draw_block) return ECORE_CALLBACK_RENEW;
|
||||
if ((ee->req.w == e->w) && (ee->req.h == e->h))
|
||||
{
|
||||
/* window created with desired size: canvas can be drawn */
|
||||
ee->draw_block = EINA_FALSE;
|
||||
edata->configured = EINA_TRUE;
|
||||
}
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_ecore_evas_x_event_client_message(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
|
||||
{
|
||||
|
@ -1622,6 +1650,18 @@ _ecore_evas_x_event_window_configure(void *data EINA_UNUSED, int type EINA_UNUSE
|
|||
if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */
|
||||
edata = ee->engine.data;
|
||||
if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
|
||||
if (!edata->configured)
|
||||
{
|
||||
if (edata->fully_obscured)
|
||||
{
|
||||
/* FIXME: round trip */
|
||||
if (!ecore_x_screen_is_composited(edata->screen_num))
|
||||
ee->draw_block = EINA_FALSE;
|
||||
}
|
||||
else
|
||||
ee->draw_block = EINA_FALSE;
|
||||
}
|
||||
edata->configured = 1;
|
||||
if (edata->direct_resize) return ECORE_CALLBACK_PASS_ON;
|
||||
|
||||
pointer = evas_default_device_get(ee->evas, EFL_INPUT_DEVICE_TYPE_MOUSE);
|
||||
|
@ -2019,6 +2059,9 @@ _ecore_evas_x_init(void)
|
|||
ecore_evas_event_handlers[12] =
|
||||
ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE,
|
||||
_ecore_evas_x_event_client_message, NULL);
|
||||
ecore_evas_event_handlers[13] =
|
||||
ecore_event_handler_add(ECORE_X_EVENT_WINDOW_CREATE,
|
||||
_ecore_evas_x_event_window_create, NULL);
|
||||
ecore_event_evas_init();
|
||||
return _ecore_evas_init_count;
|
||||
}
|
||||
|
@ -2211,11 +2254,10 @@ _ecore_evas_x_resize(Ecore_Evas *ee, int w, int h)
|
|||
}
|
||||
}
|
||||
|
||||
if ((!changed) && (ee->w == w) && (ee->h == h)) return;
|
||||
_ecore_evas_x_shadow_update(ee);
|
||||
if (edata->direct_resize)
|
||||
{
|
||||
if ((ee->w == w) && (ee->h == h)) return;
|
||||
|
||||
ee->w = w;
|
||||
ee->h = h;
|
||||
if (changed) edata->configure_reqs++;
|
||||
|
@ -2338,6 +2380,7 @@ _ecore_evas_x_move_resize(Ecore_Evas *ee, int x, int y, int w, int h)
|
|||
}
|
||||
else
|
||||
{
|
||||
if ((!changed) && (ee->w == w) && (ee->h == h)) return;
|
||||
edata->configure_coming = 1;
|
||||
if (changed) edata->configure_reqs++;
|
||||
if (ee->prop.window) ecore_x_window_resize(ee->prop.window, vw, vh);
|
||||
|
@ -4667,6 +4710,8 @@ ecore_evas_gl_x11_options_new_internal(const char *disp_name, Ecore_X_Window par
|
|||
_ecore_evas_x_aux_hints_update(ee);
|
||||
_ecore_evas_x_sync_set(ee);
|
||||
|
||||
ee->draw_block = 1;
|
||||
|
||||
ee->engine.func->fn_render = _ecore_evas_x_render;
|
||||
ecore_x_input_multi_select(ee->prop.window);
|
||||
|
||||
|
|
Loading…
Reference in New Issue