diff --git a/src/d_main.c b/src/d_main.c index e3c334d92..7f141d509 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -98,6 +98,8 @@ int SUBVERSION; // platform independant focus loss UINT8 window_notinfocus = false; +INT32 window_x; +INT32 window_y; // // DEMO LOOP diff --git a/src/doomstat.h b/src/doomstat.h index ba6e18a7f..9d425819b 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -146,6 +146,8 @@ extern boolean digital_disabled; extern boolean menuactive; // Menu overlaid? extern UINT8 paused; // Game paused? extern UINT8 window_notinfocus; // are we in focus? (backend independant -- handles auto pausing and display of "focus lost" message) +extern INT32 window_x; +extern INT32 window_y; extern boolean nodrawers; extern boolean noblit; diff --git a/src/i_system.h b/src/i_system.h index daa76f3ab..9a6dd782c 100644 --- a/src/i_system.h +++ b/src/i_system.h @@ -342,4 +342,6 @@ const char *I_ClipboardPaste(void); void I_RegisterSysCommands(void); +void I_CursedWindowMovement(int xd, int yd); + #endif diff --git a/src/p_tick.c b/src/p_tick.c index 4b94b579a..70b0d05a6 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -632,6 +632,7 @@ void P_Ticker(boolean run) quake.x = M_RandomRange(-ir,ir); quake.y = M_RandomRange(-ir,ir); quake.z = M_RandomRange(-ir,ir); + I_CursedWindowMovement(FixedInt(quake.x), FixedInt(quake.y)); ir >>= 2; ir = M_RandomRange(-ir,ir); if (ir < 0) diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index 47c7c5e20..c85caa021 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -836,6 +836,12 @@ INT32 I_GetKey (void) return rc; } +void +I_CursedWindowMovement (int xd, int yd) +{ + SDL_SetWindowPosition(window, window_x + xd, window_y + yd); +} + // // I_JoyScale // diff --git a/src/sdl/i_video.c b/src/sdl/i_video.c index bf61797f3..0e8032184 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -638,6 +638,9 @@ static void Impl_HandleWindowEvent(SDL_WindowEvent evt) break; case SDL_WINDOWEVENT_MAXIMIZED: break; + case SDL_WINDOWEVENT_MOVED: + window_x = evt.data1; + window_y = evt.data2; } if (mousefocus && kbfocus)