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

InputNonClientPointerSource send error message to app window #8976

Open
Gaoyifei1011 opened this issue Oct 1, 2023 · 3 comments
Open

InputNonClientPointerSource send error message to app window #8976

Gaoyifei1011 opened this issue Oct 1, 2023 · 3 comments
Labels
area-TitleBar Issues related to custom window title bars. area-Windowing bug Something isn't working team-CompInput Issue for IXP (Composition, Input) team

Comments

@Gaoyifei1011
Copy link

Describe the bug

When the application meets the following conditions (application window maximization, custom title bar part (ExtendsContentToTitlebar = true), set the drag area of the application window), click the right mouse button of the InputNonClientPointerSource window, and send 0X0313 message to the application window at the same time after triggering the WM_NCRBUTTONDOWN message.
当应用满足以下几个条件(应用窗口最大化,自定义标题栏部分(ExtendsContentToTitlebar = true),设置了应用窗口的拖动区域)时,点击InputNonClientPointerSource窗口的鼠标右键,在触发WM_NCRBUTTONDOWN消息后,并同时给应用窗口发送0X0313消息。

0X0313 message is an unlogged message that is sent to the app window when the app right-clicks the taskbar widget. When the app window adds a window procedure, the message can be captured normally.
0X0313消息是一个未记录的消息,当应用点击任务栏小窗口的右键时,此消息会发送到应用窗口。当应用窗口添加了窗口过程,就可以正常捕捉到该消息。

参考链接:https://blog.csdn.net/davidhsing/article/details/7770909
Reference link:https://blog.csdn.net/davidhsing/article/details/7770909

Steps to reproduce the bug

1.Customize the app title bar
2.Sets the drag area of the app window
3.The app window is maximized
4.Click to drag the right mouse button of the window

Expected behavior

When several of the conditions described above are met, you should not send 0X0313 message to the app window. When this message is handled by default by the app window, the window menu is displayed at the location of the mouse, which should not be displayed under normal circumstances.
满足以上所述的几个条件时,不应该对应用窗口发送0X0313消息。该消息被应用窗口默认处理时,会在鼠标所处的位置处显示窗口菜单,正常情况下该窗口不应该显示。

Screenshots

image
image

NuGet package version

Windows App SDK 1.4.1: 1.4.230913002

Packaging type

Packaged (MSIX)

Windows version

Windows 11 version 22H2 (22621, 2022 Update)

IDE

Visual Studio 2022

Additional context

None

@bpulliam bpulliam transferred this issue from microsoft/WindowsAppSDK Oct 12, 2023
@bpulliam bpulliam added team-CompInput Issue for IXP (Composition, Input) team area-TitleBar Issues related to custom window title bars. area-Windowing labels Oct 12, 2023
@peterjtan
Copy link
Contributor

peterjtan commented Oct 23, 2023

I think we can argue that this is a design choice. When you right click on a normal title bar, the system menu is shown. By extending content into title bar, the application draws content there, but that area is still acted like a title bar, so right clicking will have the system menu.

If you don't want the system menu to be shown in that case, probably you can catch the message WM_SYSMENU (0x0313) and handle it in your WndProc so that it won't pass through to DefWindowProc.

@duncanmacmichael duncanmacmichael added the bug Something isn't working label Oct 23, 2023
@Gaoyifei1011
Copy link
Author

I think we can argue that this is a design choice. When you right click on a normal title bar, the system menu is shown. By extending content into title bar, the application draws content there, but that area is still acted like a title bar, so right clicking will have the system menu.

If you don't want the system menu to be shown in that case, probably you can catch the message WM_SYSMENU (0x0313) and handle it in your WndProc so that it won't pass through to DefWindowProc.

感谢您的回复。我尝试通过修改窗口样式,将WS_SYSMENU移除,删除窗口的右键菜单,并在处理了WM_SYSMENU(0x0313)这一消息才完全消除。然而在最早的1.3的版本中,却没有这么多的问题,所以我希望能调查一下这个问题的具体原因。
我更希望的是,ms团队能够在InputNonClientPointerSource添加一个属性隐藏默认的窗口右键菜单,或者在自定义标题栏中实现一个WinUI样式的窗口右键菜单。

Thank you for your reply. I tried to remove WS_SYSMENU by modifying the window style, removing the right-click menu from the window, and removing it completely after processing the WM_SYSMENU(0x0313) message. However, in the original 1.3 version, there were not so many problems, so I wanted to investigate the specific cause of this problem.
I more hope is, ms team can in InputNonClientPointerSource add an attribute to hide the default window right-click menu, or in a custom title bar to achieve a WinUI style window right-click menu.

@luluco250
Copy link

I think we can argue that this is a design choice. When you right click on a normal title bar, the system menu is shown. By extending content into title bar, the application draws content there, but that area is still acted like a title bar, so right clicking will have the system menu.

If you don't want the system menu to be shown in that case, probably you can catch the message WM_SYSMENU (0x0313) and handle it in your WndProc so that it won't pass through to DefWindowProc.

@peterjtan Just stopping by to thank you for the WM_SYSMENU tip, I tried looking all over the place but it seems to be completely undocumented and is the only trick that worked for opening the system menu in a window with a client drawn frame.

LParam seems to be screen coords of the mouse cursor too, so it worked quite nicely in my case where I'm passing client messages to nonclient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-TitleBar Issues related to custom window title bars. area-Windowing bug Something isn't working team-CompInput Issue for IXP (Composition, Input) team
Projects
None yet
Development

No branches or pull requests

5 participants