Skip to content
Open
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
6 changes: 3 additions & 3 deletions FancyWM/Controls/NonHitTestableTilingOverlay.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
<Rectangle
IsHitTestVisible="False"
Opacity="{Binding RevealHighlightOpacity}"
Width="{Binding ComputedBounds.Width}"
Width="{Binding ActionsBounds.Width}"
Height="8"
Margin="0,0,0,0"
VerticalAlignment="Top"
Expand All @@ -162,8 +162,8 @@
</ItemsControl.ItemTemplate>
<ItemsControl.ItemContainerStyle>
<Style TargetType="ContentPresenter">
<Setter Property="Canvas.Left" Value="{Binding Path=ComputedBounds.Left}" />
<Setter Property="Canvas.Top" Value="{Binding Path=ComputedBounds.Top}" />
<Setter Property="Canvas.Left" Value="{Binding Path=ActionsBounds.Left}" />
<Setter Property="Canvas.Top" Value="{Binding Path=ActionsBounds.Top}" />
</Style>
</ItemsControl.ItemContainerStyle>
<ItemsControl.ItemsPanel>
Expand Down
8 changes: 4 additions & 4 deletions FancyWM/Controls/TilingOverlay.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@
</ItemsControl.ItemsPanel>
<ItemsControl.ItemContainerStyle>
<Style TargetType="ContentPresenter">
<Setter Property="Canvas.Left" Value="{Binding Path=ComputedBounds.Left}" />
<Setter Property="Canvas.Top" Value="{Binding Path=ComputedBounds.Top}" />
<Setter Property="Width" Value="{Binding Path=ComputedBounds.Width}" />
<Setter Property="Height" Value="{Binding Path=ComputedBounds.Height}" />
<Setter Property="Canvas.Left" Value="{Binding Path=ActionsBounds.Left}" />
<Setter Property="Canvas.Top" Value="{Binding Path=ActionsBounds.Top}" />
<Setter Property="Width" Value="{Binding Path=ActionsBounds.Width}" />
<Setter Property="Height" Value="{Binding Path=ActionsBounds.Height}" />
</Style>
</ItemsControl.ItemContainerStyle>
</ItemsControl>
Expand Down
17 changes: 17 additions & 0 deletions FancyWM/ViewModels/TilingWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ private enum RevealState

public Visibility ActionsVisibility { get => m_actionsVisibility; set => SetField(ref m_actionsVisibility, value); }

/// <summary>
/// Bounds of the visible window in overlay coordinates. Updated on cursor movement.
/// </summary>
public Rectangle ActionsBounds { get => m_actionsBounds; set => SetField(ref m_actionsBounds, value); }

public double ActionsHeight { get => m_actionsHeight; set => SetField(ref m_actionsHeight, value); }

public double RevealHighlightRadius { get => m_revealHighlightRadius; set => SetField(ref m_revealHighlightRadius, value); }
Expand All @@ -43,6 +48,7 @@ private enum RevealState
private IWorkspace? m_workspace;
private string? m_title;
private Visibility m_actionsVisibility = Visibility.Hidden;
private Rectangle m_actionsBounds;
private double m_actionsHeight = 22;
private RevealState m_actionsRevealState = RevealState.Hidden;
private double m_revealHighlightOpacity = 0;
Expand Down Expand Up @@ -185,6 +191,17 @@ private void OnCursorLocationChanged(object? sender, CursorLocationChangedEventA

var windowPos = node.WindowReference.Position;

// The window may be smaller than its cell (e.g. max size reached),
// so the actions must follow the visible window, not the cell.
var frame = node.WindowReference.FrameMargins;
var displayOffsetX = ComputedBounds.Left - node.ComputedRectangle.Left;
var displayOffsetY = ComputedBounds.Top - node.ComputedRectangle.Top;
ActionsBounds = new Rectangle(
left: windowPos.Left + frame.Left + displayOffsetX,
top: windowPos.Top + frame.Top + displayOffsetY,
right: windowPos.Right - frame.Right + displayOffsetX,
bottom: windowPos.Bottom - frame.Bottom + displayOffsetY);

var x = e.NewLocation.X - windowPos.Left;
var y = e.NewLocation.Y - windowPos.Top;

Expand Down
Loading