diff options
author | runge <runge> | 2005-04-10 04:30:48 +0000 |
---|---|---|
committer | runge <runge> | 2005-04-10 04:30:48 +0000 |
commit | baee5e2b3a00993fee00dca9d4e560f904693a6c (patch) | |
tree | 7cea15f636074f4d81fd100f6f37cc25750f3211 /x11vnc/misc/dtVncPopup | |
parent | ac01f36ce0e2630db608537641b0335b249fea3c (diff) | |
download | libtdevnc-baee5e2b3a00993fee00dca9d4e560f904693a6c.tar.gz libtdevnc-baee5e2b3a00993fee00dca9d4e560f904693a6c.zip |
x11vnc: -rawfb, -pipeinput, -xtrap, -flag, ...
Diffstat (limited to 'x11vnc/misc/dtVncPopup')
-rw-r--r-- | x11vnc/misc/dtVncPopup | 109 |
1 files changed, 109 insertions, 0 deletions
diff --git a/x11vnc/misc/dtVncPopup b/x11vnc/misc/dtVncPopup new file mode 100644 index 0000000..e90cc8b --- /dev/null +++ b/x11vnc/misc/dtVncPopup @@ -0,0 +1,109 @@ +#!/usr/dt/bin/dtksh +# +# accept dialog script for x11vnc +# 2004-07-13 [email protected] +# should work in any CDE environment (Sun,HP,IBM,...) +# +# when called without parameters shows a CDE question dialog: +# Do you want to accept a VNC connection +# from IP address $RFB_CLIENT_IP to your desktop? +# Note: +# After 30 seconds the screen will +# be locked and the connection will be +# accepted automatically." +# [Yes} {__No__] [View/Only] +# and counts down a timer in the dialog title bar +# when the timer is down to 0, it locks the display and returns 0 +# (if the screenlock was successful or if the login prompt was active) +# +# buttons=retcode: +# Yes = 0 +# No = 1 (same as closing the dialog windows) +# View/Only = 3 +# +# usage: x11vnc -forever -shared -accept "yes:0,no:*,view:3 dtVncPopup" -gone "dtVncPopup lock" +# +# security considerations: when you return to your console and unlock the display +# you can never know if enyone else is connected to your display +# + +# timeout until accept +timeout=30 + +# dialog message +test -z "${RFB_CLIENT_IP}" && unknown="an unknown " || ip="$RFB_CLIENT_IP " +message="\ +Do you want to accept a VNC connection +from ${unknown}IP address ${ip}to your desktop? +Note: +After $timeout seconds the screen will +be locked and the connection will be +accepted automatically." + +# action functions +accept () { + exit 0 +} +reject () { + exit 1 +} +view () { + exit 3 +} +lock () { + # lock only if dtsession active + xrdb -query | grep -c '^dtsession*' || accept + # accept only if lock succeeds + /usr/dt/bin/dtaction LockDisplay && accept || reject +} + +# main + +# actions can be called directly +test $# -gt 0 && $@ + +# initialize the display +XtInitialize TOPLEVEL vncPopup VncPopup "$0" "$@" + +# create a message dialog containing the contents of the specified file +XmCreateQuestionDialog DIALOG $TOPLEVEL dialog \ + dialogTitle:"$DTKSH_APPNAME" \ + messageString:"$message" \ + unmapCallback:reject \ +# symbolPixmap:/usr/dt/appconfig/icons/C/DtFlag.m.pm + +# change the OK button to "Yes" +XmMessageBoxGetChild OK_BUTTON $DIALOG DIALOG_OK_BUTTON +XtSetValues $OK_BUTTON \ + labelString:"Yes" \ + activateCallback:accept + +# change the Cancel Button to "No" +XmMessageBoxGetChild CANCEL_BUTTON $DIALOG DIALOG_CANCEL_BUTTON +XtSetValues $CANCEL_BUTTON \ + labelString:"No" \ + activateCallback:reject + +# change Help button to View-Only, set focus and make it the default +XmMessageBoxGetChild HELP_BUTTON $DIALOG DIALOG_HELP_BUTTON +XtSetValues $HELP_BUTTON \ + labelString:"View\nOnly" \ + activateCallback:view + +# make "No" the default (for unmap as well) +XtSetValues $DIALOG \ + defaultButton:$CANCEL_BUTTON initialFocus:$CANCEL_BUTTON \ + +# create the ticker +ticker () { + test $timeout -eq 0 && lock + XtSetValues $DIALOG dialogTitle:"accepting in $timeout seconds" + XtAddTimeOut TICKER 1000 ticker + timeout=`expr $timeout - 1` +} + +# display dialog and activate ticker +XtAddTimeOut TICKER 1000 ticker +XtManageChild $DIALOG +XtMainLoop + |