Skip to content

Commit

Permalink
If the emulator starts with the left/top of the window off screen, mo…
Browse files Browse the repository at this point in the history
…ve it onscreen (commanderx16#188)

* If the emulator starts with the left/top of the window off screen, move it onscreen

* update check here as well
  • Loading branch information
mooinglemur authored Nov 3, 2023
1 parent 0996b20 commit 2da4249
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/video.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
#include "stb_image_write.h"
#endif

#define APPROX_TITLEBAR_HEIGHT 30

#define VERA_VERSION_MAJOR 0x00
#define VERA_VERSION_MINOR 0x03
#define VERA_VERSION_PATCH 0x01
Expand Down Expand Up @@ -322,9 +324,17 @@ video_init(int window_scale, float screen_x_scale, char *quality, bool fullscree

SDL_SetWindowTitle(window, WINDOW_TITLE);
SDL_SetWindowIcon(window, CommanderX16Icon());
if(fullscreen) {
if (fullscreen) {
is_fullscreen = true;
SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN);
} else {
int winX, winY;
SDL_GetWindowPosition(window, &winX, &winY);
if (winX < 0 || winY < APPROX_TITLEBAR_HEIGHT) {
winX = winX < 0 ? 0 : winX;
winY = winY < APPROX_TITLEBAR_HEIGHT ? APPROX_TITLEBAR_HEIGHT : winY;
SDL_SetWindowPosition(window, winX, winY);
}
}

SDL_SetWindowOpacity(window, opacity);
Expand Down Expand Up @@ -1302,7 +1312,6 @@ bool
video_update()
{
static bool cmd_down = false;

bool mouse_changed = false;

// for activity LED, overlay red 8x4 square into top right of framebuffer
Expand Down

0 comments on commit 2da4249

Please sign in to comment.