Revised "Monitor_toggleWindowTag" and ...

"View_activateWindow" in regards to absolute and relative value setting
This commit is contained in:
joten 2015-01-28 19:42:07 +01:00
parent b014a72284
commit 8455ec1b60
6 changed files with 52 additions and 62 deletions

View file

@ -14,6 +14,8 @@
`View_setMY` and `View_rotateLayoutAxis`
4. `~` Revised the following functions to allow setting absolute and relative values: `Debug_setLogLevel`, `Monitor_activateView`,
`Monitor_setWindowTag`, `View_setLayout`, `View_setMFactor`, `View_shuffleWindow`
5. `~` Revised the interface, i. e. the parameters, of the following functions for setting absolute and relative values -- but did
not implement the functionality: `Monitor_toggleWindowTag`, `View_activateWindow`
| # | Configuration variables | `-` Hotkey functions | `+` Hotkey functions |
| --:| ----------------------- | --------------------------------------- | ----------------------------------------------------- |
@ -37,6 +39,8 @@
| | | `#+Up::View_shuffleWindow(-1)` | `#+Up::View_shuffleWindow(0, -1)` |
| | | `#+Enter::View_shuffleWindow(0)` | `#+Enter::View_shuffleWindow(1)` |
| | | `#+0::Monitor_setWindowTag(0)` | `#+0::Monitor_setWindowTag(10)` |
| 5. | | `#Down::View_activateWindow(+1)` | `#Down::View_activateWindow(0, +1)` |
| | | `#Up::View_activateWindow(-1)` | `#Up::View_activateWindow(0, -1)` |
### 8.4.0

View file

@ -18,10 +18,10 @@ quitting bug.n.
### Window management
`#Down::View_activateWindow(+1)`
`#Down::View_activateWindow(0, +1)`
> Activate the next window in the active view.
`#Up::View_activateWindow(-1)`
`#Up::View_activateWindow(0, -1)`
> Activate the previous window in the active view.
`#+Down::View_shuffleWindow(0, +1)`

View file

@ -383,8 +383,8 @@ Config_UI_saveSession() {
;; Key definitions
;; Window management
#Down::View_activateWindow(+1)
#Up::View_activateWindow(-1)
#Down::View_activateWindow(0, +1)
#Up::View_activateWindow(0, -1)
#+Down::View_shuffleWindow(0, +1)
#+Up::View_shuffleWindow(0, -1)
#+Enter::View_shuffleWindow(1)

View file

@ -185,19 +185,19 @@ Manager_cleanup()
}
Manager_closeWindow() {
Local aView, aWndId, c
Local aView, aWndId, wndId0, wndIds
WinGet, aWndId, ID, A
If Window_isProg(aWndId) {
;; Prior to closing, find the next window that should have focus.
;; If there is no such window, choose the bar on the same monitor.
aView := Monitor_#%Manager_aMonitor%_aView_#1
StringSplit, c, View_#%Manager_aMonitor%_#%aView%_wndIds, `;
If (c0 < 3) {
StringTrimRight, wndIds, View_#%Manager_aMonitor%_#%aView%_wndIds, 1
StringSplit, wndId, wndIds, `;
If (wndId0 >= 2)
View_activateWindow(0, +1)
Else
Manager_winActivate(0)
} Else {
View_activateWindow(1)
}
Window_close(aWndId)
}
}
@ -480,7 +480,7 @@ WINDOW_NOTICE := 32774
Windows events can't always be caught.
*/
Manager_onShellMessage(wParam, lParam) {
Local a, isChanged, aWndClass, aWndHeight, aWndId, aWndTitle, aWndWidth, aWndX, aWndY, m, t, wndClass, wndId, wndIds, wndPName, wndTitle, x, y
Local a, isChanged, aWndClass, aWndHeight, aWndId, aWndTitle, aWndWidth, aWndX, aWndY, m, t, wndClass, wndId, wndId0, wndIds, wndPName, wndTitle, x, y
SetFormat, Integer, hex
lParam := lParam+0
@ -828,7 +828,7 @@ Manager_saveState() {
}
Manager_saveWindowState(filename, nm, nv) {
Local allWndId, allWndIds, process, title, text, monitor, wndId, view, isManaged, isTitleHidden
Local allWndId0, allWndIds, process, title, text, monitor, wndId, view, isManaged, isTitleHidden
text := "; bug.n - tiling window management`n; @version " VERSION "`n`n"
@ -1010,7 +1010,7 @@ Manager_sizeWindow() {
;; No windows are known to the system yet.
;; Try to do something smart with the initial layout.
Manager_initial_sync(doRestore) {
Local wndId0, wnd, wndX, wndY, wndW, wndH, x, y, m, len
Local wndId, wndId0, wnd, wndX, wndY, wndW, wndH, x, y, m, len
;; Initialize lists
;; Note that these variables make this function non-reentrant.
@ -1110,20 +1110,18 @@ Manager_unmanage(wndId) {
;; Find the next window that should have focus.
;; If there is no such window, choose the bar on the same monitor.
aView := Monitor_#%Manager_aMonitor%_aView_#1
wndIds := View_#%Manager_aMonitor%_#%aView%_wndIds
StringTrimRight, wndIds, View_#%Manager_aMonitor%_#%aView%_wndIds, 1
StringSplit, wndId, wndIds, `;
If (wndId0 < 3)
Manager_winActivate(0)
If (wndId0 >= 2)
View_activateWindow(0, +1)
Else
View_activateWindow(1)
Manager_winActivate(0)
;; Do our best to make sure that any unmanaged windows are left visible.
Window_show(wndId)
a := Window_#%wndId%_tags & 1 << Monitor_#%Manager_aMonitor%_aView_#1 - 1
Loop, % Config_viewCount
{
If (Window_#%wndId%_tags & 1 << A_Index - 1)
{
a := Window_#%wndId%_tags & 1 << aView - 1
Loop, % Config_viewCount {
If (Window_#%wndId%_tags & 1 << A_Index - 1) {
StringReplace, View_#%Manager_aMonitor%_#%A_Index%_wndIds, View_#%Manager_aMonitor%_#%A_Index%_wndIds, %wndId%`;,
Bar_updateView(Manager_aMonitor, A_Index)
}

View file

@ -317,38 +317,31 @@ Monitor_toggleTaskBar()
}
}
Monitor_toggleWindowTag(t)
{
Monitor_toggleWindowTag(i, d = 0) {
Local aWndId, wndId
WinGet, aWndId, ID, A
If (InStr(Manager_managedWndIds, aWndId ";") And t >= 0 And t <= Config_viewCount)
{
If (Window_#%aWndId%_tags & (1 << t - 1))
{
If Not ((Window_#%aWndId%_tags - (1 << t - 1)) = 0)
{
Window_#%aWndId%_tags -= 1 << t - 1
StringReplace, View_#%Manager_aMonitor%_#%t%_wndIds, View_#%Manager_aMonitor%_#%t%_wndIds, %aWndId%`;,
Bar_updateView(Manager_aMonitor, t)
If (t = Monitor_#%Manager_aMonitor%_aView_#1)
{
If (InStr(Manager_managedWndIds, aWndId ";") And i >= 0 And i <= Config_viewCount) {
If (Window_#%aWndId%_tags & (1 << i - 1)) {
If Not ((Window_#%aWndId%_tags - (1 << i - 1)) = 0) {
Window_#%aWndId%_tags -= 1 << i - 1
StringReplace, View_#%Manager_aMonitor%_#%i%_wndIds, View_#%Manager_aMonitor%_#%i%_wndIds, %aWndId%`;,
Bar_updateView(Manager_aMonitor, i)
If (i = Monitor_#%Manager_aMonitor%_aView_#1) {
Manager_hideShow := True
Window_hide(aWndId)
Manager_hideShow := False
wndId := SubStr(View_#%Manager_aMonitor%_#%t%_wndIds, 1, InStr(View_#%Manager_aMonitor%_#%t%_wndIds, ";")-1)
wndId := SubStr(View_#%Manager_aMonitor%_#%i%_wndIds, 1, InStr(View_#%Manager_aMonitor%_#%i%_wndIds, ";")-1)
Manager_winActivate(wndId)
If Config_dynamicTiling
View_arrange(Manager_aMonitor, t)
View_arrange(Manager_aMonitor, i)
}
}
}
Else
{
View_#%Manager_aMonitor%_#%t%_wndIds := aWndId ";" View_#%Manager_aMonitor%_#%t%_wndIds
View_#%Manager_aMonitor%_#%t%_aWndId := aWndId
Bar_updateView(Manager_aMonitor, t)
Window_#%aWndId%_tags += 1 << t - 1
} Else {
View_#%Manager_aMonitor%_#%i%_wndIds := aWndId ";" View_#%Manager_aMonitor%_#%i%_wndIds
View_#%Manager_aMonitor%_#%i%_aWndId := aWndId
Bar_updateView(Manager_aMonitor, i)
Window_#%aWndId%_tags += 1 << i - 1
}
}
}

View file

@ -35,11 +35,10 @@ View_init(m, v)
View_#%m%_#%v%_wndIds := ""
}
View_activateWindow(d)
{
Local aWndId, direction, failure, i, j, v, wndId, wndId0, wndIds
View_activateWindow(i, d = 0) {
Local aWndId, direction, failure, j, v, wndId, wndId0, wndIds
Debug_logMessage("DEBUG[1] View_activateWindow(" . d . ")", 1)
Debug_logMessage("DEBUG[1] View_activateWindow(" . i . ", " . d . ")", 1)
If (d = 0)
Return
@ -50,29 +49,25 @@ View_activateWindow(d)
StringTrimRight, wndIds, View_#%Manager_aMonitor%_#%v%_wndIds, 1
StringSplit, wndId, wndIds, `;
Debug_logMessage("DEBUG[2] wndId count: " . wndId0, 2, False)
If (wndId0 > 1)
{
If (wndId0 > 1) {
If Window_#%aWndId%_isFloating
Window_set(aWndId, "Bottom", "")
Loop, % wndId0
{
If (wndId%A_Index% = aWndId)
{
i := A_Index
Loop, % wndId0 {
If (wndId%A_Index% = aWndId) {
j := A_Index
Break
}
}
Debug_logMessage("DEBUG[2] Current wndId index: " . i, 2, False)
Debug_logMessage("DEBUG[2] Current wndId index: " . j, 2, False)
If (d > 0)
direction = 1
Else
direction = -1
j := Manager_loop(i, d, 1, wndId0)
Loop, % wndId0
{
Debug_logMessage("DEBUG[2] Next wndId index: " . j, 2, False)
wndId := wndId%j%
i := Manager_loop(j, d, 1, wndId0)
Loop, % wndId0 {
Debug_logMessage("DEBUG[2] Next wndId index: " . i, 2, False)
wndId := wndId%i%
Window_set(wndId, "AlwaysOnTop", "On")
Window_set(wndId, "AlwaysOnTop", "Off")
@ -80,7 +75,7 @@ View_activateWindow(d)
failure := Manager_winActivate(wndId)
If Not failure
Break
j := Manager_loop(j, direction, 1, wndId0)
i := Manager_loop(i, direction, 1, wndId0)
}
}
}