[Spice-commits] 3 commits - gtk/spice-widget.c gtk/spice-widget-cairo.c gtk/spice-widget-x11.c
Marc-André Lureau
elmarco at kemper.freedesktop.org
Fri Aug 31 09:46:29 PDT 2012
gtk/spice-widget-cairo.c | 11 ++++++++++-
gtk/spice-widget-x11.c | 4 ++++
gtk/spice-widget.c | 29 +++++++++++++++++++++++++++--
3 files changed, 41 insertions(+), 3 deletions(-)
New commits:
commit a9557b4dd1bd63de0c122d546ec0b13be3f26e53
Author: Alexander Larsson <alexl at redhat.com>
Date: Fri Aug 31 17:03:34 2012 +0200
Make region code build with gtk2
https://bugs.freedesktop.org/show_bug.cgi?id=54277
diff --git a/gtk/spice-widget-cairo.c b/gtk/spice-widget-cairo.c
index cd310cd..8f424cb 100644
--- a/gtk/spice-widget-cairo.c
+++ b/gtk/spice-widget-cairo.c
@@ -74,6 +74,14 @@ void spicex_image_destroy(SpiceDisplay *display)
d->convert = FALSE;
}
+#if !GTK_CHECK_VERSION (3, 0, 0)
+#define cairo_rectangle_int_t GdkRectangle
+#define cairo_region_t GdkRegion
+#define cairo_region_create_rectangle gdk_region_rectangle
+#define cairo_region_subtract_rectangle(_dest,_rect) { GdkRegion *_region = gdk_region_rectangle (_rect); gdk_region_subtract (_dest, _region); }
+#define cairo_region_destroy gdk_region_destroy
+#endif
+
G_GNUC_INTERNAL
void spicex_draw_event(SpiceDisplay *display, cairo_t *cr)
{
commit df165ab9c128db38e6664509d3b94d4999adacca
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date: Thu Aug 30 23:08:04 2012 +0200
Fix X11 backend
The X11 backend allocates the "image" with X11 and needs the widget to
be realized before calling spicex_image_create().
https://bugs.freedesktop.org/show_bug.cgi?id=54310
diff --git a/gtk/spice-widget-cairo.c b/gtk/spice-widget-cairo.c
index b457f89..cd310cd 100644
--- a/gtk/spice-widget-cairo.c
+++ b/gtk/spice-widget-cairo.c
@@ -37,7 +37,8 @@ int spicex_image_create(SpiceDisplay *display)
{
SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
- g_return_val_if_fail(d->ximage == NULL, 1);
+ if (d->ximage != NULL)
+ return 0;
if (d->format == SPICE_SURFACE_FMT_16_555 ||
d->format == SPICE_SURFACE_FMT_16_565) {
diff --git a/gtk/spice-widget-x11.c b/gtk/spice-widget-x11.c
index 178dc98..05b8d56 100644
--- a/gtk/spice-widget-x11.c
+++ b/gtk/spice-widget-x11.c
@@ -122,6 +122,10 @@ G_GNUC_INTERNAL
int spicex_image_create(SpiceDisplay *display)
{
SpiceDisplayPrivate *d = SPICE_DISPLAY_GET_PRIVATE(display);
+
+ if (d->ximage != NULL)
+ return 0;
+
GdkDrawable *window = gtk_widget_get_window(GTK_WIDGET(display));
GdkDisplay *gtkdpy = gdk_drawable_get_display(window);
void *old_handler = NULL;
diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
index 528eb84..47afa40 100644
--- a/gtk/spice-widget.c
+++ b/gtk/spice-widget.c
@@ -1503,6 +1503,21 @@ static gboolean configure_event(GtkWidget *widget, GdkEventConfigure *conf)
return true;
}
+static void realize(GtkWidget *widget)
+{
+ GTK_WIDGET_CLASS(spice_display_parent_class)->realize(widget);
+
+ spicex_image_create(SPICE_DISPLAY(widget));
+}
+
+static void unrealize(GtkWidget *widget)
+{
+ spicex_image_destroy(SPICE_DISPLAY(widget));
+
+ GTK_WIDGET_CLASS(spice_display_parent_class)->unrealize(widget);
+}
+
+
/* ---------------------------------------------------------------- */
static void spice_display_class_init(SpiceDisplayClass *klass)
@@ -1526,6 +1541,8 @@ static void spice_display_class_init(SpiceDisplayClass *klass)
gtkwidget_class->button_release_event = button_event;
gtkwidget_class->configure_event = configure_event;
gtkwidget_class->scroll_event = scroll_event;
+ gtkwidget_class->realize = realize;
+ gtkwidget_class->unrealize = unrealize;
gobject_class->constructor = spice_display_constructor;
gobject_class->dispose = spice_display_dispose;
@@ -1838,7 +1855,8 @@ static void update_area(SpiceDisplay *display,
spicex_image_destroy(display);
d->area = area;
- spicex_image_create(display);
+ if (gtk_widget_get_realized(GTK_WIDGET(display)))
+ spicex_image_create(display);
update_size_request(display);
set_monitor_ready(display, true);
commit 36458c62bea191e8473b47b5f31f6af99e380606
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date: Thu Aug 30 22:15:56 2012 +0200
Update SpiceDisplay:only-downscale documentation
diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
index 5045fb0..528eb84 100644
--- a/gtk/spice-widget.c
+++ b/gtk/spice-widget.c
@@ -1640,10 +1640,17 @@ static void spice_display_class_init(SpiceDisplayClass *klass)
G_PARAM_CONSTRUCT |
G_PARAM_STATIC_STRINGS));
+ /**
+ * SpiceDisplay:only-downscale:
+ *
+ * If scaling, only scale down, never up.
+ *
+ * Since: 0.14
+ **/
g_object_class_install_property
(gobject_class, PROP_ONLY_DOWNSCALE,
g_param_spec_boolean("only-downscale", "Only Downscale",
- "If scaling, only scale down, never up. Since: 0.14",
+ "If scaling, only scale down, never up",
FALSE,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT |
More information about the Spice-commits
mailing list