Skip to content

Commit 582ca7a

Browse files
committed
SDL: restore window size #95
1 parent 2237ef3 commit 582ca7a

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
2020-06-14 (0.12.19)
22
FLTK: line numbers colours #93
3+
SDL: restore window size #95
34

45
2020-06-06 (0.12.19)
56
COMMON: minor performance tweak

src/platform/sdl/runtime.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -804,6 +804,17 @@ char *Runtime::getClipboardText() {
804804
return result;
805805
}
806806

807+
void Runtime::setActive(bool active) {
808+
setRunning(active);
809+
if (active) {
810+
setWindowRect(_saveRect);
811+
} else {
812+
SDL_SetWindowPosition(_window, _saveRect.x, _saveRect.y);
813+
SDL_SetWindowSize(_window, _saveRect.w, _saveRect.h);
814+
setWindowSize(_saveRect.w, _saveRect.h);
815+
}
816+
}
817+
807818
//
808819
// System platform methods
809820
//
@@ -847,12 +858,12 @@ void maWait(int timeout) {
847858
// sbasic implementation
848859
//
849860
int osd_devinit(void) {
850-
runtime->setRunning(true);
861+
runtime->setActive(true);
851862
return 1;
852863
}
853864

854865
int osd_devrestore(void) {
855-
runtime->setRunning(false);
866+
runtime->setActive(false);
856867
return 0;
857868
}
858869

src/platform/sdl/runtime.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,13 @@ struct Runtime : public System {
5858
char *getClipboardText();
5959
void setWindowRect(SDL_Rect &rect);
6060
SDL_Rect getWindowRect();
61+
void setActive(bool running);
6162

6263
private:
6364
int _menuX, _menuY;
6465
bool _fullscreen;
6566
SDL_Rect _windowRect;
67+
SDL_Rect _saveRect;
6668
Graphics *_graphics;
6769
Stack<MAEvent *> *_eventQueue;
6870
SDL_Window *_window;

0 commit comments

Comments
 (0)