Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/reference/first-release-scene-control.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ The Windows Studio footer groups Graphics and Outputs on the left, Take/FTB on t
health/audio row. Output option flyouts remain available. Edit Tiles on a Tiles
scene cues that scene to Preview and opens its wall inspector; it never Takes.

Ctrl+Enter invokes the existing Take command in Studio. Ctrl+Shift+B invokes FTB.
Both shortcuts ignore text-entry controls. Existing graphics F-key mappings and
Spacebar invokes the existing Take command in Studio; Ctrl+Enter remains an alternate.
Ctrl+Shift+B invokes FTB. These shortcuts ignore text-entry controls. Existing graphics F-key mappings and
remote `transport.take` remain unchanged. Companion discovers `transport.ftb.toggle`
and `transport.ftb.set(enabled)` from the action manifest; its FTB preset lights
from `programBlackout` feedback. Use the idempotent set action when retrying requests.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Input;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Input;
using Windows.System;
using Windows.UI.Core;

namespace CoreVideoPro.WinUI.Views;

Expand All @@ -10,6 +14,10 @@ public sealed partial class StudioWorkspace

private void AttachTransportHotkeys()
{
// Preview events precede a focused button's built-in Space activation.
// A normal accelerator on the parent loses to the transition flyout button.
PreviewKeyDown += OnTransportPreviewKeyDown;
PreviewKeyUp += OnTransportPreviewKeyUp;
Add(VirtualKey.Enter, VirtualKeyModifiers.Control, false);
Add(VirtualKey.B, VirtualKeyModifiers.Control | VirtualKeyModifiers.Shift, true);
void Add(VirtualKey key, VirtualKeyModifiers modifiers, bool blackout)
Expand All @@ -29,4 +37,38 @@ void Add(VirtualKey key, VirtualKeyModifiers modifiers, bool blackout)
KeyboardAccelerators.Add(accelerator);
}
}

private bool _spaceTakeCaptured;

private void OnTransportPreviewKeyDown(object sender, KeyRoutedEventArgs args)
{
if (args.Key != VirtualKey.Space) return;
var modified = IsDown(VirtualKey.Control) || IsDown(VirtualKey.Shift) ||
IsDown(VirtualKey.Menu) || IsDown(VirtualKey.LeftWindows) || IsDown(VirtualKey.RightWindows);
var focus = XamlRoot is null ? null : FocusManager.GetFocusedElement(XamlRoot) as DependencyObject;
if (ViewModel is not { IsStudioTab: true } vm || modified || IsTextEntry(focus)) return;
// Consume even when Take is unavailable: Space must never open a flyout
// or toggle an output because the focused control happened to change.
args.Handled = true;
_spaceTakeCaptured = true;
if (!args.KeyStatus.WasKeyDown && vm.TakeCommand.CanExecute(null))
vm.TakeCommand.Execute(null);
}

private void OnTransportPreviewKeyUp(object sender, KeyRoutedEventArgs args)
{
if (args.Key != VirtualKey.Space || !_spaceTakeCaptured) return;
args.Handled = true;
_spaceTakeCaptured = false;
}

private static bool IsDown(VirtualKey key) =>
InputKeyboardSource.GetKeyStateForCurrentThread(key).HasFlag(CoreVirtualKeyStates.Down);

private static bool IsTextEntry(DependencyObject? focus)
{
for (var current = focus; current is not null; current = VisualTreeHelper.GetParent(current))
if (current is TextBox or RichEditBox or AutoSuggestBox or NumberBox or PasswordBox) return true;
return false;
}
}
2 changes: 1 addition & 1 deletion native-shell/CoreVideoPro.WinUI/Views/StudioWorkspace.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -1209,7 +1209,7 @@
<StackPanel Orientation="Horizontal" Spacing="0">
<Button Style="{StaticResource TakeButton}" Width="84" Height="48" Padding="12,8" CornerRadius="8" Content="Take"
Command="{x:Bind ViewModel.TakeCommand}" IsEnabled="{x:Bind ViewModel.CanTake, Mode=OneWay}"
ToolTipService.ToolTip="Take Preview to Program (Ctrl+Enter)"/>
ToolTipService.ToolTip="Take Preview to Program (Spacebar)"/>
<Button Style="{StaticResource TransportButton}" Width="128" Height="48" Padding="10,6" Margin="12,0,0,0" AutomationProperties.Name="Choose Take transition" ToolTipService.ToolTip="Choose Take transition">
<StackPanel Orientation="Horizontal" Spacing="8">
<TextBlock Text="{x:Bind ViewModel.TakeTransitionLabel, Mode=OneWay}" FontSize="12"/>
Expand Down
Loading