Keyboard Focus Bug On Linux

When grabbing keyboard focus with a JUCE component in Linux, it seems to take focus away from other applications. On macOS and Windows these calls only take focus away from the other JUCE components in our plugins.

Here’s a PIP for quick testing. We ran on Debian 9 with a text editor open. Every timerCallback() the text editor app had focus taken away from it but remained in the foreground, which was not the same behavior as running on my macOS machine.

 The block below describes the properties of this PIP. A PIP is a short snippet
 of code that can be read by the Projucer and used to generate a JUCE project.


  name:             UnfocusTest

  dependencies:     juce_core, juce_data_structures, juce_events, juce_graphics, juce_gui_basics
  exporters:        linux_make

  type:             Component
  mainClass:        MyComponent



#pragma once

class MyComponent   : public Component,
					  public Timer
        setSize (600, 400);


    void timerCallback () override

    void paint (Graphics& g) override


Is this only in a plug-in setting? Your pip works fine on Ubuntu. I let your PiP run in the background while editing in gedit and everything seems to be working.

Hey Fabian,

We encountered it while running that PIP as well as our plugin

Perhaps it could be distro or WM/DE specific? I’ll try it out in Ubuntu and see, if it only really happens on that Debian setup that would be okay

You are using the newest version of JUCE right? I just remembered that we fixed a bug over a year ago where JUCE would steal the focus from any other application running - exactly like you describe.

We’re currently on 5.3.1