From fe0a68d8ebcc52b80ed91fab073f09dcfb7911fa Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 2 Feb 2020 14:38:27 +0100 Subject: X11: Avoid calculating expose rect if view is not visible --- pugl/detail/x11.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'pugl') diff --git a/pugl/detail/x11.c b/pugl/detail/x11.c index c82a2e5..bbf4307 100644 --- a/pugl/detail/x11.c +++ b/pugl/detail/x11.c @@ -811,18 +811,18 @@ puglPostRedisplay(PuglView* view) PuglStatus puglPostRedisplayRect(PuglView* view, PuglRect rect) { - const int x = (int)floor(rect.x); - const int y = (int)floor(rect.y); - const int w = (int)ceil(rect.x + rect.width) - x; - const int h = (int)ceil(rect.y + rect.height) - y; + if (view->visible) { + const int x = (int)floor(rect.x); + const int y = (int)floor(rect.y); + const int w = (int)ceil(rect.x + rect.width) - x; + const int h = (int)ceil(rect.y + rect.height) - y; - XExposeEvent ev = {Expose, 0, True, - view->impl->display, view->impl->win, - x, y, - w, h, - 0}; + XExposeEvent ev = {Expose, 0, True, + view->impl->display, view->impl->win, + x, y, + w, h, + 0}; - if (view->visible) { XSendEvent(view->impl->display, view->impl->win, False, 0, (XEvent*)&ev); } -- cgit v1.2.1