Commit Graph

793 Commits

Author SHA1 Message Date
Christophe Fergeau
7f0656a861 Update user-visible copyright information
Years in copyright notices in the about dialog and man pages is at most
2012, let's set it to 2014
2014-04-04 14:49:20 +02:00
Christophe Fergeau
3232dd743b build-sys: Always prepend '-' to build id
When using the --with-buildid configure paramater, the build id which is
substituted in the MSI wxs file is automatically prepended by a '-', but
the build id which is used in the C files does not get this '-'
automatically.

Currently, the linux and mingw spec files prepend a '-' on their own to the
--with-buildid argument, but this causes the MSI installer to show 2 '-'
during installation: "Please wait while Windows configures VirtViewer
0.6.0--1"

This commit always prepends a '-' to the buildid strings, and removes the
'-' from the spec files. This is to ensure the separator between version
number and buildid is not forgotten, which could give a confusing version
number.
2014-04-04 14:49:20 +02:00
Jonathon Jongsma
f1cadccb9a Fix regression with enabling additional displays
Commit 8fa942 broke enabling of additional displays. We don't want to send down
display re-configurations due to events that happen while setting up windows for
enabled displays that we recieve from the server. However, by ignoring
allocations on unmapped windows, we fail to send display configurations for new
displays that a user is attempting to enable via the window menu. To
discriminate between these two cases, we check whether the display is in the
'ready' state or not.
- Unmapped displays with the 'ready' hint set can be assumed to be displays
  that are enabled on the server that we are attempting to create windows for on
  the client. In this case, we should *not* send a display configuration to the
  server
- Unmapped displays with the 'ready' hint cleared can be assumed to be displays
  that are not yet enabled on the server that we are trying to enable in the
  client. In this case, we *should* send a display configuration to the server
2014-03-27 09:43:00 -05:00
Martin Kletzander
b6d2744bae Fix building with older spice-gtk
Due to spice-gtk-0.23 missing SPICE_GTK_CHECK_VERSION macro, the
condition:

causes the following error:

virt-viewer-session-spice.c: In function 'virt_viewer_session_spice_main_channel_event':
virt-viewer-session-spice.c:525:64: error: missing binary operator before token "("
 #if defined(SPICE_GTK_CHECK_VERSION) && SPICE_GTK_CHECK_VERSION(0, 23, 21)
                                                                ^
Also one more warning is fixed in this patch:

virt-viewer-session-spice.c:476:19: warning: unused variable 'error'
[-Wunused-variable] const GError *error;
                                  ^

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2014-03-14 09:09:13 +01:00
Christophe Fergeau
e0e25be56d Fix 'silentely' typo in remote-viewer man page 2014-03-14 09:01:50 +01:00
Christophe Fergeau
eb65226a9d Don't show 'do you want to quit' dialog in kiosk mode
In some situation, (for example, guest without vdagent running), it's
possible to pass key combinations to virt-viewer. When using alt+f4,
this can cause the 'do you want to quit?' dialog to show while it's
non-functional.
This commit moves the check for kiosk mode to before we show this dialog.
2014-03-14 09:01:31 +01:00
Jonathon Jongsma
fe167a6668 Fix broken 'release-cursor' accel when not specified in --hotkeys
When the --hotkeys option is given, all hotkeys that are not explicitly
specified are disabled.  The method used to disable hotkeys is to change the
accel map entry to key=0, mods=0. However, when we decide whether to set a grab
sequence on the spice dispay widget, we simply use the return value for
gtk_accel_map_lookup_entry and assume that a TRUE value returned from this
function means that the hotkey is enabled.  In reality, this function will
return TRUE for disabled hotkeys, but the 'key' variable will be set to key=0,
mods=0. The result is that if I start virt-viewer like this:

    virt-viewer --hotkeys secure-attention=ctrl+alt+end ...

and the guest that I'm attached to uses server mouse mode, it will be impossible
to release the grab on the spice widget.  Because we will explicitly disable the
grab keys in the spice widget and handle the 'release-cursor' hotkey in
virt-viewer, but the hotkey is an empty accel key.

Instead of simply checking the return value of gtk_accel_map_lookup_entry, we
have to inspect the return value for 'key' and check whether any keys are
actually assigned.
2014-03-13 10:13:42 -05:00
Jonathon Jongsma
02fb004a8e Don't create new windows at startup when kiosk mode is false
virt_viewer_app_set_kiosk creates a new window at startup for each client
monitor (regardless of whether the guest supports more than one display).  This
seems unnecessary.  Only do this if kiosk mode is actually enabled.
2014-03-13 10:13:42 -05:00
Jonathon Jongsma
91e772b5e6 Remove special-case for getting window n=0
virt_viewer_app_get_nth_window() will return the proper window when passed 0 for
the 'nth' argument, so there's no need to avoid calling it in this case.  It
just complicates the code logic.
2014-03-13 10:13:42 -05:00
Jonathon Jongsma
8fa9423bd8 Don't resize guest display on zoom change
When the zoom level is changed, the virt-viewer window gets resized. But we
don't want this to trigger a resize of the guest display. But occasionally
rounding errors cause the guest display to be reconfigured when zooming out.  To
fix this, we first check whether the current size is the preferred size.  If it
is, we don't send down a resize command to the guest.

In addition to preventing guest resizes in response to zooming, it also improves
the behavior when the guest display resolution is changed from within the guest.
Before this change, we'd have the following behavior:
    A. guest changes display to WxH
    B. client gets notified of change and resizes the window to WxH
    C. client responds to window resize by sending a new monitor config command to the guest

With this change, the extra step C will be avoided because we're already at the
preferred size.

Resolves: rhbz#1004051
2014-03-13 10:13:42 -05:00
Marc-André Lureau
d33e6b1a49 Use a USB icon in the fullscreen toolbar
Replace the generic GTK_STOCK_PREFERENCES with a more appropriate USB icon.

The icon was provided by Jakub Steiner <jsteiner@redhat.com>

https://bugzilla.redhat.com/show_bug.cgi?id=804184
2014-03-13 12:57:14 +01:00
Marc-André Lureau
c3cbdef888 Remove "Automatically resize" menu
Remove "Automatically resize" menu item (always enabled for Spice
display now)

https://bugzilla.redhat.com/show_bug.cgi?id=1007649
2014-03-13 12:57:14 +01:00
Marc-André Lureau
4b283b26a9 Silence a message about missing configuration file
Do not print a g_debug() error when the configuration file is missing,
unless given the --debug option.

https://bugzilla.redhat.com/show_bug.cgi?id=1006737
2014-03-13 12:57:14 +01:00
Daniel P. Berrange
f2c4a99b6e Fix scaling of window upon resize
The code to determine scaling of windows was incorrectly
using the original desktop size instead of the host screen
size. The 128 pixel fudge factor was also causing windows
to be scaled when there was no need for them to be.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2014-03-12 17:34:47 +00:00
Jonathon Jongsma
03035cf69e Revert "Don't resize guest display on zoom change"
This reverts commit 895ef8029e.
2014-03-06 14:12:52 -06:00
Christophe Fergeau
8f0dd93e8f spec: Don't disable spice support on some archs
Nowadays spice-gtk no longer has an ExclusiveArch: x86 x86_64 %{arm}
virt-viewer can be built with spice-gtk support on all arches.
2014-02-27 10:06:40 +01:00
Jonathon Jongsma
895ef8029e Don't resize guest display on zoom change
When the zoom level is changed, the virt-viewer window gets resized. But we
don't want this to trigger a resize of the guest display. But occasionally
rounding errors cause the guest display to be reconfigured when zooming out.  To
fix this, we first check whether the current size is the preferred size.  If it
is, we don't send down a resize command to the guest.

In addition to preventing guest resizes in response to zooming, it also improves
the behavior when the guest display resolution is changed from within the guest.
Before this change, we'd have the following behavior:
    A. guest changes display to WxH
    B. client gets notified of change and resizes the window to WxH
    C. client responds to window resize by sending a new monitor config command to the guest

With this change, the extra step C will be avoided because we're already at the
preferred size.

Resolves: rhbz#1004051
2014-02-26 13:50:58 -06:00
Marc-André Lureau
7212c8745a spice: do not open in fullscreen with CONTROLLER_AUTO_DISPLAY_RES
This flag is always set when using the rhevm user portal. Best is
probably to ignore it, now that fullscreen has simplified unique
behaviour.
2014-02-26 12:42:20 +01:00
Marc-André Lureau
d1d53d0c8b spice: ask credentials for proxy
If Spice proxy requires authentication, ask credentials and try
connecting again.
2014-02-24 16:36:09 +01:00
Marc-André Lureau
57d1175051 Fix a gcc warning when compiling with mingw32 2014-02-24 16:36:09 +01:00
Daniel P. Berrange
843910a522 Fix german translation of send key
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2014-02-24 10:20:44 +00:00
Daniel P. Berrange
7d7d324387 Improve docs for --attach flag in virt-viewer
People seem to have a hard time understanding the --attach flag.
Rewrite the docs in the hope that people figure it out this time.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2014-02-24 10:19:58 +00:00
Jonathon Jongsma
74b532f1ec rhbz#1007306 - Don't free session if we're re-trying auth
deactivate() is called in response to a failed authentication attempt. If the
session is cleared here, when a user attempts to re-authenticate, it will issue
a warning and will not actually work. So only clear the session here if we're
not going to re-try authentication.
2014-02-13 09:09:13 -06:00
Jonathon Jongsma
51c3a0decf Don't set VNC display to ready until vnc is initialized
We were setting the show_hint to READY as soon as we got the vnc-connected
signal.  But there may be an authentication step between vnc-connected and
vnc-initialized.  In this case, we switch to an empty black display during the
authentication step instead of showing the 'waiting for display N' status.
2014-02-13 09:09:13 -06:00
Jonathon Jongsma
ed9b3f3450 Don't hide the main window when disconnecting
The main window (display #1) is treated a bit differently from other windows,
since it is opened at app start and displays status messages while we attempt to
connect to the remote guest.  As such, it should really stay open as long as the
app is running.

The impetus for this change is the following:
- user attempts to connect to a remote VNC display with a password
- user types the wrong password
- A dialog pops up indicating that authentication failed and asking if the user
  would like to try to re-connect.
- User clicks 'Yes'
- Because the connection was disconnected, all windows are closed
- remote-viewer tries to reconnect again, at which point a new display window is
  opened, and the window gets placed by the window manager (possibly on another
  monitor altogether).

As a user, I expect the program to simply re-use the existing window when trying
to re-authenticate, instead of having the window disappear and then re-appear at
a different location.  This patch accomplishes that.
2014-02-13 09:09:13 -06:00
Jonathon Jongsma
dce19b379a Move vnc-specific auth logic to VirtViewerSessionVnc 2014-02-13 09:09:13 -06:00
Jonathon Jongsma
0383cc4c9b Improve window title when connected to newer spice-server
Recent spice servers send the guest vm name and uuid to the client.  We can use
these values to display the proper vm name in the window title if a title is not
specified on the commandline. We can also be smarter about the title in
virt-viewer as well.

If a title is specified on the comamndline (-t/--title=foo), we use that.  If not,
we fall back to the vm name.  If that is empty, we fall back to the uri of the
connection.

Comparison between old behavior and new behavior

Using new spice-server
Command                                     Old title                   New title
-------                                     ---------                   ---------
remote-viewer -t xyz spice://host:port      xyz                         xyz
remote-viewer spice://host:port             spice://host:port           <vmname>
virt-viewer <vmname>                        <vmname>                    <vmname>
virt-viewer <uuid>                          <uuid>                      <vmname>

Using old spice-server
Command                                     Old title                   New title
-------                                     ---------                   ---------
remote-viewer -t xyz spice://host:port      xyz                         xyz
remote-viewer spice://host:port             spice://host:port           spice://host:port
virt-viewer <vmname>                        <vmname>                    <vmname>
virt-viewer <uuid>                          <uuid>                      <vmname>
2014-02-11 11:56:43 -06:00
Jonathon Jongsma
bee13a6a59 Display warning if UI file fails
When trying to load ui files, we try to find the file in several directories.
If a file is not found in one directory, try to load it from the next directory.
However, if a file is found in a directory but we are not able to load it (e.g.
due to unsupported versions of glade used to generate it, etc), we should print
a warning to the terminal to help the developer debug the issue.

This is an unexpected failure (whereas not finding the file in that directory at
all is an 'expected' failure).
2014-02-11 11:56:37 -06:00
Daniel P. Berrange
03a3ba68a5 Update for 0.6.0 release
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2014-01-24 17:36:27 +00:00
Daniel P. Berrange
278fc60ef4 Refresh translations
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2014-01-24 17:36:27 +00:00
Daniel P. Berrange
ec31b4fd99 Fix virt-viewer.exe on win32
Libvirt uses gnulib for making winsock look like POSIX
sockets. This means that in the libvirt event handle
callbacks the application will be given a file descriptor
rather than a winsock HANDLE object. The g_io_channel_unix_new
method will detect that it is an FD and delegate to the
g_io_channel_win32_new_fd method. Unfortunately the glib Win32
event loop impl is not very good at dealing with FD objects,
simulating poll() by doing a read() on the FD :-(

The API docs for g_io_channel_win32_new_fd say

 "All reads from the file descriptor should be done by
  this internal GLib thread. Your code should call only
  g_io_channel_read()."

This isn't going to fly for libvirt, since it has zero
knowledge of glib at all, so is just doing normal read().

Fortunately we can work around this problem by turning
the FD we get from libvirt back into a HANDLE using the
_get_osfhandle() method.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2014-01-24 16:51:04 +00:00
Daniel P. Berrange
b2a233b711 Don't use --nodeps for developer builds
Only use --nodeps when running under the autobuild engine

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2014-01-24 16:50:58 +00:00
Jonathon Jongsma
9f6878c35a Load ui files first from installed location
virt_viewer_util_load_ui() looks first in the current directory, and then looks
in the system data dirs for a ui file to load, but if you install virt-viewer in
a different prefix, it will load the system UI file rather than the one from the
install prefix. Try to load the ui file from pkgdatadir first.
2014-01-20 16:10:12 -06:00
Marc-André Lureau
9e2d9ba857 Clear global zoom-reset hotkey too 2014-01-07 14:42:34 +01:00
Marc-André Lureau
529cd490b8 Fix rebuild of accelerators menu when loading from file
It's not enough to set the property to notify of its change. Add a
virt_viewer_app_set_enable_accel() helper, and call it after the changes
to accelerators are made when loading from file.

I verified the menu is correctly built when connection from controller
or command line too.
2014-01-07 14:41:04 +01:00
Christophe Fergeau
a6d5acdf6a Disable mime database update during make distcheck
Updating the mime database creates files in the install directory, and
these files are not cleaned up on make uninstall, so this causes a make
distcheck failure.
2013-12-19 10:06:13 +01:00
Christophe Fergeau
71eac4bc67 spec: Get BuildRequires min versions from configure.ac
We currently duplicate the minimum requirements for the various virt-viewer
dependencies in configure.ac, virt-viewer.spec.in and mingw-virt-viewer.spec.in
This commit uses the versions set in configure.ac in the 2 .spec.in files
so that it's easier to keep them in sync

Before/after diff of the .spec files are:

--- virt-viewer.spec.or 2013-12-18 14:14:14.304285905 +0100
+++ virt-viewer.spec    2013-12-18 14:19:20.217072678 +0100
@@ -47,14 +47,14 @@
 BuildRequires: libtool
 %endif

-BuildRequires: glib2-devel >= 2.22
+BuildRequires: glib2-devel >= 2.22.0
 %if %{with_gtk3}
-BuildRequires: gtk3-devel >= 3.0.0
+BuildRequires: gtk3-devel >= 3.0
 %else
-BuildRequires: gtk2-devel >= 2.12.0
+BuildRequires: gtk2-devel >= 2.18.0
 %endif
-BuildRequires: libvirt-devel >= 0.9.7
-BuildRequires: libxml2-devel
+BuildRequires: libvirt-devel >= 0.10.0
+BuildRequires: libxml2-devel >= 2.6.0
 %if %{with_gtk3}
 BuildRequires: gtk-vnc2-devel >= 0.4.0
 %else

--- mingw-virt-viewer.spec.or   2013-12-18 14:14:23.656401693 +0100
+++ mingw-virt-viewer.spec      2013-12-18 14:20:57.007270507 +0100
@@ -12,22 +12,22 @@

 BuildRequires:  mingw32-filesystem >= 23
 BuildRequires:  mingw64-filesystem >= 23
-BuildRequires:  mingw32-glib2 >= 2.22
-BuildRequires:  mingw64-glib2 >= 2.22
+BuildRequires:  mingw32-glib2 >= 2.22.0
+BuildRequires:  mingw64-glib2 >= 2.22.0
 BuildRequires:  mingw32-gstreamer-plugins-bad-free
 BuildRequires:  mingw64-gstreamer-plugins-bad-free
 BuildRequires:  mingw32-gstreamer-plugins-good
 BuildRequires:  mingw64-gstreamer-plugins-good
-BuildRequires:  mingw32-gtk2
-BuildRequires:  mingw64-gtk2
+BuildRequires:  mingw32-gtk2 >= 2.18.0
+BuildRequires:  mingw64-gtk2 >= 2.18.0
 BuildRequires:  mingw32-libusbx
 BuildRequires:  mingw64-libusbx
-BuildRequires:  mingw32-libvirt >= 0.9.7
-BuildRequires:  mingw64-libvirt >= 0.9.7
-BuildRequires:  mingw32-libxml2
-BuildRequires:  mingw64-libxml2
-BuildRequires:  mingw32-gtk-vnc >= 0.4.3
-BuildRequires:  mingw64-gtk-vnc >= 0.4.3
+BuildRequires:  mingw32-libvirt >= 0.10.0
+BuildRequires:  mingw64-libvirt >= 0.10.0
+BuildRequires:  mingw32-libxml2 >= 2.6.0
+BuildRequires:  mingw64-libxml2 >= 2.6.0
+BuildRequires:  mingw32-gtk-vnc >= 0.3.8
+BuildRequires:  mingw64-gtk-vnc >= 0.3.8
 BuildRequires:  mingw32-readline
 BuildRequires:  mingw64-readline
 BuildRequires:  mingw32-spice-glib
2013-12-18 15:42:24 +01:00
Christophe Fergeau
ae14b5b390 Update spice-gtk requirement everywhere
d1c2bc1 updated configure.ac spice-gtk requirement to 0.22, but did not
update the various places which duplicated this requirement, namely the
.spec.in files and the README file.
2013-12-18 15:42:24 +01:00
Christophe Fergeau
abf13d38b3 Update shared mime database on install/uninstall
remomte-viewer installs a file to $datadir/share/mime to register a
mime-type for its .vv files. However, after installing this file,
update-mime-database must be run in order to update the shared mime
database. This commit (inspired by what Nautilus/planner are doing) adds
what is needed for that.
If the mime type is not correctly registered, gvfs-info console.vv will not
return the correct mime type, and xdg-open console.vv will fail to start
remote-viewer, and will fall back to running gedit as the .vv file is a
text file.

https://bugzilla.redhat.com/show_bug.cgi?id=1044209
2013-12-18 14:20:39 +01:00
Jonathon Jongsma
8ae2199aa7 Enable the display before showing the window
This ensures that the display is enabled when it gets its first Allocate event
(which causes a display reconfiguration).  If the display is not enabled at this
point, it won't send down a new monitors_config message until the second
allocation, which may result in the display being disabled until a window is
resized.
2013-12-16 11:24:19 -06:00
Marc-André Lureau
d1c2bc17fa build-sys: require spice-gtk >= 0.22
Require 0.22 fro spice_uuid_to_string()
2013-12-16 18:10:39 +01:00
Christophe Fergeau
63671a00b3 Disable govirt support on f19
The govirt package in f19 is an older one, and does not have some of the
functions used since the switch to govirt 0.3.0. As 0.3.0 broke ABI, it's
not convenient to backport it to f19.
Update the spec file to reflect the fact that oVirt support in git is no
longer buildable on f19.
2013-12-13 16:01:05 +01:00
Marc-André Lureau
f4b7f3321c app: remove useless warning
This warning should have been removed with 20eb200c.

https://bugzilla.redhat.com/show_bug.cgi?id=1021350
2013-12-11 00:26:54 +01:00
Marc-André Lureau
9ad08231ca remote-viewer: add desktop icon
Associate an icon to desktop menu entry.
https://bugzilla.redhat.com/show_bug.cgi?id=1020359
2013-12-11 00:26:54 +01:00
Jonathon Jongsma
b82e238354 Remove obsolete function declaration
This function was removed in bd914bdea2, but the
declaration was missed.
2013-12-10 11:13:17 -06:00
Jonathon Jongsma
03bf8d3051 Create a sparse array for monitor-geometry-changed
It's possible to have only display N enabled without having all of the displays
before it. I experienced this a couple times with a windows guest where display
1 would show up before display 0 and we'd hit a warning that nth is not less
than nmonitors. So find the highest display ID and then create an array of that
size, leaving missing displays initialized to 0
2013-11-27 10:35:22 -06:00
Jonathon Jongsma
81f70304ed Don't re-configure displays when show-hint changes
This caused secondary displays on a windows guest to flicker under some
circumstances. The old code didn't re-configure displays in this case either, so
it shouldn't have been included in the display alignment refactor.
2013-11-27 10:35:22 -06:00
Jonathon Jongsma
33614f86db Do all display alignment in virt-viewer
Don't rely on spice-gtk to do any alignment of displays.  This patch sets the
disable-display-align property on the SpiceMainChannel, and makes the
VirtViewerSession in charge of doing all alignment. This means that every
display has to tell the VirtViewerSession when its "virtual monitor" has changed
configuration (and wants to reconfigure its display on the guest), rather than
sending it directly to the Main Channel.  The session will then align the
displays (if necessary), and the spice session will send down new configuration
for all displays at once. This solves a couple of problems:

1. It allows the session to send down absolute coordinates only in the case
   where *all* windows are fullscreen (so that we can still support
   vertically-stacked displays, etc).  But it auto-aligns displays if only a
   subset of the displays are in fullscreen mode. This solves the problem of
   overlapping regions on different displays when one monitor is in fullscreen
   because only one monitor's configuration was updated and the others were not
   aligned.
2. Allows us to always align based on the current position of each display. This
   contrasts with the earlier behavior where the position used for alignment was
   the window's position at the time when it was last resized. This caused
   displays to be arranged in a seemingly non-deterministic manner if one window
   was moved and then another window was resized (causing a display
   re-configuration).

Solves rhbz#1002156
2013-11-27 10:35:22 -06:00
Jonathon Jongsma
c57f0f3df9 Ensure all windows obey initial --zoom setting
There are cases where multiple VirtViewerWindow objects are created before the
VirtViewerApp constructor has a chance to run. Since the constructor has not yet
run, priv->main_window will still be NULL, the test in
virt_viewer_app_window_new() will fail, and they will not get their initial zoom
level set.  When the constructor finally runs, it set the zoom level of the main
window to the value set on the command line, but all other windows that had
already been created retained the default 100% zoom level.

By creating the main_window in the instance init function, we ensure that the
main window is created before we get any 'session-display-added' signals and all
displays will start out with consistent zoom levels.
2013-11-21 12:41:17 -06:00
Jonathon Jongsma
d1df937e01 Remove non-functional VIRT_VIEWER_HIDE env behavior
VIRT_VIEWER_HIDE could be set as an environment variable to (theoretically) hide
displays whenever they were not ready.  Unfortunately, this bit of functionality
appears bitrotten and doesn't work anymore (it prevents windows from opening
when you click 'view > displays > display 2', for instance).
2013-11-21 11:46:33 -06:00