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

Only move the window to the current desktop when it isn't on that one already #10025

Merged
1 commit merged into from
May 4, 2021

Conversation

zadjii-msft
Copy link
Member

Summary of the Pull Request

This is to mitigate MSFT:33035972. If you call MoveWindowToDesktop while an app is set to "Show windows from this app on all desktops", the OS will clear that "Show windows from this app on all desktops" state. But it won't clear that state from the task view, so it'll just plain look broken.

We can mitigate this just by checking if we're already on the current desktop first. "Show windows from this app on all desktops" windows will always be on every desktop, so that API will return true, and we can avoid tearing the state.

References

PR Checklist

Validation Steps Performed

  • it works again

@zadjii-msft zadjii-msft added Issue-Bug It either shouldn't be doing this or needs an investigation. Product-Terminal The new Windows Terminal. Area-Remoting Communication layer between windows. Often for windowing behavior, quake mode, etc. labels May 3, 2021
// we are, then don't call MoveWindowToDesktop. This is to mitigate
// MSFT:33035972
BOOL onCurrentDesktop{ false };
if (SUCCEEDED(_desktopManager->IsWindowOnCurrentVirtualDesktop(_window->GetHandle(), &onCurrentDesktop)) && onCurrentDesktop)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FAILED doesn't exist? Or could we do !SUCCEEDED?

I was taught that...

if (x)
   // do nothing
else
   // do something

should always be simplified to...

if (!x)
   // do something

but otherwise, meh.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is more complicated because of the conditional. I'd just leave it.

@DHowett DHowett added the AutoMerge Marked for automatic merge by the bot when requirements are met label May 4, 2021
@ghost
Copy link

ghost commented May 4, 2021

Hello @DHowett!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit 7d71b4b into main May 4, 2021
@ghost ghost deleted the dev/migrie/f/quake/MoveWindowToDesktop-bug branch May 4, 2021 21:20
@ghost
Copy link

ghost commented May 25, 2021

🎉Windows Terminal Preview v1.9.1445.0 has been released which incorporates this pull request.:tada:

Handy links:

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Remoting Communication layer between windows. Often for windowing behavior, quake mode, etc. AutoMerge Marked for automatic merge by the bot when requirements are met Issue-Bug It either shouldn't be doing this or needs an investigation. Product-Terminal The new Windows Terminal.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants