mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-13 08:44:12 +03:00
Hack in a workaround to cycle windows with meta-`
There's something wrong with CEF 3 right now where meta-` events aren't being forwarded to cocoa correctly. I just added some code to intercept meta-` and manually cycle the windows. I ignore any windows for which `excludeFromWindowsMenu` is true. That means we don't ever cycle to the hidden menu.
This commit is contained in:
parent
ae0be397de
commit
df0c19482c
@ -107,6 +107,8 @@ bool AtomCefClient::OnKeyEvent(CefRefPtr<CefBrowser> browser,
|
||||
}
|
||||
else if (event.modifiers == (KEY_META | KEY_ALT) && event.unmodified_character == 'i') {
|
||||
ToggleDevTools(browser);
|
||||
} else if (event.modifiers == KEY_META && event.unmodified_character == '`') {
|
||||
FocusNextWindow();
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
|
@ -98,6 +98,7 @@ class AtomCefClient : public CefClient,
|
||||
protected:
|
||||
CefRefPtr<CefBrowser> m_Browser;
|
||||
|
||||
void FocusNextWindow();
|
||||
void Open(std::string path);
|
||||
void Open();
|
||||
void NewWindow();
|
||||
|
@ -5,6 +5,25 @@
|
||||
#import "atom_application.h"
|
||||
#import "atom_window_controller.h"
|
||||
|
||||
|
||||
void AtomCefClient::FocusNextWindow() {
|
||||
NSArray *windows = [NSApp windows];
|
||||
int count = [windows count];
|
||||
int start = [windows indexOfObject:[NSApp mainWindow]];
|
||||
int i = start;
|
||||
while (true) {
|
||||
i = (i + 1) % count;
|
||||
|
||||
if (i == start) break;
|
||||
|
||||
NSWindow *window = [windows objectAtIndex:i];
|
||||
if (![window isExcludedFromWindowsMenu]) {
|
||||
[window makeKeyAndOrderFront:nil];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AtomCefClient::Open(std::string path) {
|
||||
NSString *pathString = [NSString stringWithCString:path.c_str() encoding:NSUTF8StringEncoding];
|
||||
[(AtomApplication *)[AtomApplication sharedApplication] open:pathString];
|
||||
|
@ -44,6 +44,7 @@
|
||||
- (id)initInBackground {
|
||||
[self initWithBootstrapScript:@"window-bootstrap" background:YES];
|
||||
[self.window setFrame:NSMakeRect(0, 0, 0, 0) display:NO];
|
||||
[self.window setExcludedFromWindowsMenu:YES];
|
||||
return self;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user