@17140@
@13830@
@13245@
@13635@
@13440@
@13245@

Modified by Robert H”hne to be used for RHIDE.

@13245@
@13245@
@14024@

@14317@
@14293@
@14609@
#include	<tv.h>

TEvent TEventQueue::eventQueue[ eventQSize ]	= { {0} };
TEvent *TEventQueue::eventQHead = TEventQueue::eventQueue;
TEvent *TEventQueue::eventQTail = TEventQueue::eventQueue;
Boolean TEventQueue::mouseIntFlag =	False;

ushort TEventQueue::eventCount =	0;

Boolean TEventQueue::mouseEvents	= False;
Boolean TEventQueue::mouseReverse =	False;
@21350@
@21353@
ushort TEventQueue::autoTicks	= 0;
ushort TEventQueue::autoDelay	= 0;

MouseEventType	TEventQueue::lastMouse;
MouseEventType	TEventQueue::curMouse;
MouseEventType	TEventQueue::downMouse;
ushort TEventQueue::downTicks	= 0;

@19342@
@23372@
	 resume();
@24151@

static int TEventQueue_suspended	= 1;

#ifdef __linux__
void resume_keyboard();
void suspend_keyboard();
@15582@

@21593@
@23372@
	 if (!TEventQueue_suspended) return;
#ifdef __linux__
    resume_keyboard();
@15582@
	 mouseEvents =	False;
	 if( mouse.present()	==	False	)
		  mouse.resume();
	 if( mouse.present()	==	False	)
		  return;
	 mouse.getEvent( curMouse );
	 lastMouse = curMouse;
	 
	 mouseEvents =	True;
	 mouse.setRange( TScreen::getCols()-1,	TScreen::getRows()-1	);
	 TEventQueue_suspended = 0;
@24151@

@21594@
@23372@
  if (TEventQueue_suspended) return;
	 if (mouse.present()	==	True)	mouse.suspend();
/* I think here is the right place for clearing the
   buffer */
  clear_keybuf();
#ifdef __linux__
  suspend_keyboard();
@15582@
  TEventQueue_suspended	= 1;
@24151@

@19343@
@23372@
	 suspend();
@24151@

void TEventQueue::getMouseEvent(	TEvent& ev )
@23372@
	 if( mouseEvents == True )
		  {

		  getMouseState( ev );

		  if(	ev.mouse.buttons == 0 && lastMouse.buttons != 0	)
				{
				ev.what = evMouseUp;
//            int buttons = lastMouse.buttons;
				lastMouse =	ev.mouse;
//            ev.mouse.buttons = buttons;
				return;
				}

		  if(	ev.mouse.buttons != 0 && lastMouse.buttons == 0	)
				{
				if( ev.mouse.buttons	==	downMouse.buttons	&&
					 ev.mouse.where == downMouse.where &&
					 ev.what	- downTicks	<=	doubleDelay	)
						  ev.mouse.doubleClick = True;

				downMouse =	ev.mouse;
				autoTicks =	downTicks =	ev.what;
				autoDelay =	repeatDelay;
				ev.what = evMouseDown;
				lastMouse =	ev.mouse;
				return;
				}

		  ev.mouse.buttons =	lastMouse.buttons;

		  if(	ev.mouse.where	!=	lastMouse.where )
				{
				ev.what = evMouseMove;
				lastMouse =	ev.mouse;
				return;
				}

		  if(	ev.mouse.buttons != 0 && ev.what	- autoTicks	> autoDelay	)
				{
				autoTicks =	ev.what;
				autoDelay =	1;
				ev.what = evMouseAuto;
				lastMouse =	ev.mouse;
				return;
				}
		  }

	 ev.what	= evNothing;
@24151@

void TEventQueue::getMouseState(	TEvent &	ev	)
@23372@
	 if( eventCount == 0	)
		  {
		  TMouse::getEvent(ev.mouse);
		  ev.what =	TICKS();
		  }
	 else
		  {
	ev	= *eventQHead;
		  if(	++eventQHead >= eventQueue	+ eventQSize )
				eventQHead = eventQueue;
		  eventCount--;
		  }
	 if( mouseReverse	!=	False	&&	ev.mouse.buttons != 0 && ev.mouse.buttons	!=	3 )
		  ev.mouse.buttons ^= 3;
@24151@

@21591@
@23372@
  if (!rh_kbhit()) what	= evNothing;
@12774@
@12966@
	 keyDown.keyCode = gkey();
	 keyDown.shiftState = gkey_shifts_flags;
	 keyDown.raw_scanCode =	gkey_raw_value;
	 what	= evKeyDown;
@12978@
@24151@


