Skip to content
This repository has been archived by the owner on Dec 2, 2023. It is now read-only.

Commit

Permalink
Fixes for windowed mode
Browse files Browse the repository at this point in the history
  • Loading branch information
01CodeLT committed Oct 17, 2021
1 parent 5fd955b commit bf3cb8e
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 27 deletions.
27 changes: 9 additions & 18 deletions lib/DisplaySlide.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions lib/DisplaySlide.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export function updateDisplayOptions(updatedOptions: Settings) {

//Change to windowed mode?
displayWindow.setFullScreen(!updatedOptions.display.windowed);
if (updatedOptions.display.windowed == false) { console.log('maximising'); displayWindow.maximize(); }
if (updatedOptions.display.windowed == false) displayWindow.maximize();
}

//Update options
Expand Down Expand Up @@ -115,6 +115,7 @@ export function toggleDisplay() {
//Create externalDisplay
if (externalDisplay) {
displayWindow = new BrowserWindow({
title: 'Meeting display',
x: externalDisplay.bounds.x,
y: externalDisplay.bounds.y,
webPreferences: {
Expand All @@ -123,12 +124,16 @@ export function toggleDisplay() {
allowRunningInsecureContent: (serve) ? true : false,
},
fullscreen: !displayOptions.display.windowed,
title: 'Meeting display',
frame: false
});

//Emitted when window closed
displayWindow.on('closed', () => {
displayWindow = null;
});

//Set as fullscreen
displayWindow.maximize();
if (displayOptions.display.windowed == false) displayWindow.maximize();

//Listen for escape
displayWindow.webContents.on('before-input-event', (event, input) => {
Expand Down
2 changes: 1 addition & 1 deletion main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as url from 'url';
import * as path from 'path';
import debug = require('electron-debug');
import { autoUpdater } from 'electron-updater';
import { app, BrowserWindow, screen, protocol, ipcMain, dialog, remote } from 'electron';
import { app, BrowserWindow, screen, protocol, ipcMain, dialog } from 'electron';

import { showToolbar, hideToolbar, toolbarWindow } from './lib/ControlToolbar';
import { displayWindow, toggleDisplay, controlDisplay, getSlides, updateSlides, updateDisplayOptions } from './lib/DisplaySlide';
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "meeting-display",
"version": "2.0.3",
"version": "2.0.4",
"description": "Basic application for displaying books & magazines in epub format from the jw website in congregation meetings.",
"author": {
"name": "Luke Tinnion",
Expand Down Expand Up @@ -59,7 +59,7 @@
"conventional-changelog-cli": "2.0.34",
"core-js": "3.6.5",
"cross-env": "7.0.2",
"electron": "9.0.4",
"electron": "9.4.0",
"electron-builder": "22.7.0",
"electron-reload": "1.5.0",
"eslint": "7.3.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@ export class MenuLayoutComponent implements OnInit {
maximizeWindow() {
let mainWindow = this.electronService.remote.getCurrentWindow();
if (mainWindow.isMaximized()) {
console.log('restore');
mainWindow.restore();
this.window.maximizable = true;
} else {
console.log('maximize');
mainWindow.maximize();
this.window.maximizable = false;
}
Expand Down
8 changes: 6 additions & 2 deletions src/app/shared/modals/settings/settings.component.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { Component, OnInit, ChangeDetectorRef } from '@angular/core';
import { SlidesService } from '../../../shared/services/slides.service';
import { ElectronService } from 'ngx-electron';
import { FuiModal } from 'ngx-fomantic-ui';

@Component({
selector: 'settings',
styleUrls: ['./settings.component.scss'],
templateUrl: './settings.component.html',
providers: [FuiModal]
})

export class SettingsComponent implements OnInit {
Expand All @@ -27,7 +29,8 @@ export class SettingsComponent implements OnInit {
constructor(
public slidesService: SlidesService,
private electronService: ElectronService,
private changeDetector: ChangeDetectorRef
private changeDetector: ChangeDetectorRef,
public modal: FuiModal<string, string>
) { }

ngOnInit() {
Expand All @@ -50,6 +53,7 @@ import { SharedModule } from '../../shared.module';

@NgModule({
declarations: [SettingsComponent],
imports: [CommonModule, SharedModule]
imports: [CommonModule, SharedModule],
providers: []
})
class SettingsModule { }
2 changes: 1 addition & 1 deletion src/app/shared/services/modal.service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Injectable, ComponentFactoryResolver, Injector } from '@angular/core';
import { FuiModalService, TemplateModalConfig, ModalTemplate, ComponentModalConfig } from 'ngx-fomantic-ui';
import { FuiModalService, ComponentModalConfig } from 'ngx-fomantic-ui';

@Injectable()
export class ModalService {
Expand Down

0 comments on commit bf3cb8e

Please sign in to comment.