From f777cfb50a839f1f81f1f86b7d9586935c3624d6 Mon Sep 17 00:00:00 2001 From: Pierre Baillet Date: Fri, 9 Mar 2001 19:38:47 +0000 Subject: [PATCH] .nicer drop --- plugins/gtk/gtk_callbacks.c | 65 +++++++++++++++++++++++++++++++------ plugins/gtk/gtk_callbacks.h | 8 +++++ plugins/gtk/gtk_interface.c | 3 ++ plugins/gtk/gtk_playlist.c | 13 ++------ plugins/gtk/gtk_sys.h | 14 +++++++- plugins/gtk/intf_gtk.c | 4 +-- plugins/gtk/intf_gtk.glade | 5 +++ plugins/sdl/vout_sdl.c | 7 ++-- 8 files changed, 92 insertions(+), 27 deletions(-) diff --git a/plugins/gtk/gtk_callbacks.c b/plugins/gtk/gtk_callbacks.c index 4ecdcf3a83..03288a73f6 100644 --- a/plugins/gtk/gtk_callbacks.c +++ b/plugins/gtk/gtk_callbacks.c @@ -47,10 +47,10 @@ #include "intf_plst.h" #include "intf_msg.h" -#include "gtk_sys.h" #include "gtk_callbacks.h" #include "gtk_interface.h" #include "gtk_support.h" +#include "gtk_sys.h" #include "main.h" @@ -62,15 +62,6 @@ void on_generic_drop_data_received( intf_thread_t * p_intf, -/***************************************************************************** - * Inline function to retrieve the interface structure - *****************************************************************************/ -static __inline__ intf_thread_t * GetIntf( GtkWidget *item, char * psz_parent ) -{ - return( gtk_object_get_data( GTK_OBJECT( lookup_widget(item, psz_parent) ), - "p_intf" ) ); -} - /***************************************************************************** * Callbacks ******************************************************************************/ @@ -759,3 +750,57 @@ on_main_window_toggle (GtkMenuItem *menuitem, } } + +gboolean +on_playlist_clist_drag_motion (GtkWidget *widget, + GdkDragContext *drag_context, + gint x, + gint y, + guint time, + gpointer user_data) +{ + GtkCList * clist; + gint row,col; + int dummy; + gchar * text[2]; + GdkColor color; + intf_thread_t *p_intf = GetIntf( GTK_WIDGET(widget), "intf_playlist" ); + + + clist = GTK_CLIST(lookup_widget( p_intf->p_sys->p_playlist,"playlist_clist" + )); + + if(!GTK_WIDGET_TOPLEVEL(widget)) + { + gdk_window_raise( p_intf->p_sys->p_playlist->window ); + } + + color.red = 0xffff; + color.green = 0xffff; + color.blue = 0xffff; + + gtk_clist_freeze( clist ); + + for(dummy=0; dummyrows; dummy++) + { + gtk_clist_set_background ( clist, dummy , &color); + } + color.red = 0xffff; + color.green = 0; + color.blue = 0; + gtk_clist_set_background ( clist, p_main->p_playlist->i_index , &color); + + if( gtk_clist_get_selection_info( clist,x,y ,&row,&col )== 1) + { + color.red = 0; + color.green = 0x9000; + color.blue = 0xf000; + gtk_clist_set_background ( clist, row-1 , &color); + gtk_clist_set_background ( clist, row , &color); + } + + gtk_clist_thaw( clist ); + + return TRUE; +} + diff --git a/plugins/gtk/gtk_callbacks.h b/plugins/gtk/gtk_callbacks.h index 66928e260e..a55498f4b0 100644 --- a/plugins/gtk/gtk_callbacks.h +++ b/plugins/gtk/gtk_callbacks.h @@ -276,3 +276,11 @@ on_crop_activate (GtkMenuItem *menuitem, void on_invertselection_clicked (GtkMenuItem *menuitem, gpointer user_data); + +gboolean +on_playlist_clist_drag_motion (GtkWidget *widget, + GdkDragContext *drag_context, + gint x, + gint y, + guint time, + gpointer user_data); diff --git a/plugins/gtk/gtk_interface.c b/plugins/gtk/gtk_interface.c index 0d33af7354..d2deedb24a 100644 --- a/plugins/gtk/gtk_interface.c +++ b/plugins/gtk/gtk_interface.c @@ -1316,6 +1316,9 @@ create_intf_playlist (void) gtk_signal_connect (GTK_OBJECT (playlist_clist), "drag_data_received", GTK_SIGNAL_FUNC (on_intf_playlist_drag_data_received), NULL); + gtk_signal_connect (GTK_OBJECT (playlist_clist), "drag_motion", + GTK_SIGNAL_FUNC (on_playlist_clist_drag_motion), + NULL); return intf_playlist; } diff --git a/plugins/gtk/gtk_playlist.c b/plugins/gtk/gtk_playlist.c index 3995731d85..61cf767421 100644 --- a/plugins/gtk/gtk_playlist.c +++ b/plugins/gtk/gtk_playlist.c @@ -52,10 +52,10 @@ #include "intf_msg.h" #include "intf_urldecode.h" -#include "gtk_sys.h" #include "gtk_callbacks.h" #include "gtk_interface.h" #include "gtk_support.h" +#include "gtk_sys.h" #include "main.h" @@ -69,15 +69,6 @@ void GtkPlayListManage( gpointer p_data ); void on_generic_drop_data_received( intf_thread_t * p_intf, GtkSelectionData *data, guint info, int position); - -static __inline__ intf_thread_t * GetIntf( GtkWidget *item, char * psz_parent ) -{ - return( gtk_object_get_data( GTK_OBJECT( lookup_widget(item, psz_parent) ), - "p_intf" ) ); -} - - - void on_menubar_playlist_activate (GtkMenuItem *menuitem, gpointer user_data) @@ -314,7 +305,7 @@ on_intf_playlist_drag_data_received (GtkWidget *widget, &row, &col )== 1) { - on_generic_drop_data_received( p_intf, data, info, row -1 /*TRICK ! */); + on_generic_drop_data_received( p_intf, data, info, row ); } else { on_generic_drop_data_received( p_intf, data, info, PLAYLIST_END); } diff --git a/plugins/gtk/gtk_sys.h b/plugins/gtk/gtk_sys.h index 010b625c4b..e358f14003 100644 --- a/plugins/gtk/gtk_sys.h +++ b/plugins/gtk/gtk_sys.h @@ -2,7 +2,7 @@ * gtk_sys.h: private Gtk+ interface description ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: gtk_sys.h,v 1.4 2001/03/08 13:32:55 octplane Exp $ + * $Id: gtk_sys.h,v 1.5 2001/03/09 19:38:47 octplane Exp $ * * Authors: Samuel Hocevar * @@ -27,6 +27,18 @@ #define DROP_ACCEPT_TEXT_URI_LIST 0 #define DROP_ACCEPT_TEXT_PLAIN 1 +/***************************************************************************** + * useful inline function + ****************************************************************************/ +static __inline__ intf_thread_t * GetIntf( GtkWidget *item, char * psz_parent ) +{ + return( gtk_object_get_data( GTK_OBJECT( lookup_widget(item, psz_parent) ), + "p_intf" ) ); +} + + + + /***************************************************************************** * intf_sys_t: description and status of Gtk+ interface *****************************************************************************/ diff --git a/plugins/gtk/intf_gtk.c b/plugins/gtk/intf_gtk.c index 927cd3e051..619d204feb 100644 --- a/plugins/gtk/intf_gtk.c +++ b/plugins/gtk/intf_gtk.c @@ -2,7 +2,7 @@ * intf_gtk.c: Gtk+ interface ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: intf_gtk.c,v 1.8 2001/03/08 21:47:02 octplane Exp $ + * $Id: intf_gtk.c,v 1.9 2001/03/09 19:38:47 octplane Exp $ * * Authors: Samuel Hocevar * Stéphane Borel @@ -50,10 +50,10 @@ #include "intf_msg.h" #include "interface.h" -#include "gtk_sys.h" #include "gtk_callbacks.h" #include "gtk_interface.h" #include "gtk_support.h" +#include "gtk_sys.h" #include "main.h" diff --git a/plugins/gtk/intf_gtk.glade b/plugins/gtk/intf_gtk.glade index d80af7d02a..4478da0649 100644 --- a/plugins/gtk/intf_gtk.glade +++ b/plugins/gtk/intf_gtk.glade @@ -1399,6 +1399,11 @@ Henri Fallon <henri@via.ecp.fr> on_intf_playlist_drag_data_received Thu, 08 Mar 2001 12:00:13 GMT + + drag_motion + on_playlist_clist_drag_motion + Fri, 09 Mar 2001 18:32:47 GMT + 2 257,80 GTK_SELECTION_EXTENDED diff --git a/plugins/sdl/vout_sdl.c b/plugins/sdl/vout_sdl.c index c2acc2af45..4767349122 100644 --- a/plugins/sdl/vout_sdl.c +++ b/plugins/sdl/vout_sdl.c @@ -217,8 +217,10 @@ static int vout_Init( vout_thread_t *p_vout ) /* This hack is hugly, but hey, you are, too. */ SDL_Overlay * p_overlay; - - p_overlay = SDL_CreateYUVOverlay( VOUT_WIDTH_DEFAULT, VOUT_HEIGHT_DEFAULT, + + p_overlay = SDL_CreateYUVOverlay( + main_GetIntVariable( VOUT_WIDTH_VAR,VOUT_WIDTH_DEFAULT ), + main_GetIntVariable( VOUT_HEIGHT_VAR,VOUT_HEIGHT_DEFAULT ), SDL_YV12_OVERLAY, p_vout->p_sys->p_display ); intf_Msg( "vout: YUV acceleration %s", @@ -470,7 +472,6 @@ static void vout_Display( vout_thread_t *p_vout ) } else { - /* * p_vout->p_rendered_pic->p_y/u/v contains the YUV buffers to * render -- 2.39.2