[broadway] Track transient_for

This commit is contained in:
Alexander Larsson 2011-04-05 12:02:46 +02:00
parent e1dcd6735e
commit 9c5c4223e3
5 changed files with 54 additions and 0 deletions

View File

@ -778,6 +778,25 @@ broadway_output_resize_surface(BroadwayOutput *output, int id, int w, int h)
broadway_output_write (output, buf, sizeof (buf));
}
void
broadway_output_set_transient_for (BroadwayOutput *output,
int id,
int parent_id)
{
char buf[HEADER_LEN + 6];
int p;
p = write_header (output, buf, 'p');
append_uint16 (id, buf, &p);
append_uint16 (parent_id, buf, &p);
assert (p == sizeof (buf));
broadway_output_write (output, buf, sizeof (buf));
}
void
broadway_output_put_rgb (BroadwayOutput *output, int id, int x, int y,
int w, int h, int byte_stride, void *data)

View File

@ -33,6 +33,9 @@ void broadway_output_resize_surface (BroadwayOutput *output,
int id,
int w,
int h);
void broadway_output_set_transient_for (BroadwayOutput *output,
int id,
int parent_id);
void broadway_output_put_rgb (BroadwayOutput *output,
int id,
int x,

View File

@ -103,6 +103,7 @@ function initContext(canvas, x, y, id)
context.globalCompositeOperation = "source-over";
document.body.appendChild(canvas);
context.drawQueue = [];
context.transientParent = 0;
return context;
}
@ -240,6 +241,13 @@ function handleCommands(cmdObj)
surfaces[id].canvas.style["display"] = "none";
break;
case 'p': // Set transient parent
var id = base64_16(cmd, i);
i = i + 3;
var parentId = base64_16(cmd, i);
i = i + 3;
surfaces[id].transientParent = parentId;
case 'd': // Delete surface
var id = base64_16(cmd, i);
i = i + 3;

View File

@ -231,6 +231,10 @@ _gdk_broadway_resync_windows (void)
broadway_output_show_surface (display->output, impl->id);
window_data_send (display->output, impl);
}
if (impl->transient_for)
{
broadway_output_set_transient_for (display->output, impl->id, impl->transient_for);
}
}
gdk_display_flush (GDK_DISPLAY (display));
@ -764,6 +768,24 @@ static void
gdk_broadway_window_set_transient_for (GdkWindow *window,
GdkWindow *parent)
{
GdkBroadwayDisplay *display;
GdkWindowImplBroadway *impl;
int parent_id;
impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
parent_id = 0;
if (parent)
parent_id = GDK_WINDOW_IMPL_BROADWAY (parent->impl)->id;
impl->transient_for = parent_id;
display = GDK_BROADWAY_DISPLAY (gdk_window_get_display (impl->wrapper));
if (display->output)
{
broadway_output_set_transient_for (display->output, impl->id, impl->transient_for);
gdk_display_flush (GDK_DISPLAY (display));
}
}
static void

View File

@ -60,6 +60,8 @@ struct _GdkWindowImplBroadway
int id;
int transient_for;
gint8 toplevel_window_type;
gboolean dirty;
gboolean last_synced;