From 810c36f71e4abc17a6c617aca492fe7801b530b4 Mon Sep 17 00:00:00 2001 From: WarmUpTill Date: Wed, 6 Jul 2016 14:42:04 +0200 Subject: [PATCH] undo of last commit (not reliable without extra permission) --- switcher.cpp | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/switcher.cpp b/switcher.cpp index e57d687d..edd1cde5 100644 --- a/switcher.cpp +++ b/switcher.cpp @@ -35,7 +35,7 @@ void Switcher::switcherThreadFunc() { break; } } - catch(exception const & ex) + catch(...) { } @@ -175,15 +175,21 @@ bool Switcher::isWindowFullscreen() { //get window resolution cmd = "osascript " + "-e 'global frontApp, frontAppName, windowTitle, boundsValue' " + "-e 'set windowTitle to \"\"' " "-e 'tell application \"System Events\"' " - "-e 'set frontApp to name of first application process whose frontmost is true' " + "-e 'set frontApp to first application process whose frontmost is true' " + "-e 'set frontAppName to name of frontApp' " + "-e 'tell process frontAppName' " + "-e 'tell (1st window whose value of attribute \"AXMain\" is true)' " + "-e 'set windowTitle to value of attribute \"AXTitle\"' " + "-e 'end tell' " + "-e 'end tell' " "-e 'end tell' " - "-e 'tell application frontApp' " - "-e 'if the (count of windows) is not 0 then' " - "-e 'set window_name to name of front window' " - "-e 'set boundvalue to bounds of front window' " - "-e 'end if' " - "-e 'end tell' "; + "-e 'tell application frontAppName' " + "-e 'set boundsValue to bounds of front window' " + "-e 'end tell' " + "-e 'return boundsValue' "; char bounds[256]; @@ -212,14 +218,18 @@ string Switcher::GetActiveWindowTitle() string Switcher::GetActiveWindowTitle() { string cmd = "osascript " + "-e 'global frontApp, frontAppName, windowTitle' " + "-e 'set windowTitle to \"\"' " "-e 'tell application \"System Events\"' " - "-e 'set frontApp to name of first application process whose frontmost is true' " + "-e 'set frontApp to first application process whose frontmost is true' " + "-e 'set frontAppName to name of frontApp' " + "-e 'tell process frontAppName' " + "-e 'tell (1st window whose value of attribute \"AXMain\" is true)' " + "-e 'set windowTitle to value of attribute \"AXTitle\"' " + "-e 'end tell' " + "-e 'end tell' " "-e 'end tell' " - "-e 'tell application frontApp' " - "-e 'if the (count of windows) is not 0 then' " - "-e 'set window_name to name of front window' " - "-e 'end if' " - "-e 'end tell' "; + "-e 'return windowTitle' "; char buffer[256]; FILE * f = popen(cmd.c_str(), "r");