diff --git a/doc/BACKENDDEV.md b/doc/BACKENDDEV.md index b77564bc..4fa2ed72 100644 --- a/doc/BACKENDDEV.md +++ b/doc/BACKENDDEV.md @@ -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. - `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. +- 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` - 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 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 - 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;`. diff --git a/include/Mw/LowLevel/Wayland.h b/include/Mw/LowLevel/Wayland.h index ba607519..0d46e503 100644 --- a/include/Mw/LowLevel/Wayland.h +++ b/include/Mw/LowLevel/Wayland.h @@ -139,19 +139,31 @@ extern wayland_call_table_t wl_call_tbl; extern MwBool MwWaylandAlwaysRender; /* defined inline right here so that it doesn't conflict with the other macros */ MwInline int wayland_load_funcs() { +#ifdef __APPLE__ + wl_call_tbl.lib = MwDynamicOpen("libwayland-client.dylib"); +#else wl_call_tbl.lib = MwDynamicOpen("libwayland-client.so"); +#endif 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; } +#ifdef __APPLE__ + wl_call_tbl.xkb_lib = MwDynamicOpen("libxkbcommon.dylib"); +#else wl_call_tbl.xkb_lib = MwDynamicOpen("libxkbcommon.so"); +#endif 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; } +#ifdef __APPLE__ + wl_call_tbl.cairo_lib = MwDynamicOpen("libcairo.dylib"); +#else wl_call_tbl.cairo_lib = MwDynamicOpen("libcairo.so"); +#endif 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; } #define WAYLAND_FUNC(x) \