Esempio n. 1
0
void MouseController::timerTick(juce::int64 tick){
    previousTimeStamp = currentTimeStamp;
    currentTimeStamp = tick;
    queryMouse();
}
Esempio n. 2
0
void processJMouse(int argc, char *argv[])
{
    int x, y, but, drag, release, bid, click, modifier;
    int move, combo;
#ifdef OLD
    int k, xmask, bmask;
#endif

    if (argc < 7)
	return;
    but = atoi(argv[2]);
    drag = atoi(argv[3]);
    release = atoi(argv[4]);
    x = atoi(argv[5]);
    y = atoi(argv[6]);
    if (argc > 10) {
        bid = atoi(argv[7]);
        click = atoi(argv[8]);
	modifier = atoi(argv[9]);
	move = atoi(argv[10]);
    }
    else {
        bid = 0;
        click = 0;
	modifier = 0;
	move = 0;
    }
    if (bid == JPRESS) {
        buttonsDown |= 1 << but;
    } else if (bid == JRELEASE) {
        buttonsDown &= ~(1 << but);
    }
#ifdef VNMRJ
    if (click > 1 && but == 0 && multiWin) {
        setActiveWin(x, y); 
        return;
    }
    if(drag)
        writelineToVnmrJ("drag","1");
#endif 
    if (multiWin) {
        x = x - xoffset;
        y = y - yoffset;
    }

   if(bid == JRELEASE) p11_updateDisChanged();

   if (!isJMouse && !aspMouse) {
#ifdef VNMRJ
	  combo = getMask(bid, but, click, move, modifier);
          newMouseHandler(x, y, but, combo, 0, 
		mouseMove, mouseButton, mouseReturn);
/*
	  if (drag) {
              if (mouseMove) {
                (*mouseMove)(x, y, but);
                update_overlay_image(0, 0);
              }
          } 
	  else if (bid == JRELEASE || bid == JPRESS || release) {
              m_noCrosshair();
              if (mouseButton) {
                (*mouseButton)(but, release, x, y);
                update_overlay_image(0, release);
              }
          } else if(move) {
              m_crosshair(but, release, x, y);
          }
*/
#else
	if (drag) {
	    if (mouseMove) {
	    	(*mouseMove)(x, y, but);
	    }
	}
	else if (mouseButton) {
	    if (bid == JRELEASE || bid == JPRESS || release) {
	 	(*mouseButton)(but, release, x, y);
            }
	}
#endif
        return;
   }

#ifdef VNMRJ

#ifdef OLD
   xmask = queryMouse();

   /* the combo data use four bytes to represent mouse event.
    * bit0 to bit7: click number.
    * bit8: button_1, bit9: button_2, bit10: button_3,
    * bit16: button_press, but17: button_release, but18: button_click,
    * bit19: drag. bit20: move.
    * bit24: SHIFT, bit25: CTRL, bit26: ALT, bit27: META
   */
   combo = 0;
   but = curButton;
   if (xmask & ShiftMask)
	combo |= 0x1000000; /* bit 25 */
   if (xmask & ControlMask)
	combo |= 0x2000000; /* bit 26 */
   if (xmask & Mod1Mask) /* ALT */
	combo |= 0x4000000; /* bit 27 */
   if (xmask & Mod4Mask) /* META */
	combo |= 0x8000000; /* bit 28 */
   if (move) {
   	if (bid == JMOVE)
	    butData = 0;
	combo |= 0x100000;  /* bit 20 */
   }
   else {
   	if (bid == JCLICK) {

	    if (click > 255)
	    	click = 255;
	    combo |= click;
	    combo |= 0x40000; /* bit 18 */
	}
	else if (bid == JDRAG) {
	    combo |= 0x80000; /* bit 19 */
	}
	else { /* press or release */
	    bmask = 0;
   	    if (xmask & Button1Mask)
	        bmask = BUTTON1;
   	    if (xmask & Button2Mask)
	        bmask |= BUTTON2;
   	    if (xmask & Button3Mask)
	        bmask |= BUTTON3;
	    k = bmask ^ butData;
	    if (k != 0) {
	      if (k == BUTTON3)
		curButton = 2;
	      else if (k == BUTTON2)
		curButton = 1;
	      else
		curButton = 0;
	    }
	    
   	    if (bid == JPRESS)
		combo |= 0x10000; /* bit 16 */
   	    else if (bid == JRELEASE)
	 	combo |= 0x20000; /* bit 17 */
	    butData = bmask;
	    but = curButton;
	}
	combo |= butData;
   }
#else 
    combo = getMask(bid, but, click, move, modifier);

#endif 
   if (aspMouse && mouseGeneral) {
        (*mouseGeneral)(x, y, but, combo, 0);
	return;
   }
   if (drag)
   {
	if (mouseMove) {
	    (*mouseMove)(x, y, but, combo, 0);
	    return;
	}
   }
   if (bid == JCLICK)
   {
	if (mouseClick) {
            (*mouseClick)(x, y, but, combo, click);
	    return;
	}
   }
   if (bid == JRELEASE || bid == JPRESS)
   {
	if (mouseButton) {
            (*mouseButton)(x, y, but, combo, release);
	    return;
	}
   }
   if (mouseGeneral) {
        (*mouseGeneral)(x, y, but, combo, 0);
	return;
   }
#endif 
}