2 KiB
2 KiB
Backend dev
The basic process of creating a new Milsko backend is
- Adding a new include header into
include/Mw/LowLevel. It must include;struct _MwLLBackendName: Any details about a window or a subwidgetstruct _MwLLBackendNameColor: An 8-bit RGB Color. You'll probably never impl this, this is for platforms like X11/GDI where they have a secondary color representation that can be stored.struct _MwLLBackendNamePixmap: Self-explanatory. This is also used for the soft gradients in the modern theme.MwLLBackendNameCallInitImpl(void)called byMwLibraryInitto address and platform globals.- Note that all of those structs are actually unions. They should all start with their
MwLLCommon...equivalants.
- 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 thenCALL(BackendName);, and somewhere you should have the impl forMwLLBackendNameCallInitImpl(void).
- Backends actually return a table of function pointers that you have to implement with static functions. Your file should end with
- Add
MwLLBackendNameCallInitImplto theMwLibraryInitimpl insrc/core.c. - Either
- a.) Modify
CMakeLists.txtfor your platform. - b.) Add a new perl file in
pl/ostypethat./configurecan reference, and modifypl/rules.pl; If you don't know how to use perl it's fine, just copy a file like theLinux.plorWindows.pl, the functions you'll have to change for your platform are self explanatory. Ensure it ends with1;. - c.) Both.
- Both are recommended, but some platforms like Classic Mac OS can't be used with the
./configurescript, and that's fine.
- a.) Modify
The functions you'll have to impl are too many to list here so you should start by just copying x11.c and then replacing all the function impls with your own.
**Pay attention to some of these functions' comments in LowLevel.h as they might not be as you expect; for example, MwLLSetDarkThemeImpl is for setting the accent color to dark theme on platforms like modern Windows (dark theme itself is set with MwSetInteger(handle, MwNdarktheme, 1)).