Fixed bug in multi-monitor bug.n command GUI ...

... positioning
+ fixed minor redrawing problem of the bug.n bar
+ fixed bug in bug.n Bar_GuiClick and Bar_GUIContextMenu monitor
calculation
This commit is contained in:
joten 2015-02-01 14:39:46 +01:00
parent be8e4a68c3
commit 8ca47284e1
3 changed files with 37 additions and 15 deletions

View file

@ -284,12 +284,12 @@ Bar_GuiClick:
If (A_GuiEvent = "Normal") { If (A_GuiEvent = "Normal") {
If (SubStr(A_GuiControl, -13) = "_shebang_event") { If (SubStr(A_GuiControl, -13) = "_shebang_event") {
If Not Bar_cmdGuiIsVisible If Not Bar_cmdGuiIsVisible
If Not (SubStr(A_GuiControl, 6, InStr(A_GuiControl, "_#", False, 0) - 6) = Manager_aMonitor) If Not (SubStr(A_GuiControl, 6, InStr(A_GuiControl, "_", False, 6) - 6) = Manager_aMonitor)
Manager_activateMonitor(SubStr(A_GuiControl, 6, InStr(A_GuiControl, "_#", False, 0) - 6)) Manager_activateMonitor(SubStr(A_GuiControl, 6, InStr(A_GuiControl, "_", False, 6) - 6))
Bar_toggleCommandGui() Bar_toggleCommandGui()
} Else { } Else {
If Not (SubStr(A_GuiControl, 6, InStr(A_GuiControl, "_#", False, 0) - 6) = Manager_aMonitor) If Not (SubStr(A_GuiControl, 6, InStr(A_GuiControl, "_", False, 6) - 6) = Manager_aMonitor)
Manager_activateMonitor(SubStr(A_GuiControl, 6, InStr(A_GuiControl, "_#", False, 0) - 6)) Manager_activateMonitor(SubStr(A_GuiControl, 6, InStr(A_GuiControl, "_", False, 6) - 6))
If (SubStr(A_GuiControl, -12) = "_layout_event") If (SubStr(A_GuiControl, -12) = "_layout_event")
View_setLayout(-1) View_setLayout(-1)
Else If InStr(A_GuiControl, "_view_#") And (SubStr(A_GuiControl, -5) = "_event") Else If InStr(A_GuiControl, "_view_#") And (SubStr(A_GuiControl, -5) = "_event")
@ -302,12 +302,12 @@ Bar_GuiContextMenu:
Manager_winActivate(Bar_aWndId) Manager_winActivate(Bar_aWndId)
If (A_GuiEvent = "RightClick") { If (A_GuiEvent = "RightClick") {
If (SubStr(A_GuiControl, -12) = "_layout_event") { If (SubStr(A_GuiControl, -12) = "_layout_event") {
If Not (SubStr(A_GuiControl, 6, InStr(A_GuiControl, "_#", False, 0) - 6) = Manager_aMonitor) If Not (SubStr(A_GuiControl, 6, InStr(A_GuiControl, "_", False, 6) - 6) = Manager_aMonitor)
Manager_activateMonitor(SubStr(A_GuiControl, 6, InStr(A_GuiControl, "_#", False, 0) - 6)) Manager_activateMonitor(SubStr(A_GuiControl, 6, InStr(A_GuiControl, "_", False, 6) - 6))
View_setLayout(0, +1) View_setLayout(0, +1)
} Else If InStr(A_GuiControl, "_view_#") And (SubStr(A_GuiControl, -5) = "_event") { } Else If InStr(A_GuiControl, "_view_#") And (SubStr(A_GuiControl, -5) = "_event") {
If Not (SubStr(A_GuiControl, 6, InStr(A_GuiControl, "_#", False, 0) - 6) = Manager_aMonitor) If Not (SubStr(A_GuiControl, 6, InStr(A_GuiControl, "_", False, 6) - 6) = Manager_aMonitor)
Manager_setWindowMonitor(SubStr(A_GuiControl, 6, InStr(A_GuiControl, "_#", False, 0) - 6)) Manager_setWindowMonitor(SubStr(A_GuiControl, 6, InStr(A_GuiControl, "_", False, 6) - 6))
Monitor_setWindowTag(SubStr(A_GuiControl, InStr(A_GuiControl, "_view_#", False, 0) + 7, 1)) Monitor_setWindowTag(SubStr(A_GuiControl, InStr(A_GuiControl, "_view_#", False, 0) + 7, 1))
} }
} }
@ -342,8 +342,8 @@ Bar_toggleCommandGui()
Else Else
{ {
Bar_cmdGuiIsVisible := True Bar_cmdGuiIsVisible := True
x := Monitor_#%Manager_aMonitor%_barX + Monitor_#%Manager_aMonitor%_barWidth - Bar_#0_#0W x := Monitor_#%Manager_aMonitor%_x + Monitor_#%Manager_aMonitor%_barX + Monitor_#%Manager_aMonitor%_barWidth - Bar_#0_#0W
If (Config_verticalBarPos = "top") Or (Config_verticalBarPos = "tray") And (Manager_taskBarPos = "top" Or Not Monitor_#%Manager_aMonitor%_taskBarClass) If (Config_verticalBarPos = "top") Or (Config_verticalBarPos = "tray") And (Monitor_%Manager_aMonitor%_taskBarPos = "top" Or Not Monitor_#%Manager_aMonitor%_taskBarClass)
y := Monitor_#%Manager_aMonitor%_y y := Monitor_#%Manager_aMonitor%_y
Else Else
y := Monitor_#%Manager_aMonitor%_y + Monitor_#%Manager_aMonitor%_height - Bar_#0_#0H y := Monitor_#%Manager_aMonitor%_y + Monitor_#%Manager_aMonitor%_height - Bar_#0_#0H
@ -375,6 +375,13 @@ Bar_updateLayout(m) {
GuiControl, %GuiN%: , Bar_#%m%_layout, % View_#%m%_#%aView%_layoutSymbol GuiControl, %GuiN%: , Bar_#%m%_layout, % View_#%m%_#%aView%_layoutSymbol
} }
Bar_updateStatic(m) {
Local GuiN
GuiN := (m - 1) + 1
GuiControl, %GuiN%: , Bar_#%m%_shebang, #!
}
Bar_updateStatus() { Bar_updateStatus() {
Local anyContent, anyText, bat1, bat2, bat3, GuiN, m, mute, vol Local anyContent, anyText, bat1, bat2, bat3, GuiN, m, mute, vol
@ -484,7 +491,7 @@ Bar_updateView(m, v) {
GuiControl, +c%Config_fontColor_#1_#1%, Bar_#%m%_view_#%v% GuiControl, +c%Config_fontColor_#1_#1%, Bar_#%m%_view_#%v%
} }
Loop, %Config_viewCount% { Loop, % Config_viewCount {
StringTrimRight, wndIds, View_#%m%_#%A_Index%_wndIds, 1 StringTrimRight, wndIds, View_#%m%_#%A_Index%_wndIds, 1
StringSplit, wndId, wndIds, `; StringSplit, wndId, wndIds, `;
GuiControl, , Bar_#%m%_view_#%A_Index%_highlighted, % wndId0 / managedWndId0 * 100 ;; Update the percentage fill for the view. GuiControl, , Bar_#%m%_view_#%A_Index%_highlighted, % wndId0 / managedWndId0 * 100 ;; Update the percentage fill for the view.

View file

@ -476,7 +476,7 @@ WINDOW_NOTICE := 32774
Windows events can't always be caught. Windows events can't always be caught.
*/ */
Manager_onShellMessage(wParam, lParam) { Manager_onShellMessage(wParam, lParam) {
Local a, isChanged, aWndClass, aWndHeight, aWndId, aWndTitle, aWndWidth, aWndX, aWndY, m, t, wndClass, wndId, wndId0, wndIds, wndPName, wndTitle, x, y Local a, isChanged, aWndClass, aWndHeight, aWndId, aWndTitle, aWndWidth, aWndX, aWndY, i, m, t, wndClass, wndId, wndId0, wndIds, wndPName, wndTitle, x, y
SetFormat, Integer, hex SetFormat, Integer, hex
lParam := lParam+0 lParam := lParam+0
@ -592,6 +592,20 @@ Manager_onShellMessage(wParam, lParam) {
} }
} }
;; This is a workaround for a redrawing problem of the bug.n bar, which
;; seems to get lost, when windows are created or destroyed under the
;; following conditions.
If (Manager_monitorCount > 1) And (Config_verticalBarPos = "tray") {
Loop, % (Manager_monitorCount - 1) {
i := A_Index + 1
Bar_updateLayout(i)
Bar_updateStatic(i)
Loop, % Config_viewCount
Bar_updateView(i, A_Index)
}
Bar_updateStatus()
Bar_updateTitle()
} Else
Bar_updateTitle() Bar_updateTitle()
} }
} }

View file

@ -21,6 +21,7 @@ Monitor_init(m, doRestore) {
Monitor_#%m%_showBar := Config_showBar Monitor_#%m%_showBar := Config_showBar
Monitor_#%m%_showTaskBar := Config_showTaskBar Monitor_#%m%_showTaskBar := Config_showTaskBar
Monitor_#%m%_taskBarClass := "" Monitor_#%m%_taskBarClass := ""
Monitor_%m%_taskBarPos := ""
Loop, % Config_viewCount Loop, % Config_viewCount
View_init(m, A_Index) View_init(m, A_Index)
If doRestore If doRestore
@ -148,8 +149,8 @@ Monitor_getWorkArea(m) {
;; Top ;; Top
wndHeight += wndY - monitorTop wndHeight += wndY - monitorTop
monitorTop += wndHeight monitorTop += wndHeight
If (A_LoopField = "Shell_TrayWnd") If (A_LoopField = "Shell_TrayWnd") Or (A_LoopField = "Shell_SecondaryTrayWnd")
Manager_taskBarPos := "top" Monitor_%m%_taskBarPos := "top"
} Else { } Else {
;; Bottom ;; Bottom
wndHeight := monitorBottom - wndY wndHeight := monitorBottom - wndY