Skip to content

Commit c4d4c60

Browse files
committed
Update DPF
Signed-off-by: falkTX <falktx@falktx.com>
1 parent 8616f96 commit c4d4c60

3 files changed

Lines changed: 44 additions & 21 deletions

File tree

‎.github/workflows/build.yml‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
run: |
2323
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
2424
sudo apt-get update -qq
25-
sudo apt-get install -yqq --allow-downgrades libpcre2-8-0/focal
25+
sudo apt-get install -yqq --allow-downgrades libpcre2-8-0/focal libpcre2-16-0/focal libpcre2-32-0/focal libpcre2-posix2/focal
2626
- name: Set up dependencies
2727
run: |
2828
sudo dpkg --add-architecture arm64
@@ -60,7 +60,7 @@ jobs:
6060
run: |
6161
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
6262
sudo apt-get update -qq
63-
sudo apt-get install -yqq --allow-downgrades libpcre2-8-0/focal
63+
sudo apt-get install -yqq --allow-downgrades libpcre2-8-0/focal libpcre2-16-0/focal libpcre2-32-0/focal libpcre2-posix2/focal
6464
- name: Set up dependencies
6565
run: |
6666
sudo dpkg --add-architecture armhf
@@ -98,7 +98,7 @@ jobs:
9898
run: |
9999
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
100100
sudo apt-get update -qq
101-
sudo apt-get install -yqq --allow-downgrades libpcre2-8-0/focal
101+
sudo apt-get install -yqq --allow-downgrades libpcre2-8-0/focal libpcre2-16-0/focal libpcre2-32-0/focal libpcre2-posix2/focal
102102
- name: Set up dependencies
103103
run: |
104104
sudo dpkg --add-architecture i386
@@ -193,7 +193,7 @@ jobs:
193193
run: |
194194
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
195195
sudo apt-get update -qq
196-
sudo apt-get install -yqq --allow-downgrades libpcre2-8-0/focal
196+
sudo apt-get install -yqq --allow-downgrades libpcre2-8-0/focal libpcre2-16-0/focal libpcre2-32-0/focal libpcre2-posix2/focal
197197
- name: Set up dependencies
198198
run: |
199199
sudo dpkg --add-architecture i386
@@ -327,14 +327,14 @@ jobs:
327327
done
328328
- name: Test VST2 plugins
329329
run: |
330-
for p in $(ls bin/ | grep vst.so); do \
330+
for p in $(find bin/ | grep -e vst.so -e '.*\.vst/.*\.so'); do \
331331
env CARLA_BRIDGE_DUMMY=1 CARLA_BRIDGE_TESTING=native \
332332
valgrind \
333333
--error-exitcode=255 \
334334
--leak-check=full \
335335
--track-origins=yes \
336336
--suppressions=./dpf/utils/valgrind-dpf.supp \
337-
/usr/lib/carla/carla-bridge-native vst2 ./bin/${p} "" 1>/dev/null; \
337+
/usr/lib/carla/carla-bridge-native vst2 ./${p} "" 1>/dev/null; \
338338
done
339339
- name: Test VST3 plugins
340340
run: |

‎plugins/glBars/ResizeHandle.hpp‎

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Resize handle for DPF
3-
* Copyright (C) 2021 Filipe Coelho <falktx@falktx.com>
3+
* Copyright (C) 2021-2022 Filipe Coelho <falktx@falktx.com>
44
*
55
* Permission to use, copy, modify, and/or distribute this software for any purpose with
66
* or without fee is hereby granted, provided that the above copyright notice and this
@@ -29,7 +29,8 @@ class ResizeHandle : public TopLevelWidget
2929
explicit ResizeHandle(Window& window)
3030
: TopLevelWidget(window),
3131
handleSize(16),
32-
resizing(false)
32+
hasCursor(false),
33+
isResizing(false)
3334
{
3435
resetArea();
3536
}
@@ -38,12 +39,14 @@ class ResizeHandle : public TopLevelWidget
3839
explicit ResizeHandle(TopLevelWidget* const tlw)
3940
: TopLevelWidget(tlw->getWindow()),
4041
handleSize(16),
41-
resizing(false)
42+
hasCursor(false),
43+
isResizing(false)
4244
{
4345
resetArea();
4446
}
4547

46-
/** Set the handle size, minimum 16. */
48+
/** Set the handle size, minimum 16.
49+
* Scale factor is automatically applied on top of this size as needed */
4750
void setHandleSize(const uint size)
4851
{
4952
handleSize = std::max(16u, size);
@@ -53,12 +56,14 @@ class ResizeHandle : public TopLevelWidget
5356
protected:
5457
void onDisplay() override
5558
{
59+
// TODO implement gl3 stuff in DPF
60+
#ifndef DGL_USE_OPENGL3
5661
const GraphicsContext& context(getGraphicsContext());
5762
const double lineWidth = 1.0 * getScaleFactor();
5863

59-
#ifdef DGL_OPENGL
64+
#if defined(DGL_OPENGL) && !defined(DGL_USE_OPENGL3)
6065
glMatrixMode(GL_MODELVIEW);
61-
#endif
66+
#endif
6267

6368
// draw white lines, 1px wide
6469
Color(1.0f, 1.0f, 1.0f).setFor(context);
@@ -75,6 +80,7 @@ class ResizeHandle : public TopLevelWidget
7580
l1b.draw(context, lineWidth);
7681
l2b.draw(context, lineWidth);
7782
l3b.draw(context, lineWidth);
83+
#endif
7884
}
7985

8086
bool onMouse(const MouseEvent& ev) override
@@ -84,15 +90,16 @@ class ResizeHandle : public TopLevelWidget
8490

8591
if (ev.press && area.contains(ev.pos))
8692
{
87-
resizing = true;
93+
isResizing = true;
8894
resizingSize = Size<double>(getWidth(), getHeight());
8995
lastResizePoint = ev.pos;
9096
return true;
9197
}
9298

93-
if (resizing && ! ev.press)
99+
if (isResizing && ! ev.press)
94100
{
95-
resizing = false;
101+
isResizing = false;
102+
recheckCursor(ev.pos);
96103
return true;
97104
}
98105

@@ -101,18 +108,23 @@ class ResizeHandle : public TopLevelWidget
101108

102109
bool onMotion(const MotionEvent& ev) override
103110
{
104-
if (! resizing)
111+
if (! isResizing)
112+
{
113+
recheckCursor(ev.pos);
105114
return false;
115+
}
106116

107117
const Size<double> offset(ev.pos.getX() - lastResizePoint.getX(),
108118
ev.pos.getY() - lastResizePoint.getY());
109119

110120
resizingSize += offset;
111121
lastResizePoint = ev.pos;
112122

113-
// TODO min width, min height
114-
const uint minWidth = 16;
115-
const uint minHeight = 16;
123+
// TODO keepAspectRatio
124+
bool keepAspectRatio;
125+
const Size<uint> minSize(getWindow().getGeometryConstraints(keepAspectRatio));
126+
const uint minWidth = minSize.getWidth();
127+
const uint minHeight = minSize.getHeight();
116128

117129
if (resizingSize.getWidth() < minWidth)
118130
resizingSize.setWidth(minWidth);
@@ -139,10 +151,21 @@ class ResizeHandle : public TopLevelWidget
139151
uint handleSize;
140152

141153
// event handling state
142-
bool resizing;
154+
bool hasCursor, isResizing;
143155
Point<double> lastResizePoint;
144156
Size<double> resizingSize;
145157

158+
void recheckCursor(const Point<double>& pos)
159+
{
160+
const bool shouldHaveCursor = area.contains(pos);
161+
162+
if (shouldHaveCursor == hasCursor)
163+
return;
164+
165+
hasCursor = shouldHaveCursor;
166+
setCursor(shouldHaveCursor ? kMouseCursorDiagonal : kMouseCursorArrow);
167+
}
168+
146169
void resetArea()
147170
{
148171
const double scaleFactor = getScaleFactor();

0 commit comments

Comments
 (0)