[gtk+] [broadway] Centralize surface creation code in js
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] [broadway] Centralize surface creation code in js
- Date: Thu, 7 Apr 2011 19:20:06 +0000 (UTC)
commit 9f848aaf3068dc7a93198909cba3e3b4c5110c0d
Author: Alexander Larsson <alexl redhat com>
Date: Wed Apr 6 09:32:15 2011 +0200
[broadway] Centralize surface creation code in js
gdk/broadway/broadway.js | 13 ++++++-------
1 files changed, 6 insertions(+), 7 deletions(-)
---
diff --git a/gdk/broadway/broadway.js b/gdk/broadway/broadway.js
index bcac301..e00e3eb 100644
--- a/gdk/broadway/broadway.js
+++ b/gdk/broadway/broadway.js
@@ -92,8 +92,11 @@ var surfaces = {};
var outstandingCommands = new Array();
var inputSocket = null;
-function initContext(canvas, x, y, id, isTemp)
+function createSurface(id, x, y, width, height, isTemp)
{
+ var canvas = document.createElement("canvas");
+ canvas.width = width;
+ canvas.height = height;
canvas.surfaceId = id;
canvas.style["position"] = "absolute";
canvas.style["left"] = x + "px";
@@ -105,8 +108,7 @@ function initContext(canvas, x, y, id, isTemp)
context.drawQueue = [];
context.isTemp = isTemp;
context.transientParent = 0;
-
- return context;
+ surfaces[id] = context;
}
var GDK_CROSSING_NORMAL = 0;
@@ -226,10 +228,7 @@ function handleCommands(cmdObj)
i = i + 3;
var isTemp = cmd[i] == '1';
i = i + 1;
- var surface = document.createElement("canvas");
- surface.width = w;
- surface.height = h;
- surfaces[id] = initContext(surface, x, y, id, isTemp);
+ createSurface(id, x, y, w, h, isTemp);
break;
case 'S': // Show a surface
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]