$OpenBSD: patch-src_gui_c,v 1.12 2011/01/18 11:03:20 dcoppa Exp $ adapt audio/video device selection gui set DVD device to /dev/rcd0c instead of /dev/dvd use the right icon for the "Open iPod" menu fixes from upstream: don't hide controls and mouse in fullscreen mode when mouse is over controls plug a memory leak adjust audio and video cache size minimum and incremental values --- src/gui.c.orig Fri Nov 5 17:16:22 2010 +++ src/gui.c Tue Jan 18 10:29:24 2011 @@ -2716,7 +2716,7 @@ gboolean slide_panel_away(gpointer data) } // mutex was already locked, this is good since we only want to do the animation if locked - if (GTK_IS_WIDGET(fs_controls) && get_visible(fs_controls)) { + if (GTK_IS_WIDGET(fs_controls) && get_visible(fs_controls) && mouse_over_controls == FALSE) { gtk_widget_hide(fs_controls); g_mutex_unlock(slide_away); return FALSE; @@ -2748,7 +2748,8 @@ gboolean make_panel_and_mouse_invisible(gpointer data) GTimeVal currenttime; if ((fullscreen || always_hide_after_timeout) && auto_hide_timeout > 0 - && (get_visible(controls_box) || fs_controls != NULL)) { + && (get_visible(controls_box) || fs_controls != NULL) + && mouse_over_controls == FALSE) { g_get_current_time(¤ttime); g_time_val_add(¤ttime, -auto_hide_timeout * G_USEC_PER_SEC); if (last_movement_time > 0 && currenttime.tv_sec > last_movement_time) { @@ -2835,6 +2836,19 @@ gboolean leave_button_callback(GtkWidget * widget, Gdk return FALSE; } +gboolean fs_controls_entered(GtkWidget * widget, GdkEventCrossing * event, gpointer data) +{ + mouse_over_controls = TRUE; + return FALSE; +} + +gboolean fs_controls_left(GtkWidget * widget, GdkEventCrossing * event, gpointer data) +{ + mouse_over_controls = FALSE; + return FALSE; +} + + void menuitem_open_callback(GtkMenuItem * menuitem, void *data) { @@ -3303,9 +3317,11 @@ void parseChannels(FILE * f) void menuitem_open_dtv_callback(GtkMenuItem * menuitem, void *data) { - gtk_list_store_clear(playliststore); FILE *fi; // FILE pointer to use to open the conf file gchar *mpconf; + + gtk_list_store_clear(playliststore); + mpconf = g_strdup_printf("%s/.mplayer/channels.conf", g_getenv("HOME")); fi = fopen(mpconf, "r"); // Make sure this is pointing to // the appropriate file @@ -3315,7 +3331,8 @@ void menuitem_open_dtv_callback(GtkMenuItem * menuitem } else { printf("Unable to open the config file\n"); //can change this to whatever error message system is used } - + g_free(mpconf); + gtk_tree_model_get_iter_first(GTK_TREE_MODEL(playliststore), &iter); if (gtk_list_store_iter_is_valid(playliststore, &iter)) { play_iter(&iter, 0); @@ -5053,9 +5070,6 @@ void menuitem_config_callback(GtkMenuItem * menuitem, gtk_combo_box_append_text(GTK_COMBO_BOX(config_vo), "gl2"); gtk_combo_box_append_text(GTK_COMBO_BOX(config_vo), "x11"); gtk_combo_box_append_text(GTK_COMBO_BOX(config_vo), "xv"); - gtk_combo_box_append_text(GTK_COMBO_BOX(config_vo), "xvmc"); - gtk_combo_box_append_text(GTK_COMBO_BOX(config_vo), "vaapi"); - gtk_combo_box_append_text(GTK_COMBO_BOX(config_vo), "vdpau"); if (vo != NULL) { if (strcmp(vo, "gl") == 0) @@ -5066,16 +5080,10 @@ void menuitem_config_callback(GtkMenuItem * menuitem, gtk_combo_box_set_active(GTK_COMBO_BOX(config_vo), 2); if (strcmp(vo, "xv") == 0) gtk_combo_box_set_active(GTK_COMBO_BOX(config_vo), 3); - if (strcmp(vo, "xvmc") == 0) - gtk_combo_box_set_active(GTK_COMBO_BOX(config_vo), 4); - if (strcmp(vo, "vaapi") == 0) - gtk_combo_box_set_active(GTK_COMBO_BOX(config_vo), 5); - if (strcmp(vo, "vdpau") == 0) - gtk_combo_box_set_active(GTK_COMBO_BOX(config_vo), 6); if (gtk_combo_box_get_active(GTK_COMBO_BOX(config_vo)) == -1) { gtk_combo_box_append_text(GTK_COMBO_BOX(config_vo), vo); - gtk_combo_box_set_active(GTK_COMBO_BOX(config_vo), 7); + gtk_combo_box_set_active(GTK_COMBO_BOX(config_vo), 4); } } } @@ -5145,39 +5153,36 @@ void menuitem_config_callback(GtkMenuItem * menuitem, #ifdef GTK2_12_ENABLED gtk_widget_set_tooltip_text(config_ao, _ - ("mplayer audio output device\nalsa or oss should always work, try esd in gnome, arts in kde, or pulse on newer distributions")); + ("mplayer audio output device\nsndio should always work\nTry esd under GNOME, arts under KDE\nTry jack if you use the JACK sound server\nUse rtunes if you want to stream to an Apple AirPort Express")); #else tooltip = gtk_tooltips_new(); gtk_tooltips_set_tip(tooltip, config_ao, _ - ("mplayer audio output device\nalsa or oss should always work, try esd in gnome, arts in kde, or pulse on newer distributions"), + ("mplayer audio output device\nsndio should always work\nTry esd under GNOME, arts under KDE\nTry jack if you use the JACK sound server\nUse rtunes if you want to stream to an Apple AirPort Express"), NULL); #endif if (config_ao != NULL) { - gtk_combo_box_append_text(GTK_COMBO_BOX(config_ao), "alsa"); - gtk_combo_box_append_text(GTK_COMBO_BOX(config_ao), "arts"); + gtk_combo_box_append_text(GTK_COMBO_BOX(config_ao), "sndio"); gtk_combo_box_append_text(GTK_COMBO_BOX(config_ao), "esd"); + gtk_combo_box_append_text(GTK_COMBO_BOX(config_ao), "arts"); gtk_combo_box_append_text(GTK_COMBO_BOX(config_ao), "jack"); - gtk_combo_box_append_text(GTK_COMBO_BOX(config_ao), "oss"); - gtk_combo_box_append_text(GTK_COMBO_BOX(config_ao), "pulse"); + gtk_combo_box_append_text(GTK_COMBO_BOX(config_ao), "rtunes"); if (ao != NULL) { - if (strcmp(ao, "alsa") == 0) + if (strcmp(ao, "sndio") == 0) gtk_combo_box_set_active(GTK_COMBO_BOX(config_ao), 0); - if (strcmp(ao, "arts") == 0) - gtk_combo_box_set_active(GTK_COMBO_BOX(config_ao), 1); if (strcmp(ao, "esd") == 0) + gtk_combo_box_set_active(GTK_COMBO_BOX(config_ao), 1); + if (strcmp(ao, "arts") == 0) gtk_combo_box_set_active(GTK_COMBO_BOX(config_ao), 2); if (strcmp(ao, "jack") == 0) gtk_combo_box_set_active(GTK_COMBO_BOX(config_ao), 3); - if (strcmp(ao, "oss") == 0) + if (strcmp(ao, "rtunes") == 0) gtk_combo_box_set_active(GTK_COMBO_BOX(config_ao), 4); - if (strcmp(ao, "pulse") == 0) - gtk_combo_box_set_active(GTK_COMBO_BOX(config_ao), 5); if (gtk_combo_box_get_active(GTK_COMBO_BOX(config_ao)) == -1) { gtk_combo_box_append_text(GTK_COMBO_BOX(config_ao), ao); - gtk_combo_box_set_active(GTK_COMBO_BOX(config_ao), 6); + gtk_combo_box_set_active(GTK_COMBO_BOX(config_ao), 5); } } } @@ -5264,8 +5269,8 @@ void menuitem_config_callback(GtkMenuItem * menuitem, j = -1; config_mplayer_dvd_device = gtk_combo_box_entry_new_text(); - gtk_combo_box_append_text(GTK_COMBO_BOX(config_mplayer_dvd_device), "/dev/dvd"); - if (mplayer_dvd_device == NULL || g_ascii_strcasecmp("/dev/dvd", mplayer_dvd_device) == 0) { + gtk_combo_box_append_text(GTK_COMBO_BOX(config_mplayer_dvd_device), "/dev/rcd0c"); + if (mplayer_dvd_device == NULL || g_ascii_strcasecmp("/dev/rcd0c", mplayer_dvd_device) == 0) { j = i; } i++; @@ -5492,8 +5497,8 @@ void menuitem_config_callback(GtkMenuItem * menuitem, gtk_misc_set_padding(GTK_MISC(conf_label), 12, 0); gtk_table_attach(GTK_TABLE(conf_table), conf_label, 0, 1, i, i + 1, GTK_FILL, GTK_SHRINK, 0, 0); gtk_widget_show(conf_label); - config_plugin_audio_cache_size = gtk_spin_button_new_with_range(32, 256 * 1024, 128); - config_plugin_video_cache_size = gtk_spin_button_new_with_range(32, 256 * 1024, 512); + config_plugin_audio_cache_size = gtk_spin_button_new_with_range(64, 256 * 1024, 64); + config_plugin_video_cache_size = gtk_spin_button_new_with_range(256, 256 * 1024, 256); #ifdef GTK2_12_ENABLED gtk_widget_set_tooltip_text(config_plugin_audio_cache_size, _ @@ -6634,9 +6639,9 @@ GtkWidget *create_window(gint windowid) gtk_menu_append(menu_file_tv, GTK_WIDGET(menuitem_file_open_dtv)); #ifdef HAVE_GPOD menuitem_file_open_ipod = - GTK_MENU_ITEM(gtk_image_menu_item_new_with_mnemonic(_("Open _iPod™"))); + GTK_MENU_ITEM(gtk_image_menu_item_new_with_mnemonic(_("Open _iPod"))); gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem_file_open_ipod), - gtk_image_new_from_icon_name("ipod", GTK_ICON_SIZE_MENU)); + gtk_image_new_from_icon_name("multimedia-player", GTK_ICON_SIZE_MENU)); gtk_menu_append(menu_file, GTK_WIDGET(menuitem_file_open_ipod)); #endif @@ -7658,6 +7663,10 @@ void show_fs_controls() if (fs_controls == NULL && fullscreen) { fs_controls = gtk_window_new(GTK_WINDOW_POPUP); + gtk_widget_add_events(fs_controls, GDK_ENTER_NOTIFY_MASK); + gtk_widget_add_events(fs_controls, GDK_LEAVE_NOTIFY_MASK); + g_signal_connect(G_OBJECT(fs_controls), "enter_notify_event", G_CALLBACK(fs_controls_entered), NULL); + g_signal_connect(G_OBJECT(fs_controls), "leave_notify_event", G_CALLBACK(fs_controls_left), NULL); g_object_ref(hbox); gtk_container_remove(GTK_CONTAINER(controls_box), hbox); gtk_container_add(GTK_CONTAINER(fs_controls), hbox);