Evas (wayland_egl): Fix 'close' of windows. Basically, we will check

if the eng setup has a NULL surface, and if the RenderEngine has an
existing surface, that means we are hiding/closing the window, and
thus should free the existing RenderEngine Window.



SVN revision: 67160
This commit is contained in:
Christopher Michael 2012-01-12 23:58:17 +00:00
parent 91c925fc54
commit 1a34b86f34
2 changed files with 24 additions and 4 deletions

View File

@ -499,6 +499,7 @@ eng_info_free(Evas *e __UNUSED__, void *info)
static int static int
_re_wincheck(Render_Engine *re) _re_wincheck(Render_Engine *re)
{ {
if (!re) return 0;
if (re->win->surf) return 1; if (re->win->surf) return 1;
eng_window_resurf(re->win); eng_window_resurf(re->win);
if (!re->win->surf) if (!re->win->surf)
@ -652,7 +653,7 @@ eng_setup(Evas *e, void *in)
} }
else else
{ {
re = e->engine.data.output; if (!(re = e->engine.data.output)) return 0;
if (_re_wincheck(re)) if (_re_wincheck(re))
{ {
if ((re->info->info.display != re->win->disp) || if ((re->info->info.display != re->win->disp) ||
@ -664,6 +665,21 @@ eng_setup(Evas *e, void *in)
{ {
int inc = 0; int inc = 0;
/* if we already have a window surface, check for NULL input surface.
* this will mean we are hiding the window and should destroy
* things properly */
if ((re->win->surface) && (re->info->info.surface = NULL))
{
if (re->win)
{
eng_window_free(re->win);
gl_wins--;
}
free(re);
e->engine.data.output = NULL;
return 0;
}
if (re->win) if (re->win)
{ {
re->win->gl_context->references++; re->win->gl_context->references++;
@ -700,9 +716,11 @@ eng_setup(Evas *e, void *in)
} }
} }
} }
if (!re->win) if (!re->win)
{ {
free(re); free(re);
e->engine.data.output = NULL;
return 0; return 0;
} }
@ -714,6 +732,7 @@ eng_setup(Evas *e, void *in)
gl_wins--; gl_wins--;
} }
free(re); free(re);
e->engine.data.output = NULL;
return 0; return 0;
} }
re->tb = evas_common_tilebuf_new(re->win->w, re->win->h); re->tb = evas_common_tilebuf_new(re->win->w, re->win->h);
@ -725,6 +744,7 @@ eng_setup(Evas *e, void *in)
gl_wins--; gl_wins--;
} }
free(re); free(re);
e->engine.data.output = NULL;
return 0; return 0;
} }
evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE); evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE);

View File

@ -212,14 +212,14 @@ eng_window_free(Evas_GL_Wl_Window *gw)
} }
if (gw->egl_surface[0] != EGL_NO_SURFACE) if (gw->egl_surface[0] != EGL_NO_SURFACE)
eglDestroySurface(gw->egl_disp, gw->egl_surface[0]); eglDestroySurface(gw->egl_disp, gw->egl_surface[0]);
eglMakeCurrent(gw->egl_disp, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
if (ref == 0) if (ref == 0)
{ {
if (context) eglDestroyContext(gw->egl_disp, context); if (context) eglDestroyContext(gw->egl_disp, context);
context = EGL_NO_CONTEXT; context = EGL_NO_CONTEXT;
eglTerminate(gw->egl_disp);
eglReleaseThread();
} }
eglMakeCurrent(gw->egl_disp, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
if (ref == 0) eglTerminate(gw->egl_disp);
eglReleaseThread();
free(gw); free(gw);
} }