diff options
author | Benjamin Otte <otte@redhat.com> | 2017-10-06 21:19:42 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2017-10-06 21:23:39 +0200 |
commit | 43c212ac28f5f80e10c49590e569b6450098743f (patch) | |
tree | ae5210d90f79d313d3b4c88c88f5e00b87405e0e /gtk | |
parent | 2ac66328a3edc0838c19b49fcb9468c473936c9c (diff) | |
download | gtk+-43c212ac28f5f80e10c49590e569b6450098743f.tar.gz |
build: Enable -Wswitch-enum and -Wswitch-default
This patch makes that work using 1 of 2 options:
1. Add all missing enums to the switch statement
or
2. Cast the switch argument to a uint to avoid having to do that (mostly
for GdkEventType).
I even found a bug while doing that: clearing a GtkImage with a surface
did not notify thae surface property.
The reason for enabling this flag even though it is tedious at times is
that it is very useful when adding values to an enum, because it makes
GTK immediately warn about all the switch statements where this enum is
relevant.
And I expect changes to enums to be frequent during the GTK4 development
cycle.
Diffstat (limited to 'gtk')
84 files changed, 599 insertions, 140 deletions
diff --git a/gtk/a11y/gtkimageaccessible.c b/gtk/a11y/gtkimageaccessible.c index dc398c82b8..7c394d0aff 100644 --- a/gtk/a11y/gtkimageaccessible.c +++ b/gtk/a11y/gtkimageaccessible.c @@ -297,6 +297,8 @@ gtk_image_accessible_get_image_size (AtkImage *image, *width = gdk_pixbuf_animation_get_width (animation); break; } + case GTK_IMAGE_EMPTY: + case GTK_IMAGE_SURFACE: default: { *height = -1; diff --git a/gtk/gtkbbox.c b/gtk/gtkbbox.c index 2661001935..2cd1a45da3 100644 --- a/gtk/gtkbbox.c +++ b/gtk/gtkbbox.c @@ -647,6 +647,7 @@ gtk_button_box_size_request (GtkWidget *widget, switch (gtk_box_get_baseline_position (GTK_BOX (widget))) { + default: case GTK_BASELINE_POSITION_TOP: break; case GTK_BASELINE_POSITION_CENTER: @@ -800,6 +801,7 @@ gtk_button_box_size_allocate (GtkWidget *widget, switch (gtk_box_get_baseline_position (GTK_BOX (widget))) { case GTK_BASELINE_POSITION_TOP: + default: /* keep baseline as is */ break; case GTK_BASELINE_POSITION_CENTER: @@ -973,6 +975,7 @@ gtk_button_box_size_allocate (GtkWidget *widget, break; + case GTK_BUTTONBOX_EXPAND: default: g_assert_not_reached (); break; diff --git a/gtk/gtkbindings.c b/gtk/gtkbindings.c index 1bf47b792c..068744bbec 100644 --- a/gtk/gtkbindings.c +++ b/gtk/gtkbindings.c @@ -1320,17 +1320,17 @@ gtk_binding_parse_bind (GScanner *scanner, { guint expected_token; - switch (scanner->next_token) + if (scanner->next_token == G_TOKEN_STRING) { - case G_TOKEN_STRING: expected_token = gtk_binding_parse_signal (scanner, binding_set, keyval, modifiers); if (expected_token != G_TOKEN_NONE) return expected_token; - break; - default: + } + else + { g_scanner_get_next_token (scanner); return '}'; } diff --git a/gtk/gtkbookmarksmanager.c b/gtk/gtkbookmarksmanager.c index 0108637c60..57b16384ed 100644 --- a/gtk/gtkbookmarksmanager.c +++ b/gtk/gtkbookmarksmanager.c @@ -207,6 +207,13 @@ bookmarks_file_changed (GFileMonitor *monitor, gdk_threads_leave (); break; + case G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED: + case G_FILE_MONITOR_EVENT_PRE_UNMOUNT: + case G_FILE_MONITOR_EVENT_UNMOUNTED: + case G_FILE_MONITOR_EVENT_MOVED: + case G_FILE_MONITOR_EVENT_RENAMED: + case G_FILE_MONITOR_EVENT_MOVED_IN: + case G_FILE_MONITOR_EVENT_MOVED_OUT: default: /* ignore at the moment */ break; diff --git a/gtk/gtkbox.c b/gtk/gtkbox.c index 344ea527b9..7361ce96ef 100644 --- a/gtk/gtkbox.c +++ b/gtk/gtkbox.c @@ -576,6 +576,8 @@ gtk_box_size_allocate (GtkWidget *widget, case GTK_BASELINE_POSITION_BOTTOM: baseline = height - minimum_below; break; + default: + break; } } @@ -1025,6 +1027,8 @@ gtk_box_get_size (GtkWidget *widget, min_baseline = minimum - minimum_below; nat_baseline = natural - natural_below; break; + default: + break; } } @@ -1227,6 +1231,8 @@ gtk_box_compute_size_for_opposing_orientation (GtkBox *box, computed_minimum_baseline = computed_minimum - computed_minimum_below; computed_natural_baseline = computed_natural - computed_natural_below; break; + default: + break; } } diff --git a/gtk/gtkcalendar.c b/gtk/gtkcalendar.c index 5f54660963..a2efe6eb9c 100644 --- a/gtk/gtkcalendar.c +++ b/gtk/gtkcalendar.c @@ -2858,6 +2858,8 @@ gtk_calendar_key_press (GtkWidget *widget, calendar_select_and_focus_day (calendar, day); } + default: + break; } return return_val; diff --git a/gtk/gtkcellrenderertext.c b/gtk/gtkcellrenderertext.c index 691f19562a..4bac4c7332 100644 --- a/gtk/gtkcellrenderertext.c +++ b/gtk/gtkcellrenderertext.c @@ -698,9 +698,9 @@ get_property_font_set_mask (guint prop_id) return PANGO_FONT_MASK_STRETCH; case PROP_SIZE_SET: return PANGO_FONT_MASK_SIZE; + default: + return 0; } - - return 0; } static void @@ -1222,6 +1222,8 @@ gtk_cell_renderer_text_set_property (GObject *object, g_value_get_double (value) * PANGO_SCALE); g_object_notify_by_pspec (object, pspec); break; + default: + break; } if (priv->fixed_height_rows != -1) @@ -1539,6 +1541,9 @@ get_layout (GtkCellRendererText *celltext, uline = PANGO_UNDERLINE_DOUBLE; break; + case PANGO_UNDERLINE_DOUBLE: + case PANGO_UNDERLINE_LOW: + case PANGO_UNDERLINE_ERROR: default: break; } diff --git a/gtk/gtkcenterbox.c b/gtk/gtkcenterbox.c index 88230b9dc7..996e1ab305 100644 --- a/gtk/gtkcenterbox.c +++ b/gtk/gtkcenterbox.c @@ -350,6 +350,8 @@ gtk_center_box_measure_opposite (GtkWidget *widget, min_baseline = total_min - below_min; nat_baseline = total_nat - below_nat; break; + default: + break; } if (minimum_baseline) @@ -476,6 +478,7 @@ gtk_center_box_size_allocate (GtkWidget *widget, */ switch (self->baseline_pos) { + default: case GTK_BASELINE_POSITION_TOP: baseline = min_above; break; diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c index 4bb6b51f14..c9c1f4844d 100644 --- a/gtk/gtkcombobox.c +++ b/gtk/gtkcombobox.c @@ -2583,6 +2583,8 @@ gtk_combo_box_real_move_active (GtkComboBox *combo_box, found = tree_first (combo_box, priv->model, &new_iter); break; + case GTK_SCROLL_NONE: + case GTK_SCROLL_JUMP: default: return; } diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c index 5e3fa99e69..820af54703 100644 --- a/gtk/gtkcontainer.c +++ b/gtk/gtkcontainer.c @@ -2593,11 +2593,10 @@ _gtk_container_focus_sort (GtkContainer *container, case GTK_DIR_LEFT: case GTK_DIR_RIGHT: return gtk_container_focus_sort_left_right (container, visible_children, direction, old_focus); + default: + g_assert_not_reached (); + return NULL; } - - g_assert_not_reached (); - - return NULL; } static gboolean diff --git a/gtk/gtkcsscolorvalue.c b/gtk/gtkcsscolorvalue.c index 0224018d40..4bd0f59a02 100644 --- a/gtk/gtkcsscolorvalue.c +++ b/gtk/gtkcsscolorvalue.c @@ -93,6 +93,8 @@ gtk_css_value_color_free (GtkCssValue *color) case COLOR_TYPE_WIN32: gtk_win32_theme_unref (color->sym_col.win32.theme); break; + case COLOR_TYPE_LITERAL: + case COLOR_TYPE_CURRENT_COLOR: default: break; } @@ -770,6 +772,9 @@ _gtk_css_color_value_parse_function (GtkCssParser *parser, case COLOR_MIX: value = _gtk_css_color_value_new_mix (child1, child2, d); break; + case COLOR_RGB: + case COLOR_RGBA: + case COLOR_WIN32: default: g_assert_not_reached (); value = NULL; diff --git a/gtk/gtkcssimagebuiltin.c b/gtk/gtkcssimagebuiltin.c index 5732a79ae6..a8fd047eca 100644 --- a/gtk/gtkcssimagebuiltin.c +++ b/gtk/gtkcssimagebuiltin.c @@ -177,7 +177,7 @@ gtk_css_image_builtin_draw_arrow (GtkCssImage *image, size = MIN (width, height); cairo_translate (cr, width / 2.0, height / 2.0); - switch (image_type) + switch ((guint) image_type) { case GTK_CSS_IMAGE_BUILTIN_ARROW_UP: break; diff --git a/gtk/gtkcssstyle.c b/gtk/gtkcssstyle.c index 8cdcd2e6d6..670a87d7b0 100644 --- a/gtk/gtkcssstyle.c +++ b/gtk/gtkcssstyle.c @@ -286,7 +286,9 @@ gtk_css_style_get_pango_attributes (GtkCssStyle *style) case GTK_CSS_FONT_KERNING_NONE: append_separated (s, "kern 0"); break; - default: ; + case GTK_CSS_FONT_KERNING_AUTO: + default: + break; } value = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_FONT_VARIANT_LIGATURES); @@ -326,7 +328,9 @@ gtk_css_style_get_pango_attributes (GtkCssStyle *style) case GTK_CSS_FONT_VARIANT_POSITION_SUPER: append_separated (s, "sups 1"); break; - default: ; + case GTK_CSS_FONT_VARIANT_POSITION_NORMAL: + default: + break; } value = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_FONT_VARIANT_CAPS); @@ -349,8 +353,10 @@ gtk_css_style_get_pango_attributes (GtkCssStyle *style) break; case GTK_CSS_FONT_VARIANT_CAPS_TITLING_CAPS: append_separated (s, "titl 1"); - break; - default: ; + break; + case GTK_CSS_FONT_VARIANT_CAPS_NORMAL: + default: + break; } value = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_FONT_VARIANT_NUMERIC); @@ -385,7 +391,9 @@ gtk_css_style_get_pango_attributes (GtkCssStyle *style) case GTK_CSS_FONT_VARIANT_ALTERNATE_HISTORICAL_FORMS: append_separated (s, "hist 1"); break; - default: ; + case GTK_CSS_FONT_VARIANT_ALTERNATE_NORMAL: + default: + break; } value = gtk_css_style_get_value (style, GTK_CSS_PROPERTY_FONT_VARIANT_EAST_ASIAN); diff --git a/gtk/gtkcssstylefuncs.c b/gtk/gtkcssstylefuncs.c index 4af0db5666..347b23ede3 100644 --- a/gtk/gtkcssstylefuncs.c +++ b/gtk/gtkcssstylefuncs.c @@ -501,6 +501,8 @@ pattern_value_print (const GValue *value, break; case CAIRO_PATTERN_TYPE_LINEAR: case CAIRO_PATTERN_TYPE_RADIAL: + case CAIRO_PATTERN_TYPE_MESH: + case CAIRO_PATTERN_TYPE_RASTER_SOURCE: g_string_append (string, "none /* FIXME: add support for printing gradients */"); break; case CAIRO_PATTERN_TYPE_SOLID: diff --git a/gtk/gtkcsstypes.c b/gtk/gtkcsstypes.c index 0399e4920c..8bae7c397c 100644 --- a/gtk/gtkcsstypes.c +++ b/gtk/gtkcsstypes.c @@ -41,6 +41,8 @@ _gtk_css_blend_mode_get_operator (GskBlendMode mode) return CAIRO_OPERATOR_EXCLUSION; case GSK_BLEND_MODE_HARD_LIGHT: return CAIRO_OPERATOR_HARD_LIGHT; + case GSK_BLEND_MODE_SOFT_LIGHT: + return CAIRO_OPERATOR_SOFT_LIGHT; case GSK_BLEND_MODE_HUE: return CAIRO_OPERATOR_HSL_HUE; case GSK_BLEND_MODE_LIGHTEN: diff --git a/gtk/gtkcsswin32sizevalue.c b/gtk/gtkcsswin32sizevalue.c index 134078b3a5..fd7970a9ca 100644 --- a/gtk/gtkcsswin32sizevalue.c +++ b/gtk/gtkcsswin32sizevalue.c @@ -145,6 +145,10 @@ gtk_css_value_win32_size_equal (const GtkCssValue *value1, return value1->val.part.part == value2->val.part.part && value1->val.part.state == value2->val.part.state; + case GTK_WIN32_PART_BORDER_TOP: + case GTK_WIN32_PART_BORDER_RIGHT: + case GTK_WIN32_PART_BORDER_BOTTOM: + case GTK_WIN32_PART_BORDER_LEFT: default: g_assert_not_reached (); return FALSE; diff --git a/gtk/gtkdnd.c b/gtk/gtkdnd.c index 67ec173bf3..0bb71f7336 100644 --- a/gtk/gtkdnd.c +++ b/gtk/gtkdnd.c @@ -732,7 +732,7 @@ _gtk_drag_dest_handle_event (GtkWidget *toplevel, info = gtk_drag_get_dest_info (context, TRUE); /* Find the widget for the event */ - switch (event_type) + switch ((guint) event_type) { case GDK_DRAG_ENTER: break; @@ -1789,7 +1789,7 @@ _gtk_drag_source_handle_event (GtkWidget *widget, if (!info) return; - switch (gdk_event_get_event_type (event)) + switch ((guint) gdk_event_get_event_type (event)) { case GDK_DRAG_STATUS: { @@ -2352,6 +2352,9 @@ gtk_drag_key_cb (GtkWidget *widget, gtk_drag_cancel_internal (info, GTK_DRAG_RESULT_NO_TARGET, time); } break; + + default: + break; } } diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index 225f3e9e6f..002f5a4c09 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -3536,7 +3536,7 @@ gtk_entry_event (GtkWidget *widget, sequence = gdk_event_get_event_sequence (event); device = gdk_event_get_device (event); - switch (gdk_event_get_event_type (event)) + switch ((guint) gdk_event_get_event_type (event)) { case GDK_TOUCH_BEGIN: if (icon_info->current_sequence) @@ -4816,6 +4816,7 @@ gtk_entry_move_cursor (GtkEntry *entry, case GTK_MOVEMENT_PARAGRAPHS: case GTK_MOVEMENT_PAGES: case GTK_MOVEMENT_HORIZONTAL_PAGES: + default: break; } } @@ -4888,6 +4889,7 @@ gtk_entry_move_cursor (GtkEntry *entry, case GTK_MOVEMENT_PARAGRAPHS: case GTK_MOVEMENT_PAGES: case GTK_MOVEMENT_HORIZONTAL_PAGES: + default: break; } } @@ -4996,6 +4998,9 @@ gtk_entry_delete_from_cursor (GtkEntry *entry, case GTK_DELETE_WHITESPACE: gtk_entry_delete_whitespace (entry); break; + + default: + break; } if (gtk_entry_buffer_get_bytes (get_buffer (entry)) == old_n_bytes) @@ -6634,6 +6639,9 @@ gtk_entry_clear_icon (GtkEntry *entry, : PROP_GICON_SECONDARY]); break; + case GTK_IMAGE_EMPTY: + case GTK_IMAGE_ANIMATION: + case GTK_IMAGE_SURFACE: default: g_assert_not_reached (); break; diff --git a/gtk/gtkeventcontrollerscroll.c b/gtk/gtkeventcontrollerscroll.c index 61f916782c..a250bfb8aa 100644 --- a/gtk/gtkeventcontrollerscroll.c +++ b/gtk/gtkeventcontrollerscroll.c @@ -270,6 +270,7 @@ gtk_event_controller_scroll_handle_event (GtkEventController *controller, case GDK_SCROLL_RIGHT: dx += 1; break; + case GDK_SCROLL_SMOOTH: default: g_assert_not_reached (); break; diff --git a/gtk/gtkexpander.c b/gtk/gtkexpander.c index 6aac0e343d..55ff54934a 100644 --- a/gtk/gtkexpander.c +++ b/gtk/gtkexpander.c @@ -739,6 +739,7 @@ focus_in_site (GtkExpander *expander, return FALSE; } case FOCUS_NONE: + default: break; } @@ -767,6 +768,7 @@ get_next_site (GtkExpander *expander, case GTK_DIR_TAB_FORWARD: case GTK_DIR_DOWN: case GTK_DIR_RIGHT: + default: return FOCUS_WIDGET; } break; @@ -780,6 +782,7 @@ get_next_site (GtkExpander *expander, return ltr ? FOCUS_NONE : FOCUS_LABEL; case GTK_DIR_TAB_FORWARD: case GTK_DIR_DOWN: + default: return FOCUS_LABEL; case GTK_DIR_RIGHT: return ltr ? FOCUS_LABEL : FOCUS_NONE; @@ -795,6 +798,7 @@ get_next_site (GtkExpander *expander, return ltr ? FOCUS_WIDGET : FOCUS_CHILD; case GTK_DIR_TAB_FORWARD: case GTK_DIR_DOWN: + default: return FOCUS_CHILD; case GTK_DIR_RIGHT: return ltr ? FOCUS_CHILD : FOCUS_WIDGET; @@ -810,12 +814,15 @@ get_next_site (GtkExpander *expander, case GTK_DIR_TAB_FORWARD: case GTK_DIR_DOWN: case GTK_DIR_RIGHT: + default: return FOCUS_NONE; } break; + default: + g_assert_not_reached (); + break; } - - g_assert_not_reached (); + return FOCUS_NONE; } diff --git a/gtk/gtkfilechooserbutton.c b/gtk/gtkfilechooserbutton.c index e868e0442d..abc6147522 100644 --- a/gtk/gtkfilechooserbutton.c +++ b/gtk/gtkfilechooserbutton.c @@ -956,6 +956,8 @@ gtk_file_chooser_button_set_property (GObject *object, g_value_set_enum ((GValue *) value, GTK_FILE_CHOOSER_ACTION_OPEN); } break; + default: + break; } g_object_set_property (G_OBJECT (priv->chooser), pspec->name, value); @@ -1346,6 +1348,8 @@ gtk_file_chooser_button_mnemonic_activate (GtkWidget *widget, case GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER: return gtk_widget_mnemonic_activate (priv->combo_box, group_cycling); break; + case GTK_FILE_CHOOSER_ACTION_SAVE: + case GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER: default: g_assert_not_reached (); break; diff --git a/gtk/gtkfilechooserentry.c b/gtk/gtkfilechooserentry.c index 4e43298fa7..25247b0ee5 100644 --- a/gtk/gtkfilechooserentry.c +++ b/gtk/gtkfilechooserentry.c @@ -570,6 +570,7 @@ update_inline_completion (GtkFileChooserEntry *chooser_entry) break; case GTK_FILE_CHOOSER_ACTION_SAVE: case GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER: + default: gtk_entry_completion_set_inline_completion (completion, FALSE); break; } @@ -975,6 +976,7 @@ _gtk_file_chooser_entry_set_action (GtkFileChooserEntry *chooser_entry, { case GTK_FILE_CHOOSER_ACTION_OPEN: case GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER: + default: gtk_entry_completion_set_popup_single_match (comp, FALSE); break; case GTK_FILE_CHOOSER_ACTION_SAVE: diff --git a/gtk/gtkfilechoosernative.c b/gtk/gtkfilechoosernative.c index b66e5a7d8c..a9f6d20818 100644 --- a/gtk/gtkfilechoosernative.c +++ b/gtk/gtkfilechoosernative.c @@ -780,6 +780,8 @@ gtk_file_chooser_native_hide (GtkNativeDialog *native) case MODE_PORTAL: gtk_file_chooser_native_portal_hide (self); break; + default: + break; } } diff --git a/gtk/gtkfilechooserwidget.c b/gtk/gtkfilechooserwidget.c index a077fb7205..eda7045428 100644 --- a/gtk/gtkfilechooserwidget.c +++ b/gtk/gtkfilechooserwidget.c @@ -6883,6 +6883,7 @@ gtk_file_chooser_widget_should_respond (GtkFileChooserEmbed *chooser_embed) case SAVE_ENTRY: goto save_entry; + case NOT_REACHED: default: g_assert_not_reached (); } diff --git a/gtk/gtkfilefilter.c b/gtk/gtkfilefilter.c index cd19fb688c..58decf9721 100644 --- a/gtk/gtkfilefilter.c +++ b/gtk/gtkfilefilter.c @@ -710,6 +710,8 @@ _gtk_file_filter_get_as_patterns (GtkFileFilter *filter) } break; } + default: + break; } } @@ -804,6 +806,9 @@ gtk_file_filter_filter (GtkFileFilter *filter, if (rule->u.custom.func (filter_info, rule->u.custom.data)) return TRUE; break; + + default: + break; } } diff --git a/gtk/gtkfilesystemmodel.c b/gtk/gtkfilesystemmodel.c index 33714a81aa..386188d108 100644 --- a/gtk/gtkfilesystemmodel.c +++ b/gtk/gtkfilesystemmodel.c @@ -1264,6 +1264,10 @@ gtk_file_system_model_monitor_change (GFileMonitor * monitor, /* FIXME: use freeze/thaw with this somehow? */ case G_FILE_MONITOR_EVENT_PRE_UNMOUNT: case G_FILE_MONITOR_EVENT_UNMOUNTED: + case G_FILE_MONITOR_EVENT_MOVED: + case G_FILE_MONITOR_EVENT_RENAMED: + case G_FILE_MONITOR_EVENT_MOVED_IN: + case G_FILE_MONITOR_EVENT_MOVED_OUT: default: /* ignore these */ break; diff --git a/gtk/gtkflowbox.c b/gtk/gtkflowbox.c index 9c32be91fa..e4a4b22680 100644 --- a/gtk/gtkflowbox.c +++ b/gtk/gtkflowbox.c @@ -1371,6 +1371,7 @@ get_offset_pixels (GtkAlign align, case GTK_ALIGN_END: offset = pixels; break; + case GTK_ALIGN_BASELINE: default: g_assert_not_reached (); break; @@ -2486,8 +2487,21 @@ autoscroll_cb (GtkWidget *widget, case GTK_SCROLL_PAGE_BACKWARD: factor = - AUTOSCROLL_FACTOR_FAST; break; + case GTK_SCROLL_NONE: + case GTK_SCROLL_JUMP: + case GTK_SCROLL_STEP_UP: + case GTK_SCROLL_STEP_DOWN: + case GTK_SCROLL_STEP_LEFT: + case GTK_SCROLL_STEP_RIGHT: + case GTK_SCROLL_PAGE_UP: + case GTK_SCROLL_PAGE_DOWN: + case GTK_SCROLL_PAGE_LEFT: + case GTK_SCROLL_PAGE_RIGHT: + case GTK_SCROLL_START: + case GTK_SCROLL_END: default: g_assert_not_reached (); + break; } increment = gtk_adjustment_get_step_increment (adjustment) / factor; @@ -3058,7 +3072,7 @@ gtk_flow_box_move_cursor (GtkFlowBox *box, if (vertical) { - switch (step) + switch ((guint) step) { case GTK_MOVEMENT_VISUAL_POSITIONS: step = GTK_MOVEMENT_DISPLAY_LINES; @@ -3066,12 +3080,13 @@ gtk_flow_box_move_cursor (GtkFlowBox *box, case GTK_MOVEMENT_DISPLAY_LINES: step = GTK_MOVEMENT_VISUAL_POSITIONS; break; - default: ; + default: + break; } } child = NULL; - switch (step) + switch ((guint) step) { case GTK_MOVEMENT_VISUAL_POSITIONS: if (priv->cursor_child != NULL) diff --git a/gtk/gtkfontbutton.c b/gtk/gtkfontbutton.c index ada22588b0..754615f234 100644 --- a/gtk/gtkfontbutton.c +++ b/gtk/gtkfontbutton.c @@ -1239,6 +1239,8 @@ pango_font_description_to_css (PangoFontDescription *desc) case PANGO_STYLE_ITALIC: g_string_append (s, "font-style: italic; "); break; + default: + break; } } if (set & PANGO_FONT_MASK_VARIANT) @@ -1251,6 +1253,8 @@ pango_font_description_to_css (PangoFontDescription *desc) case PANGO_VARIANT_SMALL_CAPS: g_string_append (s, "font-variant: small-caps; "); break; + default: + break; } } if (set & PANGO_FONT_MASK_WEIGHT) @@ -1287,6 +1291,8 @@ pango_font_description_to_css (PangoFontDescription *desc) case PANGO_WEIGHT_ULTRAHEAVY: g_string_append (s, "font-weight: 900; "); break; + default: + break; } } if (set & PANGO_FONT_MASK_STRETCH) @@ -1320,6 +1326,8 @@ pango_font_description_to_css (PangoFontDescription *desc) case PANGO_STRETCH_ULTRA_EXPANDED: g_string_append (s, "font-stretch: ultra-expanded; "); break; + default: + break; } } if (set & PANGO_FONT_MASK_SIZE) diff --git a/gtk/gtkgesture.c b/gtk/gtkgesture.c index 67d91535da..8c7ed9501d 100644 --- a/gtk/gtkgesture.c +++ b/gtk/gtkgesture.c @@ -1664,7 +1664,7 @@ _gtk_gesture_get_pointer_emulating_sequence (GtkGesture *gesture, while (g_hash_table_iter_next (&iter, (gpointer*) &seq, (gpointer*) &data)) { - switch (gdk_event_get_event_type (data->event)) + switch ((guint) gdk_event_get_event_type (data->event)) { case GDK_TOUCH_BEGIN: case GDK_TOUCH_UPDATE: diff --git a/gtk/gtkgesturesingle.c b/gtk/gtkgesturesingle.c index d87fc0c13c..9c6ad83681 100644 --- a/gtk/gtkgesturesingle.c +++ b/gtk/gtkgesturesingle.c @@ -155,7 +155,7 @@ gtk_gesture_single_handle_event (GtkEventController *controller, event_type = gdk_event_get_event_type (event); - switch (event_type) + switch ((guint) event_type) { case GDK_TOUCH_BEGIN: case GDK_TOUCH_END: diff --git a/gtk/gtkgrid.c b/gtk/gtkgrid.c index 73ae2eb5ff..af06a1f76e 100644 --- a/gtk/gtkgrid.c +++ b/gtk/gtkgrid.c @@ -777,6 +777,8 @@ gtk_grid_request_non_spanning (GtkGridRequest *request, line->natural_above += line->natural - (line->natural_above + line->natural_below); line->natural_below += 0; break; + default: + break; } } } @@ -1357,6 +1359,8 @@ gtk_grid_request_allocate (GtkGridRequest *request, line->allocated_baseline = line->allocation - line->minimum_below; break; + default: + break; } } else diff --git a/gtk/gtkiconhelper.c b/gtk/gtkiconhelper.c index 6f9c329881..51954a7c18 100644 --- a/gtk/gtkiconhelper.c +++ b/gtk/gtkiconhelper.c @@ -768,6 +768,10 @@ _gtk_icon_helper_set_pixbuf_scale (GtkIconHelper *self, scale)); break; + case GTK_IMAGE_EMPTY: + case GTK_IMAGE_ICON_NAME: + case GTK_IMAGE_GICON: + case GTK_IMAGE_SURFACE: default: break; } diff --git a/gtk/gtkicontheme.c b/gtk/gtkicontheme.c index 2bd7a13aa3..2a663c55e8 100644 --- a/gtk/gtkicontheme.c +++ b/gtk/gtkicontheme.c @@ -2797,14 +2797,14 @@ theme_dir_size_difference (IconThemeDir *dir, { case ICON_THEME_DIR_FIXED: return abs (scaled_size - scaled_dir_size); - break; + case ICON_THEME_DIR_SCALABLE: if (scaled_size < (dir->min_size * dir->scale)) return (dir->min_size * dir->scale) - scaled_size; if (size > (dir->max_size * dir->scale)) return scaled_size - (dir->max_size * dir->scale); return 0; - break; + case ICON_THEME_DIR_THRESHOLD: min = (dir->size - dir->threshold) * dir->scale; max = (dir->size + dir->threshold) * dir->scale; @@ -2813,13 +2813,12 @@ theme_dir_size_difference (IconThemeDir *dir, if (scaled_size > max) return scaled_size - max; return 0; - break; + case ICON_THEME_DIR_UNTHEMED: + default: g_assert_not_reached (); - break; + return 1000; } - g_assert_not_reached (); - return 1000; } static const gchar * @@ -2835,10 +2834,12 @@ string_from_suffix (IconSuffix suffix) return ".png"; case ICON_SUFFIX_SYMBOLIC_PNG: return ".symbolic.png"; + case ICON_SUFFIX_NONE: + case HAS_ICON_FILE: default: g_assert_not_reached(); + return NULL; } - return NULL; } static IconSuffix @@ -3665,6 +3666,8 @@ apply_emblems_to_pixbuf (GdkPixbuf *pixbuf, x = 0; y = 0; break; + default: + break; } if (icon == NULL) diff --git a/gtk/gtkiconview.c b/gtk/gtkiconview.c index df13372566..4cd2487bf1 100644 --- a/gtk/gtkiconview.c +++ b/gtk/gtkiconview.c @@ -1757,7 +1757,8 @@ gtk_icon_view_snapshot (GtkWidget *widget, rect.y = dest_item->cell_area.y; rect.width = 2; rect.height = dest_item->cell_area.height; - case GTK_ICON_VIEW_NO_DROP: ; + case GTK_ICON_VIEW_NO_DROP: + default: break; } @@ -2590,6 +2591,7 @@ gtk_icon_view_real_toggle_cursor_item (GtkIconView *icon_view) switch (icon_view->priv->selection_mode) { case GTK_SELECTION_NONE: + default: break; case GTK_SELECTION_BROWSE: _gtk_icon_view_select_item (icon_view, icon_view->priv->cursor_item); @@ -3506,8 +3508,14 @@ gtk_icon_view_real_move_cursor (GtkIconView *icon_view, case GTK_MOVEMENT_BUFFER_ENDS: gtk_icon_view_move_cursor_start_end (icon_view, count); break; + case GTK_MOVEMENT_WORDS: + case GTK_MOVEMENT_DISPLAY_LINE_ENDS: + case GTK_MOVEMENT_PARAGRAPHS: + case GTK_MOVEMENT_PARAGRAPH_ENDS: + case GTK_MOVEMENT_HORIZONTAL_PAGES: default: g_assert_not_reached (); + break; } icon_view->priv->modify_selection_pressed = FALSE; diff --git a/gtk/gtkimage.c b/gtk/gtkimage.c index 245d636af6..72bdeb715e 100644 --- a/gtk/gtkimage.c +++ b/gtk/gtkimage.c @@ -1375,6 +1375,9 @@ gtk_image_notify_for_storage_type (GtkImage *image, case GTK_IMAGE_GICON: g_object_notify_by_pspec (G_OBJECT (image), image_props[PROP_GICON]); break; + case GTK_IMAGE_SURFACE: + g_object_notify_by_pspec (G_OBJECT (image), image_props[PROP_SURFACE]); + break; case GTK_IMAGE_EMPTY: default: break; diff --git a/gtk/gtkkineticscrolling.c b/gtk/gtkkineticscrolling.c index 29bf085674..deb953d6f0 100644 --- a/gtk/gtkkineticscrolling.c +++ b/gtk/gtkkineticscrolling.c @@ -208,6 +208,7 @@ gtk_kinetic_scrolling_tick (GtkKineticScrolling *data, } case GTK_KINETIC_SCROLLING_PHASE_FINISHED: + default: break; } diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c index de33f39ebe..6774ebc28d 100644 --- a/gtk/gtklabel.c +++ b/gtk/gtklabel.c @@ -4466,6 +4466,10 @@ gtk_label_focus (GtkWidget *widget, break; default: + case GTK_DIR_UP: + case GTK_DIR_DOWN: + case GTK_DIR_LEFT: + case GTK_DIR_RIGHT: goto out; } @@ -5840,6 +5844,7 @@ gtk_label_move_cursor (GtkLabel *label, case GTK_MOVEMENT_PARAGRAPHS: case GTK_MOVEMENT_PAGES: case GTK_MOVEMENT_HORIZONTAL_PAGES: + default: break; } } @@ -5900,6 +5905,7 @@ gtk_label_move_cursor (GtkLabel *label, case GTK_MOVEMENT_PARAGRAPHS: case GTK_MOVEMENT_PAGES: case GTK_MOVEMENT_HORIZONTAL_PAGES: + default: break; } } diff --git a/gtk/gtklistbox.c b/gtk/gtklistbox.c index b1305d7d43..52f6398bc1 100644 --- a/gtk/gtklistbox.c +++ b/gtk/gtklistbox.c @@ -1904,6 +1904,10 @@ gtk_list_box_focus (GtkWidget *widget, if (next_focus_row == NULL) next_focus_row = gtk_list_box_get_last_focusable (box); break; + case GTK_DIR_DOWN: + case GTK_DIR_TAB_FORWARD: + case GTK_DIR_LEFT: + case GTK_DIR_RIGHT: default: next_focus_row = priv->selected_row; if (next_focus_row == NULL) @@ -2722,7 +2726,7 @@ gtk_list_box_move_cursor (GtkListBox *box, int height; row = NULL; - switch (step) + switch ((guint) step) { case GTK_MOVEMENT_BUFFER_ENDS: if (count < 0) diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c index 40b939f4b3..e9894a5815 100644 --- a/gtk/gtkmain.c +++ b/gtk/gtkmain.c @@ -1140,7 +1140,7 @@ rewrite_event_for_window (GdkEvent *event, { event = gdk_event_copy (event); - switch (event->type) + switch ((guint) event->type) { case GDK_SCROLL: rewrite_events_translate (event->any.window, @@ -1211,7 +1211,7 @@ rewrite_event_for_grabs (GdkEvent *event) GdkDisplay *display; GdkDevice *device; - switch (event->type) + switch ((guint) event->type) { case GDK_SCROLL: case GDK_BUTTON_PRESS: @@ -1307,6 +1307,9 @@ get_virtual_notify_type (GdkNotifyType notify_type) return GDK_NOTIFY_VIRTUAL; case GDK_NOTIFY_NONLINEAR: return GDK_NOTIFY_NONLINEAR_VIRTUAL; + case GDK_NOTIFY_VIRTUAL: + case GDK_NOTIFY_NONLINEAR_VIRTUAL: + case GDK_NOTIFY_UNKNOWN: default: g_assert_not_reached (); return GDK_NOTIFY_UNKNOWN; @@ -1441,7 +1444,7 @@ gtk_synthesize_crossing_events (GtkWindow *toplevel, static gboolean is_pointing_event (GdkEvent *event) { - switch (event->type) + switch ((guint) event->type) { case GDK_MOTION_NOTIFY: case GDK_ENTER_NOTIFY: @@ -1485,7 +1488,7 @@ handle_pointing_event (GdkEvent *event) sequence = gdk_event_get_event_sequence (event); - switch (event->type) + switch ((guint) event->type) { case GDK_LEAVE_NOTIFY: if (event->crossing.mode == GDK_CROSSING_GRAB || @@ -1842,6 +1845,9 @@ gtk_main_do_event (GdkEvent *event) case GDK_DROP_START: _gtk_drag_dest_handle_event (event_widget, event); break; + case GDK_SETTING: + case GDK_OWNER_CHANGE: + case GDK_EVENT_LAST: default: g_assert_not_reached (); break; diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c index 6d5eb92f52..cf80a08dfa 100644 --- a/gtk/gtkmenu.c +++ b/gtk/gtkmenu.c @@ -1128,7 +1128,7 @@ gtk_menu_window_event (GtkWidget *window, g_object_ref (window); g_object_ref (menu); - switch (gdk_event_get_event_type (event)) + switch ((guint) gdk_event_get_event_type (event)) { case GDK_WINDOW_STATE: /* Window for the menu has been closed by the display server or by GDK. @@ -3609,7 +3609,7 @@ gtk_menu_captured_event (GtkWidget *widget, source_device = gdk_event_get_source_device (event); gdk_event_get_root_coords (event, &x_root, &y_root); - switch (gdk_event_get_event_type (event)) + switch ((guint) gdk_event_get_event_type (event)) { case GDK_TOUCH_BEGIN: case GDK_BUTTON_PRESS: @@ -4035,10 +4035,10 @@ get_horizontally_flipped_anchor (GdkGravity anchor) return GDK_GRAVITY_SOUTH; case GDK_GRAVITY_SOUTH_EAST: return GDK_GRAVITY_SOUTH_WEST; + default: + g_warning ("unknown GdkGravity: %d", anchor); + return anchor; } - - g_warning ("unknown GdkGravity: %d", anchor); - return anchor; } static void @@ -4450,7 +4450,10 @@ gtk_menu_move_current (GtkMenuShell *menu_shell, case GTK_MENU_DIR_PARENT: direction = GTK_MENU_DIR_CHILD; break; - default: ; + case GTK_MENU_DIR_NEXT: + case GTK_MENU_DIR_PREV: + default: + break; } } @@ -4634,7 +4637,7 @@ gtk_menu_real_move_scroll (GtkMenu *menu, gint end_position = get_menu_height (menu); GtkMenuShell *menu_shell = GTK_MENU_SHELL (menu); - switch (type) + switch ((guint) type) { case GTK_SCROLL_PAGE_UP: case GTK_SCROLL_PAGE_DOWN: diff --git a/gtk/gtkmenubar.c b/gtk/gtkmenubar.c index d18ea69b74..f3f753d4bc 100644 --- a/gtk/gtkmenubar.c +++ b/gtk/gtkmenubar.c @@ -632,7 +632,10 @@ gtk_menu_bar_move_current (GtkMenuShell *menu_shell, case GTK_MENU_DIR_NEXT: direction = GTK_MENU_DIR_PREV; break; - default: ; + case GTK_MENU_DIR_PARENT: + case GTK_MENU_DIR_CHILD: + default: + break; } } } diff --git a/gtk/gtkmenubutton.c b/gtk/gtkmenubutton.c index e0fd91c92e..110c7b5fa3 100644 --- a/gtk/gtkmenubutton.c +++ b/gtk/gtkmenubutton.c @@ -264,6 +264,7 @@ popup_menu (GtkMenuButton *menu_button, switch (gtk_widget_get_halign (priv->menu)) { + default: case GTK_ALIGN_FILL: case GTK_ALIGN_START: case GTK_ALIGN_BASELINE: @@ -298,6 +299,7 @@ popup_menu (GtkMenuButton *menu_button, switch (gtk_widget_get_halign (priv->menu)) { + default: case GTK_ALIGN_FILL: case GTK_ALIGN_START: case GTK_ALIGN_BASELINE: @@ -327,6 +329,7 @@ popup_menu (GtkMenuButton *menu_button, switch (gtk_widget_get_valign (priv->menu)) { + default: case GTK_ALIGN_FILL: case GTK_ALIGN_START: case GTK_ALIGN_BASELINE: @@ -356,6 +359,7 @@ popup_menu (GtkMenuButton *menu_button, switch (gtk_widget_get_valign (priv->menu)) { + default: case GTK_ALIGN_FILL: case GTK_ALIGN_START: case GTK_ALIGN_BASELINE: @@ -384,6 +388,9 @@ popup_menu (GtkMenuButton *menu_button, NULL); break; + + default: + break; } gtk_menu_popup_at_widget (GTK_MENU (priv->menu), @@ -593,6 +600,8 @@ set_arrow_type (GtkImage *image, case GTK_ARROW_RIGHT: gtk_image_set_from_icon_name (image, "pan-end-symbolic", GTK_ICON_SIZE_BUTTON); break; + default: + break; } } @@ -960,6 +969,8 @@ update_popover_direction (GtkMenuButton *menu_button) case GTK_ARROW_RIGHT: gtk_popover_set_position (GTK_POPOVER (priv->popover), GTK_POS_RIGHT); break; + default: + break; } } diff --git a/gtk/gtkmenuitem.c b/gtk/gtkmenuitem.c index efddab514e..0c98806f46 100644 --- a/gtk/gtkmenuitem.c +++ b/gtk/gtkmenuitem.c @@ -1351,6 +1351,7 @@ popped_up_cb (GtkMenu *menu, break; case GTK_DIRECTION_RIGHT: + default: menu_item->priv->submenu_direction = GTK_DIRECTION_LEFT; break; } @@ -1425,6 +1426,7 @@ gtk_menu_item_real_popup_submenu (GtkWidget *widget, break; case GTK_LEFT_RIGHT: + default: if (parent_menu && GTK_IS_MENU_ITEM (parent_menu->priv->parent_menu_item)) submenu_direction = GTK_MENU_ITEM (parent_menu->priv->parent_menu_item)->priv->submenu_direction; else @@ -1451,6 +1453,7 @@ gtk_menu_item_real_popup_submenu (GtkWidget *widget, switch (submenu_direction) { case GTK_DIRECTION_RIGHT: + default: g_object_set (priv->submenu, "rect-anchor-dx", horizontal_offset + parent_padding.right + menu_padding.left, NULL); diff --git a/gtk/gtkmenushell.c b/gtk/gtkmenushell.c index 732f6523af..ebb7194513 100644 --- a/gtk/gtkmenushell.c +++ b/gtk/gtkmenushell.c @@ -1413,6 +1413,9 @@ gtk_real_menu_shell_move_current (GtkMenuShell *menu_shell, if (!had_selection && !priv->active_menu_item && priv->children) gtk_menu_shell_select_first (menu_shell, TRUE); break; + + default: + break; } } diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c index d1f90ab3f3..144a5fc3ce 100644 --- a/gtk/gtknotebook.c +++ b/gtk/gtknotebook.c @@ -1214,6 +1214,9 @@ gtk_notebook_focus_tab (GtkNotebook *notebook, if (list) gtk_notebook_switch_focus_tab (notebook, list); break; + + default: + break; } return TRUE; @@ -1869,6 +1872,9 @@ gtk_notebook_get_preferred_tabs_size (GtkNotebook *notebook, tab_width = MAX (tab_width, page->requisition.width); tab_max = MAX (tab_max, page->requisition.height); break; + default: + g_assert_not_reached (); + break; } } else if (gtk_widget_get_visible (page->tab_label)) @@ -2428,13 +2434,16 @@ get_drop_position (GtkNotebook *notebook) if (allocation.x + allocation.width / 2 < x) return children; } - break; + case GTK_POS_LEFT: case GTK_POS_RIGHT: if (allocation.y + allocation.height / 2 > y) return children; + break; + default: + g_assert_not_reached (); break; } @@ -3608,7 +3617,7 @@ gtk_notebook_focus (GtkWidget *widget, if (old_focus_child == priv->action_widget[ACTION_WIDGET_START]) { - switch (effective_direction) + switch ((guint) effective_direction) { case GTK_DIR_DOWN: return focus_child_in (notebook, GTK_DIR_TAB_FORWARD); @@ -3619,7 +3628,7 @@ gtk_notebook_focus (GtkWidget *widget, case GTK_DIR_UP: return FALSE; default: - switch (direction) + switch ((guint) direction) { case GTK_DIR_TAB_FORWARD: if ((priv->tab_pos == GTK_POS_RIGHT || priv->tab_pos == GTK_POS_BOTTOM) && @@ -3630,12 +3639,13 @@ gtk_notebook_focus (GtkWidget *widget, return FALSE; default: g_assert_not_reached (); + break; } } } else if (old_focus_child == priv->action_widget[ACTION_WIDGET_END]) { - switch (effective_direction) + switch ((guint) effective_direction) { case GTK_DIR_DOWN: return focus_child_in (notebook, GTK_DIR_TAB_FORWARD); @@ -3646,7 +3656,7 @@ gtk_notebook_focus (GtkWidget *widget, case GTK_DIR_UP: return FALSE; default: - switch (direction) + switch ((guint) direction) { case GTK_DIR_TAB_FORWARD: return FALSE; @@ -3657,12 +3667,13 @@ gtk_notebook_focus (GtkWidget *widget, return focus_tabs_in (notebook); default: g_assert_not_reached (); + break; } } } else { - switch (effective_direction) + switch ((guint) effective_direction) { case GTK_DIR_TAB_BACKWARD: case GTK_DIR_UP: @@ -3674,12 +3685,14 @@ gtk_notebook_focus (GtkWidget *widget, return FALSE; case GTK_DIR_TAB_FORWARD: return focus_action_in (notebook, last_action, direction); + default: + break; } } } else if (widget_is_focus) /* Focus was on tabs */ { - switch (effective_direction) + switch ((guint) effective_direction) { case GTK_DIR_TAB_BACKWARD: return focus_action_in (notebook, first_action, direction); @@ -3699,11 +3712,13 @@ gtk_notebook_focus (GtkWidget *widget, return focus_tabs_move (notebook, direction, STEP_PREV); case GTK_DIR_RIGHT: return focus_tabs_move (notebook, direction, STEP_NEXT); + default: + break; } } else /* Focus was not on widget */ { - switch (effective_direction) + switch ((guint) effective_direction) { case GTK_DIR_TAB_FORWARD: case GTK_DIR_DOWN: @@ -3729,6 +3744,8 @@ gtk_notebook_focus (GtkWidget *widget, case GTK_DIR_LEFT: case GTK_DIR_RIGHT: return focus_child_in (notebook, direction); + default: + break; } } @@ -4420,6 +4437,9 @@ gtk_notebook_snapshot_tabs (GtkGizmo *gizmo, case GTK_POS_RIGHT: step = STEP_PREV; break; + default: + g_assert_not_reached (); + break; } } @@ -4601,6 +4621,9 @@ gtk_notebook_allocate_arrows (GtkNotebook *notebook, } break; + default: + g_assert_not_reached (); + break; } } @@ -4650,6 +4673,10 @@ gtk_notebook_tab_space (GtkNotebook *notebook, *tab_space += page->requisition.height; } break; + + default: + g_assert_not_reached (); + break; } if (!priv->scrollable) @@ -4680,6 +4707,10 @@ gtk_notebook_tab_space (GtkNotebook *notebook, *tab_space = tabs_allocation->height; } break; + + default: + g_assert_not_reached (); + break; } } } @@ -4903,14 +4934,14 @@ get_allocate_at_bottom (GtkWidget *widget, else return (search_direction == STEP_NEXT); - break; case GTK_POS_RIGHT: case GTK_POS_LEFT: return (search_direction == STEP_PREV); - break; - } - return FALSE; + default: + g_assert_not_reached (); + return FALSE; + } } static void @@ -4939,7 +4970,6 @@ gtk_notebook_calculate_tabs_allocation (GtkNotebook *notebook, widget = GTK_WIDGET (notebook); tab_pos = get_effective_tab_pos (notebook); allocate_at_bottom = get_allocate_at_bottom (widget, direction); - anchor = 0; child_allocation = *allocation; @@ -4958,6 +4988,11 @@ gtk_notebook_calculate_tabs_allocation (GtkNotebook *notebook, child_allocation.y += allocation->height; anchor = child_allocation.y; break; + + default: + g_assert_not_reached (); + anchor = 0; + break; } gtk_widget_get_own_allocation (priv->cur_page->tab_widget, &drag_allocation); @@ -5094,7 +5129,10 @@ gtk_notebook_calculate_tabs_allocation (GtkNotebook *notebook, child_allocation.y = anchor; } + break; + default: + g_assert_not_reached (); break; } @@ -5165,6 +5203,9 @@ gtk_notebook_calculate_tabs_allocation (GtkNotebook *notebook, } break; + default: + g_assert_not_reached (); + break; } } @@ -5192,6 +5233,9 @@ gtk_notebook_calculate_tabs_allocation (GtkNotebook *notebook, (allocate_at_bottom && priv->drag_window_y < anchor)) priv->drag_window_y = anchor; break; + default: + g_assert_not_reached (); + break; } } } @@ -5319,6 +5363,9 @@ gtk_notebook_calc_tabs (GtkNotebook *notebook, children = children->prev; } break; + default: + g_assert_not_reached (); + break; } } @@ -5409,7 +5456,7 @@ gtk_notebook_page_select (GtkNotebook *notebook, { GtkNotebookPrivate *priv = notebook->priv; GtkNotebookPage *page; - GtkDirectionType dir = GTK_DIR_DOWN; /* Quiet GCC */ + GtkDirectionType dir; GtkPositionType tab_pos = get_effective_tab_pos (notebook); if (!priv->focus_tab) @@ -5434,6 +5481,10 @@ gtk_notebook_page_select (GtkNotebook *notebook, case GTK_POS_RIGHT: dir = GTK_DIR_LEFT; break; + default: + g_assert_not_reached (); + dir = GTK_DIR_DOWN; + break; } if (gtk_widget_child_focus (page->child, dir)) @@ -6242,6 +6293,9 @@ gtk_notebook_update_tab_pos (GtkNotebook *notebook) gtk_orientable_set_orientation (GTK_ORIENTABLE (priv->box), GTK_ORIENTATION_HORIZONTAL); gtk_orientable_set_orientation (GTK_ORIENTABLE (priv->header_widget), GTK_ORIENTATION_VERTICAL); break; + default: + g_assert_not_reached (); + break; } update_node_ordering (notebook); diff --git a/gtk/gtkoverlay.c b/gtk/gtkoverlay.c index 355ad9f0fc..85d918c03d 100644 --- a/gtk/gtkoverlay.c +++ b/gtk/gtkoverlay.c @@ -124,6 +124,9 @@ effective_align (GtkAlign align, return direction == GTK_TEXT_DIR_RTL ? GTK_ALIGN_END : GTK_ALIGN_START; case GTK_ALIGN_END: return direction == GTK_TEXT_DIR_RTL ? GTK_ALIGN_START : GTK_ALIGN_END; + case GTK_ALIGN_FILL: + case GTK_ALIGN_CENTER: + case GTK_ALIGN_BASELINE: default: return align; } diff --git a/gtk/gtkpadcontroller.c b/gtk/gtkpadcontroller.c index ad4457a4bf..91614169ac 100644 --- a/gtk/gtkpadcontroller.c +++ b/gtk/gtkpadcontroller.c @@ -248,7 +248,7 @@ gtk_pad_controller_handle_event (GtkEventController *controller, return GDK_EVENT_PROPAGATE; } - switch (event_type) + switch ((guint) event_type) { case GDK_PAD_BUTTON_PRESS: type = GTK_PAD_ACTION_BUTTON; diff --git a/gtk/gtkpagesetupunixdialog.c b/gtk/gtkpagesetupunixdialog.c index 368f03a1ea..044b5edfd9 100644 --- a/gtk/gtkpagesetupunixdialog.c +++ b/gtk/gtkpagesetupunixdialog.c @@ -936,6 +936,8 @@ set_orientation (GtkPageSetupUnixDialog *dialog, case GTK_PAGE_ORIENTATION_REVERSE_LANDSCAPE: gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->reverse_landscape_radio), TRUE); break; + default: + break; } } diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c index da21bc138b..a759190c01 100644 --- a/gtk/gtkpaned.c +++ b/gtk/gtkpaned.c @@ -2346,6 +2346,8 @@ gtk_paned_move_handle (GtkPaned *paned, new_position = priv->max_position; break; + case GTK_SCROLL_NONE: + case GTK_SCROLL_JUMP: default: break; } diff --git a/gtk/gtkpango.c b/gtk/gtkpango.c index 98f787a3ee..2c87e8cb65 100644 --- a/gtk/gtkpango.c +++ b/gtk/gtkpango.c @@ -761,8 +761,14 @@ pango_layout_get_line_before (PangoLayout *layout, start_index = 0; end_index = prev_line->start_index + prev_line->length; break; + case ATK_TEXT_BOUNDARY_CHAR: + case ATK_TEXT_BOUNDARY_WORD_START: + case ATK_TEXT_BOUNDARY_WORD_END: + case ATK_TEXT_BOUNDARY_SENTENCE_START: + case ATK_TEXT_BOUNDARY_SENTENCE_END: default: g_assert_not_reached(); + break; } } else @@ -823,8 +829,14 @@ pango_layout_get_line_at (PangoLayout *layout, if (prev_line) start_index = prev_line->start_index + prev_line->length; break; + case ATK_TEXT_BOUNDARY_CHAR: + case ATK_TEXT_BOUNDARY_WORD_START: + case ATK_TEXT_BOUNDARY_WORD_END: + case ATK_TEXT_BOUNDARY_SENTENCE_START: + case ATK_TEXT_BOUNDARY_SENTENCE_END: default: g_assert_not_reached(); + break; } found = TRUE; @@ -887,8 +899,14 @@ pango_layout_get_line_after (PangoLayout *layout, start_index = end_index; end_index = line->start_index + line->length; break; + case ATK_TEXT_BOUNDARY_CHAR: + case ATK_TEXT_BOUNDARY_WORD_START: + case ATK_TEXT_BOUNDARY_WORD_END: + case ATK_TEXT_BOUNDARY_SENTENCE_START: + case ATK_TEXT_BOUNDARY_SENTENCE_END: default: g_assert_not_reached(); + break; } } else @@ -1004,6 +1022,10 @@ _gtk_pango_get_text_before (PangoLayout *layout, case ATK_TEXT_BOUNDARY_LINE_END: pango_layout_get_line_before (layout, boundary_type, offset, &start, &end); break; + + default: + g_assert_not_reached (); + break; } *start_offset = start; @@ -1111,6 +1133,10 @@ _gtk_pango_get_text_after (PangoLayout *layout, case ATK_TEXT_BOUNDARY_LINE_END: pango_layout_get_line_after (layout, boundary_type, offset, &start, &end); break; + + default: + g_assert_not_reached (); + break; } *start_offset = start; @@ -1210,6 +1236,10 @@ _gtk_pango_get_text_at (PangoLayout *layout, case ATK_TEXT_BOUNDARY_LINE_END: pango_layout_get_line_at (layout, boundary_type, offset, &start, &end); break; + + default: + g_assert_not_reached (); + break; } *start_offset = start; diff --git a/gtk/gtkpathbar.c b/gtk/gtkpathbar.c index 899fc1bbaf..e58927feab 100644 --- a/gtk/gtkpathbar.c +++ b/gtk/gtkpathbar.c @@ -1230,6 +1230,8 @@ set_button_image_get_info_cb (GCancellable *cancellable, g_set_object (&data->path_bar->priv->desktop_icon, icon); break; + case NORMAL_BUTTON: + case ROOT_BUTTON: default: break; }; @@ -1309,6 +1311,8 @@ set_button_image (GtkPathBar *path_bar, set_button_image_get_info_cb, data); break; + + case NORMAL_BUTTON: default: break; } diff --git a/gtk/gtkplacessidebar.c b/gtk/gtkplacessidebar.c index 8cb1a4f058..21c2ad3b90 100644 --- a/gtk/gtkplacessidebar.c +++ b/gtk/gtkplacessidebar.c @@ -516,6 +516,7 @@ special_directory_get_gicon (GUserDirectory directory) ICON_CASE (TEMPLATES); ICON_CASE (VIDEOS); + case G_USER_N_DIRECTORIES: default: return g_themed_icon_new_with_default_fallbacks (ICON_NAME_FOLDER); } diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c index d31e30c296..19a4e380e8 100644 --- a/gtk/gtkpopover.c +++ b/gtk/gtkpopover.c @@ -1180,6 +1180,8 @@ gtk_popover_update_position (GtkPopover *popover) case GTK_POS_RIGHT: rect.x -= priv->transition_diff; break; + default: + break; } _gtk_window_set_popover_position (priv->window, widget, @@ -1363,6 +1365,8 @@ gtk_popover_size_allocate (GtkWidget *widget, child_alloc.x += TAIL_HEIGHT; child_alloc.y += TAIL_HEIGHT / 2; break; + default: + break; } gtk_widget_size_allocate (priv->contents_widget, &child_alloc, -1, out_clip); diff --git a/gtk/gtkprinteroptionwidget.c b/gtk/gtkprinteroptionwidget.c index 2bd5832556..1707e151b3 100644 --- a/gtk/gtkprinteroptionwidget.c +++ b/gtk/gtkprinteroptionwidget.c @@ -648,6 +648,14 @@ combo_changed_cb (GtkWidget *combo, case GTK_PRINTER_OPTION_TYPE_PICKONE_REAL: filtered_val = filter_numeric (value, TRUE, TRUE, &changed); break; + case GTK_PRINTER_OPTION_TYPE_BOOLEAN: + case GTK_PRINTER_OPTION_TYPE_PICKONE: + case GTK_PRINTER_OPTION_TYPE_PICKONE_PASSWORD: + case GTK_PRINTER_OPTION_TYPE_PICKONE_STRING: + case GTK_PRINTER_OPTION_TYPE_ALTERNATIVE: + case GTK_PRINTER_OPTION_TYPE_STRING: + case GTK_PRINTER_OPTION_TYPE_FILESAVE: + case GTK_PRINTER_OPTION_TYPE_INFO: default: break; } diff --git a/gtk/gtkprintoperation-portal.c b/gtk/gtkprintoperation-portal.c index faeee259ee..97bec76f72 100644 --- a/gtk/gtkprintoperation-portal.c +++ b/gtk/gtkprintoperation-portal.c @@ -129,6 +129,9 @@ portal_start_page (GtkPrintOperation *op, case GTK_PAGE_ORIENTATION_REVERSE_LANDSCAPE: cairo_ps_surface_dsc_comment (op_portal->surface, "%%PageOrientation: Landscape"); break; + + default: + break; } } else if (type == CAIRO_SURFACE_TYPE_PDF) diff --git a/gtk/gtkprintoperation-unix.c b/gtk/gtkprintoperation-unix.c index dee683f7a5..2c454268f6 100644 --- a/gtk/gtkprintoperation-unix.c +++ b/gtk/gtkprintoperation-unix.c @@ -103,6 +103,8 @@ unix_start_page (GtkPrintOperation *op, case GTK_PAGE_ORIENTATION_REVERSE_LANDSCAPE: cairo_ps_surface_dsc_comment (op_unix->surface, "%%PageOrientation: Landscape"); break; + default: + break; } } else if (type == CAIRO_SURFACE_TYPE_PDF) diff --git a/gtk/gtkprintoperation.c b/gtk/gtkprintoperation.c index 329a07aeaf..516f694b0c 100644 --- a/gtk/gtkprintoperation.c +++ b/gtk/gtkprintoperation.c @@ -324,8 +324,9 @@ preview_iface_is_selected (GtkPrintOperationPreview *preview, return TRUE; } return FALSE; + default: + return FALSE; } - return FALSE; } static void diff --git a/gtk/gtkprintutils.c b/gtk/gtkprintutils.c index 35affcf6e9..6bcb6dc500 100644 --- a/gtk/gtkprintutils.c +++ b/gtk/gtkprintutils.c @@ -29,6 +29,7 @@ _gtk_print_convert_to_mm (gdouble len, return len; case GTK_UNIT_INCH: return len * MM_PER_INCH; + case GTK_UNIT_NONE: default: g_warning ("Unsupported unit"); /* Fall through */ @@ -48,6 +49,7 @@ _gtk_print_convert_from_mm (gdouble len, return len; case GTK_UNIT_INCH: return len / MM_PER_INCH; + case GTK_UNIT_NONE: default: g_warning ("Unsupported unit"); /* Fall through */ diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c index c6fb78efad..75d4126e15 100644 --- a/gtk/gtkrange.c +++ b/gtk/gtkrange.c @@ -2219,7 +2219,7 @@ autoscroll_cb (GtkWidget *widget, step = gtk_adjustment_get_step_increment (adj); page = gtk_adjustment_get_page_increment (adj); - switch (priv->autoscroll_mode) + switch ((guint) priv->autoscroll_mode) { case GTK_SCROLL_STEP_FORWARD: increment = step / AUTOSCROLL_FACTOR; @@ -2655,6 +2655,7 @@ gtk_range_scroll (GtkRange *range, break; case GTK_SCROLL_NONE: + default: break; } diff --git a/gtk/gtkrecentfilter.c b/gtk/gtkrecentfilter.c index 4062db59d9..506e0aa82b 100644 --- a/gtk/gtkrecentfilter.c +++ b/gtk/gtkrecentfilter.c @@ -827,6 +827,9 @@ gtk_recent_filter_filter (GtkRecentFilter *filter, if (rule->u.custom.func (filter_info, rule->u.custom.data)) return TRUE; break; + default: + g_assert_not_reached (); + break; } } diff --git a/gtk/gtkrecentmanager.c b/gtk/gtkrecentmanager.c index 8182ff5728..734eb44bf9 100644 --- a/gtk/gtkrecentmanager.c +++ b/gtk/gtkrecentmanager.c @@ -556,6 +556,15 @@ gtk_recent_manager_monitor_changed (GFileMonitor *monitor, gdk_threads_leave (); break; + case G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT: + case G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED: + case G_FILE_MONITOR_EVENT_PRE_UNMOUNT: + case G_FILE_MONITOR_EVENT_UNMOUNTED: + case G_FILE_MONITOR_EVENT_MOVED: + case G_FILE_MONITOR_EVENT_RENAMED: + case G_FILE_MONITOR_EVENT_MOVED_IN: + case G_FILE_MONITOR_EVENT_MOVED_OUT: + default: break; } diff --git a/gtk/gtkrender.c b/gtk/gtkrender.c index 3d4bbbaf3e..39ffdf33b8 100644 --- a/gtk/gtkrender.c +++ b/gtk/gtkrender.c @@ -682,6 +682,10 @@ gtk_css_style_render_frame_gap (GtkCssStyle *style, wc = border_width; hc = MAX (xy1_gap - xy0_gap - 2 * border_width, 0); break; + + default: + g_assert_not_reached (); + break; } cairo_clip_extents (cr, &x0, &y0, &x1, &y1); diff --git a/gtk/gtkrevealer.c b/gtk/gtkrevealer.c index 4aeffd88a4..df11832fb9 100644 --- a/gtk/gtkrevealer.c +++ b/gtk/gtkrevealer.c @@ -333,14 +333,19 @@ gtk_revealer_get_child_allocation (GtkRevealer *revealer, switch (transition) { - case GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT: + case GTK_REVEALER_TRANSITION_TYPE_SLIDE_RIGHT: child_allocation->x = - child_allocation->width * (1 - priv->current_pos); break; - case GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN: + case GTK_REVEALER_TRANSITION_TYPE_SLIDE_DOWN: child_allocation->y = - child_allocation->height * (1 - priv->current_pos); break; - default: {} + case GTK_REVEALER_TRANSITION_TYPE_NONE: + case GTK_REVEALER_TRANSITION_TYPE_CROSSFADE: + case GTK_REVEALER_TRANSITION_TYPE_SLIDE_LEFT: + case GTK_REVEALER_TRANSITION_TYPE_SLIDE_UP: + default: + break; } } diff --git a/gtk/gtkscale.c b/gtk/gtkscale.c index 48ff14fab5..5e9259ec93 100644 --- a/gtk/gtkscale.c +++ b/gtk/gtkscale.c @@ -1316,6 +1316,9 @@ gtk_scale_get_range_border (GtkRange *range, case GTK_POS_BOTTOM: border->bottom += value_size; break; + default: + g_assert_not_reached (); + break; } } diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c index d73aff5349..021ebf6d3e 100644 --- a/gtk/gtkscrolledwindow.c +++ b/gtk/gtkscrolledwindow.c @@ -2872,6 +2872,8 @@ gtk_scrolled_window_scroll_child (GtkScrolledWindow *scrolled_window, case GTK_SCROLL_START: case GTK_SCROLL_END: break; + case GTK_SCROLL_NONE: + case GTK_SCROLL_JUMP: default: g_warning ("Invalid scroll type %u for GtkScrolledWindow::scroll-child", scroll); return FALSE; @@ -2916,6 +2918,16 @@ gtk_scrolled_window_scroll_child (GtkScrolledWindow *scrolled_window, case GTK_SCROLL_END: value = gtk_adjustment_get_upper (adjustment); break; + case GTK_SCROLL_STEP_UP: + case GTK_SCROLL_STEP_DOWN: + case GTK_SCROLL_STEP_LEFT: + case GTK_SCROLL_STEP_RIGHT: + case GTK_SCROLL_PAGE_UP: + case GTK_SCROLL_PAGE_DOWN: + case GTK_SCROLL_PAGE_LEFT: + case GTK_SCROLL_PAGE_RIGHT: + case GTK_SCROLL_NONE: + case GTK_SCROLL_JUMP: default: g_assert_not_reached (); break; diff --git a/gtk/gtksettings.c b/gtk/gtksettings.c index e2b5d43ff3..0f199ae6ed 100644 --- a/gtk/gtksettings.c +++ b/gtk/gtksettings.c @@ -1402,6 +1402,9 @@ gtk_settings_notify (GObject *object, case PROP_CURSOR_THEME_SIZE: settings_update_cursor_theme (settings); break; + default: + g_assert_not_reached (); + break; } } diff --git a/gtk/gtkshortcutsshortcut.c b/gtk/gtkshortcutsshortcut.c index 6ae53665ce..be280e9fff 100644 --- a/gtk/gtkshortcutsshortcut.c +++ b/gtk/gtkshortcutsshortcut.c @@ -240,7 +240,9 @@ update_icon_from_type (GtkShortcutsShortcut *self) icon = g_themed_icon_new ("gesture-swipe-right-symbolic"); break; - default: ; + case GTK_SHORTCUT_ACCELERATOR: + case GTK_SHORTCUT_GESTURE: + default: icon = NULL; break; } diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c index 07853124b1..2cd6c2889b 100644 --- a/gtk/gtkspinbutton.c +++ b/gtk/gtkspinbutton.c @@ -1274,6 +1274,8 @@ gtk_spin_button_real_change_value (GtkSpinButton *spin, break; } + case GTK_SCROLL_NONE: + case GTK_SCROLL_JUMP: default: g_warning ("Invalid scroll type %d for GtkSpinButton::change-value", scroll); break; diff --git a/gtk/gtkstack.c b/gtk/gtkstack.c index f64f763eda..2bfa5c54a8 100644 --- a/gtk/gtkstack.c +++ b/gtk/gtkstack.c @@ -712,9 +712,23 @@ get_simple_transition_type (gboolean new_child_first, return new_child_first ? GTK_STACK_TRANSITION_TYPE_UNDER_RIGHT : GTK_STACK_TRANSITION_TYPE_OVER_LEFT; case GTK_STACK_TRANSITION_TYPE_OVER_RIGHT_LEFT: return new_child_first ? GTK_STACK_TRANSITION_TYPE_UNDER_LEFT : GTK_STACK_TRANSITION_TYPE_OVER_RIGHT; - default: ; + case GTK_STACK_TRANSITION_TYPE_SLIDE_UP: + case GTK_STACK_TRANSITION_TYPE_SLIDE_DOWN: + case GTK_STACK_TRANSITION_TYPE_OVER_UP: + case GTK_STACK_TRANSITION_TYPE_OVER_DOWN: + case GTK_STACK_TRANSITION_TYPE_UNDER_UP: + case GTK_STACK_TRANSITION_TYPE_UNDER_DOWN: + case GTK_STACK_TRANSITION_TYPE_NONE: + case GTK_STACK_TRANSITION_TYPE_SLIDE_LEFT: + case GTK_STACK_TRANSITION_TYPE_SLIDE_RIGHT: + case GTK_STACK_TRANSITION_TYPE_OVER_LEFT: + case GTK_STACK_TRANSITION_TYPE_OVER_RIGHT: + case GTK_STACK_TRANSITION_TYPE_UNDER_LEFT: + case GTK_STACK_TRANSITION_TYPE_UNDER_RIGHT: + case GTK_STACK_TRANSITION_TYPE_CROSSFADE: + default: + return transition_type; } - return transition_type; } static gint @@ -858,11 +872,28 @@ effective_transition_type (GtkStack *stack, return GTK_STACK_TRANSITION_TYPE_UNDER_RIGHT; case GTK_STACK_TRANSITION_TYPE_UNDER_RIGHT: return GTK_STACK_TRANSITION_TYPE_UNDER_LEFT; - default: ; + case GTK_STACK_TRANSITION_TYPE_SLIDE_UP: + case GTK_STACK_TRANSITION_TYPE_SLIDE_DOWN: + case GTK_STACK_TRANSITION_TYPE_OVER_UP: + case GTK_STACK_TRANSITION_TYPE_OVER_DOWN: + case GTK_STACK_TRANSITION_TYPE_UNDER_UP: + case GTK_STACK_TRANSITION_TYPE_UNDER_DOWN: + case GTK_STACK_TRANSITION_TYPE_NONE: + case GTK_STACK_TRANSITION_TYPE_SLIDE_LEFT_RIGHT: + case GTK_STACK_TRANSITION_TYPE_SLIDE_UP_DOWN: + case GTK_STACK_TRANSITION_TYPE_OVER_UP_DOWN: + case GTK_STACK_TRANSITION_TYPE_OVER_DOWN_UP: + case GTK_STACK_TRANSITION_TYPE_OVER_LEFT_RIGHT: + case GTK_STACK_TRANSITION_TYPE_OVER_RIGHT_LEFT: + case GTK_STACK_TRANSITION_TYPE_CROSSFADE: + default: + return transition_type; } } - - return transition_type; + else + { + return transition_type; + } } static void @@ -1847,7 +1878,7 @@ gtk_stack_snapshot_under (GtkWidget *widget, pos_x = pos_y = 0; - switch (priv->active_transition_type) + switch ((guint) priv->active_transition_type) { case GTK_STACK_TRANSITION_TYPE_UNDER_DOWN: y = 0; @@ -1913,7 +1944,7 @@ gtk_stack_snapshot_slide (GtkWidget *widget, x = get_bin_window_x (stack); y = get_bin_window_y (stack); - switch (priv->active_transition_type) + switch ((guint) priv->active_transition_type) { case GTK_STACK_TRANSITION_TYPE_SLIDE_LEFT: x -= width; @@ -2015,6 +2046,13 @@ gtk_stack_snapshot (GtkWidget *widget, case GTK_STACK_TRANSITION_TYPE_UNDER_RIGHT: gtk_stack_snapshot_under (widget, snapshot); break; + case GTK_STACK_TRANSITION_TYPE_NONE: + case GTK_STACK_TRANSITION_TYPE_SLIDE_LEFT_RIGHT: + case GTK_STACK_TRANSITION_TYPE_SLIDE_UP_DOWN: + case GTK_STACK_TRANSITION_TYPE_OVER_UP_DOWN: + case GTK_STACK_TRANSITION_TYPE_OVER_DOWN_UP: + case GTK_STACK_TRANSITION_TYPE_OVER_LEFT_RIGHT: + case GTK_STACK_TRANSITION_TYPE_OVER_RIGHT_LEFT: default: g_assert_not_reached (); } diff --git a/gtk/gtktextbuffer.c b/gtk/gtktextbuffer.c index 81b95f5d83..b75ba63503 100644 --- a/gtk/gtktextbuffer.c +++ b/gtk/gtktextbuffer.c @@ -4577,6 +4577,10 @@ _gtk_text_buffer_get_text_before (GtkTextBuffer *buffer, gtk_text_iter_forward_to_line_end (end); } break; + + default: + g_assert_not_reached (); + break; } } @@ -4678,6 +4682,10 @@ _gtk_text_buffer_get_text_at (GtkTextBuffer *buffer, } gtk_text_iter_forward_to_line_end (end); break; + + default: + g_assert_not_reached (); + break; } } @@ -4771,6 +4779,9 @@ _gtk_text_buffer_get_text_after (GtkTextBuffer *buffer, gtk_text_iter_forward_to_line_end (end); } break; + default: + g_assert_not_reached (); + break; } } diff --git a/gtk/gtktextbufferserialize.c b/gtk/gtktextbufferserialize.c index 45ea75ccba..5df71c6ff2 100644 --- a/gtk/gtktextbufferserialize.c +++ b/gtk/gtktextbufferserialize.c @@ -1334,6 +1334,8 @@ start_element_handler (GMarkupParseContext *context, attribute_names, attribute_values, info, error); break; + case STATE_ATTR: + case STATE_PIXBUF: default: g_assert_not_reached (); break; @@ -1451,6 +1453,7 @@ end_element_handler (GMarkupParseContext *context, g_assert (peek_state (info) == STATE_APPLY_TAG || peek_state (info) == STATE_TEXT); break; + case STATE_START: default: g_assert_not_reached (); break; @@ -1493,13 +1496,9 @@ text_handler (GMarkupParseContext *context, peek_state (info) != STATE_APPLY_TAG) return; - switch (peek_state (info)) + if (peek_state (info) == STATE_TEXT || + peek_state (info) == STATE_APPLY_TAG) { - case STATE_START: - g_assert_not_reached (); /* gmarkup shouldn't do this */ - break; - case STATE_TEXT: - case STATE_APPLY_TAG: if (text_len == 0) return; @@ -1508,10 +1507,6 @@ text_handler (GMarkupParseContext *context, span->tags = g_slist_copy (info->tag_stack); info->spans = g_list_prepend (info->spans, span); - break; - default: - g_assert_not_reached (); - break; } } diff --git a/gtk/gtktextlayout.c b/gtk/gtktextlayout.c index ad3d1e0c9e..75c37a583b 100644 --- a/gtk/gtktextlayout.c +++ b/gtk/gtktextlayout.c @@ -1349,6 +1349,11 @@ set_para_values (GtkTextLayout *layout, case PANGO_DIRECTION_RTL : display->direction = GTK_TEXT_DIR_RTL; break; + case PANGO_DIRECTION_LTR: + case PANGO_DIRECTION_TTB_LTR: + case PANGO_DIRECTION_TTB_RTL: + case PANGO_DIRECTION_WEAK_LTR: + case PANGO_DIRECTION_WEAK_RTL: default: display->direction = GTK_TEXT_DIR_LTR; break; @@ -1411,6 +1416,7 @@ set_para_values (GtkTextLayout *layout, break; case GTK_WRAP_NONE: + default: break; } @@ -1998,7 +2004,7 @@ add_preedit_attrs (GtkTextLayout *layout, PangoAttribute *attr = tmp_list->data; GdkRGBA rgba; - switch (attr->klass->type) + switch ((guint) attr->klass->type) { case PANGO_ATTR_FOREGROUND: convert_color (&rgba, (PangoAttrColor *)attr); @@ -2583,6 +2589,7 @@ gtk_text_layout_get_line_display (GtkTextLayout *layout, switch (pango_layout_get_alignment (display->layout)) { case PANGO_ALIGN_LEFT: + default: break; case PANGO_ALIGN_CENTER: display->x_offset += excess / 2; diff --git a/gtk/gtktexttag.c b/gtk/gtktexttag.c index 6dab6d754c..e149e81ff5 100644 --- a/gtk/gtktexttag.c +++ b/gtk/gtktexttag.c @@ -1044,9 +1044,9 @@ get_property_font_set_mask (guint prop_id) return PANGO_FONT_MASK_STRETCH; case PROP_SIZE_SET: return PANGO_FONT_MASK_SIZE; + default: + return 0; } - - return 0; } static PangoFontMask @@ -1322,6 +1322,9 @@ gtk_text_tag_set_property (GObject *object, g_value_get_double (value) * PANGO_SCALE); g_object_notify (object, "size"); break; + + default: + break; } size_changed = TRUE; @@ -1708,45 +1711,40 @@ gtk_text_tag_get_property (GObject *object, break; case PROP_FAMILY: + gtk_text_tag_ensure_font (tag); + g_value_set_string (value, pango_font_description_get_family (priv->values->font)); + break; + case PROP_STYLE: + gtk_text_tag_ensure_font (tag); + g_value_set_enum (value, pango_font_description_get_style (priv->values->font)); + break; + case PROP_VARIANT: + gtk_text_tag_ensure_font (tag); + g_value_set_enum (value, pango_font_description_get_variant (priv->values->font)); + break; + case PROP_WEIGHT: + gtk_text_tag_ensure_font (tag); + g_value_set_int (value, pango_font_description_get_weight (priv->values->font)); + break; + case PROP_STRETCH: + gtk_text_tag_ensure_font (tag); + g_value_set_enum (value, pango_font_description_get_stretch (priv->values->font)); + break; + case PROP_SIZE: - case PROP_SIZE_POINTS: gtk_text_tag_ensure_font (tag); - switch (prop_id) - { - case PROP_FAMILY: - g_value_set_string (value, pango_font_description_get_family (priv->values->font)); - break; - - case PROP_STYLE: - g_value_set_enum (value, pango_font_description_get_style (priv->values->font)); - break; - - case PROP_VARIANT: - g_value_set_enum (value, pango_font_description_get_variant (priv->values->font)); - break; - - case PROP_WEIGHT: - g_value_set_int (value, pango_font_description_get_weight (priv->values->font)); - break; - - case PROP_STRETCH: - g_value_set_enum (value, pango_font_description_get_stretch (priv->values->font)); - break; - - case PROP_SIZE: - g_value_set_int (value, pango_font_description_get_size (priv->values->font)); - break; - - case PROP_SIZE_POINTS: - g_value_set_double (value, ((double)pango_font_description_get_size (priv->values->font)) / (double)PANGO_SCALE); - break; - } + g_value_set_int (value, pango_font_description_get_size (priv->values->font)); break; + case PROP_SIZE_POINTS: + gtk_text_tag_ensure_font (tag); + g_value_set_double (value, ((double)pango_font_description_get_size (priv->values->font)) / (double)PANGO_SCALE); + break; + case PROP_SCALE: g_value_set_double (value, priv->values->font_scale); break; diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c index 092f0c56e7..023e5e5bde 100644 --- a/gtk/gtktextview.c +++ b/gtk/gtktextview.c @@ -4939,7 +4939,7 @@ get_event_coordinates (GdkEvent *event, gint *x, gint *y) gdouble event_x, event_y; if (event) - switch (gdk_event_get_event_type (event)) + switch ((guint) gdk_event_get_event_type (event)) { case GDK_MOTION_NOTIFY: case GDK_BUTTON_PRESS: @@ -6558,6 +6558,8 @@ gtk_text_view_move_cursor (GtkTextView *text_view, gtk_text_buffer_get_iter_at_offset (get_buffer (text_view), &newplace, 0); break; + case GTK_MOVEMENT_PAGES: + case GTK_MOVEMENT_HORIZONTAL_PAGES: default: break; } @@ -9700,7 +9702,12 @@ text_window_new (GtkTextWindowType type, case GTK_TEXT_WINDOW_BOTTOM: gtk_css_node_add_class (win->css_node, g_quark_from_static_string (GTK_STYLE_CLASS_BOTTOM)); break; - default: /* no extra style class */ ; + case GTK_TEXT_WINDOW_PRIVATE: + case GTK_TEXT_WINDOW_WIDGET: + case GTK_TEXT_WINDOW_TEXT: + default: + /* no extra style class */ + break; } } g_object_unref (win->css_node); @@ -9762,22 +9769,16 @@ text_window_realize (GtkTextWindow *win, gdk_window_show (win->bin_window); - switch (win->type) + if (win->type == GTK_TEXT_WINDOW_TEXT && + gtk_widget_is_sensitive (widget)) { - case GTK_TEXT_WINDOW_TEXT: - if (gtk_widget_is_sensitive (widget)) - { - display = gdk_window_get_display (window); - cursor = gdk_cursor_new_from_name (display, "text"); - gdk_window_set_cursor (win->bin_window, cursor); - g_clear_object (&cursor); - } + display = gdk_window_get_display (window); + cursor = gdk_cursor_new_from_name (display, "text"); + gdk_window_set_cursor (win->bin_window, cursor); + g_clear_object (&cursor); gtk_im_context_set_client_widget (GTK_TEXT_VIEW (widget)->priv->im_context, widget); - break; - default: - break; } g_object_set_qdata (G_OBJECT (win->window), @@ -9900,6 +9901,8 @@ text_window_invalidate_rect (GtkTextWindow *win, window_rect.height = win->allocation.height; break; + case GTK_TEXT_WINDOW_PRIVATE: + case GTK_TEXT_WINDOW_WIDGET: default: g_warning ("%s: bug!", G_STRFUNC); return; @@ -10066,6 +10069,7 @@ gtk_text_view_get_window (GtkTextView *text_view, break; case GTK_TEXT_WINDOW_PRIVATE: + default: g_warning ("%s: You can't get GTK_TEXT_WINDOW_PRIVATE, it has \"PRIVATE\" in the name because it is private.", G_STRFUNC); return NULL; break; @@ -10109,6 +10113,7 @@ gtk_text_view_get_css_node (GtkTextView *text_view, return priv->bottom_window->css_node; break; + case GTK_TEXT_WINDOW_PRIVATE: default: break; } @@ -10563,6 +10568,9 @@ gtk_text_view_set_border_window_size (GtkTextView *text_view, &priv->bottom_window); break; + case GTK_TEXT_WINDOW_PRIVATE: + case GTK_TEXT_WINDOW_WIDGET: + case GTK_TEXT_WINDOW_TEXT: default: g_warning ("Can only set size of left/right/top/bottom border windows with gtk_text_view_set_border_window_size()"); break; @@ -10609,6 +10617,9 @@ gtk_text_view_get_border_window_size (GtkTextView *text_view, return priv->bottom_window->requisition.height; break; + case GTK_TEXT_WINDOW_PRIVATE: + case GTK_TEXT_WINDOW_WIDGET: + case GTK_TEXT_WINDOW_TEXT: default: g_warning ("Can only get size of left/right/top/bottom border windows with gtk_text_view_get_border_window_size()"); break; diff --git a/gtk/gtktoolbar.c b/gtk/gtktoolbar.c index 8d9876793a..85b1c8b537 100644 --- a/gtk/gtktoolbar.c +++ b/gtk/gtktoolbar.c @@ -2337,6 +2337,10 @@ show_menu (GtkToolbar *toolbar, (GdkEvent *) event); break; + + default: + g_assert_not_reached (); + break; } } diff --git a/gtk/gtktoolbutton.c b/gtk/gtktoolbutton.c index 7d2c20e6e2..c94e1fd226 100644 --- a/gtk/gtktoolbutton.c +++ b/gtk/gtktoolbutton.c @@ -500,6 +500,7 @@ gtk_tool_button_construct_contents (GtkToolItem *tool_item) switch (style) { + default: case GTK_TOOLBAR_ICONS: if (icon) gtk_container_add (GTK_CONTAINER (button->priv->button), icon); diff --git a/gtk/gtktoolitemgroup.c b/gtk/gtktoolitemgroup.c index 2dd49f9251..a21122c396 100644 --- a/gtk/gtktoolitemgroup.c +++ b/gtk/gtktoolitemgroup.c @@ -357,6 +357,10 @@ gtk_tool_item_group_header_adjust_style (GtkToolItemGroup *group) gtk_label_set_ellipsize (GTK_LABEL (label_widget), priv->ellipsize); } break; + + default: + g_assert_not_reached (); + break; } gtk_widget_set_margin_start (frame, dx); diff --git a/gtk/gtktooltip.c b/gtk/gtktooltip.c index 7fab3c8b6f..5bf83176fe 100644 --- a/gtk/gtktooltip.c +++ b/gtk/gtktooltip.c @@ -1442,7 +1442,7 @@ gtk_tooltip_handle_event_internal (GdkEventType event_type, return; } - switch (event_type) + switch ((guint) event_type) { case GDK_BUTTON_PRESS: case GDK_KEY_PRESS: diff --git a/gtk/gtktreeselection.c b/gtk/gtktreeselection.c index 7150d1d301..1bb43fcc3d 100644 --- a/gtk/gtktreeselection.c +++ b/gtk/gtktreeselection.c @@ -1333,6 +1333,9 @@ gtk_tree_selection_real_modify_range (GtkTreeSelection *selection, &end_node); anchor_path = start_path; break; + default: + g_assert_not_reached (); + break; } /* Invalid start or end node? */ diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c index 2bb539cc0e..52919404e4 100644 --- a/gtk/gtktreeview.c +++ b/gtk/gtktreeview.c @@ -5153,6 +5153,9 @@ gtk_tree_view_bin_snapshot (GtkWidget *widget, case GTK_TREE_VIEW_DROP_INTO_OR_AFTER: gtk_style_context_add_class (context, "into"); break; + + default: + break; } _gtk_tree_view_find_node (tree_view, drag_dest_path, &drag_tree, &drag_node); @@ -5586,9 +5589,11 @@ gtk_tree_view_get_drop_column (GtkTreeView *tree_view, else return (GtkTreeViewColumn *)0x1; break; - } - return (GtkTreeViewColumn *)0x1; + default: + return (GtkTreeViewColumn *)0x1; + break; + } } static gboolean @@ -8541,6 +8546,11 @@ gtk_tree_view_real_move_cursor (GtkTreeView *tree_view, case GTK_MOVEMENT_BUFFER_ENDS: gtk_tree_view_move_cursor_start_end (tree_view, count); break; + case GTK_MOVEMENT_WORDS: + case GTK_MOVEMENT_DISPLAY_LINE_ENDS: + case GTK_MOVEMENT_PARAGRAPHS: + case GTK_MOVEMENT_PARAGRAPH_ENDS: + case GTK_MOVEMENT_HORIZONTAL_PAGES: default: g_assert_not_reached (); } diff --git a/gtk/gtktreeviewcolumn.c b/gtk/gtktreeviewcolumn.c index eea86e7d04..8e30dfe675 100644 --- a/gtk/gtktreeviewcolumn.c +++ b/gtk/gtktreeviewcolumn.c @@ -1053,7 +1053,7 @@ gtk_tree_view_column_button_event (GtkWidget *widget, if (priv->clickable == FALSE) { - switch (event_type) + switch ((guint) event_type) { case GDK_BUTTON_PRESS: case GDK_BUTTON_RELEASE: diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 3b425cb22a..51e39c3555 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -5777,6 +5777,9 @@ effective_align (GtkAlign align, return direction == GTK_TEXT_DIR_RTL ? GTK_ALIGN_END : GTK_ALIGN_START; case GTK_ALIGN_END: return direction == GTK_TEXT_DIR_RTL ? GTK_ALIGN_START : GTK_ALIGN_END; + case GTK_ALIGN_FILL: + case GTK_ALIGN_CENTER: + case GTK_ALIGN_BASELINE: default: return align; } @@ -5792,6 +5795,7 @@ adjust_for_align (GtkAlign align, { case GTK_ALIGN_BASELINE: case GTK_ALIGN_FILL: + default: /* change nothing */ break; case GTK_ALIGN_START: @@ -6695,7 +6699,7 @@ event_window_is_still_viewable (const GdkEvent *event) * at the last moment, since the event may have been queued * up behind other events, held over a recursive main loop, etc. */ - switch (event->type) + switch ((guint) event->type) { case GDK_EXPOSE: case GDK_MOTION_NOTIFY: @@ -6762,7 +6766,7 @@ gtk_widget_event_internal (GtkWidget *widget, return TRUE; /* Non input events get handled right away */ - switch (event->type) + switch ((guint) event->type) { case GDK_VISIBILITY_NOTIFY: case GDK_EXPOSE: @@ -6820,6 +6824,17 @@ gtk_widget_emit_event_signals (GtkWidget *widget, switch (event->type) { + case GDK_DRAG_ENTER: + case GDK_DRAG_LEAVE: + case GDK_DRAG_MOTION: + case GDK_DRAG_STATUS: + case GDK_DROP_START: + case GDK_DROP_FINISHED: + case GDK_CLIENT_EVENT: + case GDK_SETTING: + case GDK_OWNER_CHANGE: + case GDK_DAMAGE: + case GDK_EVENT_LAST: case GDK_TOUCHPAD_SWIPE: case GDK_TOUCHPAD_PINCH: case GDK_PAD_BUTTON_PRESS: @@ -7267,6 +7282,7 @@ gtk_widget_real_keynav_failed (GtkWidget *widget, case GTK_DIR_DOWN: case GTK_DIR_LEFT: case GTK_DIR_RIGHT: + default: break; } diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index 4d95aa257e..91b637a401 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -1411,6 +1411,8 @@ gtk_window_titlebar_action (GtkWindow *window, case GDK_BUTTON_SECONDARY: g_object_get (settings, "gtk-titlebar-right-click", &action, NULL); break; + default: + break; } if (action == NULL) @@ -1531,6 +1533,14 @@ multipress_gesture_pressed_cb (GtkGestureMultiPress *gesture, gtk_gesture_set_sequence_state (GTK_GESTURE (gesture), sequence, GTK_EVENT_SEQUENCE_CLAIMED); break; + case GTK_WINDOW_REGION_EDGE_NW: + case GTK_WINDOW_REGION_EDGE_N: + case GTK_WINDOW_REGION_EDGE_NE: + case GTK_WINDOW_REGION_EDGE_W: + case GTK_WINDOW_REGION_EDGE_E: + case GTK_WINDOW_REGION_EDGE_SW: + case GTK_WINDOW_REGION_EDGE_S: + case GTK_WINDOW_REGION_EDGE_SE: default: if (!priv->maximized) { @@ -1585,6 +1595,15 @@ drag_gesture_begin_cb (GtkGestureDrag *gesture, gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_DENIED); break; + + case GTK_WINDOW_REGION_EDGE_NW: + case GTK_WINDOW_REGION_EDGE_N: + case GTK_WINDOW_REGION_EDGE_NE: + case GTK_WINDOW_REGION_EDGE_W: + case GTK_WINDOW_REGION_EDGE_E: + case GTK_WINDOW_REGION_EDGE_SW: + case GTK_WINDOW_REGION_EDGE_S: + case GTK_WINDOW_REGION_EDGE_SE: default: gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_DENIED); } @@ -8502,6 +8521,7 @@ gtk_window_compute_configure_request (GtkWindow *window, } break; + case GTK_WIN_POS_NONE: default: break; } diff --git a/gtk/inspector/recorder.c b/gtk/inspector/recorder.c index 78b0d73763..7f2ed0aeea 100644 --- a/gtk/inspector/recorder.c +++ b/gtk/inspector/recorder.c @@ -502,7 +502,16 @@ populate_render_node_properties (GtkListStore *store, } break; - default: ; + case GSK_NOT_A_RENDER_NODE: + case GSK_CONTAINER_NODE: + case GSK_TRANSFORM_NODE: + case GSK_COLOR_MATRIX_NODE: + case GSK_REPEAT_NODE: + case GSK_CLIP_NODE: + case GSK_ROUNDED_CLIP_NODE: + case GSK_SHADOW_NODE: + default: + break; } } |