Revert "Possibly fixed the bug from issue #27"

This reverts commit 67ab683436.
This commit is contained in:
joten 2015-02-27 21:57:10 +01:00
parent 67ab683436
commit 4f7120be7b
5 changed files with 38 additions and 55 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 title is not hidden on the bug.n status bar and no window action is taken, when
the window first is created. the window first is created.
`Config_rule_#2=.*;.*;Window_isElevated;0;0;0;1;1;0;` `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;`
> Windows created by applications run as administrator cannot be managed by > 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 bug.n and are therefor excluded. If a higher numbered rule also covers elevated
windows, it would precede rule #2 and therefor needs to be followed by an windows, it would precede rule #4 and therefor needs to be followed by an
additional rule, which again would exclude those windows identified by the additional rule, which again would exclude those windows identified by the
rule, but which are elevated. 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;` `Config_rule_#5=QWidget;.*;;1;0;0;0;0;0;`
> Windows created by QT (QWidget) have the style WS_POPUP, but should be > Windows created by QT (QWidget) have the style WS_POPUP, but should be
excluded from rule #4. excluded from the preceding rule.
`Config_rule_#6=SWT_Window0;.*;;1;0;0;0;0;0;` `Config_rule_#6=SWT_Window0;.*;;1;0;0;0;0;0;`
> Also windows created by Java (SWT) e. g. Eclipse should be excluded from rule > Also windows created by Java (SWT) e. g. Eclipse should be excluded from the
#4 for the same reason as above. second rule for the same reason as above.
`Config_rule_#7=Xming;.*;;1;0;0;0;0;0;` `Config_rule_#7=Xming;.*;;1;0;0;0;0;0;`
> Also Xming windows should be excluded from rule #4 for the same reason as > Also Xming windows should be excluded from the second rule for the same
above. reason as above.
`Config_rule_#8=CabinetWClass;.*;;1;0;0;0;1;0;` `Config_rule_#8=CabinetWClass;.*;;1;0;0;0;1;0;`
> Windows Explorer. If the window's title bar is hidden, it looks distorted. > 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;` `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. > Chrome web browser. If the window's title bar is hidden, it looks distorted.
`Config_rule_#11=Chrome_WidgetWin_1;.*;Window_isPopup;0;0;0;1;1;0;` `Config_rule_#11=Chrome_WidgetWin_1;.*;Window_isPopup;1;0;0;1;1;0;`
> With the preceding rule overriding #2 Chrome pop-up windows would be treated > With the preceding rule overriding #2 Chrome pop-up windows would be treated
as new main windows. 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_#<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_#1 := ".*;.*;;1;0;0;0;0;0;"
Config_rule_#2 := ".*;.*;Window_isElevated;0;0;0;1;1;0;" Config_rule_#2 := ".*;.*;Window_isChild;1;0;0;1;1;0;"
Config_rule_#3 := ".*;.*;Window_isNotVisible;0;0;0;1;1;0;" Config_rule_#3 := ".*;.*;Window_isPopup;0;0;0;1;1;0;"
Config_rule_#4 := ".*;.*;Window_isPopup;0;0;0;1;1;0;" Config_rule_#4 := ".*;.*;Window_isElevated;0;0;0;1;1;0;"
Config_rule_#5 := "QWidget;.*;;1;0;0;0;0;0;" Config_rule_#5 := "QWidget;.*;;1;0;0;0;0;0;"
Config_rule_#6 := "SWT_Window0;.*;;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_#7 := "Xming;.*;;1;0;0;0;0;0;"
Config_rule_#8 := "CabinetWClass;.*;;1;0;0;0;1;0;" Config_rule_#8 := "CabinetWClass;.*;;1;0;0;0;1;0;"
Config_rule_#9 := "OperationStatusWindow;.*;;1;0;0;1;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_#10 := "Chrome_WidgetWin_1;.*;;1;0;0;0;1;0;"
Config_rule_#11 := "Chrome_WidgetWin_1;.*;Window_isPopup;0;0;0;1;1;0;" Config_rule_#11 := "Chrome_WidgetWin_1;.*;Window_isPopup;1;0;0;1;1;0;"
Config_rule_#12 := "Chrome_RenderWidgetHostHWND;.*;;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_#13 := "IEFrame;.*Internet Explorer;;1;0;0;0;1;0;"
Config_rule_#14 := "MozillaWindowClass;.*Mozilla Firefox;;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 Local wndIds
Debug_logMessage("Window dump for manager") Debug_logMessage("Window dump for manager")
Debug_logMessage("ID `tH W A F D R G M Tags`tX `tY `tW `tH `tStyle `tProc / Class / Title", 0, False) Debug_logMessage("ID`t`tH W A F D R G M`tTags`tX`tY`tW`tH`tStyle`t`tProc / Class / Title", 0, False)
StringTrimRight, wndIds, Manager_managedWndIds, 1 StringTrimRight, wndIds, Manager_managedWndIds, 1
Loop, PARSE, wndIds, `; Loop, PARSE, wndIds, `;
@ -77,15 +77,16 @@ Debug_logMessage(text, level = 1, includeTimestamp = True)
} }
} }
Debug_logViewWindowList() { Debug_logViewWindowList()
{
Local v, wndIds Local v, wndIds
v := Monitor_#%Manager_aMonitor%_aView_#1 v := Monitor_#%Manager_aMonitor%_aView_#1
Debug_logMessage("Window dump for active view (" . Manager_aMonitor . ", " . v . ")") Debug_logMessage("Window dump for active view (" . Manager_aMonitor . ", " . v . ")")
Debug_logMessage("ID `tH W A F D R G M Tags`tX `tY `tW `tH `tStyle `tProc / Class / Title", 0, False) Debug_logMessage("ID`t`tH W A F D R G M`tTags`tX`tY`tW`tH`tStyle`t`tProc / Class / Title", 0, False)
StringTrimRight, wndIds, View_#%Manager_aMonitor%_#%v%_wndIds, 1 StringTrimRight, wndIds, View_#%Manager_aMonitor%_#%v%_wndIds, 1
Loop, Parse, wndIds, `; Loop, PARSE, wndIds, `;
{ {
Debug_logWindowInfo(A_LoopField) Debug_logWindowInfo(A_LoopField)
} }
@ -141,7 +142,7 @@ Debug_logWindowInfo(wndId)
text := wndId "`t" text := wndId "`t"
text .= isHidden " " isWinFocus " " isBugnActive " " isFloating " " isDecorated " " isResponsive " " isGhost " " text .= isHidden " " isWinFocus " " isBugnActive " " isFloating " " isDecorated " " isResponsive " " isGhost " "
text .= Window_#%wndId%_monitor " " Window_#%wndId%_tags " `t" text .= Window_#%wndId%_monitor "`t" Window_#%wndId%_tags "`t"
text .= wndX "`t" wndY "`t" wndW "`t" wndH "`t" wndStyle "`t" wndPName " [" wndPId "] / " wndClass " / " wndTitle text .= wndX "`t" wndY "`t" wndW "`t" wndH "`t" wndStyle "`t" wndPName " [" wndPId "] / " wndClass " / " wndTitle
Debug_logMessage(text , 0, False) 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) { Manager_applyRules(wndId, ByRef isManaged, ByRef m, ByRef tags, ByRef isFloating, ByRef isDecorated, ByRef hideTitle, ByRef action) {
Local i, mouseX, mouseY, wndClass, wndTitle Local i, mouseX, mouseY, wndClass, wndHeight, wndTitle, wndWidth, wndX, wndY
Local rule0, rule1, rule2, rule3, rule4, rule5, rule6, rule7, rule8, rule9, rule10 Local rule0, rule1, rule2, rule3, rule4, rule5, rule6, rule7, rule8, rule9, rule10
isManaged := True isManaged := True
@ -102,6 +102,7 @@ Manager_applyRules(wndId, ByRef isManaged, ByRef m, ByRef tags, ByRef isFloating
WinGetClass, wndClass, ahk_id %wndId% WinGetClass, wndClass, ahk_id %wndId%
WinGetTitle, wndTitle, ahk_id %wndId% WinGetTitle, wndTitle, ahk_id %wndId%
WinGetPos, wndX, wndY, wndWidth, wndHeight, ahk_id %wndId%
If (wndClass Or wndTitle) { If (wndClass Or wndTitle) {
Loop, % Config_ruleCount { Loop, % Config_ruleCount {
;; The rules are traversed in reverse order. ;; The rules are traversed in reverse order.
@ -124,7 +125,7 @@ Manager_applyRules(wndId, ByRef isManaged, ByRef m, ByRef tags, ByRef isFloating
If wndTitle If wndTitle
hideTitle := True 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, 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 ", x: " wndX ", y: " wndY, 3)
} }
Manager_cleanup() Manager_cleanup()
@ -548,14 +549,14 @@ Manager_onShellMessage(wParam, lParam) {
;; MISSED MESSAGES? FIND ADDITIONAL WINDOWS. ;; MISSED MESSAGES? FIND ADDITIONAL WINDOWS.
;; !! THIS CODE CURRENTLY DOES SOME AWEFUL THINGS! ;; !! THIS CODE CURRENTLY DOES SOME AWEFUL THINGS!
WinGet, wndId, List, , , ; WinGet, wndId, List, , ,
Loop, % wndId { ; Loop, % wndId {
If Not InStr(Manager_allWndIds, wndId%A_Index% ";") { ; If Not InStr(Manager_allWndIds, wndId%A_Index% ";") {
a := Manager_manage(Manager_aMonitor, Monitor_#%Manager_aMonitor%_aView_#1, wndId%A_Index%) ; a := Manager_manage(Manager_aMonitor, Monitor_#%Manager_aMonitor%_aView_#1, wndId%A_Index%)
If a ; If a
updateView := a ; updateView := a
} ; }
} ; }
;; IN MOST CASES DO THE FOLLOWING. ;; IN MOST CASES DO THE FOLLOWING.
If updateView { If updateView {

View File

@ -27,13 +27,6 @@ Window_activate(wndId) {
} }
} }
Window_clipsSiblings(wndId) {
WS_CLIPSIBLINGS = 0x04000000
WinGet, wndStyle, Style, ahk_id %wndId%
Return, (wndStyle & WS_CLIPSIBLINGS)
}
Window_close(wndId) { Window_close(wndId) {
If Window_isHung(wndId) { If Window_isHung(wndId) {
Debug_logMessage("DEBUG[2] Window_close: Potentially hung window " . wndId, 2) Debug_logMessage("DEBUG[2] Window_close: Potentially hung window " . wndId, 2)
@ -78,7 +71,7 @@ Window_isChild(wndId) {
WS_POPUP = 0x40000000 WS_POPUP = 0x40000000
WinGet, wndStyle, Style, ahk_id %wndId% WinGet, wndStyle, Style, ahk_id %wndId%
Return, (wndStyle & WS_POPUP) Return, wndStyle & WS_POPUP
} }
Window_isElevated(wndId) { Window_isElevated(wndId) {
@ -133,18 +126,6 @@ Window_isHung(wndId) {
Return, 0 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) { Window_isPopup(wndId) {
WS_POPUP = 0x80000000 WS_POPUP = 0x80000000
WinGet, wndStyle, Style, ahk_id %wndId% WinGet, wndStyle, Style, ahk_id %wndId%