File tree Expand file tree Collapse file tree 6 files changed +24
-13
lines changed
Expand file tree Collapse file tree 6 files changed +24
-13
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ buildscript {
55 jcenter()
66 }
77 dependencies {
8- classpath ' com.android.tools.build:gradle:3.6.3 '
8+ classpath ' com.android.tools.build:gradle:4.0.0 '
99 classpath " com.github.ben-manes:gradle-versions-plugin:0.22.0"
1010 }
1111}
Original file line number Diff line number Diff line change 11// This file is part of SmallBASIC
22//
3- // Copyright(C) 2001-2016 Chris Warren-Smith.
3+ // Copyright(C) 2001-2020 Chris Warren-Smith.
44//
55// This program is distributed under the terms of the GPL v2.0 or later
66// Download the GNU Public License (GPL) from www.gnu.org
@@ -61,6 +61,8 @@ struct Runtime : public System {
6161 void runShell ();
6262 char *loadResource (const char *fileName);
6363 void optionsBox (StringList *items);
64+ void restoreWindowRect () {}
65+ void saveWindowRect () {}
6466 void setWindowSize (int width, int height) {};
6567 void setWindowTitle (const char *title) {}
6668 void share (const char *path) { setString (" share" , path); }
Original file line number Diff line number Diff line change @@ -804,14 +804,14 @@ 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_SetWindowSize (_window, _saveRect. w , _saveRect. h );
813- setWindowSize (_saveRect. w , _saveRect. h );
814- }
807+ void Runtime::restoreWindowRect ( ) {
808+ SDL_SetWindowPosition (_window, _saveRect. x , _saveRect. y );
809+ SDL_SetWindowSize (_window, _saveRect. w , _saveRect. h );
810+ setWindowSize (_saveRect. w , _saveRect. h );
811+ }
812+
813+ void Runtime::saveWindowRect () {
814+ setWindowRect (_saveRect);
815815}
816816
817817//
@@ -857,12 +857,12 @@ void maWait(int timeout) {
857857// sbasic implementation
858858//
859859int osd_devinit (void ) {
860- runtime->setActive (true );
860+ runtime->setRunning (true );
861861 return 1 ;
862862}
863863
864864int osd_devrestore (void ) {
865- runtime->setActive (false );
865+ runtime->setRunning (false );
866866 return 0 ;
867867}
868868
Original file line number Diff line number Diff line change @@ -45,6 +45,8 @@ struct Runtime : public System {
4545 MAEvent processEvents (int waitFlag);
4646 void processEvent (MAEvent &event);
4747 void pushEvent (MAEvent *event);
48+ void restoreWindowRect ();
49+ void saveWindowRect ();
4850 void setWindowSize (int width, int height);
4951 void setWindowTitle (const char *title);
5052 void share (const char *path) {}
@@ -58,7 +60,6 @@ struct Runtime : public System {
5860 char *getClipboardText ();
5961 void setWindowRect (SDL_Rect &rect);
6062 SDL_Rect getWindowRect ();
61- void setActive (bool running);
6263
6364private:
6465 int _menuX, _menuY;
Original file line number Diff line number Diff line change @@ -158,6 +158,8 @@ bool System::execute(const char *bas) {
158158 _state = kRunState ;
159159 setWindowTitle (bas);
160160 showCursor (kArrow );
161+ saveWindowRect ();
162+
161163 int result = ::sbasic_main (bas);
162164 if (isRunning ()) {
163165 _state = kActiveState ;
@@ -166,6 +168,10 @@ bool System::execute(const char *bas) {
166168 if (_editor == nullptr ) {
167169 opt_command[0 ] = ' \0 ' ;
168170 }
171+
172+ if (!_mainBas) {
173+ restoreWindowRect ();
174+ }
169175 enableCursor (true );
170176 opt_file_permitted = 1 ;
171177 opt_loadmod = 0 ;
Original file line number Diff line number Diff line change @@ -62,6 +62,8 @@ struct System {
6262 virtual MAEvent processEvents (int waitFlag) = 0;
6363 virtual char *loadResource (const char *fileName);
6464 virtual void optionsBox (StringList *items) = 0;
65+ virtual void restoreWindowRect () = 0;
66+ virtual void saveWindowRect () = 0;
6567 virtual void setWindowSize (int width, int height) = 0;
6668 virtual void setWindowTitle (const char *title) = 0;
6769 virtual void share (const char *path) = 0;
You can’t perform that action at this time.
0 commit comments