summaryrefslogtreecommitdiff
path: root/gtk/spice-widget-x11.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2012-06-12 19:24:47 +0200
committerMarc-André Lureau <marcandre.lureau@redhat.com>2012-07-16 17:46:40 +0200
commite3bb7b1cfd162fcb8943e9d582dab43eeec6ce41 (patch)
tree7d508db3d891081b145903187103427ab0843a4d /gtk/spice-widget-x11.c
parent59b7c8a0053f4facb43b16313906353237a5e3db (diff)
display: learn to restrict display to an area
Each spice widget can now restrict the area of the primary surface they show and interact with by setting the private area member. A nice clean-up would be to seperate an area object that would deal with clipping, input translation and color conversion, but the resulting code would be similar anyway
Diffstat (limited to 'gtk/spice-widget-x11.c')
-rw-r--r--gtk/spice-widget-x11.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/gtk/spice-widget-x11.c b/gtk/spice-widget-x11.c
index be2b6e7..7fc99ff 100644
--- a/gtk/spice-widget-x11.c
+++ b/gtk/spice-widget-x11.c
@@ -222,30 +222,30 @@ void spicex_expose_event(SpiceDisplay *display, GdkEventExpose *expose)
if (expose->area.x >= d->mx &&
expose->area.y >= d->my &&
- expose->area.x + expose->area.width <= d->mx + d->width &&
- expose->area.y + expose->area.height <= d->my + d->height) {
+ expose->area.x + expose->area.width <= d->mx + d->area.width &&
+ expose->area.y + expose->area.height <= d->my + d->area.height) {
/* area is completely inside the guest screen -- blit it */
if (d->have_mitshm && d->shminfo) {
XShmPutImage(d->dpy, gdk_x11_drawable_get_xid(window),
d->gc, d->ximage,
- expose->area.x - d->mx, expose->area.y - d->my,
- expose->area.x, expose->area.y,
+ d->area.x + expose->area.x - d->mx, d->area.y + expose->area.y - d->my,
+ expose->area.x, expose->area.y,
expose->area.width, expose->area.height,
true);
} else {
XPutImage(d->dpy, gdk_x11_drawable_get_xid(window),
d->gc, d->ximage,
- expose->area.x - d->mx, expose->area.y - d->my,
- expose->area.x, expose->area.y,
+ d->area.x + expose->area.x - d->mx, d->area.y + expose->area.y - d->my,
+ expose->area.x expose->area.y,
expose->area.width, expose->area.height);
}
} else {
/* complete window update */
- if (d->ww > d->width || d->wh > d->height) {
+ if (d->ww > d->area.width || d->wh > d->area.height) {
int x1 = d->mx;
- int x2 = d->mx + d->width;
+ int x2 = d->mx + d->area.width;
int y1 = d->my;
- int y2 = d->my + d->height;
+ int y2 = d->my + d->area.height;
XFillRectangle(d->dpy, gdk_x11_drawable_get_xid(window),
d->gc, 0, 0, x1, d->wh);
XFillRectangle(d->dpy, gdk_x11_drawable_get_xid(window),
@@ -258,12 +258,12 @@ void spicex_expose_event(SpiceDisplay *display, GdkEventExpose *expose)
if (d->have_mitshm && d->shminfo) {
XShmPutImage(d->dpy, gdk_x11_drawable_get_xid(window),
d->gc, d->ximage,
- 0, 0, d->mx, d->my, d->width, d->height,
+ d->area.x, d->area.y, d->mx, d->my, d->area.width, d->area.height,
true);
} else {
XPutImage(d->dpy, gdk_x11_drawable_get_xid(window),
d->gc, d->ximage,
- 0, 0, d->mx, d->my, d->width, d->height);
+ d->area.x, d->area.y, d->mx, d->my, d->area.width, d->area.height);
}
}
}