Commit Graph

860 Commits

Author SHA1 Message Date
Charles Arnold
b64b58b971 window: Fix segault on zooming operations
When virt-viewer is "Waiting for guest domain to start" and
the Ctrl- or Ctrl+ keys are pressed to zoom the blank display
virt-viewer will crash in virt_viewer_display_get_desktop_size
because of a NULL display pointer. To reproduce start virt-viewer
on a VM not running and zoom the display.

Signed-off-by: Charles Arnold <carnold@suse.com>
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-06-20 17:08:18 +02:00
Frediano Ziglio
18e0fa27e3 Revert "Disable IME to allow receiving all keys"
This reverts commit 191f9a8ab4.

This fixes https://bugzilla.redhat.com/show_bug.cgi?id=1342984.

Calling ImmDisableIME disable IME for the entire program.
On Windows 7 this also hide the keyboard application from the task bar
making impossible to switch keyboard while using remote viewer.
A recent commit in spice-gtk (7d881d2193bf5598b888a48bb4d8d7ad2e62f443,
"widget: Disable IME context on display widget") disable IME processing
just for SpiceDisplay. This avoid the above regression on Windows 7.

Not having this spice-gtk commit is not going to cause a huge
regression, so it's fine not to add strong coupling between this
commit and the spice-gtk commit which fixes this differently.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
2016-06-16 17:34:05 +02:00
Michal Privoznik
5eb4a82b18 virt-viewer-display-vnc: Include virt-viewer-util.h
In function virt_viewer_display_vnc_new() we are calling
virt_viewer_signal_connect_object() which is defined in
virt-viewer-util module. However, the header file for the module
is never included.

  CC       libvirt_viewer_la-virt-viewer-display-vnc.lo
virt-viewer-display-vnc.c: In function 'virt_viewer_display_vnc_new':
virt-viewer-display-vnc.c:251:5: warning: implicit declaration of function 'virt_viewer_signal_connect_object' [-Wimplicit-function-declaration]
     virt_viewer_signal_connect_object(app, "notify::enable-accel",
     ^
virt-viewer-display-vnc.c:251:5: warning: nested extern declaration of 'virt_viewer_signal_connect_object' [-Wnested-externs]

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2016-06-04 20:20:22 +02:00
Pavel Grunt
ffa460b8c6 app: Check validity of hotkey
The hotkey is valid if it has a valid value. The value is valid if it is
not empty and is successfully parsed by gtk_accelerator_parse().

These hotkeys formats are considered invalid:
 "key" - missing value
 "key=" - missing value
 "key=abcd" - value cannot be parsed by gtk_accelerator_parse()

Resolves: rhbz#1339572

Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2016-06-02 11:04:02 +02:00
Pavel Grunt
7d7e8c2aae app: Use debug to inform about smartcard shortcuts state
Related: rhbz#1339572

Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2016-06-02 10:59:18 +02:00
Pavel Grunt
bc83803859 vnc-display: Disable default grab sequence
It should be enabled only if the "release-cursor" sequence was not
specified (by using "--hotkeys=release-cursor=sequence"), otherwise
both sequences would release the cursor.

The solution is taken from the spice-display code.

Resolves: rhbz#1339575

Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2016-06-02 10:58:57 +02:00
Pavel Grunt
40d1fff271 Include virt-viewer-util.h only in source files
It doesn't have any symbols to be used in headers

Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2016-05-31 16:52:46 +02:00
Pavel Grunt
4b6fc261d0 Add mnemonics for each display item
Related: rhbz#1332545

Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2016-05-31 16:44:07 +02:00
Christophe Fergeau
4f37332940 ovirt: Use sso-token when set in .vv file
Starting with oVirt 4.0, this replaces the jsessionid field for
automatic authentication with oVirt instances for REST communication.
2016-05-10 09:51:14 +02:00
Christophe Fergeau
c904b1c63a vv-file: Add support for 'sso-token' field in [ovirt]
This is the new way of authenticating with remote oVirt instance
starting with oVirt 4.0.
2016-05-10 09:51:14 +02:00
Christophe Fergeau
9aa7aec9a9 ovirt: Fix OvirtApi memory handling
The oVirt integration code in remote-viewer assumes that
the caller owns a reference on the OvirtApi instance returned
by ovirt_proxy_fetch_api{,finish}.
This is incorrect as these 2 API calls have always been documented as
being (transfer none). This was working so far because libgovirt was
leaking an OvirtApi reference. This bug is fixed upstream, so we now get
a warning on remote-viewer exit about trying to unref an invalid object.

This commit fixes that by taking the ref we expect in OvirtForeignMenu,
and by not releasing a ref we do not own in remote-viewer.c
2016-05-10 09:51:14 +02:00
Christophe Fergeau
7a7143245a ovirt: Error reporting improvements on invalid VM name 2016-05-10 09:51:14 +02:00
Christophe Fergeau
bc77b4776c ovirt: Don't try to use [ovirt] if jsessionid is not set
If jsessionid is not set in the .vv file and we try to use anyway the
REST API, an authentication dialog will be shown by remote-viewer, which
is very unwelcome. If we don't have a jsessionid set, we know we won't
be able to silently login to the REST API, so don't try to set a foreign
menu when it's not set.
2016-05-10 09:51:14 +02:00
Frediano Ziglio
146e00f5eb Manage redirection in a way similar to Unix
This patch allows remote-viewer to redirect output/error streams to
files.
Also if launched from a console program (for instance from the command
prompt) you are able to see output from the console where you launch
the program.
This allow to launch the program with a syntax like:
  > remote-viewer.exe --debug > log.txt 2>&1
or simply:
  > remote-viewer.exe --debug

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2016-05-04 11:16:05 +02:00
Jonathon Jongsma
b917969f75 Add some missing mnemonics to menu items
Fixes: rhbz#1332545
2016-05-03 15:49:05 -05:00
Jonathon Jongsma
274e65d6da Add some timeouts to file transfer dialog
In order to avoid the situation where a dialog flashes onto the screen
and then is immediately hidden, I've added a couple timeouts to the
dialog.

The first is a 250ms timeout before showing the dialog. This avoids
showing the dialog at all for very small, quick transfers.

There is also a 500ms timeout before hiding a finished task. This
ensures that even transfers that only take e.g. 251ms to transfer will
get shown to the user for at least 500ms rather than being hidden 1ms
after showing the dialog.

Related: rhbz#1332180, rhbz#1324521
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2016-05-03 08:04:15 +02:00
Jonathon Jongsma
0856067d79 Add file transfer dialog
This dialog will show the progress of files being transferred from the
client to the guest and allows the user to cancel ongoing file transfer
tasks.  The user can cancel each transfer individually, or cancel all
ongoing transfers at once.

Resolves: rhbz#1332180, rhbz#1324521
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2016-05-03 08:04:10 +02:00
Fabiano Fidêncio
01b66ef88b spice: avoid crashing when using invalid video config
virt-viewer _only_ supports guests that have either:

A) a signle graphics device with multiple displays (monitorid=0,
displayid=(0,1,2,3)).

B) multiple graphics device with a single display each
(monitorid=(0,1,2,3), displayid=0).

From now on, avoid crashing connecting to a guest which has a graphics
configuration that violates A or B. However, even avoiding the crash, we
cannot ensure the guest will work as expected.

Resolves: rhbz#1250820

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
2016-04-26 13:58:59 +02:00
Christophe Fergeau
191f9a8ab4 Disable IME to allow receiving all keys
This fixes https://bugzilla.redhat.com/show_bug.cgi?id=1297640

Acked-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-04-19 15:22:17 +02:00
Eduardo Lima (Etrunko)
e5239c7cbb Fix spice includes
Spice release version 0.31 requires that only spice-client.h or
spice-client-gtk.h should be included directly. As a result,
compilation is now throwing warnings like:

warning: #warning "Only <spice-client.h> can be included directly" [-Wcpp]
warning: #warning "Only <spice-client-gtk.h> can be included directly" [-Wcpp]

This patch also bumps spice version requirement to 0.31, to ensure
those files are available.

Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2016-03-24 11:49:39 +01:00
Pavel Grunt
3367285c37 util: Remove unused GHashTable key/value 2016-03-15 07:24:03 +01:00
Pavel Grunt
2736081940 Move tests under /tests directory
Keep tests separated from the code
2016-03-14 16:36:37 +01:00
Pavel Grunt
d81f7c047f Add libvirt-viewer-util library an use it in tests 2016-03-14 16:35:43 +01:00
Christophe Fergeau
8ea6a9d923 Don't include libvirt.h in virt-viewer-auth.h
virt-viewer-auth.h does not use any libvirt types, so the #include is
not needed, and virt-viewer-auth.h is used while building remote-viewer,
which do not use libvirt compilation flags. This caused failures on
a freshly installed box without libvirt headers.
2016-03-09 16:59:59 +01:00
Christophe Fergeau
0ea2a674b8 ovirt: Only use active ISO domains for foreign menu
oVirt storage domains can be in various states (inactive, in
maintainance, ...). We only want to show the ISOs it contains in the
foreign menu when the storage domain is actually active, not in the
other states.

https://bugzilla.redhat.com/show_bug.cgi?id=1310450
2016-03-09 16:59:37 +01:00
Pavel Grunt
3e42ec7c39 test: Add tests for monitor mapping 2016-03-08 19:04:12 +01:00
Pavel Grunt
ab603d8e25 virt_viewer_parse_monitor_mappings: Add parameter for client monitors
Drop dependency on gdk. it allows to write tests not depending
on the client's configuration.
2016-03-08 19:04:04 +01:00
Pavel Grunt
e0c6718c3f Move monitor mapping parsing from app to util
It is not specific to VirtViewerApp.
Following commits will add support for tests thanks to this move.
2016-03-08 19:03:53 +01:00
Fabiano Fidêncio
adf1ee3823 app, cosmetic: remove one unneeded level of identation
Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-03-07 16:04:01 +01:00
Fabiano Fidêncio
5f26924535 app: monitor-config - do it all or nothing
Don't keep trying to use a monitor config when it already failed for one
monitor, otherwise virt-viewer can end up in a situation where none of
the displays are enabled but the program is still running.
So, in case of any failure, let's skip the whole monitor config, forcing
virt-viewer to use the "fallback" one instead.

Resolves: rhbz#1315206

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-03-07 16:03:52 +01:00
Fabiano Fidêncio
82e13442b9 Use GResource for loading ui files
Let's take advantage of GResource for loading ui files in a better and
cleaner way than virt_viewer_util_load_ui() was doing.
It also brings the benefit, at least for developers, of being able to
test ui changes without having to "make install" virt-viewer.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2016-03-03 23:08:37 +01:00
Fabiano Fidêncio
ad6924aff1 app: Remove useless libxml includes
Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2016-03-03 23:08:32 +01:00
Fabiano Fidêncio
b7de994156 about: Fix the program's name in the title
Title currently says "About Glade". It's not a big deal because it's not
actually shown anywhere, but just for correctness let's change it to
"About Virt-Viewer".

Thanks Jonathon Jongsma for pointing this out.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2016-03-03 23:08:12 +01:00
Eduardo Lima (Etrunko)
d18bbc6f5b Don't open the default display while parsing command line
Since commit a9ce19f it has not been possible to check app version from
a tty without X session running. The issue is that gtk_get_option_group
function opens the default display if passed TRUE as argument.

Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2016-02-26 22:23:07 +01:00
Fabiano Fidêncio
0e0df372cf session-vnc: Avoid depracated warnings on this file
This is a temporary solution for using autobuild.sh, as commit df403f5
introduced the -Wdeprecated-declarations and gtk-vnc provides a callback
for getting authentication credentials which uses GValueArray, forcing
virt-viewer to keep using g_value_array_get_nth(), which is deprecated.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-02-26 22:21:04 +01:00
Fabiano Fidêncio
45afba8d0b configure: Simplify libvirt/libvirt-glib handling
Merge libvirt and libvirt-glib checking in PKG_CHECK_MODULES, then we
don't nee the LIBVIRT_GLIB_{CFLAGS,LIBS} in Makefile.am

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2016-02-25 22:26:59 +01:00
Fabiano Fidêncio
51ce01dfdd Bring back libvirt-glib dependency
libvirt-glib dependency was dropped in commit 296f91c in favor to
maintain the full glib event loop integration into virt-viewer tree.
This decision was taken because libvirt-glib was not mature enough at
that time, which is not the case nowadays.

The libvirt-glib version chosen as dependency (0.1.8) is the first
release that includes the fixes for the glib event loop integration that
were backported to virt-viewer last year.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2016-02-25 22:17:37 +01:00
Fabiano Fidêncio
a3e5d0b97a cleanup: Don't use gtk_widget_modify_{fg,bg}()
These function have been deprecated since Gtk 3.0 and is recommended to
use _override_color() and _override_background_color() instead.
As these new functions take a GdkRGBA as parameter, let's use
gdk_rgba_parse() instead of gdk_color_parse().

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-02-24 16:58:01 +01:00
Fabiano Fidêncio
af1e42a101 cleanup: Don't use GtkStock
It has been deprecated since Gtk 3.10.

New strings have been added as the GTK_STOCK_* defines had their
translations done inside Gtk itself, but now the translations of the new
added labels must be done by virt-viewer translators.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-02-24 16:57:37 +01:00
Fabiano Fidêncio
a37127c7cf cleanup: Drop old compatibilty code
A few more pieces of old compatibility code can be dropped, as we
already depend on GLib 2.38.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
2016-02-24 16:57:34 +01:00
Fabiano Fidêncio
80ac4d5774 app: Don't leave a window opened in case of connection error
Since commit ed9b3f3 the main window is not hidden when disconnecting.
But it also is not hidden when a connection error occurs, leaving a
black display with a not so accurate message to the users in case they
try to connect to a non-valid address from the remote-viewer connection
window and in this case the main window (display #1) shuldn't be shown.

The impetus for this chance is the following:
- user runs remote-viewer without any argument
- the remote-viewer connection window shows up
- user attempts to connect to a non-valid address
- a dialog pops up indicating a failure connecting to the graphic server
- the main window shows up saying "Connecting to the graphic server"
- user clicks 'Ok'
- the main window stays there with the same message

As a user, I expect the program to not show the main window in
connecting failure cases. This patch accomplishes that.
2016-02-24 07:21:06 +01:00
Eduardo Lima (Etrunko)
76d2e483d5 Drop old compatibility code
With glib requirements now being 2.38, these functions do not make sense anymore.

Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2016-02-18 21:46:02 +01:00
Eduardo Lima (Etrunko)
3270ce61af remote-viewer: Remove unused properties
The reason for using properties to access those members was to ensure
that they would only be set during the creation of the object. Now that
we removed that restriction, we set private members directly.

Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2016-02-18 21:46:02 +01:00
Eduardo Lima (Etrunko)
a9ce19f848 Port to GtkApplication API's
Most of this patch consists in code being shuffled around to fit the
expected flow while using the new APIs. I tried my best to make this
patch the less intrusive as possible. Main changes are:

- Updated build requirements
   * glib version 2.38
   * gtk+ version 3.10
   * gio

- VirtViewerApp is now a subclass of GtkApplication.
  Some mainloop calls were replaced:
   * gtk_main() -> g_application_run()
   * gtk_quit() -> g_application_quit()

- Unified command line option handling.
  The logic has moved from the main functions and split in common
  options, and specific ones for each application. With this, the main
  functions were highly simplified, and now basically responsible for
  instantiating the App object and running the main loop.

- All Window objects must be associated with the Application.
  With this, there is no need to emit our own 'window-added'/'window-
  removed' signals, as those will be emited by GtkApplication whenever
  gtk_application_add_window() and gtk_application_remove_window() are
  called. Also, 'window-removed' was not being used anywhere.

Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2016-02-18 21:45:56 +01:00
Uri Lublin
7a54b96dbe spice: vv-file: do not ignore usb-filter
Fixes rhbz#1309634

Signed-off-by: Uri Lublin <uril@redhat.com>
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2016-02-18 16:23:34 +01:00
Eduardo Lima (Etrunko)
40ebfbadee Minor code cleanups
- Reuse #ifdef HAVE_SPICE_GTK block for include.
- Move declaration of vfunc together with others of the same class.
- Move variable declaration to the top of the function.

Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2016-02-15 21:50:19 +01:00
Fabiano Fidêncio
4235ef3453 Drop support to gtk2
The 3.0 release was the last one that still supports GTK2. For the
Windows builds the support to GTK2 was dropped in the previous release.
Let's do the same for the entire project now.

Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2016-02-15 21:49:57 +01:00
Pavel Grunt
c86a4dfa41 display: Use correct variable name
Fix gtk2 build
2016-02-15 17:59:32 +01:00
Pavel Grunt
fd4c721551 display: Remove zoom property
It is possible to get the same info from the "zoom-level" property.
virt_viewer_display_get_zoom() now returns TRUE if zoom level != 100
2016-02-15 14:01:50 +01:00
Pavel Grunt
ca1ad884bd display: Use common code to get preferred size 2016-02-15 14:01:42 +01:00