Esempio n. 1
0
static void hb_gt_os2_mouse_Show( PHB_GT pGT )
{
   HB_SYMBOL_UNUSED( pGT );

   if( s_uMouHandle )
      MouDrawPtr( s_uMouHandle );
}
void main()
{
int rc;
HMOU msHandle;
MOUEVENTINFO msEventInfo;
USHORT ReadType = 0;

rc = MouOpen( NULL, &msHandle );
if( rc )
{
		printf("MouOpen error, rc = %d\n", rc);
		return;
}

rc = MouDrawPtr( msHandle );
while(1)
{
	rc = MouReadEventQue( &msEventInfo, &ReadType, msHandle );
	if( rc )
	{
		printf("MouReadEventQue error, rc = %d\n", rc);
		return;
	}
	if( msEventInfo.time )
	printf( "mousestate = %d\n",
		msEventInfo.fs
		);
	
	DosSleep( 100 );
}

}
Esempio n. 3
0
/*
  m = 1; showmouse
  m = 0; hidemouse
  */
static void os2_cursormode(aa_context * c, int m) {
  USHORT statusHide = 0x0;  
  USHORT statusShow = 0x100;  
  if(!m) {
    MouSetDevStatus(&statusShow, hMou);
    MouDrawPtr(hMou);
  }  else
    MouSetDevStatus(&statusHide, hMou);
}
//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);
}
Esempio n. 5
0
static int os2_init(aa_context * c, int mode) {
  USHORT mask = 0x7F;
  USHORT status = 0x0;

  if (MouOpen(NULL,&hMou) && MouOpen("POINTER$", &hMou)) {
    hMou = -1;
    return 0;
  }
  MouDrawPtr(hMou);
  MouSetDevStatus(&status, hMou);
  MouSetEventMask(&mask, hMou);

  return 1;
}
Esempio n. 6
0
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);
}
Esempio n. 7
0
static void DrawMouse(int Show) {
  if (!MousePresent) return;

  if (Show == 1) {
    MouDrawPtr(MouseHandle);
  } else {
    NOPTRRECT npr;
    int W, H;

    npr.row = 0;
    npr.col = 0;
    ConQuerySize(&W, &H);
    npr.cCol = (USHORT)(W - 1);
    npr.cRow = (USHORT)(H - 1);
    MouRemovePtr(&npr, MouseHandle);
  }
}
Esempio n. 8
0
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);
}