dbus should work on netbsd now
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good

This commit is contained in:
Nishi 2026-04-16 23:40:29 +09:00
commit 79efc31c55
Signed by: nishi
GPG key ID: 27EF69B208EB9343
13 changed files with 50 additions and 25 deletions

View file

@ -6,7 +6,7 @@
#ifndef __MW_LOWLEVEL_H__ #ifndef __MW_LOWLEVEL_H__
#define __MW_LOWLEVEL_H__ #define __MW_LOWLEVEL_H__
#include "Mw/BaseTypes.h" #include <Mw/BaseTypes.h>
#include <Mw/MachDep.h> #include <Mw/MachDep.h>
typedef struct _MwLLHandler* MwLLHandler; typedef struct _MwLLHandler* MwLLHandler;

View file

@ -1,6 +1,8 @@
use_backend("classicmacos"); 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"; $cc = $ENV{RETRO68_TOOLCHAIN_PATH} . "/bin/powerpc-apple-macos-gcc";
$ar = $ENV{RETRO68_TOOLCHAIN_PATH} . "/bin/powerpc-apple-macos-ar"; $ar = $ENV{RETRO68_TOOLCHAIN_PATH} . "/bin/powerpc-apple-macos-ar";

View file

@ -4,4 +4,6 @@ add_libdir(
use_backend("x11"); use_backend("x11");
add_libs("-lpthread"); add_libs("-lpthread");
add_cflags("-DUSE_DBUS");
1; 1;

View file

@ -31,6 +31,7 @@ if (grep(/^gdi$/, @backends)) {
} }
if (grep(/^classicmacos$/, @backends)) { if (grep(/^classicmacos$/, @backends)) {
#add_cflags("-DCLASSIC_MAC_OS"); #add_cflags("-DCLASSIC_MAC_OS");
new_object("src/backend/classicmacos.c"); new_object("src/backend/classicmacos.c");
@ -56,11 +57,13 @@ if (grep(/^wayland$/, @backends)) {
scan_wayland_protocol("unstable", "pointer-constraints", "-unstable-v1"); scan_wayland_protocol("unstable", "pointer-constraints", "-unstable-v1");
scan_wayland_protocol("unstable", "relative-pointer", "-unstable-v1"); scan_wayland_protocol("unstable", "relative-pointer", "-unstable-v1");
add_cflags(`pkg-config --cflags dbus-1`);
$gl_libs = "-lGL -lGLU"; $gl_libs = "-lGL -lGLU";
} }
if (grep(/( |^)-DUSE_DBUS( |$)/, $cflags)) {
add_cflags(`pkg-config --cflags dbus-1`);
}
if (grep(/^cocoa$/, @backends) || param_get("gnustep")) { if (grep(/^cocoa$/, @backends) || param_get("gnustep")) {
add_cflags("-DUSE_COCOA"); add_cflags("-DUSE_COCOA");
new_object("src/backend/cocoa.m"); new_object("src/backend/cocoa.m");

View file

@ -823,7 +823,6 @@ static void MwLLSetDarkThemeImpl(MwLL handle, int toggle){
BOOL v = toggle ? TRUE : FALSE; BOOL v = toggle ? TRUE : FALSE;
DwmSetWindowAttribute(handle->gdi.hWnd, 20, &v, sizeof(v)); DwmSetWindowAttribute(handle->gdi.hWnd, 20, &v, sizeof(v));
} }
static int MwLLGDICallInitImpl(void) { static int MwLLGDICallInitImpl(void) {

View file

@ -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) { static void detect_dark_theme(MwLL handle) {
MwU32 value = 0; MwU32 value = 0;
MwU32 dark_theme = 0; MwU32 dark_theme = 0;
@ -1826,6 +1827,7 @@ static void detect_dark_theme(MwLL handle) {
MwLLDispatch(handle, dark_theme, &dark_theme); MwLLDispatch(handle, dark_theme, &dark_theme);
} }
#endif
static MwLL MwLLCreateImpl(MwLL parent, int x, int y, int width, int height) { static MwLL MwLLCreateImpl(MwLL parent, int x, int y, int width, int height) {
MwLL r; MwLL r;
@ -1876,9 +1878,11 @@ static void MwLLDestroyImpl(MwLL handle) {
pthread_mutex_unlock(&handle->wayland.eventsMutex); pthread_mutex_unlock(&handle->wayland.eventsMutex);
pthread_mutex_destroy(&handle->wayland.eventsMutex); pthread_mutex_destroy(&handle->wayland.eventsMutex);
#ifdef USE_DBUS
if(!wl_call_tbl.has_dbus) { if(!wl_call_tbl.has_dbus) {
MwLLDBusFreeContext(&wl_call_tbl.dbus, &handle->wayland.dbus); MwLLDBusFreeContext(&wl_call_tbl.dbus, &handle->wayland.dbus);
} }
#endif
buffer_destroy(&handle->wayland.cursor); buffer_destroy(&handle->wayland.cursor);
wl_region_destroy(handle->wayland.region); wl_region_destroy(handle->wayland.region);
@ -2161,11 +2165,13 @@ static int MwLLPendingImpl(MwLL handle) {
int pending = 0; int pending = 0;
if(handle->wayland.dark_theme_detection) { if(handle->wayland.dark_theme_detection) {
handle->wayland.dark_theme_detection = MwFALSE;
#ifdef USE_DBUS
if(wl_call_tbl.has_dbus) { if(wl_call_tbl.has_dbus) {
detect_dark_theme(handle); detect_dark_theme(handle);
handle->wayland.dark_theme_detection = MwFALSE;
MwLLDispatch(handle, draw, NULL); MwLLDispatch(handle, draw, NULL);
} }
#endif
} }
if(!handle->wayland.did_initial_resize) { if(!handle->wayland.did_initial_resize) {

View file

@ -9,8 +9,10 @@ static struct symtbl {
void* lib_xrender; void* lib_xrender;
MwBool has_xrender; MwBool has_xrender;
#ifdef USE_DBUS
MwLLDBusFuncTable dbus; MwLLDBusFuncTable dbus;
MwBool has_dbus; MwBool has_dbus;
#endif
int (*XClearWindow)(Display* display, Window w); int (*XClearWindow)(Display* display, Window w);
XImage* (*XCreateImage)(Display*, Visual*, unsigned int, int, int, char*, unsigned int, unsigned int, int, int); 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); return XGetVisualInfo(display, VisualIDMask, &xvi, &n);
} }
#ifdef USE_DBUS
static void detect_dark_theme(MwLL handle) { static void detect_dark_theme(MwLL handle) {
MwU32 value = 0; MwU32 value = 0;
MwU32 dark_theme = 0; MwU32 dark_theme = 0;
@ -320,6 +323,7 @@ static void detect_dark_theme(MwLL handle) {
MwLLDispatch(handle, dark_theme, &dark_theme); MwLLDispatch(handle, dark_theme, &dark_theme);
} }
#endif
static MwLL MwLLCreateImpl(MwLL parent, int x, int y, int width, int height) { static MwLL MwLLCreateImpl(MwLL parent, int x, int y, int width, int height) {
MwLL r; MwLL r;
@ -470,9 +474,11 @@ static void MwLLDestroyImpl(MwLL handle) {
if(handle->x11.toplevel) XCloseDisplay(handle->x11.display); if(handle->x11.toplevel) XCloseDisplay(handle->x11.display);
#ifdef USE_DBUS
if(!xsymtbl.has_dbus) { if(!xsymtbl.has_dbus) {
MwLLDBusFreeContext(&xsymtbl.dbus, &handle->x11.dbus); MwLLDBusFreeContext(&xsymtbl.dbus, &handle->x11.dbus);
} }
#endif
free(handle); free(handle);
} }
@ -633,11 +639,13 @@ static int MwLLPendingImpl(MwLL handle) {
XEvent ev; XEvent ev;
if(handle->x11.dark_theme_detection) { if(handle->x11.dark_theme_detection) {
handle->x11.dark_theme_detection = MwFALSE;
#ifdef USE_DBUS
if(xsymtbl.has_dbus) { if(xsymtbl.has_dbus) {
detect_dark_theme(handle); detect_dark_theme(handle);
handle->x11.dark_theme_detection = MwFALSE;
MwLLDispatch(handle, draw, NULL); MwLLDispatch(handle, draw, NULL);
} }
#endif
} }
if(handle->x11.clipboard_pending && (MwTimeGetTick() - handle->x11.clipboard_time) >= ClipboardTimeout) { 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)handle;
(void)text; (void)text;
(void)clipboard_type;
} }
static void MwLLGetClipboardImpl(MwLL handle, int clipboard_type) { static void MwLLGetClipboardImpl(MwLL handle, int clipboard_type) {
(void)clipboard_type;
if(handle->x11.clipboard_pending) return; if(handle->x11.clipboard_pending) return;
XConvertSelection(handle->x11.display, handle->x11.clipboard, handle->x11.utf8_string, handle->x11.selection, handle->x11.window, CurrentTime); XConvertSelection(handle->x11.display, handle->x11.clipboard, handle->x11.utf8_string, handle->x11.selection, handle->x11.window, CurrentTime);
@ -1427,7 +1438,9 @@ static int MwLLX11CallInitImpl(void) {
XRENDER_FUNC_LOAD(XRenderComposite) XRENDER_FUNC_LOAD(XRenderComposite)
#endif #endif
#ifdef USE_DBUS
xsymtbl.has_dbus = MwLLDBusFuncSetup(&xsymtbl.dbus); xsymtbl.has_dbus = MwLLDBusFuncSetup(&xsymtbl.dbus);
#endif
return 0; return 0;
} }