Пример #1
0
static int native_drainevents (SADisplay *display, VisEventQueue *eventqueue)
{
        SDLNative *native = SDL_NATIVE (display->native);
        SDL_Event event;

        /* Visible or not */
        if (((SDL_GetAppState () & SDL_APPACTIVE) == 0) && (native->active == TRUE)) {
                native->active = FALSE;
                visual_event_queue_add_visibility (eventqueue, FALSE);
        } else if (((SDL_GetAppState () & SDL_APPACTIVE) != 0) && (native->active == FALSE)) {
                native->active = TRUE;
                visual_event_queue_add_visibility (eventqueue, TRUE);
        }

        /* Events */
        while (SDL_PollEvent (&event)) {

                switch (event.type) {
                        case SDL_KEYUP:
                                visual_event_queue_add_keyboard (eventqueue, event.key.keysym.sym, event.key.keysym.mod,
                                                                 VISUAL_KEY_UP);
                                break;

                        case SDL_KEYDOWN:
                                visual_event_queue_add_keyboard (eventqueue, event.key.keysym.sym, event.key.keysym.mod,
                                                                 VISUAL_KEY_DOWN);
                                break;

                        case SDL_VIDEORESIZE:
                                visual_event_queue_add_resize (eventqueue, display->screen, event.resize.w, event.resize.h);

                                native_create (display, display->screen->depth, NULL, event.resize.w, event.resize.h, native->resizable);
                                break;

                        case SDL_MOUSEMOTION:
                                visual_event_queue_add_mousemotion (eventqueue, event.motion.x, event.motion.y);
                                break;

                        case SDL_MOUSEBUTTONDOWN:
                                visual_event_queue_add_mousebutton (eventqueue, event.button.button, VISUAL_MOUSE_DOWN,
                                                                    event.button.x, event.button.y);
                                break;

                        case SDL_MOUSEBUTTONUP:
                                visual_event_queue_add_mousebutton (eventqueue, event.button.button, VISUAL_MOUSE_UP,
                                                                    event.button.x, event.button.y);
                                break;

                        case SDL_QUIT:
                                visual_event_queue_add_quit (eventqueue, FALSE);
                                break;

                        default:
                                break;
                }
        }

        return 0;
}
Пример #2
0
static int motion_callback(void * data, int x, int y, int mask)
  {
  VisEventQueue *eventqueue;
  lv_priv_t * priv = (lv_priv_t*)data;
  eventqueue = visual_plugin_get_eventqueue(visual_actor_get_plugin(priv->actor));
  
  visual_event_queue_add_mousemotion(eventqueue, x, y);

  if(priv->ov_callbacks && priv->ov_callbacks->motion_callback)
    {
    priv->ov_callbacks->motion_callback(priv->ov_callbacks->data,
                                        x, y, mask);
    }

  return 1;
  }
Пример #3
0
    static bool
    event_handler()
    {
        SDL_Event event;
        VisEventQueue *vevent;

        while( SDL_PollEvent( &event ) )
        {
            vevent = visual_plugin_get_eventqueue( visual_actor_get_plugin( visual_bin_get_actor( Vis::bin ) ) );

            switch( event.type )
            {
            case SDL_KEYUP:
                visual_event_queue_add_keyboard( vevent, (VisKey)event.key.keysym.sym, event.key.keysym.mod, VISUAL_KEY_UP );
                break;

            case SDL_KEYDOWN:
                visual_event_queue_add_keyboard (vevent, (VisKey)event.key.keysym.sym, event.key.keysym.mod, VISUAL_KEY_DOWN);

                switch( event.key.keysym.sym )
                {
                //PLUGIN CONTROLS
                case SDLK_F11:
                case SDLK_TAB:
                    SDL::toggleFullScreen();
                    break;

                case SDLK_ESCAPE:
                    if( SDL::isFullScreen() )
                        SDL::toggleFullScreen();
                    break;

                case SDLK_LEFT:
                    Vis::prevActor();
                    goto morph;

                case SDLK_RIGHT:
                    Vis::nextActor();

                morph:
                    SDL::lock();
                      visual_bin_set_morph_by_name( Vis::bin, (char*)"alphablend" );
                      visual_bin_switch_actor_by_name( Vis::bin, (char*)Vis::plugin );
                    SDL::unlock();

                    SDL_WM_SetCaption( Vis::plugin, 0 );

                    break;

                default:
                    ;
                }
                break;

            case SDL_VIDEORESIZE:
                Vis::resize( event.resize.w, event.resize.h );
                break;

            case SDL_MOUSEMOTION:
                visual_event_queue_add_mousemotion (vevent, event.motion.x, event.motion.y);
                break;

            case SDL_MOUSEBUTTONDOWN:
                if (event.button.button == SDL_BUTTON_RIGHT)
                {
                    SDL::toggleFullScreen();
                    break;
		}
                visual_event_queue_add_mousebutton (vevent, event.button.button, VISUAL_MOUSE_DOWN, 0, 0);
                break;

            case SDL_MOUSEBUTTONUP:
                visual_event_queue_add_mousebutton (vevent, event.button.button, VISUAL_MOUSE_UP, 0, 0);
                break;

            case SDL_QUIT:
                return false;

            default:
                ;
            }
        }

        return true;
    }