The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
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.

750 lines
25KB

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