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 no longer works after removing titlebar with SetBorderAndTitleBar #9661

Open
HO-COOH opened this issue May 21, 2024 · 1 comment
Labels
area-TitleBar Issues related to custom window title bars. area-Windowing team-CompInput Issue for IXP (Composition, Input) team

Comments

@HO-COOH
Copy link

HO-COOH commented May 21, 2024

Describe the bug

I am trying to completely self-drawing the titlebar buttons, so I use presenter.SetBorderAndTitleBar(false, false); to remove the titlebar together with the caption buttons. Then I found InputNonClientPointerSource to set draggable regions no longer works.

This is an issue for developers trying to completely self-drawing a window.

Steps to reproduce the bug

  1. In window constructor, use this code to completely remove the titlebar (along with the standard caption buttons)
            ExtendsContentIntoTitleBar(true);
            auto presenter = AppWindow().Presenter().as<winrt::Microsoft::UI::Windowing::OverlappedPresenter>();
            presenter.SetBorderAndTitleBar(false, false);
  1. Use this code to set a draggable region
    auto source = winrt::Microsoft::UI::Input::InputNonClientPointerSource::GetForWindowId(winrt::Microsoft::UI::GetWindowIdFromWindow(/*get hwnd from this window*/));
    source.ClearRegionRects(winrt::Microsoft::UI::Input::NonClientRegionKind::Caption);
    source.SetRegionRects(
        winrt::Microsoft::UI::Input::NonClientRegionKind::Caption,
        {
            winrt::Windows::Graphics::RectInt32{
                .X = (int)0,
                .Y = (int)0,
                .Width = (int)400,
                .Height = (int)400
            }
        }
    );

Expected behavior

No response

Screenshots

No response

NuGet package version

Windows App SDK 1.5.3: 1.5.240428000

Packaging type

Packaged (MSIX)

Windows version

Windows 10 version 1809 (17763, October 2018 Update)

IDE

No response

Additional context

No response

@microsoft-github-policy-service microsoft-github-policy-service bot added the needs-triage Issue needs to be triaged by the area owners label May 21, 2024
@codendone codendone transferred this issue from microsoft/WindowsAppSDK May 23, 2024
@codendone codendone added team-CompInput Issue for IXP (Composition, Input) team area-TitleBar Issues related to custom window title bars. area-Windowing and removed needs-triage Issue needs to be triaged by the area owners labels May 23, 2024
Copy link

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

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 team-CompInput Issue for IXP (Composition, Input) team
Projects
None yet
Development

No branches or pull requests

2 participants