We now display the current ISO as subtitle on the HeaderBar. On the
glade UI file, we get rid of the GtkAlignment object that was used to
put some space between the tree view and dialog buttons. The "Select
ISO" label is gone too.
Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
With the possibility of having ISO images in storage domains of DATA
type, we need to store the id of the object as well as its name. This is
not the case with ISO storage domains, which only hold the name of the
image. This patch makes it possible to use deal with both types
transparently for the user.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1835640
Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
This function only existed to make use of glib compat, now that we
require a version of glib that already exports the symbol, the call is
not required anymore.
Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
The '-r' shortcut was alread used for '--reconnect' in virt-viewer.
The --auto-resize arg is a fairly niche use case so doesn't really
need a shortcut.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This is implemented by switching from GTK accelerators to using the
display's grab sequence handling when a modifier-only hotkey is
configured.
Signed-off-by: Paul Donohue <git@PaulSD.com>
Previously, virt_viewer_update_smartcard_accels() and
virt_viewer_update_usbredir_accels() needed to be called after
configuring hotkeys and before any smartcard/usbredir devices were
connected in order to properly configure the hotkeys. However, those
were not called if hotkeys were configured via the config file.
In addition, the code did not support reconfiguring hotkeys after
devices were connected, which could cause future problems, eg. if a GUI
is added to support reconfiguring hotkeys.
Signed-off-by: Paul Donohue <git@PaulSD.com>
This is mostly just code de-duplication and cleanup. The only
functional change is that the case-sensitive accel support from the
command-line hotkey handling now also applies to the config file.
Signed-off-by: Paul Donohue <git@PaulSD.com>
"win.<action>" and "app.<action>" were mixed up in a few places.
Smartcard actions use "app" and other actions use "win".
Signed-off-by: Paul Donohue <git@PaulSD.com>
Since glib >= 2.69 we get warnings:
../src/ovirt-foreign-menu.c: In function 'ovirt_foreign_menu_next_async_step':
../src/ovirt-foreign-menu.c:319:13: error: Not available before 2.60 [-Werror]
319 | G_GNUC_FALLTHROUGH;
| ^~~~~~~~~~~~~~~
../src/ovirt-foreign-menu.c:345:13: error: Not available before 2.60 [-Werror]
345 | G_GNUC_FALLTHROUGH;
| ^~~~~~~~~~~~~~~
../src/ovirt-foreign-menu.c:351:13: error: Not available before 2.60 [-Werror]
351 | G_GNUC_FALLTHROUGH;
| ^~~~~~~~~~~~~~~
../src/ovirt-foreign-menu.c:357:13: error: Not available before 2.60 [-Werror]
357 | G_GNUC_FALLTHROUGH;
| ^~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
GLib is right to warn about this, since it does not know that we
provided our own back-compat definition of the macro. For now we have to
temporarily purge glib's macro entirely in order to get rid of the
warning that is bogus for our usage.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
The desktop-width / desktop-height properties are set to have a min
valid value of 320x200, and this also matches the minimum window
dimensions reported to GTK.
In practice when a guest restarts, spice can report width/height
values smaller than this
(virt-viewer:9359): GLib-GObject-WARNING **: 12:57:05.556: value "64" of type 'gint' is invalid or out of range for property 'desktop-width' of type 'gint'
(virt-viewer:9359): GLib-GObject-WARNING **: 12:57:05.556: value "64" of type 'gint' is invalid or out of range for property 'desktop-height' of type 'gint'
There is not an obvious need to enforce this minimum on the properties,
as the window dimension sizing will do the right thing regardless.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
When the last window is closed we optionally show a confirmation dialog
to check if user wants to quit. If the user cancels, we need to ensure
the display menu state gets set back to checked.
We called g_action_change_state correctly, but a later call to
g_simple_action_set_state used the "visible" variable which was not
correctly reset back to TRUE upon cancel.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
If authentication fails we reshow the same authentication dialog box
again. Rather than leaving the previous incorrect information in the
text entry boxes we need to clear them.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
My clang version 11.0.0 (Fedora 11.0.0-2.fc33) complains:
../src/virt-viewer-app.c:610:9: error: variable 'keymaps' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
if (keymap_string) {
^~~~~~~~~~~~~
../src/virt-viewer-app.c:614:10: note: uninitialized use occurs here
if (!keymaps || g_strv_length(keymaps) == 0) {
^~~~~~~
../src/virt-viewer-app.c:610:5: note: remove the 'if' if its condition is always true
if (keymap_string) {
^~~~~~~~~~~~~~~~~~~
../src/virt-viewer-app.c:595:27: note: initialize the variable 'keymaps' to silence this warning
gchar **key, **keymaps, **valkey, **valuekeys = NULL;
^
= NULL
1 error generated.
Initialize the variable to fix the uninitialized use.
Signed-off-by: Ján Tomko <jtomko@redhat.com>
The gtk_accelerator_parse code is case sensitive when resolving key
names, however, the spice_hotkey_to_gtk_accelerator method converts
everything to uppercase. The latter allows the user to provide "f"
as the key and get it converted to "F" which matches a GDK key name.
The latter breaks for most other keys though, eg "comma" is required
to be all lowercase and "Menu" must have the initial capital.
To cope with this we try the gtk_accelerator_parse call twice, once
with the spice munged key name for back compat, and once with the
exact user specified key name.
https://gitlab.com/virt-viewer/virt-viewer/-/issues/30
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
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>