aboutsummaryrefslogtreecommitdiffstats
path: root/pugl
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-02-02 14:38:27 +0100
committerDavid Robillard <d@drobilla.net>2020-02-02 14:38:27 +0100
commitfe0a68d8ebcc52b80ed91fab073f09dcfb7911fa (patch)
treeaea566a9d139805d67dfdb9679779355d263666a /pugl
parent9200b1f05ebc124eaf623b76d085e940934ea37d (diff)
downloadpugl-fe0a68d8ebcc52b80ed91fab073f09dcfb7911fa.tar.gz
pugl-fe0a68d8ebcc52b80ed91fab073f09dcfb7911fa.tar.bz2
pugl-fe0a68d8ebcc52b80ed91fab073f09dcfb7911fa.zip
X11: Avoid calculating expose rect if view is not visible
Diffstat (limited to 'pugl')
-rw-r--r--pugl/detail/x11.c20
1 files changed, 10 insertions, 10 deletions
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);
}