Browse Source

Ensure 0,0 offset for embed windows

Signed-off-by: falkTX <falktx@falktx.com>
pull/443/head
falkTX 1 year ago
parent
commit
9b62626d8c
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
3 changed files with 8 additions and 4 deletions
  1. +1
    -1
      dgl/src/WidgetPrivateData.cpp
  2. +3
    -0
      dgl/src/Window.cpp
  3. +4
    -3
      dgl/src/WindowPrivateData.cpp

+ 1
- 1
dgl/src/WidgetPrivateData.cpp View File

@@ -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


+ 3
- 0
dgl/src/Window.cpp View File

@@ -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);
}


+ 4
- 3
dgl/src/WindowPrivateData.cpp View File

@@ -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);
}



Loading…
Cancel
Save