-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
Make the window name _quake
special
#9785
Conversation
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A lot of nits, but a few questions here and there that I want answers on before signing off.
if (launchMode == LaunchMode::FullscreenMode) | ||
if (IsQuakeWindow()) | ||
{ | ||
_root->ToggleFocusMode(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why ToggleFocusMode
and not something like EnableFocusMode
or SetFocusMode(true)
? QM will always be in focus mode right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Frankly, I hadn't written _SetFocusMode
yet when I added this line 😋
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, but that's a private member on TerminalPage... meh, I just didn't feel like adding another method that'll only have one usage right here
// If we're entering QM from ~FM, then this will enter FM | ||
// If we're entering QM from FM, then this will do nothing | ||
// If we're leaving QM (we're already in FM), then this will do nothing | ||
_SetFocusMode(_isInFocusMode); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A continuation of my confusion from above, why not do ToggleFocusMode
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
meh, this one gets to be more explicit in what it's trying to do because it's already inside the TerminalPage. Technically, yes, ToggleFocusMode
would work, by setting it to false, but then staying in focus mode anyways, but ¯\_(ツ)_/¯
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! Thanks!
@@ -416,18 +410,25 @@ void AppHost::_HandleCreateWindow(const HWND hwnd, RECT proposedRect, LaunchMode | |||
const til::size availableSpace = desktopDimensions + nonClientSize; | |||
|
|||
origin = til::point{ | |||
nearestMonitorInfo.rcWork.left - (nonClientSize.width() / 2), | |||
nearestMonitorInfo.rcWork.top | |||
::base::saturated_cast<ptrdiff_t>(nearestMonitorInfo.rcWork.left - (nonClientSize.width() / 2)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like this is weird. We're doing the math unprotected from over/underflow first then casting the result into ptrdiff_t
.
Shouldn't we be doing a saturated operation on these things or casting them into the math wrappers first and then let it do the saturated subtract?
The same goes for some of the other saturated casts below. Though I'm not totally clear on what the source types are here that requires us to do the cast to begin with.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea you know, I felt weird writing that. I thinkthe types are LONGs originally. Maybe point
is more forgiving than size
, which is why I was getting weird "can't use an initializer list" errors.
lemme back that out and spend more than 30 seconds on it
…ial-_quake-window
…ub.com/microsoft/terminal into dev/migrie/f/653-special-_quake-window
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's an excellent idea for fixing the math thing. Appreciated. Looks good to me in that respect and otherwise.
Hello @zadjii-msft! Because this pull request has the 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 (
|
Adds support for two new actions: * `globalSummon`, which can be used to activate a window using a _global_ (READ: OS-level) hotkey. - accepts an optional `name` argument. When provided, this will attempt to summon with the given name. When omitted, we'll try to summon the most recent window. * `quakeMode` which is `globalSummon` for the `_quake` window. These actions are stored in the actions array, but are read by the `WindowsTerminal` level and bound to the OS in `IslandWindow`. The monarch registers for these keybindings with the OS. When one is pressed, the monarch will recieve a `WM_HOTKEY` message. It'll use that to look up the corresponding action args. It'll use those to try and summon the right window. ## References * #8888: Quake mode megathread * #9274: Spec (**guys seriously i just need one more ✔️**) * #9785: The start of granting "\_quake" super powers ## PR Checklist * [x] Closes #653 - I'm gonna say this closes it for now, though we have _many_ follow-ups in #8888 * [x] I work here * [x] Tests added/passed ## Validation Steps Performed * Validated that it works with `win` keys * Validated that it works without `win` keys * Validated that it hot-reloads * Validated that it moves to the new monarch * Validated that you can bind both `globalSummon` and `quakeMode` at the same time and do different things * Validated that you can bind `globalSummon` with a name and it creates that name if it doesn't already exist
🎉 Handy links: |
🎉 Handy links: |
Summary of the Pull Request
This PR adds some special behavior to the window named "_quake".
initialPosition
to determine which monitor this isWhen renaming a window to "_quake", it adopts all those behaviors as well. It does not exit focus mode when leaving QM, nor does it resize back. That seemed unnecessary.
References
PR Checklist
Detailed Description of the Pull Request / Additional comments
Note that this doesn't do things like:
I'm doing #653 very piecemeal, to try and make the PRs less egregious.
Validation Steps Performed
initialPosition
TODO!