From 72981477deea74c5eb09db9810407dfb5292401b Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Fri, 16 Feb 2001 01:33:14 +0000 Subject: [PATCH] ooooops - fix gl engine to handle window resizes..... :) SVN revision: 4230 --- legacy/evas/src/evas_gl_routines.c | 29 ++++++++++++++++------------- legacy/evas/src/evas_object.c | 6 ++++-- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/legacy/evas/src/evas_gl_routines.c b/legacy/evas/src/evas_gl_routines.c index 1bfadad7a0..6d7db7e5c5 100644 --- a/legacy/evas/src/evas_gl_routines.c +++ b/legacy/evas/src/evas_gl_routines.c @@ -246,11 +246,7 @@ __evas_gl_window_current(Display *disp, Window win, int w, int h) if (!glw) return NULL; if (glw != __evas_current) { - double dr, dg, db, da; - __evas_current = glw; - glw->w = w; - glw->h = h; glXMakeCurrent(glw->disp, glw->win, glw->context->context); glShadeModel(GL_FLAT); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_FASTEST); @@ -258,15 +254,6 @@ __evas_gl_window_current(Display *disp, Window win, int w, int h) glEnable(GL_LINE_SMOOTH); glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glPixelStorei(GL_PACK_ALIGNMENT, 1); - - glViewport(0, 0, glw->w, h); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glOrtho(0, glw->w, 0, glw->h, -1, 1); - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - glScalef(1, -1, 1); - glTranslatef(0, - glw->h, 0); if (glw->context->dither) glEnable(GL_DITHER); else glDisable(GL_DITHER); if (glw->context->blend) @@ -294,6 +281,22 @@ __evas_gl_window_current(Display *disp, Window win, int w, int h) if (glw->context->bound_texture) glBindTexture(GL_TEXTURE_2D, glw->context->bound_texture->texture); } + if ((glw->w != w) || (glw->h != h)) + { + double dr, dg, db, da; + + glw->w = w; + glw->h = h; + glViewport(0, 0, glw->w, h); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glOrtho(0, glw->w, 0, glw->h, -1, 1); + printf("%i %i\n", glw->w, glw->h); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glScalef(1, -1, 1); + glTranslatef(0, - glw->h, 0); + } return glw; } diff --git a/legacy/evas/src/evas_object.c b/legacy/evas/src/evas_object.c index cd6bed8153..5d5c3aa612 100644 --- a/legacy/evas/src/evas_object.c +++ b/legacy/evas/src/evas_object.c @@ -562,6 +562,7 @@ evas_move(Evas e, Evas_Object o, double x, double y) if (!e) return; if (!o) return; if ((o->type == OBJECT_LINE)) return; + if ((x == o->current.x) && (y == o->current.y)) return; if ((o->current.visible) && (_evas_point_in_object(e, o, e->mouse.x, e->mouse.y))) event_update = 1; @@ -607,11 +608,12 @@ evas_resize(Evas e, Evas_Object o, double w, double h) if ((o->type == OBJECT_LINE)) return; if ((o->type == OBJECT_TEXT)) return; if ((o->type == OBJECT_POLYGON)) return; + if (w < 0) w = 0; + if (h < 0) h = 0; + if ((w == o->current.w) && (h == o->current.h)) return; if ((o->current.visible) && (_evas_point_in_object(e, o, e->mouse.x, e->mouse.y))) event_update = 1; - if (w < 0) w = 0; - if (h < 0) h = 0; o->current.w = w; o->current.h = h; o->changed = 1;