DPF

DISTRHO Plugin Framework
Log | Files | Refs | Submodules | README | LICENSE

commit 9b62626d8cd56f8b4407b873a2f6b1a6cd38c846
parent 06c18eebd98b90000b7763d73f37cbadb1466fbf
Author: falkTX <falktx@falktx.com>
Date:   Wed, 11 Oct 2023 15:03:01 +0200

Ensure 0,0 offset for embed windows

Signed-off-by: falkTX <falktx@falktx.com>

Diffstat:
Mdgl/src/WidgetPrivateData.cpp | 2+-
Mdgl/src/Window.cpp | 3+++
Mdgl/src/WindowPrivateData.cpp | 7++++---
3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/dgl/src/WidgetPrivateData.cpp b/dgl/src/WidgetPrivateData.cpp @@ -1,6 +1,6 @@ /* * DISTRHO Plugin Framework (DPF) - * Copyright (C) 2012-2022 Filipe Coelho <falktx@falktx.com> + * Copyright (C) 2012-2023 Filipe Coelho <falktx@falktx.com> * * Permission to use, copy, modify, and/or distribute this software for any purpose with * or without fee is hereby granted, provided that the above copyright notice and this diff --git a/dgl/src/Window.cpp b/dgl/src/Window.cpp @@ -208,6 +208,9 @@ void Window::setOffsetY(const int y) void Window::setOffset(const int x, const int y) { + // do not call this for embed windows! + DISTRHO_SAFE_ASSERT_RETURN(!pData->isEmbed,); + if (pData->view != nullptr) puglSetPosition(pData->view, x, y); } diff --git a/dgl/src/WindowPrivateData.cpp b/dgl/src/WindowPrivateData.cpp @@ -86,6 +86,10 @@ static PuglView* puglNewViewWithParentWindow(PuglWorld* const world, const uintp if (PuglView* const view = puglNewView(world)) { puglSetParentWindow(view, parentWindowHandle); + + if (parentWindowHandle != 0) + puglSetPosition(view, 0, 0); + return view; } @@ -212,9 +216,6 @@ Window::PrivateData::PrivateData(Application& a, Window* const s, #endif modal() { - if (isEmbed) - puglSetParentWindow(view, parentWindowHandle); - initPre(width != 0 ? width : DEFAULT_WIDTH, height != 0 ? height : DEFAULT_HEIGHT, resizable); }