let get_mouse_buttons t =
let bm = get_button_mask t in
let add mask button tl =
if bm land mask = mask then button::tl else tl
in
add 1 LEFT_MOUSE_BUTTON
(add 2 MIDDLE_MOUSE_BUTTON
(add 4 RIGHT_MOUSE_BUTTON []))