This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project gfxprim.git.
The branch, master has been updated via 86d973b47abbc97b301abcee265a2537cbc3784e (commit) via 17b4abe983a4218ffa1a17f467c7b3845d1b9be8 (commit) from d9723b14b7ba7dd2eaef8f09fbd3823a25078b94 (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- http://repo.or.cz/w/gfxprim.git/commit/86d973b47abbc97b301abcee265a2537cbc37...
commit 86d973b47abbc97b301abcee265a2537cbc3784e Author: Cyril Hrubis metan@ucw.cz Date: Mon Dec 10 23:01:40 2012 +0100
backends: GP_X11.c: Finish SHM & Fix Race.
This commit finishes the MIT SHM Extension and enables it by default.
Also this commit fixes race between X{Shm}Image resize and UpdateRect Event that was there since begining but the SHM inteface started to trigger it.
diff --git a/libs/backends/GP_X11.c b/libs/backends/GP_X11.c index d4030b8..d02b244 100644 --- a/libs/backends/GP_X11.c +++ b/libs/backends/GP_X11.c @@ -67,6 +67,7 @@ static void destroy_ximage(GP_Backend *self); static void destroy_shm_ximage(GP_Backend *self);
static int resize_ximage(GP_Backend *self, int w, int h); +static int resize_shm_ximage(GP_Backend *self, int w, int h);
static void x11_exit(GP_Backend *self) { @@ -107,8 +108,6 @@ static void x11_update_rect(GP_Backend *self, GP_Coord x0, GP_Coord y0, XFlush(x11->dpy);
- x11->resized_flag = 0; - XUnlockDisplay(x11->dpy); }
@@ -126,8 +125,6 @@ static void x11_flip(GP_Backend *self) x11->img, 0, 0, 0, 0, w, h); XFlush(x11->dpy); - x11->resized_flag = 0; - XUnlockDisplay(x11->dpy); }
@@ -141,7 +138,11 @@ static void x11_ev(GP_Backend *self, XEvent *ev) ev->xexpose.x, ev->xexpose.y, ev->xexpose.width, ev->xexpose.height, ev->xexpose.count); - + + /* + * Ignore Expose events in case user wasn't notified + * about change and acked image resize. + */ if (x11->resized_flag) break;
@@ -153,6 +154,11 @@ static void x11_ev(GP_Backend *self, XEvent *ev) if (ev->xconfigure.width == (int)self->context->w && ev->xconfigure.height == (int)self->context->h) break; + + /* + * Window has been resized, set flag. + */ + x11->resized_flag = 1; default: GP_InputDriverX11EventPut(ev); break; @@ -204,14 +210,19 @@ static int x11_set_attributes(struct GP_Backend *self, if (w != 0 && h != 0) { GP_DEBUG(3, "Setting window size to %ux%u", w, h); - if (resize_ximage(self, w, h)) - return 1; + if (x11->shm_flag) { + if (resize_shm_ximage(self, w, h)) + return 1; + } else { + if (resize_ximage(self, w, h)) + return 1; + }
/* Resize X11 window */ // XResizeWindow(x11->dpy, x11->win, w, h); XFlush(x11->dpy);
- x11->resized_flag = 1; + x11->resized_flag = 0; } XUnlockDisplay(x11->dpy); @@ -244,11 +255,13 @@ static int create_shm_ximage(GP_Backend *self, GP_Size w, GP_Size h) struct x11_priv *x11 = GP_BACKEND_PRIV(self);
if (XShmQueryExtension(x11->dpy) == False) { - GP_DEBUG(1, "X Shm Extension not supported, " - "falling back to XImagen"); + GP_DEBUG(1, "MIT SHM Extension not supported, " + "falling back to XImage"); return 1; } - + + GP_DEBUG(1, "Using MIT SHM Extension"); + enum GP_PixelType pixel_type; int depth;
@@ -312,11 +325,22 @@ static void destroy_shm_ximage(GP_Backend *self) struct x11_priv *x11 = GP_BACKEND_PRIV(self); XShmDetach(x11->dpy, &x11->shminfo); + XFlush(x11->dpy); shmdt(x11->shminfo.shmaddr); shmctl(x11->shminfo.shmid, IPC_RMID, 0); XDestroyImage(x11->img); }
+static int resize_shm_ximage(GP_Backend *self, int w, int h) +{ + GP_DEBUG(4, "Resizing XShmImage %ux%u -> %ux%u", + self->context->w, self->context->h, w, h); + + destroy_shm_ximage(self); + + return create_shm_ximage(self, w, h); +} + #else
static int create_shm_ximage(GP_Backend GP_UNUSED(*self), @@ -330,6 +354,12 @@ static void destroy_shm_ximage(GP_Backend GP_UNUSED(*self)) GP_WARN("Stub called"); }
+static int resize_shm_ximage(GP_Backend GP_UNUSED(*self), + int GP_UNUSED(w), int GP_UNUSED(h)) +{ + GP_WARN("Stub called"); +} + #endif /* HAVE_X_SHM */
static int create_ximage(GP_Backend *self, GP_Size w, GP_Size h) @@ -381,11 +411,6 @@ static int resize_ximage(GP_Backend *self, int w, int h) struct x11_priv *x11 = GP_BACKEND_PRIV(self); XImage *img;
- if (x11->shm_flag) { - GP_WARN("UNIMPLEMENTED"); - return 1; - } - /* Create new X image */ img = XCreateImage(x11->dpy, x11->vis, x11->scr_depth, ZPixmap, 0, NULL, w, h, x11->img->bitmap_pad, 0); @@ -593,7 +618,7 @@ void create_window(struct x11_priv *x11, int x, int y, Atom xa = XInternAtom(x11->dpy, "WM_DELETE_WINDOW", True);
if (xa != None) { - GP_DEBUG(2, "Setting WM_DELETE_WINWOW Atom to True"); + GP_DEBUG(2, "Setting WM_DELETE_WINDOW Atom to True");
XSetWMProtocols(x11->dpy, x11->win, &xa, 1); } else { @@ -647,7 +672,7 @@ GP_Backend *GP_BackendX11Init(const char *display, int x, int y, goto err1; }
- //if (create_shm_ximage(backend, w, h)) + if (create_shm_ximage(backend, w, h)) if (create_ximage(backend, w, h)) goto err1;
http://repo.or.cz/w/gfxprim.git/commit/17b4abe983a4218ffa1a17f467c7b3845d1b9...
commit 17b4abe983a4218ffa1a17f467c7b3845d1b9be8 Author: Cyril Hrubis metan@ucw.cz Date: Mon Dec 10 23:01:05 2012 +0100
backends: GP_Backend.c: Add WARNINGS into UpdateRect()
diff --git a/libs/backends/GP_Backend.c b/libs/backends/GP_Backend.c index 036fd56..b81808e 100644 --- a/libs/backends/GP_Backend.c +++ b/libs/backends/GP_Backend.c @@ -22,6 +22,7 @@
#include "core/GP_Common.h" #include "core/GP_Transform.h" +#include "core/GP_Debug.h"
#include "backends/GP_Backend.h"
@@ -38,6 +39,30 @@ void GP_BackendUpdateRectXYXY(GP_Backend *backend, if (y1 < y0) GP_SWAP(y0, y1);
+ if (x0 < 0) { + GP_WARN("Negative x coordinate %i, clipping to 0", x0); + x0 = 0; + } + + if (y0 < 0) { + GP_WARN("Negative y coordinate %i, clipping to 0", y0); + y0 = 0; + } + + GP_Coord w = backend->context->w; + + if (x1 >= w) { + GP_WARN("Invalid x coordinate %i, clipping to %u", x1, w - 1); + x1 = w - 1; + } + + GP_Coord h = backend->context->h; + + if (y1 >= h) { + GP_WARN("Invalid x coordinate %i, clipping to %u", y1, h - 1); + y1 = h - 1; + } + backend->UpdateRect(backend, x0, y0, x1, y1); }
-----------------------------------------------------------------------
Summary of changes: libs/backends/GP_Backend.c | 25 ++++++++++++++++++ libs/backends/GP_X11.c | 61 +++++++++++++++++++++++++++++++------------- 2 files changed, 68 insertions(+), 18 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos@gmail.com if you want to unsubscribe, or site admin admin@repo.or.cz if you receive no reply.