/
x11frame.cpp
770 lines (695 loc) · 20.8 KB
/
x11frame.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
// This file is part of VSTGUI. It is subject to the license terms
// in the LICENSE file found in the top-level directory of this
// distribution and at http://github.com/steinbergmedia/vstgui/LICENSE
#include "x11frame.h"
#include "x11dragging.h"
#include "x11utils.h"
#include "../../cbuttonstate.h"
#include "../../cframe.h"
#include "../../crect.h"
#include "../../dragging.h"
#include "../../vstkeycode.h"
#include "../../cinvalidrectlist.h"
#include "../iplatformopenglview.h"
#include "../iplatformviewlayer.h"
#include "../iplatformtextedit.h"
#include "../iplatformoptionmenu.h"
#include "../common/fileresourceinputstream.h"
#include "../common/generictextedit.h"
#include "../common/genericoptionmenu.h"
#include "cairobitmap.h"
#include "cairocontext.h"
#include "x11platform.h"
#include "x11utils.h"
#include <cassert>
#include <iostream>
#include <unordered_map>
#include <X11/Xlib.h>
#include <xcb/xcb.h>
#include <xcb/xcb_util.h>
#include <cairo/cairo-xcb.h>
#ifdef None
#undef None
#endif
//------------------------------------------------------------------------
namespace VSTGUI {
namespace X11 {
namespace {
//------------------------------------------------------------------------
inline CButtonState translateMouseButtons (xcb_button_t value)
{
switch (value)
{
case 1:
return kLButton;
case 2:
return kMButton;
case 3:
return kRButton;
}
return 0;
}
//------------------------------------------------------------------------
inline CButtonState translateMouseButtons (int state)
{
CButtonState buttons = 0;
if (state & XCB_BUTTON_MASK_1)
buttons |= kLButton;
if (state & XCB_BUTTON_MASK_2)
buttons |= kRButton;
if (state & XCB_BUTTON_MASK_3)
buttons |= kMButton;
return buttons;
}
//------------------------------------------------------------------------
inline uint32_t translateModifiers (int state)
{
uint32_t buttons = 0;
if (state & XCB_MOD_MASK_CONTROL)
buttons |= kControl;
if (state & XCB_MOD_MASK_SHIFT)
buttons |= kShift;
if (state & (XCB_MOD_MASK_1 | XCB_MOD_MASK_5))
buttons |= kAlt;
return buttons;
}
//------------------------------------------------------------------------
} // anonymous
//------------------------------------------------------------------------
struct RedrawTimerHandler
: ITimerHandler
, NonAtomicReferenceCounted
{
using RedrawCallback = std::function<void ()>;
RedrawTimerHandler (uint64_t delay, RedrawCallback&& redrawCallback)
: redrawCallback (std::move (redrawCallback))
{
RunLoop::instance ().get ()->registerTimer (delay, this);
}
~RedrawTimerHandler () noexcept { RunLoop::instance ().get ()->unregisterTimer (this); }
void onTimer () override
{
SharedPointer<RedrawTimerHandler> Self (this);
Self->redrawCallback ();
}
RedrawCallback redrawCallback;
};
//------------------------------------------------------------------------
struct DrawHandler
{
DrawHandler (const ChildWindow& window)
{
auto s = cairo_xcb_surface_create (RunLoop::instance ().getXcbConnection (),
window.getID (), window.getVisual (),
window.getSize ().x, window.getSize ().y);
windowSurface.assign (s);
onSizeChanged (window.getSize ());
device = cairo_device_reference (cairo_surface_get_device (s));
}
~DrawHandler ()
{
cairo_device_destroy (device);
}
void onSizeChanged (const CPoint& size)
{
cairo_xcb_surface_set_size (windowSurface, size.x, size.y);
backBuffer = Cairo::SurfaceHandle (cairo_surface_create_similar (
windowSurface, CAIRO_CONTENT_COLOR_ALPHA, size.x, size.y));
CRect r;
r.setSize (size);
drawContext = makeOwned<Cairo::Context> (r, backBuffer);
}
template<typename RectList, typename Proc>
void draw (const RectList& dirtyRects, Proc proc)
{
CRect copyRect;
drawContext->beginDraw ();
for (auto rect : dirtyRects)
{
drawContext->setClipRect (rect);
drawContext->saveGlobalState ();
proc (drawContext, rect);
drawContext->restoreGlobalState ();
if (copyRect.isEmpty ())
copyRect = rect;
else
copyRect.unite (rect);
}
drawContext->endDraw ();
blitBackbufferToWindow (copyRect);
xcb_flush (RunLoop::instance ().getXcbConnection ());
}
private:
cairo_device_t* device = nullptr;
Cairo::SurfaceHandle windowSurface;
Cairo::SurfaceHandle backBuffer;
SharedPointer<Cairo::Context> drawContext;
void blitBackbufferToWindow (const CRect& rect)
{
Cairo::ContextHandle windowContext (cairo_create (windowSurface));
cairo_rectangle (windowContext, rect.left, rect.top, rect.getWidth (), rect.getHeight ());
cairo_clip (windowContext);
cairo_set_source_surface (windowContext, backBuffer, 0, 0);
cairo_rectangle (windowContext, rect.left, rect.top, rect.getWidth (), rect.getHeight ());
cairo_fill (windowContext);
cairo_surface_flush (windowSurface);
}
};
//------------------------------------------------------------------------
struct DoubleClickDetector
{
void onMouseDown (CPoint where, CButtonState& buttons, xcb_timestamp_t time)
{
switch (state)
{
case State::MouseDown:
case State::Uninitialized:
{
state = State::MouseDown;
firstClickState = buttons;
firstClickTime = time;
point = where;
break;
}
case State::MouseUp:
{
if (timeInside (time) && pointInside (where))
{
buttons |= kDoubleClick;
}
state = State::Uninitialized;
break;
}
}
}
void onMouseUp (CPoint where, CButtonState buttons, xcb_timestamp_t time)
{
if (state == State::MouseDown && pointInside (where))
state = State::MouseUp;
else
state = State::Uninitialized;
}
void onMouseMove (CPoint where, CButtonState buttons, xcb_timestamp_t time)
{
if (!pointInside (where))
state = State::Uninitialized;
}
private:
bool timeInside (xcb_timestamp_t time)
{
constexpr xcb_timestamp_t threshold = 250; // in milliseconds
return (time - firstClickTime) < threshold;
}
bool pointInside (CPoint p) const
{
CRect r;
r.setTopLeft (point);
r.setBottomRight (point);
r.inset (-5, -5);
return r.pointInside (p);
}
enum class State
{
Uninitialized,
MouseDown,
MouseUp,
};
State state {State::Uninitialized};
CPoint point;
CButtonState firstClickState;
xcb_timestamp_t firstClickTime {0};
};
//------------------------------------------------------------------------
struct Frame::Impl : IFrameEventHandler
{
using RectList = CInvalidRectList;
ChildWindow window;
DrawHandler drawHandler;
DoubleClickDetector doubleClickDetector;
IPlatformFrameCallback* frame;
std::unique_ptr<GenericOptionMenuTheme> genericOptionMenuTheme;
SharedPointer<RedrawTimerHandler> redrawTimer;
RectList dirtyRects;
CCursorType currentCursor {kCursorDefault};
uint32_t pointerGrabed {0};
XdndHandler dndHandler;
//------------------------------------------------------------------------
Impl (::Window parent, CPoint size, IPlatformFrameCallback* frame)
: window (parent, size), drawHandler (window), frame (frame), dndHandler (&window, frame)
{
RunLoop::instance ().registerWindowEventHandler (window.getID (), this);
}
//------------------------------------------------------------------------
~Impl () noexcept { RunLoop::instance ().unregisterWindowEventHandler (window.getID ()); }
//------------------------------------------------------------------------
void setSize (const CRect& size)
{
window.setSize (size);
drawHandler.onSizeChanged (size.getSize ());
dirtyRects.clear ();
dirtyRects.add (size);
}
//------------------------------------------------------------------------
void setCursor (CCursorType cursor)
{
if (currentCursor == cursor)
return;
currentCursor = cursor;
setCursorInternal (cursor);
}
//------------------------------------------------------------------------
void setCursorInternal (CCursorType cursor)
{
auto xcb = RunLoop::instance ().getXcbConnection ();
xcb_params_cw_t params;
params.cursor = RunLoop::instance ().getCursorID (cursor);
xcb_aux_change_window_attributes (xcb, window.getID (), XCB_CW_CURSOR, ¶ms);
xcb_aux_sync (xcb);
xcb_flush (xcb);
}
//------------------------------------------------------------------------
void redraw ()
{
drawHandler.draw (dirtyRects, [&] (CDrawContext* context, const CRect& rect) {
frame->platformDrawRect (context, rect);
});
dirtyRects.clear ();
}
//------------------------------------------------------------------------
void invalidRect (CRect r)
{
dirtyRects.add (r);
if (redrawTimer)
return;
redrawTimer = makeOwned<RedrawTimerHandler> (16, [this] () {
if (dirtyRects.data ().empty ())
return;
redraw ();
});
}
//------------------------------------------------------------------------
void grabPointer ()
{
if (++pointerGrabed > 1)
return;
auto xcb = RunLoop::instance ().getXcbConnection ();
auto cookie =
xcb_grab_pointer (xcb, false, window.getID (),
(XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE |
XCB_EVENT_MASK_BUTTON_MOTION | XCB_EVENT_MASK_ENTER_WINDOW |
XCB_EVENT_MASK_LEAVE_WINDOW | XCB_EVENT_MASK_POINTER_MOTION),
XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC, XCB_WINDOW_NONE,
XCB_CURSOR_NONE, XCB_TIME_CURRENT_TIME);
if (auto reply = xcb_grab_pointer_reply (xcb, cookie, nullptr))
{
if (reply->status != XCB_GRAB_STATUS_SUCCESS)
pointerGrabed = 0;
free (reply);
}
}
//------------------------------------------------------------------------
void ungrabPointer ()
{
if (pointerGrabed == 0)
return;
if (--pointerGrabed > 0)
return;
vstgui_assert (pointerGrabed == 0);
auto xcb = RunLoop::instance ().getXcbConnection ();
xcb_ungrab_pointer (xcb, XCB_TIME_CURRENT_TIME);
}
//------------------------------------------------------------------------
void onEvent (xcb_map_notify_event_t& event) override {}
//------------------------------------------------------------------------
void onEvent (xcb_key_press_event_t& event) override
{
auto type = (event.response_type & ~0x80);
auto keyCode = RunLoop::instance ().getCurrentKeyEvent ();
if (type == XCB_KEY_PRESS)
{
frame->platformOnKeyDown (keyCode);
}
else
{
frame->platformOnKeyUp (keyCode);
}
}
//------------------------------------------------------------------------
void onEvent (xcb_button_press_event_t& event) override
{
CPoint where (event.event_x, event.event_y);
if ((event.response_type & ~0x80) == XCB_BUTTON_PRESS) // mouse down or wheel
{
if (event.detail >= 4 && event.detail <= 7) // mouse wheel
{
auto buttons = translateModifiers (event.state);
switch (event.detail)
{
case 4: // up
{
frame->platformOnMouseWheel (where, kMouseWheelAxisY, 1, buttons);
break;
}
case 5: // down
{
frame->platformOnMouseWheel (where, kMouseWheelAxisY, -1, buttons);
break;
}
case 6: // left
{
frame->platformOnMouseWheel (where, kMouseWheelAxisX, -1, buttons);
break;
}
case 7: // right
{
frame->platformOnMouseWheel (where, kMouseWheelAxisX, 1, buttons);
break;
}
}
}
else // mouse down
{
auto buttons = translateMouseButtons (event.detail);
buttons |= translateModifiers (event.state);
doubleClickDetector.onMouseDown (where, buttons, event.time);
auto result = frame->platformOnMouseDown (where, buttons);
grabPointer ();
if (result != kMouseEventNotHandled)
{
auto xcb = RunLoop::instance ().getXcbConnection ();
xcb_set_input_focus (xcb, XCB_INPUT_FOCUS_PARENT, window.getID (),
XCB_CURRENT_TIME);
}
}
}
else // mouse up
{
if (event.detail >= 4 && event.detail <= 7) // mouse wheel
{
}
else
{
auto buttons = translateMouseButtons (event.detail);
buttons |= translateModifiers (event.state);
doubleClickDetector.onMouseUp (where, buttons, event.time);
frame->platformOnMouseUp (where, buttons);
ungrabPointer ();
}
}
}
//------------------------------------------------------------------------
void onEvent (xcb_motion_notify_event_t& event) override
{
CPoint where (event.event_x, event.event_y);
auto buttons = translateMouseButtons (event.state);
buttons |= translateModifiers (event.state);
doubleClickDetector.onMouseMove (where, buttons, event.time);
frame->platformOnMouseMoved (where, buttons);
// make sure we get more motion events
auto xcb = RunLoop::instance ().getXcbConnection ();
xcb_get_motion_events (xcb, window.getID (), event.time, event.time + 10000000);
}
//------------------------------------------------------------------------
void onEvent (xcb_enter_notify_event_t& event) override
{
if ((event.response_type & ~0x80) == XCB_LEAVE_NOTIFY)
{
CPoint where (event.event_x, event.event_y);
auto buttons = translateMouseButtons (event.state);
buttons |= translateModifiers (event.state);
frame->platformOnMouseExited (where, buttons);
setCursorInternal (kCursorDefault);
}
else
{
setCursorInternal (currentCursor);
}
}
//------------------------------------------------------------------------
void onEvent (xcb_focus_in_event_t& event) override {}
//------------------------------------------------------------------------
void onEvent (xcb_expose_event_t& event) override
{
CRect r;
r.setTopLeft (CPoint (event.x, event.y));
r.setSize (CPoint (event.width, event.height));
invalidRect (r);
}
//------------------------------------------------------------------------
void onEvent (xcb_property_notify_event_t& event) override
{
#if 1 // needed for Reaper
if (Atoms::xEmbedInfo.valid () && event.atom == Atoms::xEmbedInfo ())
{
auto xcb = RunLoop::instance ().getXcbConnection ();
xcb_map_window (xcb, window.getID ());
}
#endif
}
void onEvent (xcb_selection_notify_event_t& event) override
{
dndHandler.selectionNotify (event);
}
//------------------------------------------------------------------------
void onEvent (xcb_client_message_event_t& event, xcb_window_t proxyId = 0) override
{
if (Atoms::xEmbed.valid () && event.type == Atoms::xEmbed ())
{
switch (static_cast<XEMBED> (event.data.data32[1]))
{
case XEMBED::EMBEDDED_NOTIFY:
{
auto xcb = RunLoop::instance ().getXcbConnection ();
xcb_map_window (xcb, window.getID ());
break;
}
case XEMBED::WINDOW_ACTIVATE:
{
frame->platformOnWindowActivate (true);
break;
}
case XEMBED::WINDOW_DEACTIVATE:
{
frame->platformOnWindowActivate (false);
break;
}
case XEMBED::FOCUS_IN:
{
frame->platformOnActivate (true);
break;
}
case XEMBED::FOCUS_OUT:
{
frame->platformOnActivate (false);
break;
}
case XEMBED::FOCUS_NEXT:
{
// we could send a tab keycode here...
break;
}
case XEMBED::FOCUS_PREV:
{
// we could send a shift-tab keycode here...
break;
}
case XEMBED::MODALITY_ON:
case XEMBED::MODALITY_OFF:
case XEMBED::REGISTER_ACCELERATOR:
case XEMBED::UNREGISTER_ACCELERATOR:
case XEMBED::ACTIVATE_ACCELERATOR:
case XEMBED::REQUEST_FOCUS:
break;
}
}
else if (Atoms::xDndEnter.valid () && event.type == Atoms::xDndEnter ())
{
dndHandler.enter (event, proxyId ? proxyId : window.getID ());
}
else if (Atoms::xDndPosition.valid () && event.type == Atoms::xDndPosition ())
{
dndHandler.position (event);
}
else if (Atoms::xDndLeave.valid () && event.type == Atoms::xDndLeave ())
{
dndHandler.leave (event);
}
else if (Atoms::xDndDrop.valid () && event.type == Atoms::xDndDrop ())
{
dndHandler.drop (event);
}
}
};
//------------------------------------------------------------------------
Frame::Frame (IPlatformFrameCallback* frame, const CRect& size, uint32_t parent,
IPlatformFrameConfig* config)
: IPlatformFrame (frame)
{
auto cfg = dynamic_cast<FrameConfig*> (config);
if (cfg && cfg->runLoop)
{
RunLoop::init (cfg->runLoop);
}
impl = std::unique_ptr<Impl> (new Impl (parent, {size.getWidth (), size.getHeight ()}, frame));
frame->platformOnActivate (true);
}
//------------------------------------------------------------------------
Frame::~Frame ()
{
impl.reset ();
RunLoop::exit ();
}
//------------------------------------------------------------------------
void Frame::optionMenuPopupStarted ()
{
impl->grabPointer ();
}
//------------------------------------------------------------------------
void Frame::optionMenuPopupStopped ()
{
impl->ungrabPointer ();
}
//------------------------------------------------------------------------
bool Frame::getGlobalPosition (CPoint& pos) const
{
return false;
}
//------------------------------------------------------------------------
bool Frame::setSize (const CRect& newSize)
{
vstgui_assert (impl);
impl->setSize (newSize);
return true;
}
//------------------------------------------------------------------------
bool Frame::getSize (CRect& size) const
{
size.setSize (impl->window.getSize ());
return true;
}
//------------------------------------------------------------------------
bool Frame::getCurrentMousePosition (CPoint& mousePosition) const
{
xcb_query_pointer_cookie_t cookie =
xcb_query_pointer (RunLoop::instance ().getXcbConnection (), getX11WindowID ());
xcb_query_pointer_reply_t* reply =
xcb_query_pointer_reply (RunLoop::instance ().getXcbConnection (), cookie, nullptr);
if (!reply)
return false;
mousePosition.x = reply->win_x;
mousePosition.y = reply->win_y;
return true;
}
//------------------------------------------------------------------------
bool Frame::getCurrentMouseButtons (CButtonState& buttons) const
{
return false;
}
//------------------------------------------------------------------------
bool Frame::setMouseCursor (CCursorType type)
{
impl->setCursor (type);
return true;
}
//------------------------------------------------------------------------
bool Frame::invalidRect (const CRect& rect)
{
impl->invalidRect (rect);
return true;
}
//------------------------------------------------------------------------
bool Frame::scrollRect (const CRect& src, const CPoint& distance)
{
(void)src;
(void)distance;
return false;
}
//------------------------------------------------------------------------
bool Frame::showTooltip (const CRect& rect, const char* utf8Text)
{
#warning TODO: Implementation
return false;
}
//------------------------------------------------------------------------
bool Frame::hideTooltip ()
{
#warning TODO: Implementation
return false;
}
//------------------------------------------------------------------------
void* Frame::getPlatformRepresentation () const
{
return reinterpret_cast<void*> (getX11WindowID ());
}
//------------------------------------------------------------------------
uint32_t Frame::getX11WindowID () const
{
return impl->window.getID ();
}
//------------------------------------------------------------------------
SharedPointer<IPlatformTextEdit> Frame::createPlatformTextEdit (IPlatformTextEditCallback* textEdit)
{
return makeOwned<GenericTextEdit> (textEdit);
}
//------------------------------------------------------------------------
SharedPointer<IPlatformOptionMenu> Frame::createPlatformOptionMenu ()
{
auto cFrame = dynamic_cast<CFrame*> (frame);
GenericOptionMenuTheme theme;
if (impl->genericOptionMenuTheme)
theme = *impl->genericOptionMenuTheme.get ();
auto optionMenu = makeOwned<GenericOptionMenu> (cFrame, 0, theme);
optionMenu->setListener (this);
return optionMenu;
}
#if VSTGUI_OPENGL_SUPPORT
//------------------------------------------------------------------------
SharedPointer<IPlatformOpenGLView> Frame::createPlatformOpenGLView ()
{
#warning TODO: Implementation
return nullptr;
}
#endif
//------------------------------------------------------------------------
SharedPointer<IPlatformViewLayer> Frame::createPlatformViewLayer (
IPlatformViewLayerDelegate* drawDelegate, IPlatformViewLayer* parentLayer)
{
// optional
return nullptr;
}
#if VSTGUI_ENABLE_DEPRECATED_METHODS
//------------------------------------------------------------------------
DragResult Frame::doDrag (IDataPackage* source, const CPoint& offset, CBitmap* dragBitmap)
{
return kDragError;
}
#endif
//------------------------------------------------------------------------
bool Frame::doDrag (const DragDescription& dragDescription,
const SharedPointer<IDragCallback>& callback)
{
return false;
}
//------------------------------------------------------------------------
PlatformType Frame::getPlatformType () const
{
return PlatformType::kX11EmbedWindowID;
}
//------------------------------------------------------------------------
Optional<UTF8String> Frame::convertCurrentKeyEventToText ()
{
return RunLoop::instance ().convertCurrentKeyEventToText ();
}
//------------------------------------------------------------------------
bool Frame::setupGenericOptionMenu (bool use, GenericOptionMenuTheme* theme)
{
if (theme)
impl->genericOptionMenuTheme =
std::unique_ptr<GenericOptionMenuTheme> (new GenericOptionMenuTheme (*theme));
else
impl->genericOptionMenuTheme = nullptr;
return true;
}
//------------------------------------------------------------------------
} // X11
} // VSTGUI