-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from MidstallSoftware/refactor
refactor: using a split design now
- Loading branch information
Showing
104 changed files
with
5,924 additions
and
1,095 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
BasedOnStyle: LLVM | ||
IndentWidth: 2 | ||
BracedInitializerIndentWidth: 2 | ||
IndentAccessModifiers: true | ||
IndentCaseBlocks: true | ||
IndentCaseLabels: true | ||
AlignOperands: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
name: clang-format Check | ||
on: [push, pull_request] | ||
jobs: | ||
formatting-check: | ||
name: Formatting Check | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Run clang-format style check. | ||
uses: jidicula/[email protected] | ||
with: | ||
clang-format-version: '18' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,3 +50,9 @@ modules.order | |
Module.symvers | ||
Mkfile.old | ||
dkms.conf | ||
|
||
# Nix | ||
|
||
result | ||
result-dev | ||
result-devdoc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,203 @@ | ||
#!/usr/bin/env python3 | ||
# | ||
# SPDX-FileCopyrightText: 2022 Collabora Inc. | ||
# 2023 Emmanuele Bassi | ||
# | ||
# SPDX-License-Identifier: LGPL-2.1-or-later | ||
# | ||
# Original author: Xavier Claessens <[email protected]> | ||
|
||
import argparse | ||
import textwrap | ||
from pathlib import Path | ||
|
||
|
||
# Disable line length warnings as wrapping the C code templates would be hard | ||
# flake8: noqa: E501 | ||
|
||
|
||
def gen_versions_macros(args, current_major_version, current_minor_version, current_micro_version): | ||
ns = args.namespace | ||
with args.out_path.open("w", encoding="utf-8") as ofile, args.in_path.open( | ||
"r", encoding="utf-8" | ||
) as ifile: | ||
for line in ifile.readlines(): | ||
if f"@{ns}_VERSIONS@" in line: | ||
ofile.write( | ||
textwrap.dedent( | ||
f"""\ | ||
/** | ||
* {ns}_MAJOR_VERSION: | ||
* | ||
* The major version component of the library's version, e.g. "1" for "1.2.3". | ||
*/ | ||
#define {ns}_MAJOR_VERSION ({current_major_version}) | ||
/** | ||
* {ns}_MINOR_VERSION: | ||
* | ||
* The minor version component of the library's version, e.g. "2" for "1.2.3". | ||
*/ | ||
#define {ns}_MINOR_VERSION ({current_minor_version}) | ||
/** | ||
* {ns}_MICRO_VERSION: | ||
* | ||
* The micro version component of the library's version, e.g. "3" for "1.2.3". | ||
*/ | ||
#define {ns}_MICRO_VERSION ({current_micro_version}) | ||
""" | ||
) | ||
) | ||
for minor in range(0, current_minor_version + 2, 2): | ||
ofile.write( | ||
textwrap.dedent( | ||
f"""\ | ||
/** | ||
* {ns}_VERSION_{current_major_version}_{minor}: | ||
* | ||
* A macro that evaluates to the {current_major_version}.{minor} version, in a format | ||
* that can be used by the C pre-processor. | ||
* | ||
* Since: {current_major_version}.{minor} | ||
*/ | ||
#define {ns}_VERSION_{current_major_version}_{minor} (G_ENCODE_VERSION ({current_major_version}, {minor})) | ||
""" | ||
) | ||
) | ||
else: | ||
ofile.write(line) | ||
|
||
|
||
def gen_visibility_macros(args, current_major_version, current_minor_version, current_micro_version): | ||
""" | ||
Generates a set of macros for each minor stable version of Shoyu | ||
- SHOYU_DEPRECATED | ||
- SHOYU_DEPRECATED_IN_… | ||
- SHOYU_DEPRECATED_MACRO_IN_… | ||
- SHOYU_DEPRECATED_ENUMERATOR_IN_… | ||
- SHOYU_DEPRECATED_TYPE_IN_… | ||
- SHOYU_AVAILABLE_IN_ALL | ||
- SHOYU_AVAILABLE_IN_… | ||
- SHOYU_AVAILABLE_STATIC_INLINE_IN_… | ||
- SHOYU_AVAILABLE_MACRO_IN_… | ||
- SHOYU_AVAILABLE_ENUMERATOR_IN_… | ||
- SHOYU_AVAILABLE_TYPE_IN_… | ||
- SHOYU_UNAVAILABLE(maj,min) | ||
- SHOYU_UNAVAILABLE_STATIC_INLINE(maj,min) | ||
""" | ||
|
||
ns = args.namespace | ||
with args.out_path.open("w", encoding="utf-8") as f: | ||
f.write( | ||
textwrap.dedent( | ||
f"""\ | ||
#pragma once | ||
#if (defined(_WIN32) || defined(__CYGWIN__)) && !defined({ns}_STATIC_COMPILATION) | ||
# define _{ns}_EXPORT __declspec(dllexport) | ||
# define _{ns}_IMPORT __declspec(dllimport) | ||
#elif __GNUC__ >= 4 | ||
# define _{ns}_EXPORT __attribute__((visibility("default"))) | ||
# define _{ns}_IMPORT | ||
#else | ||
# define _{ns}_EXPORT | ||
# define _{ns}_IMPORT | ||
#endif | ||
#ifdef {ns}_COMPILATION | ||
# define _{ns}_API _{ns}_EXPORT | ||
#else | ||
# define _{ns}_API _{ns}_IMPORT | ||
#endif | ||
#define _{ns}_EXTERN _{ns}_API extern | ||
#define {ns}_VAR _{ns}_EXTERN | ||
#define {ns}_AVAILABLE_IN_ALL _{ns}_EXTERN | ||
#ifdef {ns}_DISABLE_DEPRECATION_WARNINGS | ||
#define {ns}_DEPRECATED _{ns}_EXTERN | ||
#define {ns}_DEPRECATED_FOR(f) _{ns}_EXTERN | ||
#define {ns}_UNAVAILABLE(maj,min) _{ns}_EXTERN | ||
#define {ns}_UNAVAILABLE_STATIC_INLINE(maj,min) | ||
#else | ||
#define {ns}_DEPRECATED G_DEPRECATED _{ns}_EXTERN | ||
#define {ns}_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f) _{ns}_EXTERN | ||
#define {ns}_UNAVAILABLE(maj,min) G_UNAVAILABLE(maj,min) _{ns}_EXTERN | ||
#define {ns}_UNAVAILABLE_STATIC_INLINE(maj,min) G_UNAVAILABLE(maj,min) | ||
#endif | ||
""" | ||
) | ||
) | ||
for minor in range(0, current_minor_version + 2, 2): | ||
f.write( | ||
textwrap.dedent( | ||
f""" | ||
#if {ns}_VERSION_MIN_REQUIRED >= {ns}_VERSION_0_{minor} | ||
#define {ns}_DEPRECATED_IN_{current_major_version}_{minor} {ns}_DEPRECATED | ||
#define {ns}_DEPRECATED_IN_{current_major_version}_{minor}_FOR(f) {ns}_DEPRECATED_FOR (f) | ||
#define {ns}_DEPRECATED_MACRO_IN_{current_major_version}_{minor} {ns}_DEPRECATED_MACRO | ||
#define {ns}_DEPRECATED_MACRO_IN_{current_major_version}_{minor}_FOR(f) {ns}_DEPRECATED_MACRO_FOR (f) | ||
#define {ns}_DEPRECATED_ENUMERATOR_IN_{current_major_version}_{minor} {ns}_DEPRECATED_ENUMERATOR | ||
#define {ns}_DEPRECATED_ENUMERATOR_IN_{current_major_version}_{minor}_FOR(f) {ns}_DEPRECATED_ENUMERATOR_FOR (f) | ||
#define {ns}_DEPRECATED_TYPE_IN_{current_major_version}_{minor} {ns}_DEPRECATED_TYPE | ||
#define {ns}_DEPRECATED_TYPE_IN_{current_major_version}_{minor}_FOR(f) {ns}_DEPRECATED_TYPE_FOR (f) | ||
#else | ||
#define {ns}_DEPRECATED_IN_{current_major_version}_{minor} _{ns}_EXTERN | ||
#define {ns}_DEPRECATED_IN_{current_major_version}_{minor}_FOR(f) _{ns}_EXTERN | ||
#define {ns}_DEPRECATED_MACRO_IN_{current_major_version}_{minor} | ||
#define {ns}_DEPRECATED_MACRO_IN_{current_major_version}_{minor}_FOR(f) | ||
#define {ns}_DEPRECATED_ENUMERATOR_IN_{current_major_version}_{minor} | ||
#define {ns}_DEPRECATED_ENUMERATOR_IN_{current_major_version}_{minor}_FOR(f) | ||
#define {ns}_DEPRECATED_TYPE_IN_{current_major_version}_{minor} | ||
#define {ns}_DEPRECATED_TYPE_IN_{current_major_version}_{minor}_FOR(f) | ||
#endif | ||
#if {ns}_VERSION_MAX_ALLOWED < {ns}_VERSION_{current_major_version}_{minor} | ||
#define {ns}_AVAILABLE_IN_{current_major_version}_{minor} {ns}_UNAVAILABLE ({current_major_version}, {minor}) | ||
#define {ns}_AVAILABLE_STATIC_INLINE_IN_{current_major_version}_{minor} {ns}_UNAVAILABLE_STATIC_INLINE ({current_major_version}, {minor}) | ||
#define {ns}_AVAILABLE_MACRO_IN_{current_major_version}_{minor} {ns}_UNAVAILABLE_MACRO ({current_major_version}, {minor}) | ||
#define {ns}_AVAILABLE_ENUMERATOR_IN_{current_major_version}_{minor} {ns}_UNAVAILABLE_ENUMERATOR ({current_major_version}, {minor}) | ||
#define {ns}_AVAILABLE_TYPE_IN_{current_major_version}_{minor} {ns}_UNAVAILABLE_TYPE ({current_major_version}, {minor}) | ||
#else | ||
#define {ns}_AVAILABLE_IN_{current_major_version}_{minor} _{ns}_EXTERN | ||
#define {ns}_AVAILABLE_STATIC_INLINE_IN_{current_major_version}_{minor} | ||
#define {ns}_AVAILABLE_MACRO_IN_{current_major_version}_{minor} | ||
#define {ns}_AVAILABLE_ENUMERATOR_IN_{current_major_version}_{minor} | ||
#define {ns}_AVAILABLE_TYPE_IN_{current_major_version}_{minor} | ||
#endif | ||
""" | ||
) | ||
) | ||
|
||
|
||
def main(): | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument("shoyu_version", help="Current GLib version") | ||
subparsers = parser.add_subparsers() | ||
|
||
versions_parser = subparsers.add_parser( | ||
"versions-macros", help="Generate versions macros" | ||
) | ||
versions_parser.add_argument("namespace", help="Macro namespace") | ||
versions_parser.add_argument("in_path", help="input file", type=Path) | ||
versions_parser.add_argument("out_path", help="output file", type=Path) | ||
versions_parser.set_defaults(func=gen_versions_macros) | ||
|
||
visibility_parser = subparsers.add_parser( | ||
"visibility-macros", help="Generate visibility macros" | ||
) | ||
visibility_parser.add_argument("namespace", help="Macro namespace") | ||
visibility_parser.add_argument("out_path", help="output file", type=Path) | ||
visibility_parser.set_defaults(func=gen_visibility_macros) | ||
|
||
args = parser.parse_args() | ||
version = [int(i) for i in args.shoyu_version.split(".")] | ||
args.func(args, version[0], version[1], version[2]) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
expand_content_md_files = [ | ||
] | ||
|
||
if get_option('documentation') | ||
shoyu_compositor_toml = configure_file( | ||
input: 'shoyu-compositor.toml.in', | ||
output: 'shoyu-compositor.toml', | ||
configuration: toml_conf, | ||
install: true, | ||
install_dir: docs_dir / 'shoyu-compositor') | ||
|
||
custom_target('compositor-doc', | ||
input: [ shoyu_compositor_toml, libcompositor_gir[0] ], | ||
output: 'shoyu-compositor', | ||
command: [ | ||
gidocgen, | ||
'generate', | ||
gidocgen_common_args, | ||
'--add-include-path=@0@'.format(meson.current_build_dir() / '../../../compositor'), | ||
'--config=@INPUT0@', | ||
'--output-dir=@OUTPUT@', | ||
'--content-dir=@0@'.format(meson.current_source_dir()), | ||
'@INPUT1@', | ||
], | ||
depend_files: [ expand_content_md_files ], | ||
build_by_default: true, | ||
install: true, | ||
install_dir: docs_dir) | ||
|
||
test('doc-check-compositor', | ||
gidocgen, | ||
args: [ | ||
'check', | ||
'--config', shoyu_compositor_toml, | ||
'--add-include-path=@0@'.format(meson.current_build_dir() / '../../../compositor'), | ||
libcompositor_gir[0], | ||
], | ||
depends: libcompositor_gir[0], | ||
suite: ['docs']) | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
[library] | ||
version = "@version@" | ||
browse_url = "https://github.com/MidstallSoftware/shoyu" | ||
repository_url = "https://github.com/MidstallSoftware/shoyu.git" | ||
authors = "Midstall Software" | ||
description = "Shoyu Compositor framework" | ||
license = "AGPL-3.0-only" | ||
dependencies = ["GObject-2.0", "Gio-2.0"] | ||
devhelp = true | ||
search_index = true | ||
|
||
[dependencies."GObject-2.0"] | ||
name = "GObject" | ||
description = "The base type system library" | ||
docs_url = "https://docs.gtk.org/gobject/" | ||
|
||
[dependencies."Gio-2.0"] | ||
name = "Gio" | ||
description = "GObject Interfaces and Objects, Networking, IPC, and I/O" | ||
docs_url = "https://docs.gtk.org/gio/" | ||
|
||
[theme] | ||
name = "basic" | ||
show_index_summary = true | ||
show_class_hierarchy = true | ||
|
||
[source-location] | ||
base_url = "https://github.com/MidstallSoftware/shoyu/tree/master" | ||
|
||
[extra] | ||
content_base_url = "https://github.com/MidstallSoftware/shoyu/tree/master/docs/reference/compositor" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
toml_conf = configuration_data() | ||
toml_conf.set('version', meson.project_version()) | ||
|
||
gidocgen = find_program('gi-docgen', required: get_option('documentation'), native: true) | ||
|
||
gidocgen_common_args = [ | ||
'--quiet', | ||
'--no-namespace-dir', | ||
] | ||
|
||
if get_option('werror') | ||
gidocgen_common_args += ['--fatal-warnings'] | ||
endif | ||
|
||
docs_dir = shoyu_datadir / 'doc' | ||
|
||
if get_option('documentation') and not build_gir | ||
error('API reference requires introspection.') | ||
endif | ||
|
||
subdir('compositor') | ||
|
||
foreach shell : shoyu_shells | ||
subdir('shell-@0@'.format(shell)) | ||
endforeach |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
expand_content_md_files = [ | ||
] | ||
|
||
if get_option('documentation') | ||
shoyu_shell_gtk3_toml = configure_file( | ||
input: 'shoyu-shell-gtk3.toml.in', | ||
output: 'shoyu-shell-gtk3.toml', | ||
configuration: toml_conf, | ||
install: true, | ||
install_dir: docs_dir / 'shoyu-shell-gtk3') | ||
|
||
custom_target('shell-gtk3-doc', | ||
input: [ shoyu_shell_gtk3_toml, libshell_gtk3_gir[0] ], | ||
output: 'shoyu-shell-gtk3', | ||
command: [ | ||
gidocgen, | ||
'generate', | ||
gidocgen_common_args, | ||
'--add-include-path=@0@'.format(meson.current_build_dir() / '../../../shoyu-shell-gtk3'), | ||
'--config=@INPUT0@', | ||
'--output-dir=@OUTPUT@', | ||
'--content-dir=@0@'.format(meson.current_source_dir()), | ||
'@INPUT1@', | ||
], | ||
depend_files: [ expand_content_md_files ], | ||
build_by_default: true, | ||
install: true, | ||
install_dir: docs_dir) | ||
|
||
test('doc-check-shell-gtk3', | ||
gidocgen, | ||
args: [ | ||
'check', | ||
'--config', shoyu_shell_gtk3_toml, | ||
'--add-include-path=@0@'.format(meson.current_build_dir() / '../../../shoyu-shell-gtk3'), | ||
libshell_gtk3_gir[0], | ||
], | ||
depends: libshell_gtk3_gir[0], | ||
suite: ['docs']) | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[library] | ||
version = "@version@" | ||
repository_url = "https://github.com/MidstallSoftware/shoyu.git" | ||
authors = "Midstall Software" | ||
description = "Shoyu Shell GTK 3" | ||
dependencies = ["GObject-2.0"] | ||
devhelp = true | ||
search_index = true | ||
|
||
[dependencies."GObject-2.0"] | ||
name = "GObject" | ||
description = "The base type system library" | ||
docs_url = "https://docs.gtk.org/gobject/" | ||
|
||
[theme] | ||
name = "basic" | ||
show_index_summary = true | ||
show_class_hierarchy = true |
Oops, something went wrong.