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

polling in Graphics on Windows #2488

Closed
vicuna opened this issue Apr 22, 2004 · 1 comment
Closed

polling in Graphics on Windows #2488

vicuna opened this issue Apr 22, 2004 · 1 comment
Labels

Comments

@vicuna
Copy link

vicuna commented Apr 22, 2004

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

Bug description

Full_Name: Eijiro Sumii
Version: 3.06, 3.07, cvs
OS: Windows 2000, Windows XP
Submission from: pcp01330153pcs.chrstn01.pa.comcast.net (68.81.130.132)

It seems to me that polling in the Graphics library for Windows is
fundamentally broken (or very different from the X version, at least).
For example, if you do something like:

Graphics.open_graph "" ;;
while true do
let e = Graphics.wait_next_event [Graphics.Poll; Graphics.Key_pressed] in
if e.Graphics.keypressed then begin
Format.eprintf "event received@.";
if e.Graphics.keypressed then Format.eprintf "key pressed@.";
Format.eprintf "reading the event@.";
ignore (Graphics.wait_next_event [Graphics.Key_pressed]);
Format.eprintf "event read@."
end
done ;;

on Windows and X, then the behavior when a key is pressed for a second is
completely different. Looking at win32graph/draw.c

    if (poll) {
            // Poll uses info on last event stored in global variables
            mouse_x = MouseLastX;
            mouse_y = MouseLastY;
            button = MouseLbuttonDown | MouseMbuttonDown |

MouseRbuttonDown;
key = LastKey;
}
else { // Not polled. Block for a message

and win32graph/open.c

    case WM_CHAR:
            LastKey = wParam & 0xFF;
            break;
    case WM_KEYUP:
            LastKey = -1;
            break;

the meaning of "key pressed" events seems completely different in Windows from
X. Since this difference is rather significant, it would better be fixed or at
least documented.

@vicuna
Copy link
Author

vicuna commented Jun 21, 2004

Comment author: administrator

Revised Win32graph event handling 2004-06-21, XL.

@vicuna vicuna closed this as completed Jun 21, 2004
@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