コード例 #1
0
/*
 * FiniMouse - done with the mouse
 */
void FiniMouse( void )
{
    if( EditFlags.UseMouse ) {
        MouClose( mouseHandle );
    }

} /* FiniMouse */
コード例 #2
0
static void hb_gt_os2_mouse_Exit( PHB_GT pGT )
{
   HB_SYMBOL_UNUSED( pGT );

   if( s_uMouHandle )
   {
      MouClose( s_uMouHandle );           /* release mouse handle */
      s_uMouHandle = 0;
   }
}
コード例 #3
0
ファイル: os2vio.c プロジェクト: martinwguy/xvi
static void
mousehandler()
{
    for (;;) {
	MOUEVENTINFO	m;
	unsigned short	status;
	clock_t		start;

#if 0
	if (MouGetDevStatus((PUSHORT) &status, mousenum) != 0
	    ||
	    (status & (MOUSE_UNSUPPORTED_MODE | MOUSE_DISABLED))
	) {
	    hidemouse();
	    (void) MouClose(mousenum);
	    DosExit(EXIT_THREAD, 0);
	}
#endif
	status = MOU_WAIT;
	MouReadEventQue((PMOUEVENTINFO) &m, (PUSHORT) &status, mousenum);
	/*
	 * If we don't get the control semaphore immediately,
	 * we do nothing. Delayed responses to mouse button
	 * presses could be confusing.
	 */
#if 0
	start = clock();
#endif
	if (DosSemRequest(control, SEM_IMMEDIATE_RETURN) != 0)
	    continue;
#if 0
	if (clock() != start) {
	    (void) fprintf(stderr, "mouse thread: %d\n", __LINE__);
	    DosSemClear(control);
	    continue;
	}
#endif
	/*
	 * Start of critical section.
	 */
	if (++keystrokes >= PSVKEYS)
	    lastevent = clock();
	if (State == NORMAL &&
		(m.fs & (MOUSE_BN1_DOWN | MOUSE_BN2_DOWN | MOUSE_BN3_DOWN))) {
	    hidemouse();
	    mouseclick(m.row, m.col);
	    showmouse();
	}
	/*
	 * End of critical section.
	 */
	DosSemClear(control);
    }
}
コード例 #4
0
//static void APIENTRY thMouse(ULONG data)
static void CC thMouse(void* data)
{
    MOUEVENTINFO Event;
    //USHORT MouHandle = 0;
    USHORT ReadType = 1;
    APIRET rc;

    ppMou = new PMObj;

    EditBoxCollection* pEdit = (EditBoxCollection*) data;

    rc = MouOpen( 0L, &pEdit->MouHandle);

    if(rc)
        return;

    rc = MouDrawPtr(pEdit->MouHandle);

    while(!pEdit->isDown())
    {
        rc = MouReadEventQue(&Event, &ReadType, pEdit->MouHandle);

        if(Event.fs & iMouseMask)
        {
            pEdit->lock();

            if(pEdit->current())
            {
                pEdit->track_beg();

                if(iSenseShift)
                {
                    if(kiLastKey.skey & shShift)
                        pEdit->current()->mark();
                    else
                        pEdit->current()->unmark();
                }

                if(iUpperStatus)
                    pEdit->SetMouse(Event.row - 1, Event.col);
                else
                    pEdit->SetMouse(Event.row, Event.col);

                pEdit->track_end();

                pEdit->draw();
            }
            pEdit->unlock();
        }
    }

    MouClose(pEdit->MouHandle);
}
コード例 #5
0
ファイル: in_os2.c プロジェクト: OS2World/GAME-ACTION-Quake2
void RW_IN_Init (in_state_t *in_state_p)
{
	USHORT m_mask = MOUSE_MOTION_WITH_BN1_DOWN | MOUSE_BN1_DOWN |
			MOUSE_MOTION_WITH_BN2_DOWN | MOUSE_BN2_DOWN |
			MOUSE_MOTION_WITH_BN3_DOWN | MOUSE_BN3_DOWN |
			MOUSE_MOTION;
	USHORT m_flags = MOUSE_DISABLED | MOUSE_MICKEYS;
	if (mouse_works) return;

	in_state = in_state_p;

	// mouse variables
	freelook = ri.Cvar_Get( "freelook", "0", 0 );
	lookstrafe = ri.Cvar_Get ("lookstrafe", "0", 0);
	sensitivity = ri.Cvar_Get ("sensitivity", "3", 0);
	m_pitch = ri.Cvar_Get ("m_pitch", "0.022", 0);
	m_yaw = ri.Cvar_Get ("m_yaw", "0.022", 0);
	m_forward = ri.Cvar_Get ("m_forward", "1", 0);
	m_side = ri.Cvar_Get ("m_side", "0.8", 0);

	ri.Cmd_AddCommand ("+mlook", RW_IN_MLookDown);
	ri.Cmd_AddCommand ("-mlook", RW_IN_MLookUp);

	ri.Cmd_AddCommand ("force_centerview", Force_CenterView_f);

	if (MouOpen(NULL, &mh)) return;
	ev = _THUNK_PTR_STRUCT_OK(ev_a) ? ev_a : ev_a + 1;
	//scale = _THUNK_PTR_STRUCT_OK(scale_a) ? scale_a : scale_a + 1;
	mouse_works = 1;
	//scale->rowScale = 1;
	//scale->colScale = 1;
	//if (MouSetScaleFact(scale, mh)) Sys_Error("MouSetScaleFact");
	if (MouSetDevStatus(&m_flags, mh)) Sys_Error("MouSetDevStatus");
	MouSetEventMask(&m_mask, mh);
	{
		//THRESHOLD t;
		USHORT status = -1;
		MouGetNumButtons(&status, mh);
		//Con_Printf("os/2 mouse: %d buttons\n", (int)status);
		/*
		t.Length = sizeof t;
		MouGetThreshold(&t, mh);
		Con_Printf("t: %d %d %d %d %d\n", t.Length, t.Level1, t.Lev1Mult, t.Level2, t.lev2Mult);
		*/
	}
	_fmutex_create(&sem, 0);
	xpos = ypos = 0;
	if (_beginthread(mouse_thread, NULL, 65536, NULL) == -1) {
		MouClose(mh);
		mouse_works = 0;
	}
}
コード例 #6
0
ファイル: mouse.c プロジェクト: OS2World/LIB-libfly
void main (void)
{
    MOUEVENTINFO  event;
    HMOU          MouHandle;
    USHORT        NButtons, wait = MOU_NOWAIT, eventmask;
    char          ev_name[1024];
    int           rc;

    rc = MouOpen (NULL, &MouHandle);
    printf ("rc = %d from MouOpen\n", rc);
    if (rc) return;

    MouGetNumButtons (&NButtons, MouHandle);
    printf ("%d buttons\n", NButtons);

    rc = MouGetEventMask (&eventmask, MouHandle);
    printf ("rc = %d from MouGetEventMask\n", rc);
    eventmask = (MOUSE_MOTION | MOUSE_BN1_DOWN | MOUSE_BN2_DOWN | MOUSE_BN3_DOWN);
    eventmask |= (MOUSE_MOTION_WITH_BN1_DOWN |
                  MOUSE_MOTION_WITH_BN2_DOWN | MOUSE_MOTION_WITH_BN3_DOWN);
    rc = MouSetEventMask (&eventmask, MouHandle);
    printf ("rc = %d from MouSetEventMask\n", rc);
    rc = MouDrawPtr (MouHandle);
    printf ("rc = %d from MouDrawPtr\n", rc);
    
    while (1)
    {
        rc = MouReadEventQue (&event, &wait, MouHandle);
        if (rc) printf ("rc = %d from MouReadEventQue\n", rc);
        if (rc) continue;
        if (event.time == 0) continue;
        
        ev_name[0] = '\0';
        if (event.fs & MOUSE_BN1_DOWN)             strcat (ev_name, "B1 down     | ");
        if (event.fs & MOUSE_BN2_DOWN)             strcat (ev_name, "B2 down     | ");
        if (event.fs & MOUSE_BN3_DOWN)             strcat (ev_name, "B3 down     | ");
        if (event.fs & MOUSE_MOTION)               strcat (ev_name, "Movement    | ");
        if (event.fs & MOUSE_MOTION_WITH_BN1_DOWN) strcat (ev_name, "B1 movement | ");
        if (event.fs & MOUSE_MOTION_WITH_BN2_DOWN) strcat (ev_name, "B2 movement | ");
        if (event.fs & MOUSE_MOTION_WITH_BN3_DOWN) strcat (ev_name, "B3 movement | ");
        if (ev_name[0] == '\0')                    strcat (ev_name, "release     | ");
        
        printf ("%s row = %3d, col = %3d, flags = %x\n", ev_name, event.row, event.col, event.fs);
    }

    MouClose (MouHandle);
}
コード例 #7
0
ファイル: in_os2.c プロジェクト: OS2World/GAME-ACTION-Quake2
void mouse_thread(void *p)
{
	HMOU h = mh;
	USHORT rd = MOU_WAIT;
	DosSetPriority(PRTYS_THREAD, PRTYC_TIMECRITICAL, 31, 0);
	while (1) {
	if (MouReadEventQue(ev, &rd, h)) return;
	if (!mouse_works) goto ret;
	_fmutex_request(&sem, _FMR_IGNINT);
	xpos += ev->col;
	ypos += ev->row;
	buttons =
	  ((ev->fs & (MOUSE_MOTION_WITH_BN1_DOWN|MOUSE_BN1_DOWN)) ? 1 : 0) +
	  ((ev->fs & (MOUSE_MOTION_WITH_BN2_DOWN|MOUSE_BN2_DOWN)) ? 2 : 0) +
	  ((ev->fs & (MOUSE_MOTION_WITH_BN3_DOWN|MOUSE_BN3_DOWN)) ? 4 : 0);
	_fmutex_release(&sem);
	}
	ret:
	MouClose(h);
}
コード例 #8
0
void TThreads::suspend() {
   shutDownFlag=1;
   TID localTID=mouseThreadID;
   if (localTID != 0xFFFF) DosWaitThread(&localTID,DCWW_WAIT);
   //  cerr << " MouseThread has ended\n";
   ULONG count;
   assert(! DosQueryEventSem(TThreads::hevKeyboard2,&count));
   if (!count)
      assert(! DosPostEventSem(TThreads::hevKeyboard2));  // Make sure the thread is running.
   localTID=keyboardThreadID;
   DosWaitThread(&localTID,DCWW_WAIT);
   //  cerr << " KeyboardThread has ended\n";

   assert(!DosCloseMutexSem(hmtxMouse1));
   assert(!DosCloseEventSem(hevKeyboard2));
   assert(!DosCloseEventSem(hevKeyboard1));
   assert(!DosCloseEventSem(hevMouse2));
   assert(!DosCloseEventSem(hevMouse1));
   assert(!DosCloseMuxWaitSem(hmuxMaster));

   if (tiled->mouseHandle != 0xFFFF) MouClose(tiled->mouseHandle);   // This doesn't work, the mouseThread uses the handle.
   assert(! DosFreeMem(tiled));  // Better not, dito
}
コード例 #9
0
ファイル: lib_mouse.c プロジェクト: mikekmv/aeriebsd-src
static void
mouse_server(unsigned long ignored GCC_UNUSED)
{
    unsigned short fWait = MOU_WAIT;
    /* NOPTRRECT mourt = { 0,0,24,79 }; */
    MOUEVENTINFO mouev;
    HMOU hmou;
    unsigned short mask = MOUSE_BN1_DOWN | MOUSE_BN2_DOWN | MOUSE_BN3_DOWN;
    int nbuttons = 3;
    int oldstate = 0;
    char err[80];
    unsigned long rc;

    /* open the handle for the mouse */
    if (MouOpen(NULL, &hmou) == 0) {
	rc = MouSetEventMask(&mask, hmou);
	if (rc) {		/* retry with 2 buttons */
	    mask = MOUSE_BN1_DOWN | MOUSE_BN2_DOWN;
	    rc = MouSetEventMask(&mask, hmou);
	    nbuttons = 2;
	}
	if (rc == 0 && MouDrawPtr(hmou) == 0) {
	    for (;;) {
		/* sit and wait on the event queue */
		rc = MouReadEventQue(&mouev, &fWait, hmou);
		if (rc) {
		    snprintf(err, sizeof(err),
			     "Error reading mouse queue, rc=%lu.\r\n", rc);
		    break;
		}
		if (!mouse_activated)
		    goto finish;

		/*
		 * OS/2 numbers a 3-button mouse inconsistently from other
		 * platforms:
		 *      1 = left
		 *      2 = right
		 *      3 = middle.
		 */
		if ((mouev.fs ^ oldstate) & MOUSE_BN1_DOWN)
		    write_event(mouev.fs & MOUSE_BN1_DOWN,
				mouse_buttons[1], mouev.col, mouev.row);
		if ((mouev.fs ^ oldstate) & MOUSE_BN2_DOWN)
		    write_event(mouev.fs & MOUSE_BN2_DOWN,
				mouse_buttons[3], mouev.col, mouev.row);
		if ((mouev.fs ^ oldstate) & MOUSE_BN3_DOWN)
		    write_event(mouev.fs & MOUSE_BN3_DOWN,
				mouse_buttons[2], mouev.col, mouev.row);

	      finish:
		oldstate = mouev.fs;
	    }
	} else
	    snprintf(err, sizeof(err),
		     "Error setting event mask, buttons=%d, rc=%lu.\r\n",
		     nbuttons, rc);

	DosWrite(2, err, strlen(err), &rc);
	MouClose(hmou);
    }
    DosExit(EXIT_THREAD, 0L);
}
コード例 #10
0
ファイル: aaos2mou.c プロジェクト: alepharchives/alcextra
static void os2_uninit(aa_context * c) {
  USHORT status = 0;
  MouSetDevStatus(&status, hMou);
  MouClose(hMou);
}