fixed comment into code
This commit is contained in:
@@ -3,8 +3,8 @@ using System.Runtime.InteropServices;
|
||||
namespace CursorLang.Interop;
|
||||
|
||||
/// <summary>
|
||||
/// Win32 API для окна-подсказки: стили, позиционирование у курсора
|
||||
/// и масштаб монитора, на котором курсор находится.
|
||||
/// Win32 API for the popup window: styles, positioning near the cursor
|
||||
/// and the scale of the monitor the cursor is on.
|
||||
/// </summary>
|
||||
internal static class PopupWindowNative
|
||||
{
|
||||
@@ -62,9 +62,9 @@ internal static class PopupWindowNative
|
||||
}
|
||||
|
||||
private const int GWL_EXSTYLE = -20;
|
||||
// Окно не забирает фокус у активного приложения
|
||||
// The window does not take focus away from the active application
|
||||
private const int WS_EX_NOACTIVATE = 0x08000000;
|
||||
// И не попадает в Alt+Tab
|
||||
// And does not show up in Alt+Tab
|
||||
private const int WS_EX_TOOLWINDOW = 0x00000080;
|
||||
|
||||
private const uint SWP_NOSIZE = 0x0001;
|
||||
@@ -81,8 +81,8 @@ internal static class PopupWindowNative
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Подсказка всплывает поверх чужих приложений, поэтому она не должна
|
||||
/// ни активироваться сама, ни отбирать фокус ввода у активного окна.
|
||||
/// The popup shows up on top of other applications, so it must neither
|
||||
/// activate itself nor steal input focus from the active window.
|
||||
/// </summary>
|
||||
internal static void MakePassive(IntPtr hWnd)
|
||||
{
|
||||
@@ -91,10 +91,10 @@ internal static class PopupWindowNative
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Двигает окно в точку экрана, не меняя размер и порядок окон.
|
||||
/// Координаты — физические пиксели: у мониторов разный масштаб, а
|
||||
/// Window.Left/Top пересчитываются по DPI того монитора, где окно сейчас,
|
||||
/// и на соседнем мониторе дают промах.
|
||||
/// Moves the window to a screen point without changing its size or z-order.
|
||||
/// The coordinates are physical pixels: monitors have different scaling, while
|
||||
/// Window.Left/Top are converted using the DPI of the monitor the window is on
|
||||
/// right now, which misses the target on a neighbouring monitor.
|
||||
/// </summary>
|
||||
internal static void MoveTo(IntPtr hWnd, int x, int y)
|
||||
{
|
||||
@@ -102,26 +102,27 @@ internal static class PopupWindowNative
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Задаёт положение и размер окна в физических пикселях.
|
||||
/// Sets the window position and size in physical pixels.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Размер выставляется именно так, а не через Width/Height: при первом показе
|
||||
/// окно ещё подчиняется системному минимальному размеру окна (SM_CXMIN×SM_CYMIN)
|
||||
/// и подсказка выходит заметно крупнее текста. К моменту вызова окно уже
|
||||
/// показано и стало popup-окном, на которое это ограничение не действует.
|
||||
/// The size is set this way rather than through Width/Height: on the first show the
|
||||
/// window is still subject to the system minimum window size (SM_CXMIN×SM_CYMIN)
|
||||
/// and the popup comes out noticeably larger than its text. By the time this is
|
||||
/// called the window is already shown and has become a popup window, which that
|
||||
/// restriction does not apply to.
|
||||
/// </remarks>
|
||||
internal static void SetBounds(IntPtr hWnd, int x, int y, int width, int height)
|
||||
{
|
||||
SetWindowPos(hWnd, IntPtr.Zero, x, y, width, height, SWP_NOZORDER | SWP_NOACTIVATE);
|
||||
}
|
||||
|
||||
/// <summary>Масштаб монитора, на котором находится точка (1.0 при 96 DPI).</summary>
|
||||
/// <summary>The scale of the monitor the point is on (1.0 at 96 DPI).</summary>
|
||||
internal static double GetScaleAt(Point point) =>
|
||||
GetScaleOf(MonitorFromPoint(point, MONITOR_DEFAULTTONEAREST));
|
||||
|
||||
/// <summary>
|
||||
/// Рабочая область монитора с активным окном — без панели задач — и его масштаб.
|
||||
/// Именно на этом мониторе пользователь сейчас работает.
|
||||
/// The work area of the monitor holding the active window — without the taskbar —
|
||||
/// and its scale. That is the monitor the user is working on right now.
|
||||
/// </summary>
|
||||
internal static (Rect WorkArea, double Scale) GetActiveMonitorWorkArea()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user