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 /gdk | |
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 'gdk')
-rw-r--r-- | gdk/broadway/gdkwindow-broadway.c | 5 | ||||
-rw-r--r-- | gdk/gdkdevice.c | 4 | ||||
-rw-r--r-- | gdk/gdkdnd.c | 2 | ||||
-rw-r--r-- | gdk/gdkevents.c | 56 | ||||
-rw-r--r-- | gdk/gdkframeclockidle.c | 1 | ||||
-rw-r--r-- | gdk/gdkgl.c | 3 | ||||
-rw-r--r-- | gdk/gdkkeys.c | 3 | ||||
-rw-r--r-- | gdk/gdkseatdefault.c | 7 | ||||
-rw-r--r-- | gdk/gdkvulkancontext.c | 6 | ||||
-rw-r--r-- | gdk/gdkwindow.c | 6 | ||||
-rw-r--r-- | gdk/wayland/gdkdevice-wayland.c | 7 | ||||
-rw-r--r-- | gdk/wayland/gdkdnd-wayland.c | 2 | ||||
-rw-r--r-- | gdk/wayland/gdkkeys-wayland.c | 5 | ||||
-rw-r--r-- | gdk/wayland/gdkscreen-wayland.c | 6 | ||||
-rw-r--r-- | gdk/wayland/gdkwindow-wayland.c | 8 | ||||
-rw-r--r-- | gdk/x11/gdkasync.c | 2 | ||||
-rw-r--r-- | gdk/x11/gdkdevice-xi2.c | 2 | ||||
-rw-r--r-- | gdk/x11/gdkdevicemanager-xi2.c | 2 | ||||
-rw-r--r-- | gdk/x11/gdkdisplay-x11.c | 7 | ||||
-rw-r--r-- | gdk/x11/gdkdnd-x11.c | 28 | ||||
-rw-r--r-- | gdk/x11/gdkkeys-x11.c | 17 | ||||
-rw-r--r-- | gdk/x11/gdkmain-x11.c | 7 | ||||
-rw-r--r-- | gdk/x11/gdkvisual-x11.c | 3 | ||||
-rw-r--r-- | gdk/x11/gdkwindow-x11.c | 12 |
24 files changed, 136 insertions, 65 deletions
diff --git a/gdk/broadway/gdkwindow-broadway.c b/gdk/broadway/gdkwindow-broadway.c index 17075bb86b..44bc9ec15a 100644 --- a/gdk/broadway/gdkwindow-broadway.c +++ b/gdk/broadway/gdkwindow-broadway.c @@ -1101,6 +1101,8 @@ update_pos (MoveResizeData *mv_resize, x += dx; w -= dx; break; + default: + break; } x = MAX (x, 0); @@ -1228,6 +1230,8 @@ _gdk_broadway_moveresize_handle_event (GdkDisplay *display, if (event->button.button == mv_resize->moveresize_button) finish_drag (mv_resize); break; + default: + break; } return TRUE; } @@ -1349,6 +1353,7 @@ calculate_unmoving_origin (MoveResizeData *mv_resize) mv_resize->moveresize_orig_x = rect.x + rect.width - width; mv_resize->moveresize_orig_y = rect.y + rect.height - height; break; + case GDK_GRAVITY_STATIC: default: mv_resize->moveresize_orig_x = rect.x; mv_resize->moveresize_orig_y = rect.y; diff --git a/gdk/gdkdevice.c b/gdk/gdkdevice.c index fd918f374b..d44df42847 100644 --- a/gdk/gdkdevice.c +++ b/gdk/gdkdevice.c @@ -1051,7 +1051,7 @@ gdk_device_set_axis_use (GdkDevice *device, info = &g_array_index (device->axes, GdkAxisInfo, index_); info->use = use; - switch (use) + switch ((guint) use) { case GDK_AXIS_X: case GDK_AXIS_Y: @@ -1574,7 +1574,7 @@ _gdk_device_add_axis (GdkDevice *device, axis_info.max_value = max_value; axis_info.resolution = resolution; - switch (use) + switch ((guint) use) { case GDK_AXIS_X: case GDK_AXIS_Y: diff --git a/gdk/gdkdnd.c b/gdk/gdkdnd.c index b52311aa76..f6cddd5a65 100644 --- a/gdk/gdkdnd.c +++ b/gdk/gdkdnd.c @@ -789,7 +789,7 @@ gdk_drag_context_handle_dest_event (GdkEvent *event) GdkDragContext *context = NULL; GList *l; - switch (event->type) + switch ((guint) event->type) { case GDK_DRAG_MOTION: case GDK_DROP_START: diff --git a/gdk/gdkevents.c b/gdk/gdkevents.c index a2ffcf5cea..65bd8210ae 100644 --- a/gdk/gdkevents.c +++ b/gdk/gdkevents.c @@ -520,7 +520,7 @@ gdk_event_new (GdkEventType type) * since I trust bytewise 0 == 0. less than for integers * or pointers. */ - switch (type) + switch ((guint) type) { case GDK_MOTION_NOTIFY: new_event->motion.x = 0.; @@ -666,7 +666,7 @@ gdk_event_copy (const GdkEvent *event) g_set_object (&new_private->user_data, private->user_data); } - switch (event->any.type) + switch ((guint) event->any.type) { case GDK_KEY_PRESS: case GDK_KEY_RELEASE: @@ -769,7 +769,7 @@ gdk_event_free (GdkEvent *event) g_clear_object (&private->user_data); } - switch (event->any.type) + switch ((guint) event->any.type) { case GDK_KEY_PRESS: case GDK_KEY_RELEASE: @@ -940,6 +940,7 @@ gdk_event_get_time (const GdkEvent *event) case GDK_OWNER_CHANGE: case GDK_GRAB_BROKEN: case GDK_EVENT_LAST: + default: /* return current time */ break; } @@ -1031,6 +1032,7 @@ gdk_event_get_state (const GdkEvent *event, case GDK_PAD_STRIP: case GDK_PAD_GROUP_MODE: case GDK_EVENT_LAST: + default: /* no state field */ break; } @@ -1059,7 +1061,7 @@ gdk_event_get_coords (const GdkEvent *event, g_return_val_if_fail (event != NULL, FALSE); - switch (event->type) + switch ((guint) event->type) { case GDK_CONFIGURE: x = event->configure.x; @@ -1131,7 +1133,7 @@ gdk_event_get_root_coords (const GdkEvent *event, g_return_val_if_fail (event != NULL, FALSE); - switch (event->type) + switch ((guint) event->type) { case GDK_MOTION_NOTIFY: x = event->motion.x_root; @@ -1195,7 +1197,7 @@ gdk_event_set_coords (GdkEvent *event, { g_return_if_fail (event != NULL); - switch (event->type) + switch ((guint) event->type) { case GDK_CONFIGURE: event->configure.x = x; @@ -1259,7 +1261,7 @@ gdk_event_get_button (const GdkEvent *event, g_return_val_if_fail (event != NULL, FALSE); - switch (event->type) + switch ((guint) event->type) { case GDK_BUTTON_PRESS: case GDK_BUTTON_RELEASE: @@ -1300,7 +1302,7 @@ gdk_event_get_click_count (const GdkEvent *event, g_return_val_if_fail (event != NULL, FALSE); - switch (event->type) + switch ((guint) event->type) { case GDK_BUTTON_PRESS: case GDK_BUTTON_RELEASE: @@ -1335,7 +1337,7 @@ gdk_event_get_keyval (const GdkEvent *event, gboolean fetched = TRUE; guint number = 0; - switch (event->type) + switch ((guint) event->type) { case GDK_KEY_PRESS: case GDK_KEY_RELEASE: @@ -1381,7 +1383,7 @@ gdk_event_get_keycode (const GdkEvent *event, gboolean fetched = TRUE; guint16 number = 0; - switch (event->type) + switch ((guint) event->type) { case GDK_KEY_PRESS: case GDK_KEY_RELEASE: @@ -1411,7 +1413,7 @@ gdk_event_get_key_group (const GdkEvent *event, { gboolean fetched = TRUE; - switch (event->type) + switch ((guint) event->type) { case GDK_KEY_PRESS: case GDK_KEY_RELEASE: @@ -1439,7 +1441,7 @@ gdk_event_get_string (const GdkEvent *event, { gboolean fetched = TRUE; - switch (event->type) + switch ((guint) event->type) { case GDK_KEY_PRESS: case GDK_KEY_RELEASE: @@ -1467,7 +1469,7 @@ gdk_event_get_key_is_modifier (const GdkEvent *event, { gboolean fetched = TRUE; - switch (event->type) + switch ((guint) event->type) { case GDK_KEY_PRESS: case GDK_KEY_RELEASE: @@ -1500,7 +1502,7 @@ gdk_event_get_scroll_direction (const GdkEvent *event, gboolean fetched = TRUE; GdkScrollDirection dir = 0; - switch (event->type) + switch ((guint) event->type) { case GDK_SCROLL: if (event->scroll.direction == GDK_SCROLL_SMOOTH) @@ -1540,7 +1542,7 @@ gdk_event_get_scroll_deltas (const GdkEvent *event, gdouble dx = 0.0; gdouble dy = 0.0; - switch (event->type) + switch ((guint) event->type) { case GDK_SCROLL: if (event->scroll.direction == GDK_SCROLL_SMOOTH) @@ -1612,7 +1614,7 @@ gdk_event_get_axis (const GdkEvent *event, { gdouble x, y; - switch (event->type) + switch ((guint) event->type) { case GDK_MOTION_NOTIFY: x = event->motion.x; @@ -1699,7 +1701,7 @@ gdk_event_set_device (GdkEvent *event, g_set_object (&private->device, device); - switch (event->type) + switch ((guint) event->type) { case GDK_MOTION_NOTIFY: event->motion.device = device; @@ -1750,7 +1752,7 @@ gdk_event_get_device (const GdkEvent *event) return private->device; } - switch (event->type) + switch ((guint) event->type) { case GDK_MOTION_NOTIFY: return event->motion.device; @@ -1767,32 +1769,15 @@ gdk_event_get_device (const GdkEvent *event) case GDK_PROXIMITY_IN: case GDK_PROXIMITY_OUT: return event->proximity.device; - default: - break; - } - - /* Fallback if event has no device set */ - switch (event->type) - { - case GDK_MOTION_NOTIFY: - case GDK_BUTTON_PRESS: - case GDK_BUTTON_RELEASE: - case GDK_TOUCH_BEGIN: - case GDK_TOUCH_UPDATE: - case GDK_TOUCH_END: - case GDK_TOUCH_CANCEL: case GDK_ENTER_NOTIFY: case GDK_LEAVE_NOTIFY: case GDK_FOCUS_CHANGE: - case GDK_PROXIMITY_IN: - case GDK_PROXIMITY_OUT: 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_SCROLL: case GDK_GRAB_BROKEN: case GDK_KEY_PRESS: case GDK_KEY_RELEASE: @@ -2255,6 +2240,7 @@ _gdk_set_window_state (GdkWindow *window, case GDK_WINDOW_FOREIGN: case GDK_WINDOW_ROOT: case GDK_WINDOW_CHILD: + default: break; } } diff --git a/gdk/gdkframeclockidle.c b/gdk/gdkframeclockidle.c index 12897f4236..0af296c40f 100644 --- a/gdk/gdkframeclockidle.c +++ b/gdk/gdkframeclockidle.c @@ -447,6 +447,7 @@ gdk_frame_clock_paint_idle (void *data) } /* fallthrough */ case GDK_FRAME_CLOCK_PHASE_RESUME_EVENTS: + default: ; } } diff --git a/gdk/gdkgl.c b/gdk/gdkgl.c index 3a175b638c..b831428920 100644 --- a/gdk/gdkgl.c +++ b/gdk/gdkgl.c @@ -47,8 +47,9 @@ get_vertex_type_name (int type) return "geometry"; case GL_FRAGMENT_SHADER: return "fragment"; + default: + return "unknown"; } - return "unknown"; } static guint diff --git a/gdk/gdkkeys.c b/gdk/gdkkeys.c index 467e063ad5..cc1c914a8f 100644 --- a/gdk/gdkkeys.c +++ b/gdk/gdkkeys.c @@ -859,6 +859,9 @@ gdk_keyval_convert_case (guint symbol, symbol != GDK_KEY_Greek_finalsmallsigma) xupper -= (GDK_KEY_Greek_alpha - GDK_KEY_Greek_ALPHA); break; + + default: + break; } if (lower) diff --git a/gdk/gdkseatdefault.c b/gdk/gdkseatdefault.c index 91a42cd4af..cd6dc8a5e9 100644 --- a/gdk/gdkseatdefault.c +++ b/gdk/gdkseatdefault.c @@ -194,7 +194,7 @@ gdk_seat_default_get_master (GdkSeat *seat, priv = gdk_seat_default_get_instance_private (GDK_SEAT_DEFAULT (seat)); /* There must be only one flag set */ - switch (capability) + switch ((guint) capability) { case GDK_SEAT_CAPABILITY_POINTER: case GDK_SEAT_CAPABILITY_TOUCH: @@ -224,6 +224,11 @@ device_get_capability (GdkDevice *device) return GDK_SEAT_CAPABILITY_TOUCH; case GDK_SOURCE_MOUSE: case GDK_SOURCE_TOUCHPAD: + case GDK_SOURCE_PEN: + case GDK_SOURCE_ERASER: + case GDK_SOURCE_CURSOR: + case GDK_SOURCE_TRACKPOINT: + case GDK_SOURCE_TABLET_PAD: default: return GDK_SEAT_CAPABILITY_POINTER; } diff --git a/gdk/gdkvulkancontext.c b/gdk/gdkvulkancontext.c index 79e067dbb8..52cd263b89 100644 --- a/gdk/gdkvulkancontext.c +++ b/gdk/gdkvulkancontext.c @@ -118,6 +118,12 @@ gdk_vulkan_strerror (VkResult result) return "A surface has changed in such a way that it is no longer compatible with the swapchain."; case VK_ERROR_INCOMPATIBLE_DISPLAY_KHR: return "The display used by a swapchain does not use the same presentable image layout, or is incompatible in a way that prevents sharing an image."; + case VK_ERROR_VALIDATION_FAILED_EXT: + return "The application caused the validation layer to fail."; + case VK_ERROR_INVALID_SHADER_NV: + return "One or more shaders failed to compile or link."; + case VK_RESULT_RANGE_SIZE: + case VK_RESULT_MAX_ENUM: default: return "Unknown Vulkan error."; } diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c index 045f26d5ed..6aad9e8625 100644 --- a/gdk/gdkwindow.c +++ b/gdk/gdkwindow.c @@ -1384,6 +1384,10 @@ _gdk_window_destroy_hierarchy (GdkWindow *window, switch (window->window_type) { + default: + g_assert_not_reached (); + break; + case GDK_WINDOW_ROOT: if (!screen->closed) { @@ -5626,7 +5630,7 @@ _gdk_make_event (GdkWindow *window, if (event_in_queue && event_in_queue->any.send_event) event->any.send_event = TRUE; - switch (type) + switch ((guint) type) { case GDK_MOTION_NOTIFY: event->motion.time = the_time; diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c index 61a4d50f06..31f2f08691 100644 --- a/gdk/wayland/gdkdevice-wayland.c +++ b/gdk/wayland/gdkdevice-wayland.c @@ -1753,6 +1753,8 @@ get_axis_source_name (enum wl_pointer_axis_source source) return "finger"; case WL_POINTER_AXIS_SOURCE_CONTINUOUS: return "continuous"; + case WL_POINTER_AXIS_SOURCE_WHEEL_TILT: + return "wheel-tilt"; default: return "unknown"; } @@ -3288,6 +3290,7 @@ get_scroll_device (GdkWaylandSeat *seat, } return seat->continuous_scrolling; + case WL_POINTER_AXIS_SOURCE_WHEEL_TILT: default: return seat->pointer; } @@ -3390,6 +3393,8 @@ tablet_tool_handle_capability (void *data, case ZWP_TABLET_TOOL_V2_CAPABILITY_SLIDER: tool->axes |= GDK_AXIS_FLAG_SLIDER; break; + default: + break; } } @@ -3426,7 +3431,7 @@ gdk_wayland_tablet_flush_frame_event (GdkWaylandTabletData *tablet, if (!event) return; - switch (event->type) + switch ((guint) event->type) { case GDK_MOTION_NOTIFY: event->motion.time = time; diff --git a/gdk/wayland/gdkdnd-wayland.c b/gdk/wayland/gdkdnd-wayland.c index 184c6a0b69..23fd8baee3 100644 --- a/gdk/wayland/gdkdnd-wayland.c +++ b/gdk/wayland/gdkdnd-wayland.c @@ -107,7 +107,7 @@ _gdk_wayland_drag_context_emit_event (GdkDragContext *context, GdkWindow *window; GdkEvent *event; - switch (type) + switch ((guint) type) { case GDK_DRAG_ENTER: case GDK_DRAG_LEAVE: diff --git a/gdk/wayland/gdkkeys-wayland.c b/gdk/wayland/gdkkeys-wayland.c index 9c80d805af..c8a4d7e0ae 100644 --- a/gdk/wayland/gdkkeys-wayland.c +++ b/gdk/wayland/gdkkeys-wayland.c @@ -508,6 +508,11 @@ update_direction (GdkWaylandKeymap *keymap) case PANGO_DIRECTION_LTR: rtl[layout]--; break; + case PANGO_DIRECTION_TTB_LTR: + case PANGO_DIRECTION_TTB_RTL: + case PANGO_DIRECTION_WEAK_LTR: + case PANGO_DIRECTION_WEAK_RTL: + case PANGO_DIRECTION_NEUTRAL: default: break; } diff --git a/gdk/wayland/gdkscreen-wayland.c b/gdk/wayland/gdkscreen-wayland.c index f9cfc33a20..af2e2e28ab 100644 --- a/gdk/wayland/gdkscreen-wayland.c +++ b/gdk/wayland/gdkscreen-wayland.c @@ -191,11 +191,8 @@ update_xft_settings (GdkScreen *screen) order = GSD_FONT_RGBA_ORDER_RGB; } - xft_settings.antialias = (antialiasing != GSD_FONT_ANTIALIASING_MODE_NONE); xft_settings.hinting = (hinting != GSD_FONT_HINTING_NONE); xft_settings.dpi = get_dpi_from_gsettings (screen_wayland) * 1024; /* Xft wants 1/1024ths of an inch */ - xft_settings.rgba = "rgb"; - xft_settings.hintstyle = "hintfull"; switch (hinting) { @@ -209,6 +206,7 @@ update_xft_settings (GdkScreen *screen) xft_settings.hintstyle = "hintmedium"; break; case GSD_FONT_HINTING_FULL: + default: xft_settings.hintstyle = "hintfull"; break; } @@ -218,6 +216,7 @@ update_xft_settings (GdkScreen *screen) case GSD_FONT_RGBA_ORDER_RGBA: xft_settings.rgba = "rgba"; break; + default: case GSD_FONT_RGBA_ORDER_RGB: xft_settings.rgba = "rgb"; break; @@ -234,6 +233,7 @@ update_xft_settings (GdkScreen *screen) switch (antialiasing) { + default: case GSD_FONT_ANTIALIASING_MODE_NONE: xft_settings.antialias = FALSE; break; diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c index f6d3a38a6f..1697dcda52 100644 --- a/gdk/wayland/gdkwindow-wayland.c +++ b/gdk/wayland/gdkwindow-wayland.c @@ -1738,6 +1738,7 @@ calculate_popup_rect (GdkWindow *window, switch (rect_anchor) { + default: case GDK_GRAVITY_STATIC: case GDK_GRAVITY_NORTH_WEST: x = anchor_rect.x; @@ -1779,6 +1780,7 @@ calculate_popup_rect (GdkWindow *window, switch (window_anchor) { + default: case GDK_GRAVITY_STATIC: case GDK_GRAVITY_NORTH_WEST: break; @@ -1825,6 +1827,7 @@ flip_anchor_horizontally (GdkGravity anchor) { switch (anchor) { + default: case GDK_GRAVITY_STATIC: case GDK_GRAVITY_NORTH_WEST: return GDK_GRAVITY_NORTH_EAST; @@ -1854,6 +1857,7 @@ flip_anchor_vertically (GdkGravity anchor) { switch (anchor) { + default: case GDK_GRAVITY_STATIC: case GDK_GRAVITY_NORTH_WEST: return GDK_GRAVITY_SOUTH_WEST; @@ -2211,7 +2215,7 @@ should_map_as_popup (GdkWindow *window) } /* Yet we need to keep the window type hint tests for compatibility */ - switch (impl->hint) + switch ((guint) impl->hint) { case GDK_WINDOW_TYPE_HINT_POPUP_MENU: case GDK_WINDOW_TYPE_HINT_DROPDOWN_MENU: @@ -3616,7 +3620,7 @@ gdk_wayland_window_show_window_menu (GdkWindow *window, double x, y; uint32_t serial; - switch (event->type) + switch ((guint) event->type) { case GDK_BUTTON_PRESS: case GDK_BUTTON_RELEASE: diff --git a/gdk/x11/gdkasync.c b/gdk/x11/gdkasync.c index 51a088fc6d..d9b84c4af2 100644 --- a/gdk/x11/gdkasync.c +++ b/gdk/x11/gdkasync.c @@ -526,6 +526,8 @@ get_child_info_handler (Display *dpy, handle_get_geometry_reply (dpy, state, repl); } break; + default: + break; } } diff --git a/gdk/x11/gdkdevice-xi2.c b/gdk/x11/gdkdevice-xi2.c index bdf28c4b0f..328d0007d1 100644 --- a/gdk/x11/gdkdevice-xi2.c +++ b/gdk/x11/gdkdevice-xi2.c @@ -233,7 +233,7 @@ gdk_x11_device_xi2_get_state (GdkDevice *device, value = ((XIValuatorClassInfo *) class_info)->value; use = gdk_device_get_axis_use (device, j); - switch (use) + switch ((guint) use) { case GDK_AXIS_X: case GDK_AXIS_Y: diff --git a/gdk/x11/gdkdevicemanager-xi2.c b/gdk/x11/gdkdevicemanager-xi2.c index 41d5faeafb..8779c65a72 100644 --- a/gdk/x11/gdkdevicemanager-xi2.c +++ b/gdk/x11/gdkdevicemanager-xi2.c @@ -1158,7 +1158,7 @@ translate_axes (GdkDevice *device, use = gdk_device_get_axis_use (device, i); val = *vals++; - switch (use) + switch ((guint) use) { case GDK_AXIS_X: case GDK_AXIS_Y: diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c index 0c42e7c4a5..74c0ecf5f0 100644 --- a/gdk/x11/gdkdisplay-x11.c +++ b/gdk/x11/gdkdisplay-x11.c @@ -784,6 +784,8 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator, g_message ("visibility notify:\twindow: %ld full", xevent->xvisibility.window); break; + default: + break; } #endif /* G_ENABLE_DEBUG */ @@ -806,6 +808,7 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator, event->visibility.state = GDK_VISIBILITY_PARTIAL; break; + default: case VisibilityUnobscured: event->visibility.state = GDK_VISIBILITY_UNOBSCURED; break; @@ -1217,6 +1220,8 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator, case XkbStateNotify: _gdk_x11_keymap_state_changed (display, xevent); break; + default: + break; } } else @@ -2363,6 +2368,8 @@ gdk_x11_display_broadcast_startup_message (GdkDisplay *display, case '\\': g_string_append_c (message, '\\'); break; + default: + break; } g_string_append_c (message, *p); diff --git a/gdk/x11/gdkdnd-x11.c b/gdk/x11/gdkdnd-x11.c index 03812d6b8d..11585dd930 100644 --- a/gdk/x11/gdkdnd-x11.c +++ b/gdk/x11/gdkdnd-x11.c @@ -1978,6 +1978,11 @@ gdk_drag_do_leave (GdkX11DragContext *context_x11, xdnd_send_leave (context_x11); break; case GDK_DRAG_PROTO_ROOTWIN: + case GDK_DRAG_PROTO_MOTIF: + case GDK_DRAG_PROTO_WIN32_DROPFILES: + case GDK_DRAG_PROTO_OLE2: + case GDK_DRAG_PROTO_LOCAL: + case GDK_DRAG_PROTO_WAYLAND: case GDK_DRAG_PROTO_NONE: default: break; @@ -2277,6 +2282,11 @@ gdk_x11_drag_context_drag_motion (GdkDragContext *context, break; case GDK_DRAG_PROTO_ROOTWIN: + case GDK_DRAG_PROTO_MOTIF: + case GDK_DRAG_PROTO_WIN32_DROPFILES: + case GDK_DRAG_PROTO_OLE2: + case GDK_DRAG_PROTO_LOCAL: + case GDK_DRAG_PROTO_WAYLAND: case GDK_DRAG_PROTO_NONE: default: break; @@ -2360,8 +2370,13 @@ gdk_x11_drag_context_drag_motion (GdkDragContext *context, gdk_event_free (temp_event); } break; + case GDK_DRAG_PROTO_MOTIF: + case GDK_DRAG_PROTO_WIN32_DROPFILES: + case GDK_DRAG_PROTO_OLE2: + case GDK_DRAG_PROTO_LOCAL: + case GDK_DRAG_PROTO_WAYLAND: case GDK_DRAG_PROTO_NONE: - g_warning ("GDK_DRAG_PROTO_NONE is not valid in gdk_drag_motion()"); + g_warning ("Invalid drag protocol %u in gdk_drag_motion()", context->protocol); break; default: break; @@ -2401,7 +2416,13 @@ gdk_x11_drag_context_drag_drop (GdkDragContext *context, case GDK_DRAG_PROTO_NONE: g_warning ("GDK_DRAG_PROTO_NONE is not valid in gdk_drag_drop()"); break; + case GDK_DRAG_PROTO_MOTIF: + case GDK_DRAG_PROTO_WIN32_DROPFILES: + case GDK_DRAG_PROTO_OLE2: + case GDK_DRAG_PROTO_LOCAL: + case GDK_DRAG_PROTO_WAYLAND: default: + g_warning ("Drag protocol %u is not valid in gdk_drag_drop()", context->protocol); break; } } @@ -3014,6 +3035,9 @@ gdk_dnd_handle_key_event (GdkDragContext *context, case GDK_KEY_KP_Right: dx = (state & GDK_MOD1_MASK) ? BIG_STEP : SMALL_STEP; break; + + default: + break; } } @@ -3130,7 +3154,7 @@ gdk_x11_drag_context_handle_event (GdkDragContext *context, if (!x11_context->grab_seat && event->type != GDK_DROP_FINISHED) return FALSE; - switch (event->type) + switch ((guint) event->type) { case GDK_MOTION_NOTIFY: return gdk_dnd_handle_motion_event (context, &event->motion); diff --git a/gdk/x11/gdkkeys-x11.c b/gdk/x11/gdkkeys-x11.c index a51e8e462b..1814a4c877 100644 --- a/gdk/x11/gdkkeys-x11.c +++ b/gdk/x11/gdkkeys-x11.c @@ -490,6 +490,11 @@ get_direction (XkbDescRec *xkb, case PANGO_DIRECTION_LTR: rtl_minus_ltr--; break; + case PANGO_DIRECTION_TTB_LTR: + case PANGO_DIRECTION_TTB_RTL: + case PANGO_DIRECTION_WEAK_LTR: + case PANGO_DIRECTION_WEAK_RTL: + case PANGO_DIRECTION_NEUTRAL: default: break; } @@ -1560,15 +1565,11 @@ gdk_x11_keymap_get_modifier_mask (GdkKeymap *keymap, { GdkX11Keymap *keymap_x11 = GDK_X11_KEYMAP (keymap); - switch (intent) - { - case GDK_MODIFIER_INTENT_SHIFT_GROUP: - return keymap_x11->group_switch_mask; + if (intent == GDK_MODIFIER_INTENT_SHIFT_GROUP) + return keymap_x11->group_switch_mask; - default: - return GDK_KEYMAP_CLASS (gdk_x11_keymap_parent_class)->get_modifier_mask (keymap, - intent); - } + return GDK_KEYMAP_CLASS (gdk_x11_keymap_parent_class)->get_modifier_mask (keymap, + intent); } static void diff --git a/gdk/x11/gdkmain-x11.c b/gdk/x11/gdkmain-x11.c index 7671f24448..19fd6fef35 100644 --- a/gdk/x11/gdkmain-x11.c +++ b/gdk/x11/gdkmain-x11.c @@ -130,11 +130,10 @@ _gdk_x11_convert_grab_status (gint status) return GDK_GRAB_NOT_VIEWABLE; case GrabFrozen: return GDK_GRAB_FROZEN; + default: + g_assert_not_reached(); + return 0; } - - g_assert_not_reached(); - - return 0; } /* diff --git a/gdk/x11/gdkvisual-x11.c b/gdk/x11/gdkvisual-x11.c index 0430db1ce5..56654e2226 100644 --- a/gdk/x11/gdkvisual-x11.c +++ b/gdk/x11/gdkvisual-x11.c @@ -124,6 +124,9 @@ _gdk_x11_screen_init_visuals (GdkScreen *screen, case DirectColor: visuals[nvisuals]->type = GDK_VISUAL_DIRECT_COLOR; break; + default: + g_warn_if_reached (); + break; } visuals[nvisuals]->depth = visual_list[i].depth; diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c index 3bcff7d4ec..3d3d305a7b 100644 --- a/gdk/x11/gdkwindow-x11.c +++ b/gdk/x11/gdkwindow-x11.c @@ -953,6 +953,7 @@ _gdk_x11_display_create_window_impl (GdkDisplay *display, break; case GDK_WINDOW_CHILD: + default: g_assert_not_reached (); break; } @@ -1519,6 +1520,7 @@ gdk_window_x11_hide (GdkWindow *window) case GDK_WINDOW_FOREIGN: case GDK_WINDOW_ROOT: case GDK_WINDOW_CHILD: + default: break; } @@ -4300,6 +4302,8 @@ update_pos (MoveResizeData *mv_resize, x += dx; w -= dx; break; + default: + break; } x = MAX (x, 0); @@ -4486,11 +4490,16 @@ _gdk_x11_moveresize_handle_event (XEvent *event) finish_drag (mv_resize); } break; + default: + break; } } break; #endif + default: + break; + } return TRUE; } @@ -4607,6 +4616,7 @@ calculate_unmoving_origin (MoveResizeData *mv_resize) mv_resize->moveresize_orig_x = rect.x + rect.width - width; mv_resize->moveresize_orig_y = rect.y + rect.height - height; break; + case GDK_GRAVITY_STATIC: default: mv_resize->moveresize_orig_x = rect.x; mv_resize->moveresize_orig_y = rect.y; @@ -4963,7 +4973,7 @@ gdk_x11_window_show_window_menu (GdkWindow *window, double x_root, y_root; XClientMessageEvent xclient = { 0 }; - switch (event->type) + switch ((guint) event->type) { case GDK_BUTTON_PRESS: case GDK_BUTTON_RELEASE: |