Compare commits

...

3 commits

Author SHA1 Message Date
196a1c87f5 lowlevel.md: mention adding to mw/lowlevel.h
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good
2026-04-26 22:00:15 -07:00
153b7e8254 wayland: allow use on macos 2026-04-26 21:57:46 -07:00
a155126e84 mention enums in backenddev.md 2026-04-26 21:53:19 -07:00
2 changed files with 17 additions and 3 deletions

View file

@ -8,9 +8,11 @@ The basic process of creating a new Milsko backend is
- `struct _MwLLBackendNamePixmap`: Self-explanatory. This is also used for the soft gradients in the modern theme. - `struct _MwLLBackendNamePixmap`: Self-explanatory. This is also used for the soft gradients in the modern theme.
- `MwLLBackendNameCallInitImpl(void)` called by `MwLibraryInit` to address and platform globals. - `MwLLBackendNameCallInitImpl(void)` called by `MwLibraryInit` to address and platform globals.
- Note that all of those structs are actually unions. They should all start with their `MwLLCommon...` equivalants. - Note that all of those structs are actually unions. They should all start with their `MwLLCommon...` equivalants.
- Fill out `Mw/LowLevel.h` appopriately, adding an include to your new file and the structs in the appropriate unions. These need to be guarded by a `USE_BACKENDNAME` macro which you'll define later when you modify the build system.
- Creating a new impl file in `src/backend` - Creating a new impl file in `src/backend`
- Backends actually return a table of function pointers that you have to implement with static functions. Your file should end with `#include "call.c"` and then `CALL(BackendName);`, and somewhere you should have the impl for `MwLLBackendNameCallInitImpl(void)`. - Backends actually return a table of function pointers that you have to implement with static functions. Your file should end with `#include "call.c"` and then `CALL(BackendName);`, and somewhere you should have the impl for `MwLLBackendNameCallInitImpl(void)`.
- Add `MwLLBackendNameCallInitImpl` to the `MwLibraryInit` impl in `src/core.c`. - Add `MwLLBackendNameCallInitImpl` to the `MwLibraryInit` impl in `src/core.c`.
- Add a new enum variation to `MwLLBackends` in `Mw/Include/LowLevel.h`; your impl of `MwLLCreateImpl` will set `common.type` to this so the user can check which backend they're on (important for platforms with multiple supported backends).
- Either - Either
- a.) Modify `CMakeLists.txt` for your platform. - a.) Modify `CMakeLists.txt` for your platform.
- b.) Add a new perl file in `pl/ostype` that `./configure` can reference, and modify `pl/rules.pl`; If you don't know how to use perl it's fine, just copy a file like the `Linux.pl` or `Windows.pl`, the functions you'll have to change for your platform are self explanatory. Ensure it ends with `1;`. - b.) Add a new perl file in `pl/ostype` that `./configure` can reference, and modify `pl/rules.pl`; If you don't know how to use perl it's fine, just copy a file like the `Linux.pl` or `Windows.pl`, the functions you'll have to change for your platform are self explanatory. Ensure it ends with `1;`.

View file

@ -139,19 +139,31 @@ extern wayland_call_table_t wl_call_tbl;
extern MwBool MwWaylandAlwaysRender; extern MwBool MwWaylandAlwaysRender;
/* defined inline right here so that it doesn't conflict with the other macros */ /* defined inline right here so that it doesn't conflict with the other macros */
MwInline int wayland_load_funcs() { MwInline int wayland_load_funcs() {
#ifdef __APPLE__
wl_call_tbl.lib = MwDynamicOpen("libwayland-client.dylib");
#else
wl_call_tbl.lib = MwDynamicOpen("libwayland-client.so"); wl_call_tbl.lib = MwDynamicOpen("libwayland-client.so");
#endif
if(!wl_call_tbl.lib) { if(!wl_call_tbl.lib) {
printf("(libwayland-client.so not found, falling back to X11)\n"); printf("(libwayland-client not found, falling back to X11)\n");
return 1; return 1;
} }
#ifdef __APPLE__
wl_call_tbl.xkb_lib = MwDynamicOpen("libxkbcommon.dylib");
#else
wl_call_tbl.xkb_lib = MwDynamicOpen("libxkbcommon.so"); wl_call_tbl.xkb_lib = MwDynamicOpen("libxkbcommon.so");
#endif
if(!wl_call_tbl.xkb_lib) { if(!wl_call_tbl.xkb_lib) {
printf("(libxkbcommon.so not found, cannot use Wayland backend.)\n"); printf("(libxkbcommon not found, cannot use Wayland backend.)\n");
return 1; return 1;
} }
#ifdef __APPLE__
wl_call_tbl.cairo_lib = MwDynamicOpen("libcairo.dylib");
#else
wl_call_tbl.cairo_lib = MwDynamicOpen("libcairo.so"); wl_call_tbl.cairo_lib = MwDynamicOpen("libcairo.so");
#endif
if(!wl_call_tbl.cairo_lib) { if(!wl_call_tbl.cairo_lib) {
printf("(libcairo.so not found, cannot use Wayland backend.)\n"); printf("(libcairo not found, cannot use Wayland backend.)\n");
return 1; return 1;
} }
#define WAYLAND_FUNC(x) \ #define WAYLAND_FUNC(x) \