diff --git a/Wox/Helper/DWMDropShadow.cs b/Wox/Helper/DWMDropShadow.cs
new file mode 100644
index 0000000000..d727966d6a
--- /dev/null
+++ b/Wox/Helper/DWMDropShadow.cs
@@ -0,0 +1,73 @@
+using System;
+using System.Drawing.Printing;
+using System.Runtime.InteropServices;
+using System.Windows;
+using System.Windows.Interop;
+
+namespace Wox.Helper
+{
+ public class DwmDropShadow
+ {
+
+ [DllImport("dwmapi.dll", PreserveSig = true)]
+ private static extern int DwmSetWindowAttribute(IntPtr hwnd, int attr, ref int attrValue, int attrSize);
+
+ [DllImport("dwmapi.dll")]
+ private static extern int DwmExtendFrameIntoClientArea(IntPtr hWnd, ref Margins pMarInset);
+
+ ///
+ /// Drops a standard shadow to a WPF Window, even if the window isborderless. Only works with DWM (Vista and Seven).
+ /// This method is much more efficient than setting AllowsTransparency to true and using the DropShadow effect,
+ /// as AllowsTransparency involves a huge permormance issue (hardware acceleration is turned off for all the window).
+ ///
+ /// Window to which the shadow will be applied
+ public static void DropShadowToWindow(Window window)
+ {
+ if (!DropShadow(window))
+ {
+ window.SourceInitialized += new EventHandler(window_SourceInitialized);
+ }
+ }
+
+ private static void window_SourceInitialized(object sender, EventArgs e) //fixed typo
+ {
+ Window window = (Window)sender;
+
+ DropShadow(window);
+
+ window.SourceInitialized -= new EventHandler(window_SourceInitialized);
+ }
+
+ ///
+ /// The actual method that makes API calls to drop the shadow to the window
+ ///
+ /// Window to which the shadow will be applied
+ /// True if the method succeeded, false if not
+ private static bool DropShadow(Window window)
+ {
+ try
+ {
+ WindowInteropHelper helper = new WindowInteropHelper(window);
+ int val = 2;
+ int ret1 = DwmSetWindowAttribute(helper.Handle, 2, ref val, 4);
+
+ if (ret1 == 0)
+ {
+ Margins m = new Margins { Bottom = 0, Left = 0, Right = 0, Top = 0 };
+ int ret2 = DwmExtendFrameIntoClientArea(helper.Handle, ref m);
+ return ret2 == 0;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ catch (Exception ex)
+ {
+ // Probably dwmapi.dll not found (incompatible OS)
+ return false;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/Wox/MainWindow.xaml b/Wox/MainWindow.xaml
index 701214e680..3a01414c95 100644
--- a/Wox/MainWindow.xaml
+++ b/Wox/MainWindow.xaml
@@ -9,8 +9,6 @@
WindowStyle="None"
WindowStartupLocation="Manual"
ShowInTaskbar="False"
- AllowsTransparency="True"
- Background="{x:Null}"
Style="{DynamicResource WindowStyle}"
Icon="Images\app.png"
>
diff --git a/Wox/MainWindow.xaml.cs b/Wox/MainWindow.xaml.cs
index 059658a1f0..f853f2ed0a 100644
--- a/Wox/MainWindow.xaml.cs
+++ b/Wox/MainWindow.xaml.cs
@@ -46,6 +46,7 @@ namespace Wox
InitializeComponent();
Initialized = true;
+
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
progressBar.ToolTip = toolTip;
@@ -57,9 +58,9 @@ namespace Wox
{
SetTheme(CommonStorage.Instance.UserSetting.Theme);
}
- catch (IOException)
+ catch (Exception)
{
- SetTheme(CommonStorage.Instance.UserSetting.Theme = "Default");
+ SetTheme(CommonStorage.Instance.UserSetting.Theme = "Dark");
}
SetHotkey(CommonStorage.Instance.UserSetting.Hotkey, OnHotkey);
@@ -75,6 +76,8 @@ namespace Wox
Plugins.Init();
InitProgressbarAnimation();
+ //only works for win7+
+ DwmDropShadow.DropShadowToWindow(this);
}
private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
diff --git a/Wox/Themes/Dark.xaml b/Wox/Themes/Dark.xaml
index 2ca629d0c7..4becca7ffa 100644
--- a/Wox/Themes/Dark.xaml
+++ b/Wox/Themes/Dark.xaml
@@ -9,8 +9,6 @@
diff --git a/Wox/Themes/Pink.xaml b/Wox/Themes/Pink.xaml
new file mode 100644
index 0000000000..3d9b0677d2
--- /dev/null
+++ b/Wox/Themes/Pink.xaml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ #cc1081
+
+
+
\ No newline at end of file
diff --git a/Wox/Wox.csproj b/Wox/Wox.csproj
index 6ce3c9aabc..7ceb597cf6 100644
--- a/Wox/Wox.csproj
+++ b/Wox/Wox.csproj
@@ -129,6 +129,7 @@
CustomPluginHotkeySetting.xaml
+
@@ -200,6 +201,10 @@
MSBuild:Compile
Designer
+
+ MSBuild:Compile
+ Designer
+
Designer
MSBuild:Compile