mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-09-14 10:32:10 +02:00
Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
c5a42e74d9
|
|||
23ebd58da0
|
@@ -6,6 +6,6 @@ using TweetDuck;
|
||||
|
||||
namespace TweetDuck {
|
||||
internal static class Version {
|
||||
public const string Tag = "1.25.3";
|
||||
public const string Tag = "1.25.4";
|
||||
}
|
||||
}
|
||||
|
@@ -237,7 +237,7 @@ namespace TweetDuck.Video {
|
||||
int maxWidth = Math.Min(DpiScaled(media.imageSourceWidth), ownerWidth * 3 / 4);
|
||||
int maxHeight = Math.Min(DpiScaled(media.imageSourceHeight), ownerHeight * 3 / 4);
|
||||
|
||||
bool isCursorInside = ClientRectangle.Contains(PointToClient(Cursor.Position));
|
||||
bool isCursorInside = ClientRectangle.Contains(PointToClient(Cursor.Position)) && Handle == NativeMethods.GetFormHandleAt(Cursor.Position);
|
||||
|
||||
Size newSize = new Size(Math.Max(minWidth + 2, maxWidth), Math.Max(minHeight + 2, maxHeight));
|
||||
Point newLocation = new Point(ownerLeft + (ownerWidth - newSize.Width) / 2, ownerTop + (ownerHeight - newSize.Height + SystemInformation.CaptionHeight) / 2);
|
||||
|
@@ -1,11 +1,13 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Drawing;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace TweetDuck.Video {
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
static class NativeMethods {
|
||||
private const int GA_ROOT = 2;
|
||||
private const int GWL_HWNDPARENT = -8;
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
@@ -24,6 +26,12 @@ namespace TweetDuck.Video {
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
public static extern IntPtr GetForegroundWindow();
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
private static extern IntPtr WindowFromPoint(Point point);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
private static extern IntPtr GetAncestor(IntPtr hwnd, int flags);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
public static extern bool SetProcessDPIAware();
|
||||
@@ -49,5 +57,10 @@ namespace TweetDuck.Video {
|
||||
* ...so technically, this is following the documentation to the word.
|
||||
*/
|
||||
}
|
||||
|
||||
public static IntPtr GetFormHandleAt(Point point) {
|
||||
IntPtr window = WindowFromPoint(point);
|
||||
return window == IntPtr.Zero ? IntPtr.Zero : GetAncestor(window, GA_ROOT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user