Skip to content

Commit

Permalink
Merge branch 'develop' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
punker76 committed Jul 24, 2020
2 parents 31b0b50 + d8c4185 commit 529527c
Show file tree
Hide file tree
Showing 13 changed files with 309 additions and 132 deletions.
53 changes: 53 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
@@ -0,0 +1,53 @@
---
name: Bug report
about: Create a bug report to help us to improve ControlzEx
title: ''
labels: Bug
assignees: ''

---

## Describe the bug

<!--
A clear and concise description of what the bug is. Questions about usage are better asked in the Gitter https://gitter.im/ControlzEx/ControlzEx room.
-->

## Steps to reproduce

<!--
A description of how to trigger this bug.
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
If it's possible follow these guidelines for a good sample and I will most likely look at the issue sooner:
- Post a full GitHub repository. Not a zip file, half baked snippet etc. If GitHub is new to you consider it a great learning opportunity and chance to get involved.
- The repository should have just ONE step max for me to get running, and that is "Restore NuGet Packages". If there are any other missing dependencies, or new features I will most likely move on to another issue.
- I'm not trying to be awkward. I'm just busy and I'm helping a lot of people, not just you, so help me out and I will help you out.
-->

## Expected behavior

<!-- A description of what you're expecting, possibly containing screenshots or reference material. -->

## Actual behavior

<!-- What's actually happening? -->

## Environment

```
ControlzEx version: v4.x.x
Windows build number: Win10 1909 [Version 10.0.x.x]
Visual Studio: 2019 16.x.x
Target Framework: .Net Core 3.1 (v4.x.x)
```

## Screenshots

<!-- If applicable, add screenshots to help explain your problem. -->
19 changes: 19 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
@@ -0,0 +1,19 @@
---
name: Feature request
about: Suggest an idea for ControlzEx
title: ''
labels: Feature Request
assignees: ''

---

## Describe the feature

<!--
Describe your feature request.
A clear and concise description of what you want to happen.
-->

## Additional context

<!-- Add any other context or screenshots about the feature request here. -->
18 changes: 18 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,18 @@
## Describe the changes you have made to improve this project

<!--
Is your feature request related to a problem? Please describe.
A clear and concise description of what the change is.
-->

## Unit test

<!-- If it's possible then make a unit test for your changes. -->

## Additional context

<!-- Add any other context or screenshots about the feature request here. -->

## Closed Issues

<!-- Closes #xxxx -->
1 change: 1 addition & 0 deletions GitVersion.yml
Expand Up @@ -4,6 +4,7 @@ next-version: 4.3.0
mode: ContinuousDeployment
branches:
master:
regex: ^main
mode: ContinuousDeployment
tag: rc
prevent-increment-of-merged-branch-version: true
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -17,7 +17,7 @@
[![Downloads](https://img.shields.io/nuget/dt/ControlzEx.svg?style=flat-square)](http://www.nuget.org/packages/ControlzEx/)
[![Issues](https://img.shields.io/github/issues/ControlzEx/ControlzEx.svg?style=flat-square)](https://github.com/ControlzEx/ControlzEx/issues)
[![Nuget](https://img.shields.io/nuget/vpre/ControlzEx.svg?style=flat-square)](http://nuget.org/packages/ControlzEx)
[![License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://github.com/ControlzEx/ControlzEx/blob/master/License.txt)
[![License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://github.com/ControlzEx/ControlzEx/blob/main/License.txt)

[![Twitter Jan](https://img.shields.io/badge/twitter-%40punker76-55acee.svg?style=flat-square)](https://twitter.com/punker76) [![Twitter Bastian](https://img.shields.io/badge/twitter-%40batzendev-55acee.svg?style=flat-square)](https://twitter.com/batzendev) [![Twitter James](https://img.shields.io/badge/twitter-%40James_Willock-55acee.svg?style=flat-square)](https://twitter.com/James_Willock)

Expand Down
4 changes: 1 addition & 3 deletions appveyor.yml
@@ -1,11 +1,9 @@
# http://www.appveyor.com/docs/appveyor-yml

# configuration for develop/CI and master/Release branch

branches:
only:
- develop
- master
- main
- /\d*\.\d*\.\d*/

environment:
Expand Down
4 changes: 2 additions & 2 deletions build.cake
Expand Up @@ -6,7 +6,7 @@
#tool "dotnet:?package=NuGetKeyVaultSignTool&version=1.2.18"
#tool "dotnet:?package=AzureSignTool&version=2.0.17"

#tool GitVersion.CommandLine&version=5.0.1
#tool GitVersion.CommandLine&version=5.3.7
#tool gitreleasemanager
#tool vswhere
#addin Cake.Figlet
Expand Down Expand Up @@ -36,7 +36,7 @@ GitVersion gitVersion = GitVersion(new GitVersionSettings { OutputType = GitVers
var isPullRequest = AppVeyor.Environment.PullRequest.IsPullRequest;
var branchName = gitVersion.BranchName;
var isDevelopBranch = StringComparer.OrdinalIgnoreCase.Equals("develop", branchName);
var isReleaseBranch = StringComparer.OrdinalIgnoreCase.Equals("master", branchName);
var isReleaseBranch = StringComparer.OrdinalIgnoreCase.Equals("main", branchName);
var isTagged = AppVeyor.Environment.Repository.Tag.IsTag;

var latestInstallationPath = VSWhereLatest(new VSWhereLatestSettings { IncludePrerelease = true });
Expand Down
Expand Up @@ -633,7 +633,7 @@ private IntPtr _HandleGETMINMAXINFO(WM uMsg, IntPtr wParam, IntPtr lParam, out b
var monitor = NativeMethods.MonitorFromWindow(this.windowHandle, MonitorOptions.MONITOR_DEFAULTTONEAREST);
if (monitor != IntPtr.Zero)
{
var monitorInfo = NativeMethods.GetMonitorInfoW(monitor);
var monitorInfo = NativeMethods.GetMonitorInfo(monitor);
var rcWorkArea = monitorInfo.rcWork;
var rcMonitorArea = monitorInfo.rcMonitor;

Expand Down Expand Up @@ -722,7 +722,7 @@ private IntPtr _HandleMOVEForRealSize(WM uMsg, IntPtr wParam, IntPtr lParam, out
if (monitorFromWindow != IntPtr.Zero)
{
var ignoreTaskBar = this.IgnoreTaskbarOnMaximize;
var monitorInfo = NativeMethods.GetMonitorInfoW(monitorFromWindow);
var monitorInfo = NativeMethods.GetMonitorInfo(monitorFromWindow);
var rcMonitorArea = ignoreTaskBar ? monitorInfo.rcMonitor : monitorInfo.rcWork;
/*
* ASYNCWINDOWPOS
Expand Down
2 changes: 2 additions & 0 deletions src/ControlzEx/Microsoft.Windows.Shell/Standard/ErrorCodes.cs
Expand Up @@ -94,6 +94,8 @@ public Win32Error(int i)
_value = i;
}

public int Error => _value;

/// <summary>Performs HRESULT_FROM_WIN32 conversion.</summary>
/// <param name="error">The Win32 error being converted to an HRESULT.</param>
/// <returns>The equivilent HRESULT value.</returns>
Expand Down
40 changes: 32 additions & 8 deletions src/ControlzEx/Microsoft.Windows.Shell/Standard/MonitorHelper.cs
Expand Up @@ -2,23 +2,47 @@
namespace ControlzEx.Standard
{
using System;
using System.Diagnostics;

internal static class MonitorHelper
{
/// <summary>
/// Gets the monitor information from the current cursor position.
/// Gets the monitor information from the current cursor position.
/// </summary>
/// <returns></returns>
/// <returns>The monitor information.</returns>
public static MONITORINFO GetMonitorInfoFromPoint()
{
var cursorPos = NativeMethods.GetCursorPos();
var monitor = NativeMethods.MonitorFromPoint(cursorPos, MonitorOptions.MONITOR_DEFAULTTONEAREST);
if (monitor != IntPtr.Zero)
if (TryGetMonitorInfoFromPoint(out var mi))
{
var monitorInfo = NativeMethods.GetMonitorInfo(monitor);
return monitorInfo;
return mi;
}
return new MONITORINFO();

return default;
}

/// <summary>
/// Gets the monitor information from the current cursor position.
/// </summary>
/// <returns>True when getting the monitor information was successful.</returns>
public static bool TryGetMonitorInfoFromPoint(out MONITORINFO monitorInfo)
{
try
{
var cursorPos = NativeMethods.GetCursorPos();
var monitor = NativeMethods.MonitorFromPoint(cursorPos, MonitorOptions.MONITOR_DEFAULTTONEAREST);
if (monitor != IntPtr.Zero)
{
monitorInfo = NativeMethods.GetMonitorInfo(monitor);
return true;
}
}
catch (UnauthorizedAccessException ex)
{
Trace.TraceError("Could not get the monitor info with the current cursor position: {0}", ex);
}

monitorInfo = default;
return false;
}
}
}

0 comments on commit 529527c

Please sign in to comment.