Skip to content

Commit

Permalink
Somehow working felixse#102 - loosing focus on click to to WebView ar…
Browse files Browse the repository at this point in the history
…ea for now
  • Loading branch information
beyond-danube committed Feb 3, 2022
1 parent a76551a commit e663153
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 2 deletions.
8 changes: 7 additions & 1 deletion FluentTerminal.App/Views/MainPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
if (sender != TopTabBar && sender != BottomTabBar)
{
DraggingHappensFromAnotherWindow = e;

TerminalView terminal = TerminalContainer.Content as TerminalView;
terminal.DraggingHappens = e;


}
DraggingHappens = e;
});
Expand Down Expand Up @@ -118,7 +123,7 @@ private void ViewModel_Closed(object sender, EventArgs e)

_coreTitleBar = null;
Bindings.StopTracking();
TerminalContainer.Content = null;
// TerminalContainer.Content = null;
}

private void OnWindowActivated(object sender, WindowActivatedEventArgs e)
Expand Down Expand Up @@ -242,5 +247,6 @@ private void MainPage_OnKeyDown(object sender, KeyRoutedEventArgs e)

ViewModel?.OnWindowKeyDown((int) e.Key, control, alt, shift, meta);
}

}
}
4 changes: 3 additions & 1 deletion FluentTerminal.App/Views/TerminalView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
mc:Ignorable="d">

<Grid>
<Grid x:Name="TerminalContainer" />
<Grid x:Name="TerminalContainer">
<Rectangle Fill="Fuchsia" x:Name="TermnalDropArea" Opacity="0.2" AllowDrop="True" DragEnter="TermnalDropArea_DragEnter" Drop="TermnalDropArea_Drop" Canvas.ZIndex="1" Visibility="{x:Bind DraggingHappens, Mode=TwoWay, Converter={StaticResource TrueToVisibleConverter}}"/>
</Grid>

<views:OverlayView x:Name="MessageOverlay" />

Expand Down
18 changes: 18 additions & 0 deletions FluentTerminal.App/Views/TerminalView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
using Windows.UI.Xaml.Media.Imaging;
using Windows.UI;
using Microsoft.Toolkit.Mvvm.Messaging;
using Windows.ApplicationModel.DataTransfer;
using System.Threading.Tasks;
using System.Linq;

namespace FluentTerminal.App.Views
{
Expand All @@ -19,6 +22,8 @@ public sealed partial class TerminalView : UserControl,
{
private ITerminalView _terminalView;

public bool DraggingHappens { get; set; }

public TerminalView(TerminalViewModel viewModel)
{
ViewModel = viewModel;
Expand Down Expand Up @@ -148,5 +153,18 @@ private void SearchTextBox_LostFocus(object sender, RoutedEventArgs e)
if (ViewModel != null)
ViewModel.SearchHasFocus = false;
}

private void TermnalDropArea_DragEnter(object sender, DragEventArgs e)
{
e.AcceptedOperation = DataPackageOperation.Link;

}

private async void TermnalDropArea_Drop(object sender, DragEventArgs e)
{
var items = await e.DataView.GetStorageItemsAsync();

_terminalView.Paste($"\"{items.First().Path}\"");
}
}
}
3 changes: 3 additions & 0 deletions FluentTerminal.App/Views/XtermTerminalView.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using FluentTerminal.App.Converters;
using FluentTerminal.App.Services;
using FluentTerminal.App.Services.Utilities;
using FluentTerminal.App.Utilities;
using FluentTerminal.App.ViewModels;
using FluentTerminal.Models;
Expand All @@ -13,7 +14,9 @@
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Windows.ApplicationModel.DataTransfer;
using Windows.Foundation;
using Windows.Storage;
using Windows.System;
using Windows.UI;
using Windows.UI.Xaml;
Expand Down

0 comments on commit e663153

Please sign in to comment.