Commit Graph

1063 Commits

Author SHA1 Message Date
Daniel P. Berrangé
24bf4c998d src: switch to use G_GNUC_FALLTHROUGH macros
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-01-22 16:14:40 +00:00
Daniel P. Berrangé
45dd26ece2 src: add missing COMMON_CFLAGS to libvirt_viewer_util.la
This ensures that G_LOG_DOMAIN is used in all places, and in turns
highlights a bug in the test suite.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-01-22 16:14:40 +00:00
Daniel P. Berrangé
0dab000823 src: remove use of 'volatile' from enum type decl
This avoids warnings with latest glib/gcc

src/virt-viewer-enums.c: In function ‘virt_viewer_display_show_hint_flags_get_type’:
/usr/include/glib-2.0/glib/gatomic.h:112:5: error: argument 2 of ‘__atomic_load’ discards ‘volatile’ qualifier [-Werror=incompatible-pointer-types]
  112 |     __atomic_load (gapg_temp_atomic, &gapg_temp_newval, __ATOMIC_SEQ_CST); \
      |     ^~~~~~~~~~~~~
/usr/include/glib-2.0/glib/gthread.h:260:7: note: in expansion of macro ‘g_atomic_pointer_get’
  260 |     (!g_atomic_pointer_get (location) &&                             \
      |       ^~~~~~~~~~~~~~~~~~~~
src/virt-viewer-enums.c:34:7: note: in expansion of macro ‘g_once_init_enter’
   34 |   if (g_once_init_enter (&g_define_type_id__volatile))
      |       ^~~~~~~~~~~~~~~~~

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2021-01-22 16:14:40 +00:00
Uri Lublin
74fdd26c94 vnc: no dialog for server-closed-connection error
Following commit de5cd71, when the server closes the connection
(likely when qemu-kvm exits), a dialog is shown to the user.

This behavior change is not good for automatic tests that expect
virt-viewer to exit without any dialog.

This patch makes sure no dialog is shown for this error, by
checking if the VNC connection was already initialized.

Signed-off-by: Uri Lublin <uril@redhat.com>
2021-01-18 22:48:47 +02:00
Uri Lublin
7c442b60b3 zoom hotkeys: disable numpad when users set new hotkeys
If a user sets any hotkey, disable numpad hotkeys.
If a user does not set any hotkey and the default hotkeys
are enabled, then numpad hotkeys are enabled too.

This is a folloup for commits a40c8f4 and e89e82e + 8cc0667.
Currently setting (e.g. ctrl [123]) hotkeys for zoom (in/out/reset),
re-enable the default numpad hotkeys (ctrl [+-0]).

Related to: https://bugzilla.redhat.com/show_bug.cgi?id=1791261

Suggested-by: Jakub Janků <jjanku@redhat.com>
Signed-off-by: Uri Lublin <uril@redhat.com>
2021-01-12 12:13:05 +00:00
Uri Lublin
8cc0667023 hotkeys: enable setting zoom hotkeys from a vv file
Signed-off-by: Uri Lublin <uril@redhat.com>
2021-01-05 11:06:19 +02:00
Uri Lublin
e89e82eeb9 hotkeys: enable setting zoom hotkeys from command line
Signed-off-by: Uri Lublin <uril@redhat.com>
2021-01-05 11:06:19 +02:00
Jakub Janků
c3a3f23968 disable default grab sequence in kiosk mode
Hotkeys should be disabled in kiosk mode. However, if no
"release-cursor" hotkey is specified, the default Ctrl+Alt
grab sequence keeps functioning even in kiosk mode.
That's because it's based on the spice/vnc functionality instead
of on the accelerators in virt-viewer.

That's especially problematic with spice, because the grab
sequence releases both the cursor and the keyboard. Thus the user
can escape from kiosk mode by pressing Ctrl+Alt followed by
Alt+Tab, for example.

Related: https://bugzilla.redhat.com/show_bug.cgi?id=1893584

Signed-off-by: Jakub Janků <jjanku@redhat.com>
2021-01-04 13:33:34 +00:00
Jakub Janků
a40c8f4508 windows: fix nonuniform behavior of zoom hotkeys
If a vv file is used or the hotkeys are customized using the
--hotkeys cmd option, all hotkeys that are not explicitly
requested get disabled, this includes the zomm hotkeys.

As a consequence, the labels for zoom actions in the menu
disappear. However, the user can still perform these actions
using the keys on the numpad which are handled separately.

To fix it, check that the normal zoom hotkeys are enabled
before enabling the keypad ones.

Related to: https://bugzilla.redhat.com/show_bug.cgi?id=1791261

Signed-off-by: Jakub Janků <jjanku@redhat.com>
2020-12-03 14:50:26 +01:00
Shawn M. Chapla
d5e96a30cb Don't re-enable kiosk mode in virt_viewer_window_show
There is nothing that would disable any aspect of kiosk mode that would
ever need to be enabled with a call to virt_viewer_window_show. To the
contrary, "re-enabling" kiosk mode in virt_viwer_window_show can, in
certain cases, result in accels becoming disable despite the keyboard
being released.

Signed-off-by: Shawn M. Chapla <schapla@codeweavers.com>
2020-11-26 19:48:21 +00:00
Shawn M. Chapla
cfcac9fb9d Add all accel groups when enabling window mods
Previously, enabling window modifiers would only add accel groups that
had presumably been disabled to the window in question. This was fragile
and caused bad behavior in cases when the criteria for whether or not an
accel group should be enabled changed between the time the groups were
disabled and re-enabled, potentially leading to certain groups never
being re-added. There is no harm in adding accel groups that are already
added to a window, so this change simply eliminates the unnecessary
check.

Signed-off-by: Shawn M. Chapla <schapla@codeweavers.com>
2020-11-26 19:48:20 +00:00
Shawn M. Chapla
6af952adb9 Disable all accels when not grabbed in kiosk mode
Signed-off-by: Shawn M. Chapla <schapla@codeweavers.com>
2020-11-26 19:48:20 +00:00
Shawn M. Chapla
f08cb607a4 Add "USB device reset" accel
Adds a "USB device reset" default keyboard shortcut (ctrl+shift+r), as
well as the option to override this shortcut with the --hotkeys opt.
Updates documentation accordingly.

Signed-off-by: Shawn M. Chapla <schapla@codeweavers.com>
2020-11-26 18:22:23 +00:00
Shawn M. Chapla
1608dabd9f Add "USB device reset" option to File menu
Adds a "USB device reset" option to the File menu. When selected, "USB
device reset" will disconnect and reconnect all currently connected USB
devices.

Signed-off-by: Shawn M. Chapla <schapla@codeweavers.com>
2020-11-26 18:22:23 +00:00
Frediano Ziglio
1573a790da Fix warning by Coverity
Error: DEADCODE (CWE-561): [#def1]
virt-viewer-9.0/src/virt-viewer-display-vte.c:164: assignment: Assigning: "scroll" = "NULL".
virt-viewer-9.0/src/virt-viewer-display-vte.c:188: null: At condition "scroll", the value of "scroll" must be "NULL".
virt-viewer-9.0/src/virt-viewer-display-vte.c:188: dead_error_condition: The condition "scroll" cannot be true.
virt-viewer-9.0/src/virt-viewer-display-vte.c:189: dead_error_begin: Execution cannot reach this statement: "gtk_container_add((GtkConta...".
virt-viewer-9.0/src/virt-viewer-display-vte.c:189: effectively_constant: Local variable "scroll" is assigned only once, to a constant value, making it effectively constant throughout its scope. If this is not the intent, examine the logic to see if there is a missing assignment that would make "scroll" not remain constant.

Reported in https://gitlab.com/virt-viewer/virt-viewer/-/issues/7.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
2020-11-26 10:26:02 +00:00
Daniel P. Berrangé
db827dedc9 Add a --shared / -s flag for shared session access
By default when connecting with VNC, an existing viewer will be kicked
off. This adds a --shared / -s flag which tells the server we are
willing the share the session with other clients.

This is wired up for VNC only.

https://bugzilla.redhat.com/show_bug.cgi?id=1060425

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-11-26 09:55:58 +00:00
Uri Lublin
de5cd71013 vnc: show an error dialog upon vnc-error
For example when connecting by accident to a spice server

Signed-off-by: Uri Lublin <uril@redhat.com>
2020-10-27 19:53:40 +02:00
Uri Lublin
d880ce4a40 about ui: year 2020 in Copyright
rhbz#1848267

Signed-off-by: Uri Lublin <uril@redhat.com>
2020-09-08 15:36:38 +03:00
Frediano Ziglio
28a330758f win32: Enable some additional security flags for Windows executables
Enable ASLR and NX options.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2020-08-27 15:02:49 +01:00
Haochen Tong
03f8a8ff5a virt-viewer-display: fix guest display size on HiDPI host
Signed-off-by: Haochen Tong <i@hexchain.org>
2020-08-19 20:11:13 +00:00
Pino Toscano
7f3317e578 VM selection: sort items
Even if the view has search capabilities built-in, show the VM names
sorted so it is easier to visually search for them.

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
2020-07-24 13:01:57 +00:00
Pino Toscano
4b7f2ac0ec Use VM descriptions if available
When listing the running VMs in a libvirt connection, use the
descriptions as tooltips if available.

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
2020-07-24 13:01:57 +00:00
Pino Toscano
e2abe953ed VM selection: expand models for tooltip column
Add a new column in the list models for the VM selection dialog, and use
this new column to hold the tooltip of the items in the list.

At the moment nothing is set in the new column, so there is no behavior
change.

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
2020-07-24 13:01:57 +00:00
Pino Toscano
2e46ffc08d Use VM titles if available
When listing the running VMs in a libvirt connection, use the titles if
available.

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
2020-07-24 13:01:57 +00:00
Pino Toscano
74d25742ea VM selection: expand models for UI/key columns
Add a new column in the list models for the VM selection dialog, and use
this new column to hold the key of the VM. This way, the first column
represents the UI representation of the VM without affecting the key.

At the moment the VM name is set for both, so there is no behavior
change.

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
2020-07-24 13:01:57 +00:00
Pino Toscano
c28374d8a8 Unconditionally use virDomainOpenGraphicsFD
libvirt 1.2.8 is required now.

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
2020-07-24 11:38:16 +02:00
Pino Toscano
35443daed4 Remove unused i18n translation
All the g_printerr does is printing the message of the GError with a
newline at the end. Hence, use a simple format string without the need
to translate it.

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
2020-07-23 12:01:52 +02:00
Pino Toscano
0325901984 Create single strings for the window title
Currently there is a strings with four placeholders that represents
optional bits: the "press to release", a whitespace (!), the subtitle,
and the application title. This is suboptimal, because it hides the way
the title is composed, and makes it hard to properly translate.

Instead of this string puzzle, create separate strings for each case
(there are only four of them, and one is only the application title).
Each of the string has all the static text availale, with a proper
comment explaining the layout.

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
2020-07-23 12:01:52 +02:00
Pino Toscano
debedd40d1 Disambiguate "unknown" messages
Give them a context to explain what is the "unknown thing", so it is
possible to provide proper translations.

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
2020-07-23 12:01:52 +02:00
Pino Toscano
8db413e689 Fix few spellings
"ID", "oVirt", "SSH", "UNIX", "URI", "UUID"

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
2020-07-23 12:01:52 +02:00
Pino Toscano
b2a2a02b5b Show localized accelerators in Send key menu
Turn the menu labels into GTK accelerator strings, so we can parse them
to convert them into a proper user representation.

There is a small behaviour change: the menu items do not have mnemonics
anymore by default.

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
2020-07-23 12:01:38 +02:00
Pino Toscano
671f79bd7d ui: improve homepage in about dialog
Switch the homepage URL to https, and synchronize the label with the
URL. Also, do not make the label translatable, as it is pointless (it is
only a URL).

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
2020-07-22 12:08:25 +02:00
Pino Toscano
44c03148f1 ui: use the standard about dialog license type
Use the standard gpl-2-0 license type of GtkAboutDialog, instead of the
custom license text: this way, the dialog will show a translated text
with the license type, and a link to the full license text.

As side change due to the editing of this file in glade 3.36: set the
logo icon name to "virt-viewer", even if at runtime a logo/image will be
loaded. glade needs a logo set, either as icon name or as pixmap.

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
2020-07-22 12:04:33 +02:00
Frediano Ziglio
522cca5ac1 virt-viewer-file-transfer-dialog: Reports detailed errors
Instead of showing just a generic error with a list of files group
files by error and show them.

This solves https://bugzilla.redhat.com/show_bug.cgi?id=1753563

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
2020-07-15 10:52:24 +01:00
Frediano Ziglio
ae25f6ca6b More specific key accelerator description
The default key accelerator to release mouse if left control and
left alt but the current description is "Ctrl+Alt", change to
"Ctrl_L+Alt_L" to avoid misunderstanding.

This solves https://bugzilla.redhat.com/show_bug.cgi?id=1548371

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
2020-07-15 08:13:45 +01:00
Frediano Ziglio
2f0d080179 iso-dialog: Fix leak and quoting
Do not leak memory in case of task cancelled.
Quote "msg" in case it contains some no-xml character that could
came from translated strings.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
2020-07-10 09:11:52 +01:00
Frediano Ziglio
8297a178c4 Minor updates to accel_key_to_keys
Make "modifiers" static, potentially avoids a copy to stack.
Use G_N_ELEMENTS also to allocate keys, as in the next loop
allowing to easily change "modifiers" size.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
2020-07-10 09:11:52 +01:00
Frediano Ziglio
ff11d5937e iso-dialog: Give less scary error if there are no ISOs
Instead of a fail simply reply that there are no ISO files.

Message text was suggested by Radek Duda who reported the issue.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
2020-07-10 09:11:19 +01:00
Eduardo Lima (Etrunko)
53dcc7fe52 foreign-menu: Avoid leaking 'name' variable in error path
Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2020-07-01 11:14:38 -03:00
Daniel P. Berrangé
3e1d619529 src: remove trailing whitespace
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-06-26 15:50:50 +01:00
Daniel P. Berrangé
e587274b76 src: remove tab characters from indent
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-06-26 15:50:50 +01:00
Eduardo Lima (Etrunko)
bb3d020cb9 ovirt-foreign-menu: Take into account StorageDomains of type DATA
Now that we support both ISO and DATA storage domain types, we need to
make sure that the files are listed correctly. In this case we give the
domains of ISO type the precedence over DATA ones.

This change extends previous commit bbda3aa which made it possible for
storage domains of type DATA to be considered valid.

Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2020-06-25 23:02:03 -03:00
Eduardo Lima (Etrunko)
42f408902e ovirt-foreign-menu: Use proper function in the case of DATA StorageDomains
Unlike the StorageDomain objects of ISO type, the DATA ones require a
specific API recently added to libgovirt to support them. This commit
makes use of those new functions under #ifdef guards and adds proper a
check to configure.ac.

Related: https://bugzilla.redhat.com/show_bug.cgi?id=1847223

Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2020-06-25 23:02:01 -03:00
Julien Ropé
c6afc28cc9 Rather than adding a default extension to screenshots, display an error message to make the user add it.
This prevents the silent overwriting of the file, and still makes sure the user knows why we don't proceed.

Fix BZ#1752514

Signed-off-by: Julien Ropé <jrope@redhat.com>
2020-06-09 15:50:02 +02:00
Stephen Thom
fedaa5f89a Added -K --keymap commandline option that allows user to block certain keypresses or to remap keypresses being sent to the underlying spice or vnc widget
Signed-off-by: Stephen Thom <sthom@williamhill.co.uk>
2020-06-05 14:12:19 +00:00
Daniel P. Berrangé
c12131ef30 fix handling of enter/leave events in full screen revealer
The current code is using a single event handler for leave/enter and
looking at the mouse coordinates to decide whether it entered or left
the widget. This logic is completely broken when the window is
mimimized, because the mouse coordinates of the leave event are still
within the window boundary.

Switch to just have a separate handler for enter/leave events and stop
looking at mouse coordinates entirely.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-05-19 17:48:28 +01:00
Eduardo Lima (Etrunko)
bbda3aa71a ovirt: Do not filter out DATA storage domains
Since ovirt 4.2 it is acceptable to have ISO images in storage domains
of DATA type, while the usage of ISO type is about to be deprecated. The
code now allow both types of storage domains when looking up for ISO
images.

https://access.redhat.com/documentation/en-us/red_hat_virtualization/4.2/html/release_notes/deprecated_features_rhv
https://access.redhat.com/documentation/en-us/red_hat_virtualization/4.4-beta/html/release_notes/deprecated_features_rhv

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1835640

Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2020-05-19 10:30:21 -03:00
James Le Cuirot
ee173fc254
Add minimize button to toolbar
Signed-off-by: James Le Cuirot <chewi@gentoo.org>
2020-05-07 09:21:04 +01:00
Daniel P. Berrangé
beeff760ac docs: update to point users to gitlab.com project
The project primary git repo has moved from pagure.io to
gitlab.com/virt-viewer/virt-viewer.  We want users to submit
code contributions, bug reports and support questions to the
gitlab project, not the mailing list, nor bugzilla, nor the
virt-manager.org site.

We're still using virt-manager.org for hosting downloads of
source and pagure.io for MSIs, but we'll aim to change that
too.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-04-03 14:08:10 +01:00
Julien Ropé
d84149a92c Fix potential file descriptor leaks found by Coverity.
The error code returned by virt_viewer_session_open_fd() and
virt_viewer_session_channel_open_fd() were not checked. The file
descriptor passed to them could then be left opened even if the function
failed, causing a leak of resources.

This was reported by a Coverity scan, logged under
https://bugzilla.redhat.com/show_bug.cgi?id=1655792

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Julien Ropé <jrope@redhat.com>
2020-04-03 14:08:00 +01:00