mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 13:30:02 +00:00
SDL: Save window position
This commit is contained in:
parent
3ff87f5959
commit
57362b9199
@ -12,9 +12,11 @@ class Path;
|
||||
typedef std::function<void(const char *responseString, int responseValue)> RequestCallback;
|
||||
typedef std::function<void()> RequestFailedCallback;
|
||||
|
||||
// Platforms often have to process requests asynchronously, on wildly different threads.
|
||||
// (Especially Android...)
|
||||
// Platforms often have to process requests asynchronously, on wildly different threads,
|
||||
// and then somehow pass a response back to the main thread (especially Android...)
|
||||
// This acts as bridge and buffer.
|
||||
// However - the actual request is performed on the current thread, it's the callbacks that are "made threadsafe"
|
||||
// by running them on the main thread. So beware in your implementations!
|
||||
class RequestManager {
|
||||
public:
|
||||
// These requests are to be handled by platform implementations.
|
||||
|
@ -587,12 +587,16 @@ static const ConfigSetting generalSettings[] = {
|
||||
|
||||
#if defined(USING_WIN_UI)
|
||||
ConfigSetting("TopMost", &g_Config.bTopMost, false),
|
||||
ConfigSetting("PauseOnLostFocus", &g_Config.bPauseOnLostFocus, false, true, true),
|
||||
#endif
|
||||
|
||||
#if !defined(MOBILE_DEVICE)
|
||||
ConfigSetting("WindowX", &g_Config.iWindowX, -1), // -1 tells us to center the window.
|
||||
ConfigSetting("WindowY", &g_Config.iWindowY, -1),
|
||||
ConfigSetting("WindowWidth", &g_Config.iWindowWidth, 0), // 0 will be automatically reset later (need to do the AdjustWindowRect dance).
|
||||
ConfigSetting("WindowHeight", &g_Config.iWindowHeight, 0),
|
||||
ConfigSetting("PauseOnLostFocus", &g_Config.bPauseOnLostFocus, false, true, true),
|
||||
#endif
|
||||
|
||||
ConfigSetting("PauseWhenMinimized", &g_Config.bPauseWhenMinimized, false, true, true),
|
||||
ConfigSetting("DumpDecryptedEboots", &g_Config.bDumpDecryptedEboot, false, true, true),
|
||||
ConfigSetting("FullscreenOnDoubleclick", &g_Config.bFullscreenOnDoubleclick, true, false, false),
|
||||
|
@ -794,13 +794,18 @@ int main(int argc, char *argv[]) {
|
||||
int x = SDL_WINDOWPOS_UNDEFINED_DISPLAY(getDisplayNumber());
|
||||
int y = SDL_WINDOWPOS_UNDEFINED;
|
||||
|
||||
if (g_Config.iWindowX != -1)
|
||||
x = g_Config.iWindowX;
|
||||
if (g_Config.iWindowY != -1)
|
||||
y = g_Config.iWindowY;
|
||||
|
||||
g_display.pixel_in_dps_x = (float)g_display.pixel_xres / g_display.dp_xres;
|
||||
g_display.pixel_in_dps_y = (float)g_display.pixel_yres / g_display.dp_yres;
|
||||
g_display.dpi_scale_x = g_display.dp_xres / (float)g_display.pixel_xres;
|
||||
g_display.dpi_scale_y = g_display.dp_yres / (float)g_display.pixel_yres;
|
||||
g_display.dpi_scale_real_x = g_display.dpi_scale_x;
|
||||
g_display.dpi_scale_real_y = g_display.dpi_scale_y;
|
||||
g_display.Print();
|
||||
// g_display.Print();
|
||||
|
||||
GraphicsContext *graphicsContext = nullptr;
|
||||
SDL_Window *window = nullptr;
|
||||
@ -960,6 +965,19 @@ int main(int argc, char *argv[]) {
|
||||
break;
|
||||
}
|
||||
|
||||
case SDL_WINDOWEVENT_MOVED:
|
||||
{
|
||||
int x = event.window.data1;
|
||||
int y = event.window.data2;
|
||||
Uint32 window_flags = SDL_GetWindowFlags(window);
|
||||
bool fullscreen = (window_flags & SDL_WINDOW_FULLSCREEN);
|
||||
if (!fullscreen) {
|
||||
g_Config.iWindowX = x;
|
||||
g_Config.iWindowY = y;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case SDL_WINDOWEVENT_MINIMIZED:
|
||||
case SDL_WINDOWEVENT_HIDDEN:
|
||||
windowHidden = true;
|
||||
|
Loading…
Reference in New Issue
Block a user