@raydiant/playlist-window-manager 0.0.0-test-9 → 0.0.0-test-11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -98,6 +98,7 @@ var BrowserWindowRenderer = /** @class */ (function () {
98
98
  opts.logger.info("playlist-window-manager/src/BrowserWindowRenderer.ts constructor1 ".concat(JSON.stringify(opts.bounds)));
99
99
  this.setWindowOrViewBounds(this.offscreenWindow, opts.bounds);
100
100
  opts.logger.info("playlist-window-manager/src/BrowserWindowRenderer.ts constructor2 ".concat(JSON.stringify({
101
+ fullscreen: this.offscreenWindow.isFullScreen(),
101
102
  bounds: this.offscreenWindow.getBounds(),
102
103
  normalBounds: this.offscreenWindow.getNormalBounds(),
103
104
  contentBounds: this.offscreenWindow.getContentBounds(),
@@ -133,6 +134,7 @@ var BrowserWindowRenderer = /** @class */ (function () {
133
134
  : this.createOrGetPooledBrowserWindow(windowId, {
134
135
  show: false,
135
136
  frame: this.opts.frame,
137
+ fullscreen: (0, windowUtils_1.isFullscreen)(this.opts.bounds),
136
138
  // NOTE: useWindowPool: true does not work with renderChildWindowsAsBrowserViews: false
137
139
  // because the parent can't be changed after creating the BrowserWindow.
138
140
  parent: parentWindowId
@@ -174,6 +176,7 @@ var BrowserWindowRenderer = /** @class */ (function () {
174
176
  if (window.view instanceof electron_1.BrowserView) {
175
177
  this.moveWindowOffscreen(window);
176
178
  this.logger.info("playlist-window-manager/src/BrowserWindowRenderer.ts createWindow2: ".concat(JSON.stringify({
179
+ fullscreen: this.offscreenWindow.isFullScreen(),
177
180
  bounds: this.offscreenWindow.getBounds(),
178
181
  normalBounds: this.offscreenWindow.getNormalBounds(),
179
182
  contentBounds: this.offscreenWindow.getContentBounds(),
@@ -187,9 +190,35 @@ var BrowserWindowRenderer = /** @class */ (function () {
187
190
  // Electron issue: https://github.com/electron/electron/issues/20357
188
191
  window.view.setBackgroundColor(backgroundColor === 'transparent' ? '#00000000' : backgroundColor);
189
192
  }
190
- this.logger.info("playlist-window-manager/src/BrowserWindowRenderer.ts createWindow4: ".concat(JSON.stringify(window.bounds)));
193
+ if (window.view instanceof electron_1.BrowserWindow) {
194
+ this.logger.info("playlist-window-manager/src/BrowserWindowRenderer.ts createWindow4: ".concat(JSON.stringify({
195
+ newBounds: window.bounds,
196
+ fullscreen: window.view.isFullScreen(),
197
+ bounds: window.view.getBounds(),
198
+ contentBounds: window.view.getContentBounds(),
199
+ normalBounds: window.view.getNormalBounds(),
200
+ })));
201
+ }
202
+ else {
203
+ this.logger.info("playlist-window-manager/src/BrowserWindowRenderer.ts createWindow5: ".concat(JSON.stringify({
204
+ newBounds: window.bounds,
205
+ bounds: window.view.getBounds(),
206
+ })));
207
+ }
191
208
  this.setWindowOrViewBounds(window.view, window.bounds);
192
- this.logger.info("playlist-window-manager/src/BrowserWindowRenderer.ts createWindow7: ".concat(JSON.stringify(window.view.getBounds())));
209
+ if (window.view instanceof electron_1.BrowserWindow) {
210
+ this.logger.info("playlist-window-manager/src/BrowserWindowRenderer.ts createWindow7: ".concat(JSON.stringify({
211
+ fullscreen: window.view.isFullScreen(),
212
+ bounds: window.view.getBounds(),
213
+ contentBounds: window.view.getContentBounds(),
214
+ normalBounds: window.view.getNormalBounds(),
215
+ })));
216
+ }
217
+ else {
218
+ this.logger.info("playlist-window-manager/src/BrowserWindowRenderer.ts createWindow8: ".concat(JSON.stringify({
219
+ bounds: window.view.getBounds(),
220
+ })));
221
+ }
193
222
  if (!this.proxySettings) return [3 /*break*/, 2];
194
223
  return [4 /*yield*/, window.view.webContents.session.setProxy(this.proxySettings)];
195
224
  case 1:
@@ -236,6 +265,7 @@ var BrowserWindowRenderer = /** @class */ (function () {
236
265
  this.logger.info("playlist-window-manager/src/BrowserWindowRenderer.ts updateWindowBounds2: ".concat(JSON.stringify(newBounds)));
237
266
  this.setWindowOrViewBounds(window.view, newBounds);
238
267
  this.logger.info("playlist-window-manager/src/BrowserWindowRenderer.ts updateWindowBounds3: ".concat(JSON.stringify({
268
+ fullscreen: window.view.isFullScreen(),
239
269
  bounds: window.view.getBounds(),
240
270
  normalBounds: window.view.getNormalBounds(),
241
271
  contentBounds: window.view.getContentBounds(),
@@ -355,9 +385,13 @@ var BrowserWindowRenderer = /** @class */ (function () {
355
385
  * 1919x1079.
356
386
  */
357
387
  BrowserWindowRenderer.prototype.setWindowOrViewBounds = function (window, bounds) {
388
+ // setBounds will be ignored if window was in fullscreen mode
389
+ if (window instanceof electron_1.BrowserWindow && !(0, windowUtils_1.isFullscreen)(bounds)) {
390
+ window.setFullScreen(false);
391
+ }
358
392
  window.setBounds(bounds);
359
- if (window instanceof electron_1.BrowserWindow) {
360
- window.setFullScreen((0, windowUtils_1.isFullscreen)(bounds));
393
+ if (window instanceof electron_1.BrowserWindow && (0, windowUtils_1.isFullscreen)(bounds)) {
394
+ window.setFullScreen(true);
361
395
  }
362
396
  };
363
397
  BrowserWindowRenderer.prototype.getWindow = function (windowId) {
@@ -436,6 +470,13 @@ var BrowserWindowRenderer = /** @class */ (function () {
436
470
  this.browserWindowPool.add(browserWindow);
437
471
  }
438
472
  }
473
+ this.logger.info("playlist-window-manager/src/BrowserWindowRenderer.ts createOrGetPooledBrowserWindow1: ".concat(JSON.stringify({
474
+ screen: electron_1.screen.getPrimaryDisplay().bounds,
475
+ fullscreen: browserWindow.isFullScreen(),
476
+ bounds: browserWindow.getBounds(),
477
+ contentBounds: browserWindow.getContentBounds(),
478
+ normalBounds: browserWindow.getNormalBounds(),
479
+ })));
439
480
  return browserWindow;
440
481
  };
441
482
  BrowserWindowRenderer.prototype.destroyOrUnloadPooledBrowserWindow = function (windowId, browserWindow) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raydiant/playlist-window-manager",
3
- "version": "0.0.0-test-9",
3
+ "version": "0.0.0-test-11",
4
4
  "description": "Window manager for playlist playback.",
5
5
  "main": "build/index.js",
6
6
  "scripts": {
@@ -3,6 +3,7 @@ import {
3
3
  BrowserWindow,
4
4
  BrowserView,
5
5
  ipcMain,
6
+ screen,
6
7
  IpcMainEvent,
7
8
  Event,
8
9
  Details,
@@ -83,6 +84,7 @@ export default class BrowserWindowRenderer
83
84
  opts.logger.info(
84
85
  `playlist-window-manager/src/BrowserWindowRenderer.ts constructor2 ${JSON.stringify(
85
86
  {
87
+ fullscreen: this.offscreenWindow.isFullScreen(),
86
88
  bounds: this.offscreenWindow.getBounds(),
87
89
  normalBounds: this.offscreenWindow.getNormalBounds(),
88
90
  contentBounds: this.offscreenWindow.getContentBounds(),
@@ -108,7 +110,7 @@ export default class BrowserWindowRenderer
108
110
  backgroundColor,
109
111
  receiveMessageCallback,
110
112
  errorCallback,
111
- }: CreateWindowOptions) {
113
+ }: CreateWindowOptions): Promise<void> {
112
114
  this.logger.info(
113
115
  `playlist-window-manager/src/BrowserWindowRenderer.ts createWindow1: ${JSON.stringify(
114
116
  parentWindowId && !this.opts.renderChildWindowsAsBrowserViews
@@ -134,6 +136,7 @@ export default class BrowserWindowRenderer
134
136
  : this.createOrGetPooledBrowserWindow(windowId, {
135
137
  show: false,
136
138
  frame: this.opts.frame,
139
+ fullscreen: isFullscreen(this.opts.bounds),
137
140
  // NOTE: useWindowPool: true does not work with renderChildWindowsAsBrowserViews: false
138
141
  // because the parent can't be changed after creating the BrowserWindow.
139
142
  parent: parentWindowId
@@ -208,6 +211,7 @@ export default class BrowserWindowRenderer
208
211
  this.logger.info(
209
212
  `playlist-window-manager/src/BrowserWindowRenderer.ts createWindow2: ${JSON.stringify(
210
213
  {
214
+ fullscreen: this.offscreenWindow.isFullScreen(),
211
215
  bounds: this.offscreenWindow.getBounds(),
212
216
  normalBounds: this.offscreenWindow.getNormalBounds(),
213
217
  contentBounds: this.offscreenWindow.getContentBounds(),
@@ -228,17 +232,49 @@ export default class BrowserWindowRenderer
228
232
  );
229
233
  }
230
234
 
231
- this.logger.info(
232
- `playlist-window-manager/src/BrowserWindowRenderer.ts createWindow4: ${JSON.stringify(
233
- window.bounds
234
- )}`
235
- );
235
+ if (window.view instanceof BrowserWindow) {
236
+ this.logger.info(
237
+ `playlist-window-manager/src/BrowserWindowRenderer.ts createWindow4: ${JSON.stringify(
238
+ {
239
+ newBounds: window.bounds,
240
+ fullscreen: window.view.isFullScreen(),
241
+ bounds: window.view.getBounds(),
242
+ contentBounds: window.view.getContentBounds(),
243
+ normalBounds: window.view.getNormalBounds(),
244
+ }
245
+ )}`
246
+ );
247
+ } else {
248
+ this.logger.info(
249
+ `playlist-window-manager/src/BrowserWindowRenderer.ts createWindow5: ${JSON.stringify(
250
+ {
251
+ newBounds: window.bounds,
252
+ bounds: window.view.getBounds(),
253
+ }
254
+ )}`
255
+ );
256
+ }
236
257
  this.setWindowOrViewBounds(window.view, window.bounds);
237
- this.logger.info(
238
- `playlist-window-manager/src/BrowserWindowRenderer.ts createWindow7: ${JSON.stringify(
239
- window.view.getBounds()
240
- )}`
241
- );
258
+ if (window.view instanceof BrowserWindow) {
259
+ this.logger.info(
260
+ `playlist-window-manager/src/BrowserWindowRenderer.ts createWindow7: ${JSON.stringify(
261
+ {
262
+ fullscreen: window.view.isFullScreen(),
263
+ bounds: window.view.getBounds(),
264
+ contentBounds: window.view.getContentBounds(),
265
+ normalBounds: window.view.getNormalBounds(),
266
+ }
267
+ )}`
268
+ );
269
+ } else {
270
+ this.logger.info(
271
+ `playlist-window-manager/src/BrowserWindowRenderer.ts createWindow8: ${JSON.stringify(
272
+ {
273
+ bounds: window.view.getBounds(),
274
+ }
275
+ )}`
276
+ );
277
+ }
242
278
 
243
279
  if (this.proxySettings) {
244
280
  await window.view.webContents.session.setProxy(this.proxySettings);
@@ -292,6 +328,7 @@ export default class BrowserWindowRenderer
292
328
  this.logger.info(
293
329
  `playlist-window-manager/src/BrowserWindowRenderer.ts updateWindowBounds3: ${JSON.stringify(
294
330
  {
331
+ fullscreen: window.view.isFullScreen(),
295
332
  bounds: window.view.getBounds(),
296
333
  normalBounds: window.view.getNormalBounds(),
297
334
  contentBounds: window.view.getContentBounds(),
@@ -438,9 +475,13 @@ export default class BrowserWindowRenderer
438
475
  window: BrowserWindow | BrowserView,
439
476
  bounds: WindowBounds
440
477
  ) {
478
+ // setBounds will be ignored if window was in fullscreen mode
479
+ if (window instanceof BrowserWindow && !isFullscreen(bounds)) {
480
+ window.setFullScreen(false);
481
+ }
441
482
  window.setBounds(bounds);
442
- if (window instanceof BrowserWindow) {
443
- window.setFullScreen(isFullscreen(bounds));
483
+ if (window instanceof BrowserWindow && isFullscreen(bounds)) {
484
+ window.setFullScreen(true);
444
485
  }
445
486
  }
446
487
 
@@ -555,6 +596,18 @@ export default class BrowserWindowRenderer
555
596
  }
556
597
  }
557
598
 
599
+ this.logger.info(
600
+ `playlist-window-manager/src/BrowserWindowRenderer.ts createOrGetPooledBrowserWindow1: ${JSON.stringify(
601
+ {
602
+ screen: screen.getPrimaryDisplay().bounds,
603
+ fullscreen: browserWindow.isFullScreen(),
604
+ bounds: browserWindow.getBounds(),
605
+ contentBounds: browserWindow.getContentBounds(),
606
+ normalBounds: browserWindow.getNormalBounds(),
607
+ }
608
+ )}`
609
+ );
610
+
558
611
  return browserWindow;
559
612
  }
560
613