You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 5, 2024. It is now read-only.
Rework window event handling to fix bullshit with focus events and mouse binding while in multiscreen fullscreen splitscreen screenscreen screenscreenscreen AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA (followup to d4cd433)
PLS DON'T SHIT SELF UNDER SOME DUMBASS EDGE CASE PLS AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
// Some bullshit we have to deal with to correctly focus windows in multi-display fullscreen so mouse binding/unbinding works correctly. Not relevant for single window.
541
+
// This is SDL's fault for not having handling to raise a window so it's top-most without taking focus of it.
542
+
// Don't process any focus events this update if either of these has been set in the previous one.
543
+
// Having two flags is a bit redundant but better be safe than recursively raising windows and taking focus and pretty much locking up your whole shit so the only thing you can do about it is sign out to terminate this.
544
+
// Clearing the queue here is just us not handling the events on our end. Whatever they are and do and wherever they propagate to is handled by SDL_PollEvent earlier.
545
+
if (m_FocusEventsDispatchedByDisplaySwitchIn || m_FocusEventsDispatchedByMovingBetweenWindows) {
std::vector<SDL_Event> m_EventQueue; //!< List of incoming window events.
220
+
221
+
bool m_FocusEventsDispatchedByMovingBetweenWindows; //!< Whether queued events were dispatched due to raising windows when moving between windows in multi-display fullscreen in the previous update.
222
+
bool m_FocusEventsDispatchedByDisplaySwitchIn; //!< Whether queued events were dispatched due to raising windows when taking focus of any game window in the previous update.
223
+
219
224
std::shared_ptr<SDL_Window> m_PrimaryWindow; //!< The main window.
220
225
std::shared_ptr<SDL_Renderer> m_PrimaryRenderer; //!< The main window renderer, draws to the main window.
221
226
std::unique_ptr<SDL_Texture, SDLTextureDeleter> m_PrimaryTexture; //!< The main window renderer's drawing surface.
@@ -226,7 +231,6 @@ namespace RTE {
226
231
std::vector<SDL_Rect> m_MultiDisplayTextureOffsets; //!< Texture offsets for multi-display fullscreen.
227
232
228
233
bool m_AnyWindowHasFocus; //!< Whether any game window has focus.
229
-
bool m_FocusLostDueToMovingBetweenGameWindows; //!< Whether the focus lost event was due to moving between displays while in multi-display fullscreen.
230
234
bool m_ResolutionChanged; //!< Whether the resolution was changed through the settings.
231
235
232
236
int m_NumDisplays; //!< Number of physical displays.
@@ -311,7 +315,8 @@ namespace RTE {
311
315
/// <summary>
312
316
/// Handles focus gain when switching back to the game window.
313
317
/// </summary>
314
-
voidDisplaySwitchIn() const;
318
+
/// <param name="windowThatShouldTakeInputFocus">The window that should take focus of input after all the windows are raised. This is only relevant in multi-display fullscreen.</param>
0 commit comments