AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

SetCapsLockState bug

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Bug Reports
View previous topic :: View next topic  
Author Message
jonny



Joined: 13 Nov 2004
Posts: 3004
Location: Minnesota

PostPosted: Sun Feb 06, 2005 7:05 am    Post subject: SetCapsLockState bug Reply with quote

Quote:
settitlematchmode,2
setwindelay,2
coordmode,mouse
setcapslockstate,alwaysoff
hotkey,*rbutton,off
hotkey,*mbutton,off
hotkey,*lbutton,off
hotkey,*xbutton1,off
hotkey,*xbutton2,off
return

^!+r::reload

^!+e::edit

^!+s::suspend

#i::run,c:\program files\mozilla firefox\firefox.exe

#e::run,c:\program files\xplorer2\xplorer2.exe

#n::run,c:\program files\xplorer2\editor2.exe

*rbutton::
*mbutton::
*lbutton::
*xbutton1::
*xbutton2::
return

capslock & lbutton::
if double
{
mousegetpos,,,id
postmessage,0x112,0xf020,,,ahk_id %id%
double := false
return
}
mousegetpos,x1,y1,id
winget,win,minmax,ahk_id %id%
if win
return
wingetpos,winx1,winy1,,,ahk_id %id%
loop
{
getkeystate,button,lbutton,p
if button = u
break
mousegetpos,x2,y2
x2 -= x1
y2 -= y1
winx2 := (winx1 + x2)
winy2 := (winy1 + y2)
winmove,ahk_id %id%,,%winx2%,%winy2%
}
return

capslock & rbutton::
if double
{
mousegetpos,,,id
winget,win,minmax,ahk_id %id%
if win
winrestore,ahk_id %id%
else
winmaximize,ahk_id %id%
double := false
return
}
mousegetpos,x1,y1,id
winget,win,minmax,ahk_id %id%
if win
return
wingetpos,winx1,winy1,winw,winh,ahk_id %id%
if (x1 < winx1 + winw / 2)
winleft := true
else
winleft := false
if (y1 < winy1 + winh / 2)
winup := true
else
winup := false
loop
{
getkeystate,button,rbutton,p
if button = u
break
mousegetpos,x2,y2
wingetpos,winx1,winy1,winw,winh,ahk_id %id%
x2 -= %x1%
y2 -= %y1%
if winleft
{
winx1 += %x2%
winw -= %x2%
}
else
winw += %x2%
if winup
{
winy1 += %y2%
winh -= %y2%
}
else
winh += %y2%
winmove,ahk_id %id%,,%winx1%,%winy1%,%winw%,%winh%
x1 := (x2 + x1)
y1 := (y2 + y1)
}
return

capslock & mbutton::
if double
{
mousegetpos,,,id
winclose,ahk_id %id%
double := false
return
}
return

~capslock::
double := false
keywait,capslock
keywait,capslock,d t0.6
if errorlevel
return
double := true
return


^!+capslock::
hotkey,*rbutton,toggle
hotkey,*mbutton,toggle
hotkey,*lbutton,toggle
hotkey,*xbutton1,toggle
hotkey,*xbutton2,toggle
return


This is my main script. As you can see, a large portion of it is a version of my ultimate KDE script, modified to work with CapsLock, my general-purpose command modifier. However, the "double" code seems to have trouble with SetCapsLockState. When I use the double, CapsLock somehow bypasses the hook and switches on, on the second press (before the release). It then doesn't turn off at all, unless I reload the script twice. It is reproducable.
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Mon Feb 07, 2005 2:11 am    Post subject: Re: SetCapsLockState bug Reply with quote

jonny wrote:
CapsLock somehow bypasses the hook and switches on, on the second press (before the release). It then doesn't turn off at all
Thanks. Until the next update, I think you can fix this by adding a tilde in every place Capslock is used as a prefix key. In the example above, I believe there is only this one place:
~capslock & mbutton::

Description of upcoming change: A hotkey such as "a & b::" will be seen as "~a & b::" if "~a::" also exists as a hotkey, and vice versa.

Having "a" as a pass-through key in one place but not the other seems like a paradox, which is why it was resolved this way. But there's a good chance this isn't the resolution you wanted to see, in which case we can talk about it some more.
Back to top
View user's profile Send private message Send e-mail
jonny



Joined: 13 Nov 2004
Posts: 3004
Location: Minnesota

PostPosted: Mon Feb 07, 2005 3:04 am    Post subject: Reply with quote

Ok, thx. Works fine now. Don't feel too pressed to update quickly, as in this case the problem seems confined to people who use my double code with "state" keys. (Unless there's other cases where a conflict exists between the tilde and prefix; I'm not sure I entirely grasp the logical error here)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Bug Reports All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group