Commit Graph

422 Commits

Author SHA1 Message Date
Marc-André Lureau
df30f9730d Support Spice controller "auto-display-res" flag
The controller "auto-display-res" flag should be use to reconfigure
guest to match client configuration. This is what the
--fullscreen=auto-conf option is already made for.

https://bugzilla.redhat.com/show_bug.cgi?id=967154
2013-05-27 15:29:45 +02:00
Marc-André Lureau
f0f52f9406 Use a more descriptive FileDescription
This field is used to invite the user to close running instances, when
updating the installation with an MSI. "A remote desktop client" isn't
specific enough, use a VirtViewer specific description.
2013-05-23 17:31:05 +02:00
Marc-André Lureau
d9035d0535 app: move display on client monitors with --full-screen
There used to be a check to fullscreen the only visible display on
current monitor, by checking the number of visible monitors. Now that
fullscreen is independant for each display, and goes on current monitor,
it's useless.

However, this code path is still used for the app --full-screen, at
startup time. And it is still nicer to open the display on respective
client monitors, rather than all on current monitor.
2013-05-22 21:36:15 +02:00
Marc-André Lureau
17e3c48d0a Fix trivial critical
GLib-CRITICAL **: g_strv_length: assertion `str_array != NULL'

Committed without review under trivial rule.
2013-05-21 18:25:16 +02:00
Marc-André Lureau
240baeeb44 Show connect dialog again if connection from dialog failed
https://bugzilla.redhat.com/show_bug.cgi?id=864026
2013-05-17 14:15:06 +02:00
Marc-André Lureau
6ed73f150c spice-session: use a more robust signal connect
The Spice session may outlive the virt-viewer session, due to it's async
nature. Use the more robust virt_viewer_signal_connect_object() to fix
delayed potential crashes.
2013-05-17 14:15:06 +02:00
Marc-André Lureau
79255e80d5 Move connect dialog to remote-viewer.c 2013-05-17 14:15:06 +02:00
Marc-André Lureau
93ac885838 Silence unused arguments warnings
In file included from virt-viewer-session-spice.c:41:
gbinding.c: In function 'on_source_notify':
gbinding.c:381: warning: unused parameter 'gobject'
gbinding.c: In function 'on_target_notify':
gbinding.c:422: warning: unused parameter 'gobject'
gbinding.c: In function 'g_binding_init':
gbinding.c:709: warning: unused parameter 'binding'
2013-05-16 21:54:48 +02:00
Marc-André Lureau
ccd2882cce Rename variable, fix gcc warning
virt-viewer-main.c:61: warning: declaration of 'basename' shadows a global declaration
2013-05-16 21:54:48 +02:00
Marc-André Lureau
d0d8a9fba0 Remove the "container" logic used by legacy browser plugin 2013-05-16 21:54:48 +02:00
Marc-André Lureau
79fd2ea3d0 window: wait until mapped before fullscreen
On RHEL6, when starting virt-viewer --full-screen, metacity will
remaximize & force-fullscreen when leaving fullscreen, which prevents
user from accessing window titlebar, and end up with an incorrect
fullscreen state.

Thanks Owen Taylor for help debugging this:

<owen> elmarco: So the interesting thing here is that the "legacy" isn't
       triggered off a configure request to a particular size, mutter seems to
       constrain the window back to fullscreen size on its own when it sees a
       change to WM_NORMAL_HINTS
<owen> commit 4943d79d6844af3f7fc0a15ceadb69d95c4c5c61
<owen> Author: Peter Bloomfield <PeterBloomfield@BellSouth.net>
<owen> Date:   Wed Jan 20 10:59:07 2010 -0500
<owen>     prevent window self-maximisation
<owen> Is not in rhel6 metacity
<owen> So probably that's the main difference
<owen> can you just make your program not fullscreen initially but wait until
       it's mapped? (gets map-event on the toplevel)
<elmarco> owen that seems to work
<owen> I don't have a better solution to offer - sorry for the ugliness (code and
       initial mapping appearance)

https://bugzilla.redhat.com/show_bug.cgi?id=876445
2013-05-16 21:54:48 +02:00
Marc-André Lureau
63ad7719b9 Only fullscreen the new window
The current code will forcefully reset fullscreen all windows
when a new window is created
2013-05-16 21:54:48 +02:00
Marc-André Lureau
a8c71751cd window: leave fullscreen on current window
Since fdaa9b0ca, virt-viewer allows to fullscreen a single window. It
feels more symetric to leave a single window from fullscreen as well,
unless the application was started in fullscreen.
2013-05-14 14:49:35 +02:00
Marc-André Lureau
0f6dd1f379 window: fix send key menu popup position
Fix send key menu popup position.

The current code wasn't correctly translating the menu coordinates
based on the toplevel windows position, it was always using origin 0.

https://bugzilla.redhat.com/show_bug.cgi?id=913601
2013-05-14 02:29:08 +02:00
Marc-André Lureau
9b1ad0b118 Add -- to seperate program arguments to server in man / --help
Since some of the arguments are expecting following value, make it more
explicit in the man and --help that -- can seperate options from server
name or location.

https://bugzilla.redhat.com/show_bug.cgi?id=843103
2013-05-13 14:26:45 +02:00
Marc-André Lureau
fdaa9b0ca8 Allow to fullscreen and position display independently
Currently, going from window to fullscreen mode changes all display to
fullscreen and realize automatic positionning on corresponding client
monitor. However, it allows for much more flexibility to allow entering
fullscreen on the current monitor each windows seperately. This way the
user can decide on arbitrary monitor arrangement.

https://bugzilla.redhat.com/show_bug.cgi?id=558241
2013-05-13 14:26:45 +02:00
Marc-André Lureau
f3003c6aa6 spice: make sure display ready hint is sync after creation
The ready state can be set during construction time and
not notified immediately.
2013-05-13 14:26:45 +02:00
Marc-André Lureau
3293be3f93 misc: fix typo 2013-05-13 14:26:45 +02:00
Marc-André Lureau
d1fd8c3f66 Do not restrict disabling display to != 0
Virt-viewer hides the display window 0, but doesn't disable the display.
This is inconsistent with other displays, and prevent the guest OS from
reconfiguring the main display.

(for monitor 0 to be really disabled in multi-monitor guest, the agent
need to support sparse monitor config. If not, the first display windows
will be reopened to match the new un-sparse configuration)

Note also the current Linux vdagent crashes when disabling 1st monitor,
to be solved seperately.

Related bug:
https://bugzilla.redhat.com/show_bug.cgi?id=958550
2013-05-13 14:26:45 +02:00
Marc-André Lureau
153ec66b9c remote-viewer: set auto-conf before fullscreen
If a monitor is already in fullscreen, setting auto-conf to true will
not move it until it is re-fullscreen

This was unnoticed, because usually, the first client window is opened
on the first monitor. Also we may argue than relying on g_object_set()
property order is lame and fragile, we better split it in two seperate
calls as this might break upstream.

https://bugzilla.redhat.com/show_bug.cgi?id=872288
2013-05-03 18:56:26 +02:00
Daniel P. Berrange
52c3ae39a0 Add missing include of config.h 2013-05-01 16:11:06 +01:00
Daniel P. Berrange
a763065b32 Remove tab from source file 2013-05-01 16:11:06 +01:00
Marc-André Lureau
dac6351757 file: add delete-this-file option
In case the virt-viewer setting file is meant to temporary, you may use
the delete-this-file=1 option to ask the client to remove it, once it
has been read. This is useful for example in ovirt context, where
connection settings file are generated and can't be reused.
2013-04-30 02:26:36 +02:00
Christophe Fergeau
20eb200ca5 Exit virt-viewer when trying to close any window
Currently, in multi-screen scenarios, when closing one remote-viewer
window, the corresponding screen gets disabled in the guest OS.
This can be confusing as this behaves very differently from
File/Quit. This commit will exit the whole application when the user
tries to close one of virt-viewer window.
2013-04-25 22:16:04 +02:00
Hans de Goede
284aecf0ce gtk-3: Rework window size handling
With gtk-2 we have a special hack, where at first we make the
virt-viewer-display request its actual size, and then once the window is
mapped, we request a size of 50x50 to allow the user to resize the window
to something smaller.

With gtk-3 >= 3.8.1 this is broken, and the window gets resized to a
smaller size as soon as we change the size request to 50x50.

gtk-3 has a much better way of dealing with this in the form of widgets
being able to specify both a minimal and a natural size. This patch changes
virt-viewer to use this with gtk-3, instead of the gtk-2 hack.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2013-04-23 13:49:24 +02:00
Hans de Goede
d78dd5bd99 ovBox: Make get_preferred_width/height differentiate between min and natural
gtk-3's widget size negotiation code differentiates between the minimum
size and the natural size of a widget, fix ovBox to pass this along from
its underlying widget to its parent.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2013-04-23 13:49:24 +02:00
Hans de Goede
24182b5be8 virt-viewer-window: cleanup zoom handling
We've 3 similar zoom function zoom in / out / reset. in / out do not
schedule a window resize when there is no display, where as reset does,
which is not consistent. Also there is some duplicate code between them.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2013-04-23 13:49:24 +02:00
Hans de Goede
f0a103fa86 virt-viewer-display: Use virt_viewer_display_queue_resize where possible
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2013-04-23 13:49:24 +02:00
Marc-André Lureau
fdb2e4714a spice: forward secure-channels
This needs spice-gtk >= 0.19.7 and will warn with lower version
2013-04-15 16:46:47 +02:00
Christophe Fergeau
d4ad5af70f Remove redundant check, g_strdup(NULL) is allowed
This also makes the code consistent with its surroundings.
2013-04-13 19:02:05 +02:00
Christophe Fergeau
898690b531 Fix memory leak on remote-viewer exit
When exiting remote-viewer, VirtViewepApp::dispose() calls
virt_viewer_app_set_connect_info() with NULL parameters to free all
internal fields. However, _set_connect_info() calls
virt_viewer_app_update_pretty_address() which will always allocate
a new string even if the fields it's using to fill the string are NULL.
This commit fixes the leak by checking if the fields have non-NULL
values before creating the newly-allocated string.

==24180== 14 bytes in 1 blocks are definitely lost in loss record 540 of 8,671
==24180==    at 0x4A0887C: malloc (vg_replace_malloc.c:270)
==24180==    by 0x32D2B0A187: __vasprintf_chk (vasprintf_chk.c:80)
==24180==    by 0x32D52845AA: g_vasprintf (stdio2.h:210)
==24180==    by 0x32D52640DC: g_strdup_vprintf (gstrfuncs.c:517)
==24180==    by 0x32D526417B: g_strdup_printf (gstrfuncs.c:543)
==24180==    by 0x4136E6: virt_viewer_app_update_pretty_address (virt-viewer-app.c:1681)
==24180==    by 0x414100: virt_viewer_app_set_connect_info (virt-viewer-app.c:1902)
==24180==    by 0x4141D0: virt_viewer_app_free_connect_info (virt-viewer-app.c:1910)
==24180==    by 0x4127C6: virt_viewer_app_dispose (virt-viewer-app.c:1353)
==24180==    by 0x425488: remote_viewer_dispose (remote-viewer.c:131)
==24180==    by 0x32D5E14787: g_object_unref (gobject.c:2986)
==24180==    by 0x4280AF: main (remote-viewer-main.c:323)
2013-04-13 19:02:05 +02:00
Christophe Fergeau
0fd9a6185b build-sys: Simplify setting of optional CFLAGS/LDFLAGS
They don't need to be wrapped inside if HAVE_XXX blocks in Makefile.am
as when XXX is not available, XXX_CFLAGS and XXX_LIBS will expand to
the empty string, and thus we can carry them unconditionally in
our app_CFLAGS/app_LDFLAGS variables.
2013-04-12 21:21:15 +02:00
Christophe Fergeau
584f6cf5a5 Be more consistent in #if/#ifdef use
Some of the code is checking for spice-gtk/oVirt availability
by using #ifdef HAVE_XXX, and some of the code is using #if HAVE_XXX.
As configure.ac only AC_DEFINE() HAVE_XXX when XXX could be found,
let's use the #ifdef HAVE_XXX form everywhere
2013-04-12 21:20:04 +02:00
Christophe Fergeau
67c8c3790f Add oVirt support
This commit adds support for ovirt:// URIs. It does so by using
libgovirt to get the spice/vnc connection information through
oVirt xmlrpc API.
2013-04-12 19:45:38 +02:00
Hans de Goede
a07277f28b virt-viewer-app: Always allow users to close displays from the displays menu
Marking display menu items as non sensitive for shown displays make no sense,
since the user can always close them through the window-manager.

Having a window for a display shown when the display is not selectable nor
ready, can happen when the agent goes away. This happens for example when using
a dual monitor config with a Linux guest and then switching to a text console
inside the guest.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2013-04-05 16:04:44 +02:00
Christophe Fergeau
9cf264c2cf Use translations when looking up key combination to send
virt_viewer_window_menu_send() compares the label of the menu item
that was clicked on with a list of known labels to know which
key combination should be sent to the guest.
However, the menu label can be translated, but the table doing
the label -> key combination mapping uses untranslated labels.
This means the menu item will not send any key combination when
clicked if translated.
This can be observed with fr_FR where "Ctrl+Alt+_Del" is translated
to "Ctrl+Alt+_Suppr".
2013-04-02 16:01:31 +02:00
Marc-André Lureau
4da48209cf win32: maximize when leaving fullscreen the first time
On windows, the client window may end up with a non-visible toolbar,
and overlapping the windows statusbar. To workaround this, let's
maximize the client the first time leaving fullscreen.

https://bugzilla.redhat.com/show_bug.cgi?id=916810
2013-04-02 13:53:32 +02:00
Marc-André Lureau
29056f9c03 Do not enable extra monitors until they are explicitely enabled 2013-03-28 19:36:57 +01:00
Marc-André Lureau
23acfa582d Make display menu item sensitive again
Even if the display has not been explicitely disabled, as long as
the display is "selectable"

Fix regression introduced with "Do not disable extra client monitors"
3b981d953f
2013-03-28 19:32:53 +01:00
Marc-André Lureau
081f2decbe Remove gtk_window_present() call
gtk_window_present() may forcefully call gdk_window_show(), which will
call ShowWindow(). Although gdk call is not supposed to move the
window if it's already visible, it does restore the window position on
Vista+. For example, a snapped window will be moved back to its
previous position.

Gtk+ ShowWindow() is currently using SW_SHOWNOACTIVATE, it should
probably use SW_SHOWNA instead, but that didn't help anyway for a
snapped window.

Since virt_viewer_window_show() already ensure the window is visible,
I am not sure why gtk_window_present() is there in the first place, so
just remove it.

https://bugzilla.redhat.com/show_bug.cgi?id=912713
2013-03-26 17:06:07 +01:00
Marc-André Lureau
1e810a543e Add gtk_widget_get_realized() define for old gtk+
Fix build with gtk < 2.20
2013-03-26 15:07:16 +01:00
Marc-André Lureau
006fcf859c window: keep display size when leaving fullscreen for first time
If the application was started in fullscreen, window geometry has not
been saved, since the window was not realized. We can unfullscreen and
restore 1:1 window to match guest display size with
virt_viewer_display_queue_resize()

https://bugzilla.redhat.com/show_bug.cgi?id=916810
2013-03-26 12:35:52 +01:00
Marc-André Lureau
f507f30904 window: save window geometry if the window is realized
Protect against re-entering fullscreen by moving pre-condition,
keey the last know window geometry, since it stays valid.
2013-03-26 12:34:30 +01:00
Marc-André Lureau
d2c4739dc5 window: resize to monitor geometry
This code is potentially bad, we should set size request to the size of the monitor
2013-03-26 12:31:25 +01:00
Marc-André Lureau
d99d943c90 display: make a function to queue the dirty display allocation trick 2013-03-25 22:23:09 +01:00
Marc-André Lureau
19b8be2c85 app: add get_fullscreen_auto_conf() 2013-03-25 22:23:04 +01:00
Christophe Fergeau
464031cae3 Reuse existing 'displays' submenu rather than recreating it
Because of what apparently is a gtk+2 bug , we
cannot recreate the submenu every time we need to refresh it,
otherwise the application may get frozen with the keyboard and
mouse grabbed if gtk_menu_item_set_submenu is called while
the menu is displayed. Reusing the same menu every time
works around this issue.

https://bugzilla.redhat.com/show_bug.cgi?id=922712
2013-03-25 16:18:59 +01:00
Marc-André Lureau
3b981d953f Do not disable extra client monitors
This allows reconfiguration of extra monitors whenever the agent is
back, for example after reboot.

https://bugzilla.redhat.com/show_bug.cgi?id=918997
2013-03-23 00:51:46 +01:00
Marc-André Lureau
9ff289ebf5 spice: always send auto-conf on agent connection
Restore the auto-conf client monitor configuration whenever the agent
is started. This ensures the guest has the expected number of monitors
enabled when rebooting in fullscreen.

https://bugzilla.redhat.com/show_bug.cgi?id=918997
2013-03-23 00:51:46 +01:00
Hans de Goede
663782b45c virt-viewer-display-spice: Skip monitor info in fullscreen-auto-conf mode
When we are in fullscreen-auto-conf virt-viewer-session-spice sends a
monitor-info message to the agent with the exact client monitor info, and
virt-viewer-display-spice should not override that.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2013-03-23 00:51:46 +01:00