Optimizing the windows logic, as far as was possible without LINQ. Added a check to try to fix BUG-2017.

This commit is contained in:
Robin 2016-09-04 16:42:02 +02:00
parent 68f0926b4d
commit d446127e19
5 changed files with 316 additions and 315 deletions

View file

@ -879,8 +879,7 @@ namespace Greenshot {
// 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(); foreach(WindowDetails window in WindowDetails.GetTopLevelWindows()) {
foreach(WindowDetails window in windows) {
string title = window.Text; string title = window.Text;
if (title != null) { if (title != null) {

View file

@ -471,7 +471,7 @@ namespace Greenshot.Helpers {
private void RetrieveWindowDetails() { private void RetrieveWindowDetails() {
LOG.Debug("start RetrieveWindowDetails"); LOG.Debug("start RetrieveWindowDetails");
// Start Enumeration of "active" windows // Start Enumeration of "active" windows
List<WindowDetails> allWindows = WindowDetails.GetMetroApps(); List<WindowDetails> allWindows = new List<WindowDetails>(WindowDetails.GetMetroApps());
allWindows.AddRange(WindowDetails.GetAllWindows()); allWindows.AddRange(WindowDetails.GetAllWindows());
foreach (WindowDetails window in allWindows) { foreach (WindowDetails window in allWindows) {
// Window should be visible and not ourselves // Window should be visible and not ourselves

View file

@ -71,19 +71,19 @@ namespace Greenshot.Helpers {
/// <summary> /// <summary>
/// Helper Method for creating an Email with Image Attachment /// Helper Method for creating an Email with Image Attachment
/// </summary> /// </summary>
/// <param name="image">The image to send</param> /// <param name="surface">The image to send</param>
/// <param name="captureDetails">ICaptureDetails</param> /// <param name="captureDetails">ICaptureDetails</param>
public static void SendImage(ISurface surface, ICaptureDetails captureDetails) { public static void SendImage(ISurface surface, ICaptureDetails captureDetails) {
string tmpFile = ImageOutput.SaveNamedTmpFile(surface, captureDetails, new SurfaceOutputSettings()); string tmpFile = ImageOutput.SaveNamedTmpFile(surface, captureDetails, new SurfaceOutputSettings());
if (tmpFile != null) { if (tmpFile != null) {
// Store the list of currently active windows, so we can make sure we show the email window later! // Store the list of currently active windows, so we can make sure we show the email window later!
List<WindowDetails> windowsBefore = WindowDetails.GetVisibleWindows(); var windowsBefore = WindowDetails.GetVisibleWindows();
bool isEmailSend = false; //bool isEmailSend = false;
//if (EmailConfigHelper.HasOutlook() && (conf.OutputEMailFormat == EmailFormat.OUTLOOK_HTML || conf.OutputEMailFormat == EmailFormat.OUTLOOK_TXT)) { //if (EmailConfigHelper.HasOutlook() && (conf.OutputEMailFormat == EmailFormat.OUTLOOK_HTML || conf.OutputEMailFormat == EmailFormat.OUTLOOK_TXT)) {
// isEmailSend = OutlookExporter.ExportToOutlook(tmpFile, captureDetails); // isEmailSend = OutlookExporter.ExportToOutlook(tmpFile, captureDetails);
//} //}
if (!isEmailSend && EmailConfigHelper.HasMAPI()) { if (/*!isEmailSend &&*/ EmailConfigHelper.HasMAPI()) {
// Fallback to MAPI // Fallback to MAPI
// Send the email // Send the email
SendImage(tmpFile, captureDetails.Title); SendImage(tmpFile, captureDetails.Title);

File diff suppressed because it is too large Load diff

View file

@ -109,9 +109,10 @@ namespace GreenshotPlugin.UnmanagedHelpers {
WS_EX_LAYERED = 0x00080000, WS_EX_LAYERED = 0x00080000,
WS_EX_NOINHERITLAYOUT = 0x00100000, // Disable inheritence of mirroring by children 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 WS_EX_LAYOUTRTL = 0x00400000, // Right to left mirroring
WS_EX_COMPOSITED = 0x02000000, WS_EX_COMPOSITED = 0x02000000,
WS_EX_NOACTIVATE = 0x08000000 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.
} }
[Flags] [Flags]