Skip to content

Commit 31986b1

Browse files
author
antelle
committed
merge master
2 parents 3d691f5 + 4ca2eb4 commit 31986b1

File tree

8 files changed

+27
-17
lines changed

8 files changed

+27
-17
lines changed

Diff for: app/scripts/comp/focus-detector.js

+14-12
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,20 @@ const FocusDetector = {
66
init() {
77
this.isFocused = true;
88
this.detectsFocusWithEvents = !FeatureDetector.isDesktop && !FeatureDetector.isMobile;
9-
window.addEventListener('focus', () => {
10-
if (!FocusDetector.isFocused) {
11-
FocusDetector.isFocused = true;
12-
Backbone.trigger('focus');
13-
}
14-
});
15-
window.addEventListener('blur', () => {
16-
if (FocusDetector.isFocused) {
17-
FocusDetector.isFocused = false;
18-
Backbone.trigger('blur');
19-
}
20-
});
9+
if (this.detectsFocusWithEvents) {
10+
window.addEventListener('focus', () => {
11+
if (!FocusDetector.isFocused) {
12+
FocusDetector.isFocused = true;
13+
Backbone.trigger('main-window-focus');
14+
}
15+
});
16+
window.addEventListener('blur', () => {
17+
if (FocusDetector.isFocused) {
18+
FocusDetector.isFocused = false;
19+
Backbone.trigger('main-window-blur');
20+
}
21+
});
22+
}
2123
},
2224

2325
hasFocus() {

Diff for: app/scripts/views/open-view.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ const OpenView = Backbone.View.extend({
6969
KeyHandler.onKey(Keys.DOM_VK_RETURN, this.enterKeyPress, this);
7070
KeyHandler.onKey(Keys.DOM_VK_DOWN, this.moveOpenFileSelectionDown, this);
7171
KeyHandler.onKey(Keys.DOM_VK_UP, this.moveOpenFileSelectionUp, this);
72-
this.listenTo(Backbone, 'focus', this.windowFocused.bind(this));
72+
this.listenTo(Backbone, 'main-window-focus', this.windowFocused.bind(this));
7373
},
7474

7575
render: function () {

Diff for: desktop/app.js

+5
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ function createMainWindow() {
175175
mainWindow.on('move', delaySaveMainWindowPosition);
176176
mainWindow.on('restore', coerceMainWindowPositionToConnectedDisplay);
177177
mainWindow.on('close', updateMainWindowPositionIfPending);
178+
mainWindow.on('focus', mainWindowFocus);
178179
mainWindow.on('blur', mainWindowBlur);
179180
mainWindow.on('closed', () => {
180181
mainWindow = null;
@@ -282,6 +283,10 @@ function mainWindowBlur() {
282283
emitBackboneEvent('main-window-blur');
283284
}
284285

286+
function mainWindowFocus() {
287+
emitBackboneEvent('main-window-focus');
288+
}
289+
285290
function emitBackboneEvent(e, arg) {
286291
if (mainWindow && mainWindow.webContents) {
287292
arg = JSON.stringify(arg);

Diff for: desktop/package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: desktop/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "KeeWeb",
3-
"version": "1.7.6",
3+
"version": "1.7.7",
44
"description": "Free cross-platform password manager compatible with KeePass",
55
"main": "main.js",
66
"homepage": "https://keeweb.info",

Diff for: package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "keeweb",
3-
"version": "1.7.6",
3+
"version": "1.7.7",
44
"description": "Free cross-platform password manager compatible with KeePass",
55
"main": "Gruntfile.js",
66
"private": true,

Diff for: release-notes.md

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ Release notes
33
##### v1.8.0 (TBD)
44
`*` website icons are be downloaded using favicon.keeweb.info
55

6+
##### v1.7.7 (2019-02-09)
7+
`-` another attempt to fix focus issues
8+
69
##### v1.7.6 (2019-02-07)
710
`-` fixed focus issues in desktop apps
811

0 commit comments

Comments
 (0)