Commit Graph

520 Commits

Author SHA1 Message Date
Pierre Ossman 262a90b0e0 Consistently use "first" indentation
We already enforced this for most things, so let's fix up the last few
variants as well.
2022-12-27 12:50:57 +01:00
Pierre Ossman 7f4a9eebc8 Export clipping state externally
So that UI can reflect if it is currently possible to drag the viewport
or not.
2022-12-27 12:50:57 +01:00
Samuel Mannehed 820b39c7d3 Reinstate outer div of noVNC_connect_button
There were two issues with removing the outer div of the connect button.

Firstly, rounded outlines don't work in WebKit browsers like Safari or
Epiphany (https://bugs.webkit.org/show_bug.cgi?id=20807) and this makes
the outline look completely square.

Secondly the code became too complex.

This reverts most of commit 05baf14256.
2022-12-23 13:44:58 +01:00
Samuel Mannehed 2b449b208e Get rid of WebKit's button top margin
It conflicts with our :active styling since it changes margin-top.
2022-12-23 13:44:57 +01:00
Samuel Mannehed 6e1d842850 Use an ICO file for favicons
The browsers have been choosing very poorly and have a lot of bugs when
it comes to favicons. Using an ICO makes many browsers choose better in
most cases. Most large websites use ICO files.

The icons in the ICO file needs to be ordered largest to the smallest
icon, and due to a Chrome bug we are limited to 8 icons. This
unfortunately means we couldn't fit one of the Android sizes. The 72x72
icon was removed since testing showed that it was used the least.
2022-12-23 09:05:12 +01:00
Samuel Mannehed 139f087187 Explicitly specify icon size instead of density
Instead of calculating a density that we hope results in the correct
size, we can specify what size we want. This is more robust and easier
to understand. This also allows us to simplify the Makefile quite a bit.

Note that Fedora's packaging of ImageMagick has a bug here:
https://bugzilla.redhat.com/show_bug.cgi?id=2140018
2022-12-23 09:05:12 +01:00
Samuel Mannehed 416e21151b Create specific apple-touch-icons
These icons shouldn't have any transparancy. Instead, we remove the
rounded corners and let iOS handle that.
2022-12-23 09:05:12 +01:00
Samuel Mannehed 9e9d5ef17d Simplify names of favicons
All of the icons are square, only providing the size in one direction is
enough. This change lets us avoid some unnecessary complexity in the
Makefile.
2022-12-22 16:50:11 +01:00
Samuel Mannehed c8d37ae8bd Provide up to date set of apple-touch-icons
Apple requires a different set of icons now-a-days. This change involves
removing the 76x76 icon and adding icons with the following sizes;
40, 58, 80, 87, 167 and 180.
2022-12-22 13:15:25 +01:00
Samuel Mannehed 9649b8ee25 Remove duplicate 48 icon from Android sizes
This size is already specified under BROWSER_SIZES.
2022-12-22 13:04:03 +01:00
Samuel Mannehed 034fd376ac Simplify icon variables by removing the filename
The filename is the same for all of these, lets break out that part to
simplify things.
2022-12-22 11:29:10 +01:00
Samuel Mannehed 99a9c03f3c Rename browser icon variable to reflect use
The other variables in the Makefile are named according to how the icons
are used, lets do the same for the variable for the browser icons.
2022-12-22 11:13:20 +01:00
Samuel Mannehed ec45911456 Don't show virtual keyboard button in webkit
Webkit browsers don't support Media Queries 4, which means we have to
use a slightly convoluted syntax when writing "@media not...". Otherwise
the "(any-pointer: coarse)" part evaluates as the device part of the
query.
2022-12-22 10:22:34 +01:00
Samuel Mannehed 4fb2d6c497 Add FIXME for virtual keyboard button on touch
The way we decide whether to show the keyboard button or not is not
ideal, let's add a FIXME for that.
2022-12-15 14:33:12 +01:00
Samuel Mannehed d8b3ec99fa Use "initial" for displaying handle touch area
Our intentions are clearer if we set "display" to "initial" rather than
"unset" when we want to enable the touch area for the control bar
handle.
2022-12-15 14:09:56 +01:00
Samuel Mannehed 05baf14256 Remove outer div from noVNC_connect_button
Instead of having an outer "box", we can use an outline on the button
itself to create this "platform". Since the outline isn't part of the
size of the element, it will appear wider than before, when compared to
the logo. To counteract that we remove the left and right padding from
the logo to make the entire noVNC_connect_dlg more narrow.

We also had to slightly adjust the :active style since we don't want the
entire "platform" to move when the button is clicked.
2022-12-15 10:44:27 +01:00
Samuel Mannehed f1550c69d9 Get rid of noVNC_touch in favor for @media queries
This commit removes our dependency on the class "noVNC_touch" which was
set by Javascript. Instead, we can use the CSS media query
"any-pointer: coarse", which means that any pointing device that isn't
accurate is available. In practice this seems to basically be equal to
that a touch screen is available.

This change lets us simplify the selectors in many cases as well, which
is a nice bonus.
2022-12-14 14:06:16 +01:00
Samuel Mannehed 6d7d45ba08 Ensure arrow doesn't change on disabled <select>
We can't just modify the CSS variable here, since that is also used in
the style for :disabled. We need to change the entire "background-image"
in order for :disabled to be able to override it.
2022-12-14 13:58:49 +01:00
Samuel Mannehed f983c78d17 Make connect button a regular <button>
It is a button, let the HTML element reflect that. And instead of
having the outer div being clickable, lets only make the inner one
work like a button. Because of that, this commit renames the outer div
to "connect_box" instead of "connect_button".

Note that we remove the disabled :hover-effect for touch on this button.
It doesn't make much difference since this button is one of a kind.
2022-12-14 13:28:27 +01:00
Samuel Mannehed 1ff035c330 Add comment explaining the handle touch area 2022-12-14 11:18:46 +01:00
Samuel Mannehed 333e075d7b Get rid of Chrome's blue touch tap highlight
When tapping our buttons using a touch screen in Chrome, we get an ugly
blue overlay. Let's remove this since we have our own :active styles.
2022-12-13 15:38:25 +01:00
Samuel Mannehed 6e1eec3025 Separate the disabling of :hover for touch
This is a corner case which shouldn't need to complicate things for the
regular usecases.
2022-12-13 15:23:31 +01:00
Samuel Mannehed 98364c3daa Use the same background gradient on all buttons
Before, we have had two different gradiant versions, one where the two
colors meet in the middle, and one where only the top part of the
element was the darker shade. This was easily missed. Let's standardize
on the latter alternative. This commit introduces a variable to make it
easier.
2022-12-13 14:43:03 +01:00
Samuel Mannehed 837cc75a8c Add FIXME for select:active on Firefox
The :active state is only active in Firefox during the click on the
<select>, not while the dropdown is opened, like in Chrome.
2022-12-13 14:01:24 +01:00
Samuel Mannehed d083ba269e Buttons shouldn't react to clicks when disabled
Counteract the border-width and margin set by :active in the rules for
:disabled buttons.
2022-12-12 15:35:36 +01:00
Samuel Mannehed 69c1d8a1b9 Add section comments to input.css
Makes stuff easier to find.
2022-12-12 15:32:07 +01:00
Samuel Mannehed b676122642 Simplify :focus-visible & :disabled selectors
Since these were the same for all <input> types now, we can omit the
type from the selector.
2022-12-12 15:31:00 +01:00
Samuel Mannehed 9107ae3a10 Share some properties between all input elements
Some properties, like 'font', 'appearance', and 'color' are shared
between all our input elements. Let's reflect that in our rules.
2022-12-12 15:31:00 +01:00
Samuel Mannehed 8c1b6e19c7 Combine rules for buttons in input.css
It was completely unnecessary that these two were separate, lets combine
them. The only difference was that the lower rule didn't apply for
<select>. That doesn't matter though, since padding-left and
padding-right are specifically set for <select> elements anyway.
2022-12-12 15:31:00 +01:00
Samuel Mannehed 3cf2bb9b59 Change arrow direction of active select button
When the select-dropdown is open, let's use an arrow pointing upwards
isntead. Note that we can't easily animate the change in
background-image.
2022-12-12 15:31:00 +01:00
Samuel Mannehed 80897091e0 Put all styling for selected buttons in one place
Let's not have the rules for noVNC_selected spread out.
2022-12-12 15:31:00 +01:00
Samuel Mannehed 36510f7d16 Clarify comment about hover state on touch devices 2022-12-12 15:31:00 +01:00
Samuel Mannehed cc703babcb Remove duplicate opacity for :disable
The control bar buttons can fall back on the :disable opacity from
input.css.
2022-12-12 15:31:00 +01:00
Samuel Mannehed da4f3f30ea Move workaround for Firefox bug to input.css
This applies to all input[type=image]:disabled elements, not only
control bar buttons.
2022-12-12 15:31:00 +01:00
Samuel Mannehed 654066f2c4 Be more specific for control bar button background
Use the more specific background-color, and background-image properties
when setting the state backgrounds for the control bar buttons. This way
we no longer pollute all background related properties. It makes things
easier if we need to replace them in some states in the future.
2022-12-12 15:31:00 +01:00
Samuel Mannehed 4050f0e248 Break out properties for disabled buttons
Instead of marking the hover selector with ":not(:disabled)" we can
break out this into its own section. This makes things easier to read.
In order to ensure the correct selector prioritization we also reorder
the file a bit.
2022-12-12 15:31:00 +01:00
Samuel Mannehed 629a6cacb9 Add styling for input[type=file] elements
The last remaining input element we didn't have styling for (aside from
input[type=hidden] which can't be shown).
2022-12-12 15:30:02 +01:00
Samuel Mannehed 63528570bc Respect standard font settings for buttons as well
This should not only be done for input, select and textareas.
2022-12-12 14:50:14 +01:00
Samuel Mannehed 80ea7e17ec Add styling for radio buttons
One of the few remaining items we didn't have styling for.
2022-12-12 14:50:14 +01:00
Samuel Mannehed 564a89bcb9 Add small margin to the right of checkboxes
Makes things look less cramped.
2022-12-12 14:50:14 +01:00
Samuel Mannehed a714e1b003 Add small animation for checkboxes
Makes it look quite nice.
2022-12-12 14:50:14 +01:00
Samuel Mannehed fa8ff5e09d Set checkbox size using px rather than em
We don't set other sizes using em, it makes this stand out.
2022-12-12 14:50:14 +01:00
Samuel Mannehed 7519f2d4ad Set a white background-color on checkboxes
Otherwise they appear with the same color as the background, which is
not what we want. They should always be white.
2022-12-12 14:50:14 +01:00
Samuel Mannehed faf921b023 Set background gradients using background-image
Use the more specific background-image property when setting
linear-gradient backgrounds for input elements. This way we no longer
pollute all background related properties. It makes things easier if we
need to replace it in some states in the future.
2022-12-12 14:50:14 +01:00
Samuel Mannehed 2ff09d6f10 Unify element's :disabled styles to use opacity
Some elements used grey text and background when disabled, and some used
opacity. It looked a bit old school to make the elements grey when
disabled. Let's use opacity for all input elements when disabled.
2022-12-12 14:50:14 +01:00
Samuel Mannehed 1e500883f6 Move <select>:hover to other hover styles
Lets keep this file organized.
2022-12-12 14:50:14 +01:00
Samuel Mannehed 86adcdd3a3 Reorder selectors alphabetically in input.css 2022-12-12 14:49:52 +01:00
Samuel Mannehed 9c13ea3dd2 Use a outline instead of border for focus-visible
This is the more common way to do it, and allows us to use a offset.
2022-12-07 15:15:07 +01:00
Samuel Mannehed ac6adc61d5 Replace :focus styling with :focus-visible
Use the new modern :focus-visible instead of :focus. This is only shown
when navigating using the keyboard.

And in the case of the control bar buttons, This means we can separate
the :focus and :hover styles. Instead of showing a lighter overlay (or
darker for selected) like we use for hover, lets use a more common
blue outline for focus-visible. This also means we can re-use the common
focus-visible from input.css instead of having a special one for control
bar buttons.
2022-12-07 15:15:07 +01:00
Samuel Mannehed 8c961ab7c6 Add styling for input[type=range]
This makes them fit in better in our settings GUI, especially when it
comes to coloring.
2022-12-07 15:15:07 +01:00
Samuel Mannehed f820ec86f0 Add styling for checkboxes
This makes them fit in better in our settings GUI, especially when it
comes to coloring.
2022-12-07 14:52:15 +01:00
Samuel Mannehed c43e499357 Include input[type=image] in input.css
There's no real reason this shouldn't be in here, lets include it.
2022-12-07 11:16:06 +01:00
Samuel Mannehed 52178e9381 Set min-height on control bar panel 2022-12-07 08:56:21 +01:00
Samuel Mannehed 2d6302e359 Tone down comment about user-select on container
The issue with the selection prior to the fix can't be reproduced to
the same degree. It may have been some other bug that caused interaction
with the remote to be blocked.
2022-11-17 10:14:30 +01:00
Samuel Mannehed fc5bb6dab6 Add "arrow" to <select> elements
Since we are setting "appearance: none" on our <select> elements, the
drop down arrow from the browser is hidden. This arrow doesn't fit in
visually though. This commit adds a new arrow from a simple data url
SVG. Its a dark triangle "pointing" downwards.

Note that we need to set the background to both the gradient and the
image here. Both use the "background-image" property for the graphic,
but since they are positioned differently we must use the general
"background" shorthand.
2022-11-17 08:34:50 +01:00
Samuel Mannehed 4a0999a34e Slightly increase the padding on <select> elements
Our select elements look more like buttons than they look like text
inputs, this means we should use slightly larger padding.
2022-11-16 16:46:17 +01:00
Samuel Mannehed 2825529a13 Add horizontal rule after logo in control bar
This differentiates the logo from the buttons in a clear way.
2022-11-14 17:08:54 +01:00
Samuel Mannehed 0cb5f2341c Fix indentation of comment in CSS 2022-11-11 10:23:10 +01:00
Samuel Mannehed 429a08da89 Make control bar button selectors more specific
The class "noVNC_button" is only used for control bar buttons. Lets
clarify this in the CSS selectors by only applying styles to elements
with this class that are children of "#noVNC_control_bar".
2022-11-11 10:15:55 +01:00
Samuel Mannehed 081f9d2a13 Disable iOS long-press popup for sidebar images
In order to make the sidebar feel more like a GUI element from a real
application, we can disable the long-press image popup on iOS. Note that
this only has an effect on iOS devices.
2022-11-02 16:38:12 +01:00
Samuel Mannehed 7e29e02ce4 Prevent accidental selection of the container
When long pressing stuff in the sidebar on iOS, you can sometimes
accidentally select the container or the canvas. This results in a
broken state where the user can't interact with the session anymore.
This commit prevents this from happening.
2022-11-02 16:36:50 +01:00
Samuel Mannehed 584ce06698 Disable selection globally on sidebar
We want to disable selections in the sidebar because when users drag
the handle, they could otherwise accidentally select stuff. This results
in a very broken state.

When selections are disabled, the sidebar also feels more like a GUI
element from a real application, and less like part of a webpage.
2022-11-02 16:22:54 +01:00
Samuel Mannehed 0ef75824a4 Ensure the correct cursor on disabled buttons
Without this fix we still get a "pointer" cursor on disabled inputs of
type "image" in Firefox. Currently, all our noVNC_buttons are
<input type="image">. Reported to firefox here:

https://bugzilla.mozilla.org/show_bug.cgi?id=1798304
2022-10-31 13:13:23 +01:00
Samuel Mannehed 138df46825 Remove unnecessary legacy CSS properties
We depend un such modern things anyway, having these kinds of properties
are more confusing than helpful. Let's not give the impression that we
make any attempt to work in old browsers.
2022-10-31 10:44:01 +01:00
Samuel Mannehed 5c684cce2a Change default dimensions of clipboard textarea
Make it slightly taller and not as wide, this makes it stand out less
compared to the other panels.
2022-10-28 16:15:35 +02:00
Samuel Mannehed d3913c0dde Limit webaccess clipboard textarea min width
The clipboard textarea could potentially shrink further than what was
possible for the header text elements, which looked a bit broken. In
that regard, a min width is introduced for the textarea.
2022-10-28 16:12:29 +02:00
Samuel Mannehed 82253c1f1a Don't let the clipboard textarea grow too high
There are scrollbars inside the textarea in case there's a lot of text
in there. We can limit the height of the element, it looks better.
2022-10-28 16:06:34 +02:00
Samuel Mannehed f0fea1fccd Fix max-width of clipboard textarea
It should not be able to "eat" its parent-panel's padding. By setting
box-sizing: border-box we can prevent this.
2022-10-28 16:04:45 +02:00
Samuel Mannehed 6b2357061e Use border-box for noVNC panels
If we use box-sizing: border-box we can avoid having to account for the
padding when calculcating the max-width.
2022-10-28 16:04:06 +02:00
Samuel Mannehed dd713bee63 Set max-width on all noVNC panels
All panels should be limited in this way, not just the clipboard panel.
One additional upside of this is that the numbers used to calculate the
max-width are closer by, in the code. This hopefully makes it easier to
avoid mistakes in the future.
2022-10-28 15:54:28 +02:00
Samuel Mannehed f59be0586f Move control bar hint outside of the control bar
Makes it a more independent element responsible for it's own positioning
and vertical centering. This makes the hint easier to adapt for external
CSS styles and makes it possible to remote the fixed size if needed.
2022-10-24 15:29:27 +02:00
Samuel Mannehed 3141c0e01b Only show the control bar hint once per "move"
After the user has "followed" the hint by dragging the handle to the
other side, the control bar will switch to that side. Once this has
happened, we will now hide the hint until the user starts over by
dragging the handle again.
This change was added to make the hint feel more like a "hint" and less
like a permanent GUI element. It isn't as persistent and intrusive now.

Note that we don't want the act of hiding the hint to result in a
transition animation here.
2022-10-24 13:03:50 +02:00
Samuel Mannehed 8715ed9e70 Match touch area height with height of handle
Instead of hard coding the height of this touch area we can just use
its parent's height.
2022-10-14 18:13:19 +02:00
Samuel Mannehed f0c3af3c67 Move <input> and <button> styles to its own file
This makes it easier for integrators of vnc.html to write their own
input and button styles.
It's also positive to cut a bit off from the size of the large base.css.
2022-10-14 11:27:42 +02:00
Pierre Ossman 88ccfdc193 Clean up control bar padding/margins
Try to make it a bit less messy by trying to get more general rules in
place.
2022-10-13 16:20:28 +02:00
Samuel Mannehed 9761278df8 Style <button> the same as <input type="button">
These styles are meant to be complete, that we didn't have a style for
<button> was a mistake.
2022-10-13 10:25:36 +02:00
Samuel Mannehed 9a6e0d47d0 Rename CSS section to better reflect contents
These buttons only exist in the control bar.
2022-10-12 16:50:28 +02:00
Samuel Mannehed 145d235094 Make error handler's focus changes best-effort
When the error handler itself causes an exception, it falls back to a
simple document.write(). This means the proper error dialog isn't shown
when this happens.

The focus changes that were added to the error handler in e1f8232b are
not crucial for its function. If these focus changes causes an exception
we can just ignore that.
2022-10-12 13:01:23 +02:00
Samuel Mannehed 4ecb44111d Check if activeElement exists before using it
According to MDN, document.activeElement can be null if there is no
focused element.
2022-10-12 12:39:49 +02:00
Pierre Ossman bdc0bbbb4f Respect font settings on input elements
The browsers override these instead of using the normal inheritance. So
make sure our global font settings are respected.
2022-10-11 13:51:57 +02:00
Pierre Ossman a8488d5b32 Add more air to settings panel
We want some space between elements to avoid things getting cramped, so
add some minimal margins.
2022-10-11 13:50:40 +02:00
Pierre Ossman f887abdb38 Increase input element padding
The text gets a bit cramped otherwise. Extra so at larger font sizes.
2022-10-11 13:50:09 +02:00
Pierre Ossman a1e11e6d00 Stop setting margin on input elements
Margins behave badly on inline elements, so let's try to avoid using
them. Margins should be handled by the block elements anyway.
2022-10-11 13:49:11 +02:00
Pierre Ossman 615b36a067 Handle crash dialog overflow better
Avoid making assumptions on how much space is available for the stack
dump, and instead handle the overflow on the top element.
2022-10-11 13:47:53 +02:00
Samuel Mannehed 6f55527514 Fix typo in fallback_error CSS comment
Typo from commit e1f8232bc9
2022-10-07 15:24:11 +02:00
Samuel Mannehed e1f8232bc9 Block user interaction when fallback error shows
When this error is shown, something has gone very wrong. It shows when
a bug in the JavaScript causes an uncaught error. In these scenarios we
dont want the user to be able to interact with the GUI or the remote
session, since we can't guarantee that things work.
2022-10-07 14:55:00 +02:00
Samuel Mannehed 58dfb7df45 Don't react to interactions with disabled buttons
Disabled buttons should not change appearance on mouse hover, click or
on keyboard focus. Doing so destroys the "disabled" impression.
2022-10-04 15:47:25 +02:00
Pierre Ossman c101a31520 Don't use explicitly Helvetica
On many systems you get a poor substitute, so let's instead instruct the
browser that we merely want a sans serif font for our interface.
2022-09-23 13:59:39 +02:00
Pierre Ossman 1a101443a7 Set font family on root element
This is a very global setting, so let's put it on the top node for
clarity.
2022-09-23 13:58:50 +02:00
Pierre Ossman af10b0c5e4 Avoid using translate() for positioning
It often results in a blurry result on WebKit based browsers.
2022-09-16 13:18:06 +02:00
Pierre Ossman 32f9033863 Document state classes uses in CSS
Makes it a bit easier to understand all the magic in this CSS.
2022-09-15 10:39:21 +02:00
Pierre Ossman efb2400833 Merge branch 'italian' of https://github.com/M2Rbiz/noVNC 2022-09-14 10:36:27 +02:00
Samuel Mannehed 69e0f0f5db Remove unnecessary clipboard clear button
This button fills no real purpose. It's easy to mark everything and
delete with either "Ctrl + A -> Delete" or, on touch devices, "long
press -> mark everything -> Delete".
2022-09-09 16:03:49 +02:00
Fabio Fantoni 5d8ede61f9
Add italian translation 2022-09-08 14:56:04 +02:00
James Kinsman faedcd0210
Allow continued reconnect tries
Currently novnc will only retry once (assuming the server is unavailable) and then stop (as the detail from is unclean, usually "failed to connect"). Minor change will continue to reconnect every reconnect_delay seconds until either reconnected or user intervention cancels the attempt.
2022-08-08 14:22:41 +01:00
Pierre Ossman cdfb336651 Add warnings about insecure context
Most (all?) new APIs will require a "secure context", which generally
means served over TLS. We can expect crashes because of missing
functions if this requirement isn't fulfilled, so try to warn the user.
2022-05-12 15:48:46 +02:00
Pierre Ossman da623156d3 Adjust wording and style of server verify dialog
Try to be a bit more verbose about what this dialog means and what the
user should do.
2022-03-10 16:29:24 +01:00
Pierre Ossman 15a0608e04 Make sure server verification dialog is closed
It should be closed at this point just like all other dialogs and
panels.
2022-03-10 16:28:15 +01:00
Pierre Ossman ced6431ac5 Make credentials rules more specific
This was a very broad selector, so it does not belong in a specific
section like this. Do what all similar rules do and make it very
targeted.
2022-03-10 16:27:17 +01:00
Pierre Ossman a73b5acfbb Stop abusing lists for dialogs
Use some more sane elements for these things.
2022-03-10 16:26:38 +01:00