delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/10/23/02:28:11

From: Lennart Steinke <steinke AT zeus DOT adv-boeblingen DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: user defined mouse handler
Date: Tue, 22 Oct 1996 05:34:36 -0600
Organization: InterNetNews at News.BelWue.DE (Stuttgart, Germany)
Lines: 128
Message-ID: <Pine.VUL.3.91.961022052155.25980D-100000@zeus.adv-boeblingen.de>
References: <Pine DOT VUL DOT 3 DOT 91 DOT 961021043234 DOT 24960A-100000 AT zeus DOT adv-boeblingen DOT de>
NNTP-Posting-Host: zeus.adv-boeblingen.de
Mime-Version: 1.0
In-Reply-To: <Pine.VUL.3.91.961021043234.24960A-100000@zeus.adv-boeblingen.de>
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

On Mon, 21 Oct 1996, Lennart Steinke wrote:

> Hi!
> 
>  I've some problems with user defined mouse handlers
> (int 0x33, function 0x0c).
> 
> 
>  First: I've read the faq (18.8), and the according info file.
> 
> Second: My two questions:
> 
>  1) i'm using _go32_dpmi_allocate_real_mode_callback_iret() and set
>     es to rm_segment and dx to rm_offset, call __dpmi_int()...
>     Everything seems to work (no function does return a failure),
>     but my handler isn't called.
>     
> 
>  2) Is it save to call other mouse driver  functions while in the event 
>     handler, like reading the mouse position?
>

Since I got no response to this msg, and our news server is a little 
buggy, I'm sending this msg again, this time with some code...


__dpmi_regs __mouse_regs;
_go32_dpmi_seginfo __mouse_isr_info;


/*+------------------------------------------------------------------------+ */
/*|Service routine called by the mouse driver, to display the mouse        | */
/*|on screen                                                               | */
/*+------------------------------------------------------------------------+ */
void
__jlib_display_mouse_handler(__dpmi_regs *regs)
{
	static UBYTE already_executing =0;
	int x,y,b,width,height;
	UBYTE *src, *dest =B_BUFF_PTR (__mouse_back);


	if (already_executing || !__mouse_visible)
		return;

	already_executing =1;

	/*
	 * ...
  	 */	
	already_executing =0;

}


/*+------------------------------------------------------------------------+ */
/*|check for the presence of a mouse.                                      | */
/*+------------------------------------------------------------------------+ */
int mouse_present(void)
{
   union REGS r;
      
   if(__mouse_initted){
      return MOUSE_PRESENT;
   }

   __mouse_initted = 1;

   r.x.ax = 0x0000;
   int86 (0x33, &r, &r);

   if(r.x.ax == 0xffff)
   {
		__dpmi_regs regs;

		__mouse_visible =0;


		/* Set the mouse at the middle of the screen */
		mouse_set_status(SCREEN_WIDTH /2, SCREEN_HEIGHT /2);


		/* Set the area the mouse can be moved in */

		r.x.ax = 7;
		r.x.cx = 0;
		r.x.dx = SCREEN_WIDTH;
		int86(0x33, &r, &r);

		r.x.ax = 8;
		r.x.cx = 0;
		r.x.dx = SCREEN_HEIGHT;
		int86(0x33, &r, &r);

		/* Tell the mouse driver to call our SR whenever the mouse
		 * is moved.
		 */
		__mouse_isr_info.pm_offset=__jlib_display_mouse_handler;
		__mouse_isr_info.pm_selector=_my_cs();

		_go32_dpmi_allocate_real_mode_callback_iret(
			&__mouse_isr_info, 
			&__mouse_regs);
	

		regs.x.ax = 12;
		regs.x.bx = 1;
		regs.x.es = __mouse_isr_info.rm_segment;
		regs.x.dx = __mouse_isr_info.rm_offset;
		__dpmi_int(0x33, &regs);


		mouse_show_pointer();

		return MOUSE_PRESENT;
   }
   else{
	return MOUSE_ABSENT;
   }
}
 


Lenny
-- 
Lennart Steinke (steinke AT adv-boeblingen DOT de)


- Raw text -


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