From 3be4aa115bfc7a009a49a57a09c4b7dd509ebfcd Mon Sep 17 00:00:00 2001 From: David Capello Date: Fri, 1 Mar 2024 21:10:41 -0300 Subject: [PATCH] Fix warnings about non-specified cases of enums --- examples/custom_window.cpp | 5 +++++ examples/floating_window.cpp | 3 +++ examples/multiple_windows.cpp | 3 +++ os/osx/view.mm | 2 ++ os/osx/window.mm | 2 ++ os/x11/keys.cpp | 4 ++-- 6 files changed, 17 insertions(+), 2 deletions(-) diff --git a/examples/custom_window.cpp b/examples/custom_window.cpp index 7e8e9875f..0d24bcf16 100644 --- a/examples/custom_window.cpp +++ b/examples/custom_window.cpp @@ -95,6 +95,8 @@ void draw_button(os::Surface* surface, int x, Hit button, const Hit hit) surface->drawPath(path, p); break; } + default: + break; } } @@ -223,6 +225,7 @@ bool handle_mouse_down(os::Window* window, case Hit::MinimizeButton: window->minimize(); return true; case Hit::MaximizeButton: window->maximize(); return true; case Hit::CloseButton: return false; + default: break; } window->performWindowAction(action, &ev); return true; @@ -269,6 +272,8 @@ int app_main(int argc, char* argv[]) case os::kKeyF11: window->setFullscreen(!window->isFullscreen()); break; + default: + break; } break; diff --git a/examples/floating_window.cpp b/examples/floating_window.cpp index d812b0319..5aed1d014 100644 --- a/examples/floating_window.cpp +++ b/examples/floating_window.cpp @@ -77,6 +77,9 @@ class CustomWindow { ev.scancode() == os::kKeyEnterPad) onEnterKey(); break; + + default: + break; } return true; } diff --git a/examples/multiple_windows.cpp b/examples/multiple_windows.cpp index f1f8b1f94..b56f6034a 100644 --- a/examples/multiple_windows.cpp +++ b/examples/multiple_windows.cpp @@ -223,6 +223,7 @@ int app_main(int argc, char* argv[]) case os::kKeyUp: rc.y -= rc.h; break; case os::kKeyRight: rc.x += rc.w; break; case os::kKeyDown: rc.y += rc.h; break; + default: break; } ev.window()->setFrame(rc); @@ -233,6 +234,8 @@ int app_main(int argc, char* argv[]) break; } + default: + break; } break; diff --git a/os/osx/view.mm b/os/osx/view.mm index 9e664e1d6..8856112f8 100644 --- a/os/osx/view.mm +++ b/os/osx/view.mm @@ -69,6 +69,8 @@ case NSEventTypeRightMouseUp: case NSEventTypeRightMouseDragged: return Event::RightButton; + default: + break; } switch (event.buttonNumber) { diff --git a/os/osx/window.mm b/os/osx/window.mm index fdf1197a5..f93693443 100644 --- a/os/osx/window.mm +++ b/os/osx/window.mm @@ -261,6 +261,8 @@ - (BOOL)setNativeCursor:(os::NativeCursor)cursor case os::NativeCursor::SizeW: nsCursor = [NSCursor resizeLeftCursor]; break; + default: + break; } [self.contentView setCursor:nsCursor]; diff --git a/os/x11/keys.cpp b/os/x11/keys.cpp index a365d5a74..86fcb6efa 100644 --- a/os/x11/keys.cpp +++ b/os/x11/keys.cpp @@ -274,8 +274,8 @@ KeySym x11_keysym_to_scancode(const KeyScancode scancode) case kKeyX: return XK_x; case kKeyY: return XK_y; case kKeyZ: return XK_z; + default: return 0; } - return 0; } bool x11_is_key_pressed(const KeyScancode scancode) @@ -357,8 +357,8 @@ int x11_get_unicode_from_scancode(const KeyScancode scancode) case kKeyX: return 'x'; case kKeyY: return 'y'; case kKeyZ: return 'z'; + default: return 0; } - return 0; } KeyModifiers get_modifiers_from_x(const int state)