classicmacos #17
36 changed files with 557 additions and 199 deletions
7
.gitignore
vendored
7
.gitignore
vendored
|
|
@ -19,3 +19,10 @@ examples/*/*.exe
|
||||||
compile_flags.txt
|
compile_flags.txt
|
||||||
.cache
|
.cache
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
||||||
|
*.pef
|
||||||
|
*.dsk
|
||||||
|
*.bin
|
||||||
|
*.rsrc
|
||||||
|
*.finf
|
||||||
|
*.gdb
|
||||||
|
|
|
||||||
252
CMakeLists.txt
252
CMakeLists.txt
|
|
@ -9,24 +9,34 @@ include(GNUInstallDirs)
|
||||||
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_FULL_LIBDIR}")
|
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_FULL_LIBDIR}")
|
||||||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||||
|
|
||||||
option(MW_TRY_OPENGL "Try to compile OpenGL widget or not" ON)
|
|
||||||
option(MW_TRY_VULKAN "Try to compile Vulkan widget or not" ON)
|
|
||||||
option(MW_CLASSIC_THEME "Use classic theme" OFF)
|
option(MW_CLASSIC_THEME "Use classic theme" OFF)
|
||||||
option(MW_BUILD_EXAMPLES "Build examples" OFF)
|
option(MW_BUILD_EXAMPLES "Build examples" OFF)
|
||||||
option(MW_USE_STB_IMAGE "Use stb_image" ON)
|
option(MW_USE_STB_IMAGE "Use stb_image" ON)
|
||||||
option(MW_USE_STB_TRUETYPE "Use stb_truetype" OFF)
|
option(MW_USE_STB_TRUETYPE "Use stb_truetype" OFF)
|
||||||
option(MW_BUILD_SHARED "Build a shared library" ON)
|
|
||||||
option(MW_BUILD_STATIC "Build a static library" OFF)
|
if(${CMAKE_SYSTEM_NAME} MATCHES Retro)
|
||||||
|
option(MW_BUILD_SHARED "Build a shared library" OFF)
|
||||||
|
option(MW_BUILD_STATIC "Build a static library" ON)
|
||||||
|
option(MW_TRY_OPENGL "Try to compile OpenGL widget or not" OFF)
|
||||||
|
option(MW_TRY_VULKAN "Try to compile Vulkan widget or not" OFF)
|
||||||
|
else()
|
||||||
|
option(MW_BUILD_SHARED "Build a shared library" ON)
|
||||||
|
option(MW_BUILD_STATIC "Build a static library" OFF)
|
||||||
|
option(MW_TRY_OPENGL "Try to compile OpenGL widget or not" ON)
|
||||||
|
option(MW_TRY_VULKAN "Try to compile Vulkan widget or not" ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
option(MW_INSTALL_HEADERS "Install headers" ON)
|
option(MW_INSTALL_HEADERS "Install headers" ON)
|
||||||
|
|
||||||
if(${CMAKE_SYSTEM_NAME} STREQUAL Darwin)
|
if(${CMAKE_SYSTEM_NAME} STREQUAL Darwin OR ${CMAKE_SYSTEM_NAME} MATCHES Retro)
|
||||||
option(MW_USE_FREETYPE2 "Use FreeType 2" OFF)
|
option(MW_USE_FREETYPE2 "Use FreeType 2" OFF)
|
||||||
else()
|
else()
|
||||||
option(MW_USE_FREETYPE2 "Use FreeType 2" ON)
|
option(MW_USE_FREETYPE2 "Use FreeType 2" ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(${CMAKE_SYSTEM_NAME} STREQUAL Linux)
|
if(${CMAKE_SYSTEM_NAME} STREQUAL Linux)
|
||||||
option(MW_USE_WAYLAND "Enable Wayland backend" ON)
|
option(MW_USE_WAYLAND "Enable Wayland backend" ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
file(
|
file(
|
||||||
|
|
@ -39,83 +49,83 @@ list(REMOVE_ITEM SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/widget/opengl.c")
|
||||||
list(REMOVE_ITEM SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/widget/vulkan.c")
|
list(REMOVE_ITEM SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/widget/vulkan.c")
|
||||||
|
|
||||||
if(NOT MW_USE_STB_IMAGE)
|
if(NOT MW_USE_STB_IMAGE)
|
||||||
list(REMOVE_ITEM SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/external/stb_image.c")
|
list(REMOVE_ITEM SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/external/stb_image.c")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT MW_USE_STB_TRUETYPE)
|
if(NOT MW_USE_STB_TRUETYPE)
|
||||||
list(REMOVE_ITEM SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/external/stb_truetype.c")
|
list(REMOVE_ITEM SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/external/stb_truetype.c")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_SYSTEM_NAME STREQUAL "NetBSD")
|
if(CMAKE_SYSTEM_NAME STREQUAL "NetBSD")
|
||||||
list(APPEND CMAKE_REQUIRED_INCLUDES "/usr/X11R7/include")
|
list(APPEND CMAKE_REQUIRED_INCLUDES "/usr/X11R7/include")
|
||||||
list(APPEND CMAKE_REQUIRED_INCLUDES "/usr/pkg/include")
|
list(APPEND CMAKE_REQUIRED_INCLUDES "/usr/pkg/include")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(MW_TRY_OPENGL)
|
if(MW_TRY_OPENGL)
|
||||||
find_package(OpenGL)
|
find_package(OpenGL)
|
||||||
if(OpenGL_FOUND)
|
if(OpenGL_FOUND)
|
||||||
set(MW_BUILD_OPENGL ON)
|
set(MW_BUILD_OPENGL ON)
|
||||||
list(APPEND SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/widget/opengl.c")
|
list(APPEND SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/widget/opengl.c")
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
list(APPEND SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/widget/opengl_cocoa.m")
|
list(APPEND SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/widget/opengl_cocoa.m")
|
||||||
endif()
|
|
||||||
message(STATUS "OpenGL widget has been enabled")
|
|
||||||
else()
|
|
||||||
message(WARNING "OpenGL widget has been disabled")
|
|
||||||
endif()
|
endif()
|
||||||
|
message(STATUS "OpenGL widget has been enabled")
|
||||||
|
else()
|
||||||
|
message(WARNING "OpenGL widget has been disabled")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(MW_TRY_VULKAN)
|
if(MW_TRY_VULKAN)
|
||||||
check_include_files(vulkan/vulkan.h HAVE_VULKAN_VULKAN_H)
|
check_include_files(vulkan/vulkan.h HAVE_VULKAN_VULKAN_H)
|
||||||
if(HAVE_VULKAN_VULKAN_H)
|
if(HAVE_VULKAN_VULKAN_H)
|
||||||
set(MW_BUILD_VULKAN ON)
|
set(MW_BUILD_VULKAN ON)
|
||||||
list(APPEND SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/widget/vulkan.c")
|
list(APPEND SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/widget/vulkan.c")
|
||||||
target_compile_definitions(
|
target_compile_definitions(
|
||||||
Mw
|
Mw
|
||||||
PRIVATE
|
PRIVATE
|
||||||
MW_VULKAN
|
MW_VULKAN
|
||||||
)
|
)
|
||||||
message(STATUS "Vulkan widget has been enabled")
|
message(STATUS "Vulkan widget has been enabled")
|
||||||
else()
|
else()
|
||||||
message(WARNING "Vulkan widget has been disabled")
|
message(WARNING "Vulkan widget has been disabled")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(MW_BUILD_STATIC)
|
if(MW_BUILD_STATIC)
|
||||||
message(STATUS "Building Milsko as a static library")
|
message(STATUS "Building Milsko as a static library")
|
||||||
add_library(
|
add_library(
|
||||||
Mw
|
Mw
|
||||||
${SOURCES}
|
${SOURCES}
|
||||||
)
|
)
|
||||||
elseif(MW_BUILD_SHARED)
|
elseif(MW_BUILD_SHARED)
|
||||||
message(STATUS "Building Milsko as a shared library")
|
message(STATUS "Building Milsko as a shared library")
|
||||||
add_library(
|
add_library(
|
||||||
Mw
|
Mw
|
||||||
SHARED
|
SHARED
|
||||||
${SOURCES}
|
${SOURCES}
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
message(ERROR "Must either build a shared library or a static library")
|
message(ERROR "Must either build a shared library or a static library")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(MW_USE_STB_IMAGE)
|
if(MW_USE_STB_IMAGE)
|
||||||
target_compile_definitions(
|
target_compile_definitions(
|
||||||
Mw
|
Mw
|
||||||
PRIVATE
|
PRIVATE
|
||||||
USE_STB_IMAGE
|
USE_STB_IMAGE
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
file(
|
file(
|
||||||
GLOB
|
GLOB
|
||||||
IMAGE_SOURCES
|
IMAGE_SOURCES
|
||||||
external/libjpeg/src/*.c external/libpng/src/*.c
|
external/libjpeg/src/*.c external/libpng/src/*.c
|
||||||
)
|
)
|
||||||
target_sources(
|
target_sources(
|
||||||
Mw
|
Mw
|
||||||
PRIVATE
|
PRIVATE
|
||||||
${MW_IMAGE_SOURCES}
|
${MW_IMAGE_SOURCES}
|
||||||
)
|
)
|
||||||
target_include_directories(
|
target_include_directories(
|
||||||
Mw
|
Mw
|
||||||
PRIVATE
|
PRIVATE
|
||||||
external/libjpeg/include external/libpng/include
|
external/libjpeg/include external/libpng/include
|
||||||
|
|
@ -123,7 +133,7 @@ else()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(MW_USE_STB_TRUETYPE)
|
if(MW_USE_STB_TRUETYPE)
|
||||||
target_compile_definitions(
|
target_compile_definitions(
|
||||||
Mw
|
Mw
|
||||||
PRIVATE
|
PRIVATE
|
||||||
USE_STB_TRUETYPE
|
USE_STB_TRUETYPE
|
||||||
|
|
@ -131,22 +141,22 @@ if(MW_USE_STB_TRUETYPE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(MW_USE_FREETYPE2)
|
if(MW_USE_FREETYPE2)
|
||||||
target_compile_definitions(
|
target_compile_definitions(
|
||||||
Mw
|
Mw
|
||||||
PRIVATE
|
PRIVATE
|
||||||
USE_FREETYPE2
|
USE_FREETYPE2
|
||||||
)
|
)
|
||||||
|
|
||||||
find_package(PkgConfig)
|
find_package(PkgConfig)
|
||||||
pkg_check_modules(FT2 REQUIRED freetype2)
|
pkg_check_modules(FT2 REQUIRED freetype2)
|
||||||
list(APPEND INCLUDE_DIRS ${FT2_INCLUDE_DIRS})
|
list(APPEND INCLUDE_DIRS ${FT2_INCLUDE_DIRS})
|
||||||
list(APPEND LIBRARY_DIRS ${FT2_LIBRARY_DIRS})
|
list(APPEND LIBRARY_DIRS ${FT2_LIBRARY_DIRS})
|
||||||
list(APPEND LIBRARIES ${FT2_LIBRARIES})
|
list(APPEND LIBRARIES ${FT2_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(MW_USE_WAYLAND)
|
if(MW_USE_WAYLAND)
|
||||||
function(scan_wayland_protocol_core)
|
function(scan_wayland_protocol_core)
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND wayland-scanner private-code /usr/share/wayland/wayland.xml ${CMAKE_CURRENT_SOURCE_DIR}/src/backend/wayland-core-protocol.c
|
COMMAND wayland-scanner private-code /usr/share/wayland/wayland.xml ${CMAKE_CURRENT_SOURCE_DIR}/src/backend/wayland-core-protocol.c
|
||||||
OUTPUT_VARIABLE WAYLAND_SCANNER_OUTPUT
|
OUTPUT_VARIABLE WAYLAND_SCANNER_OUTPUT
|
||||||
ERROR_VARIABLE WAYLAND_SCANNER_ERROR
|
ERROR_VARIABLE WAYLAND_SCANNER_ERROR
|
||||||
|
|
@ -154,12 +164,12 @@ if(MW_USE_WAYLAND)
|
||||||
ECHO_ERROR_VARIABLE
|
ECHO_ERROR_VARIABLE
|
||||||
COMMAND_ECHO STDOUT
|
COMMAND_ECHO STDOUT
|
||||||
)
|
)
|
||||||
target_sources(
|
target_sources(
|
||||||
Mw
|
Mw
|
||||||
PRIVATE
|
PRIVATE
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/src/backend/wayland-core-protocol.c
|
${CMAKE_CURRENT_SOURCE_DIR}/src/backend/wayland-core-protocol.c
|
||||||
)
|
)
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND wayland-scanner client-header /usr/share/wayland/wayland.xml ${CMAKE_CURRENT_SOURCE_DIR}/include/Mw/LowLevel/Wayland/wayland-core-protocol.h
|
COMMAND wayland-scanner client-header /usr/share/wayland/wayland.xml ${CMAKE_CURRENT_SOURCE_DIR}/include/Mw/LowLevel/Wayland/wayland-core-protocol.h
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
OUTPUT_VARIABLE WAYLAND_SCANNER_OUTPUT
|
OUTPUT_VARIABLE WAYLAND_SCANNER_OUTPUT
|
||||||
|
|
@ -168,11 +178,11 @@ if(MW_USE_WAYLAND)
|
||||||
ECHO_ERROR_VARIABLE
|
ECHO_ERROR_VARIABLE
|
||||||
COMMAND_ECHO STDOUT
|
COMMAND_ECHO STDOUT
|
||||||
)
|
)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
function(scan_wayland_protocol tier proto ver)
|
function(scan_wayland_protocol tier proto ver)
|
||||||
SET(proto_c ${CMAKE_CURRENT_SOURCE_DIR}/src/backend/wayland-${proto}-protocol.c)
|
SET(proto_c ${CMAKE_CURRENT_SOURCE_DIR}/src/backend/wayland-${proto}-protocol.c)
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND wayland-scanner private-code /usr/share/wayland-protocols/${tier}/${proto}/${proto}${ver}.xml ${proto_c}
|
COMMAND wayland-scanner private-code /usr/share/wayland-protocols/${tier}/${proto}/${proto}${ver}.xml ${proto_c}
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
OUTPUT_VARIABLE WAYLAND_SCANNER_OUTPUT
|
OUTPUT_VARIABLE WAYLAND_SCANNER_OUTPUT
|
||||||
|
|
@ -181,12 +191,12 @@ if(MW_USE_WAYLAND)
|
||||||
ECHO_ERROR_VARIABLE
|
ECHO_ERROR_VARIABLE
|
||||||
COMMAND_ECHO STDOUT
|
COMMAND_ECHO STDOUT
|
||||||
)
|
)
|
||||||
target_sources(
|
target_sources(
|
||||||
Mw
|
Mw
|
||||||
PRIVATE
|
PRIVATE
|
||||||
${proto_c}
|
${proto_c}
|
||||||
)
|
)
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND wayland-scanner client-header /usr/share/wayland-protocols/${tier}/${proto}/${proto}${ver}.xml ${CMAKE_CURRENT_SOURCE_DIR}/include/Mw/LowLevel/Wayland/${proto}-client-protocol.h
|
COMMAND wayland-scanner client-header /usr/share/wayland-protocols/${tier}/${proto}/${proto}${ver}.xml ${CMAKE_CURRENT_SOURCE_DIR}/include/Mw/LowLevel/Wayland/${proto}-client-protocol.h
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
OUTPUT_VARIABLE WAYLAND_SCANNER_OUTPUT
|
OUTPUT_VARIABLE WAYLAND_SCANNER_OUTPUT
|
||||||
|
|
@ -195,49 +205,49 @@ if(MW_USE_WAYLAND)
|
||||||
ECHO_ERROR_VARIABLE
|
ECHO_ERROR_VARIABLE
|
||||||
COMMAND_ECHO STDOUT
|
COMMAND_ECHO STDOUT
|
||||||
)
|
)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
check_include_files(wayland-client.h HAVE_WL_H)
|
check_include_files(wayland-client.h HAVE_WL_H)
|
||||||
check_include_files(xkbcommon/xkbcommon.h HAVE_XKBCOMMON_H)
|
check_include_files(xkbcommon/xkbcommon.h HAVE_XKBCOMMON_H)
|
||||||
check_include_files(cairo/cairo.h HAVE_CAIRO_H)
|
check_include_files(cairo/cairo.h HAVE_CAIRO_H)
|
||||||
if(HAVE_WL_H)
|
if(HAVE_WL_H)
|
||||||
if(HAVE_XKBCOMMON_H)
|
if(HAVE_XKBCOMMON_H)
|
||||||
if(HAVE_CAIRO_H)
|
if(HAVE_CAIRO_H)
|
||||||
scan_wayland_protocol_core()
|
scan_wayland_protocol_core()
|
||||||
scan_wayland_protocol("stable" "xdg-shell" "")
|
scan_wayland_protocol("stable" "xdg-shell" "")
|
||||||
scan_wayland_protocol("stable" "viewporter" "")
|
scan_wayland_protocol("stable" "viewporter" "")
|
||||||
scan_wayland_protocol("stable" "tablet" "-v2")
|
scan_wayland_protocol("stable" "tablet" "-v2")
|
||||||
scan_wayland_protocol("staging" "xdg-toplevel-icon" "-v1")
|
scan_wayland_protocol("staging" "xdg-toplevel-icon" "-v1")
|
||||||
scan_wayland_protocol("staging" "cursor-shape" "-v1")
|
scan_wayland_protocol("staging" "cursor-shape" "-v1")
|
||||||
scan_wayland_protocol("unstable" "xdg-decoration" "-unstable-v1")
|
scan_wayland_protocol("unstable" "xdg-decoration" "-unstable-v1")
|
||||||
scan_wayland_protocol("unstable" "primary-selection" "-unstable-v1")
|
scan_wayland_protocol("unstable" "primary-selection" "-unstable-v1")
|
||||||
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")
|
||||||
|
|
||||||
target_sources(
|
target_sources(
|
||||||
Mw
|
Mw
|
||||||
PRIVATE
|
PRIVATE
|
||||||
src/backend/wayland.c
|
src/backend/wayland.c
|
||||||
)
|
)
|
||||||
target_compile_definitions(
|
target_compile_definitions(
|
||||||
Mw
|
Mw
|
||||||
PRIVATE
|
PRIVATE
|
||||||
USE_WAYLAND
|
USE_WAYLAND
|
||||||
)
|
)
|
||||||
message(STATUS "Wayland backend has been enabled")
|
message(STATUS "Wayland backend has been enabled")
|
||||||
else()
|
else()
|
||||||
message(WARNING "Wayland backend has been disabled")
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
message(WARNING "Wayland backend has been disabled")
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
message(WARNING "Wayland backend has been disabled")
|
message(WARNING "Wayland backend has been disabled")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
message(WARNING "Wayland backend has been disabled")
|
||||||
endif()
|
endif()
|
||||||
|
else()
|
||||||
|
message(WARNING "Wayland backend has been disabled")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(APPLE AND MW_BUILD_OPENGL)
|
if(APPLE AND MW_BUILD_OPENGL)
|
||||||
target_compile_definitions(
|
target_compile_definitions(
|
||||||
Mw
|
Mw
|
||||||
PRIVATE
|
PRIVATE
|
||||||
GL_SILENCE_DEPRECATION
|
GL_SILENCE_DEPRECATION
|
||||||
|
|
@ -257,7 +267,7 @@ target_include_directories(
|
||||||
)
|
)
|
||||||
|
|
||||||
if(MW_CLASSIC_THEME)
|
if(MW_CLASSIC_THEME)
|
||||||
target_compile_definitions(
|
target_compile_definitions(
|
||||||
Mw
|
Mw
|
||||||
PRIVATE
|
PRIVATE
|
||||||
USE_CLASSIC_THEME
|
USE_CLASSIC_THEME
|
||||||
|
|
@ -265,60 +275,78 @@ if(MW_CLASSIC_THEME)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||||
target_sources(
|
target_sources(
|
||||||
Mw
|
Mw
|
||||||
PRIVATE
|
PRIVATE
|
||||||
src/backend/gdi.c
|
src/backend/gdi.c
|
||||||
)
|
)
|
||||||
target_compile_definitions(
|
target_compile_definitions(
|
||||||
Mw
|
Mw
|
||||||
PRIVATE
|
PRIVATE
|
||||||
USE_GDI
|
USE_GDI
|
||||||
)
|
)
|
||||||
list(APPEND LIBRARIES gdi32)
|
list(APPEND LIBRARIES gdi32)
|
||||||
target_link_options(
|
target_link_options(
|
||||||
Mw
|
Mw
|
||||||
PRIVATE
|
PRIVATE
|
||||||
-static-libgcc
|
-static-libgcc
|
||||||
)
|
)
|
||||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||||
target_sources(
|
target_sources(
|
||||||
Mw
|
Mw
|
||||||
PRIVATE
|
PRIVATE
|
||||||
src/backend/cocoa.m
|
src/backend/cocoa.m
|
||||||
)
|
)
|
||||||
target_compile_definitions(
|
target_compile_definitions(
|
||||||
Mw
|
Mw
|
||||||
PRIVATE
|
PRIVATE
|
||||||
USE_COCOA
|
USE_COCOA
|
||||||
)
|
)
|
||||||
list(APPEND LIBRARIES objc)
|
list(APPEND LIBRARIES objc)
|
||||||
target_link_options(
|
target_link_options(
|
||||||
Mw
|
Mw
|
||||||
PRIVATE
|
PRIVATE
|
||||||
-framework Cocoa
|
-framework Cocoa
|
||||||
)
|
)
|
||||||
else()
|
elseif(CMAKE_SYSTEM_NAME MATCHES "Retro")
|
||||||
find_package(PkgConfig)
|
target_sources(
|
||||||
pkg_check_modules(X11 REQUIRED x11)
|
Mw
|
||||||
pkg_check_modules(XRENDER REQUIRED xrender)
|
PRIVATE
|
||||||
|
src/backend/classicmacos.c
|
||||||
|
)
|
||||||
|
if(PLATFORM MATCHES retroppc)
|
||||||
|
endif()
|
||||||
|
if(PLATFORM MATCHES retroppc)
|
||||||
|
set_target_properties(Mw PROPERTIES COMPILE_FLAGS "-ffunction-sections -mcpu=601 -Os -Wall -Wextra -Wno-unused-parameter")
|
||||||
|
set_target_properties(Mw PROPERTIES LINK_FLAGS "-Wl,-gc-sections")
|
||||||
|
endif()
|
||||||
|
|
||||||
target_sources(
|
target_compile_definitions(
|
||||||
|
Mw
|
||||||
|
PRIVATE
|
||||||
|
CLASSIC_MAC_OS
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
find_package(PkgConfig)
|
||||||
|
pkg_check_modules(X11 REQUIRED x11)
|
||||||
|
pkg_check_modules(XRENDER REQUIRED xrender)
|
||||||
|
|
||||||
|
target_sources(
|
||||||
Mw
|
Mw
|
||||||
PRIVATE
|
PRIVATE
|
||||||
src/backend/x11.c
|
src/backend/x11.c
|
||||||
)
|
)
|
||||||
target_compile_definitions(
|
target_compile_definitions(
|
||||||
Mw
|
Mw
|
||||||
PRIVATE
|
PRIVATE
|
||||||
USE_X11
|
USE_X11
|
||||||
)
|
)
|
||||||
list(APPEND INCLUDE_DIRS ${X11_INCLUDE_DIRS} ${XRENDER_INCLUDE_DIRS})
|
list(APPEND INCLUDE_DIRS ${X11_INCLUDE_DIRS} ${XRENDER_INCLUDE_DIRS})
|
||||||
list(APPEND LIBRARY_DIRS ${X11_LIBRARY_DIRS} ${XRENDER_LIBRARY_DIRS})
|
list(APPEND LIBRARY_DIRS ${X11_LIBRARY_DIRS} ${XRENDER_LIBRARY_DIRS})
|
||||||
list(APPEND LIBRARIES ${X11_LIBRARIES} ${XRENDER_LIBRARIES} m)
|
list(APPEND LIBRARIES ${X11_LIBRARIES} ${XRENDER_LIBRARIES} m)
|
||||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
list(APPEND LIBRARIES dl)
|
list(APPEND LIBRARIES dl)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_include_directories(
|
target_include_directories(
|
||||||
|
|
@ -338,14 +366,14 @@ target_link_libraries(
|
||||||
)
|
)
|
||||||
|
|
||||||
if(MW_BUILD_VULKAN)
|
if(MW_BUILD_VULKAN)
|
||||||
check_include_files(vulkan/vk_enum_string_helper.h HAS_VK_ENUM_STRING_HELPER)
|
check_include_files(vulkan/vk_enum_string_helper.h HAS_VK_ENUM_STRING_HELPER)
|
||||||
if(HAS_VK_ENUM_STRING_HELPER)
|
if(HAS_VK_ENUM_STRING_HELPER)
|
||||||
target_compile_definitions(
|
target_compile_definitions(
|
||||||
Mw
|
Mw
|
||||||
PRIVATE
|
PRIVATE
|
||||||
HAS_VK_ENUM_STRING_HELPER
|
HAS_VK_ENUM_STRING_HELPER
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_compile_definitions(
|
target_compile_definitions(
|
||||||
|
|
@ -362,7 +390,7 @@ install(
|
||||||
)
|
)
|
||||||
|
|
||||||
if(MW_INSTALL_HEADERS)
|
if(MW_INSTALL_HEADERS)
|
||||||
install(
|
install(
|
||||||
DIRECTORY include/
|
DIRECTORY include/
|
||||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||||
FILES_MATCHING PATTERN "*.h"
|
FILES_MATCHING PATTERN "*.h"
|
||||||
|
|
@ -370,5 +398,5 @@ if(MW_INSTALL_HEADERS)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(MW_BUILD_EXAMPLES)
|
if(MW_BUILD_EXAMPLES)
|
||||||
add_subdirectory(examples)
|
add_subdirectory(examples)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
||||||
50
configure
vendored
50
configure
vendored
|
|
@ -47,13 +47,6 @@ param_set("static", 1);
|
||||||
param_set("examples", 1);
|
param_set("examples", 1);
|
||||||
|
|
||||||
|
|
||||||
if($target ne "Darwin") {
|
|
||||||
param_set("freetype2", 1);
|
|
||||||
param_set("stb-truetype", 0);
|
|
||||||
} else {
|
|
||||||
param_set("stb-truetype", 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
my %features = (
|
my %features = (
|
||||||
"classic-theme" => "use classic theme",
|
"classic-theme" => "use classic theme",
|
||||||
"stb-image" => "use stb_image, instead use libjpeg/libpng",
|
"stb-image" => "use stb_image, instead use libjpeg/libpng",
|
||||||
|
|
@ -77,13 +70,6 @@ my @features_keys = (
|
||||||
"1wayland", "1gnustep",
|
"1wayland", "1gnustep",
|
||||||
);
|
);
|
||||||
|
|
||||||
if($target eq "Linux") {
|
|
||||||
param_set("x11", 1);
|
|
||||||
if(!param_get("tiny")){
|
|
||||||
param_set("wayland", 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach my $l (@ARGV) {
|
foreach my $l (@ARGV) {
|
||||||
if ($l =~ /^--with-([^=]+)=(.+)$/) {
|
if ($l =~ /^--with-([^=]+)=(.+)$/) {
|
||||||
param_set($1, $2);
|
param_set($1, $2);
|
||||||
|
|
@ -146,6 +132,21 @@ foreach my $l (@ARGV) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($target ne "Darwin" and $target ne "ClassicMacOS") {
|
||||||
|
param_set("freetype2", 1);
|
||||||
|
param_set("stb-truetype", 0);
|
||||||
|
} else {
|
||||||
|
param_set("freetype2", 0);
|
||||||
|
param_set("stb-truetype", 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if($target eq "Linux") {
|
||||||
|
param_set("x11", 1);
|
||||||
|
if(!param_get("tiny")){
|
||||||
|
param_set("wayland", 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (-f "./pl/ostype/${target}.pl") {
|
if (-f "./pl/ostype/${target}.pl") {
|
||||||
require("./pl/ostype/${target}.pl");
|
require("./pl/ostype/${target}.pl");
|
||||||
}
|
}
|
||||||
|
|
@ -274,9 +275,15 @@ if (param_get("examples")) {
|
||||||
$libs = $examples_libs{$l};
|
$libs = $examples_libs{$l};
|
||||||
}
|
}
|
||||||
|
|
||||||
print(OUT
|
if (param_get("shared")) {
|
||||||
"${l}: ${s}${object_suffix} src/${library_prefix}Mw${library_suffix}\n"
|
print(OUT
|
||||||
);
|
"${l}: ${s}${object_suffix} src/${library_prefix}Mw${library_suffix}\n"
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
print(OUT
|
||||||
|
"${l}: ${s}${object_suffix} src/${library_prefix}Mw.a\n"
|
||||||
|
);
|
||||||
|
}
|
||||||
if (grep(/^cocoa$/, @backends)) {
|
if (grep(/^cocoa$/, @backends)) {
|
||||||
print(OUT
|
print(OUT
|
||||||
" \$(CC) -L./src \$\(LIBDIR) -o ${l} ${s}${object_suffix} -lMw ${math} ${libs}\n"
|
" \$(CC) -L./src \$\(LIBDIR) -o ${l} ${s}${object_suffix} -lMw ${math} ${libs}\n"
|
||||||
|
|
@ -287,6 +294,15 @@ if (param_get("examples")) {
|
||||||
" \$(CC) -L src -Wl,-R./src \$\(LIBDIR) -o ${l} ${s}${object_suffix} -lMw ${math} ${libs}\n"
|
" \$(CC) -L src -Wl,-R./src \$\(LIBDIR) -o ${l} ${s}${object_suffix} -lMw ${math} ${libs}\n"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($target eq "ClassicMacOS") {
|
||||||
|
print(OUT
|
||||||
|
" ".$ENV{RETRO68_TOOLCHAIN_PATH}."/bin/MakePEF ${l} -o ${s}.pef\n");
|
||||||
|
print(OUT
|
||||||
|
" Rez -I ".$ENV{RETRO68_TOOLCHAIN_PATH}."/RIncludes ".$ENV{RETRO68_TOOLCHAIN_PATH}."/RIncludes/Retro68APPL.r -DCFRAG_NAME=\"example\" --data ${l}.pef --cc ${l}.dsk -t APPL\n"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
print(OUT "${s}${object_suffix}: ${s}.c\n");
|
print(OUT "${s}${object_suffix}: ${s}.c\n");
|
||||||
print(OUT
|
print(OUT
|
||||||
" \$(CC) -c \$\(INCDIR) -o ${s}${object_suffix} ${s}.c -lMw ${math}\n"
|
" \$(CC) -c \$\(INCDIR) -o ${s}${object_suffix} ${s}.c -lMw ${math}\n"
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,26 @@
|
||||||
file(
|
file(
|
||||||
GLOB
|
GLOB
|
||||||
EXAMPLES_BASIC_SOURCES
|
EXAMPLES_BASIC_SOURCES
|
||||||
*.c
|
*.c
|
||||||
)
|
)
|
||||||
|
|
||||||
foreach(PATH IN LISTS EXAMPLES_BASIC_SOURCES)
|
foreach(PATH IN LISTS EXAMPLES_BASIC_SOURCES)
|
||||||
get_filename_component(TARGET ${PATH} NAME_WE)
|
get_filename_component(TARGET ${PATH} NAME_WE)
|
||||||
add_executable(${TARGET} MACOSX_BUNDLE ${PATH})
|
if(CMAKE_SYSTEM_NAME MATCHES Retro)
|
||||||
target_link_libraries(
|
add_application(${TARGET} ${PATH})
|
||||||
${TARGET}
|
else()
|
||||||
PRIVATE
|
add_executable(${TARGET} MACOSX_BUNDLE ${PATH})
|
||||||
Mw
|
endif()
|
||||||
)
|
target_link_libraries(
|
||||||
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
${TARGET}
|
||||||
target_link_libraries(
|
PRIVATE
|
||||||
${TARGET}
|
Mw
|
||||||
PRIVATE
|
)
|
||||||
m
|
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||||
)
|
target_link_libraries(
|
||||||
endif()
|
${TARGET}
|
||||||
|
PRIVATE
|
||||||
|
m
|
||||||
|
)
|
||||||
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
|
||||||
|
|
@ -106,6 +106,9 @@ MWDECL void MwLLDBusFreeContext(MwLLDBusFuncTable* tbl, MwLLDBusContext* ctx);
|
||||||
#ifdef USE_COCOA
|
#ifdef USE_COCOA
|
||||||
#include <Mw/LowLevel/Cocoa.h>
|
#include <Mw/LowLevel/Cocoa.h>
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef CLASSIC_MAC_OS
|
||||||
|
#include <Mw/LowLevel/ClassicMacOS.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
union _MwLL {
|
union _MwLL {
|
||||||
struct _MwLLCommon common;
|
struct _MwLLCommon common;
|
||||||
|
|
@ -121,6 +124,9 @@ union _MwLL {
|
||||||
#ifdef USE_COCOA
|
#ifdef USE_COCOA
|
||||||
struct _MwLLCocoa cocoa;
|
struct _MwLLCocoa cocoa;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef CLASSIC_MAC_OS
|
||||||
|
struct _MwLLClassicMacOS cmacos;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
union _MwLLColor {
|
union _MwLLColor {
|
||||||
|
|
|
||||||
31
include/Mw/LowLevel/ClassicMacOS.h
Normal file
31
include/Mw/LowLevel/ClassicMacOS.h
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
/*!
|
||||||
|
* @file Mw/LowLevel/ClassicMacOS.h
|
||||||
|
* @brief ClassicMacOS Backend
|
||||||
|
* @warning This is used internally
|
||||||
|
*/
|
||||||
|
#ifndef __MW_LOWLEVEL_ClassicMacOS_H__
|
||||||
|
#define __MW_LOWLEVEL_ClassicMacOS_H__
|
||||||
|
|
||||||
|
#include <Mw/MachDep.h>
|
||||||
|
#include <Mw/TypeDefs.h>
|
||||||
|
#include <Mw/LowLevel.h>
|
||||||
|
|
||||||
|
struct _MwLLClassicMacOS {
|
||||||
|
struct _MwLLCommon common;
|
||||||
|
|
||||||
|
WindowRef window;
|
||||||
|
EventRecord event;
|
||||||
|
Rect winRect;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _MwLLClassicMacOSColor {
|
||||||
|
struct _MwLLCommonColor common;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _MwLLClassicMacOSPixmap {
|
||||||
|
struct _MwLLCommonPixmap common;
|
||||||
|
};
|
||||||
|
|
||||||
|
MWDECL int MwLLClassicMacOSCallInit(void);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
@ -37,17 +37,28 @@
|
||||||
#define GET_WHEEL_DELTA_WPARAM(x) ((short)HIWORD(x))
|
#define GET_WHEEL_DELTA_WPARAM(x) ((short)HIWORD(x))
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
#elif defined(CLASSIC_MAC_OS)
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <MacTypes.h>
|
||||||
|
#include <CFBundle.h>
|
||||||
|
#include <CodeFragments.h>
|
||||||
|
#include <Timer.h>
|
||||||
|
#include <MacWindows.h>
|
||||||
|
#include <TextEdit.h>
|
||||||
|
#include <Dialogs.h>
|
||||||
#else
|
#else
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#include <dlfcn.h>
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <dirent.h>
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __unix__
|
||||||
|
#include <dirent.h>
|
||||||
|
#include <dlfcn.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
#include <mach/clock.h>
|
#include <mach/clock.h>
|
||||||
#include <mach/mach.h>
|
#include <mach/mach.h>
|
||||||
|
|
|
||||||
10
pl/ostype/ClassicMacOS.pl
Normal file
10
pl/ostype/ClassicMacOS.pl
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
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.")
|
||||||
|
|
||||||
|
$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");
|
||||||
|
|
||||||
|
1;
|
||||||
|
|
@ -30,6 +30,13 @@ if (grep(/^gdi$/, @backends)) {
|
||||||
$gl_libs = "-lopengl32 -lglu32";
|
$gl_libs = "-lopengl32 -lglu32";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (grep(/^classicmacos$/, @backends)) {
|
||||||
|
#add_cflags("-DCLASSIC_MAC_OS");
|
||||||
|
new_object("src/backend/classicmacos.c");
|
||||||
|
|
||||||
|
$gl_libs = "";
|
||||||
|
}
|
||||||
|
|
||||||
if (grep(/^wayland$/, @backends)) {
|
if (grep(/^wayland$/, @backends)) {
|
||||||
add_cflags("-DUSE_WAYLAND");
|
add_cflags("-DUSE_WAYLAND");
|
||||||
new_object("src/backend/wayland.c");
|
new_object("src/backend/wayland.c");
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,10 @@ typedef struct dir {
|
||||||
WIN32_FIND_DATA ffd;
|
WIN32_FIND_DATA ffd;
|
||||||
int next;
|
int next;
|
||||||
} dir_t;
|
} dir_t;
|
||||||
|
#elif defined(CLASSIC_MAC_OS)
|
||||||
|
typedef struct dir {
|
||||||
|
int dummy;
|
||||||
|
} dir_t;
|
||||||
#else
|
#else
|
||||||
typedef struct dir {
|
typedef struct dir {
|
||||||
DIR* dir;
|
DIR* dir;
|
||||||
|
|
@ -31,6 +35,8 @@ void* MwDirectoryOpen(const char* path) {
|
||||||
}
|
}
|
||||||
free(p);
|
free(p);
|
||||||
dir->next = 1;
|
dir->next = 1;
|
||||||
|
#elif defined(CLASSIC_MAC_OS)
|
||||||
|
/* todo */
|
||||||
#else
|
#else
|
||||||
if((dir->dir = opendir(path)) == NULL) {
|
if((dir->dir = opendir(path)) == NULL) {
|
||||||
free(dir);
|
free(dir);
|
||||||
|
|
@ -47,6 +53,8 @@ void MwDirectoryClose(void* handle) {
|
||||||
dir_t* dir = handle;
|
dir_t* dir = handle;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
FindClose(dir->hFind);
|
FindClose(dir->hFind);
|
||||||
|
#elif defined(CLASSIC_MAC_OS)
|
||||||
|
/* todo */
|
||||||
#else
|
#else
|
||||||
closedir(dir->dir);
|
closedir(dir->dir);
|
||||||
free(dir->base);
|
free(dir->base);
|
||||||
|
|
@ -80,6 +88,8 @@ MwDirectoryEntry* MwDirectoryRead(void* handle) {
|
||||||
entry->mtime = l->QuadPart / 10000000 - 11644473600;
|
entry->mtime = l->QuadPart / 10000000 - 11644473600;
|
||||||
|
|
||||||
dir->next = FindNextFile(dir->hFind, &dir->ffd);
|
dir->next = FindNextFile(dir->hFind, &dir->ffd);
|
||||||
|
#elif defined(CLASSIC_MAC_OS)
|
||||||
|
/* todo */
|
||||||
#else
|
#else
|
||||||
struct dirent* d;
|
struct dirent* d;
|
||||||
struct stat s;
|
struct stat s;
|
||||||
|
|
@ -123,6 +133,8 @@ char* MwDirectoryCurrent(void) {
|
||||||
GetCurrentDirectory(len, out);
|
GetCurrentDirectory(len, out);
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
|
#elif CLASSIC_MAC_OS
|
||||||
|
return "";
|
||||||
#else
|
#else
|
||||||
return getcwd(NULL, 0);
|
return getcwd(NULL, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,36 @@ void* MwDynamicSymbol(void* handle, const char* symbol) {
|
||||||
void MwDynamicClose(void* handle) {
|
void MwDynamicClose(void* handle) {
|
||||||
FreeLibrary(handle);
|
FreeLibrary(handle);
|
||||||
}
|
}
|
||||||
|
#elif defined(CLASSIC_MAC_OS)
|
||||||
|
void* MwDynamicOpen(const char* path) {
|
||||||
|
CFragConnectionID connID;
|
||||||
|
Ptr* addr;
|
||||||
|
unsigned char err[255];
|
||||||
|
|
||||||
|
if(GetSharedLibrary((ConstStr63Param)path, kPowerPCCFragArch, kPrivateCFragCopy,
|
||||||
|
&connID, addr, err)) {
|
||||||
|
printf("Error getting %s: %s\n", path, err);
|
||||||
|
return NULL;
|
||||||
|
};
|
||||||
|
return connID;
|
||||||
|
}
|
||||||
|
|
||||||
|
void* MwDynamicSymbol(void* handle, const char* symbol) {
|
||||||
|
CFragConnectionID connID = (CFragConnectionID)handle;
|
||||||
|
Ptr* symAddr;
|
||||||
|
CFragSymbolClass* symClass;
|
||||||
|
OSErr err;
|
||||||
|
if((err = FindSymbol(connID, (ConstStr63Param)symbol, symAddr, symClass))) {
|
||||||
|
printf("Error getting %s: %d\n", symbol, err);
|
||||||
|
return NULL;
|
||||||
|
};
|
||||||
|
return symAddr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MwDynamicClose(void* handle) {
|
||||||
|
CFragConnectionID connID = (CFragConnectionID)handle;
|
||||||
|
CloseConnection(&connID);
|
||||||
|
}
|
||||||
#elif defined(__unix__) || defined(__APPLE__)
|
#elif defined(__unix__) || defined(__APPLE__)
|
||||||
void* MwDynamicOpen(const char* path) {
|
void* MwDynamicOpen(const char* path) {
|
||||||
return dlopen(path, RTLD_LOCAL | RTLD_LAZY);
|
return dlopen(path, RTLD_LOCAL | RTLD_LAZY);
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,27 @@ void MwTimeSleep(int ms) {
|
||||||
|
|
||||||
nanosleep(&ts, NULL);
|
nanosleep(&ts, NULL);
|
||||||
}
|
}
|
||||||
|
#elif defined(CLASSIC_MAC_OS)
|
||||||
|
static TMTask tm;
|
||||||
|
static int timer;
|
||||||
|
void timerUpdateFunc(void) {
|
||||||
|
timer += 1;
|
||||||
|
PrimeTime((QElemPtr)&tm, 1);
|
||||||
|
};
|
||||||
|
|
||||||
|
long MwTimeGetTick(void) {
|
||||||
|
UnsignedWide h;
|
||||||
|
Microseconds(&h);
|
||||||
|
return *(long*)&h;
|
||||||
|
}
|
||||||
|
void MwTimeSleep(int ms) {
|
||||||
|
tm.tmAddr = NewTimerProc(timerUpdateFunc);
|
||||||
|
tm.tmWakeUp = 0;
|
||||||
|
tm.tmReserved = 0;
|
||||||
|
|
||||||
|
InsTime((QElemPtr)&tm);
|
||||||
|
PrimeTime((QElemPtr)&tm, 1);
|
||||||
|
}
|
||||||
#elif defined(__unix__)
|
#elif defined(__unix__)
|
||||||
long MwTimeGetTick(void) {
|
long MwTimeGetTick(void) {
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
|
|
|
||||||
175
src/backend/classicmacos.c
Normal file
175
src/backend/classicmacos.c
Normal file
|
|
@ -0,0 +1,175 @@
|
||||||
|
#include <Mw/Milsko.h>
|
||||||
|
|
||||||
|
#include "../../external/stb_ds.h"
|
||||||
|
|
||||||
|
static MwLL MwLLCreateImpl(MwLL parent, int x, int y, int width, int height) {
|
||||||
|
MwLL r;
|
||||||
|
|
||||||
|
MwLLCreateCommon(r);
|
||||||
|
|
||||||
|
SetRect(&r->cmacos.winRect, 100, 100, width, height);
|
||||||
|
|
||||||
|
r->cmacos.window = NewCWindow(nil, &r->cmacos.winRect, (ConstStr255Param) "\p", true,
|
||||||
|
documentProc, (WindowPtr)(-1), true, 0);
|
||||||
|
|
||||||
|
SetPort(r->cmacos.window);
|
||||||
|
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLDestroyImpl(MwLL handle) {
|
||||||
|
MwLLDestroyCommon(handle);
|
||||||
|
|
||||||
|
free(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLBeginDrawImpl(MwLL handle) {
|
||||||
|
(void)handle;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLEndDrawImpl(MwLL handle) {
|
||||||
|
(void)handle;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLPolygonImpl(MwLL handle, MwPoint* points, int points_count, MwLLColor color) {
|
||||||
|
int i;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLLineImpl(MwLL handle, MwPoint* points, MwLLColor color) {
|
||||||
|
}
|
||||||
|
|
||||||
|
static MwLLColor MwLLAllocColorImpl(MwLL handle, int r, int g, int b) {
|
||||||
|
MwLLColor c = malloc(sizeof(*c));
|
||||||
|
MwLLColorUpdate(handle, c, r, g, b);
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLColorUpdateImpl(MwLL handle, MwLLColor c, int r, int g, int b) {
|
||||||
|
c->common.red = r;
|
||||||
|
c->common.green = g;
|
||||||
|
c->common.blue = b;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLGetXYWHImpl(MwLL handle, int* x, int* y, unsigned int* w, unsigned int* h) {
|
||||||
|
*x = 0;
|
||||||
|
*y = 0;
|
||||||
|
*w = 0;
|
||||||
|
*h = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLSetXYImpl(MwLL handle, int x, int y) {
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLSetWHImpl(MwLL handle, int w, int h) {
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLFreeColorImpl(MwLLColor color) {
|
||||||
|
free(color);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int MwLLPendingImpl(MwLL handle) {
|
||||||
|
return GetNextEvent(everyEvent, &handle->cmacos.event);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLNextEventImpl(MwLL handle) {
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLSetTitleImpl(MwLL handle, const char* title) {
|
||||||
|
}
|
||||||
|
|
||||||
|
static MwLLPixmap MwLLCreatePixmapImpl(MwLL handle, unsigned char* data, int width, int height) {
|
||||||
|
MwLLPixmap r = malloc(sizeof(*r));
|
||||||
|
|
||||||
|
r->common.raw = malloc(4 * width * height);
|
||||||
|
memcpy(r->common.raw, data, 4 * width * height);
|
||||||
|
|
||||||
|
MwLLPixmapUpdate(r);
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLPixmapUpdateImpl(MwLLPixmap r) {
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLDestroyPixmapImpl(MwLLPixmap pixmap) {
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLDrawPixmapImpl(MwLL handle, MwRect* rect, MwLLPixmap pixmap) {
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLSetIconImpl(MwLL handle, MwLLPixmap pixmap) {
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLForceRenderImpl(MwLL handle) {
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLSetCursorImpl(MwLL handle, MwCursor* image, MwCursor* mask) {
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLDetachImpl(MwLL handle, MwPoint* point) {
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLShowImpl(MwLL handle, int show) {
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLMakePopupImpl(MwLL handle, MwLL parent) {
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLSetSizeHintsImpl(MwLL handle, int minx, int miny, int maxx, int maxy) {
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLMakeBorderlessImpl(MwLL handle, int toggle) {
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLFocusImpl(MwLL handle) {
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLGrabPointerImpl(MwLL handle, int toggle) {
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLSetClipboardImpl(MwLL handle, const char* text) {
|
||||||
|
/* TODO */
|
||||||
|
|
||||||
|
(void)handle;
|
||||||
|
(void)text;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLGetClipboardImpl(MwLL handle) {
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLMakeToolWindowImpl(MwLL handle) {
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLGetCursorCoordImpl(MwLL handle, MwPoint* point) {
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLGetScreenSizeImpl(MwLL handle, MwRect* rect) {
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLBeginStateChangeImpl(MwLL handle) {
|
||||||
|
MwLLShow(handle, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLEndStateChangeImpl(MwLL handle) {
|
||||||
|
MwLLShow(handle, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void MwLLSetDarkThemeImpl(MwLL handle, int toggle) {
|
||||||
|
(void)handle;
|
||||||
|
(void)toggle;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int MwLLClassicMacOSCallInitImpl(void) {
|
||||||
|
InitGraf(&qd.thePort);
|
||||||
|
InitFonts();
|
||||||
|
FlushEvents(everyEvent, 0);
|
||||||
|
InitWindows();
|
||||||
|
InitMenus();
|
||||||
|
TEInit();
|
||||||
|
InitDialogs(0L);
|
||||||
|
InitCursor();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "call.c"
|
||||||
|
CALL(ClassicMacOS);
|
||||||
|
|
@ -53,7 +53,7 @@ static void destroy(MwWidget handle) {
|
||||||
MwDestroyWidget(handle);
|
MwDestroyWidget(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cancel(MwWidget handle, void* user, void* call) {
|
static void filecancel(MwWidget handle, void* user, void* call) {
|
||||||
(void)user;
|
(void)user;
|
||||||
(void)call;
|
(void)call;
|
||||||
|
|
||||||
|
|
@ -147,7 +147,7 @@ static void nav_activate(MwWidget handle, void* user, void* call) {
|
||||||
(void)user;
|
(void)user;
|
||||||
|
|
||||||
if(strcmp(e, "Home") == 0) {
|
if(strcmp(e, "Home") == 0) {
|
||||||
#ifdef _WIN32
|
#if defined(_WIN32) || defined(CLASSIC_MAC_OS)
|
||||||
#else
|
#else
|
||||||
struct passwd* p = getpwuid(getuid());
|
struct passwd* p = getpwuid(getuid());
|
||||||
|
|
||||||
|
|
@ -383,7 +383,7 @@ static void layout(MwWidget handle) {
|
||||||
MwNtext, "Cancel",
|
MwNtext, "Cancel",
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
MwAddUserHandler(fc->cancel, MwNactivateHandler, cancel, NULL);
|
MwAddUserHandler(fc->cancel, MwNactivateHandler, filecancel, NULL);
|
||||||
} else {
|
} else {
|
||||||
MwVaApply(fc->cancel,
|
MwVaApply(fc->cancel,
|
||||||
MwNx, wx,
|
MwNx, wx,
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
#include "../../external/stb_ds.h"
|
#include "../../external/stb_ds.h"
|
||||||
|
|
||||||
static int create(MwWidget handle) {
|
static int wcreate(MwWidget handle) {
|
||||||
MwBox b = malloc(sizeof(*b));
|
MwBox b = malloc(sizeof(*b));
|
||||||
memset(b, 0, sizeof(*b));
|
memset(b, 0, sizeof(*b));
|
||||||
|
|
||||||
|
|
@ -135,7 +135,7 @@ static void children_update(MwWidget handle) {
|
||||||
}
|
}
|
||||||
|
|
||||||
MwClassRec MwBoxClassRec = {
|
MwClassRec MwBoxClassRec = {
|
||||||
create, /* create */
|
wcreate, /* create */
|
||||||
destroy, /* destroy */
|
destroy, /* destroy */
|
||||||
draw, /* draw */
|
draw, /* draw */
|
||||||
NULL, /* click */
|
NULL, /* click */
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
#include "../../external/stb_ds.h"
|
#include "../../external/stb_ds.h"
|
||||||
|
|
||||||
static int create(MwWidget handle) {
|
static int wcreate(MwWidget handle) {
|
||||||
MwSetDefault(handle);
|
MwSetDefault(handle);
|
||||||
|
|
||||||
MwSetInteger(handle, MwNflat, 0);
|
MwSetInteger(handle, MwNflat, 0);
|
||||||
|
|
@ -93,7 +93,7 @@ static void prop_change(MwWidget handle, const char* key) {
|
||||||
}
|
}
|
||||||
|
|
||||||
MwClassRec MwButtonClassRec = {
|
MwClassRec MwButtonClassRec = {
|
||||||
create, /* create */
|
wcreate, /* create */
|
||||||
NULL, /* destroy */
|
NULL, /* destroy */
|
||||||
draw, /* draw */
|
draw, /* draw */
|
||||||
click, /* click */
|
click, /* click */
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include <Mw/Milsko.h>
|
#include <Mw/Milsko.h>
|
||||||
|
|
||||||
static int create(MwWidget handle) {
|
static int wcreate(MwWidget handle) {
|
||||||
MwSetDefault(handle);
|
MwSetDefault(handle);
|
||||||
|
|
||||||
MwSetInteger(handle, MwNchecked, 0);
|
MwSetInteger(handle, MwNchecked, 0);
|
||||||
|
|
@ -38,7 +38,7 @@ static void prop_change(MwWidget handle, const char* key) {
|
||||||
}
|
}
|
||||||
|
|
||||||
MwClassRec MwCheckBoxClassRec = {
|
MwClassRec MwCheckBoxClassRec = {
|
||||||
create, /* create */
|
wcreate, /* create */
|
||||||
NULL, /* destroy */
|
NULL, /* destroy */
|
||||||
draw, /* draw */
|
draw, /* draw */
|
||||||
click, /* click */
|
click, /* click */
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
#include "../../external/stb_ds.h"
|
#include "../../external/stb_ds.h"
|
||||||
|
|
||||||
static int create(MwWidget handle) {
|
static int wcreate(MwWidget handle) {
|
||||||
MwComboBox cb = malloc(sizeof(*cb));
|
MwComboBox cb = malloc(sizeof(*cb));
|
||||||
|
|
||||||
cb->list = NULL;
|
cb->list = NULL;
|
||||||
|
|
@ -189,7 +189,7 @@ static void func_handler(MwWidget handle, const char* name, void* out, va_list v
|
||||||
}
|
}
|
||||||
|
|
||||||
MwClassRec MwComboBoxClassRec = {
|
MwClassRec MwComboBoxClassRec = {
|
||||||
create, /* create */
|
wcreate, /* create */
|
||||||
destroy, /* destroy */
|
destroy, /* destroy */
|
||||||
draw, /* draw */
|
draw, /* draw */
|
||||||
click, /* click */
|
click, /* click */
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include <Mw/Milsko.h>
|
#include <Mw/Milsko.h>
|
||||||
|
|
||||||
static int create(MwWidget handle) {
|
static int wcreate(MwWidget handle) {
|
||||||
MwEntry t = malloc(sizeof(*t));
|
MwEntry t = malloc(sizeof(*t));
|
||||||
|
|
||||||
t->cursor = 0;
|
t->cursor = 0;
|
||||||
|
|
@ -172,7 +172,7 @@ static void clipboard(MwWidget handle, const char* data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
MwClassRec MwEntryClassRec = {
|
MwClassRec MwEntryClassRec = {
|
||||||
create, /* create */
|
wcreate, /* create */
|
||||||
destroy, /* destroy */
|
destroy, /* destroy */
|
||||||
draw, /* draw */
|
draw, /* draw */
|
||||||
NULL, /* click */
|
NULL, /* click */
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include <Mw/Milsko.h>
|
#include <Mw/Milsko.h>
|
||||||
|
|
||||||
static int create(MwWidget handle) {
|
static int wcreate(MwWidget handle) {
|
||||||
MwSetDefault(handle);
|
MwSetDefault(handle);
|
||||||
|
|
||||||
MwSetInteger(handle, MwNhasBorder, 0);
|
MwSetInteger(handle, MwNhasBorder, 0);
|
||||||
|
|
@ -46,7 +46,7 @@ static void prop_change(MwWidget handle, const char* key) {
|
||||||
}
|
}
|
||||||
|
|
||||||
MwClassRec MwFrameClassRec = {
|
MwClassRec MwFrameClassRec = {
|
||||||
create, /* create */
|
wcreate, /* create */
|
||||||
NULL, /* destroy */
|
NULL, /* destroy */
|
||||||
draw, /* draw */
|
draw, /* draw */
|
||||||
NULL, /* click */
|
NULL, /* click */
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include <Mw/Milsko.h>
|
#include <Mw/Milsko.h>
|
||||||
|
|
||||||
static int create(MwWidget handle) {
|
static int wcreate(MwWidget handle) {
|
||||||
MwSetDefault(handle);
|
MwSetDefault(handle);
|
||||||
|
|
||||||
MwSetInteger(handle, MwNhasBorder, 0);
|
MwSetInteger(handle, MwNhasBorder, 0);
|
||||||
|
|
@ -42,7 +42,7 @@ static void prop_change(MwWidget handle, const char* key) {
|
||||||
}
|
}
|
||||||
|
|
||||||
MwClassRec MwImageClassRec = {
|
MwClassRec MwImageClassRec = {
|
||||||
create, /* create */
|
wcreate, /* create */
|
||||||
NULL, /* destroy */
|
NULL, /* destroy */
|
||||||
draw, /* draw */
|
draw, /* draw */
|
||||||
NULL, /* click */
|
NULL, /* click */
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
#define Spacing 1
|
#define Spacing 1
|
||||||
|
|
||||||
static int create(MwWidget handle) {
|
static int wcreate(MwWidget handle) {
|
||||||
MwLabel lab = malloc(sizeof(*lab));
|
MwLabel lab = malloc(sizeof(*lab));
|
||||||
|
|
||||||
lab->segment = NULL;
|
lab->segment = NULL;
|
||||||
|
|
@ -360,7 +360,7 @@ static void func_handler(MwWidget handle, const char* name, void* out, va_list v
|
||||||
}
|
}
|
||||||
|
|
||||||
MwClassRec MwLabelClassRec = {
|
MwClassRec MwLabelClassRec = {
|
||||||
create, /* create */
|
wcreate, /* create */
|
||||||
destroy, /* destroy */
|
destroy, /* destroy */
|
||||||
draw, /* draw */
|
draw, /* draw */
|
||||||
NULL, /* click */
|
NULL, /* click */
|
||||||
|
|
|
||||||
|
|
@ -347,7 +347,7 @@ static void resize(MwWidget handle) {
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int create(MwWidget handle) {
|
static int wcreate(MwWidget handle) {
|
||||||
MwListBox lb = malloc(sizeof(*lb));
|
MwListBox lb = malloc(sizeof(*lb));
|
||||||
memset(lb, 0, sizeof(*lb));
|
memset(lb, 0, sizeof(*lb));
|
||||||
|
|
||||||
|
|
@ -595,7 +595,7 @@ static void tick(MwWidget handle) {
|
||||||
}
|
}
|
||||||
|
|
||||||
MwClassRec MwListBoxClassRec = {
|
MwClassRec MwListBoxClassRec = {
|
||||||
create, /* create */
|
wcreate, /* create */
|
||||||
destroy, /* destroy */
|
destroy, /* destroy */
|
||||||
draw, /* draw */
|
draw, /* draw */
|
||||||
NULL, /* click */
|
NULL, /* click */
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ static void set_xywh(MwWidget handle) {
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int create(MwWidget handle) {
|
static int wcreate(MwWidget handle) {
|
||||||
MwMenu m = malloc(sizeof(*m));
|
MwMenu m = malloc(sizeof(*m));
|
||||||
|
|
||||||
m->name = NULL;
|
m->name = NULL;
|
||||||
|
|
@ -189,7 +189,7 @@ static void func_handler(MwWidget handle, const char* name, void* out, va_list v
|
||||||
}
|
}
|
||||||
|
|
||||||
MwClassRec MwMenuClassRec = {
|
MwClassRec MwMenuClassRec = {
|
||||||
create, /* create */
|
wcreate, /* create */
|
||||||
destroy, /* destroy */
|
destroy, /* destroy */
|
||||||
draw, /* draw */
|
draw, /* draw */
|
||||||
NULL, /* click */
|
NULL, /* click */
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include <Mw/Milsko.h>
|
#include <Mw/Milsko.h>
|
||||||
|
|
||||||
static int create(MwWidget handle) {
|
static int wcreate(MwWidget handle) {
|
||||||
int st;
|
int st;
|
||||||
MwEntry e;
|
MwEntry e;
|
||||||
|
|
||||||
|
|
@ -128,7 +128,7 @@ static void prop_change(MwWidget handle, const char* prop) {
|
||||||
}
|
}
|
||||||
|
|
||||||
MwClassRec MwNumberEntryClassRec = {
|
MwClassRec MwNumberEntryClassRec = {
|
||||||
create, /* create */
|
wcreate, /* create */
|
||||||
destroy, /* destroy */
|
destroy, /* destroy */
|
||||||
draw, /* draw */
|
draw, /* draw */
|
||||||
NULL, /* click */
|
NULL, /* click */
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ typedef struct waylandopengl {
|
||||||
} waylandopengl_t;
|
} waylandopengl_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int create(MwWidget handle) {
|
static int wcreate(MwWidget handle) {
|
||||||
void* r = NULL;
|
void* r = NULL;
|
||||||
MwWidget w = handle;
|
MwWidget w = handle;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
static int create(MwWidget handle) {
|
static int wcreate(MwWidget handle) {
|
||||||
void* r = NULL;
|
void* r = NULL;
|
||||||
MwWidget w = handle;
|
MwWidget w = handle;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include <Mw/Milsko.h>
|
#include <Mw/Milsko.h>
|
||||||
|
|
||||||
static int create(MwWidget handle) {
|
static int wcreate(MwWidget handle) {
|
||||||
MwSetDefault(handle);
|
MwSetDefault(handle);
|
||||||
MwVaApply(handle,
|
MwVaApply(handle,
|
||||||
MwNminValue, 0,
|
MwNminValue, 0,
|
||||||
|
|
@ -46,7 +46,7 @@ static void prop_change(MwWidget handle, const char* key) {
|
||||||
}
|
}
|
||||||
|
|
||||||
MwClassRec MwProgressBarClassRec = {
|
MwClassRec MwProgressBarClassRec = {
|
||||||
create, /* create */
|
wcreate, /* create */
|
||||||
NULL, /* destroy */
|
NULL, /* destroy */
|
||||||
draw, /* draw */
|
draw, /* draw */
|
||||||
NULL, /* click */
|
NULL, /* click */
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
#include "../../external/stb_ds.h"
|
#include "../../external/stb_ds.h"
|
||||||
|
|
||||||
static int create(MwWidget handle) {
|
static int wcreate(MwWidget handle) {
|
||||||
MwSetDefault(handle);
|
MwSetDefault(handle);
|
||||||
|
|
||||||
MwSetInteger(handle, MwNchecked, 0);
|
MwSetInteger(handle, MwNchecked, 0);
|
||||||
|
|
@ -47,7 +47,7 @@ static void prop_change(MwWidget handle, const char* key) {
|
||||||
}
|
}
|
||||||
|
|
||||||
MwClassRec MwRadioBoxClassRec = {
|
MwClassRec MwRadioBoxClassRec = {
|
||||||
create, /* create */
|
wcreate, /* create */
|
||||||
NULL, /* destroy */
|
NULL, /* destroy */
|
||||||
draw, /* draw */
|
draw, /* draw */
|
||||||
click, /* click */
|
click, /* click */
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include <Mw/Milsko.h>
|
#include <Mw/Milsko.h>
|
||||||
|
|
||||||
static int create(MwWidget handle) {
|
static int wcreate(MwWidget handle) {
|
||||||
MwScrollBar scr = malloc(sizeof(*scr));
|
MwScrollBar scr = malloc(sizeof(*scr));
|
||||||
|
|
||||||
handle->internal = scr;
|
handle->internal = scr;
|
||||||
|
|
@ -58,9 +58,9 @@ static void draw(MwWidget handle) {
|
||||||
MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||||
MwLLColor dark = MwLightenColor(handle, base, -64, -64, -64);
|
MwLLColor dark = MwLightenColor(handle, base, -64, -64, -64);
|
||||||
MwScrollBar scr = handle->internal;
|
MwScrollBar scr = handle->internal;
|
||||||
int or ;
|
int or;
|
||||||
int uy, dy, ux, dx;
|
int uy, dy, ux, dx;
|
||||||
MwLLPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap);
|
MwLLPixmap bgpx = MwGetVoid(handle, MwNbackgroundPixmap);
|
||||||
|
|
||||||
r.x = 0;
|
r.x = 0;
|
||||||
r.y = 0;
|
r.y = 0;
|
||||||
|
|
@ -257,7 +257,7 @@ static void func_handler(MwWidget handle, const char* name, void* out, va_list v
|
||||||
}
|
}
|
||||||
|
|
||||||
MwClassRec MwScrollBarClassRec = {
|
MwClassRec MwScrollBarClassRec = {
|
||||||
create, /* create */
|
wcreate, /* create */
|
||||||
destroy, /* destroy */
|
destroy, /* destroy */
|
||||||
draw, /* draw */
|
draw, /* draw */
|
||||||
NULL, /* click */
|
NULL, /* click */
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include <Mw/Milsko.h>
|
#include <Mw/Milsko.h>
|
||||||
|
|
||||||
static int create(MwWidget handle) {
|
static int wcreate(MwWidget handle) {
|
||||||
MwSetDefault(handle);
|
MwSetDefault(handle);
|
||||||
|
|
||||||
MwSetInteger(handle, MwNorientation, MwHORIZONTAL);
|
MwSetInteger(handle, MwNorientation, MwHORIZONTAL);
|
||||||
|
|
@ -35,7 +35,7 @@ static void prop_change(MwWidget handle, const char* key) {
|
||||||
}
|
}
|
||||||
|
|
||||||
MwClassRec MwSeparatorClassRec = {
|
MwClassRec MwSeparatorClassRec = {
|
||||||
create, /* create */
|
wcreate, /* create */
|
||||||
NULL, /* destroy */
|
NULL, /* destroy */
|
||||||
draw, /* draw */
|
draw, /* draw */
|
||||||
NULL, /* click */
|
NULL, /* click */
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
#include "../../external/stb_ds.h"
|
#include "../../external/stb_ds.h"
|
||||||
|
|
||||||
static int create(MwWidget handle) {
|
static int wcreate(MwWidget handle) {
|
||||||
MwLLBeginStateChange(handle->lowlevel);
|
MwLLBeginStateChange(handle->lowlevel);
|
||||||
|
|
||||||
MwSetDefault(handle);
|
MwSetDefault(handle);
|
||||||
|
|
@ -241,7 +241,7 @@ static void func_handler(MwWidget handle, const char* name, void* out, va_list v
|
||||||
}
|
}
|
||||||
|
|
||||||
MwClassRec MwSubMenuClassRec = {
|
MwClassRec MwSubMenuClassRec = {
|
||||||
create, /* create */
|
wcreate, /* create */
|
||||||
destroy, /* destroy */
|
destroy, /* destroy */
|
||||||
draw, /* draw */
|
draw, /* draw */
|
||||||
click, /* click */
|
click, /* click */
|
||||||
|
|
|
||||||
|
|
@ -297,7 +297,7 @@ static void resize(MwWidget handle) {
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int create(MwWidget handle) {
|
static int wcreate(MwWidget handle) {
|
||||||
MwTreeView tv = malloc(sizeof(*tv));
|
MwTreeView tv = malloc(sizeof(*tv));
|
||||||
memset(tv, 0, sizeof(*tv));
|
memset(tv, 0, sizeof(*tv));
|
||||||
|
|
||||||
|
|
@ -481,7 +481,7 @@ static void tick(MwWidget handle) {
|
||||||
}
|
}
|
||||||
|
|
||||||
MwClassRec MwTreeViewClassRec = {
|
MwClassRec MwTreeViewClassRec = {
|
||||||
create, /* create */
|
wcreate, /* create */
|
||||||
destroy, /* destroy */
|
destroy, /* destroy */
|
||||||
draw, /* draw */
|
draw, /* draw */
|
||||||
NULL, /* click */
|
NULL, /* click */
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ static void resize(MwWidget handle) {
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int create(MwWidget handle) {
|
static int wcreate(MwWidget handle) {
|
||||||
MwViewport vp = malloc(sizeof(*vp));
|
MwViewport vp = malloc(sizeof(*vp));
|
||||||
memset(vp, 0, sizeof(*vp));
|
memset(vp, 0, sizeof(*vp));
|
||||||
|
|
||||||
|
|
@ -176,7 +176,7 @@ static void tick(MwWidget handle) {
|
||||||
}
|
}
|
||||||
|
|
||||||
MwClassRec MwViewportClassRec = {
|
MwClassRec MwViewportClassRec = {
|
||||||
create, /* create */
|
wcreate, /* create */
|
||||||
destroy, /* destroy */
|
destroy, /* destroy */
|
||||||
draw, /* draw */
|
draw, /* draw */
|
||||||
NULL, /* click */
|
NULL, /* click */
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ static int vulkan_instance_setup(MwWidget handle, vulkan_t* o);
|
||||||
static int vulkan_surface_setup(MwWidget handle, vulkan_t* o);
|
static int vulkan_surface_setup(MwWidget handle, vulkan_t* o);
|
||||||
static int vulkan_devices_setup(MwWidget handle, vulkan_t* o);
|
static int vulkan_devices_setup(MwWidget handle, vulkan_t* o);
|
||||||
|
|
||||||
static int create(MwWidget handle) {
|
static int wcreate(MwWidget handle) {
|
||||||
vulkan_t* o = malloc(sizeof(*o));
|
vulkan_t* o = malloc(sizeof(*o));
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
|
@ -556,7 +556,7 @@ static void func_handler(MwWidget handle, const char* name, void* out, va_list v
|
||||||
}
|
}
|
||||||
|
|
||||||
MwClassRec MwVulkanClassRec = {
|
MwClassRec MwVulkanClassRec = {
|
||||||
create, /* create */
|
wcreate, /* create */
|
||||||
destroy, /* destroy */
|
destroy, /* destroy */
|
||||||
NULL, /* draw */
|
NULL, /* draw */
|
||||||
NULL, /* click */
|
NULL, /* click */
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#include <Mw/Milsko.h>
|
#include <Mw/Milsko.h>
|
||||||
|
|
||||||
static int create(MwWidget handle) {
|
static int wcreate(MwWidget handle) {
|
||||||
MwSetDefault(handle);
|
MwSetDefault(handle);
|
||||||
|
|
||||||
MwSetInteger(handle, MwNhasBorder, 0);
|
MwSetInteger(handle, MwNhasBorder, 0);
|
||||||
|
|
@ -44,7 +44,7 @@ static void func_handler(MwWidget handle, const char* name, void* out, va_list v
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MwClassRec MwWindowClassRec = {
|
MwClassRec MwWindowClassRec = {
|
||||||
create, /* create */
|
wcreate, /* create */
|
||||||
NULL, /* destroy */
|
NULL, /* destroy */
|
||||||
draw, /* draw */
|
draw, /* draw */
|
||||||
NULL, /* click */
|
NULL, /* click */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue