BUG-2792: Fixed the issue that PowerToys is interacting with our region selection window.

This commit is contained in:
Robin Krom 2021-06-04 01:00:55 +02:00
commit 3350120b55
No known key found for this signature in database
GPG key ID: BCC01364F1371490
3 changed files with 58 additions and 5 deletions

View file

@ -28,9 +28,44 @@ namespace Greenshot.Base.UnmanagedHelpers.Enums
[SuppressMessage("ReSharper", "InconsistentNaming")]
public enum ExtendedWindowStyleFlags : uint
{
WS_EX_TOOLWINDOW = 0x00000080,
WS_EX_DLGMODALFRAME = 0x00000001,
WS_EX_NOPARENTNOTIFY = 0x00000004,
WS_EX_TOPMOST = 0x00000008,
WS_EX_ACCEPTFILES = 0x00000010,
WS_EX_TRANSPARENT = 0x00000020,
WS_EX_NOREDIRECTIONBITMAP =
0x00200000, //The window does not render to a redirection surface. This is for windows that do not have visible content or that use mechanisms other than surfaces to provide their visual.
//#if(WINVER >= 0x0400)
WS_EX_MDICHILD = 0x00000040,
WS_EX_TOOLWINDOW = 0x00000080,
WS_EX_WINDOWEDGE = 0x00000100,
WS_EX_CLIENTEDGE = 0x00000200,
WS_EX_CONTEXTHELP = 0x00000400,
WS_EX_RIGHT = 0x00001000,
WS_EX_LEFT = 0x00000000,
WS_EX_RTLREADING = 0x00002000,
WS_EX_LTRREADING = 0x00000000,
WS_EX_LEFTSCROLLBAR = 0x00004000,
WS_EX_RIGHTSCROLLBAR = 0x00000000,
WS_EX_CONTROLPARENT = 0x00010000,
WS_EX_STATICEDGE = 0x00020000,
WS_EX_APPWINDOW = 0x00040000,
//WS_EX_OVERLAPPEDWINDOW = (WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE),
//WS_EX_PALETTEWINDOW = (WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST),
WS_EX_LAYERED = 0x00080000,
WS_EX_NOINHERITLAYOUT = 0x00100000, // Disable inheritence of mirroring by children
WS_EX_NOREDIRECTIONBITMAP = 0x00200000, //The window does not render to a redirection surface. This is for windows that do not have visible content or that use mechanisms other than surfaces to provide their visual.
WS_EX_LAYOUTRTL = 0x00400000, // Right to left mirroring
/// <summary>
/// Paints all descendants of a window in bottom-to-top painting order using double-buffering.
/// Bottom-to-top painting order allows a descendent window to have translucency (alpha) and transparency (color-key) effects, but only if the descendent window also has the WS_EX_TRANSPARENT bit set.
/// Double-buffering allows the window and its descendents to be painted without flicker.
/// This cannot be used if the window has a class style of either CS_OWNDC or CS_CLASSDC.
/// </summary>
WS_EX_COMPOSITED = 0x02000000,
WS_EX_NOACTIVATE = 0x08000000 // A top-level window created with this style does not become the foreground window when the user clicks it. The system does not bring this window to the foreground when the user minimizes or closes the foreground window.
}
}

View file

@ -29,8 +29,24 @@ namespace Greenshot.Base.UnmanagedHelpers.Enums
/// </summary>
[Flags]
[SuppressMessage("ReSharper", "InconsistentNaming")]
public enum WindowStyleFlags : long
public enum WindowStyleFlags : int
{
//WS_OVERLAPPED = 0x00000000,
WS_POPUP = -2147483648,
WS_CHILD = 0x40000000,
WS_MINIMIZE = 0x20000000,
WS_VISIBLE = 0x10000000,
WS_DISABLED = 0x08000000,
WS_CLIPSIBLINGS = 0x04000000,
WS_CLIPCHILDREN = 0x02000000,
WS_MAXIMIZE = 0x01000000,
WS_BORDER = 0x00800000,
WS_DLGFRAME = 0x00400000,
WS_VSCROLL = 0x00200000,
WS_HSCROLL = 0x00100000,
WS_SYSMENU = 0x00080000,
WS_THICKFRAME = 0x00040000,
WS_GROUP = 0x00020000,
WS_TABSTOP = 0x00010000
}
}

View file

@ -36,6 +36,7 @@ using Greenshot.Base.IniFile;
using Greenshot.Base.Interfaces;
using Greenshot.Base.Interfaces.Ocr;
using Greenshot.Base.UnmanagedHelpers;
using Greenshot.Base.UnmanagedHelpers.Enums;
using Greenshot.Editor.Helpers;
namespace Greenshot.Forms
@ -111,7 +112,8 @@ namespace Greenshot.Forms
get
{
CreateParams createParams = base.CreateParams;
createParams.ExStyle |= 0x02000000;
createParams.ExStyle |= (int)ExtendedWindowStyleFlags.WS_EX_COMPOSITED;
createParams.Style = (int)WindowStyleFlags.WS_POPUP;
return createParams;
}
}