Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!olivea!uunet!mcsun!hp4nl!utrcu1!infnews!ramaer From: ramaer@cs.utwente.nl (Mark Ramaer) Newsgroups: comp.sys.atari.st Subject: Re: GEM source code Message-ID: <1991Mar26.120116@cs.utwente.nl> Date: 26 Mar 91 11:01:16 GMT References: <1991Mar21.101741.14347@convex.com> Sender: ramaer@cs (Mark Ramaer) Organization: University of Twente, Dept. of Computer Science Lines: 55 Originator: ramaer@utis61 In article , steve@thelake.mn.org (Steve Yelvington) writes: |> [deleted] |> In the spirit of Sharing More GEM Code, here's a couple of functions. |> Corrections/suggestions are welcome. The third function apparently |> has a bug that shows up when I add |M_BUTTON to the arguments to |> evnt_multi(); if anybody sees what I did wrong please let me know. |> |> /* This is where I wait for a timeout or a keystroke. |> I'd like to wait for a mouse click, but adding |> MU_BUTTON to the first argument causes evnt_multi |> to return immediately. ??? */ |> |> evnt_multi(MU_TIMER|MU_KEYBD, |> 1, 1, 0, |> 0,0,0,0,0, |> 0,0,0,0,0, |> &junk, |> loword(delay),hiword(delay), |> &junk,&junk, |> &junk,&junk, |> &junk, |> &junk); |> You are waiting for the left mouse button to be UP, this probably already the case. Change this into: int current_button_state; ... vq_mouse(0,¤t_button_state,&junk,&junk); evnt_multi(MU_TIMER|MU_KEYBD|M_BUTTON, MB_CLICKS, MB_MASK, current_button_state, 0,0,0,0,0, 0,0,0,0,0, &junk, loword(delay),hiword(delay), &junk,&junk, &junk,&junk, &junk, &junk); where MB_CLICKS and MB_MASK are defined as: #define MB_MASK 3 /* both buttons are relevant */ #define NOT 0x100 /* wait until state != current state */ #define MB_CLICKS 1|NOT /* once is enough */ or if you trust that both buttons are up when you call evnt_multi: evnt_multi(MU_TIMER|MU_KEYBD|M_BUTTON, 1,1,1, ... It helps, i tried it yesterday. :-)