Skip to content

Commit 67bea84

Browse files
authored
Add main window maximize code intro'd in 1.4.x
* Added code to save and restore the main window maximized state, a feature introduced in 1.4.x
1 parent 9cc444f commit 67bea84

File tree

3 files changed

+16
-13
lines changed

3 files changed

+16
-13
lines changed

src/app.cxx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ int SVQuickNoteBox::handle (int evt)
234234

235235
// set cursor at top left
236236
if (app->quickNoteInput->take_focus())
237-
app->quickNoteInput->position(0);
237+
app->quickNoteInput->insert_position(0);
238238

239239
Fl::add_timeout(SV_BLINK_TIME, svBlinkCursor, app->quickNoteInput);
240240
}
@@ -497,9 +497,9 @@ void svConfigReadCreateHostList ()
497497
if (strProp == "showreverseconnect")
498498
app->showReverseConnect = svConvertStringToBoolean(strVal);
499499

500-
//// maximize if last window state was maximized
501-
//if (strProp == "maximized")
502-
//app->maximized = svConvertStringToBoolean(strVal);
500+
// maximize if last window state was maximized
501+
if (strProp == "maximized")
502+
app->maximized = svConvertStringToBoolean(strVal);
503503

504504
// #############################################################################
505505
// ######## per-connection options #############################################
@@ -775,7 +775,7 @@ void svConfigWrite ()
775775
ofs << "savedw=" << app->savedW << std::endl;
776776
ofs << "savedh=" << app->savedH << std::endl;
777777

778-
//ofs << "maximized=" << app->maximized << std::endl;
778+
ofs << "maximized=" << app->maximized << std::endl;
779779

780780
// blank line
781781
ofs << std::endl;
@@ -2126,6 +2126,9 @@ void svHandleMainWindowEvents (Fl_Widget * window, void *)
21262126
app->savedW = app->mainWin->w();
21272127
app->savedH = app->mainWin->h();
21282128

2129+
// check if we're maximized
2130+
app->maximized = app->mainWin->maximize_active();
2131+
21292132
svConfigWrite();
21302133

21312134
// finish up any queued events
@@ -3163,7 +3166,7 @@ void svShowAppOptions ()
31633166
Fl_Input_ * inTemp = static_cast<Fl_Input_ *>(AppOpts.spinScanTimeout->child(0));
31643167

31653168
if (inTemp != NULL && inTemp->type() == FL_INT_INPUT)
3166-
inTemp->position(0, 1000);
3169+
inTemp->insert_position(0, 1000);
31673170

31683171
Fl::redraw();
31693172
}
@@ -3611,7 +3614,7 @@ void svShowItemOptions (HostItem * im)
36113614

36123615
// focus the first input box and select all text within
36133616
ItmOpts.inName->take_focus();
3614-
ItmOpts.inName->position(0, strlen(ItmOpts.inName->value()) + 1);
3617+
ItmOpts.inName->insert_position(0, strlen(ItmOpts.inName->value()) + 1);
36153618

36163619
itmOptWin->show();
36173620
Fl::redraw();

src/app.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ class AppVars
155155
savedY(64),
156156
savedW(800),
157157
savedH(600),
158-
//maximized(false),
158+
maximized(false),
159159
createdObjects(0),
160160
strF12ClipVar(""),
161161
sshCommand("ssh"),
@@ -265,7 +265,7 @@ class AppVars
265265
int savedY;
266266
int savedW;
267267
int savedH;
268-
//bool maximized;
268+
bool maximized;
269269
int createdObjects;
270270
std::string strF12ClipVar;
271271
std::string sshCommand;

src/spiritvnc.cxx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,10 @@ int main (int argc, char **argv)
125125
Fl::add_timeout(0.7, svRestoreWindowSizePosition);
126126
#endif
127127

128-
//// maximize window if last state was maximized
129-
//// (I guess FLTK can't do 'maximize' yet!?)
130-
//if (app->maximized)
131-
//app->mainWin->maximize();
128+
// maximize window if last state was maximized
129+
// (I guess FLTK can't do 'maximize' yet!?)
130+
if (app->maximized)
131+
app->mainWin->maximize();
132132

133133
VncObject::masterMessageLoop();
134134

0 commit comments

Comments
 (0)