mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
@@ -141,6 +141,8 @@ bool AtomCefClient::OnKeyEvent(CefRefPtr<CefBrowser> browser,
|
||||
ToggleDevTools(browser);
|
||||
} else if (event.modifiers == EVENTFLAG_COMMAND_DOWN && event.unmodified_character == '`') {
|
||||
FocusNextWindow();
|
||||
} else if (event.modifiers == (EVENTFLAG_COMMAND_DOWN | EVENTFLAG_SHIFT_DOWN) && event.unmodified_character == '~') {
|
||||
FocusPreviousWindow();
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
|
||||
@@ -105,6 +105,7 @@ class AtomCefClient : public CefClient,
|
||||
bool m_HandlePasteboardCommands = false;
|
||||
|
||||
void FocusNextWindow();
|
||||
void FocusPreviousWindow();
|
||||
void Open(std::string path);
|
||||
void Open();
|
||||
void OpenUnstable(std::string path);
|
||||
|
||||
@@ -23,6 +23,24 @@ void AtomCefClient::FocusNextWindow() {
|
||||
}
|
||||
}
|
||||
|
||||
void AtomCefClient::FocusPreviousWindow() {
|
||||
NSArray *windows = [NSApp windows];
|
||||
int count = [windows count];
|
||||
int start = [windows indexOfObject:[NSApp keyWindow]];
|
||||
|
||||
int i = start;
|
||||
while (true) {
|
||||
i = i - 1;
|
||||
if (i == 0) i = count -1;
|
||||
if (i == start) break;
|
||||
NSWindow *window = [windows objectAtIndex:i];
|
||||
if ([window isVisible] && ![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];
|
||||
|
||||
Reference in New Issue
Block a user