diff --git a/src/d_main.c b/src/d_main.c index 3ee3e94c9..f3e3fd940 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -108,6 +108,8 @@ int snprintf(char *str, size_t n, const char *fmt, ...); // 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 32a5b02f6..aea051495 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -107,6 +107,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 3e589c69a..66f90112d 100644 --- a/src/i_system.h +++ b/src/i_system.h @@ -352,4 +352,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 deb8b5cc9..6e4dbbd68 100644 --- a/src/p_tick.c +++ b/src/p_tick.c @@ -744,6 +744,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 51f708d0f..7b952146d 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -852,6 +852,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 37eedf147..8e4ce4129 100644 --- a/src/sdl/i_video.c +++ b/src/sdl/i_video.c @@ -617,6 +617,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)