From be93e8dd082d517ae97a6343caaaec836e48c6f2 Mon Sep 17 00:00:00 2001 From: Jaex Date: Tue, 24 Dec 2013 22:52:12 +0200 Subject: [PATCH] Topmost notification form otherwise sometimes not show up when in desktop --- ShareX/Forms/NotificationForm.Designer.cs | 6 ++++++ ShareX/Forms/NotificationForm.cs | 5 +++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ShareX/Forms/NotificationForm.Designer.cs b/ShareX/Forms/NotificationForm.Designer.cs index 99bbd268a..351b9be98 100644 --- a/ShareX/Forms/NotificationForm.Designer.cs +++ b/ShareX/Forms/NotificationForm.Designer.cs @@ -17,6 +17,12 @@ protected override void Dispose(bool disposing) { components.Dispose(); } + + if (ToastImage != null) + { + ToastImage.Dispose(); + } + base.Dispose(disposing); } diff --git a/ShareX/Forms/NotificationForm.cs b/ShareX/Forms/NotificationForm.cs index ea1274365..8e6162325 100644 --- a/ShareX/Forms/NotificationForm.cs +++ b/ShareX/Forms/NotificationForm.cs @@ -95,13 +95,15 @@ public static void Show(string imagePath, string url) Image img = ImageHelpers.LoadImage(imagePath); NotificationForm form = new NotificationForm(5000, new Size(400, 300), img, url); NativeMethods.ShowWindow(form.Handle, (int)WindowShowStyle.ShowNoActivate); - NativeMethods.SetWindowPos(form.Handle, (IntPtr)SpecialWindowHandles.HWND_TOP, 0, 0, 0, 0, + NativeMethods.SetWindowPos(form.Handle, (IntPtr)SpecialWindowHandles.HWND_TOPMOST, 0, 0, 0, 0, SetWindowPosFlags.SWP_NOMOVE | SetWindowPosFlags.SWP_NOSIZE | SetWindowPosFlags.SWP_NOACTIVATE); } } private void NotificationForm_MouseClick(object sender, MouseEventArgs e) { + tDuration.Stop(); + if (e.Button == MouseButtons.Left) { if (!string.IsNullOrEmpty(URL)) @@ -110,7 +112,6 @@ private void NotificationForm_MouseClick(object sender, MouseEventArgs e) } } - tDuration.Stop(); Close(); } }