diff options
| author | Drashna Jaelre <drashna@live.com> | 2025-05-04 17:21:47 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-05 10:21:47 +1000 |
| commit | 12caf0be4eab171ffeb041cc153f9addb68f404e (patch) | |
| tree | 0b89fa2aa4c5ce4a525d1385a10489844e413ee9 /lib/python | |
| parent | bb9dd05c6ae0a53ced5591c70a898feef037b31c (diff) | |
Add additional hooks for Community modules (#25050)
Diffstat (limited to 'lib/python')
| -rw-r--r-- | lib/python/qmk/cli/generate/community_modules.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/python/qmk/cli/generate/community_modules.py b/lib/python/qmk/cli/generate/community_modules.py index e12daccf1c..61e24077d3 100644 --- a/lib/python/qmk/cli/generate/community_modules.py +++ b/lib/python/qmk/cli/generate/community_modules.py | |||
| @@ -76,6 +76,8 @@ def _render_api_implementations(api, module): | |||
| 76 | lines.append(f'__attribute__((weak)) {api.ret_type} {api.name}_{module_name}_user({api.args}) {{') | 76 | lines.append(f'__attribute__((weak)) {api.ret_type} {api.name}_{module_name}_user({api.args}) {{') |
| 77 | if api.ret_type == 'bool': | 77 | if api.ret_type == 'bool': |
| 78 | lines.append(' return true;') | 78 | lines.append(' return true;') |
| 79 | elif api.ret_type in ['layer_state_t', 'report_mouse_t']: | ||
| 80 | lines.append(f' return {api.call_params};') | ||
| 79 | else: | 81 | else: |
| 80 | pass | 82 | pass |
| 81 | lines.append('}') | 83 | lines.append('}') |
| @@ -86,6 +88,8 @@ def _render_api_implementations(api, module): | |||
| 86 | if api.ret_type == 'bool': | 88 | if api.ret_type == 'bool': |
| 87 | lines.append(f' if(!{api.name}_{module_name}_user({api.call_params})) {{ return false; }}') | 89 | lines.append(f' if(!{api.name}_{module_name}_user({api.call_params})) {{ return false; }}') |
| 88 | lines.append(' return true;') | 90 | lines.append(' return true;') |
| 91 | elif api.ret_type in ['layer_state_t', 'report_mouse_t']: | ||
| 92 | lines.append(f' return {api.name}_{module_name}_user({api.call_params});') | ||
| 89 | else: | 93 | else: |
| 90 | lines.append(f' {api.name}_{module_name}_user({api.call_params});') | 94 | lines.append(f' {api.name}_{module_name}_user({api.call_params});') |
| 91 | lines.append('}') | 95 | lines.append('}') |
| @@ -96,6 +100,8 @@ def _render_api_implementations(api, module): | |||
| 96 | if api.ret_type == 'bool': | 100 | if api.ret_type == 'bool': |
| 97 | lines.append(f' if(!{api.name}_{module_name}_kb({api.call_params})) {{ return false; }}') | 101 | lines.append(f' if(!{api.name}_{module_name}_kb({api.call_params})) {{ return false; }}') |
| 98 | lines.append(' return true;') | 102 | lines.append(' return true;') |
| 103 | elif api.ret_type in ['layer_state_t', 'report_mouse_t']: | ||
| 104 | lines.append(f' return {api.name}_{module_name}_kb({api.call_params});') | ||
| 99 | else: | 105 | else: |
| 100 | lines.append(f' {api.name}_{module_name}_kb({api.call_params});') | 106 | lines.append(f' {api.name}_{module_name}_kb({api.call_params});') |
| 101 | lines.append('}') | 107 | lines.append('}') |
| @@ -113,10 +119,14 @@ def _render_core_implementation(api, modules): | |||
| 113 | module_name = Path(module).name | 119 | module_name = Path(module).name |
| 114 | if api.ret_type == 'bool': | 120 | if api.ret_type == 'bool': |
| 115 | lines.append(f' && {api.name}_{module_name}({api.call_params})') | 121 | lines.append(f' && {api.name}_{module_name}({api.call_params})') |
| 122 | elif api.ret_type in ['layer_state_t', 'report_mouse_t']: | ||
| 123 | lines.append(f' {api.call_params} = {api.name}_{module_name}({api.call_params});') | ||
| 116 | else: | 124 | else: |
| 117 | lines.append(f' {api.name}_{module_name}({api.call_params});') | 125 | lines.append(f' {api.name}_{module_name}({api.call_params});') |
| 118 | if api.ret_type == 'bool': | 126 | if api.ret_type == 'bool': |
| 119 | lines.append(' ;') | 127 | lines.append(' ;') |
| 128 | elif api.ret_type in ['layer_state_t', 'report_mouse_t']: | ||
| 129 | lines.append(f' return {api.call_params};') | ||
| 120 | lines.append('}') | 130 | lines.append('}') |
| 121 | return lines | 131 | return lines |
| 122 | 132 | ||
