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.

756 lines
26KB

  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,
  169. bool wantsKeyboardFocus, bool isClientInitiated, bool shouldAllowResize)
  170. : owner (parent), atoms (x11display.get()), clientInitiated (isClientInitiated),
  171. wantsFocus (wantsKeyboardFocus), allowResize (shouldAllowResize)
  172. {
  173. if (widgets == nullptr)
  174. widgets = new Array<Pimpl*>;
  175. widgets->add (this);
  176. createHostWindow();
  177. if (clientInitiated)
  178. setClient (x11Window, true);
  179. owner.setWantsKeyboardFocus (wantsFocus);
  180. owner.addComponentListener (this);
  181. }
  182. ~Pimpl()
  183. {
  184. owner.removeComponentListener (this);
  185. setClient (0, true);
  186. if (host != 0)
  187. {
  188. Display* dpy = getDisplay();
  189. XDestroyWindow (dpy, host);
  190. XSync (dpy, false);
  191. const long mask = NoEventMask | KeyPressMask | KeyReleaseMask
  192. | EnterWindowMask | LeaveWindowMask | PointerMotionMask
  193. | KeymapStateMask | ExposureMask | StructureNotifyMask
  194. | FocusChangeMask;
  195. XEvent event;
  196. while (XCheckWindowEvent (dpy, host, mask, &event) == True)
  197. {}
  198. host = 0;
  199. }
  200. if (widgets != nullptr)
  201. {
  202. widgets->removeAllInstancesOf (this);
  203. if (widgets->size() == 0)
  204. {
  205. delete widgets;
  206. widgets = nullptr;
  207. }
  208. }
  209. }
  210. //==============================================================================
  211. void setClient (Window xembedClient, bool shouldReparent)
  212. {
  213. removeClient();
  214. if (xembedClient != 0)
  215. {
  216. Display* dpy = getDisplay();
  217. client = xembedClient;
  218. // if the client has initiated the component then keep the clients size
  219. // otherwise the client should use the host's window' size
  220. if (clientInitiated)
  221. {
  222. configureNotify();
  223. }
  224. else
  225. {
  226. Rectangle<int> newBounds = getX11BoundsFromJuce();
  227. XResizeWindow (dpy, client, static_cast<unsigned int> (newBounds.getWidth()),
  228. static_cast<unsigned int> (newBounds.getHeight()));
  229. }
  230. XSelectInput (dpy, client, StructureNotifyMask | PropertyChangeMask | FocusChangeMask);
  231. getXEmbedMappedFlag();
  232. if (shouldReparent)
  233. XReparentWindow (dpy, client, host, 0, 0);
  234. if (supportsXembed)
  235. sendXEmbedEvent (CurrentTime, XEMBED_EMBEDDED_NOTIFY, 0, (long) host, xembedVersion);
  236. updateMapping();
  237. }
  238. }
  239. void focusGained (FocusChangeType changeType)
  240. {
  241. if (client != 0 && supportsXembed && wantsFocus)
  242. {
  243. updateKeyFocus();
  244. sendXEmbedEvent (CurrentTime, XEMBED_FOCUS_IN,
  245. (changeType == focusChangedByTabKey ? XEMBED_FOCUS_FIRST : XEMBED_FOCUS_CURRENT));
  246. }
  247. }
  248. void focusLost (FocusChangeType)
  249. {
  250. if (client != 0 && supportsXembed && wantsFocus)
  251. {
  252. sendXEmbedEvent (CurrentTime, XEMBED_FOCUS_OUT);
  253. updateKeyFocus();
  254. }
  255. }
  256. void broughtToFront()
  257. {
  258. if (client != 0 && supportsXembed)
  259. sendXEmbedEvent (CurrentTime, XEMBED_WINDOW_ACTIVATE);
  260. }
  261. unsigned long getHostWindowID()
  262. {
  263. // You are using the client initiated version of the protocol. You cannot
  264. // retrieve the window id of the host. Please read the documentation for
  265. // the XEmebedComponent class.
  266. jassert (! clientInitiated);
  267. return host;
  268. }
  269. private:
  270. //==============================================================================
  271. XEmbedComponent& owner;
  272. Window client = 0, host = 0;
  273. ScopedXDisplay x11display;
  274. Atoms atoms;
  275. bool clientInitiated;
  276. bool wantsFocus = false;
  277. bool allowResize = false;
  278. bool supportsXembed = false;
  279. bool hasBeenMapped = false;
  280. int xembedVersion = maxXEmbedVersionToSupport;
  281. ComponentPeer* lastPeer = nullptr;
  282. SharedKeyWindow::Ref keyWindow;
  283. //==============================================================================
  284. void componentParentHierarchyChanged (Component&) override { peerChanged (owner.getPeer()); }
  285. void componentMovedOrResized (Component&, bool, bool) override
  286. {
  287. if (host != 0 && lastPeer != nullptr)
  288. {
  289. Display* dpy = getDisplay();
  290. Rectangle<int> newBounds = getX11BoundsFromJuce();
  291. XWindowAttributes attr;
  292. if (XGetWindowAttributes (dpy, host, &attr))
  293. {
  294. Rectangle<int> currentBounds (attr.x, attr.y, attr.width, attr.height);
  295. if (currentBounds != newBounds)
  296. {
  297. XMoveResizeWindow (dpy, host, newBounds.getX(), newBounds.getY(),
  298. static_cast<unsigned int> (newBounds.getWidth()),
  299. static_cast<unsigned int> (newBounds.getHeight()));
  300. if (client != 0 && (currentBounds.getWidth() != newBounds.getWidth()
  301. || currentBounds.getHeight() != newBounds.getHeight()))
  302. XResizeWindow (dpy, client,
  303. static_cast<unsigned int> (newBounds.getWidth()),
  304. static_cast<unsigned int> (newBounds.getHeight()));
  305. }
  306. }
  307. }
  308. }
  309. //==============================================================================
  310. void createHostWindow()
  311. {
  312. Display* dpy = getDisplay();
  313. int defaultScreen = XDefaultScreen (dpy);
  314. Window root = RootWindow (dpy, defaultScreen);
  315. XSetWindowAttributes swa;
  316. swa.border_pixel = 0;
  317. swa.background_pixmap = None;
  318. swa.override_redirect = True;
  319. swa.event_mask = SubstructureNotifyMask | StructureNotifyMask | FocusChangeMask;
  320. host = XCreateWindow (dpy, root, 0, 0, 1, 1, 0, CopyFromParent,
  321. InputOutput, CopyFromParent,
  322. CWEventMask | CWBorderPixel | CWBackPixmap | CWOverrideRedirect,
  323. &swa);
  324. }
  325. void removeClient()
  326. {
  327. if (client != 0)
  328. {
  329. Display* dpy = getDisplay();
  330. XSelectInput (dpy, client, 0);
  331. keyWindow = nullptr;
  332. int defaultScreen = XDefaultScreen (dpy);
  333. Window root = RootWindow (dpy, defaultScreen);
  334. if (hasBeenMapped)
  335. {
  336. XUnmapWindow (dpy, client);
  337. hasBeenMapped = false;
  338. }
  339. XReparentWindow (dpy, client, root, 0, 0);
  340. client = 0;
  341. }
  342. }
  343. void updateMapping()
  344. {
  345. if (client != 0)
  346. {
  347. const bool shouldBeMapped = getXEmbedMappedFlag();
  348. if (shouldBeMapped != hasBeenMapped)
  349. {
  350. hasBeenMapped = shouldBeMapped;
  351. if (shouldBeMapped)
  352. XMapWindow (getDisplay(), client);
  353. else
  354. XUnmapWindow (getDisplay(), client);
  355. }
  356. }
  357. }
  358. Window getParentX11Window()
  359. {
  360. if (ComponentPeer* peer = owner.getPeer())
  361. return reinterpret_cast<Window> (peer->getNativeHandle());
  362. return 0;
  363. }
  364. Display* getDisplay() { return reinterpret_cast<Display*> (x11display.get()); }
  365. //==============================================================================
  366. bool getXEmbedMappedFlag()
  367. {
  368. GetXProperty embedInfo (x11display.get(), client, atoms.XembedInfo, 0, 2, false, atoms.XembedInfo);
  369. if (embedInfo.success && embedInfo.actualFormat == 32
  370. && embedInfo.numItems >= 2 && embedInfo.data != nullptr)
  371. {
  372. long* buffer = (long*) embedInfo.data;
  373. supportsXembed = true;
  374. xembedVersion = jmin ((int) maxXEmbedVersionToSupport, (int) buffer[0]);
  375. return ((buffer[1] & XEMBED_MAPPED) != 0);
  376. }
  377. else
  378. {
  379. supportsXembed = false;
  380. xembedVersion = maxXEmbedVersionToSupport;
  381. }
  382. return true;
  383. }
  384. //==============================================================================
  385. void propertyChanged (const Atom& a)
  386. {
  387. if (a == atoms.XembedInfo)
  388. updateMapping();
  389. }
  390. void configureNotify()
  391. {
  392. XWindowAttributes attr;
  393. Display* dpy = getDisplay();
  394. if (XGetWindowAttributes (dpy, client, &attr))
  395. {
  396. XWindowAttributes hostAttr;
  397. if (XGetWindowAttributes (dpy, host, &hostAttr))
  398. if (attr.width != hostAttr.width || attr.height != hostAttr.height)
  399. XResizeWindow (dpy, host, (unsigned int) attr.width, (unsigned int) attr.height);
  400. // as the client window is not on any screen yet, we need to guess
  401. // on which screen it might appear to get a scaling factor :-(
  402. const Desktop::Displays& displays = Desktop::getInstance().getDisplays();
  403. ComponentPeer* peer = owner.getPeer();
  404. const double scale = (peer != nullptr ? displays.getDisplayContaining (peer->getBounds().getCentre())
  405. : displays.getMainDisplay()).scale;
  406. Point<int> topLeftInPeer
  407. = (peer != nullptr ? peer->getComponent().getLocalPoint (&owner, Point<int> (0, 0))
  408. : owner.getBounds().getTopLeft());
  409. Rectangle<int> newBounds (topLeftInPeer.getX(), topLeftInPeer.getY(),
  410. static_cast<int> (static_cast<double> (attr.width) / scale),
  411. static_cast<int> (static_cast<double> (attr.height) / scale));
  412. if (peer != nullptr)
  413. newBounds = owner.getLocalArea (&peer->getComponent(), newBounds);
  414. jassert (newBounds.getX() == 0 && newBounds.getY() == 0);
  415. if (newBounds != owner.getLocalBounds())
  416. owner.setSize (newBounds.getWidth(), newBounds.getHeight());
  417. }
  418. }
  419. void peerChanged (ComponentPeer* newPeer)
  420. {
  421. if (newPeer != lastPeer)
  422. {
  423. if (lastPeer != nullptr)
  424. keyWindow = nullptr;
  425. Display* dpy = getDisplay();
  426. Window rootWindow = RootWindow (dpy, DefaultScreen (dpy));
  427. Rectangle<int> newBounds = getX11BoundsFromJuce();
  428. if (newPeer == nullptr)
  429. XUnmapWindow (dpy, host);
  430. Window newParent = (newPeer != nullptr ? getParentX11Window() : rootWindow);
  431. XReparentWindow (dpy, host, newParent, newBounds.getX(), newBounds.getY());
  432. lastPeer = newPeer;
  433. if (newPeer != nullptr)
  434. {
  435. if (wantsFocus)
  436. {
  437. keyWindow = SharedKeyWindow::Ref (*this);
  438. updateKeyFocus();
  439. }
  440. componentMovedOrResized (owner, true, true);
  441. XMapWindow (dpy, host);
  442. broughtToFront();
  443. }
  444. }
  445. }
  446. void updateKeyFocus()
  447. {
  448. if (lastPeer != nullptr && lastPeer->isFocused())
  449. XSetInputFocus (getDisplay(), getCurrentFocusWindow (lastPeer), RevertToParent, CurrentTime);
  450. }
  451. //==============================================================================
  452. void handleXembedCmd (const ::Time& /*xTime*/, long opcode, long /*detail*/, long /*data1*/, long /*data2*/)
  453. {
  454. switch (opcode)
  455. {
  456. case XEMBED_REQUEST_FOCUS:
  457. if (wantsFocus)
  458. owner.grabKeyboardFocus();
  459. break;
  460. case XEMBED_FOCUS_NEXT:
  461. if (wantsFocus)
  462. owner.moveKeyboardFocusToSibling (true);
  463. break;
  464. case XEMBED_FOCUS_PREV:
  465. if (wantsFocus)
  466. owner.moveKeyboardFocusToSibling (false);
  467. break;
  468. }
  469. }
  470. bool handleX11Event (const XEvent& e)
  471. {
  472. if (e.xany.window == client && client != 0)
  473. {
  474. switch (e.type)
  475. {
  476. case PropertyNotify:
  477. propertyChanged (e.xproperty.atom);
  478. return true;
  479. case ConfigureNotify:
  480. if (allowResize)
  481. configureNotify();
  482. else
  483. MessageManager::callAsync([this] () {componentMovedOrResized (owner, true, true);});
  484. return true;
  485. }
  486. }
  487. else if (e.xany.window == host && host != 0)
  488. {
  489. switch (e.type)
  490. {
  491. case ReparentNotify:
  492. if (e.xreparent.parent == host && e.xreparent.window != client)
  493. {
  494. setClient (e.xreparent.window, false);
  495. return true;
  496. }
  497. break;
  498. case CreateNotify:
  499. if (e.xcreatewindow.parent != e.xcreatewindow.window && e.xcreatewindow.parent == host && e.xcreatewindow.window != client)
  500. {
  501. setClient (e.xcreatewindow.window, false);
  502. return true;
  503. }
  504. break;
  505. case GravityNotify:
  506. componentMovedOrResized (owner, true, true);
  507. return true;
  508. case ClientMessage:
  509. if (e.xclient.message_type == atoms.XembedMsgType && e.xclient.format == 32)
  510. {
  511. handleXembedCmd ((::Time) e.xclient.data.l[0], e.xclient.data.l[1],
  512. e.xclient.data.l[2], e.xclient.data.l[3],
  513. e.xclient.data.l[4]);
  514. return true;
  515. }
  516. break;
  517. }
  518. }
  519. return false;
  520. }
  521. void sendXEmbedEvent (const ::Time& xTime, long opcode,
  522. long opcodeMinor = 0, long data1 = 0, long data2 = 0)
  523. {
  524. XClientMessageEvent msg;
  525. Display* dpy = getDisplay();
  526. ::memset (&msg, 0, sizeof (XClientMessageEvent));
  527. msg.window = client;
  528. msg.type = ClientMessage;
  529. msg.message_type = atoms.XembedMsgType;
  530. msg.format = 32;
  531. msg.data.l[0] = (long) xTime;
  532. msg.data.l[1] = opcode;
  533. msg.data.l[2] = opcodeMinor;
  534. msg.data.l[3] = data1;
  535. msg.data.l[4] = data2;
  536. XSendEvent (dpy, client, False, NoEventMask, (XEvent*) &msg);
  537. XSync (dpy, False);
  538. }
  539. Rectangle<int> getX11BoundsFromJuce()
  540. {
  541. if (ComponentPeer* peer = owner.getPeer())
  542. {
  543. Rectangle<int> r
  544. = peer->getComponent().getLocalArea (&owner, owner.getLocalBounds());
  545. const double scale
  546. = Desktop::getInstance().getDisplays().getDisplayContaining (peer->localToGlobal (r.getCentre())).scale;
  547. return r * scale;
  548. }
  549. return owner.getLocalBounds();
  550. }
  551. //==============================================================================
  552. friend bool juce::juce_handleXEmbedEvent (ComponentPeer*, void*);
  553. friend unsigned long juce::juce_getCurrentFocusWindow (ComponentPeer*);
  554. static Array<Pimpl*>* widgets;
  555. static bool dispatchX11Event (ComponentPeer* p, const XEvent* eventArg)
  556. {
  557. if (widgets != nullptr)
  558. {
  559. if (eventArg != nullptr)
  560. {
  561. const XEvent& e = *eventArg;
  562. Window w = e.xany.window;
  563. if (w == 0) return false;
  564. for (auto && widget : *widgets)
  565. if (w == widget->host || w == widget->client)
  566. return widget->handleX11Event (e);
  567. }
  568. else
  569. {
  570. for (auto && widget : *widgets)
  571. {
  572. if (widget->owner.getPeer() == p)
  573. widget->peerChanged (nullptr);
  574. }
  575. }
  576. }
  577. return false;
  578. }
  579. static Window getCurrentFocusWindow (ComponentPeer* p)
  580. {
  581. if (widgets != nullptr && p != nullptr)
  582. {
  583. for (auto && widget : *widgets)
  584. if (widget->owner.getPeer() == p && widget->owner.hasKeyboardFocus (false))
  585. return widget->client;
  586. }
  587. return SharedKeyWindow::getCurrentFocusWindow (p);
  588. }
  589. };
  590. //==============================================================================
  591. Array<XEmbedComponent::Pimpl*>* XEmbedComponent::Pimpl::widgets = nullptr;
  592. HashMap<ComponentPeer*,XEmbedComponent::Pimpl::SharedKeyWindow*>* XEmbedComponent::Pimpl::SharedKeyWindow::keyWindows = nullptr;
  593. //==============================================================================
  594. XEmbedComponent::XEmbedComponent (bool wantsKeyboardFocus, bool allowForeignWidgetToResizeComponent)
  595. : pimpl (new Pimpl (*this, 0, wantsKeyboardFocus, false, allowForeignWidgetToResizeComponent))
  596. {
  597. setOpaque (true);
  598. }
  599. XEmbedComponent::XEmbedComponent (unsigned long wID, bool wantsKeyboardFocus, bool allowForeignWidgetToResizeComponent)
  600. : pimpl (new Pimpl (*this, wID, wantsKeyboardFocus, true, allowForeignWidgetToResizeComponent))
  601. {
  602. setOpaque (true);
  603. }
  604. XEmbedComponent::~XEmbedComponent() {}
  605. void XEmbedComponent::paint (Graphics& g)
  606. {
  607. g.fillAll (Colours::lightgrey);
  608. }
  609. void XEmbedComponent::focusGained (FocusChangeType changeType) { pimpl->focusGained (changeType); }
  610. void XEmbedComponent::focusLost (FocusChangeType changeType) { pimpl->focusLost (changeType); }
  611. void XEmbedComponent::broughtToFront() { pimpl->broughtToFront(); }
  612. unsigned long XEmbedComponent::getHostWindowID() { return pimpl->getHostWindowID(); }
  613. //==============================================================================
  614. bool juce_handleXEmbedEvent (ComponentPeer* p, void* e)
  615. {
  616. return ::XEmbedComponent::Pimpl::dispatchX11Event (p, reinterpret_cast<const XEvent*> (e));
  617. }
  618. unsigned long juce_getCurrentFocusWindow (ComponentPeer* peer)
  619. {
  620. return (unsigned long) ::XEmbedComponent::Pimpl::getCurrentFocusWindow (peer);
  621. }