mirror of
https://github.com/jgpaiva/GridMove.git
synced 2025-03-27 21:18:42 +00:00
Fix WinMove for Windows 10, fix defoult grid name.
This commit is contained in:
parent
171d4e7d44
commit
04226a26ed
@ -290,7 +290,10 @@ MoveToGrid(GridToMove)
|
||||
if ShouldUseSizeMoveMessage(WinClass)
|
||||
SendMessage WM_ENTERSIZEMOVE, , , ,ahk_id %windowid%
|
||||
|
||||
WinMove, A, ,%GridLeft%,%GridTop%,%GridWidth%,%GridHeight%
|
||||
if Windows10
|
||||
WinSnap("ahk_id" windowid, GridLeft,GridTop, GridWidth, GridHeight)
|
||||
else
|
||||
WinMove, A, ,%GridLeft%,%GridTop%,%GridWidth%,%GridHeight%
|
||||
|
||||
if ShouldUseSizeMoveMessage(WinClass)
|
||||
SendMessage WM_EXITSIZEMOVE, , , ,ahk_id %windowid%
|
||||
|
35
GridMove.ahk
35
GridMove.ahk
@ -11,8 +11,8 @@
|
||||
ShowGroupsFlag := True ;configures the showing or not of the groups
|
||||
ShowNumbersFlag := True ;configures the showing or not of the numbers
|
||||
TitleSize := 100
|
||||
GridName = Grids/3-part.grid
|
||||
GridOrder = 2 Part-Vertical,3-Part,EdgeGrid,Dual-Screen
|
||||
GridName = Grids/3 Part.grid
|
||||
GridOrder = 2 Part Vertical,3 Part,EdgeGrid,Dual Screen
|
||||
UseCommand := True
|
||||
CommandHotkey = #g
|
||||
UseFastMove := True
|
||||
@ -36,7 +36,31 @@
|
||||
|
||||
;;end of options
|
||||
|
||||
ScriptVersion = 1.19.72
|
||||
ScriptVersion = 1.19.72-win10fix
|
||||
|
||||
; Detect Windows 10
|
||||
if % substr(a_osversion, 1, 2) = 10
|
||||
Windows10:=True
|
||||
|
||||
; Hack WinMove for Windows 10
|
||||
WinSnap(WinTitle, X := "", Y := "", W := "", H := "") {
|
||||
If ((X . Y . W . H) = "") ;
|
||||
Return False
|
||||
WinGet, hWnd, ID, %WinTitle% ; taken from Coco's version
|
||||
If !(hWnd)
|
||||
Return False
|
||||
DL := DT := DR := DB := 0
|
||||
VarSetCapacity(RC, 16, 0)
|
||||
DllCall("GetWindowRect", "Ptr", hWnd, "Ptr", &RC)
|
||||
WL := NumGet(RC, 0, "Int"), WT := NumGet(RC, 4, "Int"), WR := NumGet(RC, 8, "Int"), WB := NumGet(RC, 12, "Int")
|
||||
If (DllCall("Dwmapi.dll\DwmGetWindowAttribute", "Ptr", hWnd, "UInt", 9, "Ptr", &RC, "UInt", 16) = 0) { ; S_OK = 0
|
||||
FL := NumGet(RC, 0, "Int"), FT := NumGet(RC, 4, "Int"), FR := NumGet(RC, 8, "Int"), FB := NumGet(RC, 12, "Int")
|
||||
DL := WL - FL, DT := WT - FT, DR := WR - FR, DB := WB - FB
|
||||
}
|
||||
X := X <> "" ? X + DL : WL, Y := Y <> "" ? Y + DT : WT
|
||||
W := W <> "" ? W - DL + DR : WR - WL, H := H <> "" ? H - DT + DB: WB - WT
|
||||
Return DllCall("MoveWindow", "Ptr", hWnd, "Int", X, "Int", Y, "Int", W, "Int", H, "UInt", 1)
|
||||
}
|
||||
|
||||
MutexExists("GridMove_XB032")
|
||||
|
||||
@ -651,7 +675,10 @@ SnapWindow:
|
||||
if ShouldUseSizeMoveMessage(WinClass)
|
||||
SendMessage WM_ENTERSIZEMOVE, , , ,ahk_id %windowid%
|
||||
|
||||
WinMove, ahk_id %windowid%, ,%GridLeft%,%GridTop%,%GridWidth%,%GridHeight%,
|
||||
if Windows10
|
||||
WinSnap("ahk_id" windowid, GridLeft,GridTop, GridWidth, GridHeight)
|
||||
else
|
||||
WinMove, ahk_id %windowid%, ,%GridLeft%,%GridTop%,%GridWidth%,%GridHeight%,
|
||||
|
||||
if ShouldUseSizeMoveMessage(WinClass)
|
||||
SendMessage WM_EXITSIZEMOVE, , , ,ahk_id %windowid%
|
||||
|
Loading…
x
Reference in New Issue
Block a user