summaryrefslogtreecommitdiff
path: root/src/app.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/app.c')
-rw-r--r--src/app.c25
1 files changed, 10 insertions, 15 deletions
diff --git a/src/app.c b/src/app.c
index b50321b2..64ddd70e 100644
--- a/src/app.c
+++ b/src/app.c
@@ -160,12 +160,12 @@ static iString *serializePrefs_App_(const iApp *d) {
160 const iSidebarWidget *sidebar2 = findWidget_App("sidebar2"); 160 const iSidebarWidget *sidebar2 = findWidget_App("sidebar2");
161 appendFormat_String(str, "window.retain arg:%d\n", d->prefs.retainWindowSize); 161 appendFormat_String(str, "window.retain arg:%d\n", d->prefs.retainWindowSize);
162 if (d->prefs.retainWindowSize) { 162 if (d->prefs.retainWindowSize) {
163 const iBool isMaximized = (SDL_GetWindowFlags(d->window->win) & SDL_WINDOW_MAXIMIZED) != 0; 163 const iBool isMaximized = snap_Window(d->window) == maximized_WindowSnap;
164 int w, h, x, y; 164 int w, h, x, y;
165 x = d->window->lastRect.pos.x; 165 x = d->window->place.normalRect.pos.x;
166 y = d->window->lastRect.pos.y; 166 y = d->window->place.normalRect.pos.y;
167 w = d->window->lastRect.size.x; 167 w = d->window->place.normalRect.size.x;
168 h = d->window->lastRect.size.y; 168 h = d->window->place.normalRect.size.y;
169 appendFormat_String(str, "window.setrect width:%d height:%d coord:%d %d\n", w, h, x, y); 169 appendFormat_String(str, "window.setrect width:%d height:%d coord:%d %d\n", w, h, x, y);
170 appendFormat_String(str, "sidebar.width arg:%d\n", width_SidebarWidget(sidebar)); 170 appendFormat_String(str, "sidebar.width arg:%d\n", width_SidebarWidget(sidebar));
171 appendFormat_String(str, "sidebar2.width arg:%d\n", width_SidebarWidget(sidebar2)); 171 appendFormat_String(str, "sidebar2.width arg:%d\n", width_SidebarWidget(sidebar2));
@@ -1113,22 +1113,17 @@ iBool handleCommand_App(const char *cmd) {
1113 } 1113 }
1114 else if (equal_Command(cmd, "window.maximize")) { 1114 else if (equal_Command(cmd, "window.maximize")) {
1115 if (!argLabel_Command(cmd, "toggle")) { 1115 if (!argLabel_Command(cmd, "toggle")) {
1116 SDL_MaximizeWindow(d->window->win); 1116 setSnap_Window(d->window, maximized_WindowSnap);
1117 } 1117 }
1118 else { 1118 else {
1119 if (SDL_GetWindowFlags(d->window->win) & SDL_WINDOW_MAXIMIZED) { 1119 setSnap_Window(d->window, snap_Window(d->window) == maximized_WindowSnap ? 0 :
1120 SDL_RestoreWindow(d->window->win); 1120 maximized_WindowSnap);
1121 }
1122 else {
1123 SDL_MaximizeWindow(d->window->win);
1124 }
1125 } 1121 }
1126 return iTrue; 1122 return iTrue;
1127 } 1123 }
1128 else if (equal_Command(cmd, "window.fullscreen")) { 1124 else if (equal_Command(cmd, "window.fullscreen")) {
1129 const iBool wasFull = 1125 const iBool wasFull = snap_Window(d->window) == fullscreen_WindowSnap;
1130 (SDL_GetWindowFlags(d->window->win) & SDL_WINDOW_FULLSCREEN_DESKTOP) != 0; 1126 setSnap_Window(d->window, wasFull ? 0 : fullscreen_WindowSnap);
1131 SDL_SetWindowFullscreen(d->window->win, wasFull ? 0 : SDL_WINDOW_FULLSCREEN_DESKTOP);
1132 postCommandf_App("window.fullscreen.changed arg:%d", !wasFull); 1127 postCommandf_App("window.fullscreen.changed arg:%d", !wasFull);
1133 return iTrue; 1128 return iTrue;
1134 } 1129 }