| Allegro CL version 10.1 Unrevised from 10.0 to 10.1. 10.0 version |
Arguments: nil
Returns an integer whose bits reflect the state of the mouse buttons and keyboard shift keys at the time that the event currently being handled occurred. A one bit indicates that the button or key was down, and a zero bit that it was not. For example, the expression
(logtest left-mouse-button (mouse-button-state))
will return true if and only if the left-mouse-button was down when
the event currently being handled occurred. To determine whether a
mouse button is down now, use key-is-down-p instead, passing one of the "key"
constants vk-lbutton
, vk-mbutton
, or vk-rbutton
(though that works on
Windows only).
This function operates per-thread. Specifically, a mouse click that is done on a window that was created in a particular thread will not be included in the value returned by a call to mouse-button-state in any other thread. (An exception is that if there is a single window hierarchy that contains windows from both threads, then the operating system appears to combine the event queues of the two threads, and mouse-button-state will still include mouse clicks and shift key presses that were done in a window of the other thread.)
The following list shows the correspondence of buttons and keys to constants defined in Allegro CL for Windows.
left-mouse-button
middle-mouse-button
right-mouse-button
first-x-button
(see *ignore-mouse-x-buttons*
)
second-x-button
(see *ignore-mouse-x-buttons*
),
shift-key
control-key
alt-key
Note: while an event is being handled, the returned value reflects the state at the time that that event occurred. For example, if you call mouse-button-state in an event method for a button-down event, then the returned value will indicate the mouse buttons and shift keys that were pressed when this event occurred, even if the user has released the buttons and keys at the time that the call to mouse-button-state is made.
See also down-keys, down-key-names, key-is-down-p, and key-was-down-p.
Copyright (c) 1998-2022, Franz Inc. Lafayette, CA., USA. All rights reserved.
This page was not revised from the 10.0 page.
Created 2019.8.20.
| Allegro CL version 10.1 Unrevised from 10.0 to 10.1. 10.0 version |