Commit Graph

33 Commits

Author SHA1 Message Date
Marc-André Lureau
c075c54729 widget: modify update-area to not require primary surface
If egl display is enabled, use GL scanout geometry to check intersection
with the monitor area. This solves displaying GL display without
software canvas (currently d->area is empty and gl drawing fails)

Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-03-24 16:55:58 +01:00
Marc-André Lureau
962ebf97e7 widget: update d->ready based on scanout image available
d->ready is updated based on monitor area & canvas. In case of GL
rendering, update it based on monitor area & scanout and add check
before drawing update.

Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-03-24 16:55:58 +01:00
Marc-André Lureau
75efdeaeba widget: make gl-scanout and update-monitor-area privately exported
The following changes will call these functions from spice-widget-egl.c

Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-03-24 16:55:58 +01:00
Marc-André Lureau
81767eb476 display: return NULL in spice_display_get_gl_scanout()
If there is no valid scanout, return NULL.

Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-03-24 16:55:58 +01:00
Marc-André Lureau
804b50fa44 widget: enable egl before updating scanout
The GLArea is realized lazily, when it is made visible in
set_egl_enabled(). The egl context is initialized once the GLArea is
realized. Enable egl before updating the scanout.

Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-03-24 16:55:58 +01:00
Marc-André Lureau
ec20a61d68 egl: check context is ready
Add a new GL status field to check if the GL context is ready. This
helps debugging races where GL is called before the context is ready.

Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-03-24 16:55:58 +01:00
Marc-André Lureau
f6d351662d widget: remove superflous WIN32 check
The egl call is already inside a X11 conditional block.

Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-03-24 16:55:58 +01:00
Marc-André Lureau
3390203021 widget: use allocation instead of window size
Since spice-gtk 57df040cc, the SpiceDisplay no longer forces its own
window. Get allocation instead of window size.  This fixes a "top
border" issue in spicy with gtk+ >= 3.19.8.

Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-03-23 17:18:43 +01:00
Marc-André Lureau
8d10969828 widget: offset draw updates by widget allocation if necessary
According to gtk_widget_queue_draw_area() documentation:

"The region here is specified in widget coordinates. Widget coordinates
are a bit odd; for historical reasons, they are defined as
widget->window coordinates for widgets that return TRUE for
gtk_widget_get_has_window(), and are relative to widget->allocation.x ,
widget->allocation.y otherwise."

Since spice-gtk 57df040cc, the SpiceDisplay no longer forces its own
window. During gtk+ 3.19.8, gtk stack also no longer use its own
window (commit 9d0e8401). In order to make drawing update resilient to
such changes, add a function applying offset if necessary.

This solves drawing glitches and perceived slowness with spice-gtk git
and gtk+ >= 3.19.8.

Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-03-23 17:18:22 +01:00
Frediano Ziglio
1174c439dc Avoid to access array with negative numbers 2016-03-23 15:51:56 +00:00
Fabiano Fidêncio
74a5ef7dcf mingw: Fix build failure due to epoxy/egl.h header
epoxy/egl.h header is not provided by mingw-epoxy package.
Let's avoid egl usage when building using mingw then.

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Acked-by: Marc-André Lureau <mlureau@redhat.com>
2016-03-21 16:17:31 +01:00
Pavel Grunt
0a9ec4ec01 Adjust to GLib 2.36
Dependency since 8693e7d3f7

Remove glib-compat files and most of GLIB_CHECK_VERSION guards

Acked-by: Victor Toso <victortoso@redhat.com>
2016-03-18 11:42:31 +01:00
Pavel Grunt
ff3380d406 spice-display: Remove auto-clipboard notify
It was used to notify the (deprecated) auto-clipboard property of
the SpiceDisplay everytime the SpiceGtkSession emits its auto-clipboard
notify.

The commit 70a00b8fcc removed the property
from SpiceDisplay causing a runtime warning:

GLib-GObject-WARNING **: g_object_notify: object class 'SpiceDisplay' has no property named 'auto-clipboard'
Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2016-03-17 08:18:37 +01:00
Marc-André Lureau
f9a1aad85f Lower gtk+ requirement to 3.10
Make GtkGlArea optional allows to lower gtk+ requirement to
3.10 (required for GtkStack). However, gl display is unsupported on
wayland with gtk+ < 3.16.

Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2016-03-15 17:11:14 +01:00
Marc-André Lureau
6d8ca210d8 gtk: add GtkGLArea
GtkGLArea is the proper modern way to have opengl in an gtk+
application. Unfortunately, it may use various backends and interfaces
to initialize it, but dmabuf image sharing requires egl atm.

This patch keeps using our egl setup on X11, while it uses gtkglarea on
known gdk backend based on egl, such as the wayland one. This brings
wayland support for local gl to spice-gtk.

Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2016-03-14 13:48:48 +01:00
Marc-André Lureau
2cb74f4ac1 gtk: use GtkStack
Move the GtkDrawingArea in a GtkStack, so other widgets can be switched
to for the display: the next patch adds a GtkGLArea for an opengl
rendering. One can imagine other display widgets to show text etc..

Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2016-03-14 13:48:47 +01:00
Marc-André Lureau
c73950df1f gtk: require gtk+ 3.16
3.16 is the minimal version for GtkGLArea widget, used in following
patches.

Drop conditional epoxy support, as it is now required by gtk+.

Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2016-03-14 13:48:45 +01:00
Marc-André Lureau
70a00b8fcc gtk: drop deprecated stuff from spice-gtk
Breaking ABI is a good time to remove deprecated code.

Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2016-03-14 12:02:53 +01:00
Marc-André Lureau
0917002c48 Drop GTK+ 2.0
Not so many systems require gtk+ 2.0 these days, let's move on.

This drops the old python bindings (non-gir based), and the
unsteady/experimental gtk2-only XShm support.

Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2016-03-14 12:02:52 +01:00
Marc-André Lureau
693cef4eaa gtk: make SpiceGrabSequence private
Do not leak internals of SpiceGrabSequence in public headers. This makes also
the class final, which let us extend more easily without fear of breaking ABI.

Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
2016-03-14 12:02:50 +01:00
Marc-André Lureau
f81ffa25ae gtk: add spice-widget GL scanout support
Hook to spice-glib events to show the GL scanout.

The opengl context is created with egl, and is currently
x11-only (supporting wayland with bare-egl doesn't seem trivial).

Using GtkGLArea is left for a future series, since SpiceDisplay widget
is a GtkDrawingArea and can't be replaced without breaking
ABI. Furthermore, GtkGLArea won't work on non-egl contexts, so this
approach is necessary on gtk+ < 3.16 or X11 (because gdk/x11 uses glx).

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
Acked-by: Pavel Grunt <pgrunt@redhat.com>
2016-02-16 14:22:24 +01:00
Fabiano Fidêncio
cd0c100831 Use #ifdef {HAVE,USE}_FOO instead of #if {HAVE,USE}_FOO
While "#if USE_FOO" checks for the value of the variable USE_FOO,
"#ifdef" checks whether USE_FOO is defined or not.

It means, if we had something like: #define USE_FOO 0, we would have:
 #if USE_FOO
 /* Any code in here would NOT be compiled */
 #endif

 #ifdef USE_FOO
 /* Any code in here would be compiled */
 #endif

No problem was faced on spice-gtk till now because either USE_FOO is not
defined or defined as 1, but let's try to have it standardized.

Acked-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
2016-02-12 10:39:17 +01:00
Marc-André Lureau
57df040cc5 gtk: replace configure-event for size-allocate
For size-allocate, it's simpler to connect to the signal rather than
override the default signal handler since there is no automatic chaining
to parent handler otherwise. Doing this removes the need to have a
window.

Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
Acked-by: Victor Toso <victortoso@redhat.com>
2016-02-03 20:13:34 +01:00
snir sheriber
143ebfdf27 Grab keyboard based on session focus.
When using multiple monitors moving mouse between monitors releases
keyboard grab.

Reproduce bug
-Open multiple monitors remote-viewer session
-Click on one of the monitors to get focus & keyboard-grab
-Move mouse to another monitor and try keyboard command (do not click)
At this point all keyboard commands are being executed on the client
machine instead of the remote machine

I added keyboard_has_focus and mouse_has_pointer variables at the
session and now these properties are being tested for the session
instead for the current widget (works also when using alt-tab).

Resolves: rhbz#1275231

Acked-by: Pavel Grunt <pgrunt@redhat.com>
2015-12-21 18:51:12 +01:00
Jonathon Jongsma
056f0510a9 Gtk applications should only include spice-client-gtk.h
This header is the single include needed for all gtk-related
functionality, similar to spice-client.h. Generate a compiler warning if
a different header is included.
2015-10-09 10:00:56 -05:00
Pavel Grunt
a2f6ac46b3 docs: Add missing symbol description strings 2015-09-25 13:39:40 +02:00
Pavel Grunt
a9cd796fef docs: Add missing parameter/field descriptions 2015-09-25 13:39:26 +02:00
Pavel Grunt
339322adf4 channel-main: Rename parameter to match docs 2015-09-25 13:39:00 +02:00
Jonathon Jongsma
7f46b1575f Don't send monitors config when Display widget is created
When a display channel is associated with a particular SpiceDisplay
widget, it previously set the display to 'enabled' unconditionally.
There is a couple of problems with this behavior.

First, simply because a display widget has an associated display
channel, it doesn't necessarily mean that the display is enabled. On
linux guests, for instance, a display channel can have up to 4 displays
for one channel, and perhaps only one of them is enabled. So, we
shouldn't set the display to 'enabled' until we actually receive a
monitors configuration message indicating that this display is enabled.

The second problem is that this was triggering the client to send down a
new monitors-config message to the server. This message is completely
unnecessary since it is triggered by a message from the server. We
should only be sending down new monitor configurations in response to
changes from the client, not from the server.
2015-09-10 15:52:12 -05:00
Sandy Stutsman
8b0cd321d5 Handle single headed monitors that have a non-zero x, y config
Each monitor on a Windows guest is represented as a separate, single-headed
device with its own framebuffer.  When there are multiple monitors, all
monitors but one will have a non-zero xy config position.  But even in
these cases the whole area (frame-buffer) of each monitor should be
updated.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1202419
2015-07-28 22:11:47 +02:00
Victor Toso
1af5b67bcd spice-widget: keypress-delay set by env var 2015-06-18 15:23:10 +02:00
Fabiano Fidêncio
28312b8d1e spice-widget: Do not update display when resize-guest is disabled
Updating the display causes weird behaviors in virt-viewer, like
re-resizing to a previous monitor config when, after changing the
display resolution (through System > PReferences > Displays). the agent
reconnects.
It is not perfect yet, because when the agent reconnects the guest
resizes to the previous config and switch to the proper one, but this
seems more like an agent bug than a spice-gtk one.
2015-06-09 15:48:34 +02:00
Marc-André Lureau
caf28401ca Move gtk/ -> src/
For historical reasons, the code was placed under gtk/ subdirectory.
If it was always bugging you, bug no more!
2015-06-08 17:38:58 +02:00