Fix focus handling when reopening REAPER FX window

REAPER initializes the plugin's editor first before reparenting the
parent window to the FX window, so our `topmost_window` didn't actually
refer to the FX window.
This commit is contained in:
Robbert van der Helm
2021-07-15 14:21:50 +02:00
parent ce1cf41f45
commit f02341e77f
4 changed files with 87 additions and 22 deletions
+14 -2
View File
@@ -163,7 +163,7 @@ class Editor {
/**
* Handle X11 events sent to the window our editor is embedded in.
*/
void handle_x11_events() const noexcept;
void handle_x11_events() noexcept;
/**
* Get the Win32 window handle so it can be passed to an `effEditOpen()`
@@ -225,6 +225,12 @@ class Editor {
*/
bool is_wine_window_active() const;
/**
* After `parent_window` gets reparented, we may need to redetect the
* topmost window and adjust the events we're subscribed to accordingly.
*/
void redetect_topmost_window() noexcept;
/**
* Send an XEmbed message to a window. This does not include a flush. See
* the spec for more information:
@@ -313,8 +319,14 @@ class Editor {
* REAPER) embed `parent_window` into another window. We have to listen for
* configuration changes on this topmost window to know when the window is
* being dragged around.
*
* NOTE: When reopening a REAPER FX window that has previously been closed,
* REAPER will initialize the first plugin's editor first before
* opening the window. This means that the topmost FX window doesn't
* actually exist yet at that point, so we need to redetect this
* later.
*/
const xcb_window_t topmost_window;
xcb_window_t topmost_window;
/**
* The atom corresponding to `_NET_ACTIVE_WINDOW`.