Re-implemented "View_shuffleWindow"
... regarding the setting of absolute and relative values
This commit is contained in:
parent
f9cfc8e5f5
commit
74dffa9792
5 changed files with 52 additions and 57 deletions
|
@ -11,7 +11,7 @@
|
|||
1. `~` Renamed the function `Manager_toggleDecor` to `Window_toggleDecor`
|
||||
2. `~` Renamed the function `View_toggleFloating` to `View_toggleFloatingWindow`
|
||||
3. `~` Migrated the following functions to `View_setLayoutProperty`: `View_setGapWidth`, `View_setMFactor`, `View_setMX`, `View_setMY` and `View_rotateLayoutAxis`
|
||||
4. `~` Re-implemented the following functions to allow setting absolute and relative values: `Debug_setLogLevel`, `View_setLayout`, `View_setMFactor`
|
||||
4. `~` Re-implemented the following functions to allow setting absolute and relative values: `Debug_setLogLevel`, `View_setLayout`, `View_setMFactor`, `View_shuffleWindow`
|
||||
|
||||
| # | Configuration variables | Hotkeys |
|
||||
| --:| ----------------------- | --------------------------------------------------------- |
|
||||
|
@ -47,6 +47,12 @@
|
|||
| | | `+` `#^d::Debug_setLogLevel(0, -1)` |
|
||||
| | | `-` `#^+d::Debug_setLogLevel(+1)` |
|
||||
| | | `+` `#^+d::Debug_setLogLevel(0, +1)` |
|
||||
| | | `-` `#+Down::View_shuffleWindow(+1)` |
|
||||
| | | `+` `#+Down::View_shuffleWindow(0, +1)` |
|
||||
| | | `-` `#+Up::View_shuffleWindow(-1)` |
|
||||
| | | `+` `#+Up::View_shuffleWindow(0, -1)` |
|
||||
| | | `-` `#+Enter::View_shuffleWindow(0)` |
|
||||
| | | `+` `#+Enter::View_shuffleWindow(1)` |
|
||||
|
||||
### 8.4.0
|
||||
|
||||
|
|
|
@ -24,14 +24,16 @@ quitting bug.n.
|
|||
`#Up::View_activateWindow(-1)`
|
||||
> Activate the previous window in the active view.
|
||||
|
||||
`#+Down::View_shuffleWindow(+1)`
|
||||
`#+Down::View_shuffleWindow(0, +1)`
|
||||
> Move the active window to the next position in the window list of the view.
|
||||
|
||||
`#+Up::View_shuffleWindow(-1)`
|
||||
`#+Up::View_shuffleWindow(0, -1)`
|
||||
> Move the active window to the previous position in the window list of the view.
|
||||
|
||||
`#+Enter::View_shuffleWindow(0)`
|
||||
`#+Enter::View_shuffleWindow(1)`
|
||||
> Move the active window to the first position in the window list of the view.
|
||||
You may also move the active window to any other absolute position in the
|
||||
window list by using the first parameter.
|
||||
|
||||
`#c::Manager_closeWindow()`
|
||||
> Close the active window.
|
||||
|
|
|
@ -385,9 +385,9 @@ Config_UI_saveSession() {
|
|||
;; Window management
|
||||
#Down::View_activateWindow(+1)
|
||||
#Up::View_activateWindow(-1)
|
||||
#+Down::View_shuffleWindow(+1)
|
||||
#+Up::View_shuffleWindow(-1)
|
||||
#+Enter::View_shuffleWindow(0)
|
||||
#+Down::View_shuffleWindow(0, +1)
|
||||
#+Up::View_shuffleWindow(0, -1)
|
||||
#+Enter::View_shuffleWindow(1)
|
||||
#c::Manager_closeWindow()
|
||||
#+d::Window_toggleDecor()
|
||||
#+f::View_toggleFloatingWindow()
|
||||
|
|
|
@ -884,6 +884,18 @@ Manager_saveWindowState(filename, nm, nv) {
|
|||
FileMove, %tmpfname%, %filename%, 1
|
||||
}
|
||||
|
||||
Manager_serCursor(wndId) {
|
||||
Local wndHeight, wndWidth, wndX, wndY
|
||||
|
||||
If Config_mouseFollowsFocus {
|
||||
If wndId {
|
||||
WinGetPos, wndX, wndY, wndWidth, wndHeight, ahk_id %wndId%
|
||||
DllCall("SetCursorPos", "Int", Round(wndX + wndWidth / 2), "Int", Round(wndY + wndHeight / 2))
|
||||
} Else
|
||||
DllCall("SetCursorPos", "Int", Round(Monitor_#%Manager_aMonitor%_x + Monitor_#%Manager_aMonitor%_width / 2), "Int", Round(Monitor_#%Manager_aMonitor%_y + Monitor_#%Manager_aMonitor%_height / 2))
|
||||
}
|
||||
}
|
||||
|
||||
Manager_setViewMonitor(d)
|
||||
{
|
||||
Local aView, aWndId, m, v, wndIds
|
||||
|
@ -1129,16 +1141,7 @@ Manager_unmanage(wndId) {
|
|||
}
|
||||
|
||||
Manager_winActivate(wndId) {
|
||||
Local wndHeight, wndWidth, wndX, wndY
|
||||
|
||||
If Config_mouseFollowsFocus {
|
||||
If wndId {
|
||||
WinGetPos, wndX, wndY, wndWidth, wndHeight, ahk_id %wndId%
|
||||
DllCall("SetCursorPos", "Int", Round(wndX + wndWidth / 2), "Int", Round(wndY + wndHeight / 2))
|
||||
} Else
|
||||
DllCall("SetCursorPos", "Int", Round(Monitor_#%Manager_aMonitor%_x + Monitor_#%Manager_aMonitor%_width / 2), "Int", Round(Monitor_#%Manager_aMonitor%_y + Monitor_#%Manager_aMonitor%_height / 2))
|
||||
}
|
||||
|
||||
Manager_serCursor(wndId)
|
||||
Debug_logMessage("DEBUG[1] Activating window: " wndId, 1)
|
||||
If Not wndId {
|
||||
If (A_OSVersion = "WIN_8")
|
||||
|
|
64
src/View.ahk
64
src/View.ahk
|
@ -171,6 +171,7 @@ View_getTiledWndIds(m, v)
|
|||
tiledWndIds .= A_LoopField ";"
|
||||
}
|
||||
}
|
||||
View_tiledWndIds := tiledWndIds
|
||||
StringTrimRight, tiledWndIds, tiledWndIds, 1
|
||||
StringSplit, View_tiledWndId, tiledWndIds, `;
|
||||
|
||||
|
@ -197,10 +198,7 @@ View_moveWindow(i=0, d=0) {
|
|||
i := Manager_loop(Window_#%aWndId%_area, d, 1, View_#%m%_#%v%_area_#0)
|
||||
Window_move(aWndId, View_#%m%_#%v%_area_#%i%_x, View_#%m%_#%v%_area_#%i%_y, View_#%m%_#%v%_area_#%i%_width, View_#%m%_#%v%_area_#%i%_height)
|
||||
Window_#%aWndId%_area := i
|
||||
If Config_mouseFollowsFocus {
|
||||
WinGetPos, aWndX, aWndY, aWndWidth, aWndHeight, ahk_id %aWndId%
|
||||
DllCall("SetCursorPos", "Int", Round(aWndX + aWndWidth / 2), "Int", Round(aWndY + aWndHeight / 2))
|
||||
}
|
||||
Manager_serCursor(aWndId)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -266,50 +264,36 @@ View_setLayoutProperty(name, i, d, opt = 0) {
|
|||
}
|
||||
}
|
||||
|
||||
View_shuffleWindow(d)
|
||||
{
|
||||
Local aWndHeight, aWndId, aWndWidth, aWndX, aWndY, i, j, search, v
|
||||
View_shuffleWindow(i, d = 0) {
|
||||
Local aWndId, j, replace, v
|
||||
|
||||
WinGet, aWndId, ID, A
|
||||
Debug_logMessage("DEBUG[2] View_shuffleWindow(" . i . ", " . d . ")", 2)
|
||||
v := Monitor_#%Manager_aMonitor%_aView_#1
|
||||
If Tiler_isActive(Manager_aMonitor, v) And InStr(Manager_managedWndIds, aWndId ";")
|
||||
{
|
||||
If Tiler_isActive(Manager_aMonitor, v) {
|
||||
View_getTiledWndIds(Manager_aMonitor, v)
|
||||
If (View_tiledWndId0 > 1)
|
||||
{
|
||||
Loop, % View_tiledWndId0
|
||||
{
|
||||
If (View_tiledWndId%A_Index% = aWndId)
|
||||
{
|
||||
i := A_Index
|
||||
WinGet, aWndId, ID, A
|
||||
If InStr(View_tiledWndIds, aWndId ";") And (View_tiledWndId0 > 1) {
|
||||
Loop, % View_tiledWndId0 {
|
||||
If (View_tiledWndId%A_Index% = aWndId) {
|
||||
j := A_Index
|
||||
Break
|
||||
}
|
||||
}
|
||||
If (d = 0 And i = 1)
|
||||
j := 2
|
||||
Else
|
||||
j := Manager_loop(i, d, 1, View_tiledWndId0)
|
||||
If (j > 0 And j <= View_tiledWndId0)
|
||||
{
|
||||
If (j = i)
|
||||
{
|
||||
StringReplace, View_#%Manager_aMonitor%_#%v%_wndIds, View_#%Manager_aMonitor%_#%v%_wndIds, %aWndId%`;,
|
||||
View_#%Manager_aMonitor%_#%v%_wndIds := aWndId ";" View_#%Manager_aMonitor%_#%v%_wndIds
|
||||
}
|
||||
If (i = 0)
|
||||
i := j
|
||||
Else If (i = 1 And j = 1)
|
||||
i := 2
|
||||
i := Manager_loop(i, d, 1, View_tiledWndId0)
|
||||
Debug_logMessage("DEBUG[2] View_shuffleWindow: " . j . " -> " . i, 2)
|
||||
If (i != j) {
|
||||
If (i < j)
|
||||
replace := aWndId ";" View_tiledWndId%i% ";"
|
||||
Else
|
||||
{
|
||||
search := View_tiledWndId%j%
|
||||
StringReplace, View_#%Manager_aMonitor%_#%v%_wndIds, View_#%Manager_aMonitor%_#%v%_wndIds, %aWndId%, SEARCH
|
||||
StringReplace, View_#%Manager_aMonitor%_#%v%_wndIds, View_#%Manager_aMonitor%_#%v%_wndIds, %search%, %aWndId%
|
||||
StringReplace, View_#%Manager_aMonitor%_#%v%_wndIds, View_#%Manager_aMonitor%_#%v%_wndIds, SEARCH, %search%
|
||||
}
|
||||
replace := View_tiledWndId%i% ";" aWndId ";"
|
||||
StringReplace, View_#%Manager_aMonitor%_#%v%_wndIds, View_#%Manager_aMonitor%_#%v%_wndIds, % aWndId ";",
|
||||
StringReplace, View_#%Manager_aMonitor%_#%v%_wndIds, View_#%Manager_aMonitor%_#%v%_wndIds, % View_tiledWndId%i% ";", %replace%
|
||||
View_arrange(Manager_aMonitor, v)
|
||||
|
||||
If Config_mouseFollowsFocus
|
||||
{
|
||||
WinGetPos, aWndX, aWndY, aWndWidth, aWndHeight, ahk_id %aWndId%
|
||||
DllCall("SetCursorPos", "Int", Round(aWndX + aWndWidth / 2), "Int", Round(aWndY + aWndHeight / 2))
|
||||
}
|
||||
Manager_serCursor(aWndId)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue