RamonUnch / AltSnap

Maintained continuation of Stefan Sundin's AltDrag
GNU General Public License v3.0
2.21k stars 74 forks source link

Long drag-free move/resize not working #392

Closed RamonUnch closed 1 year ago

RamonUnch commented 1 year ago

Got it. However I cannot activate this functionality (1.59, win11) -- nothing happens if I alt-click and hold, and release.

I do see the mouse pointer blink if I long click any title bar (but still, nothing happens).

https://github.com/RamonUnch/AltSnap/pull/391

Originally posted by @yatli in https://github.com/RamonUnch/AltSnap/issues/35#issuecomment-1471508812

RamonUnch commented 1 year ago

This is strange, @yatli Could you give me a copy of your ini file? because I cannot reproduce (not using Win11 however).

Also you can try to set DragThreshold=2 or 3, because otherwise, the least amount of movement will prevent the action and this can be difficult not to move at all with some setups.

in the [Advanced] section
DragThreshold=1
; Require a small drag before actually starting a movement.
; Set to 0 to disable (like for AtSnap 1.58 and below)
; Set to 1 to have a drag threshold for maximized/snapped windows only (default).
; Set to 2 to always have a drag threshold.
; Set to 3 to have a drag threshold even when resizing the window.
yatli commented 1 year ago

Here's the ini file:

; Disable and enable AltSnap to refresh configuration.
; Created for AltSnap v1.57

[General]
AutoFocus=0
; Automatically raises and focuses the windows you drag.

Aero=1
; Mimics Windows 7+ Aero Snap behavior.
; Drag windows to the left, right, top, or bottom side of the monitor.
; Corners work too! Hold Ctrl to trap the mouse cursor within the current
; monitor for easier snapping when using multiple monitors.

SmartAero=1
; If set to 1 (default), AltSnap will adjust the dimensions of
; a snapped window to other resized snapped windows.
; If set to 0, disabled, restores the old AltDrag behavior.
; If 2 is added, AltSnap will be smarter and snap to more windows.
; If 4 is added, AltSnapped windows will never be restored.

StickyResize=0
; If set to 1 or 3, other windows that are snapped to the current one
; can be resized by holding the Shift key.
; If set to 2, The above is done without the Shift key (Shift will disable it instead).
; If set to 0, sticky resizing is disabled.

MMMaximize=1
; Set the way MouseMove can maximize default is 1.
; If set to 1, to use resize/move combo (default).
; If set to 2, restores a window on a single left click instead of a drag.
; If set to 3, does both of the above (like the original AltDrag).
; If set to 0, disabled, does none of the above.

AeroHoffset=50
AeroVoffset=50
; Horizontal and vertical position (from top left in percent) where the aero
; windows will meet default is 50 50, at the center of the monitor.
; If you set AeroHoffset=33, for example, the windows snapped
; on the left will use only 33% of the monitor width, those on the right will
; have the remaining 67%. I strongly advise you to play around with this if
; you use Aero snapping...

InactiveScroll=0
; Adds the ability to scroll inactive windows. Hold shift to scroll horizontally.
; DO NOT USE under Windows 10/11, it is reserved for Win 8 and previous.

AutoSnap=2
; Makes a window automatically snap to other windows, without the need to press shift.
; List of settings:
; 0: Disabled.
; 1: Automatically snaps to the screen borders and the taskbar.
; 2: Also automatically snaps to the outside of windows.
; 3: Also automatically snaps to the inside of windows.

MDI=1
; Enables support for MDI windows (Multiple Document Interface), e.g. mIRC.
; A blacklist can be set to prevent this behavior on some windows (see below)

ResizeCenter=1
; 0: Bottom right mode will be used at the center.
; 1: Enables the center "All directions" mode for resizing (default).
; 2: The windows will be moved instead.
; 3: The closest side mode will be used at the center.

CenterFraction=24
; A fraction in a percent from 0 to 100 that defines the size of the central
; resizing region (default is 24), used to be 33% in AltDrag beta.

MoveTrans=255
; Transparency from 1-254, which is set to the window that is currently
; moved/resized. Lower values are more transparent.
; If set to 0 or 255, the feature is disabled (default is 255).

Language=zh-CN
SidesFraction=255
; Available languages: en-US (English), fr-FR (French), pl-PL (Polish) etc...
; Default is Auto for automatic selection based on local.

[Input]

UniKeyHoldMenu=0
; If enabled, then a long key press will popup a menu with a list of
; extended/unicode characters that can be typed.

LMB=Move
MMB=Menu
RMB=Resize
MB4=Nothing
MB5=Nothing
Scroll=Transparency
HScroll=Nothing
; Mouse actions for Left, Middle, and Right mouse buttons (MB), MB4,5 and wheel.
; List: Nothing, Move, Resize, Menu, Minimize, Maximize
; Center, AlwaysOnTop, Close, Lower, Borderless
; Kill, Pause, Resume, MaximizeHV, MinAllOther, Mute, SideSnap,
; NStacked, NStacked2, PStacked, PStacked2, StackList, StackList2, ASOnOff, MoveOnOff
; MLZone, MTZone, MRZone, MBZone XLZone, XTZone, XRZone, XBZone
; Wheel actions : Roll, AltTab, Volume, Transparency, HScroll
; Zoom, Zoom2, NPStacked,
; When moving and resizing windows, hold shift to snap to other windows.
; For Volume, Transparency and Zoom, try holding shift to adjust the speed.

LMBB=Move
MMBB=AltTabList
RMBB=Nothing
MB4B=Nothing
MB5B=Nothing
ScrollB=Nothing
HScrollB=Nothing
; Alternative action for each button (used when the ModKey is pressed).

LMBT=Nothing
MMBT=Lower
RMBT=Nothing
MB4T=Nothing
MB5T=Nothing
ScrollT=Roll
HScrollT=Nothing
; Actions to be performed in the titlebar,
; with or without Alt, see TTBActions.
LMBTB=Nothing
MMBTB=Nothing
RMBTB=Nothing
MB4TB=Nothing
MB5TB=Nothing
ScrollTB=Nothing
HScrollTB=Nothing
; Alternate titlebar actions (.ini only)

GrabWithAlt=Nothing
GrabWithAltB=Nothing
; Substitute Nothing with a hotkey, so you can perform the action
; without needing to click. This is useful for touchpads.
; Try with GrabWithAlt=Resize and set ResizeCenter=2 and CenterFraction=60

MoveUp=Nothing
MoveUpT=Nothing
ResizeUp=Nothing
ResizeUpT=Nothing
MoveUpB=Nothing
ResizeUpB=Nothing
; Actions that will be performed on the click UP even of a Move/Resize
; IF no drag occured AND the click was long or PiercingClick=1.
; The B sufixed version apply if the ModKey is down, as usual.
; /!\ Those actions are not associated with buttons but with Move/Resize.

TTBActions=0
; Perform specific actions when clicking in the titlebar
; If set to 1, to perform the action without Alt
; If set to 2, to perform the action with Alt.
; If set to 3, does both of the above.

ScrollLockState=0
; If set to 1, AltSnap will be disabled when Scroll Lock is OFF.
; If set to 3, AltSnap will be disabled when Scroll Lock is ON.

HScrollKey=10
; List of keys used to transform a vertical scroll into a Horizontal scroll,
; applies only when the InactiveScroll option is used (Old windows versions).
; Default value is 10 ie VK_SHIFT.

Hotkeys=A4 A5
; Space-separated hexadecimal values.
; Quick reminder:
; A4 A5 => Left (A4) and right (A5) ALT
; 5B 5C => Left (5B) and right (5C) WIN
; A0 A1 => Left (A0) and right (A1) SHIFT
; A2 A3 => Left (A2) and right (A3) CTRL
; 70 to 87 => F1 to F24 keys
; Values at: https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes
; You can specify up to 7 keys.

ModKey=
; Modifier keys to use the B action of each button.

Killkeys=09 2E
; Keys that will disable AltSnap when pressed down!
; Space-separated hexadecimal values.
; All keys from A-Z always disable AltSnap, so do not add them here.
; Default is TAB: 09 (for DisplayFusion's Alt+Tab).
; 2E for the DEL key (for Ctrl+Alt+DEL).

Shiftkeys=A0 A1
; Key that is used to snap windows and modify actions
; defaut sis A0 A1 for left and right shift.

EndSendKey=11
; Key sent at the end of a movement to avoid menu selecting because of Alt
; or to avoid poping up the Windows menu when using WinKey as a hotkey.
; Since the original AltDrag the default value is 11 (VK_CONTROL).
; You can try sending other keys or set to 00 to disable key sending.
; You can try WinKey(5C) if you use Alt(12) as a hotkey or vice-versa.
; You can try using some of the undefined VK-codes such as 0E.

Hotclicks=
; Mouse clicks that can be used to trigger AltSnap.
; This can be used together with the Hotkeys or as a replacement.
; Space-separated hexadecimal values.
; Values: MMB=04, MB4=05, MB5=06, MB6=07, MB7=08, MB8=09, MB9=0A,
; MB10=0B, MB11=0C, MB12=0D, MB13=0E, MB14=0F, MB15=10,
; MB16=11, MB17=12
; Just do not try this with LMB and RMB, please....
; For example, I would suggest using MB4 and MB5 ie: Hotclicks=05 06
; And using MB4=Move and MB5=Resize.
; To use MB6-MB9 see the XXButtons section.
XXButtons=
; List of keys that are actually mapped to extra mouse button (6-17)
; You can specify up to 15 values in the button order you prefer.
; Any key specified here will behave like a mouse button for AltSnap.
; Also the key will ALWAYS be unusable outside of AltSnap
; This is intended for mouse buttons that that are mapped by a
; driver to keyboard keys, If possible use keys that does not exist
; on your keyboard ie: F13-F24.
; The extra buttons defined like this are mapped to MB6/7/8/9(B)(T)
; If you set for example XXButtons=7C 7D 7E 7F, then:
; the F13 key will be mapped to MB6, F14 to MB7 etc.
; MB20 is the maximum button. Those buttons can be added to the Hotclicks

KeyCombo=0
; If set to 1, you will actually need to press two hotkeys
; to enable AltSnap (any combination of two hotkeys).
; You need at least TWO hotkeys!
; Does not apply to Hotclicks!

LongClickMove=0
; Turns a long click in a move.
; This is a way to use AltSnap without keyboard.
; Set to 0 to disable (default)
; Set to 1 to enable and long click delay will be double click delay.

FrameColor=80 00 88
; Hexadecimal color of the hollow rectangle that is used when you disabled
; the FullWin option/Show window content while dragging.
; You need to put spaces between each pair of characters (RR GG BB)
; eg: 00 00 00 for black, FF 00 00 for red, 80 00 80 dark violet...

PinColor=FF FF 00 54
LMBM=Nothing
MMBM=Nothing
RMBM=Nothing
MB4M=Nothing
MB5M=Nothing
ScrollM=Nothing
HScrollM=Nothing
; Like FrameColor but concerns the color of the always on top indicator
; The last byte represents the hex ASCII of the letter to be drawn.
; Default is FF FF 00 54 for Yellow with a T (54).

[Blacklist]
; For all blacklists, items must be separated with a comma and without spaces.
; Spaces can be present in the item itself. eg: "Virtual PC.exe"
; Unicode is fully supported for blacklist items in Windows 2000+
; UCS-2 only in Windows NT4.

Processes=Virtual PC.exe,StartMenuExperienceHost.exe,SearchApp.exe,osk.exe
; List of processes (comma separated) that AltSnap will not interfere with

Windows=Program Manager|Progman*|MultitaskingViewFrame,Volume Control|Tray Volume,Volume Control|Windows.UI.Core.CoreWindow,*|TaskSwitcherWnd,*|TaskSwitcherOverlayWnd,|WorkerW,|Shell_TrayWnd,|BaseBar,|#32768,*|XamlExplorerHostIslandWindow,*|TSSHELLWND,|MozillaDropShadowWindowClass,*|RAIL_WINDOW,VistaSwitcher|VistaSwitcher_SwitcherWnd
; List of windows for which AltSnap is completely disabled

Scroll=
; List of windows that should just ignore the scroll action
; eg: *|Photoshop

MDIs=*|PPTFrameClass,*|MMCMainFrame,*|classFoxitReader
; List of windows for which AltSnap ignores MDI option
; Default is Powerpoint, Microsoft Management Console and Foxit.

Pause=taskmgr.exe,explorer.exe,dwm.exe,Virtual PC.exe,AltSnap.exe
; List of processes that will not be paused or killed
; when using the Pause/resume and Kill keyboard actions.

Snaplist=*|BaseWindow_RootWnd,*|SkinWnd,*|ChatSkinWnd,*|SpotifyMainWindow,*|USurface_*,*|Winamp*,*|M4W_MainWindow,*|SunAwtDialog
; List of windows that should be snapped to, even though they have no caption.
; Use Snaplist=*|* if you want to enable snapping to all border-less windows.

MMBLower=*|CASCADIA_HOSTING_WINDOW_CLASS,*|MozillaDialogClass
; List of windows for which the Titlebar action should not be performed.
; default is MS-WindowTerminal and some popup windows of Firefox.

; For Windows, Snaplist and MDIs:
; Three options are offered to you in this case:
; 1) Set the whole title|class windows info.
; 2) Set all windows from this class with ,*|class.
; 3) Set the window title only with ,title|*.
; Use the "Identify window" option in AltSnap Config.

AResize=*|SunAwtDialog
; List of windows that AltSnap should consider as resizeable
; Only applies when ResizeAll=0
; eg: *|SunAwtDialog for MATLAB's help.

SSizeMove=*|iTunes
; List of windows to which the WM_ENTERSIZEMOVE / WM_EXITSIZEMOVE will not
; be sent. Keep the default value unless you know what you are doing.

NCHittest=*|ApplicationFrameWindow
; List of windows for which AltSnap should try directly to question the
; ancestor window for the Hittest, in order to know where the title bar is.
; Default is *|ApplicationFrameWindow for all METRO apps on Win10+

Bottommost=*|RainmeterMeterWindow
; List of windows that should be kept below other Windows that are lowered
; by AltSnap. Default is *|RainmeterMeterWindow for Rainmaker skin windows.

[Advanced]

TopmostIndicator=1
; Show an indicator on the always on top windows

NumberMenuItems=0
; Use numbers instead of a-z for shortcuts in windows list menu.

AutoRemaximize=0
; Automatically re-maximize windows when you move them between monitors.

SnapThreshold=20
; The distance, in number of pixels, when snapping starts (default 20).

AeroThreshold=5
; Distance in pixels, when Aero snapping to monitor sides (default 5).

SnapGap=0
; Gap in pixels from -128 to +127 between two snapped windows.
; Use negative values if you want an overlap, default is 0
; I suggest -1 under Win10.

KBMoveStep=100
KBMoveSStep=20
; Value in pixels from 1-255.
; To change the steps in pixels
; when moving windows with the keyboard

AeroMaxSpeed=65535
AeroSpeedTau=64
; Speed beyond which AeroSnaps will not occur while Moving.
; AeroMaxSpeed is in pixels/Tau (from 0-65535).
; AeroSpeedTau to specifies Tau time in milliseconds (default 64).
; (i) Set AeroMaxSpeed to a "high" value (like 100) and try to move fast
; a window between two monitors, if it gets aero-snapped, decrease the value
; until it no longer snaps, and check that the window still snaps when you
; want it to.

MultipleInstances=0
; If set to 1, allows running multiple instances of AltSnap.

AlwaysElevate=0
; If set to 1, AltSnap will always request elevation.

ResizeAll=1
; If set to 1, all windows are resizable, even those without borders.
; Note that windows that are in the AResize list will still be resizable.
; Also windows that were made borderless by AltSnap will be resizable.

FullScreen=1
; If set to 1, all fullscreen windows are moveable.
; If set to 0, blacklists all fullscreen windows.
; A fullscreen window is set to your monitor size and has no title bar.
; It is not exactly the same than a Maximized window (see below)

BLMaximized=0
; Set to 1 to disable AltSnap on all Maximized windows.
; If set to 0 (default) maximized windows will be restored by AltSnap.
; Not the same thing than "fullscreen" window but looks quite similar.

AeroTopMaximizes=1
; If set to 1, windows get maximized when snapped at the top
; of the monitor instead of being resized to fill its top half.
; If set to 2, Shift behavior will be inverted for double-right-click:
; Aero Snap <-> Extend border to monitor.
; If set to 3, both of the above work.
; You can always hold Shift to invert the behavior.

UseCursor=1
; If set to 0, disables any cursor handling (not recommended).
; If set to 1, enables all cursor sets (default)
; If set to 2, disables the Hand cursor when moving
; If set to 3, normal cursor is always used, even when resizing.
; If set to 4, uses the ResizeAll cursor for movement instead of the Hand.

MinAlpha=32
; Minimum alpha for the transparency action, from 1-255 (default 32).
AlphaDelta=64
AlphaDeltaShift=8
; Alpha step for the transparency action, from -128 to +127 (default 64).
; The other value is applied when Shift is pressed (default 8).

ZoomFrac=16
ZoomFracShift=64
; By which fraction (2-255) the Zoom action should increase/decrease the size
; of the pointed window. ZoomFrac is without shift and ZoomFracShift
; is with shift. Default is 16th/64th (ZoomFrac=16, ZoomFracShift=64).
; Formula: New Window Size = OldSize + OldSize/ZoomFrac

ShiftSnaps=1
; Set to 0 if you do not want border-to-border windows snapping to be
; Enabled by the shift key (default is 1: enabled).

PiercingClick=1
; Set to 1 to enable, in this case, if you press Alt+Click without moving,
; the click will be transmitted to the pointed program.
; Enabling this option will disable doubleclicking actions!
; If you keep it disabled (default) you still will have the click
; transmission if you hold the click down more than a double click delay.

DragSendsAltCtrl=0
; If set to 1, then Alt_Down, Ctrl_Down, Ctrl_Up, Alt_Up will be sent.
; at the begining of a move/resize action, unless Alt is already down.
; This can help to pop down context menu when the drag starts.

BLCapButtons=3
; Mouse Buttons for which the caption buttons will not be considered
; by AltSnap for the Titlebar action.
; Use 0 to include all mouse buttons.
; Use 1 to exclude the left mouse button only.
; Use 3 (1+2) to exclude the left and right mouse buttons (default).
; Use -1 to exclude all mouse buttons and wheel.
; You can specify any value in decimal converted from a bit mask in the order
; of mouse buttons ie: LMB RMB MMB MB4 MB5...MB20 VWHEEL HWHEEL.
; use BLCapButtons=0 if you always want titlebar actions to be applied
; when clicking caption buttons and use -1 if you never want this.
; For a custom value add the numbers corresponding to each mouse button:
; LMB: 1, RMB: 2, MMB: 4, MB4: 8 MB5: 16 MBX: 2^(X-2)
; VWheel: 1048576, HWheel: 2097152 (buttons 21 and 22)
BLUpperBorder=3
; Same than BLCapButtons except that it concerns the top resizing borders
; instead of only the caption buttons. Default value is 3.

ACMenuItems=-1
; Menu items that will be displayed in the action menu (bit-mask).
; Default is -1 for all menu items.
; If you want only a selection of the menu items, pick them up in the list
; below, sum up the associated numbers and assign the value to `ACMenuItems`
; 1      Toggle Always on top
; 2      Toggle Borderless
; 4      Center window on screen
; 8      Roll/Unroll window
; 16     Lower Window
; 32     Maximize vertically
; 64     Minimize other windows
; 128    Snap To side/corner
; 256    ------------------
; 512    Maximize window
; 1024   Minimize window
; 2048   Close window
; 4096   ----------------
; 8192   Kill program
; 16384  -----------------
; 32768  Movement disabled
; 65536  -----------------
; 131072 Send original click
; 262144 Nothing
; Example: 131072+1+2+8=131083 Nothing+Topmost+Borderless+Roll

[Performance]
FullWin=2
; Set to 1 to force the Drag Full Windows option (old default)
; Set to 0 to force off
; Default is 2: autodetect based on Windows setting

TransWinOpacity=0
; Set opacity from 1-255 of the transparent window used when FullWin=0
; default is 0 which mean no transparency is used (best for performance).
; also 255 has good performance but there is zero opacity.
; If you are using desktop composition or Windows 8+ then there will be
; no significant performance impact to any value.

PinRate=32
; Rate in miliseconds from 1-255 at which the always on top indicator
; will be refreshed. Default is 32. Smaller values will make the
; indicator more reactive but will decrease the performances.

RezTimer=0
; Set to 1 to move the window only when the timestamp of
; a mouse event is different from the previous one, every 16ms
; more or less. MoveRate and ResizeRate and RefreshRate
; will have no effect if the option is enabled.
; This is overall the option that gives the best performances.
; It can be combined with FullWin=0 mode for ~0% CPU usage.

RefreshRate=0
; Minimum delay, in milliseconds, between two refreshes of a window.
; For minimum CPU usage use a value around your monitor's rate:
; 75Hz monitor => RefreshRate=13
; Max value is 255 (4 Hz), sane values are below 100 (10 Hz).
; If set to 0 (default), you get the most reactivity.

MoveRate=2
ResizeRate=4
; The number of pixels to wait before actually moving the window.
; If set to 1, updates will be instant. You will have better perf with
; higher values but you will lose precision in moving/resizing.
; Sane values are below 10. Recommended is 1 to 5

[Zones]
UseZones=0
; If set to 1, enables Snap Layouts (Zones)
; If set to 3, enables Grid mode (configure below)
; If 4 is added window is extended without Ctrl.
; If 8 is added snapping will occur without Shift ie: 1+8 => UseZones=9.
; Shift will disable Zones instead.
; recomended is UseZones=1 or 9 for normal snap Layout with or w/o shift
; and 3+4 => UseZones=7 for grid mode.

; If you set UseZones to 3 or 7 then you enabled the
; GRID MODE that simply cuts each screen into 'parts'.
; You can set the number of parts below:
GridNx=3
; Number of grid columns
GridNy=2
; Number of grid lines

InterZone=32
; Size in pixels between zones from -128 to +127 (default 32)
; where the window will be snapped to the union of zones.
; If set to 0, you cannot cover more than one zone.

FancyZone=0
; If set to 1, enables better FancyZones integration (x64 builds only!).
; Windows snapped by FancyZones will be restored by AltDrag.

Zone0=
Zone1=
Zone2=
Zone3=
Zone4=
Zone5=
; List of zones coordinates LEFT,TOP,RIGHT,BOTTOM,
; Up to 2048 zones and all zones end with a comma
; You can use the "Identify Window" option to get the RECT of any window
; You can save a "Snap Layout" from test windows using the tray menu
; This is the preferred way to configure your snap layout.

[KBShortcuts]
UsePtWindow=0
; Set UsePtWindow=1 if you want the pointed window to be used
; instead of the foreground window.
;
; Formula: add the folowing:
; One VK_NUMBER (decimal)
; +256  Alt
; +512  Control
; +1024 Shift
; +2048 Winkey
;
; 883  => Ctrl+Alt+F4
; 1299 => Shift+Alt+Pause, 275 => Alt+Pause
; 2644 => Ctrl+Win+T
; 2336 => Alt+Win+SPACE
yatli commented 1 year ago

Setting the drag threshold to 1 solves the problem -- this entry was missing from my ini file.

RamonUnch commented 1 year ago

Setting the drag threshold to 1 solves the problem -- this entry was missing from my ini file.

I will investigate, In theory DragThreshold=1 should not affect non-snapped windows and it should not be required for drag-free actions.

yatli commented 1 year ago

DragThreshold=1 has a side effect that a maximized window cannot be moved anymore. Quick guess: maximized window is fixed and thus cannot overcome the threshold? Resize does work.

RamonUnch commented 1 year ago

It is very strange, because the mouse position is used to detect the threshold, not the window movement I cannot reproduce the issue either. Are you sure that the Disable on Maximized windows is not set?

Also maybe try with this test build that fixes some other bugs that might be related in the end. AltSnap1.60test2.zip (x64 build)

yatli commented 1 year ago

When I comment out the threshold option and reload config (disable & enable AltSnap), maximized windows can be moved.

I'll test that build later.

yatli commented 1 year ago

The test build fixed it. Amazing.

RamonUnch commented 1 year ago

Very happy to hear that. I will make a release soon because there are significant bugs in 1.59 indeed.

RamonUnch commented 1 year ago

1.60 released