diff --git a/include/Mw/LowLevel.h b/include/Mw/LowLevel.h index e025cb2..ea31aef 100644 --- a/include/Mw/LowLevel.h +++ b/include/Mw/LowLevel.h @@ -6,7 +6,7 @@ #ifndef __MW_LOWLEVEL_H__ #define __MW_LOWLEVEL_H__ -#include "Mw/BaseTypes.h" +#include #include typedef struct _MwLLHandler* MwLLHandler; diff --git a/pl/ostype/ClassicMacOS.pl b/pl/ostype/ClassicMacOS.pl index 751525f..1f2e532 100644 --- a/pl/ostype/ClassicMacOS.pl +++ b/pl/ostype/ClassicMacOS.pl @@ -1,9 +1,11 @@ use_backend("classicmacos"); -print("Compiling for Classic Mac OS via ./configure currently outputs a broken executable and it only supports PowerPC. Help is wanted. In the mean time, use CMake.") +print( +"Compiling for Classic Mac OS via ./configure currently outputs a broken executable and it only supports PowerPC. Help is wanted. In the mean time, use CMake." +); -$cc = $ENV{RETRO68_TOOLCHAIN_PATH}."/bin/powerpc-apple-macos-gcc"; -$ar = $ENV{RETRO68_TOOLCHAIN_PATH}."/bin/powerpc-apple-macos-ar"; +$cc = $ENV{RETRO68_TOOLCHAIN_PATH} . "/bin/powerpc-apple-macos-gcc"; +$ar = $ENV{RETRO68_TOOLCHAIN_PATH} . "/bin/powerpc-apple-macos-ar"; add_cflags("-DCLASSIC_MAC_OS"); add_cflags("-DSTBI_NO_THREAD_LOCALS"); diff --git a/pl/ostype/NetBSD.pl b/pl/ostype/NetBSD.pl index 9367250..6556cab 100644 --- a/pl/ostype/NetBSD.pl +++ b/pl/ostype/NetBSD.pl @@ -4,4 +4,6 @@ add_libdir( use_backend("x11"); add_libs("-lpthread"); +add_cflags("-DUSE_DBUS"); + 1; diff --git a/pl/rules.pl b/pl/rules.pl index 4d68cb9..6f64a17 100644 --- a/pl/rules.pl +++ b/pl/rules.pl @@ -31,6 +31,7 @@ if (grep(/^gdi$/, @backends)) { } if (grep(/^classicmacos$/, @backends)) { + #add_cflags("-DCLASSIC_MAC_OS"); new_object("src/backend/classicmacos.c"); @@ -56,18 +57,20 @@ if (grep(/^wayland$/, @backends)) { scan_wayland_protocol("unstable", "pointer-constraints", "-unstable-v1"); scan_wayland_protocol("unstable", "relative-pointer", "-unstable-v1"); - add_cflags(`pkg-config --cflags dbus-1`); - $gl_libs = "-lGL -lGLU"; } +if (grep(/( |^)-DUSE_DBUS( |$)/, $cflags)) { + add_cflags(`pkg-config --cflags dbus-1`); +} + if (grep(/^cocoa$/, @backends) || param_get("gnustep")) { add_cflags("-DUSE_COCOA"); new_object("src/backend/cocoa.m"); - if(param_get("gnustep")){ - add_incdir("-I".`gnustep-config --variable=GNUSTEP_SYSTEM_HEADERS`); - add_libdir("-L".`gnustep-config --variable=GNUSTEP_SYSTEM_LIBRARIES`); + if (param_get("gnustep")) { + add_incdir("-I" . `gnustep-config --variable=GNUSTEP_SYSTEM_HEADERS`); + add_libdir("-L" . `gnustep-config --variable=GNUSTEP_SYSTEM_LIBRARIES`); add_cflags("-fobjc-runtime=gnustep-2.0 -fblocks"); add_ldflags("-lobjc -lgnustep-base -lm -lgnustep-gui"); } diff --git a/src/backend/call.c b/src/backend/call.c index 07cf1e0..14338ec 100644 --- a/src/backend/call.c +++ b/src/backend/call.c @@ -55,7 +55,7 @@ MwLLGetCursorCoord = MwLLGetCursorCoordImpl; \ MwLLGetScreenSize = MwLLGetScreenSizeImpl; \ \ - MwLLSetDarkTheme = MwLLSetDarkThemeImpl; \ + MwLLSetDarkTheme = MwLLSetDarkThemeImpl; \ \ return 0; \ } diff --git a/src/backend/cocoa.m b/src/backend/cocoa.m index 3177d14..cfac1ad 100644 --- a/src/backend/cocoa.m +++ b/src/backend/cocoa.m @@ -1084,7 +1084,7 @@ static void MwLLEndStateChangeImpl(MwLL handle) { MwLLShow(handle, 1); } -static void MwLLSetDarkThemeImpl(MwLL handle, int toggle){ +static void MwLLSetDarkThemeImpl(MwLL handle, int toggle) { (void)handle; (void)toggle; } diff --git a/src/backend/gdi.c b/src/backend/gdi.c index 8813ba2..055b6c2 100644 --- a/src/backend/gdi.c +++ b/src/backend/gdi.c @@ -11,7 +11,7 @@ typedef struct userdata { static struct symtbl { void* lib_dwmapi; - HRESULT (WINAPI *DwmSetWindowAttribute)(HWND hwnd, DWORD dwAttribute, LPCVOID pvAttribute, DWORD cbAttribute); + HRESULT(WINAPI* DwmSetWindowAttribute)(HWND hwnd, DWORD dwAttribute, LPCVOID pvAttribute, DWORD cbAttribute); } wsymtbl; #define DwmSetWindowAttribute wsymtbl.DwmSetWindowAttribute @@ -34,7 +34,7 @@ static void detect_darktheme(MwLL handle) { t = dw ? 0 : 1; - if(t && DwmSetWindowAttribute != NULL){ + if(t && DwmSetWindowAttribute != NULL) { LPARAM style = GetWindowLongPtr(handle->gdi.hWnd, GWL_STYLE); if(!(style & WS_CHILD)) MwLLSetDarkTheme(handle, 1); } @@ -819,11 +819,10 @@ static void MwLLEndStateChangeImpl(MwLL handle) { (void)handle; } -static void MwLLSetDarkThemeImpl(MwLL handle, int toggle){ +static void MwLLSetDarkThemeImpl(MwLL handle, int toggle) { BOOL v = toggle ? TRUE : FALSE; DwmSetWindowAttribute(handle->gdi.hWnd, 20, &v, sizeof(v)); - } static int MwLLGDICallInitImpl(void) { diff --git a/src/backend/wayland.c b/src/backend/wayland.c index 425308d..fc4a67f 100644 --- a/src/backend/wayland.c +++ b/src/backend/wayland.c @@ -1817,6 +1817,7 @@ static void widget_setup(MwLL r, MwLL parent, int x, int y, int width, int heigh } } +#ifdef USE_DBUS static void detect_dark_theme(MwLL handle) { MwU32 value = 0; MwU32 dark_theme = 0; @@ -1826,6 +1827,7 @@ static void detect_dark_theme(MwLL handle) { MwLLDispatch(handle, dark_theme, &dark_theme); } +#endif static MwLL MwLLCreateImpl(MwLL parent, int x, int y, int width, int height) { MwLL r; @@ -1876,9 +1878,11 @@ static void MwLLDestroyImpl(MwLL handle) { pthread_mutex_unlock(&handle->wayland.eventsMutex); pthread_mutex_destroy(&handle->wayland.eventsMutex); +#ifdef USE_DBUS if(!wl_call_tbl.has_dbus) { MwLLDBusFreeContext(&wl_call_tbl.dbus, &handle->wayland.dbus); } +#endif buffer_destroy(&handle->wayland.cursor); wl_region_destroy(handle->wayland.region); @@ -2161,11 +2165,13 @@ static int MwLLPendingImpl(MwLL handle) { int pending = 0; if(handle->wayland.dark_theme_detection) { + handle->wayland.dark_theme_detection = MwFALSE; +#ifdef USE_DBUS if(wl_call_tbl.has_dbus) { detect_dark_theme(handle); - handle->wayland.dark_theme_detection = MwFALSE; MwLLDispatch(handle, draw, NULL); } +#endif } if(!handle->wayland.did_initial_resize) { @@ -2622,7 +2628,7 @@ static void MwLLEndStateChangeImpl(MwLL handle) { } } -static void MwLLSetDarkThemeImpl(MwLL handle, int toggle){ +static void MwLLSetDarkThemeImpl(MwLL handle, int toggle) { (void)handle; (void)toggle; } diff --git a/src/backend/x11.c b/src/backend/x11.c index a556c1c..898da85 100644 --- a/src/backend/x11.c +++ b/src/backend/x11.c @@ -9,8 +9,10 @@ static struct symtbl { void* lib_xrender; MwBool has_xrender; +#ifdef USE_DBUS MwLLDBusFuncTable dbus; MwBool has_dbus; +#endif int (*XClearWindow)(Display* display, Window w); XImage* (*XCreateImage)(Display*, Visual*, unsigned int, int, int, char*, unsigned int, unsigned int, int, int); @@ -311,6 +313,7 @@ static XVisualInfo* get_visual_info(Display* display) { return XGetVisualInfo(display, VisualIDMask, &xvi, &n); } +#ifdef USE_DBUS static void detect_dark_theme(MwLL handle) { MwU32 value = 0; MwU32 dark_theme = 0; @@ -320,6 +323,7 @@ static void detect_dark_theme(MwLL handle) { MwLLDispatch(handle, dark_theme, &dark_theme); } +#endif static MwLL MwLLCreateImpl(MwLL parent, int x, int y, int width, int height) { MwLL r; @@ -470,9 +474,11 @@ static void MwLLDestroyImpl(MwLL handle) { if(handle->x11.toplevel) XCloseDisplay(handle->x11.display); +#ifdef USE_DBUS if(!xsymtbl.has_dbus) { MwLLDBusFreeContext(&xsymtbl.dbus, &handle->x11.dbus); } +#endif free(handle); } @@ -633,11 +639,13 @@ static int MwLLPendingImpl(MwLL handle) { XEvent ev; if(handle->x11.dark_theme_detection) { + handle->x11.dark_theme_detection = MwFALSE; +#ifdef USE_DBUS if(xsymtbl.has_dbus) { detect_dark_theme(handle); - handle->x11.dark_theme_detection = MwFALSE; MwLLDispatch(handle, draw, NULL); } +#endif } if(handle->x11.clipboard_pending && (MwTimeGetTick() - handle->x11.clipboard_time) >= ClipboardTimeout) { @@ -1258,9 +1266,12 @@ static void MwLLSetClipboardImpl(MwLL handle, const char* text, int clipboard_ty (void)handle; (void)text; + (void)clipboard_type; } static void MwLLGetClipboardImpl(MwLL handle, int clipboard_type) { + (void)clipboard_type; + if(handle->x11.clipboard_pending) return; XConvertSelection(handle->x11.display, handle->x11.clipboard, handle->x11.utf8_string, handle->x11.selection, handle->x11.window, CurrentTime); @@ -1308,7 +1319,7 @@ static void MwLLEndStateChangeImpl(MwLL handle) { MwLLShow(handle, 1); } -static void MwLLSetDarkThemeImpl(MwLL handle, int toggle){ +static void MwLLSetDarkThemeImpl(MwLL handle, int toggle) { (void)handle; (void)toggle; } @@ -1427,7 +1438,9 @@ static int MwLLX11CallInitImpl(void) { XRENDER_FUNC_LOAD(XRenderComposite) #endif +#ifdef USE_DBUS xsymtbl.has_dbus = MwLLDBusFuncSetup(&xsymtbl.dbus); +#endif return 0; } diff --git a/src/core.c b/src/core.c index 6c08970..0404fa7 100644 --- a/src/core.c +++ b/src/core.c @@ -533,7 +533,7 @@ void MwSetInteger(MwWidget handle, const char* key, int n) { force_render_all(handle); } - if(strcmp(key, MwNdarkTheme) == 0){ + if(strcmp(key, MwNdarkTheme) == 0) { MwWidget h = handle; while(h->parent != NULL && h->parent->widget_class != NULL) h = h->parent; diff --git a/src/draw.c b/src/draw.c index 68f6862..8dde841 100644 --- a/src/draw.c +++ b/src/draw.c @@ -308,7 +308,7 @@ static void MwDrawFrameEx_simple(MwWidget handle, MwRect* rect, MwLLColor color, static void frame_border_complex(MwWidget handle, MwRect* rect, MwLLColor lighter, MwLLColor darker, int invert, int border, int diff, int same) { MwPoint p[7]; - + (void)diff; (void)same; diff --git a/src/string.c b/src/string.c index a7c2338..f56b9ac 100644 --- a/src/string.c +++ b/src/string.c @@ -52,7 +52,7 @@ void MwStringPrintIntoBuffer(char* out, MwU32 size, const char* fmt, ...) { MWDECL MwBool MwStringIsKeyUTF8(MwU32 key) { unsigned char bytes[4]; - int i; + int i; bytes[0] = (key & 0x000000FF); bytes[1] = (key & 0x0000FF00) >> 8; bytes[2] = (key & 0x00FF0000) >> 16; diff --git a/src/widget/scrollbar.c b/src/widget/scrollbar.c index a1df9b2..bed80c0 100644 --- a/src/widget/scrollbar.c +++ b/src/widget/scrollbar.c @@ -58,9 +58,9 @@ static void draw(MwWidget handle) { MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground)); MwLLColor dark = MwLightenColor(handle, base, -64, -64, -64); MwScrollBar scr = handle->internal; - int or; - int uy, dy, ux, dx; - MwLLPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap); + int or ; + int uy, dy, ux, dx; + MwLLPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap); r.x = 0; r.y = 0;