diff --git a/dgl/src/WindowPrivateData.cpp b/dgl/src/WindowPrivateData.cpp index 4f20fceb..d7a3c934 100644 --- a/dgl/src/WindowPrivateData.cpp +++ b/dgl/src/WindowPrivateData.cpp @@ -94,10 +94,7 @@ static PuglView* puglNewViewWithParentWindow(PuglWorld* const world, const uintp puglSetParent(view, parentWindowHandle); if (parentWindowHandle != 0) - { - puglSetPositionHint(view, PUGL_CURRENT_POSITION, 0, 0); puglSetPositionHint(view, PUGL_DEFAULT_POSITION, 0, 0); - } return view; } diff --git a/dgl/src/pugl-upstream b/dgl/src/pugl-upstream index 2aaf6c0e..f15b2470 160000 --- a/dgl/src/pugl-upstream +++ b/dgl/src/pugl-upstream @@ -1 +1 @@ -Subproject commit 2aaf6c0efb8716465861e349be9270b43a732ec2 +Subproject commit f15b24708a663189245d93f2a1e419811b49e242 diff --git a/dgl/src/pugl.cpp b/dgl/src/pugl.cpp index 2724f54d..c2b01170 100644 --- a/dgl/src/pugl.cpp +++ b/dgl/src/pugl.cpp @@ -494,7 +494,7 @@ PuglStatus puglSetGeometryConstraints(PuglView* const view, const uint width, co x11::PuglView* const x11view = cast(view); if (x11view->impl->win) { - if (const x11::PuglStatus status = x11::updateSizeHints(x11view)) + if (const x11::PuglStatus status = x11::puglUpdateSizeHints(x11view)) return static_cast(status); XFlush(x11view->world->impl->display); @@ -538,7 +538,7 @@ void puglSetResizable(PuglView* const view, const bool resizable) else { #ifdef HAVE_X11 - x11::updateSizeHints(cast(view)); + x11::puglUpdateSizeHints(cast(view)); #endif } #endif @@ -588,7 +588,7 @@ PuglStatus puglSetSizeAndDefault(PuglView* const view, const uint width, const u x11::PuglView* const x11view = cast(view); if (x11view->impl->win) { - if (const x11::PuglStatus status = updateSizeHints(x11view)) + if (const x11::PuglStatus status = puglUpdateSizeHints(x11view)) return static_cast(status); if (const x11::PuglStatus status = puglSetWindowSize(x11view, width, height)) @@ -803,6 +803,21 @@ PuglStatus puglAcceptOffer(PuglView* const view, const PuglDataOfferEvent* const return PUGL_BAD_BACKEND; } +PuglStatus puglApplySizeHint(PuglView* view, PuglSizeHint hint) +{ + #ifdef HAVE_X11 + if (view->world->handle == kUsingX11Check) + return static_cast(x11::puglApplySizeHint(cast(view), + static_cast(hint))); + #endif + #ifdef HAVE_WAYLAND + if (view->world->handle == kUsingWaylandCheck) + return static_cast(wl::puglApplySizeHint(cast(view), + static_cast(hint))); + #endif + return PUGL_BAD_BACKEND; +} + void puglFreeViewInternals(PuglView* const view) { #ifdef HAVE_X11 @@ -1132,34 +1147,41 @@ PuglStatus puglSetCursor(PuglView* view, PuglCursor cursor) return PUGL_BAD_BACKEND; } -PuglStatus puglSetPositionHint(PuglView* const view, const PuglPositionHint hint, const int x, const int y) +PuglStatus puglSetTransientParent(PuglView* const view, const PuglNativeView parent) +{ + #ifdef HAVE_X11 + if (view->world->handle == kUsingX11Check) + return static_cast(x11::puglSetTransientParent(cast(view), parent)); + #endif + #ifdef HAVE_WAYLAND + if (view->world->handle == kUsingWaylandCheck) + return static_cast(wl::puglSetTransientParent(cast(view), parent)); + #endif + return PUGL_BAD_BACKEND; +} + +PuglStatus puglSetWindowPosition(PuglView* view, int x, int y) { #ifdef HAVE_X11 if (view->world->handle == kUsingX11Check) - return static_cast(x11::puglSetPositionHint(cast(view), - static_cast(hint), - x, - y)); + return static_cast(x11::puglSetWindowPosition(cast(view), x, y)); #endif #ifdef HAVE_WAYLAND if (view->world->handle == kUsingWaylandCheck) - return static_cast(wl::puglSetPositionHint(cast(view), - static_cast(hint), - x, - y)); + return static_cast(wl::puglSetWindowPosition(cast(view), x, y)); #endif return PUGL_BAD_BACKEND; } -PuglStatus puglSetTransientParent(PuglView* const view, const PuglNativeView parent) +PuglStatus puglSetWindowSize(PuglView* view, unsigned width, unsigned height) { #ifdef HAVE_X11 if (view->world->handle == kUsingX11Check) - return static_cast(x11::puglSetTransientParent(cast(view), parent)); + return static_cast(x11::puglSetWindowSize(cast(view), width, height)); #endif #ifdef HAVE_WAYLAND if (view->world->handle == kUsingWaylandCheck) - return static_cast(wl::puglSetTransientParent(cast(view), parent)); + return static_cast(wl::puglSetWindowSize(cast(view), width, height)); #endif return PUGL_BAD_BACKEND; } @@ -1253,11 +1275,10 @@ PuglStatus puglX11UpdateWithoutExposures(PuglWorld* const world) if (world->handle == kUsingWaylandCheck) return PUGL_BACKEND_FAILED; - x11::PuglWorld* const x11world = cast(world); - x11::PuglWorldInternals* const impl = x11world->impl; + x11::PuglWorld* const x11world = cast(world); - const bool wasDispatchingEvents = impl->dispatchingEvents; - impl->dispatchingEvents = true; + const PuglWorldState startState = world->state; + world->state = PUGL_WORLD_UPDATING; x11::PuglStatus st = x11::PUGL_SUCCESS; const double startTime = x11::puglGetTime(x11world); @@ -1265,11 +1286,11 @@ PuglStatus puglX11UpdateWithoutExposures(PuglWorld* const world) for (double t = startTime; !st && t < endTime; t = x11::puglGetTime(x11world)) { - x11::pollX11Socket(x11world, endTime - t); - st = x11::dispatchX11Events(x11world); + if (!(st = x11::pollX11Socket(x11world, endTime - t))) + st = x11::dispatchX11Events(x11world); } - impl->dispatchingEvents = wasDispatchingEvents; + world->state = startState; return static_cast(st); }