Skip to content
This repository was archived by the owner on Oct 22, 2021. It is now read-only.

Commit 7e181a0

Browse files
committed
♻️ Some CSS cleanup and fixes for 16/10 ratio+touch
1 parent 961412e commit 7e181a0

File tree

4 files changed

+43
-24
lines changed

4 files changed

+43
-24
lines changed

src/_boot.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
const signale = require("signale");
2-
const {app, BrowserWindow} = require("electron");
2+
const {app, BrowserWindow, dialog} = require("electron");
33

44
process.on("uncaughtException", e => {
55
signale.fatal(e);
6+
dialog.showErrorBox("eEDEX-UI failed to launch", e.message || "Cannot retrieve error message.");
67
if (tty) {
78
tty.tty.kill();
89
}
@@ -118,11 +119,10 @@ app.on('ready', () => {
118119
height,
119120
show: false,
120121
resizable: true,
121-
movable: false,
122+
movable: settings.allowWindowed || false,
122123
fullscreen: true,
123-
skipTaskbar: true,
124124
autoHideMenuBar: true,
125-
frame: false,
125+
frame: settings.allowWindowed || false,
126126
backgroundColor: '#000000',
127127
webPreferences: {
128128
devTools: true,
@@ -142,7 +142,9 @@ app.on('ready', () => {
142142
win.once("ready-to-show", () => {
143143
signale.complete("Frontend window is up!");
144144
win.show();
145-
win.setResizable(false);
145+
if (!settings.allowWindowed) {
146+
win.setResizable(false);
147+
}
146148
});
147149

148150
signale.watch("Waiting for frontend connection...");

src/_renderer.js

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -327,8 +327,11 @@ window.themeChanger = (theme) => {
327327
};
328328

329329
// Prevent showing menu, exiting fullscreen or app with keyboard shortcuts
330-
window.onkeydown = (e) => {
331-
if (e.key === "Alt" || e.key === "F11") {
330+
window.onkeydown = e => {
331+
if (e.key === "Alt") {
332+
e.preventDefault();
333+
}
334+
if (e.key === "F11" && !settings.allowWindowed) {
332335
e.preventDefault();
333336
}
334337
if (e.code === "KeyD" && e.ctrlKey) {
@@ -339,16 +342,5 @@ window.onkeydown = (e) => {
339342
}
340343
};
341344

342-
// Initiate graphical error display
343-
window.edexErrorsModals = [];
344-
window.onerror = (msg, path, line, col, error) => {
345-
let errorModal = new Modal({
346-
type: "error",
347-
title: error,
348-
message: `${msg}<br/> at ${path} ${line}:${col}`
349-
});
350-
window.edexErrorsModals.push(errorModal);
351-
352-
ipc.send("log", "error", `${error}: ${msg}`);
353-
ipc.send("log", "debug", `at ${path} ${line}:${col}`);
354-
};
345+
// Fix double-tap zoom on touchscreens
346+
require('electron').webFrame.setVisualZoomLevelLimits(1, 1);

src/assets/css/keyboard.css

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@ section#keyboard.animation_state_2 > * {
4747

4848
div.keyboard_row:last-child {
4949
position: relative;
50-
left: 2.98vh;
50+
left: 2.4vh;
5151
}
5252

5353
div.keyboard_key {
54-
height: 4.9vh;
55-
min-width: 4.9vh;
54+
height: 2.7vw;
55+
min-width: 2.7vw;
5656
overflow: hidden;
5757
border-radius: 0.46vh;
5858
background-color: rgba(var(--color_r), var(--color_g), var(--color_b), 0.0);
@@ -150,7 +150,7 @@ div.keyboard_row#row_2 > div.keyboard_enter {
150150
margin-top: 0vh;
151151
height: 6.389vh;
152152
top: -0.37vh;
153-
right: -0.9vh;
153+
right: -1vh;
154154
}
155155

156156
div.keyboard_row#row_2 > div.keyboard_enter:active, div.keyboard_row#row_2 > div.keyboard_enter.active {
@@ -221,3 +221,15 @@ section#keyboard[data-is-fn-on="true"] > div.keyboard_row > div.keyboard_key > h
221221
position: absolute;
222222
opacity: 0;
223223
}
224+
225+
/* Support for other screen ratios than 16:9 */
226+
@media (aspect-ratio: 16/10) {
227+
div.keyboard_row:last-child {
228+
left: 1.1vh;
229+
}
230+
231+
div.keyboard_row#row_2 > div.keyboard_enter {
232+
top: -0.7vh;
233+
right: -0.9vh;
234+
}
235+
}

src/classes/terminal.class.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,19 @@ class Terminal {
122122
this._lastTouch = null;
123123
});
124124

125+
document.querySelector(".xterm-helper-textarea").addEventListener("keydown", e => {
126+
if (e.key === "F11" && window.settings.allowWindowed) {
127+
e.preventDefault();
128+
let win = require("electron").remote.BrowserWindow.getFocusedWindow();
129+
let bool = (win.isFullScreen() ? false : true);
130+
win.setFullScreen(bool);
131+
132+
setTimeout(() => {
133+
this.fit();
134+
}, 700);
135+
}
136+
});
137+
125138
this.fit = () => {
126139
this.term.fit();
127140
setTimeout(() => {

0 commit comments

Comments
 (0)