Cleanup
[carla.git] / source / modules / dgl / src / pugl.cpp
blob5ed3b5b246b0d85693b306fbd7ac5fc87e8b896b
1 /*
2 * DISTRHO Plugin Framework (DPF)
3 * Copyright (C) 2012-2022 Filipe Coelho <falktx@falktx.com>
5 * Permission to use, copy, modify, and/or distribute this software for any purpose with
6 * or without fee is hereby granted, provided that the above copyright notice and this
7 * permission notice appear in all copies.
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
10 * TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
11 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
12 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
13 * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 #include "pugl.hpp"
19 // --------------------------------------------------------------------------------------------------------------------
20 // include base headers
22 #ifdef DGL_CAIRO
23 # include <cairo.h>
24 #endif
25 #ifdef DGL_OPENGL
26 # include "../OpenGL-include.hpp"
27 #endif
28 #ifdef DGL_VULKAN
29 # include <vulkan/vulkan_core.h>
30 #endif
32 /* we will include all header files used in pugl in their C++ friendly form, then pugl stuff in custom namespace */
33 #include <cassert>
34 #include <cmath>
35 #include <cstdlib>
36 #include <cstdio>
37 #include <cstring>
38 #include <ctime>
40 #if defined(DISTRHO_OS_MAC)
41 # import <Cocoa/Cocoa.h>
42 # include <dlfcn.h>
43 # include <mach/mach_time.h>
44 # ifdef DGL_CAIRO
45 # include <cairo-quartz.h>
46 # endif
47 # ifdef DGL_OPENGL
48 # include <OpenGL/gl.h>
49 # endif
50 # ifdef DGL_VULKAN
51 # import <QuartzCore/CAMetalLayer.h>
52 # include <vulkan/vulkan_macos.h>
53 # endif
54 #elif defined(DISTRHO_OS_WASM)
55 # include <emscripten/emscripten.h>
56 # include <emscripten/html5.h>
57 # ifdef DGL_OPENGL
58 # include <EGL/egl.h>
59 # endif
60 #elif defined(DISTRHO_OS_WINDOWS)
61 # include <wctype.h>
62 # include <winsock2.h>
63 # include <windows.h>
64 # include <windowsx.h>
65 # ifdef DGL_CAIRO
66 # include <cairo-win32.h>
67 # endif
68 # ifdef DGL_OPENGL
69 # include <GL/gl.h>
70 # endif
71 # ifdef DGL_VULKAN
72 # include <vulkan/vulkan.h>
73 # include <vulkan/vulkan_win32.h>
74 # endif
75 #elif defined(HAVE_X11)
76 # include <dlfcn.h>
77 # include <limits.h>
78 # include <unistd.h>
79 # include <sys/select.h>
80 // # include <sys/time.h>
81 # include <X11/X.h>
82 # include <X11/Xatom.h>
83 # include <X11/Xlib.h>
84 # include <X11/Xresource.h>
85 # include <X11/Xutil.h>
86 # include <X11/keysym.h>
87 # ifdef HAVE_XCURSOR
88 # include <X11/Xcursor/Xcursor.h>
89 // # include <X11/cursorfont.h>
90 # endif
91 # ifdef HAVE_XRANDR
92 # include <X11/extensions/Xrandr.h>
93 # endif
94 # ifdef HAVE_XSYNC
95 # include <X11/extensions/sync.h>
96 # include <X11/extensions/syncconst.h>
97 # endif
98 # ifdef DGL_CAIRO
99 # include <cairo-xlib.h>
100 # endif
101 # ifdef DGL_OPENGL
102 # include <GL/glx.h>
103 # endif
104 # ifdef DGL_VULKAN
105 # include <vulkan/vulkan_xlib.h>
106 # endif
107 #endif
109 #ifndef DGL_FILE_BROWSER_DISABLED
110 # define FILE_BROWSER_DIALOG_DGL_NAMESPACE
111 # define FILE_BROWSER_DIALOG_NAMESPACE DGL_NAMESPACE
112 # define DGL_FILE_BROWSER_DIALOG_HPP_INCLUDED
113 START_NAMESPACE_DGL
114 # include "../../distrho/extra/FileBrowserDialogImpl.hpp"
115 END_NAMESPACE_DGL
116 # include "../../distrho/extra/FileBrowserDialogImpl.cpp"
117 #endif
119 #ifndef DISTRHO_OS_MAC
120 START_NAMESPACE_DGL
121 #endif
123 // --------------------------------------------------------------------------------------------------------------------
125 #if defined(DISTRHO_OS_MAC)
126 # ifndef DISTRHO_MACOS_NAMESPACE_MACRO
127 # define DISTRHO_MACOS_NAMESPACE_MACRO_HELPER(NS, SEP, INTERFACE) NS ## SEP ## INTERFACE
128 # define DISTRHO_MACOS_NAMESPACE_MACRO(NS, INTERFACE) DISTRHO_MACOS_NAMESPACE_MACRO_HELPER(NS, _, INTERFACE)
129 # define PuglCairoView DISTRHO_MACOS_NAMESPACE_MACRO(DGL_NAMESPACE, PuglCairoView)
130 # define PuglOpenGLView DISTRHO_MACOS_NAMESPACE_MACRO(DGL_NAMESPACE, PuglOpenGLView)
131 # define PuglStubView DISTRHO_MACOS_NAMESPACE_MACRO(DGL_NAMESPACE, PuglStubView)
132 # define PuglVulkanView DISTRHO_MACOS_NAMESPACE_MACRO(DGL_NAMESPACE, PuglVulkanView)
133 # define PuglWindow DISTRHO_MACOS_NAMESPACE_MACRO(DGL_NAMESPACE, PuglWindow)
134 # define PuglWindowDelegate DISTRHO_MACOS_NAMESPACE_MACRO(DGL_NAMESPACE, PuglWindowDelegate)
135 # define PuglWrapperView DISTRHO_MACOS_NAMESPACE_MACRO(DGL_NAMESPACE, PuglWrapperView)
136 # endif
137 # pragma clang diagnostic push
138 # pragma clang diagnostic ignored "-Wdeprecated-declarations"
139 # import "pugl-upstream/src/mac.m"
140 # import "pugl-upstream/src/mac_stub.m"
141 # ifdef DGL_CAIRO
142 # import "pugl-upstream/src/mac_cairo.m"
143 # endif
144 # ifdef DGL_OPENGL
145 # import "pugl-upstream/src/mac_gl.m"
146 # endif
147 # ifdef DGL_VULKAN
148 # import "pugl-upstream/src/mac_vulkan.m"
149 # endif
150 # pragma clang diagnostic pop
151 #elif defined(DISTRHO_OS_WASM)
152 # include "pugl-upstream/src/wasm.c"
153 # include "pugl-upstream/src/wasm_stub.c"
154 # ifdef DGL_OPENGL
155 # include "pugl-upstream/src/wasm_gl.c"
156 # endif
157 #elif defined(DISTRHO_OS_WINDOWS)
158 # include "pugl-upstream/src/win.c"
159 # include "pugl-upstream/src/win_stub.c"
160 # ifdef DGL_CAIRO
161 # include "pugl-upstream/src/win_cairo.c"
162 # endif
163 # ifdef DGL_OPENGL
164 # include "pugl-upstream/src/win_gl.c"
165 # endif
166 # ifdef DGL_VULKAN
167 # include "pugl-upstream/src/win_vulkan.c"
168 # endif
169 #elif defined(HAVE_X11)
170 # include "pugl-upstream/src/x11.c"
171 # include "pugl-upstream/src/x11_stub.c"
172 # ifdef DGL_CAIRO
173 # include "pugl-upstream/src/x11_cairo.c"
174 # endif
175 # ifdef DGL_OPENGL
176 # include "pugl-upstream/src/x11_gl.c"
177 # endif
178 # ifdef DGL_VULKAN
179 # include "pugl-upstream/src/x11_vulkan.c"
180 # endif
181 #endif
183 #include "pugl-upstream/src/common.c"
184 #include "pugl-upstream/src/internal.c"
186 // --------------------------------------------------------------------------------------------------------------------
187 // DGL specific, expose backend enter
189 bool puglBackendEnter(PuglView* const view)
191 return view->backend->enter(view, nullptr) == PUGL_SUCCESS;
194 // --------------------------------------------------------------------------------------------------------------------
195 // DGL specific, expose backend leave
197 bool puglBackendLeave(PuglView* const view)
199 return view->backend->leave(view, nullptr) == PUGL_SUCCESS;
202 // --------------------------------------------------------------------------------------------------------------------
203 // DGL specific, assigns backend that matches current DGL build
205 void puglSetMatchingBackendForCurrentBuild(PuglView* const view)
207 #ifdef DGL_CAIRO
208 puglSetBackend(view, puglCairoBackend());
209 #endif
210 #ifdef DGL_OPENGL
211 puglSetBackend(view, puglGlBackend());
212 #endif
213 #ifdef DGL_VULKAN
214 puglSetBackend(view, puglVulkanBackend());
215 #endif
216 if (view->backend == nullptr)
217 puglSetBackend(view, puglStubBackend());
220 // --------------------------------------------------------------------------------------------------------------------
221 // bring view window into the foreground, aka "raise" window
223 void puglRaiseWindow(PuglView* const view)
225 #if defined(DISTRHO_OS_MAC)
226 if (NSWindow* const window = view->impl->window ? view->impl->window
227 : [view->impl->wrapperView window])
228 [window orderFrontRegardless];
229 #elif defined(DISTRHO_OS_WASM)
230 // nothing
231 #elif defined(DISTRHO_OS_WINDOWS)
232 SetForegroundWindow(view->impl->hwnd);
233 SetActiveWindow(view->impl->hwnd);
234 #elif defined(HAVE_X11)
235 XRaiseWindow(view->world->impl->display, view->impl->win);
236 #endif
239 // --------------------------------------------------------------------------------------------------------------------
240 // get scale factor from parent window if possible, fallback to puglGetScaleFactor
242 double puglGetScaleFactorFromParent(const PuglView* const view)
244 const PuglNativeView parent = view->parent ? view->parent : view->transientParent ? view->transientParent : 0;
245 #if defined(DISTRHO_OS_MAC)
246 // some of these can return 0 as backingScaleFactor, pick the most relevant valid one
247 const NSWindow* possibleWindows[] = {
248 parent != 0 ? [(NSView*)parent window] : nullptr,
249 view->impl->window,
250 [view->impl->wrapperView window]
252 for (size_t i=0; i<ARRAY_SIZE(possibleWindows); ++i)
254 if (possibleWindows[i] == nullptr)
255 continue;
256 if (const double scaleFactor = [[possibleWindows[i] screen] backingScaleFactor])
257 return scaleFactor;
259 return [[NSScreen mainScreen] backingScaleFactor];
260 #elif defined(DISTRHO_OS_WINDOWS)
261 const HWND hwnd = parent != 0 ? (HWND)parent : view->impl->hwnd;
262 return puglWinGetViewScaleFactor(hwnd);
263 #else
264 return puglGetScaleFactor(view);
265 // unused
266 (void)parent;
267 #endif
270 // --------------------------------------------------------------------------------------------------------------------
271 // Combined puglSetSizeHint using PUGL_MIN_SIZE and PUGL_FIXED_ASPECT
273 PuglStatus puglSetGeometryConstraints(PuglView* const view, const uint width, const uint height, const bool aspect)
275 view->sizeHints[PUGL_MIN_SIZE].width = width;
276 view->sizeHints[PUGL_MIN_SIZE].height = height;
278 if (aspect)
280 view->sizeHints[PUGL_FIXED_ASPECT].width = width;
281 view->sizeHints[PUGL_FIXED_ASPECT].height = height;
284 #if defined(DISTRHO_OS_MAC)
285 if (view->impl->window)
287 PuglStatus status;
289 if ((status = updateSizeHint(view, PUGL_MIN_SIZE)) != PUGL_SUCCESS)
290 return status;
292 if (aspect && (status = updateSizeHint(view, PUGL_FIXED_ASPECT)) != PUGL_SUCCESS)
293 return status;
295 #elif defined(DISTRHO_OS_WASM)
296 // nothing
297 #elif defined(DISTRHO_OS_WINDOWS)
298 // nothing
299 #elif defined(HAVE_X11)
300 if (const PuglStatus status = updateSizeHints(view))
301 return status;
303 XFlush(view->world->impl->display);
304 #endif
306 return PUGL_SUCCESS;
309 // --------------------------------------------------------------------------------------------------------------------
310 // set view as resizable (or not) during runtime
312 void puglSetResizable(PuglView* const view, const bool resizable)
314 puglSetViewHint(view, PUGL_RESIZABLE, resizable ? PUGL_TRUE : PUGL_FALSE);
316 #if defined(DISTRHO_OS_MAC)
317 if (PuglWindow* const window = view->impl->window)
319 const uint style = (NSClosableWindowMask | NSTitledWindowMask | NSMiniaturizableWindowMask)
320 | (resizable ? NSResizableWindowMask : 0x0);
321 [window setStyleMask:style];
323 // FIXME use [view setAutoresizingMask:NSViewNotSizable] ?
324 #elif defined(DISTRHO_OS_WASM)
325 // nothing
326 #elif defined(DISTRHO_OS_WINDOWS)
327 if (const HWND hwnd = view->impl->hwnd)
329 const uint winFlags = resizable ? GetWindowLong(hwnd, GWL_STYLE) | (WS_SIZEBOX | WS_MAXIMIZEBOX)
330 : GetWindowLong(hwnd, GWL_STYLE) & ~(WS_SIZEBOX | WS_MAXIMIZEBOX);
331 SetWindowLong(hwnd, GWL_STYLE, winFlags);
333 #elif defined(HAVE_X11)
334 updateSizeHints(view);
335 #endif
338 // --------------------------------------------------------------------------------------------------------------------
339 // set window size while also changing default
341 PuglStatus puglSetSizeAndDefault(PuglView* view, uint width, uint height)
343 if (width > INT16_MAX || height > INT16_MAX)
344 return PUGL_BAD_PARAMETER;
346 view->sizeHints[PUGL_DEFAULT_SIZE].width = view->frame.width = static_cast<PuglSpan>(width);
347 view->sizeHints[PUGL_DEFAULT_SIZE].height = view->frame.height = static_cast<PuglSpan>(height);
349 #if defined(DISTRHO_OS_MAC)
350 // mostly matches upstream pugl, simplified
351 PuglInternals* const impl = view->impl;
353 const PuglRect frame = view->frame;
354 const NSRect framePx = rectToNsRect(frame);
355 const NSRect framePt = nsRectToPoints(view, framePx);
357 if (PuglWindow* const window = view->impl->window)
359 const NSRect screenPt = rectToScreen(viewScreen(view), framePt);
360 const NSRect winFrame = [window frameRectForContentRect:screenPt];
361 [window setFrame:winFrame display:NO];
364 const NSSize sizePx = NSMakeSize(frame.width, frame.height);
365 const NSSize sizePt = [impl->drawView convertSizeFromBacking:sizePx];
366 [impl->wrapperView setFrameSize:sizePt];
367 [impl->drawView setFrameSize:sizePt];
368 #elif defined(DISTRHO_OS_WASM)
369 d_stdout("className is %s", view->world->className);
370 emscripten_set_canvas_element_size(view->world->className, width, height);
371 #elif defined(DISTRHO_OS_WINDOWS)
372 // matches upstream pugl, except we re-enter context after resize
373 if (const HWND hwnd = view->impl->hwnd)
375 const RECT rect = adjustedWindowRect(view, view->frame.x, view->frame.y,
376 static_cast<long>(width), static_cast<long>(height));
378 if (!SetWindowPos(hwnd, HWND_TOP, 0, 0, rect.right - rect.left, rect.bottom - rect.top,
379 SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOZORDER | SWP_NOMOVE))
380 return PUGL_UNKNOWN_ERROR;
382 // make sure to return context back to ourselves
383 puglBackendEnter(view);
385 #elif defined(HAVE_X11)
386 // matches upstream pugl, all in one
387 if (const Window window = view->impl->win)
389 Display* const display = view->world->impl->display;
391 if (! XResizeWindow(display, window, width, height))
392 return PUGL_UNKNOWN_ERROR;
394 if (const PuglStatus status = updateSizeHints(view))
395 return status;
397 XFlush(display);
399 #endif
401 return PUGL_SUCCESS;
404 // --------------------------------------------------------------------------------------------------------------------
405 // DGL specific, build-specific drawing prepare
407 void puglOnDisplayPrepare(PuglView*)
409 #ifdef DGL_OPENGL
410 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
411 # ifndef DGL_USE_GLES
412 glLoadIdentity();
413 # endif
414 #endif
417 // --------------------------------------------------------------------------------------------------------------------
418 // DGL specific, build-specific fallback resize
420 void puglFallbackOnResize(PuglView* const view)
422 #ifdef DGL_OPENGL
423 glEnable(GL_BLEND);
424 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
425 # ifndef DGL_USE_GLES
426 glMatrixMode(GL_PROJECTION);
427 glLoadIdentity();
428 glOrtho(0.0, static_cast<GLdouble>(view->frame.width), static_cast<GLdouble>(view->frame.height), 0.0, 0.0, 1.0);
429 glViewport(0, 0, static_cast<GLsizei>(view->frame.width), static_cast<GLsizei>(view->frame.height));
430 glMatrixMode(GL_MODELVIEW);
431 glLoadIdentity();
432 # else
433 glViewport(0, 0, static_cast<GLsizei>(view->frame.width), static_cast<GLsizei>(view->frame.height));
434 # endif
435 #else
436 return;
437 // unused
438 (void)view;
439 #endif
442 // --------------------------------------------------------------------------------------------------------------------
444 #if defined(DISTRHO_OS_MAC)
446 // --------------------------------------------------------------------------------------------------------------------
447 // macOS specific, add another view's window as child
449 PuglStatus
450 puglMacOSAddChildWindow(PuglView* const view, PuglView* const child)
452 if (NSWindow* const viewWindow = view->impl->window ? view->impl->window
453 : [view->impl->wrapperView window])
455 if (NSWindow* const childWindow = child->impl->window ? child->impl->window
456 : [child->impl->wrapperView window])
458 [viewWindow addChildWindow:childWindow ordered:NSWindowAbove];
459 return PUGL_SUCCESS;
463 return PUGL_FAILURE;
466 // --------------------------------------------------------------------------------------------------------------------
467 // macOS specific, remove another view's window as child
469 PuglStatus
470 puglMacOSRemoveChildWindow(PuglView* const view, PuglView* const child)
472 if (NSWindow* const viewWindow = view->impl->window ? view->impl->window
473 : [view->impl->wrapperView window])
475 if (NSWindow* const childWindow = child->impl->window ? child->impl->window
476 : [child->impl->wrapperView window])
478 [viewWindow removeChildWindow:childWindow];
479 return PUGL_SUCCESS;
483 return PUGL_FAILURE;
486 // --------------------------------------------------------------------------------------------------------------------
487 // macOS specific, center view based on parent coordinates (if there is one)
489 void puglMacOSShowCentered(PuglView* const view)
491 if (puglShow(view) != PUGL_SUCCESS)
492 return;
494 if (view->transientParent != 0)
496 NSWindow* const transientWindow = [(NSView*)view->transientParent window];
497 DISTRHO_SAFE_ASSERT_RETURN(transientWindow != nullptr,);
499 const NSRect ourFrame = [view->impl->window frame];
500 const NSRect transientFrame = [transientWindow frame];
502 const int x = transientFrame.origin.x + (transientFrame.size.width - ourFrame.size.width) / 2;
503 const int y = transientFrame.origin.y + (transientFrame.size.height - ourFrame.size.height) / 2;
505 [view->impl->window setFrameTopLeftPoint:NSMakePoint(x, y)];
507 else
509 [view->impl->window center];
513 // --------------------------------------------------------------------------------------------------------------------
515 #elif defined(DISTRHO_OS_WINDOWS)
517 // --------------------------------------------------------------------------------------------------------------------
518 // win32 specific, call ShowWindow with SW_RESTORE
520 void puglWin32RestoreWindow(PuglView* const view)
522 PuglInternals* impl = view->impl;
523 DISTRHO_SAFE_ASSERT_RETURN(impl->hwnd != nullptr,);
525 ShowWindow(impl->hwnd, SW_RESTORE);
526 SetFocus(impl->hwnd);
529 // --------------------------------------------------------------------------------------------------------------------
530 // win32 specific, center view based on parent coordinates (if there is one)
532 void puglWin32ShowCentered(PuglView* const view)
534 PuglInternals* impl = view->impl;
535 DISTRHO_SAFE_ASSERT_RETURN(impl->hwnd != nullptr,);
537 RECT rectChild, rectParent;
539 if (view->transientParent != 0 &&
540 GetWindowRect(impl->hwnd, &rectChild) &&
541 GetWindowRect((HWND)view->transientParent, &rectParent))
543 SetWindowPos(impl->hwnd, (HWND)view->transientParent,
544 rectParent.left + (rectChild.right-rectChild.left)/2,
545 rectParent.top + (rectChild.bottom-rectChild.top)/2,
546 0, 0, SWP_SHOWWINDOW|SWP_NOSIZE);
548 else
550 #ifdef DGL_WINDOWS_ICON_ID
551 WNDCLASSEX wClass;
552 std::memset(&wClass, 0, sizeof(wClass));
554 const HINSTANCE hInstance = GetModuleHandle(nullptr);
556 if (GetClassInfoEx(hInstance, view->world->className, &wClass))
557 wClass.hIcon = LoadIcon(nullptr, MAKEINTRESOURCE(DGL_WINDOWS_ICON_ID));
559 SetClassLongPtr(impl->hwnd, GCLP_HICON, (LONG_PTR) LoadIcon(hInstance, MAKEINTRESOURCE(DGL_WINDOWS_ICON_ID)));
560 #endif
562 MONITORINFO mInfo;
563 std::memset(&mInfo, 0, sizeof(mInfo));
564 mInfo.cbSize = sizeof(mInfo);
566 if (GetMonitorInfo(MonitorFromWindow(impl->hwnd, MONITOR_DEFAULTTOPRIMARY), &mInfo))
567 SetWindowPos(impl->hwnd,
568 HWND_TOP,
569 mInfo.rcWork.left + (mInfo.rcWork.right - mInfo.rcWork.left - view->frame.width) / 2,
570 mInfo.rcWork.top + (mInfo.rcWork.bottom - mInfo.rcWork.top - view->frame.height) / 2,
571 0, 0, SWP_SHOWWINDOW|SWP_NOSIZE);
572 else
573 ShowWindow(impl->hwnd, SW_NORMAL);
576 SetFocus(impl->hwnd);
579 // --------------------------------------------------------------------------------------------------------------------
581 #elif defined(DISTRHO_OS_WASM)
583 // nothing here yet
585 // --------------------------------------------------------------------------------------------------------------------
587 #elif defined(HAVE_X11)
589 PuglStatus puglX11UpdateWithoutExposures(PuglWorld* const world)
591 const bool wasDispatchingEvents = world->impl->dispatchingEvents;
592 world->impl->dispatchingEvents = true;
593 PuglStatus st = PUGL_SUCCESS;
595 const double startTime = puglGetTime(world);
596 const double endTime = startTime + 0.03;
598 for (double t = startTime; !st && t < endTime; t = puglGetTime(world))
600 pollX11Socket(world, endTime - t);
601 st = dispatchX11Events(world);
604 world->impl->dispatchingEvents = wasDispatchingEvents;
605 return st;
608 // --------------------------------------------------------------------------------------------------------------------
609 // X11 specific, set dialog window type and pid hints
611 void puglX11SetWindowTypeAndPID(const PuglView* const view, const bool isStandalone)
613 const PuglInternals* const impl = view->impl;
614 Display* const display = view->world->impl->display;
616 const pid_t pid = getpid();
617 const Atom _nwp = XInternAtom(display, "_NET_WM_PID", False);
618 XChangeProperty(display, impl->win, _nwp, XA_CARDINAL, 32, PropModeReplace, (const uchar*)&pid, 1);
620 const Atom _wt = XInternAtom(display, "_NET_WM_WINDOW_TYPE", False);
622 Atom _wts[2];
623 int numAtoms = 0;
625 if (! isStandalone)
626 _wts[numAtoms++] = XInternAtom(display, "_NET_WM_WINDOW_TYPE_DIALOG", False);
628 _wts[numAtoms++] = XInternAtom(display, "_NET_WM_WINDOW_TYPE_NORMAL", False);
630 XChangeProperty(display, impl->win, _wt, XA_ATOM, 32, PropModeReplace, (const uchar*)&_wts, numAtoms);
633 // --------------------------------------------------------------------------------------------------------------------
635 #endif // HAVE_X11
637 #ifndef DISTRHO_OS_MAC
638 END_NAMESPACE_DGL
639 #endif