Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] The program opens when the icons in the Start menu are rearranged #452

Open
anemomylos opened this issue Oct 4, 2022 · 13 comments
Open

Comments

@anemomylos
Copy link

anemomylos commented Oct 4, 2022

  • Open the Windows Start menu
  • Move a program icon to a different location inside the Start menu
  • Close the Start menu

The SystemTrayMenu window opens, as when you left-click its icon in the systray.
Note that this happens only once per Windows session. (not true, read this: #452 (comment))

  • OS: Microsoft Windows 11 Pro, 22H2, 22621.608 (I have noticed this at all versions of Windows 11)
  • Program Version 1.3.1.0

I attach screenshots with the program configuration in case they may be helpful.

general
advanced
customize
expert
sizeandlocation

@Hofknecht
Copy link
Owner

@anemomylos
Thank you for the feedback!

I thought it might be related to
#447
but i see 'Show in Taskbar' is disabled

on the first try now i couldn't reproduce it

maybe can you make a short video of the behavior e.g. with 'Apowersoft Free Screen Recorder'?

Does this also occure in windows 10?

@anemomylos
Copy link
Author

Yes, sure, I will try to record the screen.
I never noticed that in Windows 10.
It's very strange that to reproduce it you have to reboot Windows because it doesn't do it again - only the first time that you rearrange an icon in Start menu it happens.

@anemomylos
Copy link
Author

anemomylos commented Oct 4, 2022

I never noticed that in Windows 10

Maybe it's because I didn't use the program in Windows 10. :)

I only found the program and started using it when I started using Windows 11 because MS decided to remove the "Desktop"
toolbar from the task bar.

@anemomylos
Copy link
Author

systemtraymenu.mp4

@anemomylos
Copy link
Author

I've noticed that changing the virtual desktop makes it possible to reproduce the above behavior without having to reboot Windows.

@Hofknecht
Copy link
Owner

tested in win 10 & win 11, can still not reproduce ....
we will check again

@anemomylos
Copy link
Author

Let me know if you want to create a test version that displays some debug message when the popup opens, indicating what kind of action caused it to open, so that I can test it on my system.

@anemomylos
Copy link
Author

anemomylos commented Oct 13, 2022

I noticed that when i choose as hotkey to open the program the combination Ctrl+Alt+L, the bug does not occur. Btw, don't use this combination since is the default Windows 11 combination for live captions.

If I set the default hotkey (Ctrl+Win) the program opens every time I change the virtual desktop of Windows using the default Windows combination (Ctrl+Win+Left/Right arrow).

When the hotkey field is cleared, the behavior is as I initially described.

Most likely the code to be reviewed is the one that handles the hotkey.

@Hofknecht
Copy link
Owner

Thanks, thats a great hint!

so workaround for now is to change hotkey to fix this case!

this is weird because we just register the hotkey, we don't do anything special with this hotkey. I won't be there at the weekend, but I'm considering writing a small test program next week that will show the error. For me it is just buggy that after registering the hotkey we are triggered even though the hotkey is not pressed in the situation. We've been using the Ctrl + LWin hotkey for a while and haven't seemed to have any side effects so far. Maybe there's nothing we can do about it except changing the hotkey default. but we'll see again next week

@anemomylos
Copy link
Author

Can you point me to the code that handles the hotkey setting and the code that is executed once the hotkey is activated? I did a quick search to find them but with no luck.

@Hofknecht
Copy link
Owner

Hofknecht commented Oct 17, 2022

@anemomylos

Hey, yes sure

this is in RegisterHotKeys,cs
private static extern bool RegisterHotKey(IntPtr hWnd, int id, uint fsModifiers, uint virtualKeyCode);

SystemTrayMenu.dll!SystemTrayMenu.DllImports.NativeMethods.User32RegisterHotKey(System.IntPtr hWnd, int id, uint fsModifiers, uint vk) Line 19	C#

SystemTrayMenu.dll!SystemTrayMenu.Helper.KeyboardHook.RegisterHotKey(uint modifier, System.Windows.Forms.Keys key) Line 117 C#
SystemTrayMenu.dll!SystemTrayMenu.Helper.KeyboardHook.RegisterHotKey(SystemTrayMenu.Helper.KeyboardHookModifierKeys modifier, System.Windows.Forms.Keys key) Line 105 C#
SystemTrayMenu.dll!SystemTrayMenu.Helper.KeyboardHook.RegisterHotKey() Line 92 C#
SystemTrayMenu.dll!SystemTrayMenu.Handler.KeyboardInput.RegisterHotKey() Line 56 C#
SystemTrayMenu.dll!SystemTrayMenu.Business.Menus.Menus() Line 66 C#
SystemTrayMenu.dll!SystemTrayMenu.App.App() Line 21 C#
SystemTrayMenu.dll!SystemTrayMenu.Program.Main(string[] args) Line 35 C#

2022-10-17 19_18_01-Window

here is also the callstack when pressing the hotkey

SystemTrayMenu.dll!SystemTrayMenu.Business.Menus.SwitchOpenClose(bool byClick, bool isMainPreload) Line 189 C#
SystemTrayMenu.dll!SystemTrayMenu.Business.Menus.KeyboardInput_HotKeyPressed() Line 1184 C#
SystemTrayMenu.dll!SystemTrayMenu.Handler.KeyboardInput.Hook_KeyPressed(object sender, SystemTrayMenu.Helper.KeyPressedEventArgs e) Line 228 C#
SystemTrayMenu.dll!SystemTrayMenu.Helper.KeyboardHook.Window_KeyPressed(object sender, SystemTrayMenu.Helper.KeyPressedEventArgs e) Line 110 C#
SystemTrayMenu.dll!SystemTrayMenu.Helper.KeyboardHook.Window.WndProc(ref System.Windows.Forms.Message m) Line 161 C#

@Hofknecht
Copy link
Owner

@anemomylos
Maybe you can debug a bit
-make a breakpoint at SwitchOpenClose and check if you have same stacktrace
-comment out: content of method RegisterHotKey, rebuild and try if this solves the issue to verify it is really causing by hotkey.
-maybe try if you find similar hotkeys which have the same issue, but i think you already said other ones do not have this problem.

@Hofknecht
Copy link
Owner

#474
#452
#505
seems to be related

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants