aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2023-01-02 17:04:12 -0500
committerDavid Robillard <d@drobilla.net>2023-01-02 17:04:12 -0500
commit23a1b165950d2f7b738ed42144e1569f0c82793c (patch)
treed16102362bd941a086b688d5ca15a669d7591917
parent1b9c26d0e28bf5eeab864099bc422444bc439fd3 (diff)
downloadpugl-23a1b165950d2f7b738ed42144e1569f0c82793c.tar.gz
pugl-23a1b165950d2f7b738ed42144e1569f0c82793c.tar.bz2
pugl-23a1b165950d2f7b738ed42144e1569f0c82793c.zip
X11: Factor out getCurrentConfiguration
-rw-r--r--src/x11.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/src/x11.c b/src/x11.c
index b7b78f2..271a0fb 100644
--- a/src/x11.c
+++ b/src/x11.c
@@ -754,6 +754,23 @@ translateClientMessage(PuglView* const view, XClientMessageEvent message)
}
static PuglEvent
+getCurrentConfiguration(PuglView* const view)
+{
+ // Get initial window position and size
+ XWindowAttributes attrs;
+ XGetWindowAttributes(view->world->impl->display, view->impl->win, &attrs);
+
+ // Build a configure event with the current position and size
+ PuglEvent configureEvent = {{PUGL_CONFIGURE, 0}};
+ configureEvent.configure.x = (PuglCoord)attrs.x;
+ configureEvent.configure.y = (PuglCoord)attrs.y;
+ configureEvent.configure.width = (PuglSpan)attrs.width;
+ configureEvent.configure.height = (PuglSpan)attrs.height;
+
+ return configureEvent;
+}
+
+static PuglEvent
translatePropertyNotify(PuglView* const view, XPropertyEvent message)
{
const PuglX11Atoms* const atoms = &view->world->impl->atoms;
@@ -1362,17 +1379,7 @@ handleTimerEvent(PuglWorld* const world, const XEvent xevent)
static PuglStatus
dispatchCurrentConfiguration(PuglView* const view)
{
- // Get initial window position and size
- XWindowAttributes attrs;
- XGetWindowAttributes(view->world->impl->display, view->impl->win, &attrs);
-
- // Build an initial configure event in case the WM doesn't send one
- PuglEvent configureEvent = {{PUGL_CONFIGURE, 0}};
- configureEvent.configure.x = (PuglCoord)attrs.x;
- configureEvent.configure.y = (PuglCoord)attrs.y;
- configureEvent.configure.width = (PuglSpan)attrs.width;
- configureEvent.configure.height = (PuglSpan)attrs.height;
-
+ const PuglEvent configureEvent = getCurrentConfiguration(view);
return puglDispatchEvent(view, &configureEvent);
}