Exemplo n.º 1
0
void FloatingWindow::widget_grab_focus(GtkWidget * widget)
{
  if (widget != last_focused_widget) {
    focus_set ();
  }
  last_focused_widget = widget;
}
Exemplo n.º 2
0
void FloatingWindow::container_tree_callback (GtkWidget *widget, gpointer user_data)
// Recursive callback that fires the focus signal if the widget belongs to the object.
{
  if (widget == focused_widget_to_look_for) {
    last_focused_widget = widget;
    focus_set ();
  }
  if (GTK_IS_CONTAINER(widget)) {
    gtk_container_foreach(GTK_CONTAINER(widget), on_container_tree_callback, user_data);
  }
}
Exemplo n.º 3
0
int game_sel_got_focus( void ) {
	if( game_sel_populate( game_first() ) == 0 ) {
		game_sel_show();
		snap_show();
		idle_counter = 1;
		
		if( config_get()->iface.theme.menu.auto_hide ) {
			menu_hide();
			submenu_hide();
		}
	}
	else {
		sound_play( SOUND_NO );
		focus_set( FOCUS_SUBMENU );
	}
	return 0;
}
Exemplo n.º 4
0
int game_sel_event( int event ) {
	int o = config_get()->iface.theme.game_sel.orientation;
	switch( event ) {
		case EVENT_UP:
			if( o == CONFIG_LANDSCAPE )
				game_sel_skip_back();
			else
				game_sel_retreat();
			break;
		case EVENT_DOWN:
			if( o == CONFIG_LANDSCAPE )
				game_sel_skip_forward();
			else
				game_sel_advance();
			break;
		case EVENT_LEFT:
			if( o == CONFIG_LANDSCAPE )
				game_sel_retreat();
			else
				game_sel_skip_back();
			break;
		case EVENT_RIGHT:
			if( o == CONFIG_LANDSCAPE )
				game_sel_advance();
			else
				game_sel_skip_forward();
			break;
		case EVENT_SELECT:
			snap_clear();
			emulator_run( game_sel_current() );
			break;
		case EVENT_BACK:
			snap_clear();
			sound_play( SOUND_BACK );
			focus_set( FOCUS_SUBMENU );
			break;
		default:
			break;
	}
	return 0;
}
Exemplo n.º 5
0
int main( int argc, char *arvg[] ) {
	int quit = 0;
	int config_status = 0;
	int event;

#ifdef __WIN32__
	freopen( "cabrio.out", "w", stdout );
	freopen( "cabrio.err", "w", stderr );
#endif

	config_status = config_open( NULL );
	if( config_status == -1 )
		return -1;

	if( sdl_init() != 0 )
		bail();

	if( ogl_init() != 0 )
		bail();
	
	/* Clear the screen as soon as we can. This avoids graphics
	 * glitches which can occur with some SDL implementations. */
	ogl_clear();
	sdl_swap();

	if( event_init() != 0 )
		bail();

	if( font_init() != 0 )
		bail();

	if( config_status == 1 ) {
		/* Config file didn't exist, so run the setup utility */
		if( setup() != 0 )
			return -1;
		config_update();
		if( config_create() != 0 )
			return -1;
	}

	location_init();

	/* If config or location results in a new font, it'll be loaded here. */
	font_free();
	font_init();

	/* Large game lists take a while to initialise,
	 * so show the background while we wait... */
	bg_init();
	bg_clear();
	bg_draw();
	sdl_swap();

	if( platform_init() != 0 )
		bail();

	if( category_init() != 0 )
		bail();

	if( game_sel_init() != 0 )
		bail();

	if( hint_init() != 0 )
		bail();

	if( snap_init() != 0 )
		bail();
	
	if( game_list_create() != 0 )
		bail();

	if( menu_init() != 0 )
		bail();

	if( submenu_init() != 0 )
		bail();

	sound_init();
	video_init();
	
	event_flush();

	if( !config_get()->iface.theme.menu.auto_hide )
		menu_show();
		
	focus_set( FOCUS_GAMESEL );

	while( !quit ) {
		ogl_clear();
		bg_draw();
		snap_draw();
		if (!config_get()->iface.hide_buttons)
			hint_draw();
		menu_draw();
		submenu_draw();
		game_sel_draw();
		sdl_swap();
		if (Mix_PlayingMusic() != 1 && config_get()->iface.theme_sound && reader_running == 0) 
			playmusic();
		if (( event = event_poll() )) {
			if( supress_wait == 0 ) {
				if( event == EVENT_QUIT ) {
					quit = 1;
				}
				else {
					supress();
					event_process( event );
				}
			}
		}
		if( supress_wait > 0 )
			supress_wait--;
		
		sdl_frame_delay();
	}
	clean_up();
	return 0;
}
Exemplo n.º 6
0
void FloatingWindow::on_widget_button_press (GtkWidget *widget, GdkEventButton *event)
{
  focus_set ();
}