Skip to content

Commit 9eb0e83

Browse files
committed
Initial commit
0 parents  commit 9eb0e83

20 files changed

+2942
-0
lines changed

.clang-format

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Full manual is at https://clang.llvm.org/docs/ClangFormatStyleOptions.html
2+
---
3+
BasedOnStyle: Microsoft
4+
5+
IndentWidth: 4
6+
UseTab: Never
7+
8+
ColumnLimit: 200
9+
10+
SortIncludes: false
11+
12+
IndentCaseLabels: true
13+
AccessModifierOffset: -4
14+
15+
NamespaceIndentation: All
16+
17+
AllowAllArgumentsOnNextLine: false
18+
AllowAllParametersOfDeclarationOnNextLine: false
19+
20+
BreakConstructorInitializersBeforeComma: true
21+
BreakConstructorInitializers: BeforeColon
22+
23+
BinPackParameters: false
24+
BinPackArguments: true
25+
26+
# This applies to () [] <>
27+
AlignAfterOpenBracket: AlwaysBreak
28+
29+
BreakBeforeBraces: Allman
30+
BraceWrapping:
31+
AfterClass: true
32+
AfterControlStatement: true
33+
AfterEnum: true
34+
AfterFunction: true
35+
AfterNamespace: true
36+
AfterObjCDeclaration: false
37+
AfterStruct: true
38+
AfterUnion: true
39+
BeforeCatch: true
40+
BeforeElse: true
41+
IndentBraces: false
42+
BreakBeforeBinaryOperators: None
43+
44+
# Template declaration is on its own line
45+
BreakTemplateDeclarations: true
46+
47+
# IMHO, the pointer declarator belongs with the type specifier
48+
PointerAlignment: Left
49+
50+
SpaceAfterTemplateKeyword: false
51+
SpaceBeforeCpp11BracedList: false
52+
SpaceBeforeAssignmentOperators: true
53+
SpaceBeforeParens: ControlStatements
54+
SpaceBeforeRangeBasedForLoopColon: true
55+
SpaceInEmptyParentheses: false
56+
SpacesBeforeTrailingComments: 1
57+
SpacesInAngles: false
58+
SpacesInContainerLiterals: true
59+
SpacesInCStyleCastParentheses: false
60+
SpacesInParentheses: false
61+
SpacesInSquareBrackets: false

.editorconfig

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
##################################################################
2+
# For more info on EditorConfig check out https://EditorConfig.org
3+
##################################################################
4+
5+
root = true
6+
7+
# Code files
8+
[*.{c,cc,cpp,h,hh,hpp, cs}]
9+
trim_trailing_whitespace = true
10+
indent_style = space
11+
indent_size = 4
12+
charset = utf-8
13+
tab_width = 4
14+
15+
# C/C++ Standard requires an empty line at the end of header files
16+
[*.{h,hh,hpp}]
17+
insert_final_newline = true
18+
19+
[{CMakeLists.txt, *.cmake}]
20+
indent_style = space
21+
indent_size = 4
22+
23+
[*.yaml]
24+
indent_style = space
25+
indent_size = 2

.gitattributes

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Default behavior is always what git thinks is the correct line ending for the platform being used.
2+
* text=auto
3+
4+
# Always normalize code to native line endings on checkout.
5+
*.asm text
6+
*.inc text
7+
8+
*.c text
9+
*.cc text
10+
*.cpp text
11+
12+
*.h text
13+
*.hh text
14+
*.hpp text
15+
16+
*.cs text diff=csharp
17+
*.xaml text
18+
*.tt text
19+
*.ps1 text
20+
*.cmd text
21+
*.msbuild text
22+
*.md text
23+
24+
# Visual Studio generated files always have CRLF line endings on checkout.
25+
*.sln text eol=crlf
26+
*.csproj text eol=crlf
27+
*.vcxproj text eol=crlf
28+
*.filters text eol=crlf
29+
30+
# Files that we know for sure are binary and should not be modified.
31+
*.bin binary
32+
*.png binary
33+
*.jpg binary
34+
*.bmp binary
35+
*.tga binary
36+
*.ico binary
37+
*.cur binary
38+
*.sdf binary
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Windows MSVC build
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
branches: [ "master" ]
8+
9+
env:
10+
BUILD_TYPE: Release
11+
CMAKE_GENERATOR: "Visual Studio 17 2022"
12+
13+
jobs:
14+
build:
15+
runs-on: windows-latest
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Generate project files
21+
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_GENERATOR="${{env.CMAKE_GENERATOR}}" || exit 1
22+
23+
- name: Build
24+
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Generated by Visual Studio
2+
*.aps
3+
4+
# cmake build folder
5+
[Bb][Uu][Ii][Ll][Dd]/
6+
7+
# Python cache
8+
**/__pycache__/

CMakeLists.txt

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
####################################################################################################
2+
#
3+
# RawInputViewer - A utility to test, visualize, and map WM_INPUT messages.
4+
#
5+
# Copyright (c) 2025 by Bitdancer (@RealBitdancer)
6+
#
7+
# Licensed under the MIT License. See LICENSE file in the repository for details.
8+
#
9+
# Source: https://github.com/RealBitdancer/RawInputViewer
10+
#
11+
####################################################################################################
12+
13+
cmake_minimum_required(VERSION 3.20)
14+
15+
project(RawInputViewer LANGUAGES CXX)
16+
17+
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
18+
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "Limited configurations" FORCE)
19+
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT ${PROJECT_NAME})
20+
21+
add_executable(${PROJECT_NAME} WIN32)
22+
23+
target_sources(${PROJECT_NAME}
24+
PUBLIC
25+
"src/${PROJECT_NAME}.cpp"
26+
27+
# Header files are here as workaround to ensure folder
28+
# "Header Files" for VS2022 project files is generated.
29+
"src/${PROJECT_NAME}.hpp"
30+
"src/res/resource.h"
31+
32+
# Resource files are here as workaround to ensure
33+
# source_group "Resource Files" is generated.
34+
"src/res/${PROJECT_NAME}.rc"
35+
"src/res/${PROJECT_NAME}.ico"
36+
"src/res/${PROJECT_NAME}.manifest"
37+
"src/res/ScanCodeMapping.txt"
38+
"src/res/VirtualKeyMapping.txt"
39+
"src/res/ListView.bmp"
40+
"src/res/ToolBar.bmp"
41+
42+
# There seems to be no sensible workaround for having ${PROJECT_NAME}.manifest
43+
# show up in the Solution Explorer, which is annoying to say the least.
44+
)
45+
46+
source_group("Resource Files"
47+
FILES
48+
"src/res/${PROJECT_NAME}.rc"
49+
"src/res/${PROJECT_NAME}.ico"
50+
"src/res/ScanCodeMapping.txt"
51+
"src/res/VirtualKeyMapping.txt"
52+
"src/res/ListView.bmp"
53+
"src/res/ToolBar.bmp"
54+
)
55+
56+
set_source_files_properties("src/res/${PROJECT_NAME}.rc" PROPERTIES LANGUAGE RC)
57+
58+
set_property(TARGET ${PROJECT_NAME} PROPERTY VS_DPI_AWARE "PerMonitor")
59+
60+
target_compile_definitions(${PROJECT_NAME} PRIVATE UNICODE _UNICODE)
61+
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_23)
62+
target_compile_options(${PROJECT_NAME} PRIVATE /W3)
63+
target_compile_options(${PROJECT_NAME} PRIVATE $<$<CONFIG:Release>:/WX>)
64+
65+
target_include_directories(${PROJECT_NAME} PRIVATE src/res)
66+
target_link_libraries(${PROJECT_NAME} PRIVATE user32 comctl32 Version)

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Bitdancer
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# RawInputViewer
2+
3+
![](img/RawInputViewer.png)
4+
5+
A utility to test, visualize, and map WM_INPUT messages.
6+
7+
[![Build](https://github.com/RealBitdancer/RawInputViewer/actions/workflows/build_win_msvc.yaml/badge.svg)](https://github.com/RealBitdancer/RawInputViewer/actions/workflows/build_win_msvc.yaml)
8+
9+
# How to Build
10+
11+
This project is written using **Visual Studio 2022** with **C++23** enabled and utilizes new C++ features like concepts and ranges.
12+
13+
## What You Need
14+
- **Visual Studio 2022**: Ensure the `Desktop development with C++` workload is installed.
15+
16+
## Steps
17+
1. **Clone the code from GitHub**
18+
```cmd
19+
git clone https://github.com/RealBitdancer/RawInputViewer.git && cd RawInputViewer
20+
```
21+
2. **Create a build folder**
22+
```cmd
23+
mkdir build && cd build
24+
```
25+
3. **Run CMake**
26+
27+
Pick your flavor:
28+
29+
* **64 Bit:**
30+
```cmd
31+
cmake .. -G "Visual Studio 17 2022" -A x64
32+
```
33+
* **32 Bit:**
34+
```cmd
35+
cmake .. -G "Visual Studio 17 2022" -A Win32
36+
```
37+
4. **Open in Visual Studio**
38+
```cmd
39+
start RawInputViewer.sln
40+
```
41+
5. **Build and Run**
42+
43+
In Visual Studio, pick `Debug` or `Release`, then hit `F5` or `Ctrl+F5`.
44+
45+
# Background
46+
During my work on a personal graphics library (SML), I ran repeatedly into issues with WM_INPUT. To quickly test input on different systems, I put together a quick and dirty C++ Windows desktop app that was really only meant for myself. While reading up on the topic of WM_INPUT, I realized that this tool might be useful for other folks who struggle with the quirks of WM_INPUT, so I sat down and polished it a little to avoid completely embarrassing myself. So, here we are, enjoy `RawInputViewer`.
47+
48+
# Attribution
49+
50+
This project's icons and bitmaps have been sourced from and assembled with [Axialis IconWorshop](https://www.axialis.com/iconworkshop)

img/RawInputViewer.png

47.3 KB
Loading

0 commit comments

Comments
 (0)