Skip to content

Commit

Permalink
Update to latest pugl
Browse files Browse the repository at this point in the history
Signed-off-by: falkTX <[email protected]>
  • Loading branch information
falkTX committed Oct 15, 2023
1 parent b238d8d commit 8b6196b
Show file tree
Hide file tree
Showing 17 changed files with 336 additions and 283 deletions.
1 change: 1 addition & 0 deletions Makefile.base.mk
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,7 @@ endif
else ifeq ($(WINDOWS),true)

DGL_SYSTEM_LIBS += -lcomdlg32
DGL_SYSTEM_LIBS += -ldwmapi
DGL_SYSTEM_LIBS += -lgdi32
# DGL_SYSTEM_LIBS += -lole32

Expand Down
2 changes: 1 addition & 1 deletion Makefile.plugins.mk
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ endif
DGL_BUILD_DIR = $(DPF_PATH)/build$(BUILD_DIR_SUFFIX)

BUILD_C_FLAGS += -I.
BUILD_CXX_FLAGS += -I. -I$(DPF_PATH)/distrho -I$(DPF_PATH)/dgl
BUILD_CXX_FLAGS += -I. -I$(DPF_PATH)/distrho -I$(DPF_PATH)/dgl -I$(DPF_PATH)/dgl/src/pugl-upstream/include

ifeq ($(HAVE_ALSA),true)
BASE_FLAGS += -DHAVE_ALSA
Expand Down
2 changes: 1 addition & 1 deletion cmake/DPF-plugin.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ function(dpf__add_dgl_system_libs)
elseif(HAIKU)
target_link_libraries(dgl-system-libs INTERFACE "be")
elseif(WIN32)
target_link_libraries(dgl-system-libs INTERFACE "gdi32" "comdlg32")
target_link_libraries(dgl-system-libs INTERFACE "comdlg32" "dwmapi" "gdi32")
else()
find_package(PkgConfig)
pkg_check_modules(DBUS "dbus-1")
Expand Down
143 changes: 90 additions & 53 deletions dgl/Base.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* DISTRHO Plugin Framework (DPF)
* Copyright (C) 2012-2022 Filipe Coelho <[email protected]>
* Copyright (C) 2012-2023 Filipe Coelho <[email protected]>
*
* 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
Expand Down Expand Up @@ -62,55 +62,87 @@ enum Modifier {
*/
enum Key {
// Convenience symbols for ASCII control characters
kKeyBackspace = 0x08,
kKeyEscape = 0x1B,
kKeyDelete = 0x7F,
kKeyBackspace = 0x00000008U, ///< Backspace
kKeyEnter = 0x0000000DU, ///< Enter
kKeyEscape = 0x0000001BU, ///< Escape
kKeyDelete = 0x0000007FU, ///< Delete
kKeySpace = 0x00000020U, ///< Space

// Unicode Private Use Area
kKeyF1 = 0x0000E000U, ///< F1
kKeyF2, ///< F2
kKeyF3, ///< F3
kKeyF4, ///< F4
kKeyF5, ///< F5
kKeyF6, ///< F6
kKeyF7, ///< F7
kKeyF8, ///< F8
kKeyF9, ///< F9
kKeyF10, ///< F10
kKeyF11, ///< F11
kKeyF12, ///< F12
kKeyPageUp = 0xE031, ///< Page Up
kKeyPageDown, ///< Page Down
kKeyEnd, ///< End
kKeyHome, ///< Home
kKeyLeft, ///< Left
kKeyUp, ///< Up
kKeyRight, ///< Right
kKeyDown, ///< Down
kKeyPrintScreen = 0xE041U, ///< Print Screen
kKeyInsert, ///< Insert
kKeyPause, ///< Pause/Break
kKeyMenu, ///< Menu
kKeyNumLock, ///< Num Lock
kKeyScrollLock, ///< Scroll Lock
kKeyCapsLock, ///< Caps Lock
kKeyShiftL = 0xE051U, ///< Left Shift,
kKeyShiftR, ///< Right Shift
kKeyControlL, ///< Left Control
kKeyControlR, ///< Right Control
kKeyAltL, ///< Left Alt
kKeyAltR, ///< Right Alt / AltGr
kKeySuperL, ///< Left Super
kKeySuperR, ///< Right Super
kKeyPad0 = 0xE060U, ///< Keypad 0
kKeyPad1, ///< Keypad 1
kKeyPad2, ///< Keypad 2
kKeyPad3, ///< Keypad 3
kKeyPad4, ///< Keypad 4
kKeyPad5, ///< Keypad 5
kKeyPad6, ///< Keypad 6
kKeyPad7, ///< Keypad 7
kKeyPad8, ///< Keypad 8
kKeyPad9, ///< Keypad 9
kKeyPadEnter, ///< Keypad Enter
kKeyPadPageUp = 0xE071U, ///< Keypad Page Up
kKeyPadPageDown, ///< Keypad Page Down
kKeyPadEnd, ///< Keypad End
kKeyPadHome, ///< Keypad Home
kKeyPadLeft, ///< Keypad Left
kKeyPadUp, ///< Keypad Up
kKeyPadRight, ///< Keypad Right
kKeyPadDown, ///< Keypad Down
kKeyPadClear = 0xE09DU, ///< Keypad Clear/Begin
kKeyPadInsert, ///< Keypad Insert
kKeyPadDelete, ///< Keypad Delete
kKeyPadEqual, ///< Keypad Equal
kKeyPadMultiply = 0xE0AAU, ///< Keypad Multiply
kKeyPadAdd, ///< Keypad Add
kKeyPadSeparator, ///< Keypad Separator
kKeyPadSubtract, ///< Keypad Subtract
kKeyPadDecimal, ///< Keypad Decimal
kKeyPadDivide, ///< Keypad Divide

// Backwards compatibility with old DPF
kCharBackspace DISTRHO_DEPRECATED_BY("kKeyBackspace") = kKeyBackspace,
kCharEscape DISTRHO_DEPRECATED_BY("kKeyEscape") = kKeyEscape,
kCharDelete DISTRHO_DEPRECATED_BY("kKeyDelete") = kKeyDelete,

// Unicode Private Use Area
kKeyF1 = 0xE000,
kKeyF2,
kKeyF3,
kKeyF4,
kKeyF5,
kKeyF6,
kKeyF7,
kKeyF8,
kKeyF9,
kKeyF10,
kKeyF11,
kKeyF12,
kKeyLeft,
kKeyUp,
kKeyRight,
kKeyDown,
kKeyPageUp,
kKeyPageDown,
kKeyHome,
kKeyEnd,
kKeyInsert,
kKeyShift,
kKeyShiftL = kKeyShift,
kKeyShiftR,
kKeyControl,
kKeyControlL = kKeyControl,
kKeyControlR,
kKeyAlt,
kKeyAltL = kKeyAlt,
kKeyAltR,
kKeySuper,
kKeySuperL = kKeySuper,
kKeySuperR,
kKeyMenu,
kKeyCapsLock,
kKeyScrollLock,
kKeyNumLock,
kKeyPrintScreen,
kKeyPause
kKeyShift DISTRHO_DEPRECATED_BY("kKeyShiftL") = kKeyShiftL,
kKeyControl DISTRHO_DEPRECATED_BY("kKeyControlL") = kKeyControlL,
kKeyAlt DISTRHO_DEPRECATED_BY("kKeyAltL") = kKeyAltL,
kKeySuper DISTRHO_DEPRECATED_BY("kKeySuperL") = kKeySuperL,
};

/**
Expand Down Expand Up @@ -159,15 +191,20 @@ enum MouseButton {
This is a portable subset of mouse cursors that exist on X11, MacOS, and Windows.
*/
enum MouseCursor {
kMouseCursorArrow, ///< Default pointing arrow
kMouseCursorCaret, ///< Caret (I-Beam) for text entry
kMouseCursorCrosshair, ///< Cross-hair
kMouseCursorHand, ///< Hand with a pointing finger
kMouseCursorNotAllowed, ///< Operation not allowed
kMouseCursorLeftRight, ///< Left/right arrow for horizontal resize
kMouseCursorUpDown, ///< Up/down arrow for vertical resize
kMouseCursorDiagonal, ///< Top-left to bottom-right arrow for diagonal resize
kMouseCursorAntiDiagonal ///< Bottom-left to top-right arrow for diagonal resize
kMouseCursorArrow, ///< Default pointing arrow
kMouseCursorCaret, ///< Caret (I-Beam) for text entry
kMouseCursorCrosshair, ///< Cross-hair
kMouseCursorHand, ///< Hand with a pointing finger
kMouseCursorNotAllowed, ///< Operation not allowed
kMouseCursorLeftRight, ///< Left/right arrow for horizontal resize
kMouseCursorUpDown, ///< Up/down arrow for vertical resize
kMouseCursorUpLeftDownRight, ///< Diagonal arrow for down/right resize
kMouseCursorUpRightDownLeft, ///< Diagonal arrow for down/left resize
kMouseCursorAllScroll, ///< Omnidirectional "arrow" for scrolling

// Backwards compatibility with old DPF
kMouseCursorDiagonal DISTRHO_DEPRECATED_BY("kMouseCursorUpLeftDownRight") = kMouseCursorUpLeftDownRight,
kMouseCursorAntiDiagonal DISTRHO_DEPRECATED_BY("kMouseCursorUpRightDownLeft") = kMouseCursorUpRightDownLeft
};

/**
Expand Down
10 changes: 5 additions & 5 deletions dgl/src/ApplicationPrivateData.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* DISTRHO Plugin Framework (DPF)
* Copyright (C) 2012-2021 Filipe Coelho <[email protected]>
* Copyright (C) 2012-2023 Filipe Coelho <[email protected]>
*
* 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
Expand Down Expand Up @@ -47,7 +47,7 @@ static bool isThisTheMainThread(const d_ThreadHandle mainThreadHandle) noexcept

const char* Application::getClassName() const noexcept
{
return puglGetClassName(pData->world);
return puglGetWorldString(pData->world, PUGL_CLASS_NAME);
}

// --------------------------------------------------------------------------------------------------------------------
Expand All @@ -68,9 +68,9 @@ Application::PrivateData::PrivateData(const bool standalone)

puglSetWorldHandle(world, this);
#ifdef __EMSCRIPTEN__
puglSetClassName(world, "canvas");
puglSetWorldString(world, PUGL_CLASS_NAME, "canvas");
#else
puglSetClassName(world, DISTRHO_MACRO_AS_STRING(DGL_NAMESPACE));
puglSetWorldString(world, PUGL_CLASS_NAME, DISTRHO_MACRO_AS_STRING(DGL_NAMESPACE));
#endif
}

Expand Down Expand Up @@ -168,7 +168,7 @@ void Application::PrivateData::setClassName(const char* const name)
DISTRHO_SAFE_ASSERT_RETURN(name != nullptr && name[0] != '\0',);

if (world != nullptr)
puglSetClassName(world, name);
puglSetWorldString(world, PUGL_CLASS_NAME, "canvas");
}

// --------------------------------------------------------------------------------------------------------------------
Expand Down
3 changes: 2 additions & 1 deletion dgl/src/Cairo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -801,9 +801,10 @@ void TopLevelWidget::PrivateData::display()

cairo_matrix_t matrix;
cairo_get_matrix(handle, &matrix);
cairo_translate(handle, 0, 0);

// full viewport size
cairo_translate(handle, 0, 0);

if (window.pData->autoScaling)
cairo_scale(handle, autoScaleFactor, autoScaleFactor);
else
Expand Down
2 changes: 1 addition & 1 deletion dgl/src/WidgetPrivateData.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* DISTRHO Plugin Framework (DPF)
* Copyright (C) 2012-2023 Filipe Coelho <[email protected]>
* Copyright (C) 2012-2022 Filipe Coelho <[email protected]>
*
* 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
Expand Down
10 changes: 7 additions & 3 deletions dgl/src/Window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,13 +323,13 @@ void Window::setSize(const Size<uint>& size)

const char* Window::getTitle() const noexcept
{
return pData->view != nullptr ? puglGetWindowTitle(pData->view) : "";
return pData->view != nullptr ? puglGetViewString(pData->view, PUGL_WINDOW_TITLE) : "";
}

void Window::setTitle(const char* const title)
{
if (pData->view != nullptr)
puglSetWindowTitle(pData->view, title);
puglSetViewString(pData->view, PUGL_WINDOW_TITLE, title);
}

bool Window::isIgnoringKeyRepeat() const noexcept
Expand Down Expand Up @@ -458,11 +458,15 @@ void Window::setGeometryConstraints(uint minimumWidth,
uint minimumHeight,
const bool keepAspectRatio,
const bool automaticallyScale,
const bool resizeNowIfAutoScaling)
bool resizeNowIfAutoScaling)
{
DISTRHO_SAFE_ASSERT_RETURN(minimumWidth > 0,);
DISTRHO_SAFE_ASSERT_RETURN(minimumHeight > 0,);

// prevent auto-scaling up 2x
if (resizeNowIfAutoScaling && automaticallyScale && pData->autoScaling == automaticallyScale)
resizeNowIfAutoScaling = false;

pData->minWidth = minimumWidth;
pData->minHeight = minimumHeight;
pData->autoScaling = automaticallyScale;
Expand Down
Loading

0 comments on commit 8b6196b

Please sign in to comment.