broadway: Add raise/lower ops

This commit is contained in:
Alexander Larsson 2013-11-12 12:23:58 +01:00
parent ddade66496
commit d8c17d0739
6 changed files with 87 additions and 7 deletions

View File

@ -216,6 +216,20 @@ broadway_output_hide_surface(BroadwayOutput *output, int id)
append_uint16 (output, 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 void
broadway_output_destroy_surface(BroadwayOutput *output, int id) broadway_output_destroy_surface(BroadwayOutput *output, int id)
{ {

View File

@ -37,6 +37,10 @@ void broadway_output_show_surface (BroadwayOutput *output,
int id); int id);
void broadway_output_hide_surface (BroadwayOutput *output, void broadway_output_hide_surface (BroadwayOutput *output,
int id); 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, void broadway_output_destroy_surface (BroadwayOutput *output,
int id); int id);
void broadway_output_move_resize_surface (BroadwayOutput *output, void broadway_output_move_resize_surface (BroadwayOutput *output,

View File

@ -31,6 +31,8 @@ typedef enum {
BROADWAY_OP_NEW_SURFACE = 's', BROADWAY_OP_NEW_SURFACE = 's',
BROADWAY_OP_SHOW_SURFACE = 'S', BROADWAY_OP_SHOW_SURFACE = 'S',
BROADWAY_OP_HIDE_SURFACE = 'H', BROADWAY_OP_HIDE_SURFACE = 'H',
BROADWAY_OP_RAISE_SURFACE = 'r',
BROADWAY_OP_LOWER_SURFACE = 'R',
BROADWAY_OP_DESTROY_SURFACE = 'd', BROADWAY_OP_DESTROY_SURFACE = 'd',
BROADWAY_OP_MOVE_RESIZE = 'm', BROADWAY_OP_MOVE_RESIZE = 'm',
BROADWAY_OP_SET_TRANSIENT_FOR = 'p', BROADWAY_OP_SET_TRANSIENT_FOR = 'p',

View File

@ -1359,6 +1359,42 @@ broadway_server_window_hide (BroadwayServer *server,
return sent; 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 void
broadway_server_window_set_transient_for (BroadwayServer *server, broadway_server_window_set_transient_for (BroadwayServer *server,
gint id, gint parent) gint id, gint parent)
@ -1646,7 +1682,7 @@ broadway_server_new_window (BroadwayServer *server,
GINT_TO_POINTER (window->id), GINT_TO_POINTER (window->id),
window); window);
server->toplevels = g_list_prepend (server->toplevels, window); server->toplevels = g_list_append (server->toplevels, window);
if (server->output) if (server->output)
broadway_output_new_surface (server->output, broadway_output_new_surface (server->output,

View File

@ -58,6 +58,10 @@ gboolean broadway_server_window_show (BroadwayServer *
gint id); gint id);
gboolean broadway_server_window_hide (BroadwayServer *server, gboolean broadway_server_window_hide (BroadwayServer *server,
gint id); 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, void broadway_server_window_set_transient_for (BroadwayServer *server,
gint id, gint id,
gint parent); gint parent);

View File

@ -254,12 +254,6 @@ function moveToHelper(surface, position) {
} }
} }
function moveToTop(surface) {
moveToHelper(surface);
restackWindows();
}
function cmdDeleteSurface(id) function cmdDeleteSurface(id)
{ {
if (grab.window == id) if (grab.window == id)
@ -305,6 +299,22 @@ function cmdMoveResizeSurface(id, has_pos, x, y, has_size, w, h)
sendConfigureNotify(surface); 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) function copyRect(src, srcX, srcY, dest, destX, destY, width, height)
{ {
// Clip to src // Clip to src
@ -592,6 +602,16 @@ function handleCommands(cmd)
cmdMoveResizeSurface(id, has_pos, x, y, has_size, w, h); cmdMoveResizeSurface(id, has_pos, x, y, has_size, w, h);
break; 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 case 'b': // Put image buffer
id = cmd.get_16(); id = cmd.get_16();
w = cmd.get_16(); w = cmd.get_16();