- Keep a reference to each window's expected monitor. Using the screen position can cause windows to switch sides under the right circumstances.
- Some comments to help keep the onShellMessage function straight. - Repositioned SetWinDelay calls to get better effect for everything. - Fixed a bug where a windows activation of a window on another monitor would cause weird behavior.
This commit is contained in:
parent
986669f69a
commit
b36b640aad
3 changed files with 14 additions and 14 deletions
|
@ -331,6 +331,7 @@ Manager_manage(pm, pv, wndId) {
|
||||||
Monitor_moveWindow(m, wndId)
|
Monitor_moveWindow(m, wndId)
|
||||||
|
|
||||||
Manager_managedWndIds .= wndId ";"
|
Manager_managedWndIds .= wndId ";"
|
||||||
|
Manager_#%wndId%_monitor := m
|
||||||
Manager_#%wndId%_tags := tags
|
Manager_#%wndId%_tags := tags
|
||||||
Manager_#%wndId%_isDecorated := isDecorated
|
Manager_#%wndId%_isDecorated := isDecorated
|
||||||
Manager_#%wndId%_isFloating := isFloating
|
Manager_#%wndId%_isFloating := isFloating
|
||||||
|
@ -439,9 +440,7 @@ Manager_onShellMessage(wParam, lParam) {
|
||||||
isChanged := False
|
isChanged := False
|
||||||
|
|
||||||
If a Or isChanged {
|
If a Or isChanged {
|
||||||
SetWinDelay, 0
|
|
||||||
View_arrange(Manager_aMonitor, Monitor_#%Manager_aMonitor%_aView_#1)
|
View_arrange(Manager_aMonitor, Monitor_#%Manager_aMonitor%_aView_#1)
|
||||||
SetWinDelay, 10
|
|
||||||
Bar_updateView(Manager_aMonitor, Monitor_#%Manager_aMonitor%_aView_#1)
|
Bar_updateView(Manager_aMonitor, Monitor_#%Manager_aMonitor%_aView_#1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -454,19 +453,24 @@ Manager_onShellMessage(wParam, lParam) {
|
||||||
|
|
||||||
If wndIds {
|
If wndIds {
|
||||||
If (Config_onActiveHiddenWnds = "view") {
|
If (Config_onActiveHiddenWnds = "view") {
|
||||||
|
; Grab the first of such windows and make it visible.
|
||||||
|
; All others get forgotten (until the next round?)
|
||||||
wndId := SubStr(wndIds, 1, InStr(wndIds, ";") - 1)
|
wndId := SubStr(wndIds, 1, InStr(wndIds, ";") - 1)
|
||||||
Loop, % Config_viewCount
|
Loop, % Config_viewCount
|
||||||
If (Manager_#%wndId%_tags & 1 << A_Index - 1) {
|
If (Manager_#%wndId%_tags & 1 << A_Index - 1) {
|
||||||
|
Manager_aMonitor := Manager_#%wndId%_monitor
|
||||||
Monitor_activateView(A_Index)
|
Monitor_activateView(A_Index)
|
||||||
Break
|
Break
|
||||||
}
|
}
|
||||||
} Else {
|
} Else {
|
||||||
StringTrimRight, wndIds, wndIds, 1
|
StringTrimRight, wndIds, wndIds, 1
|
||||||
StringSplit, wndId, wndIds, `;
|
StringSplit, wndId, wndIds, `;
|
||||||
|
; Otherwise re-hide them.
|
||||||
If (Config_onActiveHiddenWnds = "hide") {
|
If (Config_onActiveHiddenWnds = "hide") {
|
||||||
Loop, % wndId0
|
Loop, % wndId0
|
||||||
WinHide, % "ahk_id " wndId%A_Index%
|
WinHide, % "ahk_id " wndId%A_Index%
|
||||||
} Else If (Config_onActiveHiddenWnds = "tag") {
|
} Else If (Config_onActiveHiddenWnds = "tag") {
|
||||||
|
; Or tag all of them for the current view.
|
||||||
t := Monitor_#%Manager_aMonitor%_aView_#1
|
t := Monitor_#%Manager_aMonitor%_aView_#1
|
||||||
Loop, % wndId0 {
|
Loop, % wndId0 {
|
||||||
wndId := wndId%A_Index%
|
wndId := wndId%A_Index%
|
||||||
|
@ -661,6 +665,7 @@ Manager_unmanage(wndId) {
|
||||||
View_delWnd( Manager_aMonitor, A_Index, wndId )
|
View_delWnd( Manager_aMonitor, A_Index, wndId )
|
||||||
Bar_updateView(Manager_aMonitor, A_Index)
|
Bar_updateView(Manager_aMonitor, A_Index)
|
||||||
}
|
}
|
||||||
|
Manager_#%wndId%_monitor :=
|
||||||
Manager_#%wndId%_tags :=
|
Manager_#%wndId%_tags :=
|
||||||
Manager_#%wndId%_isDecorated :=
|
Manager_#%wndId%_isDecorated :=
|
||||||
Manager_#%wndId%_isFloating :=
|
Manager_#%wndId%_isFloating :=
|
||||||
|
|
|
@ -81,10 +81,12 @@ Monitor_activateView(v) {
|
||||||
Loop, PARSE, wndIds, `;
|
Loop, PARSE, wndIds, `;
|
||||||
If Not (Manager_#%A_LoopField%_tags & (1 << v - 1))
|
If Not (Manager_#%A_LoopField%_tags & (1 << v - 1))
|
||||||
WinHide, ahk_id %A_LoopField%
|
WinHide, ahk_id %A_LoopField%
|
||||||
|
SetWinDelay, 10
|
||||||
DetectHiddenWindows, On
|
DetectHiddenWindows, On
|
||||||
View_arrange(m, v)
|
View_arrange(m, v)
|
||||||
DetectHiddenWindows, Off
|
DetectHiddenWindows, Off
|
||||||
StringTrimRight, wndIds, View_#%m%_#%v%_wndIds, 1
|
StringTrimRight, wndIds, View_#%m%_#%v%_wndIds, 1
|
||||||
|
SetWinDelay, 0
|
||||||
Loop, PARSE, wndIds, `;
|
Loop, PARSE, wndIds, `;
|
||||||
WinShow, ahk_id %A_LoopField%
|
WinShow, ahk_id %A_LoopField%
|
||||||
SetWinDelay, 10
|
SetWinDelay, 10
|
||||||
|
@ -177,19 +179,9 @@ Monitor_getWorkArea(m) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Monitor_moveWindow(m, wndId) {
|
Monitor_moveWindow(m, wndId) {
|
||||||
Local fX, fY, monitor, wndHeight, wndWidth, wndX, wndY
|
Global
|
||||||
|
|
||||||
WinGetPos, wndX, wndY, wndWidth, wndHeight, ahk_id %wndId%
|
Manager_#%wndId%_monitor = m
|
||||||
monitor := Monitor_get(wndX+wndWidth/2, wndY+wndHeight/2)
|
|
||||||
If Not (m = monitor) {
|
|
||||||
; move the window to the target monitor and scale it, if it does not fit on the monitor
|
|
||||||
fX := Monitor_#%m%_width / Monitor_#%monitor%_width
|
|
||||||
fY := Monitor_#%m%_height / Monitor_#%monitor%_height
|
|
||||||
If (wndX-Monitor_#%monitor%_x+wndWidth > Monitor_#%m%_width) Or (wndY-Monitor_#%monitor%_y+wndHeight > Monitor_#%m%_height)
|
|
||||||
Manager_winMove(wndId, Monitor_#%m%_x+fX*(wndX-Monitor_#%monitor%_x), Monitor_#%m%_y+fY*(wndY-Monitor_#%monitor%_y), fX*wndWidth, fY*wndHeight)
|
|
||||||
Else
|
|
||||||
Manager_winMove(wndId, Monitor_#%m%_x+(wndX-Monitor_#%monitor%_x), Monitor_#%m%_y+(wndY-Monitor_#%monitor%_y), wndWidth, wndHeight)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Monitor_setWindowTag(t) {
|
Monitor_setWindowTag(t) {
|
||||||
|
|
|
@ -109,12 +109,15 @@ View_delWnd(m, v, wndId) {
|
||||||
View_arrange(m, v) {
|
View_arrange(m, v) {
|
||||||
Local fn, l, wndIds
|
Local fn, l, wndIds
|
||||||
|
|
||||||
|
; All window actions are performed on independent windows. A delay won't help.
|
||||||
|
SetWinDelay, 0
|
||||||
l := View_#%m%_#%v%_layout_#1
|
l := View_#%m%_#%v%_layout_#1
|
||||||
fn := Config_layoutFunction_#%l%
|
fn := Config_layoutFunction_#%l%
|
||||||
View_getTiledWndIds(m, v, wndIds)
|
View_getTiledWndIds(m, v, wndIds)
|
||||||
View_arrange_%fn%(m, v, wndIds)
|
View_arrange_%fn%(m, v, wndIds)
|
||||||
View_updateLayout(m, v)
|
View_updateLayout(m, v)
|
||||||
Bar_updateLayout(m)
|
Bar_updateLayout(m)
|
||||||
|
SetWinDelay, 10
|
||||||
}
|
}
|
||||||
|
|
||||||
View_getTiledWndIds(m, v, ByRef tiledWndIds) {
|
View_getTiledWndIds(m, v, ByRef tiledWndIds) {
|
||||||
|
|
Loading…
Reference in a new issue