Пример #1
0
/**
 * Gets called by the policy framework if an important
 * event arrives: Incoming calls etc.
 */
void maemo_tell_rockbox_to_stop_audio(void)
{
    sim_enter_irq_handler();
    queue_broadcast(SYS_CALL_INCOMING, 0);
    sim_exit_irq_handler();

    osso_system_note_infoprint(maemo_osso_ctx, "Stopping rockbox playback", NULL);
}
Пример #2
0
void gui_message_loop(void)
{
    SDL_Event event;
    bool quit;

    do {
        /* wait for the next event */
        while(SDL_WaitEvent(&event) == 0)
            printf("SDL_WaitEvent() error\n");

        sim_enter_irq_handler();
        quit = event_handler(&event);
        sim_exit_irq_handler();

    } while(!quit);
}
Uint32 tick_timer(Uint32 interval, void *param)
{
    long new_tick;

    (void) interval;
    (void) param;
    
    new_tick = (SDL_GetTicks() - start_tick) / (1000/HZ);
        
    while(new_tick != current_tick)
    {
        sim_enter_irq_handler();

        /* Run through the list of tick tasks - increments tick
         * on each iteration. */
        call_tick_tasks();

        sim_exit_irq_handler();
    }
    
    return interval;
}
Пример #4
0
bool gui_message_loop(void)
{
    SDL_Event event;
    static int x,y,xybutton = 0;

    while (SDL_WaitEvent(&event))
    {
        sim_enter_irq_handler();
        switch(event.type)
        {
            case SDL_KEYDOWN:
            case SDL_KEYUP:
                button_event(event.key.keysym.sym, event.type == SDL_KEYDOWN);
                break;
#ifdef HAVE_TOUCHSCREEN
            case SDL_MOUSEMOTION:
                if (event.motion.state & SDL_BUTTON(1))
                    touchscreen_event(event.motion.x, event.motion.y);
                break;
#endif
            case SDL_MOUSEBUTTONDOWN:
                switch ( event.button.button ) {
#ifdef HAVE_SCROLLWHEEL
                    case SDL_BUTTON_WHEELUP:
                        button_event( SDLK_UP, true );
                        break;
                    case SDL_BUTTON_WHEELDOWN:
                        button_event( SDLK_DOWN, true );
                        break;
#endif
                    case SDL_BUTTON_LEFT:
                    case SDL_BUTTON_MIDDLE:
                        if ( mapping && background ) {
                            x = event.button.x;
                            y = event.button.y;
                        }
                        if ( background ) {
                            xybutton = xy2button( event.button.x, event.button.y );
                            if( xybutton ) {
                                button_event( xybutton, true );
                                break;
                            }
                        }
#ifdef HAVE_TOUCHSCREEN
                        touchscreen_event(event.button.x, event.button.y);
#endif
                        break;

                    default:
                        break;
                }

                if (debug_wps && event.button.button == 1)
                {
                    if ( background ) 
#ifdef HAVE_REMOTE
                        if ( event.button.y < UI_REMOTE_POSY ) /* Main Screen */
                            printf("Mouse at: (%d, %d)\n", event.button.x - UI_LCD_POSX -1 , event.button.y - UI_LCD_POSY - 1 );
                        else 
                            printf("Mouse at: (%d, %d)\n", event.button.x - UI_REMOTE_POSX -1 , event.button.y - UI_REMOTE_POSY - 1 );
#else
                        printf("Mouse at: (%d, %d)\n", event.button.x - UI_LCD_POSX -1 , event.button.y - UI_LCD_POSY - 1 );
#endif
                    else 
                        if ( event.button.y/display_zoom < LCD_HEIGHT ) /* Main Screen */
                            printf("Mouse at: (%d, %d)\n", event.button.x/display_zoom, event.button.y/display_zoom );
#ifdef HAVE_REMOTE
                        else
                            printf("Mouse at: (%d, %d)\n", event.button.x/display_zoom, event.button.y/display_zoom - LCD_HEIGHT );
#endif
                }
                break;
            case SDL_MOUSEBUTTONUP:
                switch ( event.button.button ) {
                    /* The scrollwheel button up events are ignored as they are queued immediately */
                    case SDL_BUTTON_LEFT:
                    case SDL_BUTTON_MIDDLE:
                        if ( mapping && background ) {
                            printf("    { SDLK_,     %d, %d, %d, \"\" },\n", x,
#define SQUARE(x) ((x)*(x))
                            y, (int)sqrt( SQUARE(x-(int)event.button.x)
                                    + SQUARE(y-(int)event.button.y))  );
                        }
                        if ( background && xybutton ) {
                                button_event( xybutton, false );
                                xybutton = 0;
                            }
#ifdef HAVE_TOUCHSCREEN
                            else
                                button_event(BUTTON_TOUCHSCREEN, false);
#endif
                        break;
                    default:
                        break;
                }
                break;
                

            case SDL_QUIT:
            {
                sim_exit_irq_handler();
                return false;
            }
            default:
                /*printf("Unhandled event\n"); */
                break;
        }
        sim_exit_irq_handler();
    }