[gtk+/broadway: 46/71] [broadway] Implement window resize
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/broadway: 46/71] [broadway] Implement window resize
- Date: Thu, 25 Nov 2010 21:19:08 +0000 (UTC)
commit b82ed847096a875c158fe4e598a8cff9b0225c6b
Author: Alexander Larsson <alexl redhat com>
Date: Tue Nov 23 12:52:10 2010 +0100
[broadway] Implement window resize
gdk/broadway/broadway.c | 13 +++++++++++
gdk/broadway/broadway.h | 4 +++
gdk/broadway/broadway.js | 12 ++++++++++
gdk/broadway/gdkwindow-broadway.c | 44 +++++++++++++++++++++++++++++++++---
4 files changed, 69 insertions(+), 4 deletions(-)
---
diff --git a/gdk/broadway/broadway.c b/gdk/broadway/broadway.c
index f7e2c7d..2e27a3a 100644
--- a/gdk/broadway/broadway.c
+++ b/gdk/broadway/broadway.c
@@ -823,6 +823,19 @@ broadway_client_move_surface(BroadwayClient *client, int id, int x, int y)
}
void
+broadway_client_resize_surface(BroadwayClient *client, int id, int w, int h)
+{
+ char buf[10];
+
+ buf[0] = 'r';
+ base64_uint16(id, &buf[1]);
+ base64_uint16(w, &buf[4]);
+ base64_uint16(h, &buf[7]);
+
+ broadway_client_write (client, buf, 10);
+}
+
+void
broadway_client_put_rgb (BroadwayClient *client, int id, int x, int y,
int w, int h, int byte_stride, void *data)
{
diff --git a/gdk/broadway/broadway.h b/gdk/broadway/broadway.h
index 78154d2..16292ae 100644
--- a/gdk/broadway/broadway.h
+++ b/gdk/broadway/broadway.h
@@ -23,6 +23,10 @@ void broadway_client_move_surface (BroadwayClient *client,
int id,
int x,
int y);
+void broadway_client_resize_surface (BroadwayClient *client,
+ int id,
+ int w,
+ int h);
void broadway_client_put_rgb (BroadwayClient *client,
int id,
int x,
diff --git a/gdk/broadway/broadway.js b/gdk/broadway/broadway.js
index 4e5fbee..d231384 100644
--- a/gdk/broadway/broadway.js
+++ b/gdk/broadway/broadway.js
@@ -144,6 +144,18 @@ function handleCommands(cmd_obj)
surfaces[id].canvas.style["top"] = y + "px";
break;
+ /* resize a surface */
+ case 'r':
+ var id = base64_16(cmd, i);
+ i = i + 3;
+ var w = base64_16(cmd, i);
+ i = i + 3;
+ var h = base64_16(cmd, i);
+ i = i + 3;
+ surfaces[id].canvas.width = w;
+ surfaces[id].canvas.height = h;
+ break;
+
/* put image data surface */
case 'i':
var id = base64_16(cmd, i);
diff --git a/gdk/broadway/gdkwindow-broadway.c b/gdk/broadway/gdkwindow-broadway.c
index 07e2868..ef69351 100644
--- a/gdk/broadway/gdkwindow-broadway.c
+++ b/gdk/broadway/gdkwindow-broadway.c
@@ -504,11 +504,16 @@ gdk_window_broadway_move_resize (GdkWindow *window,
{
GdkWindowObject *private = (GdkWindowObject *) window;;
GdkWindowImplBroadway *impl = GDK_WINDOW_IMPL_BROADWAY (private->impl);
+ GdkDrawableImplBroadway *drawable = GDK_DRAWABLE_IMPL_BROADWAY (impl);
GdkDisplayBroadway *display_broadway;
+ gboolean changed;
+
+ changed = FALSE;
display_broadway = GDK_DISPLAY_BROADWAY (gdk_window_get_display (window));
if (with_move)
{
+ changed = TRUE;
private->x = x;
private->y = y;
if (display_broadway->output != NULL)
@@ -528,11 +533,42 @@ gdk_window_broadway_move_resize (GdkWindow *window,
if (height < 1)
height = 1;
- g_print ("TODO: Ignoring resize of window %p\n", window);
+ if (width != private->width ||
+ height != private->height)
+ {
+ changed = TRUE;
+
+ /* Resize clears the content */
+ impl->dirty = TRUE;
+ impl->last_synced = FALSE;
+
+ broadway_client_resize_surface (display_broadway->output,
+ impl->id, width, height);
+ queue_dirty_flush (display_broadway);
+
+ private->width = width;
+ private->height = height;
+ _gdk_broadway_drawable_update_size (private->impl);
+ gdk_window_invalidate_rect (window, NULL, TRUE);
+ }
+ }
+
+ if (changed)
+ {
+ GdkEvent *event;
+ GList *node;
+
+ event = gdk_event_new (GDK_CONFIGURE);
+ event->configure.window = g_object_ref (window);
+ event->configure.x = private->x;
+ event->configure.y = private->y;
+ event->configure.width = private->width;
+ event->configure.height = private->height;
+
+ gdk_event_set_device (event, GDK_DISPLAY_OBJECT (display_broadway)->core_pointer);
- private->width = width;
- private->height = height;
- _gdk_broadway_drawable_update_size (private->impl);
+ node = _gdk_event_queue_append (GDK_DISPLAY_OBJECT (display_broadway), event);
+ _gdk_windowing_got_event (GDK_DISPLAY_OBJECT (display_broadway), node, event, 0);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]