OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @fileoverview | 6 * @fileoverview |
7 * Class handling setting of the local app window shape to account for windows | 7 * Class handling setting of the local app window shape to account for windows |
8 * on the remote desktop, as well as any client-side UI. | 8 * on the remote desktop, as well as any client-side UI. |
9 */ | 9 */ |
10 | 10 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
62 */ | 62 */ |
63 remoting.WindowShape.prototype.updateClientWindowShape = function() { | 63 remoting.WindowShape.prototype.updateClientWindowShape = function() { |
64 if (!remoting.WindowShape.isSupported()) { | 64 if (!remoting.WindowShape.isSupported()) { |
65 return; | 65 return; |
66 } | 66 } |
67 | 67 |
68 var rects = this.desktopRects_.slice(); | 68 var rects = this.desktopRects_.slice(); |
69 for (var i = 0; i < this.clientUICallbacks_.length; ++i) { | 69 for (var i = 0; i < this.clientUICallbacks_.length; ++i) { |
70 this.clientUICallbacks_[i].addToRegion(rects); | 70 this.clientUICallbacks_[i].addToRegion(rects); |
71 } | 71 } |
72 for (var i = 0; i < rects.length; ++i) { | |
73 var rect = /** @type {ClientRect} */ (rects[i]); | |
74 var left = Math.floor(rect.left); | |
75 var right = Math.ceil(rect.left + rect.width); | |
76 var top = Math.floor(rect.top); | |
77 var bottom = Math.ceil(rect.top + rect.height); | |
78 rects[i] = { left: left, | |
79 top: top, | |
80 width: right - left, | |
81 height: bottom - top }; | |
82 } | |
Jamie
2015/02/19 22:44:04
Apologies for the churn, but now I see the code re
kelvinp
2015/02/19 23:36:20
Done.
| |
83 chrome.app.window.current().setShape({rects: rects}); | 72 chrome.app.window.current().setShape({rects: rects}); |
84 }; | 73 }; |
85 | 74 |
86 | 75 |
87 /** | 76 /** |
88 * @interface | 77 * @interface |
89 */ | 78 */ |
90 remoting.WindowShape.ClientUI = function () { | 79 remoting.WindowShape.ClientUI = function () { |
91 }; | 80 }; |
92 | 81 |
93 /** | 82 /** |
94 * Add the context menu's bounding rectangle to the specified region. | 83 * Add the context menu's bounding rectangle to the specified region. |
95 * | 84 * |
96 * @param {Array<{left: number, top: number, width: number, height: number}>} | 85 * @param {Array<{left: number, top: number, width: number, height: number}>} |
97 * rects | 86 * rects |
98 */ | 87 */ |
99 remoting.WindowShape.ClientUI.prototype.addToRegion = function(rects) {}; | 88 remoting.WindowShape.ClientUI.prototype.addToRegion = function(rects) {}; |
100 | 89 |
101 | 90 |
102 /** @type {remoting.WindowShape} */ | 91 /** @type {remoting.WindowShape} */ |
103 remoting.windowShape = new remoting.WindowShape(); | 92 remoting.windowShape = new remoting.WindowShape(); |
OLD | NEW |