summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdk/broadway/broadway-protocol.h1
-rw-r--r--gdk/broadway/broadway-server.c79
-rw-r--r--gdk/broadway/broadway-server.h1
-rw-r--r--gdk/broadway/broadway.js4
-rw-r--r--gdk/broadway/broadwayd.c16
-rw-r--r--gdk/broadway/gdkbroadway-server.c14
-rw-r--r--gdk/broadway/gdkbroadway-server.h1
-rw-r--r--gdk/broadway/gdkwindow-broadway.c47
8 files changed, 94 insertions, 69 deletions
diff --git a/gdk/broadway/broadway-protocol.h b/gdk/broadway/broadway-protocol.h
index 2a993bc7d7..abc0da711d 100644
--- a/gdk/broadway/broadway-protocol.h
+++ b/gdk/broadway/broadway-protocol.h
@@ -190,6 +190,7 @@ typedef struct {
typedef struct {
BroadwayRequestBase base;
guint32 id;
+ guint32 with_move;
gint32 x;
gint32 y;
guint32 width;
diff --git a/gdk/broadway/broadway-server.c b/gdk/broadway/broadway-server.c
index 07652ef3aa..313aba06cd 100644
--- a/gdk/broadway/broadway-server.c
+++ b/gdk/broadway/broadway-server.c
@@ -152,6 +152,8 @@ static void
update_event_state (BroadwayServer *server,
BroadwayInputMsg *message)
{
+ BroadwayWindow *window;
+
switch (message->base.type) {
case BROADWAY_EVENT_ENTER:
server->last_x = message->pointer.root_x;
@@ -197,6 +199,13 @@ update_event_state (BroadwayServer *server,
case BROADWAY_EVENT_UNGRAB_NOTIFY:
break;
case BROADWAY_EVENT_CONFIGURE_NOTIFY:
+ window = g_hash_table_lookup (server->id_ht,
+ GINT_TO_POINTER (message->configure_notify.id));
+ if (window != NULL)
+ {
+ window->x = message->configure_notify.x;
+ window->y = message->configure_notify.y;
+ }
break;
case BROADWAY_EVENT_DELETE_NOTIFY:
break;
@@ -241,10 +250,24 @@ is_pointer_event (BroadwayInputMsg *message)
}
static void
+process_input_message (BroadwayServer *server,
+ BroadwayInputMsg *message)
+{
+ gint32 client;
+
+ update_event_state (server, message);
+ client = -1;
+ if (is_pointer_event (message) &&
+ server->pointer_grab_window_id != -1)
+ client = server->pointer_grab_client_id;
+
+ broadway_events_got_input (message, client);
+}
+
+static void
process_input_messages (BroadwayServer *server)
{
BroadwayInputMsg *message;
- gint32 client;
while (server->input_messages)
{
@@ -261,17 +284,29 @@ process_input_messages (BroadwayServer *server)
message->base.serial = server->saved_serial - 1;
}
- update_event_state (server, message);
- client = -1;
- if (is_pointer_event (message) &&
- server->pointer_grab_window_id != -1)
- client = server->pointer_grab_client_id;
-
- broadway_events_got_input (message, client);
+ process_input_message (server, message);
g_free (message);
}
}
+static void
+fake_configure_notify (BroadwayServer *server,
+ BroadwayWindow *window)
+{
+ BroadwayInputMsg ev = { {0} };
+
+ ev.base.type = BROADWAY_EVENT_CONFIGURE_NOTIFY;
+ ev.base.serial = server->saved_serial - 1;
+ ev.base.time = server->last_seen_time;
+ ev.configure_notify.id = window->id;
+ ev.configure_notify.x = window->x;
+ ev.configure_notify.y = window->y;
+ ev.configure_notify.width = window->width;
+ ev.configure_notify.height = window->height;
+
+ process_input_message (server, &ev);
+}
+
static char *
parse_pointer_data (char *p, BroadwayInputPointerMsg *data)
{
@@ -309,6 +344,8 @@ parse_input_message (BroadwayInput *input, const char *message)
char *p;
gint64 time_;
+ memset (&msg, 0, sizeof (msg));
+
p = (char *)message;
msg.base.type = *p++;
msg.base.serial = (guint32)strtol (p, &p, 10);
@@ -1525,13 +1562,14 @@ broadway_server_window_update (BroadwayServer *server,
gboolean
broadway_server_window_move_resize (BroadwayServer *server,
gint id,
+ gboolean with_move,
int x,
int y,
int width,
int height)
{
BroadwayWindow *window;
- gboolean with_move, with_resize;
+ gboolean with_resize;
gboolean sent = FALSE;
cairo_t *cr;
@@ -1540,10 +1578,7 @@ broadway_server_window_move_resize (BroadwayServer *server,
if (window == NULL)
return FALSE;
- with_move = x != window->x || y != window->y;
with_resize = width != window->width || height != window->height;
- window->x = x;
- window->y = y;
window->width = width;
window->height = height;
@@ -1570,10 +1605,20 @@ broadway_server_window_move_resize (BroadwayServer *server,
{
broadway_output_move_resize_surface (server->output,
window->id,
- with_move, window->x, window->y,
+ with_move, x, y,
with_resize, window->width, window->height);
sent = TRUE;
}
+ else
+ {
+ if (with_move)
+ {
+ window->x = x;
+ window->y = y;
+ }
+
+ fake_configure_notify (server, window);
+ }
return sent;
}
@@ -1652,6 +1697,12 @@ broadway_server_new_window (BroadwayServer *server,
window->id = server->id_counter++;
window->x = x;
window->y = y;
+ if (x == 0 && y == 0 && !is_temp)
+ {
+ /* TODO: Better way to know if we should pick default pos */
+ window->x = 100;
+ window->y = 100;
+ }
window->width = width;
window->height = height;
window->is_temp = is_temp;
@@ -1670,6 +1721,8 @@ broadway_server_new_window (BroadwayServer *server,
window->width,
window->height,
window->is_temp);
+ else
+ fake_configure_notify (server, window);
return window->id;
}
diff --git a/gdk/broadway/broadway-server.h b/gdk/broadway/broadway-server.h
index e0a59c1fad..5860ad8386 100644
--- a/gdk/broadway/broadway-server.h
+++ b/gdk/broadway/broadway-server.h
@@ -69,6 +69,7 @@ void broadway_server_window_update (BroadwayServer *
cairo_surface_t *surface);
gboolean broadway_server_window_move_resize (BroadwayServer *server,
gint id,
+ gboolean with_move,
int x,
int y,
int width,
diff --git a/gdk/broadway/broadway.js b/gdk/broadway/broadway.js
index 6ad454a70b..8f20cce213 100644
--- a/gdk/broadway/broadway.js
+++ b/gdk/broadway/broadway.js
@@ -350,10 +350,6 @@ function cmdCreateSurface(id, x, y, width, height, isTemp)
toplevelElement = frame;
document.body.appendChild(frame);
-
- surface.x = 100 + positionIndex * 10;
- surface.y = 100 + positionIndex * 10;
- positionIndex = (positionIndex + 1) % 20;
}
surface.toplevelElement = toplevelElement;
diff --git a/gdk/broadway/broadwayd.c b/gdk/broadway/broadwayd.c
index 14f884487c..f756bf36c5 100644
--- a/gdk/broadway/broadwayd.c
+++ b/gdk/broadway/broadwayd.c
@@ -349,15 +349,13 @@ client_handle_request (BroadwayClient *client,
}
break;
case BROADWAY_REQUEST_MOVE_RESIZE:
- if (!broadway_server_window_move_resize (server,
- request->move_resize.id,
- request->move_resize.x,
- request->move_resize.y,
- request->move_resize.width,
- request->move_resize.height))
- {
- /* TODO: Send configure request */
- }
+ broadway_server_window_move_resize (server,
+ request->move_resize.id,
+ request->move_resize.with_move,
+ request->move_resize.x,
+ request->move_resize.y,
+ request->move_resize.width,
+ request->move_resize.height);
break;
case BROADWAY_REQUEST_GRAB_POINTER:
reply_grab_pointer.status =
diff --git a/gdk/broadway/gdkbroadway-server.c b/gdk/broadway/gdkbroadway-server.c
index 0699778eec..b67f2fe8e0 100644
--- a/gdk/broadway/gdkbroadway-server.c
+++ b/gdk/broadway/gdkbroadway-server.c
@@ -176,7 +176,7 @@ parse_all_input (GdkBroadwayServer *server)
server->incomming = g_list_append (server->incomming, reply);
}
-
+
if (p < end)
memmove (server->recv_buffer, p, end - p);
server->recv_buffer_size = end - p;
@@ -261,7 +261,7 @@ process_input_messages (GdkBroadwayServer *server)
g_source_remove (server->process_input_idle);
server->process_input_idle = 0;
}
-
+
while (server->incomming)
{
reply = server->incomming->data;
@@ -609,14 +609,15 @@ _gdk_broadway_server_window_update (GdkBroadwayServer *server,
memcpy (msg.name, data->name, 34);
msg.width = cairo_image_surface_get_width (surface);
msg.height = cairo_image_surface_get_height (surface);
-
- gdk_broadway_server_send_message (server, msg,
+
+ gdk_broadway_server_send_message (server, msg,
BROADWAY_REQUEST_UPDATE);
}
gboolean
_gdk_broadway_server_window_move_resize (GdkBroadwayServer *server,
gint id,
+ gboolean with_move,
int x,
int y,
int width,
@@ -625,6 +626,7 @@ _gdk_broadway_server_window_move_resize (GdkBroadwayServer *server,
BroadwayRequestMoveResize msg;
msg.id = id;
+ msg.with_move = with_move;
msg.x = x;
msg.y = y;
msg.width = width;
@@ -659,7 +661,7 @@ _gdk_broadway_server_grab_pointer (GdkBroadwayServer *server,
g_assert (reply->base.type == BROADWAY_REPLY_GRAB_POINTER);
status = reply->grab_pointer.status;
-
+
g_free (reply);
return status;
@@ -682,7 +684,7 @@ _gdk_broadway_server_ungrab_pointer (GdkBroadwayServer *server,
g_assert (reply->base.type == BROADWAY_REPLY_UNGRAB_POINTER);
status = reply->ungrab_pointer.status;
-
+
g_free (reply);
return status;
diff --git a/gdk/broadway/gdkbroadway-server.h b/gdk/broadway/gdkbroadway-server.h
index ad0a467e59..6c63edee73 100644
--- a/gdk/broadway/gdkbroadway-server.h
+++ b/gdk/broadway/gdkbroadway-server.h
@@ -62,6 +62,7 @@ void _gdk_broadway_server_window_update (GdkBroadwaySer
cairo_surface_t *surface);
gboolean _gdk_broadway_server_window_move_resize (GdkBroadwayServer *server,
gint id,
+ gboolean with_move,
int x,
int y,
int width,
diff --git a/gdk/broadway/gdkwindow-broadway.c b/gdk/broadway/gdkwindow-broadway.c
index 9c940d921a..7a1245cca0 100644
--- a/gdk/broadway/gdkwindow-broadway.c
+++ b/gdk/broadway/gdkwindow-broadway.c
@@ -426,17 +426,11 @@ gdk_window_broadway_move_resize (GdkWindow *window,
{
GdkWindowImplBroadway *impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
GdkBroadwayDisplay *broadway_display;
- gboolean changed, size_changed;;
+ gboolean size_changed;
- size_changed = changed = FALSE;
+ size_changed = FALSE;
broadway_display = GDK_BROADWAY_DISPLAY (gdk_window_get_display (window));
- if (with_move)
- {
- changed = TRUE;
- window->x = x;
- window->y = y;
- }
if (width > 0 || height > 0)
{
@@ -449,7 +443,6 @@ gdk_window_broadway_move_resize (GdkWindow *window,
if (width != window->width ||
height != window->height)
{
- changed = TRUE;
size_changed = TRUE;
/* Resize clears the content */
@@ -462,34 +455,14 @@ gdk_window_broadway_move_resize (GdkWindow *window,
}
}
- if (changed)
- {
- GdkEvent *event;
- GList *node;
-
- if (_gdk_broadway_server_window_move_resize (broadway_display->server,
- impl->id,
- window->x, window->y,
- window->width, window->height))
- {
- queue_dirty_flush (broadway_display);
- if (size_changed)
- window->resize_count++;
- }
-
- event = gdk_event_new (GDK_CONFIGURE);
- event->configure.window = g_object_ref (window);
- event->configure.x = window->x;
- event->configure.y = window->y;
- event->configure.width = window->width;
- event->configure.height = window->height;
-
- gdk_event_set_device (event, GDK_DISPLAY_OBJECT (broadway_display)->core_pointer);
-
- node = _gdk_event_queue_append (GDK_DISPLAY_OBJECT (broadway_display), event);
- _gdk_windowing_got_event (GDK_DISPLAY_OBJECT (broadway_display), node, event,
- _gdk_display_get_next_serial (GDK_DISPLAY (broadway_display)) - 1);
- }
+ _gdk_broadway_server_window_move_resize (broadway_display->server,
+ impl->id,
+ with_move,
+ x, y,
+ window->width, window->height);
+ queue_dirty_flush (broadway_display);
+ if (size_changed)
+ window->resize_count++;
}
static gboolean