diff options
author | Federico Mena Quintero <federico@nuclecu.unam.mx> | 1999-01-20 04:51:44 +0800 |
---|---|---|
committer | Arturo Espinosa <unammx@src.gnome.org> | 1999-01-20 04:51:44 +0800 |
commit | e5e5df258a54dc493e2d0aa7403a619640486bd6 (patch) | |
tree | 04d0021b5feaad37f985d94d76332d147f870507 /calendar/gui/quick-view.c | |
parent | 6b547a4d981c062257049a2cc3d3fbfa6a772d83 (diff) | |
download | gsoc2013-evolution-e5e5df258a54dc493e2d0aa7403a619640486bd6.tar.gz gsoc2013-evolution-e5e5df258a54dc493e2d0aa7403a619640486bd6.tar.zst gsoc2013-evolution-e5e5df258a54dc493e2d0aa7403a619640486bd6.zip |
Do not grab the mouse here (it was being grabbed incorrectly, anyways).
1999-01-19 Federico Mena Quintero <federico@nuclecu.unam.mx>
* quick-view.c (quick_view_do_popup): Do not grab the mouse here
(it was being grabbed incorrectly, anyways).
(quick_view_map_event): Grab the mouse when the window is mapped.
This avoids the ugly "while (xGrabPointer () != Success)" hack.
(quick_view_button_release): Handle button releases here.
svn path=/trunk/; revision=613
Diffstat (limited to 'calendar/gui/quick-view.c')
-rw-r--r-- | calendar/gui/quick-view.c | 60 |
1 files changed, 35 insertions, 25 deletions
diff --git a/calendar/gui/quick-view.c b/calendar/gui/quick-view.c index ce48f4cf6e..337cfdbf73 100644 --- a/calendar/gui/quick-view.c +++ b/calendar/gui/quick-view.c @@ -16,6 +16,12 @@ static void quick_view_class_init (QuickViewClass *class); static void quick_view_init (QuickView *qv); +static gint quick_view_button_release (GtkWidget *widget, GdkEventButton *event); +static gint quick_view_map_event (GtkWidget *widget, GdkEventAny *event); + + +static GtkWindowClass *parent_class; + GtkType quick_view_get_type (void) @@ -43,6 +49,14 @@ quick_view_get_type (void) static void quick_view_class_init (QuickViewClass *class) { + GtkWidgetClass *widget_class; + + widget_class = (GtkWidgetClass *) class; + + parent_class = gtk_type_class (gtk_window_get_type ()); + + widget_class->button_release_event = quick_view_button_release; + widget_class->map_event = quick_view_map_event; } static void @@ -52,27 +66,40 @@ quick_view_init (QuickView *qv) gtk_window_set_position (GTK_WINDOW (qv), GTK_WIN_POS_MOUSE); } -/* Handles button release events from the canvas in the quick view. When a button release is - * received, it pops down the quick view and calls gtk_main_quit(). - */ static gint -button_release (GtkWidget *widget, GdkEventButton *event, gpointer data) +quick_view_button_release (GtkWidget *widget, GdkEventButton *event) { QuickView *qv; - qv = data; + qv = QUICK_VIEW (widget); if (event->button != qv->button) return FALSE; gdk_pointer_ungrab (event->time); - gtk_grab_remove (GTK_WIDGET (qv->canvas)); + gtk_grab_remove (GTK_WIDGET (qv)); gtk_widget_hide (GTK_WIDGET (qv)); - gtk_main_quit (); /* End modality */ + gtk_main_quit (); /* End modality of the quick view */ return TRUE; } +static gint +quick_view_map_event (GtkWidget *widget, GdkEventAny *event) +{ + GdkCursor *cursor; + + cursor = gdk_cursor_new (GDK_ARROW); + gdk_pointer_grab (widget->window, + TRUE, + GDK_BUTTON_RELEASE_MASK, + NULL, + cursor, + GDK_CURRENT_TIME); + gdk_cursor_destroy (cursor); + + return FALSE; +} /* Creates the items corresponding to a single calendar object. Takes in the y position of the * items to create and returns the y position of the next item to create. Also takes in the current @@ -218,10 +245,6 @@ quick_view_new (GnomeCalendar *calendar, char *title, GList *event_list) gtk_widget_pop_colormap (); gtk_widget_pop_visual (); - gtk_signal_connect (GTK_OBJECT (qv->canvas), "button_release_event", - (GtkSignalFunc) button_release, - qv); - gtk_container_add (GTK_CONTAINER (w), qv->canvas); /* Set up the event list */ @@ -234,8 +257,6 @@ quick_view_new (GnomeCalendar *calendar, char *title, GList *event_list) void quick_view_do_popup (QuickView *qv, GdkEventButton *event) { - GdkCursor *cursor; - g_return_if_fail (qv != NULL); g_return_if_fail (IS_QUICK_VIEW (qv)); g_return_if_fail (event != NULL); @@ -243,18 +264,7 @@ quick_view_do_popup (QuickView *qv, GdkEventButton *event) /* Pop up the window */ gtk_widget_show_all (GTK_WIDGET (qv)); - gtk_grab_add (qv->canvas); - - cursor = gdk_cursor_new (GDK_ARROW); - - while (gdk_pointer_grab (GTK_LAYOUT (qv->canvas)->bin_window, - TRUE, - GDK_BUTTON_RELEASE_MASK, - NULL, - cursor, - event->time) != 0); /* wait for success */ - - gdk_cursor_destroy (cursor); + gtk_grab_add (GTK_WIDGET (qv)); qv->button = event->button; |