GUI: Added command-line option to force pure software rendering.
This commit is contained in:
parent
2ff7ed8262
commit
7fee4f9bf3
@ -5,6 +5,8 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using System.Windows.Interop;
|
||||||
|
using System.Windows.Media;
|
||||||
|
|
||||||
namespace com.muldersoft.slunkcrypt.gui
|
namespace com.muldersoft.slunkcrypt.gui
|
||||||
{
|
{
|
||||||
@ -15,6 +17,18 @@ namespace com.muldersoft.slunkcrypt.gui
|
|||||||
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(ExceptionHandler);
|
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(ExceptionHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void OnStartup(StartupEventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (Array.Exists(e.Args, str => StrCaseCmp(str, "--render-mode=software")) || StrCaseCmp(Environment.GetEnvironmentVariable("SLUNK_RENDER_MODE"), "software"))
|
||||||
|
{
|
||||||
|
RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
}
|
||||||
|
|
||||||
private static void ExceptionHandler(object sender, UnhandledExceptionEventArgs args)
|
private static void ExceptionHandler(object sender, UnhandledExceptionEventArgs args)
|
||||||
{
|
{
|
||||||
Exception exception;
|
Exception exception;
|
||||||
@ -36,5 +50,14 @@ namespace com.muldersoft.slunkcrypt.gui
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static bool StrCaseCmp(string s1, string s2)
|
||||||
|
{
|
||||||
|
if ((!ReferenceEquals(s1, null)) && (!ReferenceEquals(s2, null)))
|
||||||
|
{
|
||||||
|
return string.Equals(s1.Trim(), s2.Trim(), StringComparison.OrdinalIgnoreCase);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
BIN
gui/Resources/Hint.png
Normal file
BIN
gui/Resources/Hint.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 663 B |
@ -201,6 +201,9 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Resource Include="Resources\Background.png" />
|
<Resource Include="Resources\Background.png" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Resource Include="Resources\Hint.png" />
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PostBuildEvent>copy /Y "$(SolutionDir)\etc\deps\cpu-capabilities\*.dll" "$(TargetDir)"</PostBuildEvent>
|
<PostBuildEvent>copy /Y "$(SolutionDir)\etc\deps\cpu-capabilities\*.dll" "$(TargetDir)"</PostBuildEvent>
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
Icon="pack://application:,,,/slunkcrypt-gui;component/Resources/Application.ico"
|
Icon="pack://application:,,,/slunkcrypt-gui;component/Resources/Application.ico"
|
||||||
SizeToContent="WidthAndHeight"
|
SizeToContent="WidthAndHeight"
|
||||||
WindowStartupLocation="CenterScreen"
|
WindowStartupLocation="CenterScreen"
|
||||||
ResizeMode="CanMinimize"
|
ResizeMode="CanResize"
|
||||||
WindowStyle="ThreeDBorderWindow"
|
WindowStyle="ThreeDBorderWindow"
|
||||||
UseLayoutRounding="True"
|
UseLayoutRounding="True"
|
||||||
AllowDrop="True"
|
AllowDrop="True"
|
||||||
@ -36,6 +36,7 @@
|
|||||||
<BitmapImage x:Key="ImageSource_TabHd2" UriSource="Resources/Tab_Decrypt.png"/>
|
<BitmapImage x:Key="ImageSource_TabHd2" UriSource="Resources/Tab_Decrypt.png"/>
|
||||||
<BitmapImage x:Key="ImageSource_TabHd3" UriSource="Resources/Tab_LogFile.png"/>
|
<BitmapImage x:Key="ImageSource_TabHd3" UriSource="Resources/Tab_LogFile.png"/>
|
||||||
<BitmapImage x:Key="ImageSource_Bkgrnd" UriSource="Resources/Background.png"/>
|
<BitmapImage x:Key="ImageSource_Bkgrnd" UriSource="Resources/Background.png"/>
|
||||||
|
<BitmapImage x:Key="ImageSource_Hint" UriSource="Resources/Hint.png"/>
|
||||||
<ImageBrush x:Key="Brush_Bkgrnd" ImageSource="{StaticResource ImageSource_Bkgrnd}" TileMode="Tile" ViewportUnits="Absolute" Viewport="0,0,145,145"/>
|
<ImageBrush x:Key="Brush_Bkgrnd" ImageSource="{StaticResource ImageSource_Bkgrnd}" TileMode="Tile" ViewportUnits="Absolute" Viewport="0,0,145,145"/>
|
||||||
<FontFamily x:Key="Monospace">pack://application:,,,/Resources/Fonts/#Hack</FontFamily>
|
<FontFamily x:Key="Monospace">pack://application:,,,/Resources/Fonts/#Hack</FontFamily>
|
||||||
<utils:FontSizeConverter x:Key="SlightlySmallFont" Ratio="0.875"/>
|
<utils:FontSizeConverter x:Key="SlightlySmallFont" Ratio="0.875"/>
|
||||||
@ -50,7 +51,8 @@
|
|||||||
<StackPanel Style="{StaticResource WaitCursorWhileBusy}" Background="Transparent">
|
<StackPanel Style="{StaticResource WaitCursorWhileBusy}" Background="Transparent">
|
||||||
<Grid Background="{StaticResource Brush_Bkgrnd}">
|
<Grid Background="{StaticResource Brush_Bkgrnd}">
|
||||||
<Image Source="{StaticResource ImageSource_Banner}" Stretch="None" MouseLeftButtonDown="Image_MouseLeftButtonDown" Name="Banner"/>
|
<Image Source="{StaticResource ImageSource_Banner}" Stretch="None" MouseLeftButtonDown="Image_MouseLeftButtonDown" Name="Banner"/>
|
||||||
<Canvas x:Name="Canvas" IsHitTestVisible="False" Visibility="{Binding IsBusyIndicatorVisible, RelativeSource={RelativeSource FindAncestor, AncestorType=Window}, Converter={StaticResource VisibilityConverter}}" Width="{Binding Path=ActualWidth, ElementName=Banner}" Opacity="0.8"/>
|
<Canvas x:Name="Canvas" IsHitTestVisible="False" Visibility="{Binding IsBusyIndicatorVisible, RelativeSource={RelativeSource FindAncestor, AncestorType=Window}, Converter={StaticResource VisibilityConverter}}" MaxWidth="{Binding Path=ActualWidth, ElementName=Banner}" Opacity="0.8"/>
|
||||||
|
<Image Source="{StaticResource ImageSource_Hint}" Stretch="None" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="6" Visibility="Hidden" ToolTip="Software-rendering is enabled!" Name="Hint_SoftwareRendering"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Separator Margin="0"/>
|
<Separator Margin="0"/>
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
|
@ -17,6 +17,7 @@ using System.Threading.Tasks;
|
|||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Interop;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Windows.Media.Effects;
|
using System.Windows.Media.Effects;
|
||||||
using System.Windows.Shell;
|
using System.Windows.Shell;
|
||||||
@ -120,11 +121,15 @@ namespace com.muldersoft.slunkcrypt.gui
|
|||||||
MinHeight = MaxHeight = ActualHeight;
|
MinHeight = MaxHeight = ActualHeight;
|
||||||
CreateIndicatorElements();
|
CreateIndicatorElements();
|
||||||
CreateSystemMenu();
|
CreateSystemMenu();
|
||||||
|
if (RenderMode.SoftwareOnly.Equals(RenderOptions.ProcessRenderMode))
|
||||||
|
{
|
||||||
|
Hint_SoftwareRendering.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
if (m_config.LegacyCompat)
|
if (m_config.LegacyCompat)
|
||||||
{
|
{
|
||||||
Checkbox_Encrypt_LegacyCompat.IsChecked = Checkbox_Decrypt_LegacyCompat.IsChecked = true;
|
Checkbox_Encrypt_LegacyCompat.IsChecked = Checkbox_Decrypt_LegacyCompat.IsChecked = true;
|
||||||
}
|
}
|
||||||
this.EnableResize(true);
|
this.DisableMaximizeButton();
|
||||||
this.BringWindowToTop();
|
this.BringWindowToTop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,19 +30,19 @@ namespace com.muldersoft.slunkcrypt.gui.utils
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void EnableResize(this Window window, bool enable)
|
public static void DisableMaximizeButton(this Window window)
|
||||||
{
|
{
|
||||||
if (!ReferenceEquals(window, null))
|
if (!ReferenceEquals(window, null))
|
||||||
{
|
{
|
||||||
const int GWL_STYLE = -16;
|
const int GWL_STYLE = -16;
|
||||||
const uint WS_SIZEBOX = 0x40000;
|
const uint WS_MAXIMIZEBOX = 0x10000;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
WindowInteropHelper interopHelper = new WindowInteropHelper(window);
|
WindowInteropHelper interopHelper = new WindowInteropHelper(window);
|
||||||
uint value = NativeMethods.GetWindowLong(interopHelper.Handle, GWL_STYLE);
|
uint value = NativeMethods.GetWindowLong(interopHelper.Handle, GWL_STYLE);
|
||||||
if (value != 0)
|
if ((value & WS_MAXIMIZEBOX) != 0U)
|
||||||
{
|
{
|
||||||
NativeMethods.SetWindowLong(interopHelper.Handle, GWL_STYLE, enable ? (value | WS_SIZEBOX) : (value & (~WS_SIZEBOX)));
|
NativeMethods.SetWindowLong(interopHelper.Handle, GWL_STYLE, value & (~WS_MAXIMIZEBOX));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch { }
|
catch { }
|
||||||
|
Loading…
Reference in New Issue
Block a user