}
}
+function sendConfigureNotify(surface)
+{
+ sendInput("w", [surface.id, surface.x, surface.y, surface.width, surface.height]);
+}
+
var windowGeometryTimeout = null;
-function updateBrowserWindowGeometry(win) {
+function updateBrowserWindowGeometry(win, alwaysSendConfigure) {
if (win.closed)
return;
alert("No implementation to get window position");
}
- if (x != surface.x || y != surface.y ||
+ if (alwaysSendConfigure || x != surface.x || y != surface.y ||
innerW != surface.width || innerH != surface.height) {
var oldX = surface.x;
var oldY = surface.y;
resizeCanvas(surface.canvas, innerW, innerH);
surface.width = innerW;
surface.height = innerH;
- sendInput ("w", [surface.id, surface.x, surface.y, surface.width, surface.height]);
+ sendConfigureNotify(surface);
for (id in surfaces) {
var childSurface = surfaces[id];
var transientToplevel = getTransientToplevel(childSurface);
if (transientToplevel != null && transientToplevel == surface) {
childSurface.x += surface.x - oldX;
childSurface.y += surface.y - oldY;
- sendInput ("w", [childSurface.id, childSurface.x, childSurface.y, childSurface.width, childSurface.height]);
+ sendConfigureNotify(childSurface);
}
}
}
function registerWindow(win)
{
toplevelWindows.push(win);
- win.onresize = function(ev) { updateBrowserWindowGeometry(ev.target); };
+ win.onresize = function(ev) { updateBrowserWindowGeometry(ev.target, false); };
if (!windowGeometryTimeout)
- windowGeometryTimeout = setInterval(function () { toplevelWindows.forEach(updateBrowserWindowGeometry); }, 2000);
+ windowGeometryTimeout = setInterval(function () {
+ for (var i = 0; i < toplevelWindows.length; i++)
+ toplevelWindows[i].updateBrowserWindowGeometry(toplevelWindows[i], false);
+ }, 2000);
win.onunload = function(ev) { browserWindowClosed(ev.target.defaultView); };
}
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]);
}
surface.toplevelElement = toplevelElement;
surfaces[id] = surface;
stackingOrder.push(surface);
+
+ sendConfigureNotify(surface);
}
function cmdShowSurface(id)
restackWindows();
if (surface.window)
- updateBrowserWindowGeometry(surface.window);
+ updateBrowserWindowGeometry(surface.window, false);
}
function cmdHideSurface(id)
element.style["top"] = yOffset + "px";
}
}
+
+ if (surface.window) {
+ updateBrowserWindowGeometry(surface.window, true);
+ } else {
+ sendConfigureNotify(surface);
+ }
}
function cmdResizeSurface(id, w, h)
if (surface.window) {
resizeBrowserWindow(surface.window, w, h);
+ updateBrowserWindowGeometry(surface.window, true);
+ } else {
+ sendConfigureNotify(surface);
}
}
lastTimeStamp = ev.timeStamp;
if (ev.target.surface && ev.target.surface.window) {
var win = ev.target.surface.window;
- updateBrowserWindowGeometry(win);
+ updateBrowserWindowGeometry(win, false);
}
}
var offset = getFrameOffset(surface);
localGrab.frame.style["left"] = (surface.x - offset.x) + "px";
localGrab.frame.style["top"] = (surface.y - offset.y) + "px";
- sendInput ("w", [surface.id, surface.x, surface.y, surface.width, surface.height]);
+ sendConfigureNotify(surface);
localGrab.lastX = ev.pageX;
localGrab.lastY = ev.pageY;
return;