Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

juce_linux_XEmbedComponent.cpp 23KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685
  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2017 - ROLI Ltd.
  5. JUCE is an open source library subject to commercial or open-source
  6. licensing.
  7. By using JUCE, you agree to the terms of both the JUCE 5 End-User License
  8. Agreement and JUCE 5 Privacy Policy (both updated and effective as of the
  9. 27th April 2017).
  10. End User License Agreement: www.juce.com/juce-5-licence
  11. Privacy Policy: www.juce.com/juce-5-privacy-policy
  12. Or: You may also use this code under the terms of the GPL v3 (see
  13. www.gnu.org/licenses).
  14. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  15. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  16. DISCLAIMED.
  17. ==============================================================================
  18. */
  19. namespace juce
  20. {
  21. bool juce_handleXEmbedEvent (ComponentPeer*, void*);
  22. Window juce_getCurrentFocusWindow (ComponentPeer*);
  23. //==============================================================================
  24. unsigned long juce_createKeyProxyWindow (ComponentPeer*);
  25. void juce_deleteKeyProxyWindow (ComponentPeer*);
  26. //==============================================================================
  27. class XEmbedComponent::Pimpl : private ComponentListener
  28. {
  29. public:
  30. enum
  31. {
  32. maxXEmbedVersionToSupport = 0
  33. };
  34. enum Flags
  35. {
  36. XEMBED_MAPPED = (1<<0)
  37. };
  38. enum
  39. {
  40. XEMBED_EMBEDDED_NOTIFY = 0,
  41. XEMBED_WINDOW_ACTIVATE = 1,
  42. XEMBED_WINDOW_DEACTIVATE = 2,
  43. XEMBED_REQUEST_FOCUS = 3,
  44. XEMBED_FOCUS_IN = 4,
  45. XEMBED_FOCUS_OUT = 5,
  46. XEMBED_FOCUS_NEXT = 6,
  47. XEMBED_FOCUS_PREV = 7,
  48. XEMBED_MODALITY_ON = 10,
  49. XEMBED_MODALITY_OFF = 11,
  50. XEMBED_REGISTER_ACCELERATOR = 12,
  51. XEMBED_UNREGISTER_ACCELERATOR = 13,
  52. XEMBED_ACTIVATE_ACCELERATOR = 14
  53. };
  54. enum
  55. {
  56. XEMBED_FOCUS_CURRENT = 0,
  57. XEMBED_FOCUS_FIRST = 1,
  58. XEMBED_FOCUS_LAST = 2
  59. };
  60. //==============================================================================
  61. class SharedKeyWindow : public ReferenceCountedObject
  62. {
  63. public:
  64. typedef ReferenceCountedObjectPtr<SharedKeyWindow> Ptr;
  65. //==============================================================================
  66. Window getHandle() { return keyProxy; }
  67. static Window getCurrentFocusWindow (ComponentPeer* peerToLookFor)
  68. {
  69. auto& keyWindows = getKeyWindows();
  70. if (peerToLookFor != nullptr)
  71. if (auto* foundKeyWindow = keyWindows[peerToLookFor])
  72. return foundKeyWindow->keyProxy;
  73. return {};
  74. }
  75. static SharedKeyWindow::Ptr getKeyWindowForPeer (ComponentPeer* peerToLookFor)
  76. {
  77. jassert (peerToLookFor != nullptr);
  78. auto& keyWindows = getKeyWindows();
  79. auto foundKeyWindow = keyWindows[peerToLookFor];
  80. if (foundKeyWindow == nullptr)
  81. {
  82. foundKeyWindow = new SharedKeyWindow (peerToLookFor);
  83. keyWindows.set (peerToLookFor, foundKeyWindow);
  84. }
  85. return foundKeyWindow;
  86. }
  87. private:
  88. //==============================================================================
  89. friend struct ContainerDeletePolicy<SharedKeyWindow>;
  90. SharedKeyWindow (ComponentPeer* peerToUse)
  91. : keyPeer (peerToUse),
  92. keyProxy (juce_createKeyProxyWindow (keyPeer))
  93. {}
  94. ~SharedKeyWindow()
  95. {
  96. juce_deleteKeyProxyWindow (keyPeer);
  97. auto& keyWindows = getKeyWindows();
  98. keyWindows.remove (keyPeer);
  99. }
  100. ComponentPeer* keyPeer;
  101. Window keyProxy;
  102. static HashMap<ComponentPeer*, SharedKeyWindow*>& getKeyWindows()
  103. {
  104. // store a weak reference to the shared key windows
  105. static HashMap<ComponentPeer*, SharedKeyWindow*> keyWindows;
  106. return keyWindows;
  107. }
  108. };
  109. public:
  110. //==============================================================================
  111. Pimpl (XEmbedComponent& parent, Window x11Window,
  112. bool wantsKeyboardFocus, bool isClientInitiated, bool shouldAllowResize)
  113. : owner (parent), atoms (x11display.display), clientInitiated (isClientInitiated),
  114. wantsFocus (wantsKeyboardFocus), allowResize (shouldAllowResize)
  115. {
  116. getWidgets().add (this);
  117. createHostWindow();
  118. if (clientInitiated)
  119. setClient (x11Window, true);
  120. owner.setWantsKeyboardFocus (wantsFocus);
  121. owner.addComponentListener (this);
  122. }
  123. ~Pimpl()
  124. {
  125. owner.removeComponentListener (this);
  126. setClient (0, true);
  127. if (host != 0)
  128. {
  129. auto dpy = getDisplay();
  130. XDestroyWindow (dpy, host);
  131. XSync (dpy, false);
  132. const long mask = NoEventMask | KeyPressMask | KeyReleaseMask
  133. | EnterWindowMask | LeaveWindowMask | PointerMotionMask
  134. | KeymapStateMask | ExposureMask | StructureNotifyMask
  135. | FocusChangeMask;
  136. XEvent event;
  137. while (XCheckWindowEvent (dpy, host, mask, &event) == True)
  138. {}
  139. host = 0;
  140. }
  141. getWidgets().removeAllInstancesOf (this);
  142. }
  143. //==============================================================================
  144. void setClient (Window xembedClient, bool shouldReparent)
  145. {
  146. removeClient();
  147. if (xembedClient != 0)
  148. {
  149. auto dpy = getDisplay();
  150. client = xembedClient;
  151. // if the client has initiated the component then keep the clients size
  152. // otherwise the client should use the host's window' size
  153. if (clientInitiated)
  154. {
  155. configureNotify();
  156. }
  157. else
  158. {
  159. auto newBounds = getX11BoundsFromJuce();
  160. XResizeWindow (dpy, client, static_cast<unsigned int> (newBounds.getWidth()),
  161. static_cast<unsigned int> (newBounds.getHeight()));
  162. }
  163. XSelectInput (dpy, client, StructureNotifyMask | PropertyChangeMask | FocusChangeMask);
  164. getXEmbedMappedFlag();
  165. if (shouldReparent)
  166. XReparentWindow (dpy, client, host, 0, 0);
  167. if (supportsXembed)
  168. sendXEmbedEvent (CurrentTime, XEMBED_EMBEDDED_NOTIFY, 0, (long) host, xembedVersion);
  169. updateMapping();
  170. }
  171. }
  172. void focusGained (FocusChangeType changeType)
  173. {
  174. if (client != 0 && supportsXembed && wantsFocus)
  175. {
  176. updateKeyFocus();
  177. sendXEmbedEvent (CurrentTime, XEMBED_FOCUS_IN,
  178. (changeType == focusChangedByTabKey ? XEMBED_FOCUS_FIRST : XEMBED_FOCUS_CURRENT));
  179. }
  180. }
  181. void focusLost (FocusChangeType)
  182. {
  183. if (client != 0 && supportsXembed && wantsFocus)
  184. {
  185. sendXEmbedEvent (CurrentTime, XEMBED_FOCUS_OUT);
  186. updateKeyFocus();
  187. }
  188. }
  189. void broughtToFront()
  190. {
  191. if (client != 0 && supportsXembed)
  192. sendXEmbedEvent (CurrentTime, XEMBED_WINDOW_ACTIVATE);
  193. }
  194. unsigned long getHostWindowID()
  195. {
  196. // You are using the client initiated version of the protocol. You cannot
  197. // retrieve the window id of the host. Please read the documentation for
  198. // the XEmebedComponent class.
  199. jassert (! clientInitiated);
  200. return host;
  201. }
  202. private:
  203. //==============================================================================
  204. XEmbedComponent& owner;
  205. Window client = 0, host = 0;
  206. ScopedXDisplay x11display;
  207. Atoms atoms;
  208. bool clientInitiated;
  209. bool wantsFocus = false;
  210. bool allowResize = false;
  211. bool supportsXembed = false;
  212. bool hasBeenMapped = false;
  213. int xembedVersion = maxXEmbedVersionToSupport;
  214. ComponentPeer* lastPeer = nullptr;
  215. SharedKeyWindow::Ptr keyWindow;
  216. //==============================================================================
  217. void componentParentHierarchyChanged (Component&) override { peerChanged (owner.getPeer()); }
  218. void componentMovedOrResized (Component&, bool, bool) override
  219. {
  220. if (host != 0 && lastPeer != nullptr)
  221. {
  222. auto dpy = getDisplay();
  223. auto newBounds = getX11BoundsFromJuce();
  224. XWindowAttributes attr;
  225. if (XGetWindowAttributes (dpy, host, &attr))
  226. {
  227. Rectangle<int> currentBounds (attr.x, attr.y, attr.width, attr.height);
  228. if (currentBounds != newBounds)
  229. {
  230. XMoveResizeWindow (dpy, host, newBounds.getX(), newBounds.getY(),
  231. static_cast<unsigned int> (newBounds.getWidth()),
  232. static_cast<unsigned int> (newBounds.getHeight()));
  233. }
  234. }
  235. if (client != 0 && XGetWindowAttributes (dpy, client, &attr))
  236. {
  237. Rectangle<int> currentBounds (attr.x, attr.y, attr.width, attr.height);
  238. if ((currentBounds.getWidth() != newBounds.getWidth()
  239. || currentBounds.getHeight() != newBounds.getHeight()))
  240. {
  241. XMoveResizeWindow (dpy, client, 0, 0,
  242. static_cast<unsigned int> (newBounds.getWidth()),
  243. static_cast<unsigned int> (newBounds.getHeight()));
  244. }
  245. }
  246. }
  247. }
  248. //==============================================================================
  249. void createHostWindow()
  250. {
  251. auto dpy = getDisplay();
  252. int defaultScreen = XDefaultScreen (dpy);
  253. Window root = RootWindow (dpy, defaultScreen);
  254. XSetWindowAttributes swa;
  255. swa.border_pixel = 0;
  256. swa.background_pixmap = None;
  257. swa.override_redirect = True;
  258. swa.event_mask = SubstructureNotifyMask | StructureNotifyMask | FocusChangeMask;
  259. host = XCreateWindow (dpy, root, 0, 0, 1, 1, 0, CopyFromParent,
  260. InputOutput, CopyFromParent,
  261. CWEventMask | CWBorderPixel | CWBackPixmap | CWOverrideRedirect,
  262. &swa);
  263. }
  264. void removeClient()
  265. {
  266. if (client != 0)
  267. {
  268. auto dpy = getDisplay();
  269. XSelectInput (dpy, client, 0);
  270. keyWindow = nullptr;
  271. int defaultScreen = XDefaultScreen (dpy);
  272. Window root = RootWindow (dpy, defaultScreen);
  273. if (hasBeenMapped)
  274. {
  275. XUnmapWindow (dpy, client);
  276. hasBeenMapped = false;
  277. }
  278. XReparentWindow (dpy, client, root, 0, 0);
  279. client = 0;
  280. }
  281. }
  282. void updateMapping()
  283. {
  284. if (client != 0)
  285. {
  286. const bool shouldBeMapped = getXEmbedMappedFlag();
  287. if (shouldBeMapped != hasBeenMapped)
  288. {
  289. hasBeenMapped = shouldBeMapped;
  290. if (shouldBeMapped)
  291. XMapWindow (getDisplay(), client);
  292. else
  293. XUnmapWindow (getDisplay(), client);
  294. }
  295. }
  296. }
  297. Window getParentX11Window()
  298. {
  299. if (auto peer = owner.getPeer())
  300. return reinterpret_cast<Window> (peer->getNativeHandle());
  301. return {};
  302. }
  303. Display* getDisplay() { return reinterpret_cast<Display*> (x11display.display); }
  304. //==============================================================================
  305. bool getXEmbedMappedFlag()
  306. {
  307. GetXProperty embedInfo (x11display.display, client, atoms.XembedInfo, 0, 2, false, atoms.XembedInfo);
  308. if (embedInfo.success && embedInfo.actualFormat == 32
  309. && embedInfo.numItems >= 2 && embedInfo.data != nullptr)
  310. {
  311. auto* buffer = (long*) embedInfo.data;
  312. supportsXembed = true;
  313. xembedVersion = jmin ((int) maxXEmbedVersionToSupport, (int) buffer[0]);
  314. return ((buffer[1] & XEMBED_MAPPED) != 0);
  315. }
  316. else
  317. {
  318. supportsXembed = false;
  319. xembedVersion = maxXEmbedVersionToSupport;
  320. }
  321. return true;
  322. }
  323. //==============================================================================
  324. void propertyChanged (const Atom& a)
  325. {
  326. if (a == atoms.XembedInfo)
  327. updateMapping();
  328. }
  329. void configureNotify()
  330. {
  331. XWindowAttributes attr;
  332. auto dpy = getDisplay();
  333. if (XGetWindowAttributes (dpy, client, &attr))
  334. {
  335. XWindowAttributes hostAttr;
  336. if (XGetWindowAttributes (dpy, host, &hostAttr))
  337. if (attr.width != hostAttr.width || attr.height != hostAttr.height)
  338. XResizeWindow (dpy, host, (unsigned int) attr.width, (unsigned int) attr.height);
  339. // as the client window is not on any screen yet, we need to guess
  340. // on which screen it might appear to get a scaling factor :-(
  341. auto& displays = Desktop::getInstance().getDisplays();
  342. auto* peer = owner.getPeer();
  343. const double scale = (peer != nullptr ? displays.getDisplayContaining (peer->getBounds().getCentre())
  344. : displays.getMainDisplay()).scale;
  345. Point<int> topLeftInPeer
  346. = (peer != nullptr ? peer->getComponent().getLocalPoint (&owner, Point<int> (0, 0))
  347. : owner.getBounds().getTopLeft());
  348. Rectangle<int> newBounds (topLeftInPeer.getX(), topLeftInPeer.getY(),
  349. static_cast<int> (static_cast<double> (attr.width) / scale),
  350. static_cast<int> (static_cast<double> (attr.height) / scale));
  351. if (peer != nullptr)
  352. newBounds = owner.getLocalArea (&peer->getComponent(), newBounds);
  353. jassert (newBounds.getX() == 0 && newBounds.getY() == 0);
  354. if (newBounds != owner.getLocalBounds())
  355. owner.setSize (newBounds.getWidth(), newBounds.getHeight());
  356. }
  357. }
  358. void peerChanged (ComponentPeer* newPeer)
  359. {
  360. if (newPeer != lastPeer)
  361. {
  362. if (lastPeer != nullptr)
  363. keyWindow = nullptr;
  364. auto dpy = getDisplay();
  365. Window rootWindow = RootWindow (dpy, DefaultScreen (dpy));
  366. Rectangle<int> newBounds = getX11BoundsFromJuce();
  367. if (newPeer == nullptr)
  368. XUnmapWindow (dpy, host);
  369. Window newParent = (newPeer != nullptr ? getParentX11Window() : rootWindow);
  370. XReparentWindow (dpy, host, newParent, newBounds.getX(), newBounds.getY());
  371. lastPeer = newPeer;
  372. if (newPeer != nullptr)
  373. {
  374. if (wantsFocus)
  375. {
  376. keyWindow = SharedKeyWindow::getKeyWindowForPeer (newPeer);
  377. updateKeyFocus();
  378. }
  379. componentMovedOrResized (owner, true, true);
  380. XMapWindow (dpy, host);
  381. broughtToFront();
  382. }
  383. }
  384. }
  385. void updateKeyFocus()
  386. {
  387. if (lastPeer != nullptr && lastPeer->isFocused())
  388. XSetInputFocus (getDisplay(), getCurrentFocusWindow (lastPeer), RevertToParent, CurrentTime);
  389. }
  390. //==============================================================================
  391. void handleXembedCmd (const ::Time& /*xTime*/, long opcode, long /*detail*/, long /*data1*/, long /*data2*/)
  392. {
  393. switch (opcode)
  394. {
  395. case XEMBED_REQUEST_FOCUS:
  396. if (wantsFocus)
  397. owner.grabKeyboardFocus();
  398. break;
  399. case XEMBED_FOCUS_NEXT:
  400. if (wantsFocus)
  401. owner.moveKeyboardFocusToSibling (true);
  402. break;
  403. case XEMBED_FOCUS_PREV:
  404. if (wantsFocus)
  405. owner.moveKeyboardFocusToSibling (false);
  406. break;
  407. }
  408. }
  409. bool handleX11Event (const XEvent& e)
  410. {
  411. if (e.xany.window == client && client != 0)
  412. {
  413. switch (e.type)
  414. {
  415. case PropertyNotify:
  416. propertyChanged (e.xproperty.atom);
  417. return true;
  418. case ConfigureNotify:
  419. if (allowResize)
  420. configureNotify();
  421. else
  422. MessageManager::callAsync([this] () {componentMovedOrResized (owner, true, true);});
  423. return true;
  424. }
  425. }
  426. else if (e.xany.window == host && host != 0)
  427. {
  428. switch (e.type)
  429. {
  430. case ReparentNotify:
  431. if (e.xreparent.parent == host && e.xreparent.window != client)
  432. {
  433. setClient (e.xreparent.window, false);
  434. return true;
  435. }
  436. break;
  437. case CreateNotify:
  438. if (e.xcreatewindow.parent != e.xcreatewindow.window && e.xcreatewindow.parent == host && e.xcreatewindow.window != client)
  439. {
  440. setClient (e.xcreatewindow.window, false);
  441. return true;
  442. }
  443. break;
  444. case GravityNotify:
  445. componentMovedOrResized (owner, true, true);
  446. return true;
  447. case ClientMessage:
  448. if (e.xclient.message_type == atoms.XembedMsgType && e.xclient.format == 32)
  449. {
  450. handleXembedCmd ((::Time) e.xclient.data.l[0], e.xclient.data.l[1],
  451. e.xclient.data.l[2], e.xclient.data.l[3],
  452. e.xclient.data.l[4]);
  453. return true;
  454. }
  455. break;
  456. }
  457. }
  458. return false;
  459. }
  460. void sendXEmbedEvent (const ::Time& xTime, long opcode,
  461. long opcodeMinor = 0, long data1 = 0, long data2 = 0)
  462. {
  463. XClientMessageEvent msg;
  464. auto dpy = getDisplay();
  465. ::memset (&msg, 0, sizeof (XClientMessageEvent));
  466. msg.window = client;
  467. msg.type = ClientMessage;
  468. msg.message_type = atoms.XembedMsgType;
  469. msg.format = 32;
  470. msg.data.l[0] = (long) xTime;
  471. msg.data.l[1] = opcode;
  472. msg.data.l[2] = opcodeMinor;
  473. msg.data.l[3] = data1;
  474. msg.data.l[4] = data2;
  475. XSendEvent (dpy, client, False, NoEventMask, (XEvent*) &msg);
  476. XSync (dpy, False);
  477. }
  478. Rectangle<int> getX11BoundsFromJuce()
  479. {
  480. if (auto* peer = owner.getPeer())
  481. {
  482. auto r = peer->getComponent().getLocalArea (&owner, owner.getLocalBounds());
  483. auto scale = Desktop::getInstance().getDisplays().getDisplayContaining (peer->localToGlobal (r.getCentre())).scale;
  484. return r * scale;
  485. }
  486. return owner.getLocalBounds();
  487. }
  488. //==============================================================================
  489. friend bool juce::juce_handleXEmbedEvent (ComponentPeer*, void*);
  490. friend unsigned long juce::juce_getCurrentFocusWindow (ComponentPeer*);
  491. static Array<Pimpl*>& getWidgets()
  492. {
  493. static Array<Pimpl*> i;
  494. return i;
  495. }
  496. static bool dispatchX11Event (ComponentPeer* p, const XEvent* eventArg)
  497. {
  498. if (eventArg != nullptr)
  499. {
  500. auto& e = *eventArg;
  501. if (auto w = e.xany.window)
  502. for (auto* widget : getWidgets())
  503. if (w == widget->host || w == widget->client)
  504. return widget->handleX11Event (e);
  505. }
  506. else
  507. {
  508. for (auto* widget : getWidgets())
  509. if (widget->owner.getPeer() == p)
  510. widget->peerChanged (nullptr);
  511. }
  512. return false;
  513. }
  514. static Window getCurrentFocusWindow (ComponentPeer* p)
  515. {
  516. if (p != nullptr)
  517. {
  518. for (auto* widget : getWidgets())
  519. if (widget->owner.getPeer() == p && widget->owner.hasKeyboardFocus (false))
  520. return widget->client;
  521. }
  522. return SharedKeyWindow::getCurrentFocusWindow (p);
  523. }
  524. };
  525. //==============================================================================
  526. XEmbedComponent::XEmbedComponent (bool wantsKeyboardFocus, bool allowForeignWidgetToResizeComponent)
  527. : pimpl (new Pimpl (*this, 0, wantsKeyboardFocus, false, allowForeignWidgetToResizeComponent))
  528. {
  529. setOpaque (true);
  530. }
  531. XEmbedComponent::XEmbedComponent (unsigned long wID, bool wantsKeyboardFocus, bool allowForeignWidgetToResizeComponent)
  532. : pimpl (new Pimpl (*this, wID, wantsKeyboardFocus, true, allowForeignWidgetToResizeComponent))
  533. {
  534. setOpaque (true);
  535. }
  536. XEmbedComponent::~XEmbedComponent() {}
  537. void XEmbedComponent::paint (Graphics& g)
  538. {
  539. g.fillAll (Colours::lightgrey);
  540. }
  541. void XEmbedComponent::focusGained (FocusChangeType changeType) { pimpl->focusGained (changeType); }
  542. void XEmbedComponent::focusLost (FocusChangeType changeType) { pimpl->focusLost (changeType); }
  543. void XEmbedComponent::broughtToFront() { pimpl->broughtToFront(); }
  544. unsigned long XEmbedComponent::getHostWindowID() { return pimpl->getHostWindowID(); }
  545. //==============================================================================
  546. bool juce_handleXEmbedEvent (ComponentPeer* p, void* e)
  547. {
  548. return XEmbedComponent::Pimpl::dispatchX11Event (p, reinterpret_cast<const XEvent*> (e));
  549. }
  550. unsigned long juce_getCurrentFocusWindow (ComponentPeer* peer)
  551. {
  552. return (unsigned long) XEmbedComponent::Pimpl::getCurrentFocusWindow (peer);
  553. }
  554. } // namespace juce