diff options
Diffstat (limited to 'src/app.c')
-rw-r--r-- | src/app.c | 32 |
1 files changed, 24 insertions, 8 deletions
@@ -136,19 +136,31 @@ static iString *serializePrefs_App_(const iApp *d) { | |||
136 | const iSidebarWidget *sidebar = findWidget_App("sidebar"); | 136 | const iSidebarWidget *sidebar = findWidget_App("sidebar"); |
137 | appendFormat_String(str, "window.retain arg:%d\n", d->retainWindowSize); | 137 | appendFormat_String(str, "window.retain arg:%d\n", d->retainWindowSize); |
138 | if (d->retainWindowSize) { | 138 | if (d->retainWindowSize) { |
139 | const iBool isMaximized = (SDL_GetWindowFlags(d->window->win) & SDL_WINDOW_MAXIMIZED) != 0; | ||
139 | int w, h, x, y; | 140 | int w, h, x, y; |
140 | SDL_GetWindowSize(d->window->win, &w, &h); | 141 | x = d->window->lastRect.pos.x; |
141 | SDL_GetWindowPosition(d->window->win, &x, &y); | 142 | y = d->window->lastRect.pos.y; |
142 | #if defined (iPlatformLinux) | 143 | w = d->window->lastRect.size.x; |
143 | /* Workaround for window position being unaffected by decorations on creation. */ { | 144 | h = d->window->lastRect.size.y; |
144 | int bl, bt; | 145 | #if 0 |
145 | SDL_GetWindowBordersSize(d->window->win, &bt, &bl, NULL, NULL); | 146 | SDL_GetWindowSize(d->window->win, &w, &h); |
146 | x -= bl; | 147 | SDL_GetWindowPosition(d->window->win, &x, &y); |
147 | y -= bt; | 148 | #i f defined (iPlatformLinux) |
149 | /* Workaround for window position being unaffected by decorations on creation. */ { | ||
150 | int bl, bt; | ||
151 | SDL_GetWindowBordersSize(d->window->win, &bt, &bl, NULL, NULL); | ||
152 | x -= bl; | ||
153 | y -= bt; | ||
154 | x = iMax(0, x); | ||
155 | y = iMax(0, y); | ||
156 | } | ||
148 | } | 157 | } |
149 | #endif | 158 | #endif |
150 | appendFormat_String(str, "window.setrect width:%d height:%d coord:%d %d\n", w, h, x, y); | 159 | appendFormat_String(str, "window.setrect width:%d height:%d coord:%d %d\n", w, h, x, y); |
151 | appendFormat_String(str, "sidebar.width arg:%d\n", width_SidebarWidget(sidebar)); | 160 | appendFormat_String(str, "sidebar.width arg:%d\n", width_SidebarWidget(sidebar)); |
161 | if (isMaximized) { | ||
162 | appendFormat_String(str, "~window.maximize\n"); | ||
163 | } | ||
152 | } | 164 | } |
153 | if (isVisible_Widget(sidebar)) { | 165 | if (isVisible_Widget(sidebar)) { |
154 | appendCStr_String(str, "sidebar.toggle\n"); | 166 | appendCStr_String(str, "sidebar.toggle\n"); |
@@ -802,6 +814,10 @@ iBool handleCommand_App(const char *cmd) { | |||
802 | d->retainWindowSize = arg_Command(cmd); | 814 | d->retainWindowSize = arg_Command(cmd); |
803 | return iTrue; | 815 | return iTrue; |
804 | } | 816 | } |
817 | else if (equal_Command(cmd, "window.maximize")) { | ||
818 | SDL_MaximizeWindow(d->window->win); | ||
819 | return iTrue; | ||
820 | } | ||
805 | else if (equal_Command(cmd, "downloads")) { | 821 | else if (equal_Command(cmd, "downloads")) { |
806 | setCStr_String(&d->downloadDir, suffixPtr_Command(cmd, "path")); | 822 | setCStr_String(&d->downloadDir, suffixPtr_Command(cmd, "path")); |
807 | return iTrue; | 823 | return iTrue; |