DockShow workaround
Implemented workaround in DockShow for TransformProcessType bugginess based on discussion at http://stackoverflow.com/questions/7596643/
This commit is contained in:
parent
fe016d393f
commit
a39834740c
1 changed files with 14 additions and 1 deletions
|
@ -70,8 +70,21 @@ void Browser::DockHide() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Browser::DockShow() {
|
void Browser::DockShow() {
|
||||||
|
BOOL active = [[NSRunningApplication currentApplication] isActive];
|
||||||
ProcessSerialNumber psn = { 0, kCurrentProcess };
|
ProcessSerialNumber psn = { 0, kCurrentProcess };
|
||||||
|
if (active) {
|
||||||
|
// Workaround buggy behavior of TransformProcessType
|
||||||
|
for (NSRunningApplication * app in [NSRunningApplication runningApplicationsWithBundleIdentifier:@"com.apple.dock"]) {
|
||||||
|
[app activateWithOptions:NSApplicationActivateIgnoringOtherApps];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.001 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
|
||||||
TransformProcessType(&psn, kProcessTransformToForegroundApplication);
|
TransformProcessType(&psn, kProcessTransformToForegroundApplication);
|
||||||
|
[[NSRunningApplication currentApplication] activateWithOptions:NSApplicationActivateIgnoringOtherApps];
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
TransformProcessType(&psn, kProcessTransformToForegroundApplication);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Browser::DockSetMenu(ui::MenuModel* model) {
|
void Browser::DockSetMenu(ui::MenuModel* model) {
|
||||||
|
|
Loading…
Reference in a new issue