Possibly fixed the bug from issue #27

+ Reverted commit 433634c12f
+ Added a rule for "Window_isNotVisible"
This commit is contained in:
joten 2015-02-21 16:43:20 +01:00
parent 433634c12f
commit 67ab683436
5 changed files with 55 additions and 38 deletions

View file

@ -275,32 +275,32 @@ view, not floating (i. e. tiled), the window title bar is not visible, the
title is not hidden on the bug.n status bar and no window action is taken, when
the window first is created.
`Config_rule_#2=.*;.*;Window_isChild;1;0;0;1;1;0;`
> Child windows (style WS_CHILD) will not be managed, are floating and the
titles are hidden.
`Config_rule_#3=.*;.*;Window_isPopup;0;0;0;1;1;0;`
> Pop-up windows (style WS_POPUP) will not be managed, are floating and the
titles are hidden.
`Config_rule_#4=.*;.*;Window_isElevated;0;0;0;1;1;0;`
`Config_rule_#2=.*;.*;Window_isElevated;0;0;0;1;1;0;`
> Windows created by applications run as administrator cannot be managed by
bug.n and are therefor excluded. If a higher numbered rule also covers elevated
windows, it would precede rule #4 and therefor needs to be followed by an
windows, it would precede rule #2 and therefor needs to be followed by an
additional rule, which again would exclude those windows identified by the
rule, but which are elevated.
`Config_rule_#3=.*;.*;Window_isNotVisible;0;0;0;1;1;0;`
> Windows, which are not visible (i. a. do not have the style WS_VISIBLE), will
not be managed, are floating and have a title bar.
`Config_rule_#4=.*;.*;Window_isPopup;0;0;0;1;1;0;`
> Pop-up windows (style WS_POPUP) will not be managed, are floating and have a
title bar.
`Config_rule_#5=QWidget;.*;;1;0;0;0;0;0;`
> Windows created by QT (QWidget) have the style WS_POPUP, but should be
excluded from the preceding rule.
excluded from rule #4.
`Config_rule_#6=SWT_Window0;.*;;1;0;0;0;0;0;`
> Also windows created by Java (SWT) e. g. Eclipse should be excluded from the
second rule for the same reason as above.
> Also windows created by Java (SWT) e. g. Eclipse should be excluded from rule
#4 for the same reason as above.
`Config_rule_#7=Xming;.*;;1;0;0;0;0;0;`
> Also Xming windows should be excluded from the second rule for the same
reason as above.
> Also Xming windows should be excluded from rule #4 for the same reason as
above.
`Config_rule_#8=CabinetWClass;.*;;1;0;0;0;1;0;`
> Windows Explorer. If the window's title bar is hidden, it looks distorted.
@ -312,7 +312,7 @@ windows.
`Config_rule_#10=Chrome_WidgetWin_1;.*;;1;0;0;0;1;0;`
> Chrome web browser. If the window's title bar is hidden, it looks distorted.
`Config_rule_#11=Chrome_WidgetWin_1;.*;Window_isPopup;1;0;0;1;1;0;`
`Config_rule_#11=Chrome_WidgetWin_1;.*;Window_isPopup;0;0;0;1;1;0;`
> With the preceding rule overriding #2 Chrome pop-up windows would be treated
as new main windows.

View file

@ -80,16 +80,16 @@ Config_init() {
;; Config_rule_#<i> := "<class>;<title>;<function name>;<is managed>;<m>;<tags>;<is floating>;<is decorated>;<hide title>;<action>"
Config_rule_#1 := ".*;.*;;1;0;0;0;0;0;"
Config_rule_#2 := ".*;.*;Window_isChild;1;0;0;1;1;0;"
Config_rule_#3 := ".*;.*;Window_isPopup;0;0;0;1;1;0;"
Config_rule_#4 := ".*;.*;Window_isElevated;0;0;0;1;1;0;"
Config_rule_#2 := ".*;.*;Window_isElevated;0;0;0;1;1;0;"
Config_rule_#3 := ".*;.*;Window_isNotVisible;0;0;0;1;1;0;"
Config_rule_#4 := ".*;.*;Window_isPopup;0;0;0;1;1;0;"
Config_rule_#5 := "QWidget;.*;;1;0;0;0;0;0;"
Config_rule_#6 := "SWT_Window0;.*;;1;0;0;0;0;0;"
Config_rule_#7 := "Xming;.*;;1;0;0;0;0;0;"
Config_rule_#8 := "CabinetWClass;.*;;1;0;0;0;1;0;"
Config_rule_#9 := "OperationStatusWindow;.*;;1;0;0;1;1;0;"
Config_rule_#10 := "Chrome_WidgetWin_1;.*;;1;0;0;0;1;0;"
Config_rule_#11 := "Chrome_WidgetWin_1;.*;Window_isPopup;1;0;0;1;1;0;"
Config_rule_#11 := "Chrome_WidgetWin_1;.*;Window_isPopup;0;0;0;1;1;0;"
Config_rule_#12 := "Chrome_RenderWidgetHostHWND;.*;;0;0;0;1;1;0;"
Config_rule_#13 := "IEFrame;.*Internet Explorer;;1;0;0;0;1;0;"
Config_rule_#14 := "MozillaWindowClass;.*Mozilla Firefox;;1;0;0;0;1;0;"

View file

@ -51,7 +51,7 @@ Debug_logManagedWindowList()
Local wndIds
Debug_logMessage("Window dump for manager")
Debug_logMessage("ID`t`tH W A F D R G M`tTags`tX`tY`tW`tH`tStyle`t`tProc / Class / Title", 0, False)
Debug_logMessage("ID `tH W A F D R G M Tags`tX `tY `tW `tH `tStyle `tProc / Class / Title", 0, False)
StringTrimRight, wndIds, Manager_managedWndIds, 1
Loop, PARSE, wndIds, `;
@ -77,16 +77,15 @@ Debug_logMessage(text, level = 1, includeTimestamp = True)
}
}
Debug_logViewWindowList()
{
Debug_logViewWindowList() {
Local v, wndIds
v := Monitor_#%Manager_aMonitor%_aView_#1
Debug_logMessage("Window dump for active view (" . Manager_aMonitor . ", " . v . ")")
Debug_logMessage("ID`t`tH W A F D R G M`tTags`tX`tY`tW`tH`tStyle`t`tProc / Class / Title", 0, False)
Debug_logMessage("ID `tH W A F D R G M Tags`tX `tY `tW `tH `tStyle `tProc / Class / Title", 0, False)
StringTrimRight, wndIds, View_#%Manager_aMonitor%_#%v%_wndIds, 1
Loop, PARSE, wndIds, `;
Loop, Parse, wndIds, `;
{
Debug_logWindowInfo(A_LoopField)
}
@ -142,7 +141,7 @@ Debug_logWindowInfo(wndId)
text := wndId "`t"
text .= isHidden " " isWinFocus " " isBugnActive " " isFloating " " isDecorated " " isResponsive " " isGhost " "
text .= Window_#%wndId%_monitor "`t" Window_#%wndId%_tags "`t"
text .= Window_#%wndId%_monitor " " Window_#%wndId%_tags " `t"
text .= wndX "`t" wndY "`t" wndW "`t" wndH "`t" wndStyle "`t" wndPName " [" wndPId "] / " wndClass " / " wndTitle
Debug_logMessage(text , 0, False)
}

View file

@ -89,7 +89,7 @@ Manager_activateMonitor(i, d = 0) {
}
Manager_applyRules(wndId, ByRef isManaged, ByRef m, ByRef tags, ByRef isFloating, ByRef isDecorated, ByRef hideTitle, ByRef action) {
Local i, mouseX, mouseY, wndClass, wndHeight, wndTitle, wndWidth, wndX, wndY
Local i, mouseX, mouseY, wndClass, wndTitle
Local rule0, rule1, rule2, rule3, rule4, rule5, rule6, rule7, rule8, rule9, rule10
isManaged := True
@ -102,7 +102,6 @@ Manager_applyRules(wndId, ByRef isManaged, ByRef m, ByRef tags, ByRef isFloating
WinGetClass, wndClass, ahk_id %wndId%
WinGetTitle, wndTitle, ahk_id %wndId%
WinGetPos, wndX, wndY, wndWidth, wndHeight, ahk_id %wndId%
If (wndClass Or wndTitle) {
Loop, % Config_ruleCount {
;; The rules are traversed in reverse order.
@ -125,7 +124,7 @@ Manager_applyRules(wndId, ByRef isManaged, ByRef m, ByRef tags, ByRef isFloating
If wndTitle
hideTitle := True
}
Debug_logMessage("DEBUG[3] Manager_applyRules(wndId: " wndId ", isManaged: " isManaged ", m: " m ", tags: " tags ", isFloating: " isFloating ", isDecorated: " isDecorated ", hideTitle: " hideTitle ", action: " action "); class: " wndClass ", title: " wndTitle ", x: " wndX ", y: " wndY, 3)
Debug_logMessage("DEBUG[3] Manager_applyRules(wndId: " wndId ", isManaged: " isManaged ", m: " m ", tags: " tags ", isFloating: " isFloating ", isDecorated: " isDecorated ", hideTitle: " hideTitle ", action: " action "); class: " wndClass ", title: " wndTitle, 3)
}
Manager_cleanup()
@ -549,14 +548,14 @@ Manager_onShellMessage(wParam, lParam) {
;; MISSED MESSAGES? FIND ADDITIONAL WINDOWS.
;; !! THIS CODE CURRENTLY DOES SOME AWEFUL THINGS!
; WinGet, wndId, List, , ,
; Loop, % wndId {
; If Not InStr(Manager_allWndIds, wndId%A_Index% ";") {
; a := Manager_manage(Manager_aMonitor, Monitor_#%Manager_aMonitor%_aView_#1, wndId%A_Index%)
; If a
; updateView := a
; }
; }
WinGet, wndId, List, , ,
Loop, % wndId {
If Not InStr(Manager_allWndIds, wndId%A_Index% ";") {
a := Manager_manage(Manager_aMonitor, Monitor_#%Manager_aMonitor%_aView_#1, wndId%A_Index%)
If a
updateView := a
}
}
;; IN MOST CASES DO THE FOLLOWING.
If updateView {

View file

@ -27,6 +27,13 @@ Window_activate(wndId) {
}
}
Window_clipsSiblings(wndId) {
WS_CLIPSIBLINGS = 0x04000000
WinGet, wndStyle, Style, ahk_id %wndId%
Return, (wndStyle & WS_CLIPSIBLINGS)
}
Window_close(wndId) {
If Window_isHung(wndId) {
Debug_logMessage("DEBUG[2] Window_close: Potentially hung window " . wndId, 2)
@ -71,7 +78,7 @@ Window_isChild(wndId) {
WS_POPUP = 0x40000000
WinGet, wndStyle, Style, ahk_id %wndId%
Return, wndStyle & WS_POPUP
Return, (wndStyle & WS_POPUP)
}
Window_isElevated(wndId) {
@ -126,6 +133,18 @@ Window_isHung(wndId) {
Return, 0
}
Window_isNotVisible(wndId) {
WS_VISIBLE = 0x10000000
WinGet, wndStyle, Style, ahk_id %wndId%
If (wndStyle & WS_VISIBLE) {
WinGetPos, wndX, wndY, wndW, wndH, ahk_id %wndId%
hasDimensions := wndW And wndH
isOnMonitor := Monitor_get(wndX, wndY) Or Monitor_get(wndX + wndW, wndY) Or Monitor_get(wndX + wndW, wndY + wndH) Or Monitor_get(wndX, wndY + wndH)
Return, (Not hasDimensions Or Not isOnMonitor)
} Else
Return, True
}
Window_isPopup(wndId) {
WS_POPUP = 0x80000000
WinGet, wndStyle, Style, ahk_id %wndId%