sbmpost / AutoRaise

AutoRaise (and focus) a window when hovering over it with the mouse
GNU General Public License v3.0
1.48k stars 60 forks source link

Microsoft Apps (Excel and Word) Windows Raised #100

Closed hasantahir closed 2 years ago

hasantahir commented 2 years ago

A bit weird observation but multiple windows of Microsoft Excel are raised on their own when focused. I pulled the latest version of the app from the Master branch and compiled it with make CXXFLAGS="-DOLD_ACTIVATION_METHOD -DEXPERIMENTAL_FOCUS_FIRST" && make install.

This doesn't happen elsewhere (tried multiple windows of Chrome, Powerpoint, Skim PDF Reader,

Here's a video of the behaviour when I hover the cursor using a trackpad without clicking:

Excel: https://user-images.githubusercontent.com/11236148/182356051-5e70f724-3c2b-4767-8404-bc03ca87536a.mov

Word:

https://user-images.githubusercontent.com/11236148/182356906-ea597ddd-c94e-4067-baa2-d63abaf37582.mov

Observed the same behaviour when running the app through the command line using the config: ./AutoRaise -delay 0 -mouseStop true -verbose true

-- PS: On macOS 12.5, there were a few deprecation warnings during the compiling

AutoRaise.mm:155:9: warning: 'SameProcess' is deprecated: first deprecated in macOS 10.9 [-Wdeprecated-declarations]
        SameProcess(_window_psn, _focused_window_psn, &same_process);
        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ApplicationServices.framework/Frameworks/HIServices.framework/Headers/Processes.h:696:1: note: 'SameProcess' has been explicitly marked deprecated here
SameProcess(
^
AutoRaise.mm:186:22: warning: 'GetProcessForPID' is deprecated: first deprecated in macOS 10.9 [-Wdeprecated-declarations]
    OSStatus error = GetProcessForPID(pid, &process);
                     ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ApplicationServices.framework/Frameworks/HIServices.framework/Headers/Processes.h:930:1: note: 'GetProcessForPID' has been explicitly marked deprecated here
GetProcessForPID(
^
AutoRaise.mm:187:19: warning: 'SetFrontProcessWithOptions' is deprecated: first deprecated in macOS 10.9 [-Wdeprecated-declarations]
    if (!error) { SetFrontProcessWithOptions(&process, kSetFrontProcessFrontWindowOnly); }
                  ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ApplicationServices.framework/Frameworks/HIServices.framework/Headers/Processes.h:658:1: note: 'SetFrontProcessWithOptions' has been explicitly marked deprecated here
SetFrontProcessWithOptions(
^
AutoRaise.mm:977:50: warning: 'GetProcessForPID' is deprecated: first deprecated in macOS 10.9 [-Wdeprecated-declarations]
                                OSStatus error = GetProcessForPID(frontmost_pid, &focusedWindow_psn);
                                                 ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ApplicationServices.framework/Frameworks/HIServices.framework/Headers/Processes.h:930:1: note: 'GetProcessForPID' has been explicitly marked deprecated here
GetProcessForPID(
^
AutoRaise.mm:1002:50: warning: 'GetProcessForPID' is deprecated: first deprecated in macOS 10.9 [-Wdeprecated-declarations]
                                OSStatus error = GetProcessForPID(mouseWindow_pid, &mouseWindow_psn);
                                                 ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ApplicationServices.framework/Frameworks/HIServices.framework/Headers/Processes.h:930:1: note: 'GetProcessForPID' has been explicitly marked deprecated here
GetProcessForPID(
^
5 warnings generated.

Thanks as always.

sbmpost commented 2 years ago

@hasantahir Yes this indeed happens with some faulty applications that decide to raise their windows on focus. In the past firefox had the same problem but they fixed it. Unfortunately AutoRaise can't work around these cases. The only workaround would be to exclude those applications from focusing at all, but that seems worse to me?

hasantahir commented 2 years ago

Thanks, hoping the Microsoft folks are able to fix this on their end.

hasantahir commented 2 years ago

Hi @sbmpost

While using Zotero been noticing the same issue where it raises itself. Since it is based on Firefox, tried it and there is the same issue there. You mentioned that there were similar issues in the past with firefox.

Edit: tried Firefox nightly 105a and this behaviour is no longer observed.

I wanted to try out the GUI version just to exclude apps such as Zotero but I am unable to use it. The app inside the DMG doesn't seem to do anything for me.

Thanks

sbmpost commented 2 years ago

@hasantahir Can you open a new issue for the app in the dmg that doesn't seem to work for you?