# Flickering in the native menu

**URL:** <https://forum.juce.com/t/flickering-in-the-native-menu/17538>\
**Category:** MacOSX and iOS\
**Created:** [April 28, 2016, 7:38pm UTC](https://forum.juce.com/t/flickering-in-the-native-menu/17538 "2016-04-28T19:38:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![samuel](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/samuel/32/21_2.png) [@samuel](https://forum.juce.com/u/samuel)\
**Post date:** [April 28, 2016, 7:38pm UTC](https://forum.juce.com/t/flickering-in-the-native-menu/17538/1 "2016-04-28T19:38:07Z")

</div>

This happens (at least) in OS X 10.11.4

To reproduce:

- Launch the Demo.
- Tabs & Widgets → Menus → Look-and-feel → Use Native Menu Bar
- Observe the native menu bar and press e.g. Command - I

→ The menu item ‘Look-and-feel’ flickers (2 times) instead of just flashing up once.

* * *

I don’t understand the code involved, but one flicker is triggered at

> static void JuceMenuCallbackClass::menuItemInvoked (id self, SEL, NSMenuItem\* item)

which calls

> bool NSViewComponentPeer::handleKeyEvent (NSEvent\* ev, bool isKeyDown)  
> {  
> …  
> used = handleKeyUpOrDown (true) || used;  
> used = handleKeyPress (keyCode, textCharacter) || used;  
> …  
> }

Outcomment the second line and the menu item will only flash up once (but it will not work anymore). Maybe this helps in tracking the issue down.

---

<div class="post-metadata">

**Author:** ![samuel](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/samuel/32/21_2.png) [@samuel](https://forum.juce.com/u/samuel)\
**Post date:** [May 10, 2016, 2:21pm UTC](https://forum.juce.com/t/flickering-in-the-native-menu/17538/2 "2016-05-10T14:21:43Z")

</div>

bump

@jules, do you have any idea where the second flicker is triggered?

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [May 10, 2016, 4:15pm UTC](https://forum.juce.com/t/flickering-in-the-native-menu/17538/3 "2016-05-10T16:15:59Z")

</div>

This is one of those posts where I can see it’ll take a lot of debugging, and am a bit busy right now. It’s in my bookmarks, but can’t promise when I’ll get chance to look at it.

---

<div class="post-metadata">

**Author:** ![samuel](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/samuel/32/21_2.png) [@samuel](https://forum.juce.com/u/samuel)\
**Post date:** [May 10, 2016, 4:45pm UTC](https://forum.juce.com/t/flickering-in-the-native-menu/17538/4 "2016-05-10T16:45:48Z")

</div>

Thanks for the reply, good to know that you noticed.

No urgency on my side about this.

---

<div class="post-metadata">

**Author:** ![samuel](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/samuel/32/21_2.png) [@samuel](https://forum.juce.com/u/samuel)\
**Post date:** [August 23, 2016, 2:22pm UTC](https://forum.juce.com/t/flickering-in-the-native-menu/17538/5 "2016-08-23T14:22:30Z")

</div>

Thank you @jules for addressing this in your recent commit a46191ad!
