diff options
| author | Ellie Hermaszewska <ellieh@nvidia.com> | 2024-11-06 01:47:26 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-05 09:47:26 -0800 |
| commit | b118451e301d734e3e783b3acdf871f3f6ea851c (patch) | |
| tree | 277f160d31e2c442f724bc6a2d3c09fabff403ca /tools/platform | |
| parent | 53dd5928c35d5a5cb1f7d2a563348fd1fa87d672 (diff) | |
Move switch statement bodies to their own lines (#5493)
* Move switch statement bodies to their own lines
* format
---------
Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'tools/platform')
| -rw-r--r-- | tools/platform/linux/x11-key-code.cpp | 105 | ||||
| -rw-r--r-- | tools/platform/linux/x11-window.cpp | 19 | ||||
| -rw-r--r-- | tools/platform/model.cpp | 3 | ||||
| -rw-r--r-- | tools/platform/windows/win-window.cpp | 3 |
4 files changed, 88 insertions, 42 deletions
diff --git a/tools/platform/linux/x11-key-code.cpp b/tools/platform/linux/x11-key-code.cpp index 0faafae78..fd9b470a6 100644 --- a/tools/platform/linux/x11-key-code.cpp +++ b/tools/platform/linux/x11-key-code.cpp @@ -155,17 +155,28 @@ int getKeyChar(KeyCode keyCode, int keyState) { switch (keyCode) { - case KeyCode::Key0: return ')'; - case KeyCode::Key1: return '!'; - case KeyCode::Key2: return '@'; - case KeyCode::Key3: return '#'; - case KeyCode::Key4: return '$'; - case KeyCode::Key5: return '%'; - case KeyCode::Key6: return '^'; - case KeyCode::Key7: return '&'; - case KeyCode::Key8: return '*'; - case KeyCode::Key9: return '('; - default: return 0; + case KeyCode::Key0: + return ')'; + case KeyCode::Key1: + return '!'; + case KeyCode::Key2: + return '@'; + case KeyCode::Key3: + return '#'; + case KeyCode::Key4: + return '$'; + case KeyCode::Key5: + return '%'; + case KeyCode::Key6: + return '^'; + case KeyCode::Key7: + return '&'; + case KeyCode::Key8: + return '*'; + case KeyCode::Key9: + return '('; + default: + return 0; } } } @@ -173,36 +184,60 @@ int getKeyChar(KeyCode keyCode, int keyState) { switch (keyCode) { - case KeyCode::Semicolon: return ':'; - case KeyCode::Comma: return '<'; - case KeyCode::Dot: return '>'; - case KeyCode::Slash: return '?'; - case KeyCode::Quote: return '\"'; - case KeyCode::LBracket: return '{'; - case KeyCode::RBracket: return '}'; - case KeyCode::Backslash: return '|'; - case KeyCode::Minus: return '_'; - case KeyCode::Plus: return '+'; - case KeyCode::Tilde: return '~'; - default: return 0; + case KeyCode::Semicolon: + return ':'; + case KeyCode::Comma: + return '<'; + case KeyCode::Dot: + return '>'; + case KeyCode::Slash: + return '?'; + case KeyCode::Quote: + return '\"'; + case KeyCode::LBracket: + return '{'; + case KeyCode::RBracket: + return '}'; + case KeyCode::Backslash: + return '|'; + case KeyCode::Minus: + return '_'; + case KeyCode::Plus: + return '+'; + case KeyCode::Tilde: + return '~'; + default: + return 0; } } else { switch (keyCode) { - case KeyCode::Semicolon: return ';'; - case KeyCode::Comma: return ','; - case KeyCode::Dot: return '.'; - case KeyCode::Slash: return '/'; - case KeyCode::Quote: return '\''; - case KeyCode::LBracket: return '['; - case KeyCode::RBracket: return ']'; - case KeyCode::Backslash: return '\\'; - case KeyCode::Minus: return '-'; - case KeyCode::Plus: return '='; - case KeyCode::Tilde: return '`'; - default: return 0; + case KeyCode::Semicolon: + return ';'; + case KeyCode::Comma: + return ','; + case KeyCode::Dot: + return '.'; + case KeyCode::Slash: + return '/'; + case KeyCode::Quote: + return '\''; + case KeyCode::LBracket: + return '['; + case KeyCode::RBracket: + return ']'; + case KeyCode::Backslash: + return '\\'; + case KeyCode::Minus: + return '-'; + case KeyCode::Plus: + return '='; + case KeyCode::Tilde: + return '`'; + default: + return 0; } } } diff --git a/tools/platform/linux/x11-window.cpp b/tools/platform/linux/x11-window.cpp index 155801049..49fd4d859 100644 --- a/tools/platform/linux/x11-window.cpp +++ b/tools/platform/linux/x11-window.cpp @@ -355,11 +355,20 @@ public: switch (eventType) { - case MouseEvent::Down: events.mouseDown(e); break; - case MouseEvent::Up: events.mouseUp(e); break; - case MouseEvent::Move: events.mouseMove(e); break; - case MouseEvent::Scroll: events.mouseWheel(e); break; - default: break; + case MouseEvent::Down: + events.mouseDown(e); + break; + case MouseEvent::Up: + events.mouseUp(e); + break; + case MouseEvent::Move: + events.mouseMove(e); + break; + case MouseEvent::Scroll: + events.mouseWheel(e); + break; + default: + break; } } diff --git a/tools/platform/model.cpp b/tools/platform/model.cpp index 3649db9dc..8531f7844 100644 --- a/tools/platform/model.cpp +++ b/tools/platform/model.cpp @@ -117,7 +117,8 @@ ComPtr<ITextureResource> loadTextureImage(IDevice* device, char const* path) Format format; switch (channelCount) { - default: return nullptr; + default: + return nullptr; case 4: format = Format::R8G8B8A8_UNORM; diff --git a/tools/platform/windows/win-window.cpp b/tools/platform/windows/win-window.cpp index 9c4b79b39..7ef26e161 100644 --- a/tools/platform/windows/win-window.cpp +++ b/tools/platform/windows/win-window.cpp @@ -184,7 +184,8 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) return DefWindowProc(hWnd, message, wParam, lParam); } break; - default: break; + default: + break; } if (message == WM_DESTROY && hWnd == Win32AppContext::mainWindowHandle) { |
