Skip to content
Snippets Groups Projects
Commit c0d2845d authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Store window position when going fullscreen.

Also, reset struts when not in fullscreen mode.
parent 64d280ad
No related branches found
No related tags found
No related merge requests found
...@@ -28,6 +28,7 @@ static bool init_success; ...@@ -28,6 +28,7 @@ static bool init_success;
static enum ciolib_scaling stype; static enum ciolib_scaling stype;
static bool fullscreen; static bool fullscreen;
static float window_scaling; static float window_scaling;
static LONG window_left, window_top;
#define WM_USER_INVALIDATE WM_USER #define WM_USER_INVALIDATE WM_USER
#define WM_USER_SETSIZE (WM_USER + 1) #define WM_USER_SETSIZE (WM_USER + 1)
...@@ -321,6 +322,9 @@ gdi_handle_wm_paint(HWND hwnd) ...@@ -321,6 +322,9 @@ gdi_handle_wm_paint(HWND hwnd)
xoff = (w - dwidth) / 2; xoff = (w - dwidth) / 2;
yoff = (h - dheight) / 2; yoff = (h - dheight) / 2;
} }
else {
xoff = yoff = 0;
}
pthread_mutex_unlock(&off_lock); pthread_mutex_unlock(&off_lock);
winDC = BeginPaint(hwnd, &ps); winDC = BeginPaint(hwnd, &ps);
if (memDC == NULL) { if (memDC == NULL) {
...@@ -704,6 +708,11 @@ magic_message(MSG msg) ...@@ -704,6 +708,11 @@ magic_message(MSG msg)
if (hm) { if (hm) {
MONITORINFO mi = {sizeof(mi)}; MONITORINFO mi = {sizeof(mi)};
if (GetMonitorInfo(hm, &mi)) { if (GetMonitorInfo(hm, &mi)) {
WINDOWINFO wi;
if (GetWindowInfo(win, &wi)) {
window_left = wi.rcWindow.left;
window_top = wi.rcWindow.top;
}
pthread_mutex_lock(&vstatlock); pthread_mutex_lock(&vstatlock);
window_scaling = vstat.scaling; window_scaling = vstat.scaling;
// TODO: Save pos as well... // TODO: Save pos as well...
...@@ -724,6 +733,7 @@ magic_message(MSG msg) ...@@ -724,6 +733,7 @@ magic_message(MSG msg)
bitmap_get_scaled_win_size(window_scaling, &w, &h, 0, 0); bitmap_get_scaled_win_size(window_scaling, &w, &h, 0, 0);
SetWindowLongPtr(win, GWL_STYLE, style); SetWindowLongPtr(win, GWL_STYLE, style);
PostMessageW(win, WM_USER_SETSIZE, w, h); PostMessageW(win, WM_USER_SETSIZE, w, h);
PostMessageW(win, WM_USER_SETPOS, window_left, window_top);
} }
} }
gdi_add_key(keyval[i].ALT); gdi_add_key(keyval[i].ALT);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment