mirror of
https://github.com/greenshot/greenshot
synced 2025-07-14 00:53:51 -07:00
BUG-1965: Fixed a bug where a 1 pixel wide border around an active window is visible. Probably due to the "shadow" being captured too.
This commit is contained in:
parent
d25021631e
commit
1469f1fa41
9 changed files with 200 additions and 179 deletions
|
@ -908,7 +908,7 @@ namespace Greenshot {
|
||||||
public void AddCaptureWindowMenuItems(ToolStripMenuItem menuItem, EventHandler eventHandler) {
|
public void AddCaptureWindowMenuItems(ToolStripMenuItem menuItem, EventHandler eventHandler) {
|
||||||
menuItem.DropDownItems.Clear();
|
menuItem.DropDownItems.Clear();
|
||||||
// check if thumbnailPreview is enabled and DWM is enabled
|
// check if thumbnailPreview is enabled and DWM is enabled
|
||||||
bool thumbnailPreview = _conf.ThumnailPreview && DWM.isDWMEnabled();
|
bool thumbnailPreview = _conf.ThumnailPreview && DWM.IsDwmEnabled();
|
||||||
|
|
||||||
List<WindowDetails> windows = WindowDetails.GetTopLevelWindows();
|
List<WindowDetails> windows = WindowDetails.GetTopLevelWindows();
|
||||||
foreach(WindowDetails window in windows) {
|
foreach(WindowDetails window in windows) {
|
||||||
|
|
|
@ -146,7 +146,7 @@ namespace Greenshot {
|
||||||
|
|
||||||
private void SetWindowCaptureMode(WindowCaptureMode selectedWindowCaptureMode) {
|
private void SetWindowCaptureMode(WindowCaptureMode selectedWindowCaptureMode) {
|
||||||
WindowCaptureMode[] availableModes;
|
WindowCaptureMode[] availableModes;
|
||||||
if (!DWM.isDWMEnabled()) {
|
if (!DWM.IsDwmEnabled()) {
|
||||||
// Remove DWM from configuration, as DWM is disabled!
|
// Remove DWM from configuration, as DWM is disabled!
|
||||||
if (coreConfiguration.WindowCaptureMode == WindowCaptureMode.Aero || coreConfiguration.WindowCaptureMode == WindowCaptureMode.AeroTransparent) {
|
if (coreConfiguration.WindowCaptureMode == WindowCaptureMode.Aero || coreConfiguration.WindowCaptureMode == WindowCaptureMode.AeroTransparent) {
|
||||||
coreConfiguration.WindowCaptureMode = WindowCaptureMode.GDI;
|
coreConfiguration.WindowCaptureMode = WindowCaptureMode.GDI;
|
||||||
|
|
|
@ -693,7 +693,10 @@ namespace Greenshot.Helpers {
|
||||||
} else {
|
} else {
|
||||||
_selectedCaptureWindow = WindowDetails.GetActiveWindow();
|
_selectedCaptureWindow = WindowDetails.GetActiveWindow();
|
||||||
if (_selectedCaptureWindow != null) {
|
if (_selectedCaptureWindow != null) {
|
||||||
LOG.DebugFormat("Capturing window: {0} with {1}", _selectedCaptureWindow.Text, _selectedCaptureWindow.WindowRectangle);
|
if (LOG.IsDebugEnabled)
|
||||||
|
{
|
||||||
|
LOG.DebugFormat("Capturing window: {0} with {1}", _selectedCaptureWindow.Text, _selectedCaptureWindow.WindowRectangle);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (_selectedCaptureWindow == null || (!presupplied && _selectedCaptureWindow.Iconic)) {
|
if (_selectedCaptureWindow == null || (!presupplied && _selectedCaptureWindow.Iconic)) {
|
||||||
|
@ -731,7 +734,6 @@ namespace Greenshot.Helpers {
|
||||||
// Trying workaround, the size 0 arrises with e.g. Toad.exe, has a different Window when minimized
|
// Trying workaround, the size 0 arrises with e.g. Toad.exe, has a different Window when minimized
|
||||||
WindowDetails linkedWindow = WindowDetails.GetLinkedWindow(windowToCapture);
|
WindowDetails linkedWindow = WindowDetails.GetLinkedWindow(windowToCapture);
|
||||||
if (linkedWindow != null) {
|
if (linkedWindow != null) {
|
||||||
windowRectangle = linkedWindow.WindowRectangle;
|
|
||||||
windowToCapture = linkedWindow;
|
windowToCapture = linkedWindow;
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
|
@ -777,7 +779,7 @@ namespace Greenshot.Helpers {
|
||||||
Rectangle windowRectangle = windowToCapture.WindowRectangle;
|
Rectangle windowRectangle = windowToCapture.WindowRectangle;
|
||||||
|
|
||||||
// When Vista & DWM (Aero) enabled
|
// When Vista & DWM (Aero) enabled
|
||||||
bool dwmEnabled = DWM.isDWMEnabled();
|
bool dwmEnabled = DWM.IsDwmEnabled();
|
||||||
// get process name to be able to exclude certain processes from certain capture modes
|
// get process name to be able to exclude certain processes from certain capture modes
|
||||||
using (Process process = windowToCapture.Process) {
|
using (Process process = windowToCapture.Process) {
|
||||||
bool isAutoMode = windowCaptureMode == WindowCaptureMode.Auto;
|
bool isAutoMode = windowCaptureMode == WindowCaptureMode.Auto;
|
||||||
|
@ -801,7 +803,7 @@ namespace Greenshot.Helpers {
|
||||||
windowCaptureMode = WindowCaptureMode.Screen;
|
windowCaptureMode = WindowCaptureMode.Screen;
|
||||||
|
|
||||||
// Change to GDI, if allowed
|
// Change to GDI, if allowed
|
||||||
if (!windowToCapture.isMetroApp && WindowCapture.IsGdiAllowed(process)) {
|
if (!windowToCapture.IsMetroApp && WindowCapture.IsGdiAllowed(process)) {
|
||||||
if (!dwmEnabled && isWPF(process)) {
|
if (!dwmEnabled && isWPF(process)) {
|
||||||
// do not use GDI, as DWM is not enabled and the application uses PresentationFramework.dll -> isWPF
|
// do not use GDI, as DWM is not enabled and the application uses PresentationFramework.dll -> isWPF
|
||||||
LOG.InfoFormat("Not using GDI for windows of process {0}, as the process uses WPF", process.ProcessName);
|
LOG.InfoFormat("Not using GDI for windows of process {0}, as the process uses WPF", process.ProcessName);
|
||||||
|
@ -812,12 +814,12 @@ namespace Greenshot.Helpers {
|
||||||
|
|
||||||
// Change to DWM, if enabled and allowed
|
// Change to DWM, if enabled and allowed
|
||||||
if (dwmEnabled) {
|
if (dwmEnabled) {
|
||||||
if (windowToCapture.isMetroApp || WindowCapture.IsDwmAllowed(process)) {
|
if (windowToCapture.IsMetroApp || WindowCapture.IsDwmAllowed(process)) {
|
||||||
windowCaptureMode = WindowCaptureMode.Aero;
|
windowCaptureMode = WindowCaptureMode.Aero;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (windowCaptureMode == WindowCaptureMode.Aero || windowCaptureMode == WindowCaptureMode.AeroTransparent) {
|
} else if (windowCaptureMode == WindowCaptureMode.Aero || windowCaptureMode == WindowCaptureMode.AeroTransparent) {
|
||||||
if (!dwmEnabled || (!windowToCapture.isMetroApp && !WindowCapture.IsDwmAllowed(process))) {
|
if (!dwmEnabled || (!windowToCapture.IsMetroApp && !WindowCapture.IsDwmAllowed(process))) {
|
||||||
// Take default screen
|
// Take default screen
|
||||||
windowCaptureMode = WindowCaptureMode.Screen;
|
windowCaptureMode = WindowCaptureMode.Screen;
|
||||||
// Change to GDI, if allowed
|
// Change to GDI, if allowed
|
||||||
|
@ -845,32 +847,32 @@ namespace Greenshot.Helpers {
|
||||||
} else {
|
} else {
|
||||||
windowToCapture.ToForeground();
|
windowToCapture.ToForeground();
|
||||||
}
|
}
|
||||||
tmpCapture = windowToCapture.CaptureGDIWindow(captureForWindow);
|
tmpCapture = windowToCapture.CaptureGdiWindow(captureForWindow);
|
||||||
if (tmpCapture != null) {
|
if (tmpCapture != null) {
|
||||||
// check if GDI capture any good, by comparing it with the screen content
|
// check if GDI capture any good, by comparing it with the screen content
|
||||||
int blackCountGDI = ImageHelper.CountColor(tmpCapture.Image, Color.Black, false);
|
int blackCountGdi = ImageHelper.CountColor(tmpCapture.Image, Color.Black, false);
|
||||||
int GDIPixels = tmpCapture.Image.Width * tmpCapture.Image.Height;
|
int gdiPixels = tmpCapture.Image.Width * tmpCapture.Image.Height;
|
||||||
int blackPercentageGDI = blackCountGDI * 100 / GDIPixels;
|
int blackPercentageGdi = blackCountGdi * 100 / gdiPixels;
|
||||||
if (blackPercentageGDI >= 1) {
|
if (blackPercentageGdi >= 1) {
|
||||||
int screenPixels = windowRectangle.Width * windowRectangle.Height;
|
int screenPixels = windowRectangle.Width * windowRectangle.Height;
|
||||||
using (ICapture screenCapture = new Capture()) {
|
using (ICapture screenCapture = new Capture()) {
|
||||||
screenCapture.CaptureDetails = captureForWindow.CaptureDetails;
|
screenCapture.CaptureDetails = captureForWindow.CaptureDetails;
|
||||||
if (WindowCapture.CaptureRectangleFromDesktopScreen(screenCapture, windowRectangle) != null) {
|
if (WindowCapture.CaptureRectangleFromDesktopScreen(screenCapture, windowRectangle) != null) {
|
||||||
int blackCountScreen = ImageHelper.CountColor(screenCapture.Image, Color.Black, false);
|
int blackCountScreen = ImageHelper.CountColor(screenCapture.Image, Color.Black, false);
|
||||||
int blackPercentageScreen = blackCountScreen * 100 / screenPixels;
|
int blackPercentageScreen = blackCountScreen * 100 / screenPixels;
|
||||||
if (screenPixels == GDIPixels) {
|
if (screenPixels == gdiPixels) {
|
||||||
// "easy compare", both have the same size
|
// "easy compare", both have the same size
|
||||||
// If GDI has more black, use the screen capture.
|
// If GDI has more black, use the screen capture.
|
||||||
if (blackPercentageGDI > blackPercentageScreen) {
|
if (blackPercentageGdi > blackPercentageScreen) {
|
||||||
LOG.Debug("Using screen capture, as GDI had additional black.");
|
LOG.Debug("Using screen capture, as GDI had additional black.");
|
||||||
// changeing the image will automatically dispose the previous
|
// changeing the image will automatically dispose the previous
|
||||||
tmpCapture.Image = screenCapture.Image;
|
tmpCapture.Image = screenCapture.Image;
|
||||||
// Make sure it's not disposed, else the picture is gone!
|
// Make sure it's not disposed, else the picture is gone!
|
||||||
screenCapture.NullImage();
|
screenCapture.NullImage();
|
||||||
}
|
}
|
||||||
} else if (screenPixels < GDIPixels) {
|
} else if (screenPixels < gdiPixels) {
|
||||||
// Screen capture is cropped, window is outside of screen
|
// Screen capture is cropped, window is outside of screen
|
||||||
if (blackPercentageGDI > 50 && blackPercentageGDI > blackPercentageScreen) {
|
if (blackPercentageGdi > 50 && blackPercentageGdi > blackPercentageScreen) {
|
||||||
LOG.Debug("Using screen capture, as GDI had additional black.");
|
LOG.Debug("Using screen capture, as GDI had additional black.");
|
||||||
// changeing the image will automatically dispose the previous
|
// changeing the image will automatically dispose the previous
|
||||||
tmpCapture.Image = screenCapture.Image;
|
tmpCapture.Image = screenCapture.Image;
|
||||||
|
@ -896,8 +898,8 @@ namespace Greenshot.Helpers {
|
||||||
break;
|
break;
|
||||||
case WindowCaptureMode.Aero:
|
case WindowCaptureMode.Aero:
|
||||||
case WindowCaptureMode.AeroTransparent:
|
case WindowCaptureMode.AeroTransparent:
|
||||||
if (windowToCapture.isMetroApp || WindowCapture.IsDwmAllowed(process)) {
|
if (windowToCapture.IsMetroApp || WindowCapture.IsDwmAllowed(process)) {
|
||||||
tmpCapture = windowToCapture.CaptureDWMWindow(captureForWindow, windowCaptureMode, isAutoMode);
|
tmpCapture = windowToCapture.CaptureDwmWindow(captureForWindow, windowCaptureMode, isAutoMode);
|
||||||
}
|
}
|
||||||
if (tmpCapture != null) {
|
if (tmpCapture != null) {
|
||||||
captureForWindow = tmpCapture;
|
captureForWindow = tmpCapture;
|
||||||
|
|
|
@ -35,6 +35,7 @@ This version has changes, compared to 1.2.8.12, for the following reported ticke
|
||||||
* BUG-1941: Error when creating speech bubble|
|
* BUG-1941: Error when creating speech bubble|
|
||||||
* BUG-1945: Failure starting Greenshot at system startup|
|
* BUG-1945: Failure starting Greenshot at system startup|
|
||||||
* BUG-1949: Can't delete Imgur upload
|
* BUG-1949: Can't delete Imgur upload
|
||||||
|
* BUG-1965: Activation border around window is visible in the capture
|
||||||
* FEATURE-945: Added environment variables to the external command
|
* FEATURE-945: Added environment variables to the external command
|
||||||
|
|
||||||
Testing is not finished, use at your own risk...
|
Testing is not finished, use at your own risk...
|
||||||
|
|
|
@ -77,10 +77,10 @@ namespace GreenshotPlugin.Controls {
|
||||||
SIZE sourceSize;
|
SIZE sourceSize;
|
||||||
DWM.DwmQueryThumbnailSourceSize(_thumbnailHandle, out sourceSize);
|
DWM.DwmQueryThumbnailSourceSize(_thumbnailHandle, out sourceSize);
|
||||||
int thumbnailHeight = 200;
|
int thumbnailHeight = 200;
|
||||||
int thumbnailWidth = (int)(thumbnailHeight * ((float)sourceSize.width / (float)sourceSize.height));
|
int thumbnailWidth = (int)(thumbnailHeight * ((float)sourceSize.Width / (float)sourceSize.Height));
|
||||||
if (parentControl != null && thumbnailWidth > parentControl.Width) {
|
if (parentControl != null && thumbnailWidth > parentControl.Width) {
|
||||||
thumbnailWidth = parentControl.Width;
|
thumbnailWidth = parentControl.Width;
|
||||||
thumbnailHeight = (int)(thumbnailWidth * ((float)sourceSize.height / (float)sourceSize.width));
|
thumbnailHeight = (int)(thumbnailWidth * ((float)sourceSize.Height / (float)sourceSize.Width));
|
||||||
}
|
}
|
||||||
Width = thumbnailWidth;
|
Width = thumbnailWidth;
|
||||||
Height = thumbnailHeight;
|
Height = thumbnailHeight;
|
||||||
|
|
|
@ -26,6 +26,7 @@ using GreenshotPlugin.UnmanagedHelpers;
|
||||||
using log4net;
|
using log4net;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Drawing.Imaging;
|
using System.Drawing.Imaging;
|
||||||
|
@ -34,12 +35,6 @@ using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Code for handling with "windows"
|
|
||||||
/// Main code is taken from vbAccelerator, location:
|
|
||||||
/// http://www.vbaccelerator.com/home/NET/Code/Libraries/Windows/Enumerating_Windows/article.asp
|
|
||||||
/// but a LOT of changes/enhancements were made to adapt it for Greenshot.
|
|
||||||
/// </summary>
|
|
||||||
namespace GreenshotPlugin.Core {
|
namespace GreenshotPlugin.Core {
|
||||||
#region EnumWindows
|
#region EnumWindows
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -139,7 +134,7 @@ namespace GreenshotPlugin.Core {
|
||||||
/// <param name="hWnd">Window handle to add</param>
|
/// <param name="hWnd">Window handle to add</param>
|
||||||
/// <returns>True to continue enumeration, False to stop</returns>
|
/// <returns>True to continue enumeration, False to stop</returns>
|
||||||
protected virtual bool OnWindowEnum(IntPtr hWnd) {
|
protected virtual bool OnWindowEnum(IntPtr hWnd) {
|
||||||
if (!WindowDetails.isIgnoreHandle(hWnd)) {
|
if (!WindowDetails.IsIgnoreHandle(hWnd)) {
|
||||||
items.Add(new WindowDetails(hWnd));
|
items.Add(new WindowDetails(hWnd));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -150,12 +145,16 @@ namespace GreenshotPlugin.Core {
|
||||||
// nothing to do
|
// nothing to do
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
#endregion EnumWindows
|
#endregion EnumWindows
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
#region WindowDetails
|
#region WindowDetails
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// Code for handling with "windows"
|
||||||
|
/// Main code is taken from vbAccelerator, location:
|
||||||
|
/// http://www.vbaccelerator.com/home/NET/Code/Libraries/Windows/Enumerating_Windows/article.asp
|
||||||
|
/// but a LOT of changes/enhancements were made to adapt it for Greenshot.
|
||||||
|
/// <summary>
|
||||||
/// Provides details about a Window returned by the
|
/// Provides details about a Window returned by the
|
||||||
/// enumeration
|
/// enumeration
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -165,9 +164,9 @@ namespace GreenshotPlugin.Core {
|
||||||
private const string METRO_GUTTER_CLASS = "ImmersiveGutter";
|
private const string METRO_GUTTER_CLASS = "ImmersiveGutter";
|
||||||
|
|
||||||
private static readonly ILog LOG = LogManager.GetLogger(typeof(WindowDetails));
|
private static readonly ILog LOG = LogManager.GetLogger(typeof(WindowDetails));
|
||||||
private static readonly CoreConfiguration conf = IniConfig.GetIniSection<CoreConfiguration>();
|
private static readonly CoreConfiguration Conf = IniConfig.GetIniSection<CoreConfiguration>();
|
||||||
private static readonly List<IntPtr> ignoreHandles = new List<IntPtr>();
|
private static readonly List<IntPtr> IgnoreHandles = new List<IntPtr>();
|
||||||
private static readonly List<string> excludeProcessesFromFreeze = new List<string>();
|
private static readonly List<string> ExcludeProcessesFromFreeze = new List<string>();
|
||||||
private static readonly IAppVisibility appVisibility;
|
private static readonly IAppVisibility appVisibility;
|
||||||
|
|
||||||
static WindowDetails() {
|
static WindowDetails() {
|
||||||
|
@ -180,33 +179,33 @@ namespace GreenshotPlugin.Core {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AddProcessToExcludeFromFreeze(string processname) {
|
public static void AddProcessToExcludeFromFreeze(string processname) {
|
||||||
if (!excludeProcessesFromFreeze.Contains(processname)) {
|
if (!ExcludeProcessesFromFreeze.Contains(processname)) {
|
||||||
excludeProcessesFromFreeze.Add(processname);
|
ExcludeProcessesFromFreeze.Add(processname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static bool isIgnoreHandle(IntPtr handle) {
|
internal static bool IsIgnoreHandle(IntPtr handle) {
|
||||||
return ignoreHandles.Contains(handle);
|
return IgnoreHandles.Contains(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<WindowDetails> childWindows;
|
private List<WindowDetails> _childWindows;
|
||||||
private IntPtr parentHandle = IntPtr.Zero;
|
private IntPtr _parentHandle = IntPtr.Zero;
|
||||||
private WindowDetails parent;
|
private WindowDetails _parent;
|
||||||
private bool frozen;
|
private bool _frozen;
|
||||||
|
|
||||||
public bool isApp {
|
public bool IsApp {
|
||||||
get {
|
get {
|
||||||
return METRO_WINDOWS_CLASS.Equals(ClassName);
|
return METRO_WINDOWS_CLASS.Equals(ClassName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool isGutter {
|
public bool IsGutter {
|
||||||
get {
|
get {
|
||||||
return METRO_GUTTER_CLASS.Equals(ClassName);
|
return METRO_GUTTER_CLASS.Equals(ClassName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool isAppLauncher {
|
public bool IsAppLauncher {
|
||||||
get {
|
get {
|
||||||
return METRO_APPLAUNCHER_CLASS.Equals(ClassName);
|
return METRO_APPLAUNCHER_CLASS.Equals(ClassName);
|
||||||
}
|
}
|
||||||
|
@ -215,16 +214,16 @@ namespace GreenshotPlugin.Core {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Check if this window is the window of a metro app
|
/// Check if this window is the window of a metro app
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool isMetroApp {
|
public bool IsMetroApp {
|
||||||
get {
|
get {
|
||||||
return isAppLauncher || isApp;
|
return IsAppLauncher || IsApp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The window handle.
|
/// The window handle.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly IntPtr hWnd = IntPtr.Zero;
|
private readonly IntPtr _hWnd = IntPtr.Zero;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// To allow items to be compared, the hash code
|
/// To allow items to be compared, the hash code
|
||||||
|
@ -257,15 +256,15 @@ namespace GreenshotPlugin.Core {
|
||||||
|
|
||||||
public bool HasChildren {
|
public bool HasChildren {
|
||||||
get {
|
get {
|
||||||
return (childWindows != null) && (childWindows.Count > 0);
|
return (_childWindows != null) && (_childWindows.Count > 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void FreezeDetails() {
|
public void FreezeDetails() {
|
||||||
frozen = true;
|
_frozen = true;
|
||||||
}
|
}
|
||||||
public void UnfreezeDetails() {
|
public void UnfreezeDetails() {
|
||||||
frozen = false;
|
_frozen = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string ProcessPath {
|
public string ProcessPath {
|
||||||
|
@ -297,7 +296,7 @@ namespace GreenshotPlugin.Core {
|
||||||
LOG.WarnFormat("Couldn't get icon for window {0} due to: {1}", Text, ex.Message);
|
LOG.WarnFormat("Couldn't get icon for window {0} due to: {1}", Text, ex.Message);
|
||||||
LOG.Warn(ex);
|
LOG.Warn(ex);
|
||||||
}
|
}
|
||||||
if (isMetroApp) {
|
if (IsMetroApp) {
|
||||||
// No method yet to get the metro icon
|
// No method yet to get the metro icon
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -321,8 +320,8 @@ namespace GreenshotPlugin.Core {
|
||||||
IntPtr ICON_BIG = new IntPtr(1);
|
IntPtr ICON_BIG = new IntPtr(1);
|
||||||
IntPtr ICON_SMALL2 = new IntPtr(2);
|
IntPtr ICON_SMALL2 = new IntPtr(2);
|
||||||
|
|
||||||
IntPtr iconHandle = User32.SendMessage(hwnd, (int)WindowsMessages.WM_GETICON, ICON_BIG, IntPtr.Zero);
|
IntPtr iconHandle;
|
||||||
if (conf.UseLargeIcons) {
|
if (Conf.UseLargeIcons) {
|
||||||
iconHandle = User32.SendMessage(hwnd, (int)WindowsMessages.WM_GETICON, ICON_BIG, IntPtr.Zero);
|
iconHandle = User32.SendMessage(hwnd, (int)WindowsMessages.WM_GETICON, ICON_BIG, IntPtr.Zero);
|
||||||
if (iconHandle == IntPtr.Zero) {
|
if (iconHandle == IntPtr.Zero) {
|
||||||
iconHandle = User32.GetClassLongWrapper(hwnd, (int)ClassLongIndex.GCL_HICON);
|
iconHandle = User32.GetClassLongWrapper(hwnd, (int)ClassLongIndex.GCL_HICON);
|
||||||
|
@ -357,7 +356,7 @@ namespace GreenshotPlugin.Core {
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ignoreHandle"></param>
|
/// <param name="ignoreHandle"></param>
|
||||||
public static void RegisterIgnoreHandle(IntPtr ignoreHandle) {
|
public static void RegisterIgnoreHandle(IntPtr ignoreHandle) {
|
||||||
ignoreHandles.Add(ignoreHandle);
|
IgnoreHandles.Add(ignoreHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -365,24 +364,25 @@ namespace GreenshotPlugin.Core {
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ignoreHandle"></param>
|
/// <param name="ignoreHandle"></param>
|
||||||
public static void UnregisterIgnoreHandle(IntPtr ignoreHandle) {
|
public static void UnregisterIgnoreHandle(IntPtr ignoreHandle) {
|
||||||
ignoreHandles.Remove(ignoreHandle);
|
IgnoreHandles.Remove(ignoreHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<WindowDetails> Children {
|
public List<WindowDetails> Children {
|
||||||
get {
|
get {
|
||||||
if (childWindows == null) {
|
if (_childWindows == null) {
|
||||||
GetChildren();
|
GetChildren();
|
||||||
}
|
}
|
||||||
return childWindows;
|
return _childWindows;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Retrieve all windows with a certain title or classname
|
/// Retrieve all windows with a certain title or classname
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="windows"></param>
|
||||||
/// <param name="titlePattern">The regexp to look for in the title</param>
|
/// <param name="titlePattern">The regexp to look for in the title</param>
|
||||||
/// <param name="classnamePattern">The regexp to look for in the classname</param>
|
/// <param name="classnamePattern">The regexp to look for in the classname</param>
|
||||||
/// <returns>List<WindowDetails> with all the found windows</returns>
|
/// <returns>List WindowDetails with all the found windows</returns>
|
||||||
private static List<WindowDetails> FindWindow(List<WindowDetails> windows, string titlePattern, string classnamePattern) {
|
private static List<WindowDetails> FindWindow(List<WindowDetails> windows, string titlePattern, string classnamePattern) {
|
||||||
List<WindowDetails> foundWindows = new List<WindowDetails>();
|
List<WindowDetails> foundWindows = new List<WindowDetails>();
|
||||||
Regex titleRegexp = null;
|
Regex titleRegexp = null;
|
||||||
|
@ -430,16 +430,16 @@ namespace GreenshotPlugin.Core {
|
||||||
|
|
||||||
public IntPtr ParentHandle {
|
public IntPtr ParentHandle {
|
||||||
get {
|
get {
|
||||||
if (parentHandle == IntPtr.Zero) {
|
if (_parentHandle == IntPtr.Zero) {
|
||||||
parentHandle = User32.GetParent(Handle);
|
_parentHandle = User32.GetParent(Handle);
|
||||||
parent = null;
|
_parent = null;
|
||||||
}
|
}
|
||||||
return parentHandle;
|
return _parentHandle;
|
||||||
}
|
}
|
||||||
set {
|
set {
|
||||||
if (parentHandle != value) {
|
if (_parentHandle != value) {
|
||||||
parentHandle = value;
|
_parentHandle = value;
|
||||||
parent = null;
|
_parent = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -448,15 +448,15 @@ namespace GreenshotPlugin.Core {
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>WindowDetails of the parent, or null if none</returns>
|
/// <returns>WindowDetails of the parent, or null if none</returns>
|
||||||
public WindowDetails GetParent() {
|
public WindowDetails GetParent() {
|
||||||
if (parent == null) {
|
if (_parent == null) {
|
||||||
if (parentHandle == IntPtr.Zero) {
|
if (_parentHandle == IntPtr.Zero) {
|
||||||
parentHandle = User32.GetParent(Handle);
|
_parentHandle = User32.GetParent(Handle);
|
||||||
}
|
}
|
||||||
if (parentHandle != IntPtr.Zero) {
|
if (_parentHandle != IntPtr.Zero) {
|
||||||
parent = new WindowDetails(parentHandle);
|
_parent = new WindowDetails(_parentHandle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return parent;
|
return _parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -464,10 +464,10 @@ namespace GreenshotPlugin.Core {
|
||||||
/// One should normally use the getter "Children"
|
/// One should normally use the getter "Children"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<WindowDetails> GetChildren() {
|
public List<WindowDetails> GetChildren() {
|
||||||
if (childWindows == null) {
|
if (_childWindows == null) {
|
||||||
return GetChildren(0);
|
return GetChildren(0);
|
||||||
}
|
}
|
||||||
return childWindows;
|
return _childWindows;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -475,16 +475,16 @@ namespace GreenshotPlugin.Core {
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="levelsToGo">Specify how many levels we go in</param>
|
/// <param name="levelsToGo">Specify how many levels we go in</param>
|
||||||
public List<WindowDetails> GetChildren(int levelsToGo) {
|
public List<WindowDetails> GetChildren(int levelsToGo) {
|
||||||
if (childWindows == null) {
|
if (_childWindows == null) {
|
||||||
childWindows = new List<WindowDetails>();
|
_childWindows = new List<WindowDetails>();
|
||||||
foreach(WindowDetails childWindow in new WindowsEnumerator().GetWindows(hWnd, null).Items) {
|
foreach(WindowDetails childWindow in new WindowsEnumerator().GetWindows(_hWnd, null).Items) {
|
||||||
childWindows.Add(childWindow);
|
_childWindows.Add(childWindow);
|
||||||
if (levelsToGo > 0) {
|
if (levelsToGo > 0) {
|
||||||
childWindow.GetChildren(levelsToGo-1);
|
childWindow.GetChildren(levelsToGo-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return childWindows;
|
return _childWindows;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -492,7 +492,7 @@ namespace GreenshotPlugin.Core {
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="titlePattern">The regexp to look for in the title</param>
|
/// <param name="titlePattern">The regexp to look for in the title</param>
|
||||||
/// <param name="classnamePattern">The regexp to look for in the classname</param>
|
/// <param name="classnamePattern">The regexp to look for in the classname</param>
|
||||||
/// <returns>List<WindowDetails> with all the found windows, or an empty list</returns>
|
/// <returns>List WindowDetails with all the found windows, or an empty list</returns>
|
||||||
public List<WindowDetails> FindChildren(string titlePattern, string classnamePattern) {
|
public List<WindowDetails> FindChildren(string titlePattern, string classnamePattern) {
|
||||||
return FindWindow(Children, titlePattern, classnamePattern);
|
return FindWindow(Children, titlePattern, classnamePattern);
|
||||||
}
|
}
|
||||||
|
@ -500,7 +500,7 @@ namespace GreenshotPlugin.Core {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Recursing helper method for the FindPath
|
/// Recursing helper method for the FindPath
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="classnames">List<string> with classnames</param>
|
/// <param name="classnames">List string with classnames</param>
|
||||||
/// <param name="index">The index in the list to look for</param>
|
/// <param name="index">The index in the list to look for</param>
|
||||||
/// <returns>WindowDetails if a match was found</returns>
|
/// <returns>WindowDetails if a match was found</returns>
|
||||||
private WindowDetails FindPath(List<string> classnames, int index) {
|
private WindowDetails FindPath(List<string> classnames, int index) {
|
||||||
|
@ -542,6 +542,7 @@ namespace GreenshotPlugin.Core {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Deep scan for a certain classname pattern
|
/// Deep scan for a certain classname pattern
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="windowDetails">Window to scan into</param>
|
||||||
/// <param name="classnamePattern">Classname regexp pattern</param>
|
/// <param name="classnamePattern">Classname regexp pattern</param>
|
||||||
/// <returns>The first WindowDetails found</returns>
|
/// <returns>The first WindowDetails found</returns>
|
||||||
public static WindowDetails DeepScan(WindowDetails windowDetails, Regex classnamePattern) {
|
public static WindowDetails DeepScan(WindowDetails windowDetails, Regex classnamePattern) {
|
||||||
|
@ -575,7 +576,7 @@ namespace GreenshotPlugin.Core {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
WindowDetails windowDetails = new WindowDetails(tmphWnd);
|
WindowDetails windowDetails = new WindowDetails(tmphWnd);
|
||||||
windowDetails.parent = this;
|
windowDetails._parent = this;
|
||||||
return windowDetails;
|
return windowDetails;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -584,38 +585,38 @@ namespace GreenshotPlugin.Core {
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IntPtr Handle {
|
public IntPtr Handle {
|
||||||
get {
|
get {
|
||||||
return hWnd;
|
return _hWnd;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private string text;
|
private string _text;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the window's title (caption)
|
/// Gets the window's title (caption)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Text {
|
public string Text {
|
||||||
set {
|
set {
|
||||||
text = value;
|
_text = value;
|
||||||
}
|
}
|
||||||
get {
|
get {
|
||||||
if (text == null) {
|
if (_text == null) {
|
||||||
StringBuilder title = new StringBuilder(260, 260);
|
StringBuilder title = new StringBuilder(260, 260);
|
||||||
User32.GetWindowText(hWnd, title, title.Capacity);
|
User32.GetWindowText(_hWnd, title, title.Capacity);
|
||||||
text = title.ToString();
|
_text = title.ToString();
|
||||||
}
|
}
|
||||||
return text;
|
return _text;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private string className;
|
private string _className;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the window's class name.
|
/// Gets the window's class name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string ClassName {
|
public string ClassName {
|
||||||
get {
|
get {
|
||||||
if (className == null) {
|
if (_className == null) {
|
||||||
className = GetClassName(hWnd);
|
_className = GetClassName(_hWnd);
|
||||||
}
|
}
|
||||||
return className;
|
return _className;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -624,16 +625,16 @@ namespace GreenshotPlugin.Core {
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool Iconic {
|
public bool Iconic {
|
||||||
get {
|
get {
|
||||||
if (isMetroApp) {
|
if (IsMetroApp) {
|
||||||
return !Visible;
|
return !Visible;
|
||||||
}
|
}
|
||||||
return User32.IsIconic(hWnd) || Location.X <= -32000;
|
return User32.IsIconic(_hWnd) || Location.X <= -32000;
|
||||||
}
|
}
|
||||||
set {
|
set {
|
||||||
if (value) {
|
if (value) {
|
||||||
User32.SendMessage(hWnd, (int)WindowsMessages.WM_SYSCOMMAND, (IntPtr)User32.SC_MINIMIZE, IntPtr.Zero);
|
User32.SendMessage(_hWnd, (int)WindowsMessages.WM_SYSCOMMAND, (IntPtr)User32.SC_MINIMIZE, IntPtr.Zero);
|
||||||
} else {
|
} else {
|
||||||
User32.SendMessage(hWnd, (int)WindowsMessages.WM_SYSCOMMAND, (IntPtr)User32.SC_RESTORE, IntPtr.Zero);
|
User32.SendMessage(_hWnd, (int)WindowsMessages.WM_SYSCOMMAND, (IntPtr)User32.SC_RESTORE, IntPtr.Zero);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -643,7 +644,7 @@ namespace GreenshotPlugin.Core {
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool Maximised {
|
public bool Maximised {
|
||||||
get {
|
get {
|
||||||
if (isApp) {
|
if (IsApp) {
|
||||||
if (Visible) {
|
if (Visible) {
|
||||||
Rectangle windowRectangle = WindowRectangle;
|
Rectangle windowRectangle = WindowRectangle;
|
||||||
foreach (Screen screen in Screen.AllScreens) {
|
foreach (Screen screen in Screen.AllScreens) {
|
||||||
|
@ -656,13 +657,13 @@ namespace GreenshotPlugin.Core {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return User32.IsZoomed(hWnd);
|
return User32.IsZoomed(_hWnd);
|
||||||
}
|
}
|
||||||
set {
|
set {
|
||||||
if (value) {
|
if (value) {
|
||||||
User32.SendMessage(hWnd, (int)WindowsMessages.WM_SYSCOMMAND, (IntPtr)User32.SC_MAXIMIZE, IntPtr.Zero);
|
User32.SendMessage(_hWnd, (int)WindowsMessages.WM_SYSCOMMAND, (IntPtr)User32.SC_MAXIMIZE, IntPtr.Zero);
|
||||||
} else {
|
} else {
|
||||||
User32.SendMessage(hWnd, (int)WindowsMessages.WM_SYSCOMMAND, (IntPtr)User32.SC_MINIMIZE, IntPtr.Zero);
|
User32.SendMessage(_hWnd, (int)WindowsMessages.WM_SYSCOMMAND, (IntPtr)User32.SC_MINIMIZE, IntPtr.Zero);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -679,7 +680,7 @@ namespace GreenshotPlugin.Core {
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool Visible {
|
public bool Visible {
|
||||||
get {
|
get {
|
||||||
if (isApp) {
|
if (IsApp) {
|
||||||
Rectangle windowRectangle = WindowRectangle;
|
Rectangle windowRectangle = WindowRectangle;
|
||||||
foreach (Screen screen in Screen.AllScreens) {
|
foreach (Screen screen in Screen.AllScreens) {
|
||||||
if (screen.Bounds.Contains(windowRectangle)) {
|
if (screen.Bounds.Contains(windowRectangle)) {
|
||||||
|
@ -705,21 +706,21 @@ namespace GreenshotPlugin.Core {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (isGutter) {
|
if (IsGutter) {
|
||||||
// gutter is only made available when it's visible
|
// gutter is only made available when it's visible
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (isAppLauncher) {
|
if (IsAppLauncher) {
|
||||||
return IsAppLauncherVisible;
|
return IsAppLauncherVisible;
|
||||||
}
|
}
|
||||||
return User32.IsWindowVisible(hWnd);
|
return User32.IsWindowVisible(_hWnd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool HasParent {
|
public bool HasParent {
|
||||||
get {
|
get {
|
||||||
GetParent();
|
GetParent();
|
||||||
return parentHandle != IntPtr.Zero;
|
return _parentHandle != IntPtr.Zero;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -751,12 +752,12 @@ namespace GreenshotPlugin.Core {
|
||||||
/// Make sure the next call of a cached value is guaranteed the real value
|
/// Make sure the next call of a cached value is guaranteed the real value
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Reset() {
|
public void Reset() {
|
||||||
previousWindowRectangle = Rectangle.Empty;
|
_previousWindowRectangle = Rectangle.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Rectangle previousWindowRectangle = Rectangle.Empty;
|
private Rectangle _previousWindowRectangle = Rectangle.Empty;
|
||||||
private long lastWindowRectangleRetrieveTime;
|
private long _lastWindowRectangleRetrieveTime;
|
||||||
private const long CACHE_TIME = TimeSpan.TicksPerSecond * 2;
|
private const long CacheTime = TimeSpan.TicksPerSecond * 2;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the bounding rectangle of the window
|
/// Gets the bounding rectangle of the window
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -764,39 +765,48 @@ namespace GreenshotPlugin.Core {
|
||||||
get {
|
get {
|
||||||
// Try to return a cached value
|
// Try to return a cached value
|
||||||
long now = DateTime.Now.Ticks;
|
long now = DateTime.Now.Ticks;
|
||||||
if (previousWindowRectangle.IsEmpty || !frozen) {
|
if (_previousWindowRectangle.IsEmpty || !_frozen) {
|
||||||
if (previousWindowRectangle.IsEmpty || now - lastWindowRectangleRetrieveTime > CACHE_TIME) {
|
if (_previousWindowRectangle.IsEmpty || now - _lastWindowRectangleRetrieveTime > CacheTime) {
|
||||||
Rectangle windowRect = Rectangle.Empty;
|
Rectangle windowRect = Rectangle.Empty;
|
||||||
if (DWM.isDWMEnabled()) {
|
if (DWM.IsDwmEnabled() && !Maximised) {
|
||||||
if (GetExtendedFrameBounds(out windowRect) && Environment.OSVersion.IsWindows10())
|
if (GetExtendedFrameBounds(out windowRect) && Environment.OSVersion.IsWindows10())
|
||||||
{
|
{
|
||||||
lastWindowRectangleRetrieveTime = now;
|
_lastWindowRectangleRetrieveTime = now;
|
||||||
previousWindowRectangle = windowRect;
|
// Somehow DWM doesn't calculate it corectly, there is a 1 pixel border around the capture
|
||||||
// DWM does it corectly, just return the window rectangle we just gotten.
|
// Remove this border, currently it's fixed but TODO: Make it depend on the OS?
|
||||||
|
windowRect.Inflate(-1, -1);
|
||||||
|
_previousWindowRectangle = windowRect;
|
||||||
return windowRect;
|
return windowRect;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (windowRect.IsEmpty) {
|
if (windowRect.IsEmpty) {
|
||||||
GetWindowRect(out windowRect);
|
if (GetWindowRect(out windowRect))
|
||||||
|
{
|
||||||
|
Win32Error error = Win32.GetLastErrorCode();
|
||||||
|
LOG.WarnFormat("Couldn't retrieve the windows rectangle: {0}", Win32.GetMessage(error));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Correction for maximized windows, only if it's not an app
|
// Correction for maximized windows, only if it's not an app
|
||||||
if (!HasParent && !isApp && Maximised) {
|
if (!HasParent && !IsApp && Maximised) {
|
||||||
Size size = Size.Empty;
|
Size size;
|
||||||
GetBorderSize(out size);
|
// Only if the border size can be retrieved
|
||||||
windowRect = new Rectangle(windowRect.X + size.Width, windowRect.Y + size.Height, windowRect.Width - (2 * size.Width), windowRect.Height - (2 * size.Height));
|
if (GetBorderSize(out size))
|
||||||
|
{
|
||||||
|
windowRect = new Rectangle(windowRect.X + size.Width, windowRect.Y + size.Height, windowRect.Width - (2 * size.Width), windowRect.Height - (2 * size.Height));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
lastWindowRectangleRetrieveTime = now;
|
_lastWindowRectangleRetrieveTime = now;
|
||||||
// Try to return something valid, by getting returning the previous size if the window doesn't have a Rectangle anymore
|
// Try to return something valid, by getting returning the previous size if the window doesn't have a Rectangle anymore
|
||||||
if (windowRect.IsEmpty) {
|
if (windowRect.IsEmpty) {
|
||||||
return previousWindowRectangle;
|
return _previousWindowRectangle;
|
||||||
}
|
}
|
||||||
previousWindowRectangle = windowRect;
|
_previousWindowRectangle = windowRect;
|
||||||
return windowRect;
|
return windowRect;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return previousWindowRectangle;
|
return _previousWindowRectangle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -825,8 +835,12 @@ namespace GreenshotPlugin.Core {
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Rectangle ClientRectangle {
|
public Rectangle ClientRectangle {
|
||||||
get {
|
get {
|
||||||
Rectangle clientRect = Rectangle.Empty;
|
Rectangle clientRect;
|
||||||
GetClientRect(out clientRect);
|
if (GetClientRect(out clientRect))
|
||||||
|
{
|
||||||
|
Win32Error error = Win32.GetLastErrorCode();
|
||||||
|
LOG.WarnFormat("Couldn't retrieve the client rectangle: {0}", Win32.GetMessage(error));
|
||||||
|
}
|
||||||
return clientRect;
|
return clientRect;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -846,10 +860,10 @@ namespace GreenshotPlugin.Core {
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Restore() {
|
public void Restore() {
|
||||||
if (Iconic) {
|
if (Iconic) {
|
||||||
User32.SendMessage(hWnd, (int)WindowsMessages.WM_SYSCOMMAND, (IntPtr)User32.SC_RESTORE, IntPtr.Zero);
|
User32.SendMessage(_hWnd, (int)WindowsMessages.WM_SYSCOMMAND, (IntPtr)User32.SC_RESTORE, IntPtr.Zero);
|
||||||
}
|
}
|
||||||
User32.BringWindowToTop(hWnd);
|
User32.BringWindowToTop(_hWnd);
|
||||||
User32.SetForegroundWindow(hWnd);
|
User32.SetForegroundWindow(_hWnd);
|
||||||
// Make sure windows has time to perform the action
|
// Make sure windows has time to perform the action
|
||||||
while(Iconic) {
|
while(Iconic) {
|
||||||
Application.DoEvents();
|
Application.DoEvents();
|
||||||
|
@ -861,10 +875,10 @@ namespace GreenshotPlugin.Core {
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public WindowStyleFlags WindowStyle {
|
public WindowStyleFlags WindowStyle {
|
||||||
get {
|
get {
|
||||||
return (WindowStyleFlags)User32.GetWindowLongWrapper(hWnd, (int)WindowLongIndex.GWL_STYLE);
|
return (WindowStyleFlags)User32.GetWindowLongWrapper(_hWnd, (int)WindowLongIndex.GWL_STYLE);
|
||||||
}
|
}
|
||||||
set {
|
set {
|
||||||
User32.SetWindowLongWrapper(hWnd, (int)WindowLongIndex.GWL_STYLE, new IntPtr((long)value));
|
User32.SetWindowLongWrapper(_hWnd, (int)WindowLongIndex.GWL_STYLE, new IntPtr((long)value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -887,10 +901,10 @@ namespace GreenshotPlugin.Core {
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ExtendedWindowStyleFlags ExtendedWindowStyle {
|
public ExtendedWindowStyleFlags ExtendedWindowStyle {
|
||||||
get {
|
get {
|
||||||
return (ExtendedWindowStyleFlags)User32.GetWindowLongWrapper(hWnd, (int)WindowLongIndex.GWL_EXSTYLE);
|
return (ExtendedWindowStyleFlags)User32.GetWindowLongWrapper(_hWnd, (int)WindowLongIndex.GWL_EXSTYLE);
|
||||||
}
|
}
|
||||||
set {
|
set {
|
||||||
User32.SetWindowLongWrapper(hWnd, (int)WindowLongIndex.GWL_EXSTYLE, new IntPtr((uint)value));
|
User32.SetWindowLongWrapper(_hWnd, (int)WindowLongIndex.GWL_EXSTYLE, new IntPtr((uint)value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -899,7 +913,7 @@ namespace GreenshotPlugin.Core {
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="capture">The capture to fill</param>
|
/// <param name="capture">The capture to fill</param>
|
||||||
/// <returns>ICapture</returns>
|
/// <returns>ICapture</returns>
|
||||||
public ICapture CaptureGDIWindow(ICapture capture) {
|
public ICapture CaptureGdiWindow(ICapture capture) {
|
||||||
Image capturedImage = PrintWindow();
|
Image capturedImage = PrintWindow();
|
||||||
if (capturedImage != null) {
|
if (capturedImage != null) {
|
||||||
capture.Image = capturedImage;
|
capture.Image = capturedImage;
|
||||||
|
@ -916,7 +930,7 @@ namespace GreenshotPlugin.Core {
|
||||||
/// <param name="windowCaptureMode">Wanted WindowCaptureMode</param>
|
/// <param name="windowCaptureMode">Wanted WindowCaptureMode</param>
|
||||||
/// <param name="autoMode">True if auto modus is used</param>
|
/// <param name="autoMode">True if auto modus is used</param>
|
||||||
/// <returns>ICapture with the capture</returns>
|
/// <returns>ICapture with the capture</returns>
|
||||||
public ICapture CaptureDWMWindow(ICapture capture, WindowCaptureMode windowCaptureMode, bool autoMode) {
|
public ICapture CaptureDwmWindow(ICapture capture, WindowCaptureMode windowCaptureMode, bool autoMode) {
|
||||||
IntPtr thumbnailHandle = IntPtr.Zero;
|
IntPtr thumbnailHandle = IntPtr.Zero;
|
||||||
Form tempForm = null;
|
Form tempForm = null;
|
||||||
bool tempFormShown = false;
|
bool tempFormShown = false;
|
||||||
|
@ -935,13 +949,13 @@ namespace GreenshotPlugin.Core {
|
||||||
SIZE sourceSize;
|
SIZE sourceSize;
|
||||||
DWM.DwmQueryThumbnailSourceSize(thumbnailHandle, out sourceSize);
|
DWM.DwmQueryThumbnailSourceSize(thumbnailHandle, out sourceSize);
|
||||||
|
|
||||||
if (sourceSize.width <= 0 || sourceSize.height <= 0) {
|
if (sourceSize.Width <= 0 || sourceSize.Height <= 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate the location of the temp form
|
// Calculate the location of the temp form
|
||||||
Rectangle windowRectangle = WindowRectangle;
|
Rectangle windowRectangle = WindowRectangle;
|
||||||
Point formLocation = formLocation = windowRectangle.Location;
|
Point formLocation = windowRectangle.Location;
|
||||||
Size borderSize = new Size();
|
Size borderSize = new Size();
|
||||||
bool doesCaptureFit = false;
|
bool doesCaptureFit = false;
|
||||||
if (!Maximised) {
|
if (!Maximised) {
|
||||||
|
@ -950,7 +964,7 @@ namespace GreenshotPlugin.Core {
|
||||||
using (Region workingArea = new Region(Screen.PrimaryScreen.Bounds)) {
|
using (Region workingArea = new Region(Screen.PrimaryScreen.Bounds)) {
|
||||||
// Find the screen where the window is and check if it fits
|
// Find the screen where the window is and check if it fits
|
||||||
foreach (Screen screen in Screen.AllScreens) {
|
foreach (Screen screen in Screen.AllScreens) {
|
||||||
if (screen != Screen.PrimaryScreen) {
|
if (!Equals(screen, Screen.PrimaryScreen)) {
|
||||||
workingArea.Union(screen.Bounds);
|
workingArea.Union(screen.Bounds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -980,32 +994,34 @@ namespace GreenshotPlugin.Core {
|
||||||
tempForm.Size = sourceSize.ToSize();
|
tempForm.Size = sourceSize.ToSize();
|
||||||
|
|
||||||
// Prepare rectangle to capture from the screen.
|
// Prepare rectangle to capture from the screen.
|
||||||
Rectangle captureRectangle = new Rectangle(formLocation.X, formLocation.Y, sourceSize.width, sourceSize.height);
|
Rectangle captureRectangle = new Rectangle(formLocation.X, formLocation.Y, sourceSize.Width, sourceSize.Height);
|
||||||
if (Maximised) {
|
if (Maximised) {
|
||||||
// Correct capture size for maximized window by offsetting the X,Y with the border size
|
// Correct capture size for maximized window by offsetting the X,Y with the border size
|
||||||
captureRectangle.X += borderSize.Width;
|
|
||||||
captureRectangle.Y += borderSize.Height;
|
|
||||||
// and subtracting the border from the size (2 times, as we move right/down for the capture without resizing)
|
// and subtracting the border from the size (2 times, as we move right/down for the capture without resizing)
|
||||||
captureRectangle.Width -= 2 * borderSize.Width;
|
captureRectangle.Inflate(borderSize.Width, borderSize.Height);
|
||||||
captureRectangle.Height -= 2 * borderSize.Height;
|
} else {
|
||||||
} else if (autoMode) {
|
captureRectangle.Inflate(-1, -1);
|
||||||
// check if the capture fits
|
|
||||||
if (!doesCaptureFit) {
|
if (autoMode) {
|
||||||
// if GDI is allowed.. (a screenshot won't be better than we comes if we continue)
|
// check if the capture fits
|
||||||
using (Process thisWindowProcess = Process) {
|
if (!doesCaptureFit) {
|
||||||
if (!isMetroApp && WindowCapture.IsGdiAllowed(thisWindowProcess)) {
|
// if GDI is allowed.. (a screenshot won't be better than we comes if we continue)
|
||||||
// we return null which causes the capturing code to try another method.
|
using (Process thisWindowProcess = Process) {
|
||||||
return null;
|
if (!IsMetroApp && WindowCapture.IsGdiAllowed(thisWindowProcess)) {
|
||||||
|
// we return null which causes the capturing code to try another method.
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prepare the displaying of the Thumbnail
|
// Prepare the displaying of the Thumbnail
|
||||||
DWM_THUMBNAIL_PROPERTIES props = new DWM_THUMBNAIL_PROPERTIES();
|
DWM_THUMBNAIL_PROPERTIES props = new DWM_THUMBNAIL_PROPERTIES
|
||||||
props.Opacity = (byte)255;
|
{
|
||||||
props.Visible = true;
|
Opacity = 255,
|
||||||
props.Destination = new RECT(0, 0, sourceSize.width, sourceSize.height);
|
Visible = true,
|
||||||
|
Destination = new RECT(0, 0, sourceSize.Width, sourceSize.Height)
|
||||||
|
};
|
||||||
DWM.DwmUpdateThumbnailProperties(thumbnailHandle, ref props);
|
DWM.DwmUpdateThumbnailProperties(thumbnailHandle, ref props);
|
||||||
tempForm.Show();
|
tempForm.Show();
|
||||||
tempFormShown = true;
|
tempFormShown = true;
|
||||||
|
@ -1032,7 +1048,7 @@ namespace GreenshotPlugin.Core {
|
||||||
tempForm.BackColor = Color.Black;
|
tempForm.BackColor = Color.Black;
|
||||||
// Make sure everything is visible
|
// Make sure everything is visible
|
||||||
tempForm.Refresh();
|
tempForm.Refresh();
|
||||||
if (!isMetroApp) {
|
if (!IsMetroApp) {
|
||||||
// Make sure the application window is active, so the colors & buttons are right
|
// Make sure the application window is active, so the colors & buttons are right
|
||||||
ToForeground();
|
ToForeground();
|
||||||
}
|
}
|
||||||
|
@ -1055,7 +1071,7 @@ namespace GreenshotPlugin.Core {
|
||||||
if (capturedBitmap == null) {
|
if (capturedBitmap == null) {
|
||||||
// Remove transparency, this will break the capturing
|
// Remove transparency, this will break the capturing
|
||||||
if (!autoMode) {
|
if (!autoMode) {
|
||||||
tempForm.BackColor = Color.FromArgb(255, conf.DWMBackgroundColor.R, conf.DWMBackgroundColor.G, conf.DWMBackgroundColor.B);
|
tempForm.BackColor = Color.FromArgb(255, Conf.DWMBackgroundColor.R, Conf.DWMBackgroundColor.G, Conf.DWMBackgroundColor.B);
|
||||||
} else {
|
} else {
|
||||||
Color colorizationColor = DWM.ColorizationColor;
|
Color colorizationColor = DWM.ColorizationColor;
|
||||||
// Modify by losing the transparency and increasing the intensity (as if the background color is white)
|
// Modify by losing the transparency and increasing the intensity (as if the background color is white)
|
||||||
|
@ -1064,7 +1080,7 @@ namespace GreenshotPlugin.Core {
|
||||||
}
|
}
|
||||||
// Make sure everything is visible
|
// Make sure everything is visible
|
||||||
tempForm.Refresh();
|
tempForm.Refresh();
|
||||||
if (!isMetroApp) {
|
if (!IsMetroApp) {
|
||||||
// Make sure the application window is active, so the colors & buttons are right
|
// Make sure the application window is active, so the colors & buttons are right
|
||||||
ToForeground();
|
ToForeground();
|
||||||
}
|
}
|
||||||
|
@ -1077,7 +1093,7 @@ namespace GreenshotPlugin.Core {
|
||||||
// Not needed for Windows 8
|
// Not needed for Windows 8
|
||||||
if (!Environment.OSVersion.IsWindows8OrLater()) {
|
if (!Environment.OSVersion.IsWindows8OrLater()) {
|
||||||
// Only if the Inivalue is set, not maximized and it's not a tool window.
|
// Only if the Inivalue is set, not maximized and it's not a tool window.
|
||||||
if (conf.WindowCaptureRemoveCorners && !Maximised && (ExtendedWindowStyle & ExtendedWindowStyleFlags.WS_EX_TOOLWINDOW) == 0) {
|
if (Conf.WindowCaptureRemoveCorners && !Maximised && (ExtendedWindowStyle & ExtendedWindowStyleFlags.WS_EX_TOOLWINDOW) == 0) {
|
||||||
// Remove corners
|
// Remove corners
|
||||||
if (!Image.IsAlphaPixelFormat(capturedBitmap.PixelFormat)) {
|
if (!Image.IsAlphaPixelFormat(capturedBitmap.PixelFormat)) {
|
||||||
LOG.Debug("Changing pixelformat to Alpha for the RemoveCorners");
|
LOG.Debug("Changing pixelformat to Alpha for the RemoveCorners");
|
||||||
|
@ -1122,8 +1138,8 @@ namespace GreenshotPlugin.Core {
|
||||||
/// <param name="image">The bitmap to remove the corners from.</param>
|
/// <param name="image">The bitmap to remove the corners from.</param>
|
||||||
private void RemoveCorners(Bitmap image) {
|
private void RemoveCorners(Bitmap image) {
|
||||||
using (IFastBitmap fastBitmap = FastBitmap.Create(image)) {
|
using (IFastBitmap fastBitmap = FastBitmap.Create(image)) {
|
||||||
for (int y = 0; y < conf.WindowCornerCutShape.Count; y++) {
|
for (int y = 0; y < Conf.WindowCornerCutShape.Count; y++) {
|
||||||
for (int x = 0; x < conf.WindowCornerCutShape[y]; x++) {
|
for (int x = 0; x < Conf.WindowCornerCutShape[y]; x++) {
|
||||||
fastBitmap.SetColorAt(x, y, Color.Transparent);
|
fastBitmap.SetColorAt(x, y, Color.Transparent);
|
||||||
fastBitmap.SetColorAt(image.Width-1-x, y, Color.Transparent);
|
fastBitmap.SetColorAt(image.Width-1-x, y, Color.Transparent);
|
||||||
fastBitmap.SetColorAt(image.Width-1-x, image.Height-1-y, Color.Transparent);
|
fastBitmap.SetColorAt(image.Width-1-x, image.Height-1-y, Color.Transparent);
|
||||||
|
@ -1230,7 +1246,7 @@ namespace GreenshotPlugin.Core {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Helper method to get the Border size for GDI Windows
|
/// Helper method to get the Border size for GDI Windows
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="rectangle">out Rectangle</param>
|
/// <param name="size">out Size</param>
|
||||||
/// <returns>bool true if it worked</returns>
|
/// <returns>bool true if it worked</returns>
|
||||||
private bool GetBorderSize(out Size size) {
|
private bool GetBorderSize(out Size size) {
|
||||||
WindowInfo windowInfo = new WindowInfo();
|
WindowInfo windowInfo = new WindowInfo();
|
||||||
|
@ -1281,7 +1297,7 @@ namespace GreenshotPlugin.Core {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (string excludeProcess in excludeProcessesFromFreeze) {
|
foreach (string excludeProcess in ExcludeProcessesFromFreeze) {
|
||||||
if (titleOrProcessname.ToLower().Contains(excludeProcess)) {
|
if (titleOrProcessname.ToLower().Contains(excludeProcess)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1409,7 +1425,7 @@ namespace GreenshotPlugin.Core {
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="hWnd">The Window Handle</param>
|
/// <param name="hWnd">The Window Handle</param>
|
||||||
public WindowDetails(IntPtr hWnd) {
|
public WindowDetails(IntPtr hWnd) {
|
||||||
this.hWnd = hWnd;
|
this._hWnd = hWnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1419,7 +1435,7 @@ namespace GreenshotPlugin.Core {
|
||||||
public static WindowDetails GetActiveWindow() {
|
public static WindowDetails GetActiveWindow() {
|
||||||
IntPtr hWnd = User32.GetForegroundWindow();
|
IntPtr hWnd = User32.GetForegroundWindow();
|
||||||
if (hWnd != null && hWnd != IntPtr.Zero) {
|
if (hWnd != null && hWnd != IntPtr.Zero) {
|
||||||
if (ignoreHandles.Contains(hWnd)) {
|
if (IgnoreHandles.Contains(hWnd)) {
|
||||||
return GetDesktopWindow();
|
return GetDesktopWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1439,7 +1455,7 @@ namespace GreenshotPlugin.Core {
|
||||||
public bool IsGreenshot {
|
public bool IsGreenshot {
|
||||||
get {
|
get {
|
||||||
try {
|
try {
|
||||||
if (!isMetroApp) {
|
if (!IsMetroApp) {
|
||||||
using (Process thisWindowProcess = Process) {
|
using (Process thisWindowProcess = Process) {
|
||||||
return "Greenshot".Equals(thisWindowProcess.MainModule.FileVersionInfo.ProductName);
|
return "Greenshot".Equals(thisWindowProcess.MainModule.FileVersionInfo.ProductName);
|
||||||
}
|
}
|
||||||
|
@ -1470,7 +1486,7 @@ namespace GreenshotPlugin.Core {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get all the top level windows, with matching classname
|
/// Get all the top level windows, with matching classname
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>List<WindowDetails> with all the top level windows</returns>
|
/// <returns>List WindowDetails with all the top level windows</returns>
|
||||||
public static List<WindowDetails> GetAllWindows(string classname) {
|
public static List<WindowDetails> GetAllWindows(string classname) {
|
||||||
return new WindowsEnumerator().GetWindows(IntPtr.Zero, classname).Items;
|
return new WindowsEnumerator().GetWindows(IntPtr.Zero, classname).Items;
|
||||||
}
|
}
|
||||||
|
@ -1478,7 +1494,6 @@ namespace GreenshotPlugin.Core {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Recursive "find children which"
|
/// Recursive "find children which"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="window">Window to look into</param>
|
|
||||||
/// <param name="point">point to check for</param>
|
/// <param name="point">point to check for</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public WindowDetails FindChildUnderPoint(Point point) {
|
public WindowDetails FindChildUnderPoint(Point point) {
|
||||||
|
@ -1507,7 +1522,7 @@ namespace GreenshotPlugin.Core {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get all the visible top level windows
|
/// Get all the visible top level windows
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>List<WindowDetails> with all the visible top level windows</returns>
|
/// <returns>List WindowDetails with all the visible top level windows</returns>
|
||||||
public static List<WindowDetails> GetVisibleWindows() {
|
public static List<WindowDetails> GetVisibleWindows() {
|
||||||
List<WindowDetails> windows = new List<WindowDetails>();
|
List<WindowDetails> windows = new List<WindowDetails>();
|
||||||
Rectangle screenBounds = WindowCapture.GetScreenBounds();
|
Rectangle screenBounds = WindowCapture.GetScreenBounds();
|
||||||
|
@ -1542,7 +1557,7 @@ namespace GreenshotPlugin.Core {
|
||||||
/// Get the WindowDetails for all Metro Apps
|
/// Get the WindowDetails for all Metro Apps
|
||||||
/// These are all Windows with Classname "Windows.UI.Core.CoreWindow"
|
/// These are all Windows with Classname "Windows.UI.Core.CoreWindow"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>List<WindowDetails> with visible metro apps</returns>
|
/// <returns>List WindowDetails with visible metro apps</returns>
|
||||||
public static List<WindowDetails> GetMetroApps() {
|
public static List<WindowDetails> GetMetroApps() {
|
||||||
List<WindowDetails> metroApps = new List<WindowDetails>();
|
List<WindowDetails> metroApps = new List<WindowDetails>();
|
||||||
// if the appVisibility != null we have Windows 8.
|
// if the appVisibility != null we have Windows 8.
|
||||||
|
@ -1582,7 +1597,7 @@ namespace GreenshotPlugin.Core {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get all the top level windows
|
/// Get all the top level windows
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>List<WindowDetails> with all the top level windows</returns>
|
/// <returns>List WindowDetails with all the top level windows</returns>
|
||||||
public static List<WindowDetails> GetTopLevelWindows() {
|
public static List<WindowDetails> GetTopLevelWindows() {
|
||||||
List<WindowDetails> windows = new List<WindowDetails>();
|
List<WindowDetails> windows = new List<WindowDetails>();
|
||||||
var possibleTopLevelWindows = GetMetroApps();
|
var possibleTopLevelWindows = GetMetroApps();
|
||||||
|
@ -1660,7 +1675,7 @@ namespace GreenshotPlugin.Core {
|
||||||
/// Helper method to "active" all windows that are not in the supplied list.
|
/// Helper method to "active" all windows that are not in the supplied list.
|
||||||
/// One should preferably call "GetVisibleWindows" for the oldWindows.
|
/// One should preferably call "GetVisibleWindows" for the oldWindows.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="oldWindows">List<WindowDetails> with old windows</param>
|
/// <param name="oldWindows">List WindowDetails with old windows</param>
|
||||||
public static void ActiveNewerWindows(List<WindowDetails> oldWindows) {
|
public static void ActiveNewerWindows(List<WindowDetails> oldWindows) {
|
||||||
List<WindowDetails> windowsAfter = GetVisibleWindows();
|
List<WindowDetails> windowsAfter = GetVisibleWindows();
|
||||||
foreach(WindowDetails window in windowsAfter) {
|
foreach(WindowDetails window in windowsAfter) {
|
||||||
|
|
|
@ -130,7 +130,7 @@ namespace GreenshotPlugin.UnmanagedHelpers {
|
||||||
/// Helper method for an easy DWM check
|
/// Helper method for an easy DWM check
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>bool true if DWM is available AND active</returns>
|
/// <returns>bool true if DWM is available AND active</returns>
|
||||||
public static bool isDWMEnabled() {
|
public static bool IsDwmEnabled() {
|
||||||
// According to: http://technet.microsoft.com/en-us/subscriptions/aa969538%28v=vs.85%29.aspx
|
// According to: http://technet.microsoft.com/en-us/subscriptions/aa969538%28v=vs.85%29.aspx
|
||||||
// And: http://msdn.microsoft.com/en-us/library/windows/desktop/aa969510%28v=vs.85%29.aspx
|
// And: http://msdn.microsoft.com/en-us/library/windows/desktop/aa969510%28v=vs.85%29.aspx
|
||||||
// DMW is always enabled on Windows 8! So return true and save a check! ;-)
|
// DMW is always enabled on Windows 8! So return true and save a check! ;-)
|
||||||
|
|
|
@ -25,17 +25,17 @@ using System.Runtime.InteropServices;
|
||||||
namespace GreenshotPlugin.UnmanagedHelpers {
|
namespace GreenshotPlugin.UnmanagedHelpers {
|
||||||
[StructLayout(LayoutKind.Sequential), Serializable()]
|
[StructLayout(LayoutKind.Sequential), Serializable()]
|
||||||
public struct SIZE {
|
public struct SIZE {
|
||||||
public int width;
|
public int Width;
|
||||||
public int height;
|
public int Height;
|
||||||
public SIZE(Size size) : this(size.Width, size.Height) {
|
public SIZE(Size size) : this(size.Width, size.Height) {
|
||||||
|
|
||||||
}
|
}
|
||||||
public SIZE(int width, int height) {
|
public SIZE(int width, int height) {
|
||||||
this.width = width;
|
Width = width;
|
||||||
this.height = height;
|
Height = height;
|
||||||
}
|
}
|
||||||
public Size ToSize() {
|
public Size ToSize() {
|
||||||
return new Size(width, height);
|
return new Size(Width, Height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[StructLayout(LayoutKind.Sequential), Serializable()]
|
[StructLayout(LayoutKind.Sequential), Serializable()]
|
||||||
|
|
|
@ -67,12 +67,15 @@ deploy:
|
||||||
auth_token:
|
auth_token:
|
||||||
secure: 4sYcNGg7byBFtR7EkJHS8d3H3qP0u0LodlJWCV7g/4jEyv3vvVxqzh19zZ6Zgrf1
|
secure: 4sYcNGg7byBFtR7EkJHS8d3H3qP0u0LodlJWCV7g/4jEyv3vvVxqzh19zZ6Zgrf1
|
||||||
prerelease: true
|
prerelease: true
|
||||||
|
draft: true
|
||||||
on:
|
on:
|
||||||
build_type: UNSTABLE
|
build_type: UNSTABLE
|
||||||
- provider: GitHub
|
- provider: GitHub
|
||||||
tag: Greenshot-$(build_type)-$(APPVEYOR_BUILD_VERSION)
|
tag: Greenshot-$(build_type)-$(APPVEYOR_BUILD_VERSION)
|
||||||
auth_token:
|
auth_token:
|
||||||
secure: 4sYcNGg7byBFtR7EkJHS8d3H3qP0u0LodlJWCV7g/4jEyv3vvVxqzh19zZ6Zgrf1
|
secure: 4sYcNGg7byBFtR7EkJHS8d3H3qP0u0LodlJWCV7g/4jEyv3vvVxqzh19zZ6Zgrf1
|
||||||
|
prerelease: false
|
||||||
|
draft: true
|
||||||
on:
|
on:
|
||||||
build_type: RELEASE
|
build_type: RELEASE
|
||||||
notifications:
|
notifications:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue