GTK-VNC has native support for remote desktop resize, provided that we
always give the widget the full available allocation. This requires that
we turn off VirtViewerDisplay's code for keeping aspect ratio, and
instead enable GTK-VNC's equivalent.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
When the VirtViewerDisplay class resizes the child display widget, it
attempts to preserve the remote desktop aspect ratio. This is useful in
general, if the display widget can't do this itself. The implication,
however, is that VirtViewerDisplay also has to take ownership of the
remote framebuffer resize functionality.
It is thus useful to disable VirtViewerDisplay's aspect ratio
preservation when the display widget can do this natively, as it can
then also do desktop resizes natively.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Currently the GActionMap is registered during the application
startup. This takes place after the command line args are processed,
so prevents the CLI processing from using actions.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Normally we will honour the server requested behaviour for cursor,
either letting the server render it directly, or locally rendering
a cursor that the server provided us.
There are times, however, where the server does the wrong thing. For
example it might tell us to render an empty cursor, leaving the user
with no visible cursor at all. In this case it can be helpful to ignore
what the server requests, and always display the default local cursor.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
SPICE provides a number of VM actions, but they are only supported if
the QMP tunnel is available. VNC doesn't currently support any, but
in future it will support some.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This ensures that the application exits when the user presses Ctrl-C
while an auth dialog is open.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This improves the UI for the password auth box by using an inline icon
for showing/hiding the password text. This is the UI pattern uses by
GNOME shell and other GTK applications.
The two svg files added here are copied from the GTK4 codebase which
is under the LGPLv2+.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
If you press Ctrl-C while the auth dialog is active it gets ignored
because calling g_application_quit() won't break out of the model
g_dialog_run() call.
By removing the SIGINT handler after first firing, we can at least let
the user press Ctrl-C a second time to force quit.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Gtk uses the application ID to lookup resource entries compiled into the
application. The application ID must match the path in the gresource.xml
file for this to work correctly.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Without gtk-vnc we get implicit function declaration for
VIRT_VIEWER_IS_SESSION_VNC. Introduced at 8bc91ac "session: remove
"session-error" signal" in 2021-02-18
As we are already using #ifdef here, I've also changed the ternary to
an if for clarity.
Signed-off-by: Victor Toso <victortoso@redhat.com>
This enables the app to use the dark theme when running in environments
where a dark theme is available.
This is not done in Windows because the dark theme looks quite odd when
run on older versions of Windows where GTK can't replace the titlebars
by default.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
The header bar includes space for both a title and subtitle. By using
the latter for the ungrab hint, we avoid having such a long title.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
The user interface for the fullscreen toolbar is now identical to that
seen when non-fullscreen. All that differs is that the toolbar autohides
in fullscreen mode and doesn't expand to fill the window width.
There is a complication with the timed revealer and menus. With
traditional GtkMenus, it appears a grab is held as long as the menu is
open, so the revealer won't hide the toolbar. With modern GtkPopover
based menus, however, the revealer hides the toolbar despite the menu
being open, and thus in turn hides the menu.
This hacks around the problem by setting the header buttons to force use
of a traditional GtkMenu instead of a GtkPopover. It is not quite as
visually pretty, but at least it works.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This removes the main menu bar in favour of using the GtkHeaderBar with
integrated bars. This reduces the amount of vertical screen real estate
consumed by the application, leaving more for the guest display. The new
buttons are laid out to make the more common actions available with a
single click.
The buttons are grouped into two sets. On the left hand side of the
header are buttons that are interacting with the server
- Send key
- USB device selection
- Monitor selection and VM pause/shutdown
whle on the right hand side are buttons interacting with the local user
interface
- Fullscreen
- Preferences / About / Guest detail / zoom level
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
The machine pause/reset/powerdown and smartcard insert/remove operations
can implemented directly by the application class as they require no UI.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
The first time this method is called we know that
usb_device_reset_accel_valid will be FALSE.
The other times this method is called all pass override=TRUE.
Thus the conditional test in virt_viewer_set_usb_device_reset_accel
always evaluates to TRUE and thus can be removed.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
If the VncDisplay emits a signal and the VirtViewerSessionVnc
instance is no longer valid, using the pointer inside one of the
callbacks can lead to segfault.
To prevent that, use g_signal_connect_object instead of
g_signal_connect.
Related:
https://bugzilla.redhat.com/show_bug.cgi?id=1911224
Signed-off-by: Jakub Janků <jjanku@redhat.com>
This partially reverts commit de5cd71.
Problem with that commit is, that it practically renders
the "session-auth-*" signals from vnc session useless.
That's because gtk-vnc currently emits "vnc-error" before each
"vnc-auth-*" signal and the error callback in virt-viewer-app.c
calls virt_viewer_app_disconnected(), which in turn closes
the session.
As a consequence, virt-viewer never retries authentication
with vnc, it simply exits.
Since the last commit, vnc, similarly to spice, emits
"session-disconnected" with the appropriate error message. Thus
there's no need to maintain separate "session-error" signal
for now.
With vnc, this error message is shown to the user in a dialog,
if the disconnect happened during the init phase.
"session-auth-*" callbacks create their own dialogs, so
initialized must be set to TRUE to avoid having a dialog
displayed twice.
Related:
https://bugzilla.redhat.com/show_bug.cgi?id=1911224
Signed-off-by: Jakub Janků <jjanku@redhat.com>
"vnc-error" is always followed by "vnc-disconnected".
So save the error message and use it in "vnc-disconnected" callback.
"session-disconnected" already allows us to set a string
with details on why the disconnection happened.
This approach is also similar to the one in spice session
(GError is saved in virt_viewer_session_spice_channel_destroyed).
Signed-off-by: Jakub Janků <jjanku@redhat.com>
Instead of repeating an emacs footer in every source file, use config
files in the root of the repository. This fixes the bug that several
source files are missing the indent rules.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>