# Issue with JUCE\_COREGRAPHICS\_RENDER\_WITH\_MULTIPLE\_PAINT\_CALLS in Logic Pro

**URL:** <https://forum.juce.com/t/issue-with-juce-coregraphics-render-with-multiple-paint-calls-in-logic-pro/53730>\
**Category:** General JUCE discussion\
**Created:** [November 14, 2022, 11:47am UTC](https://forum.juce.com/t/issue-with-juce-coregraphics-render-with-multiple-paint-calls-in-logic-pro/53730 "2022-11-14T11:47:14Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![tkod132](https://avatars.discourse-cdn.com/v4/letter/t/57b2e6/32.png) [@tkod132](https://forum.juce.com/u/tkod132)\
**Post date:** [November 14, 2022, 11:47am UTC](https://forum.juce.com/t/issue-with-juce-coregraphics-render-with-multiple-paint-calls-in-logic-pro/53730/1 "2022-11-14T11:47:14Z")

</div>

I’m observing a weird graphical glitch on ComboBoxes in plugins built with JUCE 7.0.2 in Logic Pro.  
This is all happening with JUCE\_COREGRAPHICS\_RENDER\_WITH\_MULTIPLE\_PAINT\_CALLS=1 option (which is critical for my plugin, due to extremely laggy rendering otherwise), which switches to the metal rendered - switching this option to zero fixes the glitch.

The glitch is basically - when you open a combo box options menu (showPopup()), moving the mouse over the options doesn’t highlight them straight away. I’m attaching screen recordings of the behaviour with and without the metal rendered, as well as a minimal juce projects which reproduces the issue 100% (on my setup m1 macbook air, monterey).  
Note that the issue happens only in Logic Pro - the same plugin (even the AU version) loaded in REAPER behaves correctly.

From the example I provide the issue doesn’t seem too bad, but in my actual plugin I have sub-menus when I open the combo box - those sub-menus open and get painted, but the root element is still not highlighted.

Let me know if I can provide any other information.

[NewProject.zip](https://forum.juce.com/uploads/short-url/9bh7NCOITJ1YDyAu9XRn2X2sQkJ.zip) (5.9 KB)

[screen\_recordings.zip](https://forum.juce.com/uploads/short-url/lty1Td879IqhZORkysGOnjk3eVY.zip) (303.3 KB)

---

<div class="post-metadata">

**Author:** ![t0m](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/t0m/32/16413_2.png) [@t0m](https://forum.juce.com/u/t0m)\
**Post date:** [December 2, 2022, 2:27pm UTC](https://forum.juce.com/t/issue-with-juce-coregraphics-render-with-multiple-paint-calls-in-logic-pro/53730/2 "2022-12-02T14:27:38Z")

</div>

Please try with JUCE 7.0.3 - there have been a handful of improvements that may have fixed things.

---

<div class="post-metadata">

**Author:** ![tkod132](https://avatars.discourse-cdn.com/v4/letter/t/57b2e6/32.png) [@tkod132](https://forum.juce.com/u/tkod132)\
**Post date:** [March 21, 2023, 9:05am UTC](https://forum.juce.com/t/issue-with-juce-coregraphics-render-with-multiple-paint-calls-in-logic-pro/53730/3 "2023-03-21T09:05:19Z")

</div>

Currently on 7.0.5, issue is exactly as initially described. Please take a look, I’ve provided 100% reproducible code.

---

<div class="post-metadata">

**Author:** ![reuk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/reuk/32/21494_2.png) [@reuk](https://forum.juce.com/u/reuk)\
**Post date:** [March 22, 2023, 5:33pm UTC](https://forum.juce.com/t/issue-with-juce-coregraphics-render-with-multiple-paint-calls-in-logic-pro/53730/4 "2023-03-22T17:33:16Z")

</div>

Thanks, I can reproduce the problem. I have a potential workaround, but there are lots of fiddly interactions in this area so I’m a bit worried about breaking some other usecase. Hopefully we’ll be able to get this merged soon, although it might take a while if we discover new problems.

* * *

In case you were unaware, opening additional windows in AU plugins (including tooltips and popup menus) is generally not supported, even by Apple. There’s a bit more info here:

> [@Bug: Component::contains() fails when dragging from ListBox](https://forum.juce.com/t/bug-component-contains-fails-when-dragging-from-listbox/45641/5):
>
> Finally got round to taking a look at this. I think that the problem stems from isWindowAtPoint in the NSViewComponentPeer. This function calls through to [windowNumberAtPoint:belowWindowWithWindowNumber:](https://developer.apple.com/documentation/appkit/nswindow/1419210-windownumberatpoint), which is supposed to return the topmost window that would receive a mouse-down at a given screen position. The docs for this function say: Because this method uses the same rules as mouse-down hit-testing, windows with transparency at the given point, and windows that ignore mouse events, wil…

The important bit is this quote from the Apple docs:

> If custom, free-floating dialogs don’t work as you expect, add them as a subwindow to the main window — this includes custom tooltip and drop-down menu implementations.

Although I hope we’ll be able to fix the issue you raised, I’d strongly recommend that you avoid opening secondary windows in AU plugins where possible.

In JUCE, you can force PopupMenus to display inside the main editor window by overriding `getParentComponentForMenuOptions()`.

---

<div class="post-metadata">

**Author:** ![tkod132](https://avatars.discourse-cdn.com/v4/letter/t/57b2e6/32.png) [@tkod132](https://forum.juce.com/u/tkod132)\
**Post date:** [March 22, 2023, 6:00pm UTC](https://forum.juce.com/t/issue-with-juce-coregraphics-render-with-multiple-paint-calls-in-logic-pro/53730/5 "2023-03-22T18:00:21Z")

</div>

Thanks for the feedback.  
Is that related to [BUG? Popup Menu Background and Logic Silicon - #35 by reuk](https://forum.juce.com/t/bug-popup-menu-background-and-logic-silicon/43243/35)

---

<div class="post-metadata">

**Author:** ![reuk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/reuk/32/21494_2.png) [@reuk](https://forum.juce.com/u/reuk)\
**Post date:** [March 22, 2023, 6:07pm UTC](https://forum.juce.com/t/issue-with-juce-coregraphics-render-with-multiple-paint-calls-in-logic-pro/53730/6 "2023-03-22T18:07:31Z")

</div>

Insofar as both issues involve unexpected behaviour when opening secondary windows, yes.

---

<div class="post-metadata">

**Author:** ![reuk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/reuk/32/21494_2.png) [@reuk](https://forum.juce.com/u/reuk)\
**Post date:** [March 27, 2023, 8:31pm UTC](https://forum.juce.com/t/issue-with-juce-coregraphics-render-with-multiple-paint-calls-in-logic-pro/53730/7 "2023-03-27T20:31:29Z")

</div>

We’ve just merged a fix to develop:

> <https://github.com/juce-framework/JUCE/commit/ee976f0f0d42bd213baf94df59f0de941dab1a37>
>
> The main change is that the numFramesToSkipMetalRenderer member has been
> removed…. The old mechanism had some problems in AU plugins in Logic.
> Specifically, when opening a temporary window, repaints would be ignored
> until the numFramesToSkipMetalRenderer counter had been decremented to
> zero. In practice, this meant that a PopupMenu might not repaint until
> the highlighted item had changed five times or more.
> 
> With this change applied, repaints that were requested for a particular
> window size will use the metal renderer as long as the window hasn't
> changed size in the meantime.

Please try updating and let us know if the issue is not resolved, or if you encounter new issues as a result of the change.

---

<div class="post-metadata">

**Author:** ![reuk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/reuk/32/21494_2.png) [@reuk](https://forum.juce.com/u/reuk)\
**Post date:** [April 5, 2023, 8:58pm UTC](https://forum.juce.com/t/issue-with-juce-coregraphics-render-with-multiple-paint-calls-in-logic-pro/53730/8 "2023-04-05T20:58:50Z")

</div>

The previous change introduced some new glitches when resizing in windows with native borders.

The following change seems to resolve the original issue, along with the new glitches:

> <https://github.com/juce-framework/JUCE/commit/9d50ab6c59d34ebcbe04a459ec3ac17bbf4bc748>
