From de865965467646238243c7d43a163cf139273ccd Mon Sep 17 00:00:00 2001 From: Miguel de Icaza Date: Thu, 9 Apr 1998 21:59:32 +0000 Subject: [PATCH] Assorted bug fixes -mig --- gnome/gdesktop.c | 46 +++++++++++++++++++++++++++++++++++++++++----- gnome/gnome.TODO | 3 --- gnome/gscreen.c | 21 +++++++++++++++++---- 3 files changed, 58 insertions(+), 12 deletions(-) diff --git a/gnome/gdesktop.c b/gnome/gdesktop.c index d353f903a..fb42ec011 100644 --- a/gnome/gdesktop.c +++ b/gnome/gdesktop.c @@ -137,13 +137,13 @@ artificial_drag_start (GdkWindow *window, int x, int y) if (!wp->dnd_drag_enabled) return; +#if 0 if (!gdk_dnd.drag_perhaps) return; if (gdk_dnd.dnd_grabbed) return; if (gdk_dnd.drag_really) return; - gdk_dnd_drag_addwindow (window); gdk_dnd_drag_begin (window); XGrabPointer (gdk_display, wp->xwindow, False, @@ -151,9 +151,39 @@ artificial_drag_start (GdkWindow *window, int x, int y) GrabModeAsync, GrabModeAsync, gdk_root_window, None, CurrentTime); gdk_dnd.dnd_grabbed = TRUE; - gdk_dnd.drag_perhaps = 1; gdk_dnd.drag_really = 1; gdk_dnd_display_drag_cursor (x, y, FALSE, TRUE); +#endif + gdk_dnd.real_sw = wp; + gdk_dnd.dnd_drag_start.x = x; + gdk_dnd.dnd_drag_start.y = y; + gdk_dnd.drag_perhaps = 1; + if(gdk_dnd.drag_startwindows) + { + g_free(gdk_dnd.drag_startwindows); + gdk_dnd.drag_startwindows = NULL; + } + gdk_dnd.drag_numwindows = gdk_dnd.drag_really = 0; + gdk_dnd.dnd_grabbed = FALSE; + { + /* Set motion mask for first DnD'd window, since it + will be the one that is actually dragged */ + XWindowAttributes dnd_winattr; + XSetWindowAttributes dnd_setwinattr; + + /* We need to get motion events while the button is down, so + we can know whether to really start dragging or not... */ + XGetWindowAttributes(gdk_display, (Window)wp->xwindow, + &dnd_winattr); + + wp->dnd_drag_savedeventmask = dnd_winattr.your_event_mask; + dnd_setwinattr.event_mask = + wp->dnd_drag_eventmask = ButtonMotionMask | ButtonPressMask | ButtonReleaseMask | + EnterWindowMask | LeaveWindowMask; + XChangeWindowAttributes(gdk_display, wp->xwindow, + CWEventMask, &dnd_setwinattr); + } + } static int operation_value; @@ -488,17 +518,21 @@ destroy_shaped_dnd_windows (void) } /* As Elliot can not be bothered to fix his DnD code in Gdk and it is an absolute mess */ -static int in_desktop_dnd; +/* static int in_desktop_dnd; */ static void desktop_icon_drag_start (GtkWidget *widget, GdkEvent *event, desktop_icon_t *di) { char *fname; + g_print("!!!!! desktop_icon_drag_start"); +#if 0 if (in_desktop_dnd) return; - + in_desktop_dnd = 1; +#endif + /* This should not happen, as the drag end routine should destroy those widgets */ destroy_shaped_dnd_windows (); @@ -523,8 +557,10 @@ desktop_icon_drag_start (GtkWidget *widget, GdkEvent *event, desktop_icon_t *di) static void desktop_icon_drag_end (GtkWidget *widget, GdkEvent *event, desktop_icon_t *di) { +#if 0 in_desktop_dnd = 0; - printf ("drag end!\n"); +#endif + printf ("!!!!!!!! drag end!\n"); destroy_shaped_dnd_windows (); } diff --git a/gnome/gnome.TODO b/gnome/gnome.TODO index d4e7f12a2..b447fe6c6 100644 --- a/gnome/gnome.TODO +++ b/gnome/gnome.TODO @@ -11,9 +11,6 @@ Desktop: Panels: - Global bindings (some shortcuts are not implemented) -- Add a nifty toolbar: - - Back/Forward/History buttons are trivial to implement - with the new history code from Paul Sheer. - Split view. - External panelize hangs diff --git a/gnome/gscreen.c b/gnome/gscreen.c index ffcb85876..76f2cb650 100644 --- a/gnome/gscreen.c +++ b/gnome/gscreen.c @@ -103,8 +103,11 @@ panel_file_list_set_row_colors (GtkCList *cl, int row, int color_pair) void x_panel_update_marks (WPanel *panel) { - gtk_widget_set_sensitive (panel->fwd_b, panel->dir_history->next ? 1 : 0); - gtk_widget_set_sensitive (panel->back_b, panel->dir_history->prev ? 1 : 0); + int ff = panel->dir_history->next ? 1 : 0; + int bf = panel->dir_history->prev ? 1 : 0; + + gtk_widget_set_sensitive (panel->fwd_b, ff); + gtk_widget_set_sensitive (panel->back_b, bf); } void @@ -1215,18 +1218,24 @@ panel_create_filter (Dlg_head *h, WPanel *panel, void **filter_w) return fhbox; } -void +static void panel_back (GtkWidget *button, WPanel *panel) { directory_history_prev (panel); } -void +static void panel_fwd (GtkWidget *button, WPanel *panel) { directory_history_next (panel); } +static void +panel_up (GtkWidget *button, WPanel *panel) +{ + do_panel_cd (panel, "..", cd_exact); +} + void x_create_panel (Dlg_head *h, widget_data parent, WPanel *panel) { @@ -1249,12 +1258,15 @@ x_create_panel (Dlg_head *h, widget_data parent, WPanel *panel) /* buttons */ back_p = gnome_stock_pixmap_widget_new (very_top, GNOME_STOCK_MENU_BACK); fwd_p = gnome_stock_pixmap_widget_new (very_top, GNOME_STOCK_MENU_FORWARD); + + panel->up_b = gtk_button_new_with_label ("up"); panel->back_b = gtk_button_new (); panel->fwd_b = gtk_button_new (); gtk_container_add (GTK_CONTAINER (panel->back_b), back_p); gtk_container_add (GTK_CONTAINER (panel->fwd_b), fwd_p); gtk_signal_connect (GTK_OBJECT (panel->back_b), "clicked", GTK_SIGNAL_FUNC(panel_back), panel); gtk_signal_connect (GTK_OBJECT (panel->fwd_b), "clicked", GTK_SIGNAL_FUNC(panel_fwd), panel); + gtk_signal_connect (GTK_OBJECT (panel->up_b), "clicked", GTK_SIGNAL_FUNC(panel_up), panel); panel_update_marks (panel); /* ministatus */ @@ -1265,6 +1277,7 @@ x_create_panel (Dlg_head *h, widget_data parent, WPanel *panel) status_line = gtk_hbox_new (0, 0); gtk_label_set_justify (GTK_LABEL (panel->ministatus), GTK_JUSTIFY_LEFT); gtk_box_pack_start (GTK_BOX (status_line), panel->back_b, 0, 0, 2); + gtk_box_pack_start (GTK_BOX (status_line), panel->up_b, 0, 0, 2); gtk_box_pack_start (GTK_BOX (status_line), panel->fwd_b, 0, 0, 2); gtk_box_pack_start (GTK_BOX (status_line), cwd, 1, 1, 5); gtk_box_pack_end (GTK_BOX (status_line), filter, 0, 0, 0);