# HG changeset patch # User ib # Date 1306249064 0 # Node ID dc8779e0e9cc04f9bde8ab142edd215b320f0c72 # Parent 6ddb6b73281aa82d12e77dd0a23ae159b8f2d050 Allow direct selection with middle mouse button (single click). This works with both, adding files to and removing files from the playlist without the necessity of pressing the add or remove button. diff -r 6ddb6b73281a -r dc8779e0e9cc gui/mplayer/gtk/pl.c --- a/gui/mplayer/gtk/pl.c Tue May 24 14:31:46 2011 +0000 +++ b/gui/mplayer/gtk/pl.c Tue May 24 14:57:44 2011 +0000 @@ -104,6 +104,7 @@ static int sigSel; static int sigUnsel; +static int sigEvent; typedef struct { @@ -264,6 +265,7 @@ gtk_signal_handler_block( GTK_OBJECT( CLSelected ),sigSel ); gtk_signal_handler_block( GTK_OBJECT( CLSelected ),sigUnsel ); + gtk_signal_handler_block( GTK_OBJECT( CLSelected ),sigEvent ); gtk_clist_freeze( GTK_CLIST( CLSelected ) ); for ( i=0;itype == GDK_BUTTON_RELEASE && bevent->button == 2 ) + { + if ( gtk_clist_get_selection_info( GTK_CLIST( widget ), bevent->x, bevent->y, &row, &col ) ) + { + switch ( (int) user_data ) + { + case 0: + CLFileSelected[row] = 1; + plButtonReleased( NULL, (void *) 3 ); + CLFileSelected[row] = 0; + return TRUE; + + case 1: + CLListSelected[row] = 1; + plButtonReleased( NULL, (void *) 2 ); + return TRUE; + } + } + } + + return FALSE; +} + static int check_for_subdir( gchar * path ) { DIR * dir; @@ -557,8 +594,10 @@ gtk_signal_connect( GTK_OBJECT( CLFiles ),"select_row",GTK_SIGNAL_FUNC( plRowSelect ),(void *)0 ); gtk_signal_connect( GTK_OBJECT( CLFiles ),"unselect_row",GTK_SIGNAL_FUNC( plUnRowSelect ),(void *)0 ); + gtk_signal_connect( GTK_OBJECT( CLFiles ),"event",GTK_SIGNAL_FUNC( plEvent ),(void *)0 ); sigSel=gtk_signal_connect( GTK_OBJECT( CLSelected ),"select_row",GTK_SIGNAL_FUNC( plRowSelect ),(void*)1 ); sigUnsel=gtk_signal_connect( GTK_OBJECT( CLSelected ),"unselect_row",GTK_SIGNAL_FUNC( plUnRowSelect ),(void*)1 ); + sigEvent=gtk_signal_connect( GTK_OBJECT( CLSelected ),"event",GTK_SIGNAL_FUNC( plEvent ),(void *)1 ); gtk_signal_connect( GTK_OBJECT( Add ),"clicked",GTK_SIGNAL_FUNC( plButtonReleased ),(void*)3 ); gtk_signal_connect( GTK_OBJECT( Remove ),"clicked",GTK_SIGNAL_FUNC( plButtonReleased ),(void*)2 );