diff --git a/gdk/broadway/broadway-output.c b/gdk/broadway/broadway-output.c index e77be3355b..42ad59f050 100644 --- a/gdk/broadway/broadway-output.c +++ b/gdk/broadway/broadway-output.c @@ -216,6 +216,20 @@ broadway_output_hide_surface(BroadwayOutput *output, int id) append_uint16 (output, id); } +void +broadway_output_raise_surface(BroadwayOutput *output, int id) +{ + write_header (output, BROADWAY_OP_RAISE_SURFACE); + append_uint16 (output, id); +} + +void +broadway_output_lower_surface(BroadwayOutput *output, int id) +{ + write_header (output, BROADWAY_OP_LOWER_SURFACE); + append_uint16 (output, id); +} + void broadway_output_destroy_surface(BroadwayOutput *output, int id) { diff --git a/gdk/broadway/broadway-output.h b/gdk/broadway/broadway-output.h index 88841ea0dc..6d6bb61b31 100644 --- a/gdk/broadway/broadway-output.h +++ b/gdk/broadway/broadway-output.h @@ -37,6 +37,10 @@ void broadway_output_show_surface (BroadwayOutput *output, int id); void broadway_output_hide_surface (BroadwayOutput *output, int id); +void broadway_output_raise_surface (BroadwayOutput *output, + int id); +void broadway_output_lower_surface (BroadwayOutput *output, + int id); void broadway_output_destroy_surface (BroadwayOutput *output, int id); void broadway_output_move_resize_surface (BroadwayOutput *output, diff --git a/gdk/broadway/broadway-protocol.h b/gdk/broadway/broadway-protocol.h index d42625f077..5fffd6c3f0 100644 --- a/gdk/broadway/broadway-protocol.h +++ b/gdk/broadway/broadway-protocol.h @@ -31,6 +31,8 @@ typedef enum { BROADWAY_OP_NEW_SURFACE = 's', BROADWAY_OP_SHOW_SURFACE = 'S', BROADWAY_OP_HIDE_SURFACE = 'H', + BROADWAY_OP_RAISE_SURFACE = 'r', + BROADWAY_OP_LOWER_SURFACE = 'R', BROADWAY_OP_DESTROY_SURFACE = 'd', BROADWAY_OP_MOVE_RESIZE = 'm', BROADWAY_OP_SET_TRANSIENT_FOR = 'p', diff --git a/gdk/broadway/broadway-server.c b/gdk/broadway/broadway-server.c index ae88cce40f..30b232d31f 100644 --- a/gdk/broadway/broadway-server.c +++ b/gdk/broadway/broadway-server.c @@ -1359,6 +1359,42 @@ broadway_server_window_hide (BroadwayServer *server, return sent; } +void +broadway_server_window_raise (BroadwayServer *server, + gint id) +{ + BroadwayWindow *window; + + window = g_hash_table_lookup (server->id_ht, + GINT_TO_POINTER (id)); + if (window == NULL) + return; + + server->toplevels = g_list_remove (server->toplevels, window); + server->toplevels = g_list_append (server->toplevels, window); + + if (server->output) + broadway_output_raise_surface (server->output, window->id); +} + +void +broadway_server_window_lower (BroadwayServer *server, + gint id) +{ + BroadwayWindow *window; + + window = g_hash_table_lookup (server->id_ht, + GINT_TO_POINTER (id)); + if (window == NULL) + return; + + server->toplevels = g_list_remove (server->toplevels, window); + server->toplevels = g_list_prepend (server->toplevels, window); + + if (server->output) + broadway_output_lower_surface (server->output, window->id); +} + void broadway_server_window_set_transient_for (BroadwayServer *server, gint id, gint parent) @@ -1646,7 +1682,7 @@ broadway_server_new_window (BroadwayServer *server, GINT_TO_POINTER (window->id), window); - server->toplevels = g_list_prepend (server->toplevels, window); + server->toplevels = g_list_append (server->toplevels, window); if (server->output) broadway_output_new_surface (server->output, diff --git a/gdk/broadway/broadway-server.h b/gdk/broadway/broadway-server.h index e5a3718bea..c073c982bc 100644 --- a/gdk/broadway/broadway-server.h +++ b/gdk/broadway/broadway-server.h @@ -58,6 +58,10 @@ gboolean broadway_server_window_show (BroadwayServer * gint id); gboolean broadway_server_window_hide (BroadwayServer *server, gint id); +void broadway_server_window_raise (BroadwayServer *server, + gint id); +void broadway_server_window_lower (BroadwayServer *server, + gint id); void broadway_server_window_set_transient_for (BroadwayServer *server, gint id, gint parent); diff --git a/gdk/broadway/broadway.js b/gdk/broadway/broadway.js index ef0470fac0..c2d03b19c2 100644 --- a/gdk/broadway/broadway.js +++ b/gdk/broadway/broadway.js @@ -254,12 +254,6 @@ function moveToHelper(surface, position) { } } -function moveToTop(surface) { - moveToHelper(surface); - restackWindows(); -} - - function cmdDeleteSurface(id) { if (grab.window == id) @@ -305,6 +299,22 @@ function cmdMoveResizeSurface(id, has_pos, x, y, has_size, w, h) sendConfigureNotify(surface); } +function cmdRaiseSurface(id) +{ + var surface = surfaces[id]; + + moveToHelper(surface); + restackWindows(); +} + +function cmdLowerSurface(id) +{ + var surface = surfaces[id]; + + moveToHelper(surface, 0); + restackWindows(); +} + function copyRect(src, srcX, srcY, dest, destX, destY, width, height) { // Clip to src @@ -592,6 +602,16 @@ function handleCommands(cmd) cmdMoveResizeSurface(id, has_pos, x, y, has_size, w, h); break; + case 'r': // Raise a surface + id = cmd.get_16(); + cmdRaiseSurface(id); + break; + + case 'R': // Lower a surface + id = cmd.get_16(); + cmdLowerSurface(id); + break; + case 'b': // Put image buffer id = cmd.get_16(); w = cmd.get_16();