Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
N
noVNC
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
rasky
noVNC
Commits
8f3c0f6b
Commit
8f3c0f6b
authored
Jul 01, 2015
by
Samuel
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #499 from samhed/fullscreen
Add option to toggle fullscreen mode
parents
b098afc2
a6357e82
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
93 additions
and
13 deletions
+93
-13
fullscreen.png
images/fullscreen.png
+0
-0
base.css
include/base.css
+3
-0
display.js
include/display.js
+6
-5
ui.js
include/ui.js
+81
-8
vnc.html
vnc.html
+3
-0
No files found.
images/fullscreen.png
0 → 100644
View file @
8f3c0f6b
851 Bytes
include/base.css
View file @
8f3c0f6b
...
@@ -59,6 +59,9 @@ html {
...
@@ -59,6 +59,9 @@ html {
#sendCtrlAltDelButton
{
#sendCtrlAltDelButton
{
display
:
none
;
display
:
none
;
}
}
#fullscreenButton
{
display
:
none
;
}
#noVNC_xvp_buttons
{
#noVNC_xvp_buttons
{
display
:
none
;
display
:
none
;
}
}
...
...
include/display.js
View file @
8f3c0f6b
...
@@ -229,13 +229,14 @@ var Display;
...
@@ -229,13 +229,14 @@ var Display;
saveImg
=
this
.
_drawCtx
.
getImageData
(
0
,
0
,
img_width
,
img_height
);
saveImg
=
this
.
_drawCtx
.
getImageData
(
0
,
0
,
img_width
,
img_height
);
}
}
if
(
canvas
.
width
!==
width
)
{
canvas
.
width
=
width
;
}
if
(
canvas
.
width
!==
width
)
{
if
(
canvas
.
height
!==
height
)
{
canvas
.
height
=
height
;
}
canvas
.
width
=
width
;
if
(
this
.
_viewport
)
{
canvas
.
style
.
height
=
height
+
'px'
;
canvas
.
style
.
width
=
width
+
'px'
;
canvas
.
style
.
width
=
width
+
'px'
;
}
}
if
(
canvas
.
height
!==
height
)
{
canvas
.
height
=
height
;
canvas
.
style
.
height
=
height
+
'px'
;
}
if
(
saveImg
)
{
if
(
saveImg
)
{
this
.
_drawCtx
.
putImageData
(
saveImg
,
0
,
0
);
this
.
_drawCtx
.
putImageData
(
saveImg
,
0
,
0
);
...
...
include/ui.js
View file @
8f3c0f6b
...
@@ -38,6 +38,7 @@ var UI;
...
@@ -38,6 +38,7 @@ var UI;
ctrlOn
:
false
,
ctrlOn
:
false
,
altOn
:
false
,
altOn
:
false
,
isTouchDevice
:
false
,
isTouchDevice
:
false
,
rememberedClipSetting
:
null
,
// Setup rfb object, load settings from browser storage, then call
// Setup rfb object, load settings from browser storage, then call
// UI.init to setup the UI/menus
// UI.init to setup the UI/menus
...
@@ -131,6 +132,23 @@ var UI;
...
@@ -131,6 +132,23 @@ var UI;
UI
.
setBarPosition
();
UI
.
setBarPosition
();
}
);
}
);
var
isSafari
=
(
navigator
.
userAgent
.
indexOf
(
'Safari'
)
!=
-
1
&&
navigator
.
userAgent
.
indexOf
(
'Chrome'
)
==
-
1
);
// Only show the button if fullscreen is properly supported
// * Safari doesn't support alphanumerical input while in fullscreen
if
(
!
isSafari
&&
(
document
.
documentElement
.
requestFullscreen
||
document
.
documentElement
.
mozRequestFullScreen
||
document
.
documentElement
.
webkitRequestFullscreen
||
document
.
body
.
msRequestFullscreen
))
{
$D
(
'fullscreenButton'
).
style
.
display
=
"inline"
;
Util
.
addEvent
(
window
,
'fullscreenchange'
,
UI
.
updateFullscreenButton
);
Util
.
addEvent
(
window
,
'mozfullscreenchange'
,
UI
.
updateFullscreenButton
);
Util
.
addEvent
(
window
,
'webkitfullscreenchange'
,
UI
.
updateFullscreenButton
);
Util
.
addEvent
(
window
,
'msfullscreenchange'
,
UI
.
updateFullscreenButton
);
}
Util
.
addEvent
(
window
,
'load'
,
UI
.
keyboardinputReset
);
Util
.
addEvent
(
window
,
'load'
,
UI
.
keyboardinputReset
);
Util
.
addEvent
(
window
,
'beforeunload'
,
function
()
{
Util
.
addEvent
(
window
,
'beforeunload'
,
function
()
{
...
@@ -201,6 +219,7 @@ var UI;
...
@@ -201,6 +219,7 @@ var UI;
$D
(
"noVNC_popup_status"
).
onclick
=
UI
.
togglePopupStatus
;
$D
(
"noVNC_popup_status"
).
onclick
=
UI
.
togglePopupStatus
;
$D
(
"xvpButton"
).
onclick
=
UI
.
toggleXvpPanel
;
$D
(
"xvpButton"
).
onclick
=
UI
.
toggleXvpPanel
;
$D
(
"clipboardButton"
).
onclick
=
UI
.
toggleClipboardPanel
;
$D
(
"clipboardButton"
).
onclick
=
UI
.
toggleClipboardPanel
;
$D
(
"fullscreenButton"
).
onclick
=
UI
.
toggleFullscreen
;
$D
(
"settingsButton"
).
onclick
=
UI
.
toggleSettingsPanel
;
$D
(
"settingsButton"
).
onclick
=
UI
.
toggleSettingsPanel
;
$D
(
"connectButton"
).
onclick
=
UI
.
toggleConnectPanel
;
$D
(
"connectButton"
).
onclick
=
UI
.
toggleConnectPanel
;
$D
(
"disconnectButton"
).
onclick
=
UI
.
disconnect
;
$D
(
"disconnectButton"
).
onclick
=
UI
.
disconnect
;
...
@@ -217,10 +236,7 @@ var UI;
...
@@ -217,10 +236,7 @@ var UI;
$D
(
"noVNC_connect_button"
).
onclick
=
UI
.
connect
;
$D
(
"noVNC_connect_button"
).
onclick
=
UI
.
connect
;
$D
(
"noVNC_resize"
).
onchange
=
function
()
{
$D
(
"noVNC_resize"
).
onchange
=
UI
.
enableDisableViewClip
;
var
connected
=
UI
.
rfb
&&
UI
.
rfb_state
===
'normal'
;
UI
.
enableDisableViewClip
(
connected
);
};
},
},
onresize
:
function
(
callback
)
{
onresize
:
function
(
callback
)
{
...
@@ -437,6 +453,47 @@ var UI;
...
@@ -437,6 +453,47 @@ var UI;
}
}
},
},
// Toggle fullscreen mode
toggleFullscreen
:
function
()
{
if
(
document
.
fullscreenElement
||
// alternative standard method
document
.
mozFullScreenElement
||
// currently working methods
document
.
webkitFullscreenElement
||
document
.
msFullscreenElement
)
{
if
(
document
.
exitFullscreen
)
{
document
.
exitFullscreen
();
}
else
if
(
document
.
mozCancelFullScreen
)
{
document
.
mozCancelFullScreen
();
}
else
if
(
document
.
webkitExitFullscreen
)
{
document
.
webkitExitFullscreen
();
}
else
if
(
document
.
msExitFullscreen
)
{
document
.
msExitFullscreen
();
}
}
else
{
if
(
document
.
documentElement
.
requestFullscreen
)
{
document
.
documentElement
.
requestFullscreen
();
}
else
if
(
document
.
documentElement
.
mozRequestFullScreen
)
{
document
.
documentElement
.
mozRequestFullScreen
();
}
else
if
(
document
.
documentElement
.
webkitRequestFullscreen
)
{
document
.
documentElement
.
webkitRequestFullscreen
(
Element
.
ALLOW_KEYBOARD_INPUT
);
}
else
if
(
document
.
body
.
msRequestFullscreen
)
{
document
.
body
.
msRequestFullscreen
();
}
}
UI
.
enableDisableViewClip
();
UI
.
updateFullscreenButton
();
},
updateFullscreenButton
:
function
()
{
if
(
document
.
fullscreenElement
||
// alternative standard method
document
.
mozFullScreenElement
||
// currently working methods
document
.
webkitFullscreenElement
||
document
.
msFullscreenElement
)
{
$D
(
'fullscreenButton'
).
className
=
"noVNC_status_button_selected"
;
}
else
{
$D
(
'fullscreenButton'
).
className
=
"noVNC_status_button"
;
}
},
// Show the connection settings panel/menu
// Show the connection settings panel/menu
toggleConnectPanel
:
function
()
{
toggleConnectPanel
:
function
()
{
// Close the description panel
// Close the description panel
...
@@ -664,7 +721,7 @@ var UI;
...
@@ -664,7 +721,7 @@ var UI;
$D
(
'noVNC_cursor'
).
disabled
=
true
;
$D
(
'noVNC_cursor'
).
disabled
=
true
;
}
}
UI
.
enableDisableViewClip
(
connected
);
UI
.
enableDisableViewClip
();
$D
(
'noVNC_resize'
).
disabled
=
connected
;
$D
(
'noVNC_resize'
).
disabled
=
connected
;
$D
(
'noVNC_shared'
).
disabled
=
connected
;
$D
(
'noVNC_shared'
).
disabled
=
connected
;
$D
(
'noVNC_view_only'
).
disabled
=
connected
;
$D
(
'noVNC_view_only'
).
disabled
=
connected
;
...
@@ -821,6 +878,7 @@ var UI;
...
@@ -821,6 +878,7 @@ var UI;
if
(
UI
.
rfb
)
{
if
(
UI
.
rfb
)
{
display
=
UI
.
rfb
.
get_display
();
display
=
UI
.
rfb
.
get_display
();
}
else
{
}
else
{
UI
.
forceSetting
(
'clip'
,
clip
);
return
;
return
;
}
}
...
@@ -867,15 +925,30 @@ var UI;
...
@@ -867,15 +925,30 @@ var UI;
},
},
// Handle special cases where clipping is forced on/off or locked
// Handle special cases where clipping is forced on/off or locked
enableDisableViewClip
:
function
(
connected
)
{
enableDisableViewClip
:
function
()
{
var
resizeElem
=
$D
(
'noVNC_resize'
);
var
resizeElem
=
$D
(
'noVNC_resize'
);
var
connected
=
UI
.
rfb
&&
UI
.
rfb_state
===
'normal'
;
if
(
resizeElem
.
value
===
'downscale'
||
resizeElem
.
value
===
'scale'
)
{
if
(
resizeElem
.
value
===
'downscale'
||
resizeElem
.
value
===
'scale'
)
{
UI
.
forceSetting
(
'clip'
,
false
);
// Disable clipping if we are scaling
UI
.
setViewClip
(
false
);
$D
(
'noVNC_clip'
).
disabled
=
true
;
}
else
if
(
document
.
msFullscreenElement
)
{
// The browser is IE and we are in fullscreen mode.
// - We need to force clipping while in fullscreen since
// scrollbars doesn't work.
UI
.
togglePopupStatus
(
"Forcing clipping mode since scrollbars aren't supported by IE in fullscreen"
);
UI
.
rememberedClipSetting
=
UI
.
getSetting
(
'clip'
);
UI
.
setViewClip
(
true
);
$D
(
'noVNC_clip'
).
disabled
=
true
;
$D
(
'noVNC_clip'
).
disabled
=
true
;
}
else
if
(
document
.
body
.
msRequestFullscreen
&&
UI
.
rememberedClip
!==
null
)
{
// Restore view clip to what it was before fullscreen on IE
UI
.
setViewClip
(
UI
.
rememberedClipSetting
);
$D
(
'noVNC_clip'
).
disabled
=
connected
||
UI
.
isTouchDevice
;
}
else
{
}
else
{
$D
(
'noVNC_clip'
).
disabled
=
connected
||
UI
.
isTouchDevice
;
$D
(
'noVNC_clip'
).
disabled
=
connected
||
UI
.
isTouchDevice
;
if
(
UI
.
isTouchDevice
)
{
if
(
UI
.
isTouchDevice
)
{
UI
.
forceSetting
(
'clip'
,
true
);
UI
.
setViewClip
(
true
);
}
}
}
}
},
},
...
...
vnc.html
View file @
8f3c0f6b
...
@@ -99,6 +99,9 @@
...
@@ -99,6 +99,9 @@
<input
type=
"image"
alt=
"Clipboard"
src=
"images/clipboard.png"
<input
type=
"image"
alt=
"Clipboard"
src=
"images/clipboard.png"
id=
"clipboardButton"
class=
"noVNC_status_button"
id=
"clipboardButton"
class=
"noVNC_status_button"
title=
"Clipboard"
/>
title=
"Clipboard"
/>
<input
type=
"image"
alt=
"Fullscreen"
src=
"images/fullscreen.png"
id=
"fullscreenButton"
class=
"noVNC_status_button"
title=
"Fullscreen"
/>
<input
type=
"image"
alt=
"Settings"
src=
"images/settings.png"
<input
type=
"image"
alt=
"Settings"
src=
"images/settings.png"
id=
"settingsButton"
class=
"noVNC_status_button"
id=
"settingsButton"
class=
"noVNC_status_button"
title=
"Settings"
/>
title=
"Settings"
/>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment