Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

graphics wait_next_event bug #8192

Closed
vicuna opened this issue Jun 28, 2003 · 1 comment
Closed

graphics wait_next_event bug #8192

vicuna opened this issue Jun 28, 2003 · 1 comment
Labels

Comments

@vicuna
Copy link

vicuna commented Jun 28, 2003

Original bug ID: 1735
Reporter: administrator
Status: closed
Resolution: fixed
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)

Bug description

Windows XP, ocaml 3.06, graphics library

Compile and run the following program as (graphics > out), then click and
hold the mouse button in the window, then hit esc, then look in out. You
will see the first event having the mouse button down, and then a bunch of
button:false's, and then button:trues again. It looks like the first 200
or so Poll'ed button reads after a mouse down return false even though the
button is still down, and then it starts returning true again. If you're
always just polling (set dopoll=true) then the reading is correct always.

Chris

(* ocamlc -o graphics.exe unix.cma graphics.cma graphtest.ml *)

open Graphics

let print_event e =
Printf.printf "x:%d y:%d button:%b keypressed:%b key:%c\n" e.mouse_x
e.mouse_y e.button e.keypressed e.key;
flush stdout

let _ =
open_graph "";
set_color white;
clear_graph ();
set_color black;
plot 50 50;
let quit = ref false in
let dopoll = ref false in
while not !quit do
let e = wait_next_event (if !dopoll then [Poll] else [Button_down;
Key_pressed]) in
dopoll := true;
print_event e;
match e.key with
'q' | '\027' -> quit := true
| 'p' -> dopoll := false
| _ -> ()
done;
close_graph ();
()

@vicuna
Copy link
Author

vicuna commented Jul 7, 2003

Comment author: administrator

Fixed by XL 2003-07-07

@vicuna vicuna closed this as completed Jul 7, 2003
@vicuna vicuna added the bug label Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant