2006-11-06 Masatake YAMATO * toolbar-standalone-gtk.c (button_2press_event_cb): New function. (main): Connect `button_2press_event_cb' to double button press event. (button_release_event_cb): Return unless dragging. (button_press_event_cb): Return if double button press event. Index: toolbar-standalone-gtk.c =================================================================== --- toolbar-standalone-gtk.c (リビジョン 3948) +++ toolbar-standalone-gtk.c (作業コピー) @@ -65,10 +65,39 @@ } static gboolean +button_2press_event_cb(GtkWidget *window, GdkEventButton *event, gpointer data) +{ + GtkWidget *toolbar; + gint height; + + if (event->type == GDK_2BUTTON_PRESS) { + toolbar = GTK_WIDGET(data); + if (GTK_WIDGET_VISIBLE (toolbar)) + { + gint width; + + gtk_window_get_size(GTK_WINDOW(window), &width, &height); + gtk_widget_hide(toolbar); + } + else + { + height = -1; + gtk_widget_show(toolbar); + } + + gtk_widget_set_size_request(window, -1, height); + } + return FALSE; +} + +static gboolean button_press_event_cb(GtkWidget *widget, GdkEventButton *event, gpointer data) { GdkCursor *cursor; + if (event->type == GDK_2BUTTON_PRESS) + return FALSE; + cursor = gdk_cursor_new (GDK_CROSSHAIR); gdk_pointer_grab(widget->window, FALSE, GDK_BUTTON_RELEASE_MASK | @@ -138,6 +167,9 @@ static gboolean button_release_event_cb(GtkWidget *widget, GdkEventButton *event, gpointer data) { + if (!toolbar_dragging) + return FALSE; + gdk_pointer_ungrab(event->time); pointer_drag_start_x = -1; @@ -246,6 +278,9 @@ g_signal_connect(G_OBJECT(window), "size-request", G_CALLBACK(size_request_cb), NULL); + g_signal_connect(G_OBJECT(window), "button-press-event", + G_CALLBACK(button_2press_event_cb), toolbar); + gtk_widget_show_all(GTK_WIDGET (window)); if (argc > 1) {