summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* app, cosmetic: remove one unneeded level of identationHEADmasterFabiano Fidêncio2016-03-071-14/+14
| | | | | Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com> Acked-by: Pavel Grunt <pgrunt@redhat.com>
* app: monitor-config - do it all or nothingFabiano Fidêncio2016-03-071-3/+4
| | | | | | | | | | | | | 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>
* Use GResource for loading ui filesFabiano Fidêncio2016-03-037-54/+59
| | | | | | | | | | 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>
* app: Remove useless libxml includesFabiano Fidêncio2016-03-031-3/+0
| | | | Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
* about: Fix the program's name in the titleFabiano Fidêncio2016-03-031-1/+1
| | | | | | | | | | | 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>
* Don't open the default display while parsing command lineEduardo Lima (Etrunko)2016-02-261-1/+1
| | | | | | | | | 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>
* session-vnc: Avoid depracated warnings on this fileFabiano Fidêncio2016-02-261-0/+3
| | | | | | | | | | 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>
* configure: Simplify libvirt/libvirt-glib handlingFabiano Fidêncio2016-02-251-2/+0
| | | | | | | | 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>
* Bring back libvirt-glib dependencyFabiano Fidêncio2016-02-254-500/+4
| | | | | | | | | | | | | | | 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>
* cleanup: Don't use gtk_widget_modify_{fg,bg}()Fabiano Fidêncio2016-02-242-6/+20
| | | | | | | | | | | 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>
* cleanup: Don't use GtkStockFabiano Fidêncio2016-02-246-30/+27
| | | | | | | | | | | | 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>
* cleanup: Drop old compatibilty codeFabiano Fidêncio2016-02-246-1362/+0
| | | | | | | | 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>
* app: Don't leave a window opened in case of connection errorFabiano Fidêncio2016-02-241-1/+4
| | | | | | | | | | | | | | | | | | | | 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.
* Drop old compatibility codeEduardo Lima (Etrunko)2016-02-187-123/+0
| | | | | | With glib requirements now being 2.38, these functions do not make sense anymore. Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
* remote-viewer: Remove unused propertiesEduardo Lima (Etrunko)2016-02-181-97/+4
| | | | | | | | 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>
* Port to GtkApplication API'sEduardo Lima (Etrunko)2016-02-1810-402/+361
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* spice: vv-file: do not ignore usb-filterUri Lublin2016-02-181-0/+10
| | | | | | | Fixes rhbz#1309634 Signed-off-by: Uri Lublin <uril@redhat.com> Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
* Minor code cleanupsEduardo Lima (Etrunko)2016-02-151-6/+7
| | | | | | | | - 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>
* Drop support to gtk2Fabiano Fidêncio2016-02-159-286/+34
| | | | | | | | 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>
* display: Use correct variable namePavel Grunt2016-02-151-1/+1
| | | | Fix gtk2 build
* display: Remove zoom propertyPavel Grunt2016-02-151-24/+2
| | | | | 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
* display: Use common code to get preferred sizePavel Grunt2016-02-151-21/+31
|
* app: Compute monitor mapping only in fullscreenPavel Grunt2016-02-151-6/+20
|
* app: Do not show usbredir button without sessionPavel Grunt2016-02-151-4/+8
| | | | | | The button is visible in the fullscreen toolbar when waiting for a guest. Clicking on it causes the runtime warning: virt-viewer-CRITICAL **: virt_viewer_session_usb_device_selection: assertion 'VIRT_VIEWER_IS_SESSION(self)' failed
* app: Add comment only when config file has VM groupPavel Grunt2016-02-151-1/+1
| | | | | Avoid the debug message on close: virt-viewer-DEBUG: Unable to get comment from key file: Key file does not have group '39cd210d-5d45-478a-91fe-b3680307f2df'
* app: Return early on empty monitor mappingPavel Grunt2016-02-151-0/+5
| | | | | Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1304648
* display: Set value of desktop width and height property directlyPavel Grunt2016-02-031-6/+2
| | | | | | | | | | Avoid calling gtk_widget_queue_resize() and emiting the "display-desktop-resize" signal. The only user of the properties is virt_viewer_display_spice_set_desktop() which will call the function and emit the signal after setting both "desktop-width" and "desktop-height" properties. Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
* display: Return early and remove a blockPavel Grunt2016-02-031-21/+18
| | | | Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
* display: Remove unnecessary VIRT_VIEWER_DISPLAY castPavel Grunt2016-02-031-6/+6
| | | | Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
* Remove GSLice usageFabiano Fidêncio2016-01-182-4/+4
| | | | | It's being slowly deprecated in glib https://bugzilla.gnome.org/show_bug.cgi?id=754687
* display: Set useful values for MIN_DISPLAY_{WIDTH, HEIGHT}Jonathon Jongsma2016-01-132-17/+20
| | | | | | | | | | | | | | | | | | | Nowadays the value for MIN_DISPLAY_{WIDTH,HEIGHT} is 50. This arbitrary value doesn't bring any benefit, doesn't provide a useful size for a desktop to be usable and can actually trigger some undefined behavior when reaching resolutions that are lower than the ones provided by the video drivers (as in rhbz#1296878). In order to avoid these issues and provide a minimum resolution that can still be useful for our users, let's use the same values for minimum width and height used by the linux QXL drivers (320x200). This also requires us to adjust the minimum requested widget size when zoom is enabled so that we don't accidentally request a size smaller than the driver can support. Related: rhbz#1296878 Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
* display: set min value for desktop-{width,height} props as ↵Fabiano Fidêncio2016-01-081-2/+2
| | | | | | | | | | | | MIN_DISPLAY_{WIDTH,HEIGHT} Otherwise we can have warnings when resizing the virt-viewer window to the smallest possible size, like: (virt-viewer:11187): GLib-GObject-WARNING **: value "50" of type `gint' is invalid or out of range for property `desktop-height' of type `gint' Related: rhbz#1296878
* Remove useless {get,set}_property functionsEduardo Lima (Etrunko)2015-11-041-22/+0
| | | | Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
* Move declaration to the beginning of the fileEduardo Lima (Etrunko)2015-11-041-2/+1
| | | | Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
* session-spice: Disable extra displays in fullscreen modePavel Grunt2015-11-041-0/+22
| | | | | | | | | | | | When running in fullscreen it is possible to end up in a situation where we have more displays enabled than monitors. This can happen if displays that were enabled in the previous connection to the guest doesn't match displays requested when entering the fullscreen mode. This commit solves the problem by disabling displays that should not be enabled in the fullscreen mode. Resolves: rhbz#1212802
* app: Do not map display to non-existent monitorPavel Grunt2015-11-041-1/+5
|
* app: Add helper for number of client monitorsPavel Grunt2015-11-041-6/+11
|
* util: Fix the size of sorted_displays allocationFabiano Fidêncio2015-10-211-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As sorted_displays is a vector containing all displays' order, its allocation size must be the maximum display id + 1 instead of the maximum display id. Also, fix the size used for sorting and iterating the sorted_displays vector. Valgrind log: ==15946== Invalid write of size 4 ==15946== at 0x4169C0: virt_viewer_align_monitors_linear (virt-viewer-util.c:581) ==15946== by 0x42248B: virt_viewer_session_on_monitor_geometry_changed (virt-viewer-session.c:438) ==15946== by 0xBB41F03: _g_closure_invoke_va (gclosure.c:831) ==15946== by 0xBB5BC7C: g_signal_emit_valist (gsignal.c:3214) ==15946== by 0xBB5C764: g_signal_emit_by_name (gsignal.c:3401) ==15946== by 0x4328F3: virt_viewer_display_spice_monitor_geometry_changed (virt-viewer-display-spice.c:93) ==15946== by 0x432D60: virt_viewer_display_spice_size_allocate (virt-viewer-display-spice.c:224) ==15946== by 0xBB41CD4: g_closure_invoke (gclosure.c:768) ==15946== by 0xBB53538: signal_emit_unlocked_R (gsignal.c:3549) ==15946== by 0xBB5BEEF: g_signal_emit_valist (gsignal.c:3305) ==15946== by 0xBB5C29E: g_signal_emit (gsignal.c:3361) ==15946== by 0x637D6F6: gtk_widget_size_allocate_with_baseline (gtkwidget.c:6093) ==15946== Address 0x18c79d4c is 0 bytes after a block of size 12 alloc'd ==15946== at 0x4C2A9C7: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==15946== by 0xBDD36D1: g_malloc0 (gmem.c:127) ==15946== by 0x41698D: virt_viewer_align_monitors_linear (virt-viewer-util.c:577) ==15946== by 0x42248B: virt_viewer_session_on_monitor_geometry_changed (virt-viewer-session.c:438) ==15946== by 0xBB41F03: _g_closure_invoke_va (gclosure.c:831) ==15946== by 0xBB5BC7C: g_signal_emit_valist (gsignal.c:3214) ==15946== by 0xBB5C764: g_signal_emit_by_name (gsignal.c:3401) ==15946== by 0x4328F3: virt_viewer_display_spice_monitor_geometry_changed (virt-viewer-display-spice.c:93) ==15946== by 0x432D60: virt_viewer_display_spice_size_allocate (virt-viewer-display-spice.c:224) ==15946== by 0xBB41CD4: g_closure_invoke (gclosure.c:768) ==15946== by 0xBB53538: signal_emit_unlocked_R (gsignal.c:3549) ==15946== by 0xBB5BEEF: g_signal_emit_valist (gsignal.c:3305) Resolves: rhbz#1272650 Related: rhbz#1267184
* session: Only create a hashtable if apply_monitor_geometry vfunc existsFabiano Fidêncio2015-10-211-1/+3
| | | | | | | | Creating the monitors hashtable only after checking for the existence of apply_monitor_geometry vfunc avoids leaking the hashtable in the case where the vfunc doesn't exist. Related: rhbz#1267184
* app: Use display id instead of 'this' in debugPavel Grunt2015-10-211-1/+1
|
* Stop polling after reconnecting to libvirtdChristophe Fergeau2015-10-201-0/+18
| | | | | | | | | | | | | | | | | When the connection to libvirtd is lost, virt-viewer starts polling for libvirtd to come back. The polling mechanism is also used when connecting to very old libvirtd which don't support virConnectDomainEventDeregisterAny(). Currently, once we could reconnect to libvirtd, virt-viewer will keep polling, thus behaving as if the libvirtd connection does not support virConnectDomainEventDeregisterAny(). This commit makes sure we stop polling once the new libvirtd connection is established. This has the side-effect of preventing https://bugzilla.redhat.com/show_bug.cgi?id=1271519 from occurring with recent libvirt as it's caused by some race occurring when using the polling code.
* Use the display ID to configure fullscreen monitorsJonathon Jongsma2015-10-095-62/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | When starting virt-viewer in fullscreen mode, we generally try to arrange guest displays exactly the same as client monitors. So if a client machine has two monitors, we'll try to enable display 0 and 1 on the guest (in that order). However, when using the configuration file to map fullscreen displays to different monitors, the guest displays may not be sequential, or there may be displays missing. For example, consider the following configuration: monitor-mapping=1:2;2:1 In virt_viewer_session_spice_fullscreen_auto_conf(), we were building an array of GdkRectangles for the initial monitors that we want to enable on the guest. We then configured the guest displays using the index of the array for the as the id of the guest display. But when displays are sparse or are out-of-sequence, the array index will not match the >ntended display ID. This created problems where displays were arranged incorrectly. By changing the simple array into a GHashTable, we can keep the display ID together with the GdkRectangle until we need to use it, and things will be configured correctly. This regression was introduced by c586dc8c. Fixes: rhbz#1267184
* SessionSpice: make main-window a propertyJonathon Jongsma2015-10-091-45/+77
| | | | | | | Make "main-window" a construct-only property of VirtViewerSessionSpice. This allows us to set it in the constructor and encapsulate all of the setup within the gobject constructor rather than doing extra work in the _new() function.
* Add new functions to enable/disable a displayJonathon Jongsma2015-09-104-7/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, there was a single function for controlling the enabled state of a display: virt_viewer_display_set_enabled(). Unfortunately, this function is used for two slightly different things: A. It informs the local display widget that the display has become disabled or enabled on the server. In other words, it tries to synchronize the 'enabled' state of the local widget with the actual state of the remote display. OR B. It tries to actively enable a currently-disabled display (or vice versa) due to some action by the user in the client application. This causes the client to send a new configuration down to the server. In other words, it tries to change the state of the remote display. There is some conflict between these two scenarios. If the change is due to a notification from the server, there is no need to send a new configuration back down to the server, so this results in unnecessary monitor configuration messages and can in fact cause issues that are a little bit hard to track down. Because of this, I decided that it was really necessary to have two separate functions for these two different scenarios. so the existing _set_enabled() function will be used for scenario A mentioned above. I added two new functions (_enable() and _disable()) that are used to send new configurations down to the server.
* Set enabled status of all displays when we get a monitor updateJonathon Jongsma2015-09-081-2/+4
| | | | | | | | | | Previously, when we received a new monitors update from the server, we only called virt_viewer_display_set_enabled() for the displays that were enabled. We simply assumed that those that were not enabled were already set to disabled. This assumption is currently valid, but I have some changes in the pipeline where this is not true. This change ensures that we update the enabled state of all monitors when we get an updated monitors conifguration.
* Don't emit 'monitor-geometry-changed' for disabled displaysJonathon Jongsma2015-09-081-20/+19
| | | | | | | | | When a display widget receives a new size allocation, we generally emit a monitor-geometry-changed signal so that we can reconfigure the displays. But if the widget for a *disabled* display is allocated, there's no reason to send down a new configuration. We don't need to emit this signal. This doesn't currently cause any problems, but I ran into issues while testing some other uncommitted changes.
* coverity: result is not floating-pointFabiano Fidêncio2015-08-171-2/+2
| | | | | | | | Coverity says: Result is not floating-point (UNINTENDED_INTEGER_DIVISION) interger_division: Dividing integer expressions "preferred->width * 100" and "zoom", and then converting the integer quotient to type double. Any remainder, or fractional part of the quotient, is ignored.
* coverity: Copy into fixed sized bufferFabiano Fidêncio2015-08-131-0/+5
| | | | | | | | Coverity says: You might overrun the 108 byte fixed-size string "addr.sun_path" by copying "unixsock" without checking the lenght. Note: This detect has an elevated risk because the source argument is a paramenter of the current function.
* session-spice: Use display id instead of monitor id in debug logPavel Grunt2015-07-291-1/+2
| | | | | Windows guests have monitor id = 0, so the debug log is always the same: "creating spice display (#:0)" for all the displays.
* virt-viewer-window: Change zoom with respect to real zoomPavel Grunt2015-07-291-3/+17
| | | | | | | | | The zoom can be changed by resizing the window (VNC / Spice without the agent). It is necessary to recalculate the zoom level before changing it, otherwise zoom operations will not work correctly. Resolves: https://bugs.freedesktop.org/show_bug.cgi?id=90582