Exemplo n.º 1
0
void JE_textMenuWait( JE_word *waitTime, JE_boolean doGamma )
{
	set_mouse_position(160, 100);
	
	do
	{
		JE_showVGA();
		
		push_joysticks_as_keyboard();
		service_SDL_events(true);
		
		inputDetected = newkey | mousedown;
		
		if (lastkey_sym == SDLK_SPACE)
		{
			lastkey_sym = SDLK_RETURN;
		}
		
		if (mousedown)
		{
			newkey = true;
			lastkey_sym = SDLK_RETURN;
		}
		
		if (mouseInstalled && input_grabbed)
		{
			if (abs(mouse_y - 100) > 10)
			{
				inputDetected = true;
				if (mouse_y - 100 < 0)
				{
					lastkey_sym = SDLK_UP;
				} else {
					lastkey_sym = SDLK_DOWN;
				}
				newkey = true;
			}
			if (abs(mouse_x - 160) > 10)
			{
				inputDetected = true;
				if (mouse_x - 160 < 0)
				{
					lastkey_sym = SDLK_LEFT;
				} else {
					lastkey_sym = SDLK_RIGHT;
				}
				newkey = true;
			}
		}
		
		NETWORK_KEEP_ALIVE();
		
		SDL_Delay(16);
		
		if (*waitTime > 0)
		{
			(*waitTime)--;
		}
	} while (!(inputDetected || *waitTime == 1 || haltGame));
}
Exemplo n.º 2
0
/*****************************************************************************
 * VLCVIew::Pulse
 *****************************************************************************/
void
VLCView::Pulse()
{
    // We are getting the pulse messages no matter if the mouse is over
    // this view. If we are in full screen mode, we want to hide the cursor
    // even if it is not.
    VideoWindow *videoWindow = dynamic_cast<VideoWindow*>(Window());
    if (!fCursorHidden)
    {
        if (fCursorInside
            && mdate() - fLastMouseMovedTime > fMouseHideTimeout)
        {
            be_app->ObscureCursor();
            fCursorHidden = true;
 
            // hide the interface window as well if full screen
            if (videoWindow && videoWindow->IsFullScreen())
                videoWindow->SetInterfaceShowing(false);
        }
    }

    // Workaround to disable the screensaver in full screen:
    // we simulate an activity every 29 seconds
    if( videoWindow && videoWindow->IsFullScreen() &&
        mdate() - fLastMouseMovedTime > 29000000 )
    {
        BPoint where;
        uint32 buttons;
        GetMouse(&where, &buttons, false);
        ConvertToScreen(&where);
        set_mouse_position((int32_t) where.x, (int32_t) where.y);
    }
}
Exemplo n.º 3
0
extern "C" void be_mouse_position(int x, int y)
{
   acquire_sem(_be_mouse_view_attached);
   _mouse_x = be_mouse_x = CLAMP(limit_left, x, limit_right);
   _mouse_y = be_mouse_y = CLAMP(limit_up,   y, limit_down);
   be_mouse_warped = true;
   if (!_be_mouse_window_mode)
      set_mouse_position(320, 240);
   release_sem(_be_mouse_view_attached);
}
Exemplo n.º 4
0
void
TMagnify::NudgeMouse(float x, float y)
{
	BPoint loc;
	uint32 button;

	GetMouse(&loc, &button);
	ConvertToScreen(&loc);
	loc.x += x;
	loc.y += y;

	set_mouse_position((int32)loc.x, (int32)loc.y);
}
Exemplo n.º 5
0
void QGLView::MouseMoved(BPoint point, uint32 transit, const BMessage *message) {
	if (!Window()->IsActive())
		return;

	// If the cursor is already centered on screen, return;
	// Because set_mouse_position below issues a MouseMoved() :/
	if (point.x == glConfig.vidWidth/2 && point.y == glConfig.vidHeight/2)
		return;

	int mx, my = 0;
	mx = (int)point.x - (glConfig.vidWidth/2);
	my = (int)point.y - (glConfig.vidHeight/2);

	Sys_QueEvent(0, SE_MOUSE, mx, my, 0, NULL);

	//Center on screen
	set_mouse_position((long int)(Window()->Frame().right - Window()->Bounds().Width()/2)+1, (long int)(Window()->Frame().bottom - Window()->Bounds().Height()/2)+1);
}
Exemplo n.º 6
0
/*!

\brief Updates mouse event.
\param[in] Value InputEventMouse containing the state of the mouse event.
\return Returns dmz::True if \a Value is different than the internal mosue event value.
\note The previous mouse event values are only updated if \a Value is different from
the current mouse event value.

*/
dmz::Boolean
dmz::InputEventMouse::update (const InputEventMouse &Value) {

   Boolean result (False);

   if (*this != Value) {

      set_window_size (Value.get_window_size_x (), Value.get_window_size_y ());
      set_mouse_position (Value.get_mouse_x (), Value.get_mouse_y ());

      set_mouse_screen_position (
         Value.get_mouse_screen_x (),
         Value.get_mouse_screen_y ());

      set_button_mask (Value.get_button_mask ());
      set_scroll_delta (Value.get_scroll_delta_x (), Value.get_scroll_delta_y ());

      result = True;
   }

   return result;
}
Exemplo n.º 7
0
status_t MacScreen::tick_func(void *arg)
{
	MacScreen *obj = (MacScreen *)arg;
	while (obj->tick_thread_active) {

		// Wait
		snooze(16667);

		// Workspace activated? Then poll the mouse and set the palette if needed
		if (!obj->quitting && obj->LockWithTimeout(200000) == B_OK) {
			if (obj->screen_active) {
				BPoint pt;
				uint32 button = 0;
				if (obj->palette_changed) {
					obj->palette_changed = false;
					obj->SetColorList(obj->palette);
				}
				obj->main_view->GetMouse(&pt, &button);
				set_mouse_position(320, 240);
				ADBMouseMoved(int(pt.x) - 320, int(pt.y) - 240);
				if (button & B_PRIMARY_MOUSE_BUTTON)
					ADBMouseDown(0);
				if (!(button & B_PRIMARY_MOUSE_BUTTON))
					ADBMouseUp(0);
				if (button & B_SECONDARY_MOUSE_BUTTON)
					ADBMouseDown(1);
				if (!(button & B_SECONDARY_MOUSE_BUTTON))
					ADBMouseUp(1);
				if (button & B_TERTIARY_MOUSE_BUTTON)
					ADBMouseDown(2);
				if (!(button & B_TERTIARY_MOUSE_BUTTON))
					ADBMouseUp(2);
			}
			obj->Unlock();
		}
	}
	return 0;
}
Exemplo n.º 8
0
int32 mouse_thread(void *mouse_started)
{
   BPoint cursor(0, 0);
   uint32 buttons;

   if (!_be_mouse_window_mode) {
      set_mouse_position(320, 240);
   }

   release_sem(*(sem_id *)mouse_started);

   for (;;) {
      acquire_sem(_be_mouse_view_attached);

      if (mouse_thread_running == false) {
         release_sem(_be_mouse_view_attached);
         /* XXX commented out due to conflicting TRACE in Haiku
         TRACE(PREFIX_I "mouse thread exited\n");
         */

         return 0;
      }

      if ((_be_focus_count > 0) && _be_mouse_window->Lock()) {
         _be_mouse_view->GetMouse(&cursor, &buttons);
	 if (!_be_mouse_window_mode) {
	    int dx = (int)cursor.x - 320;
	    int dy = (int)cursor.y - 240;

	    if (be_mouse_warped) {
	       dx = 0;
	       dy = 0;
	       be_mouse_warped = false;
	    }
	    be_mickey_x = dx;
	    be_mickey_y = dy;
	    be_mouse_x += dx;
	    be_mouse_y += dy;
	    
	    if (dx != 0 || dy != 0) {
	       set_mouse_position(320, 240);
	    }
	 }
	 else {
	    BRect bounds = _be_mouse_window->Bounds();
	    
	    if (bounds.Contains(cursor)) {
	       int old_x = be_mouse_x;
	       int old_y = be_mouse_y;
	       
	       _mouse_on = TRUE;
	       if (!be_app->IsCursorHidden()) {
	          be_app->HideCursor();
	       }

	       be_mouse_x = (int)(cursor.x - bounds.left);
	       be_mouse_y = (int)(cursor.y - bounds.top);
	       if (!be_mouse_warped) {
	          be_mickey_x += (be_mouse_x - old_x);
	          be_mickey_y += (be_mouse_y - old_y);
	       }
	       else {
	          be_mouse_warped = false;
	          be_mickey_x = 0;
	          be_mickey_y = 0;
	       }
	    }
	    else {
	       buttons = 0;
	       _mouse_on = FALSE;
	       if (be_app->IsCursorHidden()) {
	          be_app->ShowCursor();
	       }
	    }
	 }

	 _be_mouse_window->Unlock();
	    
	 be_mouse_x = CLAMP(limit_left, be_mouse_x, limit_right);
	 be_mouse_y = CLAMP(limit_up,   be_mouse_y, limit_down);
	 
	 be_mouse_b = 0;
	 be_mouse_b |= (buttons & B_PRIMARY_MOUSE_BUTTON)   ? 1 : 0;
	 be_mouse_b |= (buttons & B_SECONDARY_MOUSE_BUTTON) ? 2 : 0;
	 be_mouse_b |= (buttons & B_TERTIARY_MOUSE_BUTTON)  ? 4 : 0;

	 _mouse_x = be_mouse_x;
	 _mouse_y = be_mouse_y;
	 _mouse_z = _be_mouse_z;
	 _mouse_b = be_mouse_b;
	 _handle_mouse_input();
      }

      release_sem(_be_mouse_view_attached);

      snooze(MOUSE_THREAD_PERIOD);
   }
}
Exemplo n.º 9
0
void cdislave_device::register_write(const UINT32 offset, const UINT16 data, const UINT16 mem_mask)
{
    cdi_state *state = machine().driver_data<cdi_state>();

    switch(offset)
    {
        case 0:
            if(m_in_index)
            {
                verboselog(machine(), 0, "slave_w: Channel %d: %d = %02x\n", offset, m_in_index, data & 0x00ff );
                m_in_buf[m_in_index] = data & 0x00ff;
                m_in_index++;
                if(m_in_index == m_in_count)
                {
                    switch(m_in_buf[0])
                    {
                        case 0xc0: case 0xc1: case 0xc2: case 0xc3: case 0xc4: case 0xc5: case 0xc6: case 0xc7:
                        case 0xc8: case 0xc9: case 0xca: case 0xcb: case 0xcc: case 0xcd: case 0xce: case 0xcf:
                        case 0xd0: case 0xd1: case 0xd2: case 0xd3: case 0xd4: case 0xd5: case 0xd6: case 0xd7:
                        case 0xd8: case 0xd9: case 0xda: case 0xdb: case 0xdc: case 0xdd: case 0xde: case 0xdf:
                        case 0xe0: case 0xe1: case 0xe2: case 0xe3: case 0xe4: case 0xe5: case 0xe6: case 0xe7:
                        case 0xe8: case 0xe9: case 0xea: case 0xeb: case 0xec: case 0xed: case 0xee: case 0xef:
                        case 0xf0: case 0xf1: case 0xf2: case 0xf3: case 0xf4: case 0xf5: case 0xf6: case 0xf7:
                        case 0xf8: case 0xf9: case 0xfa: case 0xfb: case 0xfc: case 0xfd: case 0xfe: case 0xff: // Update Mouse Position
                            set_mouse_position();
                            memset(m_in_buf, 0, 17);
                            m_in_index = 0;
                            m_in_count = 0;
                            break;
                    }
                }
            }
            else
            {
                m_in_buf[m_in_index] = data & 0x00ff;
                m_in_index++;
                switch(data & 0x00ff)
                {
                    case 0xc0: case 0xc1: case 0xc2: case 0xc3: case 0xc4: case 0xc5: case 0xc6: case 0xc7:
                    case 0xc8: case 0xc9: case 0xca: case 0xcb: case 0xcc: case 0xcd: case 0xce: case 0xcf:
                    case 0xd0: case 0xd1: case 0xd2: case 0xd3: case 0xd4: case 0xd5: case 0xd6: case 0xd7:
                    case 0xd8: case 0xd9: case 0xda: case 0xdb: case 0xdc: case 0xdd: case 0xde: case 0xdf:
                    case 0xe0: case 0xe1: case 0xe2: case 0xe3: case 0xe4: case 0xe5: case 0xe6: case 0xe7:
                    case 0xe8: case 0xe9: case 0xea: case 0xeb: case 0xec: case 0xed: case 0xee: case 0xef:
                    case 0xf0: case 0xf1: case 0xf2: case 0xf3: case 0xf4: case 0xf5: case 0xf6: case 0xf7:
                    case 0xf8: case 0xf9: case 0xfa: case 0xfb: case 0xfc: case 0xfd: case 0xfe: case 0xff:
                        verboselog(machine(), 0, "slave_w: Channel %d: Update Mouse Position (0x%02x)\n", offset, data & 0x00ff );
                        m_in_count = 3;
                        break;
                    default:
                        verboselog(machine(), 0, "slave_w: Channel %d: Unknown register: %02x\n", offset, data & 0x00ff );
                        m_in_index = 0;
                        break;
                }
            }
            break;
        case 1:
            if(m_in_index)
            {
                verboselog(machine(), 0, "slave_w: Channel %d: %d = %02x\n", offset, m_in_index, data & 0x00ff );
                m_in_buf[m_in_index] = data & 0x00ff;
                m_in_index++;
                if(m_in_index == m_in_count)
                {
                    switch(m_in_buf[0])
                    {
                        case 0xf0: // Set Front Panel LCD
                            memcpy(m_lcd_state, m_in_buf + 1, 16);
                            memset(m_in_buf, 0, 17);
                            m_in_index = 0;
                            m_in_count = 0;
                            break;
                        default:
                            memset(m_in_buf, 0, 17);
                            m_in_index = 0;
                            m_in_count = 0;
                            break;
                    }
                }
            }
            else
            {
                switch(data & 0x00ff)
                {
                    default:
                        verboselog(machine(), 0, "slave_w: Channel %d: Unknown register: %02x\n", offset, data & 0x00ff );
                        memset(m_in_buf, 0, 17);
                        m_in_index = 0;
                        m_in_count = 0;
                        break;
                }
            }
            break;
        case 2:
            if(m_in_index)
            {
                verboselog(machine(), 0, "slave_w: Channel %d: %d = %02x\n", offset, m_in_index, data & 0x00ff );
                m_in_buf[m_in_index] = data & 0x00ff;
                m_in_index++;
                if(m_in_index == m_in_count)
                {
                    switch(m_in_buf[0])
                    {
                        case 0xf0: // Set Front Panel LCD
                            memset(m_in_buf + 1, 0, 16);
                            m_in_count = 17;
                            break;
                        default:
                            memset(m_in_buf, 0, 17);
                            m_in_index = 0;
                            m_in_count = 0;
                            break;
                    }
                }
            }
            else
            {
                m_in_buf[m_in_index] = data & 0x00ff;
                m_in_index++;
                switch(data & 0x00ff)
                {
                    case 0x82: // Mute Audio
                        verboselog(machine(), 0, "slave_w: Channel %d: Mute Audio (0x82)\n", offset );
                        dmadac_enable(&state->m_dmadac[0], 2, 0);
                        m_in_index = 0;
                        m_in_count = 0;
                        //cdic->audio_sample_timer->adjust(attotime::never);
                        break;
                    case 0x83: // Unmute Audio
                        verboselog(machine(), 0, "slave_w: Channel %d: Unmute Audio (0x83)\n", offset );
                        dmadac_enable(&state->m_dmadac[0], 2, 1);
                        m_in_index = 0;
                        m_in_count = 0;
                        break;
                    case 0xf0: // Set Front Panel LCD
                        verboselog(machine(), 0, "slave_w: Channel %d: Set Front Panel LCD (0xf0)\n", offset );
                        m_in_count = 17;
                        break;
                    default:
                        verboselog(machine(), 0, "slave_w: Channel %d: Unknown register: %02x\n", offset, data & 0x00ff );
                        memset(m_in_buf, 0, 17);
                        m_in_index = 0;
                        m_in_count = 0;
                        break;
                }
            }
            break;
        case 3:
            if(m_in_index)
            {
                verboselog(machine(), 0, "slave_w: Channel %d: %d = %02x\n", offset, m_in_index, data & 0x00ff );
                m_in_buf[m_in_index] = data & 0x00ff;
                m_in_index++;
                if(m_in_index == m_in_count)
                {
                    switch(m_in_buf[0])
                    {
                        case 0xb0: // Request Disc Status
                            memset(m_in_buf, 0, 17);
                            m_in_index = 0;
                            m_in_count = 0;
                            prepare_readback(attotime::from_hz(4), 3, 4, 0xb0, 0x00, 0x02, 0x15, 0xb0);
                            break;
                        //case 0xb1: // Request Disc Base
                            //memset(m_in_buf, 0, 17);
                            //m_in_index = 0;
                            //m_in_count = 0;
                            //prepare_readback(attotime::from_hz(10000), 3, 4, 0xb1, 0x00, 0x00, 0x00, 0xb1);
                            //break;
                        default:
                            memset(m_in_buf, 0, 17);
                            m_in_index = 0;
                            m_in_count = 0;
                            break;
                    }
                }
            }
            else
            {
                m_in_buf[m_in_index] = data & 0x00ff;
                m_in_index++;
                switch(data & 0x00ff)
                {
                    case 0xb0: // Request Disc Status
                        verboselog(machine(), 0, "slave_w: Channel %d: Request Disc Status (0xb0)\n", offset );
                        m_in_count = 4;
                        break;
                    case 0xb1: // Request Disc Base
                        verboselog(machine(), 0, "slave_w: Channel %d: Request Disc Base (0xb1)\n", offset );
                        m_in_count = 4;
                        break;
                    case 0xf0: // Request SLAVE Revision
                        verboselog(machine(), 0, "slave_w: Channel %d: Request SLAVE Revision (0xf0)\n", offset );
                        prepare_readback(attotime::from_hz(10000), 2, 2, 0xf0, 0x32, 0x31, 0, 0xf0);
                        m_in_index = 0;
                        break;
                    case 0xf3: // Request Pointer Type
                        verboselog(machine(), 0, "slave_w: Channel %d: Request Pointer Type (0xf3)\n", offset );
                        m_in_index = 0;
                        prepare_readback(attotime::from_hz(10000), 2, 2, 0xf3, 1, 0, 0, 0xf3);
                        break;
                    case 0xf4: // Request Test Plug Status
                        verboselog(machine(), 0, "slave_w: Channel %d: Request Test Plug Status (0xf4)\n", offset );
                        m_in_index = 0;
                        prepare_readback(attotime::from_hz(10000), 2, 2, 0xf4, 0, 0, 0, 0xf4);
                        break;
                    case 0xf6: // Request NTSC/PAL Status
                        verboselog(machine(), 0, "slave_w: Channel %d: Request NTSC/PAL Status (0xf6)\n", offset );
                        prepare_readback(attotime::never, 2, 2, 0xf6, 2, 0, 0, 0xf6);
                        m_in_index = 0;
                        break;
                    case 0xf7: // Enable Input Polling
                        verboselog(machine(), 0, "slave_w: Channel %d: Activate Input Polling (0xf7)\n", offset );
                        m_polling_active = 1;
                        m_in_index = 0;
                        break;
                    case 0xfa: // Enable X-Bus Interrupts
                        verboselog(machine(), 0, "slave_w: Channel %d: X-Bus Interrupt Enable (0xfa)\n", offset );
                        m_xbus_interrupt_enable = 1;
                        m_in_index = 0;
                        break;
                    default:
                        verboselog(machine(), 0, "slave_w: Channel %d: Unknown register: %02x\n", offset, data & 0x00ff );
                        memset(m_in_buf, 0, 17);
                        m_in_index = 0;
                        m_in_count = 0;
                        break;
                }
            }
            break;
    }
}