From 419c8178159f3f2cb30945100cfb39866e789b83 Mon Sep 17 00:00:00 2001 From: Christopher Michael Date: Mon, 13 Aug 2012 14:36:25 +0000 Subject: [PATCH] Evas (wayland_egl): More bug fixes & cleanups ! :) When we create the egl window we should take rotation into consideration, so account for that. Add an 'edges' variable to the engine info structure. This is needed so we can implement resizing windows from the top also. Make sure to use wl_egl_window_get_attached_size and determine the edge we are resizing from, so we can calculate the difference in sizes to send to wl_egl_window_resize. Add __UNUSED__ to function paramaters where it was missing, and fix some compiler warnings. SVN revision: 75215 --- .../wayland_egl/Evas_Engine_Wayland_Egl.h | 3 +- .../modules/engines/wayland_egl/evas_engine.c | 61 ++++++++++++------- .../engines/wayland_egl/evas_wl_main.c | 9 ++- 3 files changed, 47 insertions(+), 26 deletions(-) diff --git a/legacy/evas/src/modules/engines/wayland_egl/Evas_Engine_Wayland_Egl.h b/legacy/evas/src/modules/engines/wayland_egl/Evas_Engine_Wayland_Egl.h index 520753a290..ff5fcd83bb 100644 --- a/legacy/evas/src/modules/engines/wayland_egl/Evas_Engine_Wayland_Egl.h +++ b/legacy/evas/src/modules/engines/wayland_egl/Evas_Engine_Wayland_Egl.h @@ -24,7 +24,8 @@ struct _Evas_Engine_Info_Wayland_Egl int depth; int screen; int rotation; - unsigned int destination_alpha : 1; + int edges; + unsigned int destination_alpha : 1; } info; /* engine specific function calls to query stuff about the destination */ /* engine (what visual & colormap & depth to use, performance info etc. */ diff --git a/legacy/evas/src/modules/engines/wayland_egl/evas_engine.c b/legacy/evas/src/modules/engines/wayland_egl/evas_engine.c index f45c840771..545bdab8fb 100644 --- a/legacy/evas/src/modules/engines/wayland_egl/evas_engine.c +++ b/legacy/evas/src/modules/engines/wayland_egl/evas_engine.c @@ -473,7 +473,7 @@ static Evas_Func func, pfunc; static Evas_GL_API gl_funcs; static void * -eng_info(Evas *e) +eng_info(Evas *e __UNUSED__) { Evas_Engine_Info_Wayland_Egl *info; @@ -481,8 +481,8 @@ eng_info(Evas *e) info->magic.magic = rand(); info->func.best_depth_get = eng_best_depth_get; info->render_mode = EVAS_RENDER_MODE_BLOCKING; + return info; - e = NULL; } static void @@ -822,7 +822,22 @@ eng_output_resize(void *data, int w, int h) eng_window_use(re->win); if (re->win->win) - wl_egl_window_resize(re->win->win, w, h, 0, 0); + { + int aw, ah, dx, dy; + + wl_egl_window_get_attached_size(re->win->win, &aw, &ah); + + if (re->info->info.edges & 4) // resize from left + dx = aw - w; + else + dx = 0; + if (re->info->info.edges & 1) // resize from top + dy = ah - h; + else + dy = 0; + + wl_egl_window_resize(re->win->win, w, h, dx, dy); + } evas_gl_common_context_resize(re->win->gl_context, w, h, re->win->rot); evas_common_tilebuf_free(re->tb); @@ -1041,11 +1056,11 @@ eng_output_flush(void *data) } static void -eng_output_idle_flush(void *data) +eng_output_idle_flush(void *data __UNUSED__) { - Render_Engine *re; + /* Render_Engine *re; */ - re = (Render_Engine *)data; + /* re = (Render_Engine *)data; */ } static void @@ -1105,20 +1120,20 @@ eng_line_draw(void *data, void *context, void *surface, int x1, int y1, int x2, } static void * -eng_polygon_point_add(void *data, void *context __UNUSED__, void *polygon, int x, int y) +eng_polygon_point_add(void *data __UNUSED__, void *context __UNUSED__, void *polygon, int x, int y) { - Render_Engine *re; + /* Render_Engine *re; */ - re = (Render_Engine *)data; + /* re = (Render_Engine *)data; */ return evas_gl_common_poly_point_add(polygon, x, y); } static void * -eng_polygon_points_clear(void *data, void *context __UNUSED__, void *polygon) +eng_polygon_points_clear(void *data __UNUSED__, void *context __UNUSED__, void *polygon) { - Render_Engine *re; + /* Render_Engine *re; */ - re = (Render_Engine *)data; + /* re = (Render_Engine *)data; */ return evas_gl_common_poly_points_clear(polygon); } @@ -1249,13 +1264,13 @@ eng_image_comment_get(void *data __UNUSED__, void *image, char *key __UNUSED__) } static char * -eng_image_format_get(void *data __UNUSED__, void *image) +eng_image_format_get(void *data __UNUSED__, void *image __UNUSED__) { // Render_Engine *re; - Evas_GL_Image *im; + /* Evas_GL_Image *im; */ // re = (Render_Engine *)data; - im = image; + /* im = image; */ return NULL; } @@ -2414,13 +2429,13 @@ eng_gl_proc_address_get(void *data __UNUSED__, const char *name) } static int -eng_gl_native_surface_get(void *data, void *surface, void *native_surface) +eng_gl_native_surface_get(void *data __UNUSED__, void *surface, void *native_surface) { - Render_Engine *re; + /* Render_Engine *re; */ Render_Engine_GL_Surface *sfc; Evas_Native_Surface *ns; - re = (Render_Engine *)data; + /* re = (Render_Engine *)data; */ sfc = (Render_Engine_GL_Surface*)surface; ns = (Evas_Native_Surface*)native_surface; @@ -2440,9 +2455,9 @@ static const GLubyte * evgl_glGetString(GLenum name) { if (name == GL_EXTENSIONS) - return (GLubyte *)_gl_ext_string; //glGetString(GL_EXTENSIONS); + return (GLubyte *)_gl_ext_string; //glGetString(GL_EXTENSIONS); else - return glGetString(name); + return glGetString(name); } static void @@ -2553,11 +2568,11 @@ evgl_glEvasGLImageTargetRenderbufferStorageOES(GLenum target, EvasGLImage image) static void * -eng_gl_api_get(void *data) +eng_gl_api_get(void *data __UNUSED__) { - Render_Engine *re; + /* Render_Engine *re; */ - re = (Render_Engine *)data; + /* re = (Render_Engine *)data; */ gl_funcs.version = EVAS_GL_API_VERSION; diff --git a/legacy/evas/src/modules/engines/wayland_egl/evas_wl_main.c b/legacy/evas/src/modules/engines/wayland_egl/evas_wl_main.c index 3b94cba402..b7ec16f018 100644 --- a/legacy/evas/src/modules/engines/wayland_egl/evas_wl_main.c +++ b/legacy/evas/src/modules/engines/wayland_egl/evas_wl_main.c @@ -137,7 +137,10 @@ eng_window_new(struct wl_display *disp, struct wl_surface *surface, int screen, return NULL; } - gw->win = wl_egl_window_create(gw->surface, gw->w, gw->h); + if ((gw->rot == 0) || (gw->rot == 180)) + gw->win = wl_egl_window_create(gw->surface, gw->w, gw->h); + else if ((gw->rot == 90) || (gw->rot == 270)) + gw->win = wl_egl_window_create(gw->surface, gw->h, gw->w); gw->egl_surface[0] = eglCreateWindowSurface(gw->egl_disp, gw->egl_config, (EGLNativeWindowType)gw->win, @@ -150,7 +153,9 @@ eng_window_new(struct wl_display *disp, struct wl_surface *surface, int screen, return NULL; } - gw->egl_context[0] = eglCreateContext(gw->egl_disp, gw->egl_config, share_context, context_attrs); + gw->egl_context[0] = + eglCreateContext(gw->egl_disp, gw->egl_config, share_context, + context_attrs); if (gw->egl_context[0] == EGL_NO_CONTEXT) {