Flatpak: moving mouse over canvas steals focus from foreground windows

Description

If there is a window on top of KiCAD (schematic or board) and the mouse moves inside the canvas, the focus of the other window is stolen and the KiCAD window pops to the top. I'm not sure if it's a KiCAD related issue (well KiCAD v6 flatpak is the only application showing this behaviour) but it's kind of annoying.

out-1

I'm running KiCAD with the command flatpak run --env=MESA_LOADER_DRIVER_OVERRIDE=i965 org.kicad.KiCad to accomodate for an upstream bug (#11161 (closed)).

Steps to reproduce

  1. install KiCAD flatpak
  2. move window on top of KiCAD
  3. move mouse over canvas

KiCad Version

Application: KiCad

Version: 6.0.4, release build

Libraries:
	wxWidgets 3.1.5
	libcurl/7.79.1-DEV GnuTLS/3.7.2 zlib/1.2.11 libidn2/2.3.1 nghttp2/1.44.0

Platform: Linux 4.15.0-173-generic x86_64, 64 bit, Little endian, wxGTK, xubuntu, x11

Build Info:
	Date: Mar 19 2022 08:49:38
	wxWidgets: 3.1.5 (wchar_t,wx containers) GTK+ 3.24
	Boost: 1.78.0
	OCC: 7.6.1
	Curl: 7.79.1-DEV
	ngspice: 36
	Compiler: GCC 11.2.0 with C++ ABI 1016

Build settings:
	KICAD_USE_OCC=ON
	KICAD_SPICE=ON