@raydiant/playlist-window-manager 0.0.0-test-10 → 0.0.0-test-12

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.
@@ -190,9 +190,35 @@ var BrowserWindowRenderer = /** @class */ (function () {
190
190
  // Electron issue: https://github.com/electron/electron/issues/20357
191
191
  window.view.setBackgroundColor(backgroundColor === 'transparent' ? '#00000000' : backgroundColor);
192
192
  }
193
- 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
+ }
194
208
  this.setWindowOrViewBounds(window.view, window.bounds);
195
- 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
+ }
196
222
  if (!this.proxySettings) return [3 /*break*/, 2];
197
223
  return [4 /*yield*/, window.view.webContents.session.setProxy(this.proxySettings)];
198
224
  case 1:
@@ -359,6 +385,14 @@ var BrowserWindowRenderer = /** @class */ (function () {
359
385
  * 1919x1079.
360
386
  */
361
387
  BrowserWindowRenderer.prototype.setWindowOrViewBounds = function (window, bounds) {
388
+ var currentBounds = window.getBounds();
389
+ // calling setBounds may introduce -1px bug
390
+ if (currentBounds.x === bounds.x ||
391
+ currentBounds.y === bounds.y ||
392
+ currentBounds.width === bounds.width ||
393
+ currentBounds.height === bounds.height) {
394
+ return;
395
+ }
362
396
  // setBounds will be ignored if window was in fullscreen mode
363
397
  if (window instanceof electron_1.BrowserWindow && !(0, windowUtils_1.isFullscreen)(bounds)) {
364
398
  window.setFullScreen(false);
@@ -444,6 +478,13 @@ var BrowserWindowRenderer = /** @class */ (function () {
444
478
  this.browserWindowPool.add(browserWindow);
445
479
  }
446
480
  }
481
+ this.logger.info("playlist-window-manager/src/BrowserWindowRenderer.ts createOrGetPooledBrowserWindow1: ".concat(JSON.stringify({
482
+ screen: electron_1.screen.getPrimaryDisplay().bounds,
483
+ fullscreen: browserWindow.isFullScreen(),
484
+ bounds: browserWindow.getBounds(),
485
+ contentBounds: browserWindow.getContentBounds(),
486
+ normalBounds: browserWindow.getNormalBounds(),
487
+ })));
447
488
  return browserWindow;
448
489
  };
449
490
  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-10",
3
+ "version": "0.0.0-test-12",
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,
@@ -231,17 +232,49 @@ export default class BrowserWindowRenderer
231
232
  );
232
233
  }
233
234
 
234
- this.logger.info(
235
- `playlist-window-manager/src/BrowserWindowRenderer.ts createWindow4: ${JSON.stringify(
236
- window.bounds
237
- )}`
238
- );
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
+ }
239
257
  this.setWindowOrViewBounds(window.view, window.bounds);
240
- this.logger.info(
241
- `playlist-window-manager/src/BrowserWindowRenderer.ts createWindow7: ${JSON.stringify(
242
- window.view.getBounds()
243
- )}`
244
- );
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
+ }
245
278
 
246
279
  if (this.proxySettings) {
247
280
  await window.view.webContents.session.setProxy(this.proxySettings);
@@ -442,11 +475,24 @@ export default class BrowserWindowRenderer
442
475
  window: BrowserWindow | BrowserView,
443
476
  bounds: WindowBounds
444
477
  ) {
478
+ const currentBounds = window.getBounds();
479
+ // calling setBounds may introduce -1px bug
480
+ if (
481
+ currentBounds.x === bounds.x ||
482
+ currentBounds.y === bounds.y ||
483
+ currentBounds.width === bounds.width ||
484
+ currentBounds.height === bounds.height
485
+ ) {
486
+ return;
487
+ }
488
+
445
489
  // setBounds will be ignored if window was in fullscreen mode
446
490
  if (window instanceof BrowserWindow && !isFullscreen(bounds)) {
447
491
  window.setFullScreen(false);
448
492
  }
493
+
449
494
  window.setBounds(bounds);
495
+
450
496
  if (window instanceof BrowserWindow && isFullscreen(bounds)) {
451
497
  window.setFullScreen(true);
452
498
  }
@@ -563,6 +609,18 @@ export default class BrowserWindowRenderer
563
609
  }
564
610
  }
565
611
 
612
+ this.logger.info(
613
+ `playlist-window-manager/src/BrowserWindowRenderer.ts createOrGetPooledBrowserWindow1: ${JSON.stringify(
614
+ {
615
+ screen: screen.getPrimaryDisplay().bounds,
616
+ fullscreen: browserWindow.isFullScreen(),
617
+ bounds: browserWindow.getBounds(),
618
+ contentBounds: browserWindow.getContentBounds(),
619
+ normalBounds: browserWindow.getNormalBounds(),
620
+ }
621
+ )}`
622
+ );
623
+
566
624
  return browserWindow;
567
625
  }
568
626