www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/10/01/05:09:28

Message-Id: <3.0.16.19971001110607.36ffa53e@hem1.passagen.se>
Date: Wed, 01 Oct 1997 11:06:19 -0400
To: Orlando Andico <orly AT dilnet DOT upd DOT edu DOT ph>
From: Peter Palotas <blizzar AT hem1 DOT passagen DOT se>
Subject: Re: Linux portability Q!
Cc: djgpp AT delorie DOT com
Mime-Version: 1.0

At 09.59 1997-10-01 +0800, you wrote:
>On Tue, 30 Sep 1997, Peter Palotas wrote:
>
>> Under Linux, Is it possible to have a a function called every time a
>> mouse-event occurs, like the int 33h callback function,
>
>prolly not. because there are two ways to handle the mouse under linux:
>using gpm (on the console) and handling it as an XEvent when running under
>X. the latter is more portable (works will all UNIX'es). don't know zip
>about gpm.

Well, if this is not possible, which is the preferred way of handling
keyboard/mouse inputs if you want to make a portable program? 
Callback functions, i.e. functions that are called every time an event
occurs weren't possible you said, that means you have to use polled input
in some way. Now I've seen examples where the mouse/keyboard events are
merged together. Is this a feature of linux, or just the code I saw? (think
it was GRX).

>> or have a function
>> called at a constant rate, like hooking the timerinterrupt?
>
>this is easy. you use this function called setitimer() and register a
>signal handler. at the countdown interval (which you set, under linux the
>resolution is 10ms, unless you're using RTlinux), the signal handler gets
>called. afaik i think this also works under djgpp.

Couldn't this functions be used to check for keyboard/mouse events then,
and call our callback function if an event had occured? 


-- Peter Palotas alias Blizzar -- blizzar AT hem1 DOT passagen DOT se --

*****************************************************
* A brief description of DJGPP:                     *
* NEVER BEFORE HAS SO FEW DONE SO MUCH FOR SO MANY! *
*****************************************************

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019