Message-ID: <3901C823.C3B39CF3@geocities.com> From: Sahab Yazdani Organization: PheonixSoft Inc. X-Mailer: Mozilla 4.7 [en] (Win98; I) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp Subject: my mouse driver.. Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 83 Date: Sat, 22 Apr 2000 11:41:23 -0400 NNTP-Posting-Host: 149.99.126.173 X-Complaints-To: abuse AT sprint DOT ca X-Trace: newscontent-01.sprint.ca 956418235 149.99.126.173 (Sat, 22 Apr 2000 11:43:55 EDT) NNTP-Posting-Date: Sat, 22 Apr 2000 11:43:55 EDT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Hello everybody.. I've written a mouse event handler in DJGPP which for the most part works extremely well in either Graphics or Text based video modes, except that the darned thing is way too sensative. A single average click of the mouse results in roughly 5-10 software clicks in a program that I write with my driver. So as a result this mouse driver can use some tweaking. As the code is upwards of 300 lines I will not post it all, but just snippets from it, but if anybody feels that the whole source code is nessesary to check it I will gladly post it.. [the code - snippets] // The Actual Event Handler static void MouseHandler( _go32_dpmi_registers *r ) { CallBackData.Event = r->x.ax; CallBackData.ButtonState = r->x.bx; CallBackData.X = r->x.cx; CallBackData.Y = r->x.dx; CallBackData.XMickeys = r->x.si; CallBackData.YMickeys = r->x.di; MouseDrawCursor(); // Ignore this line as it does not relate to problem } // The Event Installer void GMouse::InstallInterruptHandler() { __dpmi_regs regs; _go32_dpmi_lock_data( &CallBackData, sizeof( CallBackBlock ) ); _go32_dpmi_lock_data( &cursor, sizeof( GBitmap * ) ); _go32_dpmi_lock_data( &destination, sizeof( GScreen * ) ); _go32_dpmi_lock_data( &MouseDraw, sizeof( int ) ); _go32_dpmi_lock_data( &oldX, sizeof( int ) ); _go32_dpmi_lock_data( &oldY, sizeof( int ) ); _go32_dpmi_lock_code( (void *)MouseHandler, (long)end_int_mouse-(long)MouseHandler ); _go32_dpmi_lock_code( (void *)MouseDrawCursor, (long)end_code_draw-(long)MouseDrawCursor ); mouse_callback.pm_offset = (int) MouseHandler; mouse_callback.pm_selector = _go32_my_cs(); _go32_dpmi_allocate_real_mode_callback_retf(&mouse_callback, &used_registers); // Move to a Better place later oldX = -1; oldY = 0; regs.x.ax = 0x0C; regs.x.cx = 0x7F; // This is where I think the problem is originating from. I am catching all events... but I don't know what to do about it... regs.x.dx = mouse_callback.rm_offset; regs.x.es = mouse_callback.rm_segment; __dpmi_int( 0x33, ®s ); MouseStateFlag = 1; } // To Check if a button was pressed // Not sure if there is anything wrong with this or not... int GMouse::ButtonPressed() { if ( (CallBackData.ButtonState & 0x01)!=0 ) { return MOUSE_LEFTBUTTON; } if ( (CallBackData.ButtonState & 0x02)!=0 ) { return MOUSE_RIGHTBUTTON; } return FALSE; } thank you all for any help you may provide! -- *********************************************************** * Sahab Yazdani * "We are all who we are, no more and no * * Thornhill S.S * less" - al'Lan Mandragoran * *********************************************************** * http://pheonixware.8m.com/ * ***********************************************************