annotate DPF-Prymula-audioplugins/dpf/dgl/src/pugl-extra/haiku.cpp @ 3:84e66ea83026

DPF-Prymula-audioplugins-0.231015-2
author prymula <prymula76@outlook.com>
date Mon, 16 Oct 2023 21:53:34 +0200
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
1 // Copyright 2012-2022 David Robillard <d@drobilla.net>
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
2 // Copyright 2021-2022 Filipe Coelho <falktx@falktx.com>
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
3 // SPDX-License-Identifier: ISC
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
4
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
5 #include "haiku.h"
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
6
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
7 #include "../pugl-upstream/src/internal.h"
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
8
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
9 class PuglHaikuView : public BView
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
10 {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
11 PuglView* const view;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
12
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
13 public:
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
14 PuglHaikuView(PuglView* const v)
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
15 : BView(NULL, B_FULL_UPDATE_ON_RESIZE|B_FRAME_EVENTS|B_NAVIGABLE|B_INPUT_METHOD_AWARE),
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
16 view(v) {}
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
17
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
18 protected:
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
19 void GetPreferredSize(float* width, float* height) override
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
20 {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
21 d_stdout("%s %i", __func__, __LINE__);
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
22 if (width != nullptr)
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
23 *width = view->frame.width;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
24 if (height != nullptr)
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
25 *height = view->frame.height;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
26 d_stdout("%s %i", __func__, __LINE__);
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
27 }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
28 };
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
29
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
30 class PuglHaikuWindow : public BWindow
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
31 {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
32 PuglView* const view;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
33
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
34 public:
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
35 PuglHaikuWindow(PuglView* const v)
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
36 : BWindow(BRect(1.0f), "DPF-Window", B_TITLED_WINDOW, 0x0),
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
37 view(v) {}
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
38
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
39 // protected:
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
40 // bool QuitRequested() override
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
41 // {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
42 // d_stdout("%s %i", __func__, __LINE__);
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
43 // if (puglView->closeFunc) {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
44 // puglView->closeFunc(puglView);
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
45 // puglView->redisplay = false;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
46 // }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
47 // needsQuit = false;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
48 // d_stdout("%s %i", __func__, __LINE__);
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
49 // return true;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
50 // }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
51 };
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
52
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
53 BApplication* s_app = NULL;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
54
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
55 PuglWorldInternals*
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
56 puglInitWorldInternals(const PuglWorldType type, const PuglWorldFlags flags)
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
57 {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
58 if (!s_app) {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
59 status_t status;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
60 s_app = new BApplication("application/x-vnd.pugl-application", &status);
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
61
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
62 if (status != B_OK) {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
63 delete s_app;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
64 return NULL;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
65 }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
66 }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
67
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
68 PuglWorldInternals* impl =
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
69 (PuglWorldInternals*)calloc(1, sizeof(PuglWorldInternals));
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
70
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
71 impl->app = s_app;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
72 return impl;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
73 }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
74
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
75 void*
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
76 puglGetNativeWorld(PuglWorld* const world)
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
77 {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
78 return world->impl->app;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
79 }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
80
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
81 PuglInternals*
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
82 puglInitViewInternals(PuglWorld* const world)
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
83 {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
84 PuglInternals* impl = (PuglInternals*)calloc(1, sizeof(PuglInternals));
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
85
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
86 return impl;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
87 }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
88
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
89 PuglStatus
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
90 puglRealize(PuglView* const view)
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
91 {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
92 PuglInternals* const impl = view->impl;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
93 PuglStatus st = PUGL_SUCCESS;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
94
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
95 // Ensure that we're unrealized and that a reasonable backend has been set
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
96 if (impl->view) {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
97 return PUGL_FAILURE;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
98 }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
99 if (!view->backend || !view->backend->configure) {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
100 return PUGL_BAD_BACKEND;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
101 }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
102
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
103 // Set the size to the default if it has not already been set
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
104 if (view->frame.width <= 0.0 || view->frame.height <= 0.0) {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
105 const PuglViewSize defaultSize = view->sizeHints[PUGL_DEFAULT_SIZE];
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
106 if (!defaultSize.width || !defaultSize.height) {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
107 return PUGL_BAD_CONFIGURATION;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
108 }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
109
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
110 view->frame.width = defaultSize.width;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
111 view->frame.height = defaultSize.height;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
112 }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
113
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
114 // Center top-level windows if a position has not been set
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
115 if (!view->parent && !view->frame.x && !view->frame.y) {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
116 // TODO
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
117 }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
118
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
119 if (!view->parent) {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
120 impl->window = new PuglHaikuWindow(view);
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
121 impl->window->Lock();
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
122 }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
123
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
124 impl->view = new PuglHaikuView(view);
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
125
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
126 if (view->parent) {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
127 BView* const pview = (BView*)view->parent;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
128 pview->AddChild(impl->view);
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
129 } else {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
130 impl->window->AddChild(impl->view);
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
131 }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
132
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
133 // Configure and create the backend
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
134 if ((st = view->backend->configure(view)) || (st = view->backend->create(view))) {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
135 view->backend->destroy(view);
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
136 return st;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
137 }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
138
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
139 if (view->title) {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
140 puglSetWindowTitle(view, view->title);
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
141 }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
142
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
143 if (view->transientParent) {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
144 puglSetTransientParent(view, view->transientParent);
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
145 }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
146
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
147 puglDispatchSimpleEvent(view, PUGL_CREATE);
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
148
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
149 if (impl->window) {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
150 impl->window->Unlock();
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
151 }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
152
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
153 return PUGL_SUCCESS;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
154 }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
155
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
156 PuglStatus
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
157 puglShow(PuglView* const view)
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
158 {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
159 PuglInternals* const impl = view->impl;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
160 if (impl->window) {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
161 impl->window->Show();
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
162 } else {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
163 impl->view->Show();
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
164 }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
165 return PUGL_SUCCESS;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
166 }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
167
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
168 PuglStatus
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
169 puglHide(PuglView* const view)
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
170 {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
171 PuglInternals* const impl = view->impl;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
172 if (impl->window) {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
173 impl->window->Hide();
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
174 } else {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
175 impl->view->Hide();
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
176 }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
177 return PUGL_SUCCESS;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
178 }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
179
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
180 void
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
181 puglFreeViewInternals(PuglView* const view)
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
182 {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
183 if (view && view->impl) {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
184 PuglInternals* const impl = view->impl;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
185 if (view->backend) {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
186 view->backend->destroy(view);
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
187 }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
188 if (impl->view) {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
189 if (impl->window) {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
190 impl->window->RemoveChild(impl->view);
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
191 }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
192 delete impl->view;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
193 delete impl->window;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
194 }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
195 free(impl);
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
196 }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
197 }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
198
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
199 void
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
200 puglFreeWorldInternals(PuglWorld* const world)
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
201 {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
202 // if (world->impl->app != nullptr && world->impl->app->CountWindows() == 0) {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
203 // delete world->impl->app;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
204 // s_app = NULL;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
205 // }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
206 free(world->impl);
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
207 }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
208
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
209 PuglStatus
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
210 puglGrabFocus(PuglView*)
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
211 {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
212 return PUGL_UNSUPPORTED;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
213 }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
214
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
215 double
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
216 puglGetScaleFactor(const PuglView* const view)
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
217 {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
218 return 1.0;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
219 }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
220
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
221 double
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
222 puglGetTime(const PuglWorld* const world)
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
223 {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
224 struct timespec ts;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
225 clock_gettime(CLOCK_MONOTONIC, &ts);
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
226 return ((double)ts.tv_sec + (double)ts.tv_nsec / 1000000000.0) -
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
227 world->startTime;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
228 }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
229
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
230 PuglStatus
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
231 puglUpdate(PuglWorld* const world, const double timeout)
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
232 {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
233 return PUGL_UNSUPPORTED;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
234 }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
235
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
236 PuglStatus
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
237 puglPostRedisplay(PuglView* const view)
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
238 {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
239 return PUGL_UNSUPPORTED;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
240 }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
241
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
242 PuglStatus
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
243 puglPostRedisplayRect(PuglView* const view, const PuglRect rect)
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
244 {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
245 return PUGL_UNSUPPORTED;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
246 }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
247
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
248 PuglNativeView
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
249 puglGetNativeView(PuglView* const view)
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
250 {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
251 return 0;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
252 }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
253
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
254 PuglStatus
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
255 puglSetWindowTitle(PuglView* const view, const char* const title)
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
256 {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
257 puglSetString(&view->title, title);
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
258 return PUGL_UNSUPPORTED;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
259 }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
260
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
261 PuglStatus
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
262 puglSetSizeHint(PuglView* const view,
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
263 const PuglSizeHint hint,
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
264 const PuglSpan width,
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
265 const PuglSpan height)
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
266 {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
267 view->sizeHints[hint].width = width;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
268 view->sizeHints[hint].height = height;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
269 return PUGL_SUCCESS;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
270 }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
271
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
272 PuglStatus
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
273 puglStartTimer(PuglView* const view, const uintptr_t id, const double timeout)
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
274 {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
275 return PUGL_UNSUPPORTED;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
276 }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
277
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
278 PuglStatus
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
279 puglStopTimer(PuglView* const view, const uintptr_t id)
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
280 {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
281 return PUGL_UNSUPPORTED;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
282 }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
283
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
284 PuglStatus
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
285 puglPaste(PuglView* const view)
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
286 {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
287 return PUGL_UNSUPPORTED;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
288 }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
289
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
290 PuglStatus
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
291 puglAcceptOffer(PuglView* const view,
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
292 const PuglDataOfferEvent* const offer,
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
293 const uint32_t typeIndex)
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
294 {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
295 return PUGL_UNSUPPORTED;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
296 }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
297
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
298 uint32_t
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
299 puglGetNumClipboardTypes(const PuglView* const view)
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
300 {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
301 return 0u;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
302 }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
303
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
304 const char*
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
305 puglGetClipboardType(const PuglView* const view, const uint32_t typeIndex)
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
306 {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
307 return NULL;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
308 }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
309
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
310 const void*
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
311 puglGetClipboard(PuglView* const view,
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
312 const uint32_t typeIndex,
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
313 size_t* const len)
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
314 {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
315 return NULL;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
316 }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
317
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
318 PuglStatus
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
319 puglSetClipboard(PuglView* const view,
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
320 const char* const type,
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
321 const void* const data,
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
322 const size_t len)
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
323 {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
324 return PUGL_FAILURE;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
325 }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
326
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
327 PuglStatus
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
328 puglSetCursor(PuglView* const view, const PuglCursor cursor)
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
329 {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
330 return PUGL_FAILURE;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
331 }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
332
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
333 PuglStatus
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
334 puglSetTransientParent(PuglView* const view, const PuglNativeView parent)
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
335 {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
336 return PUGL_FAILURE;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
337 }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
338
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
339 PuglStatus
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
340 puglSetPosition(PuglView* const view, const int x, const int y)
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
341 {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
342 return PUGL_FAILURE;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
343 }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
344
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
345 #if 0
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
346 PuglStatus
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
347 puglGrabFocus(PuglView* view)
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
348 {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
349 view->impl->bView->MakeFocus(true);
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
350 return PUGL_SUCCESS;
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
351 }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
352
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
353 // extras follow
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
354
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
355 void
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
356 puglRaiseWindow(PuglView* view)
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
357 {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
358 }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
359
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
360 void
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
361 puglSetWindowSize(PuglView* view, unsigned int width, unsigned int height)
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
362 {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
363 bView->ResizeTo(width, height);
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
364
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
365 if (bWindow != nullptr && bWindow->LockLooper())
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
366 {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
367 bWindow->MoveTo(50, 50);
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
368 bWindow->ResizeTo(width, height);
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
369
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
370 if (! forced)
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
371 bWindow->Flush();
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
372
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
373 bWindow->UnlockLooper();
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
374 }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
375 // TODO resizable
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
376 }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
377
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
378 void setVisible(const bool yesNo)
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
379 {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
380 if (bWindow != nullptr)
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
381 {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
382 if (bWindow->LockLooper())
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
383 {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
384 if (yesNo)
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
385 bWindow->Show();
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
386 else
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
387 bWindow->Hide();
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
388
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
389 // TODO use flush?
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
390 bWindow->Sync();
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
391 bWindow->UnlockLooper();
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
392 }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
393 }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
394 else
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
395 {
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
396 if (yesNo)
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
397 bView->Show();
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
398 else
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
399 bView->Hide();
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
400 }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
401 }
84e66ea83026 DPF-Prymula-audioplugins-0.231015-2
prymula <prymula76@outlook.com>
parents:
diff changeset
402 #endif