[broadway] Position non-popup windows ourselves

We ignore the initial positions for non-popup windows, instead we
place the windows ourselves (or in the useToplevel mode by the WM).
This commit is contained in:
Alexander Larsson 2011-04-08 15:17:43 +02:00
parent e5d8905cd2
commit fe79bbd618
2 changed files with 15 additions and 12 deletions

View File

@ -334,9 +334,11 @@ function getFrameOffset(surface) {
return {x: x, y: y};
}
var positionIndex = 0;
function cmdCreateSurface(id, x, y, width, height, isTemp)
{
var surface = { id: id, x: x, y:y, width: width, height: height, isTemp: isTemp };
surface.positioned = isTemp;
surface.drawQueue = [];
surface.transientParent = 0;
surface.visible = false;
@ -385,6 +387,11 @@ function cmdCreateSurface(id, x, y, width, height, isTemp)
canvas.style["display"] = "block";
surface.frame = frame;
surface.x = 100 + positionIndex * 10;
surface.y = 100 + positionIndex * 10;
positionIndex = (positionIndex + 1) % 20;
sendInput ("w", [surface.id, surface.x, surface.y, surface.width, surface.height]);
}
var context = canvas.getContext("2d");
@ -409,10 +416,13 @@ function cmdShowSurface(id)
if (useToplevelWindows) {
var doc = document;
if (!surface.isTemp) {
var win = window.open('','_blank',
'width='+surface.width+',height='+surface.height+
',left='+surface.x+',top='+surface.y+',screenX='+surface.x+',screenY='+surface.y+
',location=no,menubar=no,scrollbars=no,toolbar=no');
var options =
'width='+surface.width+',height='+surface.height+
',location=no,menubar=no,scrollbars=no,toolbar=no';
if (surface.positioned)
options = options +
',left='+surface.x+',top='+surface.y+',screenX='+surface.x+',screenY='+surface.y;
var win = window.open('','_blank', options);
win.surface = surface;
registerWindow(win);
doc = win.document;
@ -540,6 +550,7 @@ function cmdDeleteSurface(id)
function cmdMoveSurface(id, x, y)
{
var surface = surfaces[id];
surface.positioned = true;
surface.x = x;
surface.y = y;

View File

@ -348,14 +348,6 @@ _gdk_broadway_display_create_window_impl (GdkDisplay *display,
broadway_display->toplevels = g_list_prepend (broadway_display->toplevels, impl);
/* Instead of window manager placement we have this mini hack
so that the main/first window is not covered in the demos. */
if (impl->id > 1 && window->window_type == GDK_WINDOW_TOPLEVEL)
{
window->x = 100;
window->y = 20;
}
if (broadway_display->output)
broadway_output_new_surface (broadway_display->output,
impl->id,