www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/05/21/04:57:54

From: "Mr A Appleyard" <MCLSSAA2 AT fs2 DOT mt DOT umist DOT ac DOT uk>
Organization: Materials Science Centre
To: DJGPP AT delorie DOT com
Date: Thu, 21 May 1998 09:56:57 GMT
Subject: BUG in Gnu C++ (djgpp v2) mouse access under Windows 95
Message-ID: <151F3A402D6@fs2.mt.umist.ac.uk>

  I posted about this fault before; but since then I have deleted all my mouse
software and bought a new mouse and installed its software, but I still have
the fault.
  I wrote two Gnu C++ (djgpp v2) programs that use the mouse, not by polling
it but by supplying a mouse handler interrupt routine, by the function
settrap() appended below, which Eli Zaretski kindly wrote for me some time
ago. They worked OK for ages in DOS 6.22 and previous, both plain and when
called from within Windows 3.1.1. The two programs are:-
  AAEMACS.EXE, runs with the screen in DOS mode 3 (ordinary 80*25 char text)
  SPATRL.EXE, runs with the screen in various graphics modes.

  But under Windows 95 (which I changed to a few weeks ago) I get faults:-
  In `shutdown and restart in DOS mode' (= plain DOS 7), both still OK.
  When called from Win95, or from DOS 7 which was called in a Win95 window:-
    SPATRL works OK.
    AAEMACS.EXE often totally misunderstands where the mouse pointer is, and
sometimes crashes out when I touch or handle the mouse. That is a great
nuisance.
  (Under DOS 6.22 and previous, AAEMACS.EXE gave similar mouse faults if I ran
it in enlarged text modes such as 132*43 character mode.)
/*-----*/
void mouse::settrap(uns long mask,void (*func)(__dpmi_regs *)) {
/* This is tricky in protected-mode. We must allocate a real-mode wrapper
   function which will be called by the mouse driver, and which in turn will
   switch to protected-mode and call our protected-mode handler function. */
if(!Jerry.nbuttons) return;
if(!func) {Jerry.handlerInstalled=0; /* remove handler */
    _go32_dpmi_free_real_mode_callback(&cb_info); R.dx=R.es=0;}
else { /* Allocate real-mode call-back. Find real-mode address of handler */
    cb_info.pm_offset=(uns long)func; Jerry.handlerInstalled=1;
    if(_go32_dpmi_allocate_real_mode_callback_retf(&cb_info,
      (__dpmi_regs*)&cb_regs)) return;
    R.dx=cb_info.rm_offset; R.es=cb_info.rm_segment;}
R.ax=12; R.cx=mask; Int(0x33);}

- Raw text -


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