Sync up so that Elliot can fix shaped-windows dnd -mig

This commit is contained in:
Miguel de Icaza 1998-03-06 03:48:31 +00:00
parent 158aeb9c72
commit d80470500b
5 changed files with 107 additions and 2 deletions

View File

@ -1,3 +1,25 @@
Wed Mar 4 22:43:00 1998 Miguel de Icaza <miguel@nuclecu.unam.mx>
* gtools.c (query_dialog): Rewritten to use the MC dialog/widget code.
* gutil.c (my_system), acconfig.h: By default gnome will not have
a subshell (at least for now) and will now exec everything
asyncronously by default.
* gscreen.c: Exactly what was I thinking when I used the
g_panel_contents structure will remain a mistery for future
programming psycologists. It was a huge mistake.
* gdesktop.c: Use the new icon/text display routine from
Federico.
Tue Mar 3 21:03:52 1998 Miguel de Icaza <miguel@nuclecu.unam.mx>
* gmain.c (x_destroy_dlg): Call gtk_grab_remove when destroying
the dialog.
* gmain.c (x_focus_widget): Handle special case of toplevels.
1998-03-04 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gscreen.c: Some hackish changes to work around idempotence bugs

21
gnome/directory-ok.xpm Normal file
View File

@ -0,0 +1,21 @@
/* XPM */
static char * directory_xpm[] = {
"16 13 5 1",
" c None",
". c #000000000000",
"X c #FFFFFFFFFFFF",
"o c blue",
"O c #C71BC30B0000",
" ..... ",
".XXXXo. ",
".XoooOo.........",
".XooooOXXXXXXXo.",
".XooooooooooooO.",
".XooooooooooooO.",
".XooooooooooooO.",
".XooooooooooooO.",
".XooooooooooooO.",
".XooooooooooooO.",
".XooooooooooooO.",
".oOOOOOOOOOOOOO.",
"................"};

View File

@ -1,2 +1,3 @@
#define MC_LIB_DESKTOP "mc.desktop"
GtkWidget *create_transparent_text_window (char *file, char *text, int extra_events);
GtkWidget *make_transparent_window (char *file);

View File

@ -28,6 +28,7 @@
#include "gscreen.h"
#include "dir.h"
#include "dialog.h"
#include "gdesktop.h"
#include "directory.xpm"
@ -42,6 +43,8 @@ static char *drop_types [] = { "url:ALL" };
#define ELEMENTS(x) (sizeof (x) / sizeof (x[0]))
GtkWidget *drag_directory = NULL;
GtkWidget *drag_directory_ok = NULL;
void
repaint_file (WPanel *panel, int file_index, int move, int attr, int isstatus)
@ -693,14 +696,38 @@ fixed_gtk_widget_dnd_drag_set (GtkCList *clist, int drag_enable, gchar **type_ac
gdk_window_dnd_drag_set (clist->clist_window, drag_enable, type_accept_list, numtypes);
}
static void
panel_drag_begin (GtkWidget *widget, GdkEvent *event, WPanel *panel)
{
printf ("Drag starting\n");
}
static void
panel_realized (GtkWidget *file_list, WPanel *panel)
{
GdkPoint hotspot = { 5, 5 };
GtkObject *obj = GTK_OBJECT (file_list);
if (!drag_directory)
drag_directory = make_transparent_window ("directory-ok.xpm");
if (!drag_directory_ok)
drag_directory_ok = make_transparent_window ("directory.xpm");
if (drag_directory && drag_directory_ok){
gtk_widget_show (drag_directory_ok);
gtk_widget_show (drag_directory);
gdk_dnd_set_drag_shape (drag_directory->window, &hotspot,
drag_directory_ok->window, &hotspot);
}
/* DND: Drag setup */
gtk_signal_connect (obj, "drag_request_event",
GTK_SIGNAL_FUNC (panel_drag_request), panel);
gtk_signal_connect (obj, "drag_begin_event",
GTK_SIGNAL_FUNC (panel_drag_begin), panel);
fixed_gtk_widget_dnd_drag_set (GTK_CLIST (file_list), TRUE, drag_types, ELEMENTS (drag_types));
/* DND: Drop setup */

View File

@ -274,3 +274,37 @@ create_transparent_text_window (char *file, char *text, int extra_events)
return window;
}
GtkWidget *
make_transparent_window (char *file)
{
GdkImlibImage *im;
GtkWidget *window;
if (!g_file_exists (file))
return NULL;
im = gdk_imlib_load_image (file);
if (!im)
return NULL;
printf ("Lo cargo\n");
gtk_widget_push_visual (gdk_imlib_get_visual ());
gtk_widget_push_colormap (gdk_imlib_get_colormap ());
window = gtk_window_new (GTK_WINDOW_POPUP);
gtk_widget_pop_colormap ();
gtk_widget_pop_visual ();
gtk_widget_realize (window);
gtk_widget_set_usize (window, im->rgb_width, im->rgb_height);
/* All of the following 3 lines should not be required, only
* gdk_imlib_apply_image, but is is buggy.
*/
gdk_imlib_render (im, im->rgb_width, im->rgb_height);
gdk_window_set_back_pixmap (window->window, gdk_imlib_move_image (im), FALSE);
gdk_window_shape_combine_mask (window->window, gdk_imlib_move_mask (im), 0, 0);
return window;
}