diff options
author | Havoc Pennington <hp@pobox.com> | 2001-03-24 06:10:40 +0000 |
---|---|---|
committer | Havoc Pennington <hp@src.gnome.org> | 2001-03-24 06:10:40 +0000 |
commit | 207e3bb9771b9e28c93cf2da5edebab543ed6a36 (patch) | |
tree | 0b1e1e598064d006384e4a3ccbb98e7aaf011b79 /gtk | |
parent | b6b4e13fd8b21077ec8646a9c6e161782c04d32a (diff) | |
download | gtk+-207e3bb9771b9e28c93cf2da5edebab543ed6a36.tar.gz |
make this somewhat key-navigable
2001-03-23 Havoc Pennington <hp@pobox.com>
* gtk/gtkhsv.c: make this somewhat key-navigable
* gtk/gtkfontsel.c: mnemonics
* gtk/gtkgamma.c: mnemonics
* gtk/gtkcolorsel.c: add mnemonics to labels
2001-03-22 Havoc Pennington <hp@pobox.com>
Applied big patch from Seth Lytle to fix event handler return
values, slightly modified.
* gtk/gtkcalendar.c (gtk_calendar_button_press): return TRUE if
handled.
(gtk_calendar_key_press): return TRUE for GDK_space triggers
select_day
* gtk/gtkclist.c (gtk_clist_button_press): return TRUE if handled
(gtk_clist_button_release): return TRUE if handled
* gtk/gtkcolorsel.c (mouse_release):
(palette_activate):
(palette_press):
(palette_new):
(mouse_press):
(get_screen_color):
fixed return type (void to gboolean), return TRUE,
added GTK_SIGNAL_FUNC cast
* gtk/gtkcombo.c (gtk_combo_popup_button_press): fixed return type
(void to gboolean), and return TRUE
(gtk_combo_button_release): changed return value to TRUE after
gtk_grab_add on combo->popwin
* gtk/gtkctree.c (gtk_ctree_button_press): return TRUE if triggers a
collapse or expand
* gtk/gtkcurve.c (gtk_curve_graph_events): return TRUE for
button/motion
* gtk/gtkdnd.c (gtk_drag_source_event_cb): return TRUE for button
press/release and motion that trigger act
* gtk/gtkentry.c (gtk_entry_button_release): return TRUE
* gtk/gtkfontsel.c (gtk_font_selection_size_key_press): return TRUE
for GDK_Return
* gtk/gtklist.c (gtk_list_button_press): return TRUE mostly
(gtk_list_button_release): return TRUE if selection
* gtk/gtklistitem.c (gtk_list_item_button_press): return TRUE on
press
* gtk/gtkmenushell.c (gtk_menu_shell_button_press):
(gtk_menu_shell_button_release): chain parent_menu_shell retval
* gtk/gtknotebook.c (gtk_notebook_button_press): return FALSE if
nothing triggered
(gtk_notebook_button_release): return TRUE if we do anything
* gtk/gtkspinbutton.c (gtk_spin_button_button_press):
(gtk_spin_button_button_release): return TRUE or chained retval
* gtk/gtktext.c (gtk_text_button_press):
(gtk_text_button_release): return TRUE
(gtk_text_key_press): remove redundant retval code
* gtk/gtktreeitem.c (gtk_tree_item_button_press): return TRUE if button
and sensitive
(gtk_tree_item_subtree_button_click): changed type to gint, and return
TRUE if sensitive
* gtk/gtktooltips.c (gtk_tooltips_event_handler): deactivate implies
return TRUE
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/gtkcalendar.c | 32 | ||||
-rw-r--r-- | gtk/gtkcellrenderertoggle.c | 2 | ||||
-rw-r--r-- | gtk/gtkclist.c | 11 | ||||
-rw-r--r-- | gtk/gtkcolorsel.c | 56 | ||||
-rw-r--r-- | gtk/gtkcombo.c | 7 | ||||
-rw-r--r-- | gtk/gtkctree.c | 3 | ||||
-rw-r--r-- | gtk/gtkcurve.c | 7 | ||||
-rw-r--r-- | gtk/gtkdnd.c | 8 | ||||
-rw-r--r-- | gtk/gtkentry.c | 2 | ||||
-rw-r--r-- | gtk/gtkfilesel.c | 3 | ||||
-rw-r--r-- | gtk/gtkfontsel.c | 42 | ||||
-rw-r--r-- | gtk/gtkgamma.c | 3 | ||||
-rw-r--r-- | gtk/gtkhsv.c | 247 | ||||
-rw-r--r-- | gtk/gtkhsv.h | 13 | ||||
-rw-r--r-- | gtk/gtkinputdialog.c | 10 | ||||
-rw-r--r-- | gtk/gtklist.c | 4 | ||||
-rw-r--r-- | gtk/gtklistitem.c | 8 | ||||
-rw-r--r-- | gtk/gtkmenushell.c | 5 | ||||
-rw-r--r-- | gtk/gtknotebook.c | 9 | ||||
-rw-r--r-- | gtk/gtkspinbutton.c | 6 | ||||
-rw-r--r-- | gtk/gtktext.c | 8 | ||||
-rw-r--r-- | gtk/gtktexttag.c | 2 | ||||
-rw-r--r-- | gtk/gtktextview.c | 4 | ||||
-rw-r--r-- | gtk/gtktooltips.c | 2 | ||||
-rw-r--r-- | gtk/gtktreeitem.c | 10 | ||||
-rw-r--r-- | gtk/gtktreemodelsort.c | 2 | ||||
-rw-r--r-- | gtk/gtktreeview.c | 2 |
27 files changed, 392 insertions, 116 deletions
diff --git a/gtk/gtkcalendar.c b/gtk/gtkcalendar.c index 05eb0f463a..ad3571400a 100644 --- a/gtk/gtkcalendar.c +++ b/gtk/gtkcalendar.c @@ -2305,6 +2305,7 @@ gtk_calendar_button_press (GtkWidget *widget, GtkCalendar *calendar; GtkCalendarPrivateData *private_data; gint x, y; + void (* action_func) (GtkCalendar *); g_return_val_if_fail (widget != NULL, FALSE); g_return_val_if_fail (GTK_IS_CALENDAR (widget), FALSE); @@ -2318,23 +2319,23 @@ gtk_calendar_button_press (GtkWidget *widget, if (event->window == private_data->main_win) gtk_calendar_main_button (widget, event); - - if (event->type != GDK_BUTTON_PRESS) - return FALSE; /* Double-clicks? Triple-clicks? No thanks! */ + + action_func = NULL; if (event->window == private_data->arrow_win[ARROW_MONTH_LEFT]) - gtk_calendar_set_month_prev (calendar); - - if (event->window == private_data->arrow_win[ARROW_MONTH_RIGHT]) - gtk_calendar_set_month_next (calendar); - - if (event->window == private_data->arrow_win[ARROW_YEAR_LEFT]) - gtk_calendar_set_year_prev (calendar); - - if (event->window == private_data->arrow_win[ARROW_YEAR_RIGHT]) - gtk_calendar_set_year_next (calendar); - - return FALSE; + action_func = gtk_calendar_set_month_prev; + else if (event->window == private_data->arrow_win[ARROW_MONTH_RIGHT]) + action_func = gtk_calendar_set_month_next; + else if (event->window == private_data->arrow_win[ARROW_YEAR_LEFT]) + action_func = gtk_calendar_set_year_prev; + else if (event->window == private_data->arrow_win[ARROW_YEAR_RIGHT]) + action_func = gtk_calendar_set_year_next; + + /* only call the action on single click, not double */ + if (event->type == GDK_BUTTON_PRESS) + (* action_func) (calendar); + + return action_func != NULL; } static gboolean @@ -2732,6 +2733,7 @@ gtk_calendar_key_press (GtkWidget *widget, if (row > -1 && col > -1) { + return_val = TRUE; gtk_calendar_freeze (calendar); if (calendar->day_month[row][col] == MONTH_PREV) diff --git a/gtk/gtkcellrenderertoggle.c b/gtk/gtkcellrenderertoggle.c index 6207968f39..bf9c421dad 100644 --- a/gtk/gtkcellrenderertoggle.c +++ b/gtk/gtkcellrenderertoggle.c @@ -317,7 +317,7 @@ gtk_cell_renderer_toggle_event (GtkCellRenderer *cell, guint flags) { GtkCellRendererToggle *celltoggle; - gint retval = FALSE; + gboolean retval = FALSE; celltoggle = GTK_CELL_RENDERER_TOGGLE (cell); diff --git a/gtk/gtkclist.c b/gtk/gtkclist.c index c501aba51f..bcca0abcba 100644 --- a/gtk/gtkclist.c +++ b/gtk/gtkclist.c @@ -5024,7 +5024,7 @@ gtk_clist_button_press (GtkWidget *widget, } } } - return FALSE; + return TRUE; } /* press on resize windows */ @@ -5059,7 +5059,10 @@ gtk_clist_button_press (GtkWidget *widget, if (GTK_CLIST_ADD_MODE(clist)) gdk_gc_set_line_attributes (clist->xor_gc, 1, GDK_LINE_SOLID, 0, 0); draw_xor_line (clist); + + return TRUE; } + return FALSE; } @@ -5113,7 +5116,8 @@ gtk_clist_button_release (GtkWidget *widget, width = new_column_width (clist, i, &x); gtk_clist_set_column_width (clist, i, width); - return FALSE; + + return TRUE; } if (clist->drag_button == event->button) @@ -5153,7 +5157,10 @@ gtk_clist_button_release (GtkWidget *widget, break; } } + + return TRUE; } + return FALSE; } diff --git a/gtk/gtkcolorsel.c b/gtk/gtkcolorsel.c index a87258895a..0a706f013e 100644 --- a/gtk/gtkcolorsel.c +++ b/gtk/gtkcolorsel.c @@ -598,7 +598,7 @@ palette_expose (GtkWidget *drawing_area, palette_paint (drawing_area, &(event->area), data); } -static void +static gint palette_press (GtkWidget *drawing_area, GdkEventButton *event, gpointer data) @@ -619,6 +619,7 @@ palette_press (GtkWidget *drawing_area, } gtk_widget_queue_clear (priv->last_palette); + return TRUE; } static void @@ -793,9 +794,10 @@ palette_activate (GtkWidget *widget, { priv = colorsel->private_data; palette_set_color (widget, GTK_COLOR_SELECTION (data), priv->color); + return TRUE; } - return TRUE; + return FALSE; } static GtkWidget* @@ -811,6 +813,7 @@ palette_new (GtkColorSelection *colorsel) gtk_object_set_data (GTK_OBJECT (retval), "color_set", GINT_TO_POINTER (0)); gtk_widget_set_events (retval, GDK_BUTTON_PRESS_MASK | GDK_EXPOSURE_MASK); + gtk_signal_connect (GTK_OBJECT (retval), "expose_event", GTK_SIGNAL_FUNC (palette_expose), colorsel); gtk_signal_connect (GTK_OBJECT (retval), "button_press_event", @@ -907,15 +910,15 @@ mouse_motion (GtkWidget *button, grab_color_at_mouse (button, event->x_root, event->y_root, data); } -static void +static gboolean mouse_release (GtkWidget *button, GdkEventButton *event, gpointer data) { GtkColorSelection *colorsel = data; ColorSelectionPrivate *priv; - priv = colorsel->private_data; - + priv = colorsel->private_data; + gtk_signal_disconnect_by_func (GTK_OBJECT (button), GTK_SIGNAL_FUNC (mouse_motion), data); gtk_signal_disconnect_by_func (GTK_OBJECT (button), @@ -923,10 +926,11 @@ mouse_release (GtkWidget *button, grab_color_at_mouse (button, event->x_root, event->y_root, data); gdk_pointer_ungrab (0); + return TRUE; } /* Helper Functions */ -static void +static gboolean mouse_press (GtkWidget *button, GdkEventButton *event, gpointer data) @@ -934,7 +938,7 @@ mouse_press (GtkWidget *button, GtkColorSelection *colorsel = data; ColorSelectionPrivate *priv; priv = colorsel->private_data; - + gtk_signal_connect (GTK_OBJECT (button), "motion_notify_event", GTK_SIGNAL_FUNC (mouse_motion), data); @@ -943,7 +947,8 @@ mouse_press (GtkWidget *button, data); gtk_signal_disconnect_by_func (GTK_OBJECT (button), GTK_SIGNAL_FUNC (mouse_press), - data); + data); + return TRUE; } /* when the button is clicked */ @@ -966,6 +971,7 @@ get_screen_color (GtkWidget *button) if (priv->moving_dropper == FALSE) { priv->moving_dropper = TRUE; + gtk_signal_connect (GTK_OBJECT (button), "button_press_event", GTK_SIGNAL_FUNC (mouse_press), colorsel); @@ -1155,12 +1161,15 @@ make_label_spinbutton (GtkColorSelection *colorsel, } gtk_object_set_data (GTK_OBJECT (adjust), "COLORSEL", colorsel); *spinbutton = gtk_spin_button_new (adjust, 10.0, 0); + gtk_signal_connect (GTK_OBJECT (*spinbutton), "focus_in_event", GTK_SIGNAL_FUNC (widget_focus_in), colorsel); gtk_signal_connect (GTK_OBJECT (adjust), "value_changed", GTK_SIGNAL_FUNC (adjustment_changed), GINT_TO_POINTER (channel_type)); - label = gtk_label_new (text); + label = gtk_label_new_with_mnemonic (text); + gtk_label_set_mnemonic_widget (GTK_LABEL (label), *spinbutton); + gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); gtk_table_attach_defaults (GTK_TABLE (table), label, i, i+1, j, j+1); gtk_table_attach_defaults (GTK_TABLE (table), *spinbutton, i+1, i+2, j, j+1); @@ -1402,20 +1411,22 @@ gtk_color_selection_init (GtkColorSelection *colorsel) gtk_table_set_row_spacings (GTK_TABLE (table), 4); gtk_table_set_col_spacings (GTK_TABLE (table), 4); - make_label_spinbutton (colorsel, &priv->hue_spinbutton, _("Hue:"), table, 0, 0, COLORSEL_HUE); - make_label_spinbutton (colorsel, &priv->sat_spinbutton, _("Saturation:"), table, 0, 1, COLORSEL_SATURATION); - make_label_spinbutton (colorsel, &priv->val_spinbutton, _("Value:"), table, 0, 2, COLORSEL_VALUE); - make_label_spinbutton (colorsel, &priv->red_spinbutton, _("Red:"), table, 6, 0, COLORSEL_RED); - make_label_spinbutton (colorsel, &priv->green_spinbutton, _("Green:"), table, 6, 1, COLORSEL_GREEN); - make_label_spinbutton (colorsel, &priv->blue_spinbutton, _("Blue:"), table, 6, 2, COLORSEL_BLUE); + make_label_spinbutton (colorsel, &priv->hue_spinbutton, _("_Hue:"), table, 0, 0, COLORSEL_HUE); + make_label_spinbutton (colorsel, &priv->sat_spinbutton, _("_Saturation:"), table, 0, 1, COLORSEL_SATURATION); + make_label_spinbutton (colorsel, &priv->val_spinbutton, _("_Value:"), table, 0, 2, COLORSEL_VALUE); + make_label_spinbutton (colorsel, &priv->red_spinbutton, _("_Red:"), table, 6, 0, COLORSEL_RED); + make_label_spinbutton (colorsel, &priv->green_spinbutton, _("_Green:"), table, 6, 1, COLORSEL_GREEN); + make_label_spinbutton (colorsel, &priv->blue_spinbutton, _("_Blue:"), table, 6, 2, COLORSEL_BLUE); gtk_table_attach_defaults (GTK_TABLE (table), gtk_hseparator_new (), 0, 8, 3, 4); - priv->opacity_label = gtk_label_new (_("Opacity:")); + priv->opacity_label = gtk_label_new_with_mnemonic (_("_Opacity:")); gtk_misc_set_alignment (GTK_MISC (priv->opacity_label), 1.0, 0.5); gtk_table_attach_defaults (GTK_TABLE (table), priv->opacity_label, 0, 1, 4, 5); adjust = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, 255.0, 1.0, 1.0, 0.0)); gtk_object_set_data (GTK_OBJECT (adjust), "COLORSEL", colorsel); - priv->opacity_slider = gtk_hscale_new (adjust); + priv->opacity_slider = gtk_hscale_new (adjust); + gtk_label_set_mnemonic_widget (GTK_LABEL (priv->opacity_label), + priv->opacity_slider); gtk_scale_set_draw_value (GTK_SCALE (priv->opacity_slider), FALSE); gtk_signal_connect (GTK_OBJECT(adjust), "value_changed", GTK_SIGNAL_FUNC (adjustment_changed), @@ -1429,12 +1440,16 @@ gtk_color_selection_init (GtkColorSelection *colorsel) GTK_SIGNAL_FUNC (opacity_entry_changed), colorsel); gtk_table_attach_defaults (GTK_TABLE (table), priv->opacity_entry, 7, 8, 4, 5); - label = gtk_label_new (_("Hex Value:")); + label = gtk_label_new_with_mnemonic (_("He_x Value:")); gtk_table_attach_defaults (GTK_TABLE (table), label, 0, 1, 5, 6); gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); priv->hex_entry = gtk_entry_new (); + + gtk_label_set_mnemonic_widget (GTK_LABEL (label), priv->hex_entry); + gtk_signal_connect (GTK_OBJECT (priv->hex_entry), "activate", GTK_SIGNAL_FUNC (hex_changed), colorsel); + gtk_widget_set_usize (priv->hex_entry, 75, -1); gtk_table_set_col_spacing (GTK_TABLE (table), 3, 15); gtk_table_attach_defaults (GTK_TABLE (table), priv->hex_entry, 1, 5, 5, 6); @@ -1456,8 +1471,11 @@ gtk_color_selection_init (GtkColorSelection *colorsel) vbox = gtk_vbox_new (FALSE, 4); gtk_container_add (GTK_CONTAINER (priv->palette_frame), vbox); gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0); - button = gtk_button_new_with_label (_("Set Color")); + + button = gtk_button_new_with_mnemonic (_("Set _Color")); + gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (add_button_pressed), colorsel); + gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0); gtk_container_set_border_width (GTK_CONTAINER (vbox), 4); diff --git a/gtk/gtkcombo.c b/gtk/gtkcombo.c index be607894ce..0bb3fc8aba 100644 --- a/gtk/gtkcombo.c +++ b/gtk/gtkcombo.c @@ -71,7 +71,7 @@ static void gtk_combo_get_pos (GtkCombo *combo, static void gtk_combo_popup_list (GtkCombo *combo); static void gtk_combo_activate (GtkWidget *widget, GtkCombo *combo); -static void gtk_combo_popup_button_press (GtkWidget *button, +static gboolean gtk_combo_popup_button_press (GtkWidget *button, GdkEventButton *event, GtkCombo *combo); static void gtk_combo_popup_button_leave (GtkWidget *button, @@ -491,7 +491,7 @@ gtk_combo_activate (GtkWidget *widget, NULL, NULL, GDK_CURRENT_TIME); } -static void +static gboolean gtk_combo_popup_button_press (GtkWidget *button, GdkEventButton *event, GtkCombo *combo) @@ -510,6 +510,7 @@ gtk_combo_popup_button_press (GtkWidget *button, GDK_BUTTON_RELEASE_MASK, NULL, NULL, event->time); gtk_grab_add (combo->list); + return TRUE; } static void @@ -628,7 +629,7 @@ gtk_combo_button_release (GtkWidget * widget, GdkEvent * event, GtkCombo * combo GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK, NULL, NULL, GDK_CURRENT_TIME); - return FALSE; + return TRUE; } } else diff --git a/gtk/gtkctree.c b/gtk/gtkctree.c index ff4fe0d895..2ea6d473c7 100644 --- a/gtk/gtkctree.c +++ b/gtk/gtkctree.c @@ -824,9 +824,10 @@ gtk_ctree_button_press (GtkWidget *widget, else gtk_ctree_expand (ctree, work); - return FALSE; + return TRUE; } } + return GTK_WIDGET_CLASS (parent_class)->button_press_event (widget, event); } diff --git a/gtk/gtkcurve.c b/gtk/gtkcurve.c index 8954d9e56b..e846dd117d 100644 --- a/gtk/gtkcurve.c +++ b/gtk/gtkcurve.c @@ -433,6 +433,7 @@ gtk_curve_graph_events (GtkWidget *widget, GdkEvent *event, GtkCurve *c) gfloat rx, ry, min_x; guint distance; gint x1, x2, y1, y2; + gint retval = FALSE; w = GTK_WIDGET (c); width = w->allocation.width - RADIUS * 2; @@ -519,6 +520,7 @@ gtk_curve_graph_events (GtkWidget *widget, GdkEvent *event, GtkCurve *c) break; } gtk_curve_draw (c, width, height); + retval = TRUE; break; case GDK_BUTTON_RELEASE: @@ -554,6 +556,7 @@ gtk_curve_graph_events (GtkWidget *widget, GdkEvent *event, GtkCurve *c) } new_type = GDK_FLEUR; c->grab_point = -1; + retval = TRUE; break; case GDK_MOTION_NOTIFY: @@ -652,12 +655,14 @@ gtk_curve_graph_events (GtkWidget *widget, GdkEvent *event, GtkCurve *c) gdk_window_set_cursor (w->window, cursor); gdk_cursor_destroy (cursor); } + retval = TRUE; break; default: break; } - return FALSE; + + return retval; } void diff --git a/gtk/gtkdnd.c b/gtk/gtkdnd.c index 9877213452..982facda47 100644 --- a/gtk/gtkdnd.c +++ b/gtk/gtkdnd.c @@ -2466,6 +2466,7 @@ gtk_drag_source_event_cb (GtkWidget *widget, gpointer data) { GtkDragSourceSite *site; + gboolean retval = FALSE; site = (GtkDragSourceSite *)data; switch (event->type) @@ -2476,6 +2477,7 @@ gtk_drag_source_event_cb (GtkWidget *widget, site->state |= (GDK_BUTTON1_MASK << (event->button.button - 1)); site->x = event->button.x; site->y = event->button.y; + retval = TRUE; } break; @@ -2483,6 +2485,7 @@ gtk_drag_source_event_cb (GtkWidget *widget, if ((GDK_BUTTON1_MASK << (event->button.button - 1)) & site->start_button_mask) { site->state &= ~(GDK_BUTTON1_MASK << (event->button.button - 1)); + retval = TRUE; } break; @@ -2524,7 +2527,7 @@ gtk_drag_source_event_cb (GtkWidget *widget, gtk_drag_set_icon_default (context); } - return TRUE; + retval = TRUE; } } break; @@ -2532,7 +2535,8 @@ gtk_drag_source_event_cb (GtkWidget *widget, default: /* hit for 2/3BUTTON_PRESS */ break; } - return FALSE; + + return retval; } static void diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index e07e08d451..046980492a 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -1348,7 +1348,7 @@ gtk_entry_button_release (GtkWidget *widget, gtk_entry_update_primary_selection (entry); - return FALSE; + return TRUE; } static gint diff --git a/gtk/gtkfilesel.c b/gtk/gtkfilesel.c index 130a81eab7..f2107d9aca 100644 --- a/gtk/gtkfilesel.c +++ b/gtk/gtkfilesel.c @@ -1058,13 +1058,14 @@ gtk_file_selection_create_dir (GtkWidget *widget, FALSE, FALSE, 0); gtk_widget_show( vbox); - label = gtk_label_new (_("Directory name:")); + label = gtk_label_new_with_mnemonic (_("_Directory name:")); gtk_misc_set_alignment(GTK_MISC (label), 0.0, 0.0); gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 5); gtk_widget_show (label); /* The directory entry widget */ fs->fileop_entry = gtk_entry_new (); + gtk_label_set_mnemonic_widget (GTK_LABEL (label), fs->fileop_entry); gtk_box_pack_start (GTK_BOX (vbox), fs->fileop_entry, TRUE, TRUE, 5); GTK_WIDGET_SET_FLAGS (fs->fileop_entry, GTK_CAN_DEFAULT); diff --git a/gtk/gtkfontsel.c b/gtk/gtkfontsel.c index 027b052a59..86e6ea4f00 100644 --- a/gtk/gtkfontsel.c +++ b/gtk/gtkfontsel.c @@ -186,23 +186,7 @@ gtk_font_selection_init(GtkFontSelection *fontsel) gtk_widget_show (table); gtk_table_set_col_spacings(GTK_TABLE(table), 8); gtk_box_pack_start (GTK_BOX (fontsel), table, TRUE, TRUE, 0); - - fontsel->font_label = gtk_label_new(_("Family:")); - gtk_misc_set_alignment (GTK_MISC (fontsel->font_label), 0.0, 0.5); - gtk_widget_show (fontsel->font_label); - gtk_table_attach (GTK_TABLE (table), fontsel->font_label, 0, 1, 0, 1, - GTK_FILL, 0, 0, 0); - label = gtk_label_new(_("Style:")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_widget_show (label); - gtk_table_attach (GTK_TABLE (table), label, 1, 2, 0, 1, - GTK_FILL, 0, 0, 0); - label = gtk_label_new(_("Size:")); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_widget_show (label); - gtk_table_attach (GTK_TABLE (table), label, 2, 3, 0, 1, - GTK_FILL, 0, 0, 0); - + fontsel->font_entry = gtk_entry_new (); gtk_entry_set_editable(GTK_ENTRY(fontsel->font_entry), FALSE); gtk_widget_set_usize (fontsel->font_entry, 20, -1); @@ -226,6 +210,29 @@ gtk_font_selection_init(GtkFontSelection *fontsel) (GtkSignalFunc) gtk_font_selection_size_key_press, fontsel); + fontsel->font_label = gtk_label_new_with_mnemonic (_("_Family:")); + gtk_label_set_mnemonic_widget (GTK_LABEL (fontsel->font_label), + fontsel->font_entry); + gtk_misc_set_alignment (GTK_MISC (fontsel->font_label), 0.0, 0.5); + gtk_widget_show (fontsel->font_label); + gtk_table_attach (GTK_TABLE (table), fontsel->font_label, 0, 1, 0, 1, + GTK_FILL, 0, 0, 0); + label = gtk_label_new_with_mnemonic (_("_Style:")); + gtk_label_set_mnemonic_widget (GTK_LABEL (label), + fontsel->font_style_entry); + gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); + gtk_widget_show (label); + gtk_table_attach (GTK_TABLE (table), label, 1, 2, 0, 1, + GTK_FILL, 0, 0, 0); + label = gtk_label_new_with_mnemonic (_("Si_ze:")); + gtk_label_set_mnemonic_widget (GTK_LABEL (label), + fontsel->size_entry); + gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); + gtk_widget_show (label); + gtk_table_attach (GTK_TABLE (table), label, 2, 3, 0, 1, + GTK_FILL, 0, 0, 0); + + /* Create the clists */ fontsel->font_clist = gtk_clist_new (1); gtk_clist_column_titles_hide (GTK_CLIST (fontsel->font_clist)); @@ -716,6 +723,7 @@ gtk_font_selection_size_key_press (GtkWidget *w, fontsel->font_desc->size = new_size; gtk_font_selection_load_font (fontsel); } + return TRUE; } return FALSE; diff --git a/gtk/gtkgamma.c b/gtk/gtkgamma.c index 700185baf3..220ee8ecee 100644 --- a/gtk/gtkgamma.c +++ b/gtk/gtkgamma.c @@ -399,12 +399,13 @@ button_clicked_callback (GtkWidget *w, gpointer data) gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 2); gtk_widget_show (hbox); - label = gtk_label_new (_("Gamma value")); + label = gtk_label_new (_("_Gamma value")); gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 2); gtk_widget_show (label); sprintf (buf, "%g", c->gamma); c->gamma_text = gtk_entry_new (); + gtk_label_set_mnemonic_widget (GTK_LABEL (label), c->gamma_text); gtk_entry_set_text (GTK_ENTRY (c->gamma_text), buf); gtk_box_pack_start (GTK_BOX (hbox), c->gamma_text, TRUE, TRUE, 2); gtk_widget_show (c->gamma_text); diff --git a/gtk/gtkhsv.c b/gtk/gtkhsv.c index e4d0bcc853..654c1c0aee 100644 --- a/gtk/gtkhsv.c +++ b/gtk/gtkhsv.c @@ -25,6 +25,9 @@ #include <math.h> #include "gtksignal.h" #include "gtkhsv.h" +#include "gdk/gdkkeysyms.h" +#include "gtkbindings.h" +#include "gtkcontainer.h" /* * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS @@ -66,6 +69,9 @@ typedef struct { /* Dragging mode */ DragMode mode; + + guint focus_on_ring : 1; + } HSVPrivate; @@ -74,6 +80,7 @@ typedef struct { enum { CHANGED, + MOVE, LAST_SIGNAL }; @@ -96,6 +103,11 @@ static gint gtk_hsv_motion (GtkWidget *widget, GdkEventMotion *event); static gint gtk_hsv_expose (GtkWidget *widget, GdkEventExpose *event); +static gboolean gtk_hsv_focus (GtkContainer *container, + GtkDirectionType direction); + +static void gtk_hsv_move (GtkHSV *hsv, + GtkDirectionType dir); static guint hsv_signals[LAST_SIGNAL]; static GtkWidgetClass *parent_class; @@ -127,7 +139,7 @@ gtk_hsv_get_type (void) (GtkClassInitFunc) NULL }; - hsv_type = gtk_type_unique (GTK_TYPE_WIDGET, &hsv_info); + hsv_type = gtk_type_unique (GTK_TYPE_CONTAINER, &hsv_info); } return hsv_type; @@ -139,12 +151,16 @@ gtk_hsv_class_init (GtkHSVClass *class) { GtkObjectClass *object_class; GtkWidgetClass *widget_class; + GtkContainerClass *container_class; + GtkHSVClass *hsv_class; + GtkBindingSet *binding_set; object_class = (GtkObjectClass *) class; widget_class = (GtkWidgetClass *) class; + container_class = GTK_CONTAINER_CLASS (class); + hsv_class = GTK_HSV_CLASS (class); - parent_class = gtk_type_class (GTK_TYPE_WIDGET); - + parent_class = gtk_type_class (GTK_TYPE_WIDGET); object_class->destroy = gtk_hsv_destroy; @@ -159,6 +175,10 @@ gtk_hsv_class_init (GtkHSVClass *class) widget_class->motion_notify_event = gtk_hsv_motion; widget_class->expose_event = gtk_hsv_expose; + container_class->focus = gtk_hsv_focus; + + hsv_class->move = gtk_hsv_move; + hsv_signals[CHANGED] = gtk_signal_new ("changed", GTK_RUN_FIRST, @@ -166,6 +186,45 @@ gtk_hsv_class_init (GtkHSVClass *class) GTK_SIGNAL_OFFSET (GtkHSVClass, changed), gtk_marshal_VOID__VOID, GTK_TYPE_NONE, 0); + + hsv_signals[MOVE] = + gtk_signal_new ("move", + GTK_RUN_LAST | GTK_RUN_ACTION, + GTK_CLASS_TYPE (object_class), + GTK_SIGNAL_OFFSET (GtkHSVClass, move), + gtk_marshal_VOID__ENUM, + GTK_TYPE_NONE, 1, GTK_TYPE_DIRECTION_TYPE); + + binding_set = gtk_binding_set_by_class (class); + + gtk_binding_entry_add_signal (binding_set, GDK_Up, 0, + "move", 1, + GTK_TYPE_ENUM, GTK_DIR_UP); + gtk_binding_entry_add_signal (binding_set, GDK_KP_Up, 0, + "move", 1, + GTK_TYPE_ENUM, GTK_DIR_UP); + + gtk_binding_entry_add_signal (binding_set, GDK_Down, 0, + "move", 1, + GTK_TYPE_ENUM, GTK_DIR_DOWN); + gtk_binding_entry_add_signal (binding_set, GDK_KP_Down, 0, + "move", 1, + GTK_TYPE_ENUM, GTK_DIR_DOWN); + + + gtk_binding_entry_add_signal (binding_set, GDK_Right, 0, + "move", 1, + GTK_TYPE_ENUM, GTK_DIR_RIGHT); + gtk_binding_entry_add_signal (binding_set, GDK_KP_Right, 0, + "move", 1, + GTK_TYPE_ENUM, GTK_DIR_RIGHT); + + gtk_binding_entry_add_signal (binding_set, GDK_Left, 0, + "move", 1, + GTK_TYPE_ENUM, GTK_DIR_LEFT); + gtk_binding_entry_add_signal (binding_set, GDK_KP_Left, 0, + "move", 1, + GTK_TYPE_ENUM, GTK_DIR_LEFT); } /* Object initialization function for the HSV color selector */ @@ -178,6 +237,7 @@ gtk_hsv_init (GtkHSV *hsv) hsv->priv = priv; GTK_WIDGET_SET_FLAGS (hsv, GTK_NO_WINDOW); + GTK_WIDGET_SET_FLAGS (hsv, GTK_CAN_FOCUS); priv->h = 0.0; priv->s = 0.0; @@ -268,7 +328,8 @@ gtk_hsv_realize (GtkWidget *widget) attr.height = widget->allocation.height; attr.wclass = GDK_INPUT_ONLY; attr.event_mask = gtk_widget_get_events (widget); - attr.event_mask |= (GDK_BUTTON_PRESS_MASK + attr.event_mask |= (GDK_KEY_PRESS_MASK + | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK); @@ -727,6 +788,9 @@ gtk_hsv_button_press (GtkWidget *widget, compute_v (hsv, x, y), priv->s, priv->v); + + gtk_widget_grab_focus (widget); + priv->focus_on_ring = TRUE; return TRUE; } @@ -740,6 +804,10 @@ gtk_hsv_button_press (GtkWidget *widget, compute_sv (hsv, x, y, &s, &v); gtk_hsv_set_color (hsv, priv->h, s, v); + + gtk_widget_grab_focus (widget); + priv->focus_on_ring = FALSE; + return TRUE; } @@ -967,17 +1035,21 @@ paint_ring (GtkHSV *hsv, g_free (buf); /* Draw ring outline */ - - gdk_rgb_gc_set_foreground (priv->gc, 0x000000); - - gdk_draw_arc (drawable, priv->gc, FALSE, - -x, -y, - priv->size - 1, priv->size - 1, - 0, 360 * 64); - gdk_draw_arc (drawable, priv->gc, FALSE, - -x + priv->ring_width - 1, -y + priv->ring_width - 1, - priv->size - 2 * priv->ring_width + 1, priv->size - 2 * priv->ring_width + 1, - 0, 360 * 64); + + if (GTK_WIDGET_HAS_FOCUS (hsv) && + priv->focus_on_ring) + { + gdk_rgb_gc_set_foreground (priv->gc, 0x000000); + + gdk_draw_arc (drawable, priv->gc, FALSE, + -x, -y, + priv->size - 1, priv->size - 1, + 0, 360 * 64); + gdk_draw_arc (drawable, priv->gc, FALSE, + -x + priv->ring_width - 1, -y + priv->ring_width - 1, + priv->size - 2 * priv->ring_width + 1, priv->size - 2 * priv->ring_width + 1, + 0, 360 * 64); + } } /* Converts an HSV triplet to an integer RGB triplet */ @@ -1175,11 +1247,15 @@ paint_triangle (GtkHSV *hsv, g_free (buf); - /* Draw triangle outline */ - - gdk_rgb_gc_set_foreground (priv->gc, 0x000000); + /* Draw triangle focus outline */ + + if (GTK_WIDGET_HAS_FOCUS (hsv) && + !priv->focus_on_ring) + { + gdk_rgb_gc_set_foreground (priv->gc, 0x000000); - gdk_draw_polygon (drawable, priv->gc, FALSE, points, 3); + gdk_draw_polygon (drawable, priv->gc, FALSE, points, 3); + } /* Draw value marker */ @@ -1271,6 +1347,63 @@ gtk_hsv_expose (GtkWidget *widget, return FALSE; } +static gboolean +gtk_hsv_focus (GtkContainer *container, + GtkDirectionType dir) +{ + GtkHSV *hsv; + HSVPrivate *priv; + + hsv = GTK_HSV (container); + priv = hsv->priv; + + if (!GTK_WIDGET_DRAWABLE (container) || + !GTK_WIDGET_IS_SENSITIVE (container)) + return FALSE; + + if (!GTK_WIDGET_HAS_FOCUS (hsv)) + { + gtk_widget_grab_focus (GTK_WIDGET (hsv)); + return TRUE; + } + + switch (dir) + { + case GTK_DIR_UP: + if (priv->focus_on_ring) + return FALSE; + else + priv->focus_on_ring = TRUE; + break; + + case GTK_DIR_DOWN: + if (priv->focus_on_ring) + priv->focus_on_ring = FALSE; + else + return FALSE; + break; + + case GTK_DIR_LEFT: + case GTK_DIR_TAB_BACKWARD: + if (priv->focus_on_ring) + return FALSE; + else + priv->focus_on_ring = TRUE; + break; + + case GTK_DIR_RIGHT: + case GTK_DIR_TAB_FORWARD: + if (priv->focus_on_ring) + priv->focus_on_ring = FALSE; + else + return FALSE; + break; + } + + gtk_widget_queue_draw (GTK_WIDGET (hsv)); + + return TRUE; +} /** * gtk_hsv_new: @@ -1510,3 +1643,79 @@ gtk_rgb_to_hsv (gdouble r, if (v) *v = b; } + +static void +gtk_hsv_move (GtkHSV *hsv, + GtkDirectionType dir) +{ + HSVPrivate *priv; + gdouble hue, sat, val; + gint hx, hy, sx, sy, vx, vy; /* HSV vertices */ + gint x, y; /* position in triangle */ + + priv = hsv->priv; + + hue = priv->h; + sat = priv->s; + val = priv->v; + + compute_triangle (hsv, &hx, &hy, &sx, &sy, &vx, &vy); + + x = floor (sx + (vx - sx) * priv->v + (hx - vx) * priv->s * priv->v + 0.5); + y = floor (sy + (vy - sy) * priv->v + (hy - vy) * priv->s * priv->v + 0.5); + + switch (dir) + { + case GTK_DIR_UP: + if (priv->focus_on_ring) + hue += 0.02; + else + { + y -= 1; + compute_sv (hsv, x, y, &sat, &val); + } + break; + + case GTK_DIR_DOWN: + if (priv->focus_on_ring) + hue -= 0.02; + else + { + y += 1; + compute_sv (hsv, x, y, &sat, &val); + } + break; + + case GTK_DIR_LEFT: + if (priv->focus_on_ring) + hue += 0.02; + else + { + x -= 1; + compute_sv (hsv, x, y, &sat, &val); + } + break; + + case GTK_DIR_RIGHT: + if (priv->focus_on_ring) + hue -= 0.02; + else + { + x += 1; + compute_sv (hsv, x, y, &sat, &val); + } + break; + + default: + /* we don't care about the tab directions */ + break; + } + + /* Wrap */ + if (hue < 0.0) + hue = 1.0; + else if (hue > 1.0) + hue = 0.0; + + gtk_hsv_set_color (hsv, hue, sat, val); +} diff --git a/gtk/gtkhsv.h b/gtk/gtkhsv.h index cc0a08d5bb..6a98085935 100644 --- a/gtk/gtkhsv.h +++ b/gtk/gtkhsv.h @@ -31,7 +31,7 @@ * GTK+ at ftp://ftp.gtk.org/pub/gtk/. */ -#include <gtk/gtkwidget.h> +#include <gtk/gtkcontainer.h> #ifdef __cplusplus extern "C" { @@ -39,7 +39,7 @@ extern "C" { #define GTK_TYPE_HSV (gtk_hsv_get_type ()) #define GTK_HSV(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_HSV, GtkHSV)) -#define GTK_HSV_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_HSV, GtkHSV)) +#define GTK_HSV_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_HSV, GtkHSVClass)) #define GTK_IS_HSV(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_HSV)) #define GTK_IS_HSV_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_HSV)) #define GTK_HSV_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_HSV, GtkHSVClass)) @@ -50,7 +50,8 @@ typedef struct _GtkHSVClass GtkHSVClass; struct _GtkHSV { - GtkWidget parent_instance; + /* we derive from container purely so we can have a _focus method */ + GtkContainer parent_instance; /* Private data */ gpointer priv; @@ -58,11 +59,15 @@ struct _GtkHSV struct _GtkHSVClass { - GtkWidgetClass parent_class; + GtkContainerClass parent_class; /* Notification signals */ void (*changed) (GtkHSV *hsv); + + /* Keybindings */ + void (* move) (GtkHSV *hsv, + GtkDirectionType type); }; diff --git a/gtk/gtkinputdialog.c b/gtk/gtkinputdialog.c index e150f66d7f..ba0901fdd0 100644 --- a/gtk/gtkinputdialog.c +++ b/gtk/gtkinputdialog.c @@ -215,10 +215,11 @@ gtk_input_dialog_init (GtkInputDialog *inputd) util_box = gtk_hbox_new (FALSE, 2); gtk_box_pack_start (GTK_BOX (vbox), util_box, FALSE, FALSE, 0); - label = gtk_label_new(_("Device:")); + label = gtk_label_new(_("_Device:")); gtk_box_pack_start (GTK_BOX (util_box), label, FALSE, FALSE, 2); optionmenu = gtk_option_menu_new (); + gtk_label_set_mnemonic_widget (GTK_LABEL (label), optionmenu); gtk_box_pack_start (GTK_BOX (util_box), optionmenu, TRUE, TRUE, 2); gtk_widget_show (optionmenu); gtk_option_menu_set_menu (GTK_OPTION_MENU (optionmenu), device_menu); @@ -255,10 +256,11 @@ gtk_input_dialog_init (GtkInputDialog *inputd) (GtkSignalFunc) gtk_input_dialog_set_mapping_mode, GINT_TO_POINTER (GDK_MODE_WINDOW)); - label = gtk_label_new(_("Mode: ")); + label = gtk_label_new(_("_Mode: ")); gtk_box_pack_start (GTK_BOX (util_box), label, FALSE, FALSE, 2); inputd->mode_optionmenu = gtk_option_menu_new (); + gtk_label_set_mnemonic_widget (GTK_LABEL (label), inputd->mode_optionmenu); gtk_box_pack_start (GTK_BOX (util_box), inputd->mode_optionmenu, FALSE, FALSE, 2); gtk_widget_show (inputd->mode_optionmenu); gtk_option_menu_set_menu (GTK_OPTION_MENU (inputd->mode_optionmenu), mapping_menu); @@ -285,7 +287,7 @@ gtk_input_dialog_init (GtkInputDialog *inputd) /* The axis listbox */ - label = gtk_label_new (_("Axes")); + label = gtk_label_new (_("_Axes")); inputd->axis_listbox = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(inputd->axis_listbox), @@ -301,7 +303,7 @@ gtk_input_dialog_init (GtkInputDialog *inputd) /* Keys listbox */ - label = gtk_label_new (_("Keys")); + label = gtk_label_new (_("_Keys")); inputd->keys_listbox = gtk_scrolled_window_new (NULL, NULL); gtk_widget_set_usize (inputd->keys_listbox, KEYS_LIST_WIDTH, KEYS_LIST_HEIGHT); diff --git a/gtk/gtklist.c b/gtk/gtklist.c index d784ab641a..cded0cf6b6 100644 --- a/gtk/gtklist.c +++ b/gtk/gtklist.c @@ -776,6 +776,8 @@ gtk_list_button_press (GtkWidget *widget, default: break; } + + return TRUE; } return FALSE; @@ -828,6 +830,8 @@ gtk_list_button_release (GtkWidget *widget, default: break; } + + return TRUE; } return FALSE; diff --git a/gtk/gtklistitem.c b/gtk/gtklistitem.c index 7f1f6ece05..e87adcbae3 100644 --- a/gtk/gtklistitem.c +++ b/gtk/gtklistitem.c @@ -451,8 +451,12 @@ gtk_list_item_button_press (GtkWidget *widget, g_return_val_if_fail (event != NULL, FALSE); if (event->type == GDK_BUTTON_PRESS) - if (!GTK_WIDGET_HAS_FOCUS (widget)) - gtk_widget_grab_focus (widget); + { + if (!GTK_WIDGET_HAS_FOCUS (widget)) + gtk_widget_grab_focus (widget); + + return TRUE; + } return FALSE; } diff --git a/gtk/gtkmenushell.c b/gtk/gtkmenushell.c index cdd00988c3..5843799144 100644 --- a/gtk/gtkmenushell.c +++ b/gtk/gtkmenushell.c @@ -430,7 +430,7 @@ gtk_menu_shell_button_press (GtkWidget *widget, if (menu_shell->parent_menu_shell) { - gtk_widget_event (menu_shell->parent_menu_shell, (GdkEvent*) event); + return gtk_widget_event (menu_shell->parent_menu_shell, (GdkEvent*) event); } else if (!menu_shell->active || !menu_shell->button) { @@ -484,8 +484,7 @@ gtk_menu_shell_button_release (GtkWidget *widget, { menu_shell->button = 0; if (menu_shell->parent_menu_shell) - gtk_widget_event (menu_shell->parent_menu_shell, (GdkEvent*) event); - return TRUE; + return gtk_widget_event (menu_shell->parent_menu_shell, (GdkEvent*) event); } menu_shell->button = 0; diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c index 1ee200d4d8..530b5de949 100644 --- a/gtk/gtknotebook.c +++ b/gtk/gtknotebook.c @@ -1103,9 +1103,10 @@ gtk_notebook_button_press (GtkWidget *widget, } if (!children && !GTK_WIDGET_HAS_FOCUS (widget)) gtk_widget_grab_focus (widget); + return TRUE; } - return TRUE; + return FALSE; } static gint @@ -1137,9 +1138,11 @@ gtk_notebook_button_release (GtkWidget *widget, notebook->click_child = 0; notebook->button = 0; gtk_notebook_redraw_arrows (notebook); - + + return TRUE; } - return FALSE; + else + return FALSE; } static gint diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c index bc7f272d39..999be5ac9e 100644 --- a/gtk/gtkspinbutton.c +++ b/gtk/gtkspinbutton.c @@ -892,9 +892,10 @@ gtk_spin_button_button_press (GtkWidget *widget, } gtk_spin_button_draw_arrow (spin, GTK_ARROW_DOWN); } + return TRUE; } else - GTK_WIDGET_CLASS (parent_class)->button_press_event (widget, event); + return GTK_WIDGET_CLASS (parent_class)->button_press_event (widget, event); } return FALSE; } @@ -954,9 +955,10 @@ gtk_spin_button_button_release (GtkWidget *widget, spin->click_child = 2; spin->button = 0; gtk_spin_button_draw_arrow (spin, click_child); + return TRUE; } else - GTK_WIDGET_CLASS (parent_class)->button_release_event (widget, event); + return GTK_WIDGET_CLASS (parent_class)->button_release_event (widget, event); return FALSE; } diff --git a/gtk/gtktext.c b/gtk/gtktext.c index 2d1815ad3d..66c1a4824e 100644 --- a/gtk/gtktext.c +++ b/gtk/gtktext.c @@ -1729,7 +1729,7 @@ gtk_text_button_press (GtkWidget *widget, } } - return FALSE; + return TRUE; } static gint @@ -1790,7 +1790,7 @@ gtk_text_button_release (GtkWidget *widget, find_cursor (text, TRUE); draw_cursor (text, FALSE); - return FALSE; + return TRUE; } static gint @@ -1907,8 +1907,6 @@ gtk_text_key_press (GtkWidget *widget, g_return_val_if_fail (GTK_IS_TEXT (widget), FALSE); g_return_val_if_fail (event != NULL, FALSE); - return_val = FALSE; - text = GTK_TEXT (widget); old_editable = GTK_OLD_EDITABLE (widget); @@ -2094,8 +2092,6 @@ gtk_text_key_press (GtkWidget *widget, return_val = TRUE; } - else - return_val = FALSE; } if (return_val && (old_editable->current_pos != initial_pos)) diff --git a/gtk/gtktexttag.c b/gtk/gtktexttag.c index 3e48be3343..938e442f6f 100644 --- a/gtk/gtktexttag.c +++ b/gtk/gtktexttag.c @@ -1622,7 +1622,7 @@ gtk_text_tag_event (GtkTextTag *tag, GdkEvent *event, const GtkTextIter *iter) { - gint retval = FALSE; + gboolean retval = FALSE; g_return_val_if_fail (GTK_IS_TEXT_TAG (tag), FALSE); g_return_val_if_fail (GTK_IS_OBJECT (event_object), FALSE); diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c index 30e33f3d42..3ee94dd8d7 100644 --- a/gtk/gtktextview.c +++ b/gtk/gtktextview.c @@ -2846,7 +2846,7 @@ emit_event_on_tags (GtkWidget *widget, { GSList *tags; GSList *tmp; - gint retval = FALSE; + gboolean retval = FALSE; GtkTextView *text_view; text_view = GTK_TEXT_VIEW (widget); @@ -2924,7 +2924,7 @@ gtk_text_view_event (GtkWidget *widget, GdkEvent *event) static gint gtk_text_view_key_press_event (GtkWidget *widget, GdkEventKey *event) { - gint retval = FALSE; + gboolean retval = FALSE; GtkTextView *text_view = GTK_TEXT_VIEW (widget); if (text_view->layout == NULL || diff --git a/gtk/gtktooltips.c b/gtk/gtktooltips.c index 724118ddae..52a3f0b38a 100644 --- a/gtk/gtktooltips.c +++ b/gtk/gtktooltips.c @@ -486,8 +486,10 @@ gtk_tooltips_event_handler (GtkWidget *widget, tooltips->use_sticky_delay = use_sticky_delay; } break; + default: gtk_tooltips_set_active_widget (tooltips, NULL); + return TRUE; break; } diff --git a/gtk/gtktreeitem.c b/gtk/gtktreeitem.c index 162161ac16..15c3e2a2fd 100644 --- a/gtk/gtktreeitem.c +++ b/gtk/gtktreeitem.c @@ -84,7 +84,7 @@ static void gtk_real_tree_item_collapse (GtkTreeItem *item); static void gtk_real_tree_item_expand (GtkTreeItem *item); static void gtk_real_tree_item_collapse (GtkTreeItem *item); static void gtk_tree_item_destroy (GtkObject *object); -static void gtk_tree_item_subtree_button_click (GtkWidget *widget); +static gint gtk_tree_item_subtree_button_click (GtkWidget *widget); static void gtk_tree_item_subtree_button_changed_state (GtkWidget *widget); static void gtk_tree_item_map(GtkWidget*); @@ -172,7 +172,7 @@ gtk_tree_item_class_init (GtkTreeItemClass *class) } /* callback for event box mouse event */ -static void +static gint gtk_tree_item_subtree_button_click (GtkWidget *widget) { GtkTreeItem* item; @@ -182,12 +182,14 @@ gtk_tree_item_subtree_button_click (GtkWidget *widget) item = (GtkTreeItem*) gtk_object_get_user_data (GTK_OBJECT (widget)); if (!GTK_WIDGET_IS_SENSITIVE (item)) - return; + return FALSE; if (item->expanded) gtk_tree_item_collapse (item); else gtk_tree_item_expand (item); + + return TRUE; } /* callback for event box state changed */ @@ -711,7 +713,7 @@ gtk_tree_item_button_press (GtkWidget *widget, && !GTK_WIDGET_HAS_FOCUS (widget)) gtk_widget_grab_focus (widget); - return FALSE; + return (event->type == GDK_BUTTON_PRESS && GTK_WIDGET_IS_SENSITIVE(widget)); } static gint diff --git a/gtk/gtktreemodelsort.c b/gtk/gtktreemodelsort.c index 5f1453b83f..1c86b567f5 100644 --- a/gtk/gtktreemodelsort.c +++ b/gtk/gtktreemodelsort.c @@ -1080,7 +1080,7 @@ gtk_tree_model_sort_func (gconstpointer a, GValue value_a = {0, }; GValue value_b = {0, }; SortData *sort_data = user_data; - gint retval; + gboolean retval; gtk_tree_model_get_value (sort_data->model, (GtkTreeIter *) a, sort_data->sort_col, &value_a); gtk_tree_model_get_value (sort_data->model, (GtkTreeIter *) b, sort_data->sort_col, &value_b); diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c index 761ab3b641..fc9412b5df 100644 --- a/gtk/gtktreeview.c +++ b/gtk/gtktreeview.c @@ -3178,7 +3178,7 @@ gtk_tree_view_discover_dirty_iter (GtkTreeView *tree_view, GtkTreeViewColumn *column; GList *list; gint i; - gint retval = FALSE; + gboolean retval = FALSE; gint tmpheight; if (height) |