[gtk+] [broadway] Move window to top when moving
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] [broadway] Move window to top when moving
- Date: Sun, 10 Apr 2011 18:17:55 +0000 (UTC)
commit fadaced85ff9a2aceb9b315b4a000a22c81e8f81
Author: Alexander Larsson <alexl redhat com>
Date: Fri Apr 8 15:00:51 2011 +0200
[broadway] Move window to top when moving
gdk/broadway/broadway.js | 46 ++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 44 insertions(+), 2 deletions(-)
---
diff --git a/gdk/broadway/broadway.js b/gdk/broadway/broadway.js
index 167834b..83e2b28 100644
--- a/gdk/broadway/broadway.js
+++ b/gdk/broadway/broadway.js
@@ -122,6 +122,7 @@ var lastTimeStamp = 0;
var realWindowWithMouse = 0;
var windowWithMouse = 0;
var surfaces = {};
+var stackingOrder = [];
var outstandingCommands = new Array();
var inputSocket = null;
var frameSizeX = -1;
@@ -343,6 +344,7 @@ function cmdCreateSurface(id, x, y, width, height, isTemp)
surface.document = document;
surface.transientToplevel = null;
surface.frame = null;
+ stackingOrder.push(id);
var canvas = document.createElement("canvas");
canvas.width = width;
@@ -488,11 +490,50 @@ function cmdSetTransientFor(id, parentId)
}
}
+function restackWindows() {
+ if (useToplevelWindows)
+ return;
+
+ for (var i = 0; i < stackingOrder.length; i++) {
+ var id = stackingOrder[i];
+ var surface = surfaces[id];
+ if (surface.frame)
+ surface.frame.style.zIndex = i;
+ else
+ surface.canvas.style.zIndex = i;
+ }
+}
+
+function moveToTopHelper(surface) {
+ var i = stackingOrder.indexOf(surface.id);
+ stackingOrder.splice(i, 1);
+ stackingOrder.push(surface.id);
+
+ for (var cid in surfaces) {
+ var child = surfaces[cid];
+ if (child.transientParent == surface.id)
+ moveToTopHelper(child);
+ }
+}
+
+function moveToTop(surface) {
+ moveToTopHelper(surface);
+ restackWindows();
+}
+
+
function cmdDeleteSurface(id)
{
- var canvas = surfaces[id].canvas;
- delete surfaces[id];
+ var surface = surfaces[id];
+ var i = stackingOrder.indexOf(id);
+ if (i >= 0)
+ stackingOrder.splice(i, 1);
+ var canvas = surface.canvas;
canvas.parentNode.removeChild(canvas);
+ var frame = surface.frame;
+ if (frame)
+ frame.parentNode.removeChild(frame);
+ delete surfaces[id];
}
function cmdMoveSurface(id, x, y)
@@ -912,6 +953,7 @@ function onMouseDown (ev) {
localGrab.frame = ev.target;
localGrab.lastX = ev.pageX;
localGrab.lastY = ev.pageY;
+ moveToTop(localGrab.frame.frameFor);
return;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]