Skip to content

Commit 12a1e62

Browse files
authored
Add 'Clear F12 Macro' to listeners, maximize logic
* Added 'Clear F12 Macro' right-click menu item for Listening connections. This is useful if you only want to send the F12 macro one time then easily clear it without having to edit the listening item's settings * Added main window maximizing logic for the future, although FLTK apparently doesn't currently support telling the window manager to maximize. :-\
1 parent 85e1d8d commit 12a1e62

File tree

3 files changed

+29
-4
lines changed

3 files changed

+29
-4
lines changed

src/app.cxx

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,10 @@ void svConfigReadCreateHostList ()
419419
if (strProp == "showreverseconnect")
420420
app->showReverseConnect = svConvertStringToBoolean(strVal);
421421

422+
// maximize if last window state was maximized
423+
if (strProp == "maximized")
424+
app->maximized = svConvertStringToBoolean(strVal);
425+
422426
// #############################################################################
423427
// ######## per-connection options #############################################
424428
// #############################################################################
@@ -672,6 +676,8 @@ void svConfigWrite ()
672676
ofs << "savedw=" << app->savedW << std::endl;
673677
ofs << "savedh=" << app->savedH << std::endl;
674678

679+
ofs << "maximized=" << app->maximized << std::endl;
680+
675681
// blank line
676682
ofs << std::endl;
677683

@@ -1641,6 +1647,7 @@ void svHandleHostListEvents (Fl_Widget *, void *)
16411647
if (Fl::event_button() == FL_RIGHT_MOUSE)
16421648
{
16431649
int nF12Flags;
1650+
int nF12Flags2;
16441651

16451652
if (app->childWindowVisible == true)
16461653
return;
@@ -1765,12 +1772,19 @@ void svHandleHostListEvents (Fl_Widget *, void *)
17651772
else
17661773
nF12Flags = 0;
17671774

1775+
// enable / disable 'Clear F12 macro' item in menu
1776+
if (itm->f12Macro == "")
1777+
nF12Flags2 = FL_MENU_INACTIVE;
1778+
else
1779+
nF12Flags2 = 0;
1780+
17681781
// create context menu
17691782
// text,shortcut,callback,user_data,flags,labeltype,labelfont,labelsize
17701783
const Fl_Menu_Item miMain[] = {
1771-
{"Disconnect", 0, 0, 0, 0, 0, FL_HELVETICA, app->nMenuFontSize},
1772-
{"Edit", 0, 0, 0, 0, 0, FL_HELVETICA, app->nMenuFontSize},
1773-
{"Paste F12 macro", 0, 0, 0, nF12Flags, 0, FL_HELVETICA, app->nMenuFontSize},
1784+
{"Disconnect", 0, 0, 0, 0, 0, FL_HELVETICA, app->nMenuFontSize},
1785+
{"Edit", 0, 0, 0, 0, 0, FL_HELVETICA, app->nMenuFontSize},
1786+
{"Paste F12 macro", 0, 0, 0, nF12Flags, 0, FL_HELVETICA, app->nMenuFontSize},
1787+
{"Clear F12 macro", 0, 0, 0, nF12Flags2, 0, FL_HELVETICA, app->nMenuFontSize},
17741788
{0}
17751789
};
17761790

@@ -1808,6 +1822,10 @@ void svHandleHostListEvents (Fl_Widget *, void *)
18081822
itm->f12Macro = app->strF12ClipVar;
18091823
app->strF12ClipVar = "";
18101824
}
1825+
1826+
// clear F12 macro variable of listening item
1827+
if (strcmp(strRes, "Clear F12 macro") == 0)
1828+
itm->f12Macro = "";
18111829
}
18121830
}
18131831

src/app.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ class AppVars
146146
savedY(0),
147147
savedW(800),
148148
savedH(600),
149+
maximized(false),
149150
createdObjects(0),
150151
msgThread(0),
151152
strF12ClipVar(""),
@@ -174,7 +175,7 @@ class AppVars
174175
if (userName.empty() == true && getenv("USERNAME") != NULL)
175176
userName = getenv("USERNAME");
176177
#endif
177-
178+
178179
// uh-oh, can't figure out user's name
179180
if (userName.empty() == true)
180181
{
@@ -255,6 +256,7 @@ class AppVars
255256
int savedY;
256257
int savedW;
257258
int savedH;
259+
bool maximized;
258260
int createdObjects;
259261
pthread_t msgThread;
260262
std::string strF12ClipVar;

src/spiritvnc.cxx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,11 @@ int main (int argc, char **argv)
122122
Fl::add_timeout(0.7, svRestoreWindowSizePosition);
123123
#endif
124124

125+
//// maximize window if last state was maximized
126+
//// (I guess FLTK can't do 'maximize' yet!?)
127+
//if (app->maximized)
128+
//app->mainWin->maximize();
129+
125130
VncObject::masterMessageLoop();
126131

127132
return Fl::run();

0 commit comments

Comments
 (0)