Skip to content

Commit

Permalink
refactor: remember emulation window resizes (fixes #1568)
Browse files Browse the repository at this point in the history
When using Windowed mode, if the emulation window is manually resized, that position will be remembered and restored, if the GUI is opened and closed again.
  • Loading branch information
midwan committed Jan 5, 2025
1 parent ed90471 commit 1b3833f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
6 changes: 2 additions & 4 deletions src/osdep/amiberry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -443,10 +443,8 @@ static void setcursor(struct AmigaMonitor* mon, int oldx, int oldy)

mon->windowmouse_max_w = mon->amigawinclip_rect.w / 2 - 50;
mon->windowmouse_max_h = mon->amigawinclip_rect.h / 2 - 50;
if (mon->windowmouse_max_w < 10)
mon->windowmouse_max_w = 10;
if (mon->windowmouse_max_h < 10)
mon->windowmouse_max_h = 10;
mon->windowmouse_max_w = std::max(mon->windowmouse_max_w, 10);
mon->windowmouse_max_h = std::max(mon->windowmouse_max_h, 10);

if ((currprefs.input_mouse_untrap & MOUSEUNTRAP_MAGIC) && currprefs.input_tablet > 0 && mousehack_alive() && isfullscreen() <= 0) {
mon->mouseposx = mon->mouseposy = 0;
Expand Down
11 changes: 10 additions & 1 deletion src/osdep/amiberry_gfx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2522,7 +2522,14 @@ bool target_graphics_buffer_update(int monid, bool force)

if (mon->amiga_window && isfullscreen() == 0)
{
SDL_SetWindowSize(mon->amiga_window, scaled_width, scaled_height);
if (mon->amigawin_rect.w != 800 && mon->amigawin_rect.h != 600)
{
SDL_SetWindowSize(mon->amiga_window, mon->amigawin_rect.w, mon->amigawin_rect.h);
}
else
{
SDL_SetWindowSize(mon->amiga_window, scaled_width, scaled_height);
}
}
#ifdef USE_OPENGL
if (!currprefs.gfx_auto_crop && !currprefs.gfx_manual_crop) {
Expand Down Expand Up @@ -2561,7 +2568,9 @@ bool target_graphics_buffer_update(int monid, bool force)
set_scaling_option(&currprefs, scaled_width, scaled_height);
}
else
{
return false;
}
#endif
}

Expand Down

0 comments on commit 1b3833f

Please sign in to comment.