Removal of Mw/Error.h, addition of MwStringPrintIntoBuffer #14
20 changed files with 589 additions and 313 deletions
merge conflict
commit
9560c4fd92
21
BorMakefile
generated
21
BorMakefile
generated
|
|
@ -1,11 +1,26 @@
|
|||
CC = bcc32 -c
|
||||
LD = bcc32
|
||||
|
||||
CFLAGS = -Iinclude -D_MILSKO -DUSE_GDI -DUSE_STB_TRUETYPE -DUSE_STB_IMAGE -DSTBI_NO_SIMD
|
||||
CFLAGS = -Iinclude -Iexternal\libz\include -D_MILSKO -DUSE_GDI -DUSE_STB_TRUETYPE -DUSE_STB_IMAGE -DSTBI_NO_SIMD
|
||||
LDFLAGS = -tWD
|
||||
.SUFFIXES: .obj .c
|
||||
all: src\Mw.dll
|
||||
clean:
|
||||
del /f /q external\libz\src\adler32.obj
|
||||
del /f /q external\libz\src\compress.obj
|
||||
del /f /q external\libz\src\crc32.obj
|
||||
del /f /q external\libz\src\deflate.obj
|
||||
del /f /q external\libz\src\gzclose.obj
|
||||
del /f /q external\libz\src\gzlib.obj
|
||||
del /f /q external\libz\src\gzread.obj
|
||||
del /f /q external\libz\src\gzwrite.obj
|
||||
del /f /q external\libz\src\infback.obj
|
||||
del /f /q external\libz\src\inffast.obj
|
||||
del /f /q external\libz\src\inflate.obj
|
||||
del /f /q external\libz\src\inftrees.obj
|
||||
del /f /q external\libz\src\trees.obj
|
||||
del /f /q external\libz\src\uncompr.obj
|
||||
del /f /q external\libz\src\zutil.obj
|
||||
del /f /q external\stb_ds.obj
|
||||
del /f /q external\stb_image.obj
|
||||
del /f /q external\stb_truetype.obj
|
||||
|
|
@ -75,8 +90,8 @@ clean:
|
|||
del /f /q src\Mw.dll
|
||||
del /f /q src\Mw.lib
|
||||
|
||||
src\Mw.dll: external\stb_ds.obj external\stb_image.obj external\stb_truetype.obj src\abstract\directory.obj src\abstract\dynamic.obj src\abstract\time.obj src\backend\gdi.obj src\color.obj src\core.obj src\cursor\arrow.obj src\cursor\cross.obj src\cursor\default.obj src\cursor\hidden.obj src\cursor\text.obj src\default.obj src\dialog\colorpicker.obj src\dialog\directorychooser.obj src\dialog\filechooser.obj src\dialog\messagebox.obj src\draw.obj src\icon\back.obj src\icon\clock.obj src\icon\computer.obj src\icon\directory.obj src\icon\down.obj src\icon\error.obj src\icon\file.obj src\icon\forward.obj src\icon\info.obj src\icon\left.obj src\icon\news.obj src\icon\note.obj src\icon\right.obj src\icon\search.obj src\icon\up.obj src\icon\warning.obj src\lowlevel.obj src\string.obj src\text\font\boldfont.obj src\text\font\boldttf.obj src\text\font\font.obj src\text\font\ttf.obj src\text\ft2.obj src\text\stbtt.obj src\text\text.obj src\unicode.obj src\widget\box.obj src\widget\button.obj src\widget\checkbox.obj src\widget\combobox.obj src\widget\entry.obj src\widget\frame.obj src\widget\image.obj src\widget\label.obj src\widget\listbox.obj src\widget\menu.obj src\widget\numberentry.obj src\widget\opengl.obj src\widget\progressbar.obj src\widget\radiobox.obj src\widget\scrollbar.obj src\widget\separator.obj src\widget\submenu.obj src\widget\treeview.obj src\widget\viewport.obj src\widget\window.obj
|
||||
$(LD) $(LDFLAGS) -e$@ external\stb_ds.obj external\stb_image.obj external\stb_truetype.obj src\abstract\directory.obj src\abstract\dynamic.obj src\abstract\time.obj src\backend\gdi.obj src\color.obj src\core.obj src\cursor\arrow.obj src\cursor\cross.obj src\cursor\default.obj src\cursor\hidden.obj src\cursor\text.obj src\default.obj src\dialog\colorpicker.obj src\dialog\directorychooser.obj src\dialog\filechooser.obj src\dialog\messagebox.obj src\draw.obj src\icon\back.obj src\icon\clock.obj src\icon\computer.obj src\icon\directory.obj src\icon\down.obj src\icon\error.obj src\icon\file.obj src\icon\forward.obj src\icon\info.obj src\icon\left.obj src\icon\news.obj src\icon\note.obj src\icon\right.obj src\icon\search.obj src\icon\up.obj src\icon\warning.obj src\lowlevel.obj src\string.obj src\text\font\boldfont.obj src\text\font\boldttf.obj src\text\font\font.obj src\text\font\ttf.obj src\text\ft2.obj src\text\stbtt.obj src\text\text.obj src\unicode.obj src\widget\box.obj src\widget\button.obj src\widget\checkbox.obj src\widget\combobox.obj src\widget\entry.obj src\widget\frame.obj src\widget\image.obj src\widget\label.obj src\widget\listbox.obj src\widget\menu.obj src\widget\numberentry.obj src\widget\opengl.obj src\widget\progressbar.obj src\widget\radiobox.obj src\widget\scrollbar.obj src\widget\separator.obj src\widget\submenu.obj src\widget\treeview.obj src\widget\viewport.obj src\widget\window.obj -lopengl32.lib -lgdi32.lib -luser32.lib
|
||||
src\Mw.dll: external\libz\src\adler32.obj external\libz\src\compress.obj external\libz\src\crc32.obj external\libz\src\deflate.obj external\libz\src\gzclose.obj external\libz\src\gzlib.obj external\libz\src\gzread.obj external\libz\src\gzwrite.obj external\libz\src\infback.obj external\libz\src\inffast.obj external\libz\src\inflate.obj external\libz\src\inftrees.obj external\libz\src\trees.obj external\libz\src\uncompr.obj external\libz\src\zutil.obj external\stb_ds.obj external\stb_image.obj external\stb_truetype.obj src\abstract\directory.obj src\abstract\dynamic.obj src\abstract\time.obj src\backend\gdi.obj src\color.obj src\core.obj src\cursor\arrow.obj src\cursor\cross.obj src\cursor\default.obj src\cursor\hidden.obj src\cursor\text.obj src\default.obj src\dialog\colorpicker.obj src\dialog\directorychooser.obj src\dialog\filechooser.obj src\dialog\messagebox.obj src\draw.obj src\icon\back.obj src\icon\clock.obj src\icon\computer.obj src\icon\directory.obj src\icon\down.obj src\icon\error.obj src\icon\file.obj src\icon\forward.obj src\icon\info.obj src\icon\left.obj src\icon\news.obj src\icon\note.obj src\icon\right.obj src\icon\search.obj src\icon\up.obj src\icon\warning.obj src\lowlevel.obj src\string.obj src\text\font\boldfont.obj src\text\font\boldttf.obj src\text\font\font.obj src\text\font\ttf.obj src\text\ft2.obj src\text\stbtt.obj src\text\text.obj src\unicode.obj src\widget\box.obj src\widget\button.obj src\widget\checkbox.obj src\widget\combobox.obj src\widget\entry.obj src\widget\frame.obj src\widget\image.obj src\widget\label.obj src\widget\listbox.obj src\widget\menu.obj src\widget\numberentry.obj src\widget\opengl.obj src\widget\progressbar.obj src\widget\radiobox.obj src\widget\scrollbar.obj src\widget\separator.obj src\widget\submenu.obj src\widget\treeview.obj src\widget\viewport.obj src\widget\window.obj
|
||||
$(LD) $(LDFLAGS) -e$@ external\libz\src\adler32.obj external\libz\src\compress.obj external\libz\src\crc32.obj external\libz\src\deflate.obj external\libz\src\gzclose.obj external\libz\src\gzlib.obj external\libz\src\gzread.obj external\libz\src\gzwrite.obj external\libz\src\infback.obj external\libz\src\inffast.obj external\libz\src\inflate.obj external\libz\src\inftrees.obj external\libz\src\trees.obj external\libz\src\uncompr.obj external\libz\src\zutil.obj external\stb_ds.obj external\stb_image.obj external\stb_truetype.obj src\abstract\directory.obj src\abstract\dynamic.obj src\abstract\time.obj src\backend\gdi.obj src\color.obj src\core.obj src\cursor\arrow.obj src\cursor\cross.obj src\cursor\default.obj src\cursor\hidden.obj src\cursor\text.obj src\default.obj src\dialog\colorpicker.obj src\dialog\directorychooser.obj src\dialog\filechooser.obj src\dialog\messagebox.obj src\draw.obj src\icon\back.obj src\icon\clock.obj src\icon\computer.obj src\icon\directory.obj src\icon\down.obj src\icon\error.obj src\icon\file.obj src\icon\forward.obj src\icon\info.obj src\icon\left.obj src\icon\news.obj src\icon\note.obj src\icon\right.obj src\icon\search.obj src\icon\up.obj src\icon\warning.obj src\lowlevel.obj src\string.obj src\text\font\boldfont.obj src\text\font\boldttf.obj src\text\font\font.obj src\text\font\ttf.obj src\text\ft2.obj src\text\stbtt.obj src\text\text.obj src\unicode.obj src\widget\box.obj src\widget\button.obj src\widget\checkbox.obj src\widget\combobox.obj src\widget\entry.obj src\widget\frame.obj src\widget\image.obj src\widget\label.obj src\widget\listbox.obj src\widget\menu.obj src\widget\numberentry.obj src\widget\opengl.obj src\widget\progressbar.obj src\widget\radiobox.obj src\widget\scrollbar.obj src\widget\separator.obj src\widget\submenu.obj src\widget\treeview.obj src\widget\viewport.obj src\widget\window.obj -lopengl32.lib -lgdi32.lib -luser32.lib
|
||||
implib src\Mw.lib src\Mw.dll
|
||||
|
||||
.c.obj:
|
||||
|
|
|
|||
381
CMakeLists.txt
381
CMakeLists.txt
|
|
@ -1,6 +1,6 @@
|
|||
cmake_minimum_required(VERSION 3.25)
|
||||
project(
|
||||
milsko
|
||||
milsko
|
||||
)
|
||||
|
||||
include(CheckIncludeFiles)
|
||||
|
|
@ -20,123 +20,123 @@ option(MW_BUILD_STATIC "Build a static library" OFF)
|
|||
option(MW_INSTALL_HEADERS "Install headers" ON)
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} STREQUAL Darwin)
|
||||
option(MW_USE_FREETYPE2 "Use FreeType 2" OFF)
|
||||
option(MW_USE_FREETYPE2 "Use FreeType 2" OFF)
|
||||
else()
|
||||
option(MW_USE_FREETYPE2 "Use FreeType 2" ON)
|
||||
option(MW_USE_FREETYPE2 "Use FreeType 2" ON)
|
||||
endif()
|
||||
|
||||
if(${CMAKE_SYSTEM_NAME} STREQUAL Linux)
|
||||
option(MW_USE_WAYLAND "Enable Wayland backend" ON)
|
||||
option(MW_USE_WAYLAND "Enable Wayland backend" ON)
|
||||
endif()
|
||||
|
||||
file(
|
||||
GLOB
|
||||
SOURCES
|
||||
src/*.c src/cursor/*.c src/icon/*.c src/widget/*.c src/text/*.c src/text/font/*.c src/dialog/*.c src/abstract/*.c external/*.c
|
||||
GLOB
|
||||
SOURCES
|
||||
external/libz/src/*.c src/*.c src/cursor/*.c src/icon/*.c src/widget/*.c src/text/*.c src/text/font/*.c src/dialog/*.c src/abstract/*.c external/*.c
|
||||
)
|
||||
|
||||
list(REMOVE_ITEM SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/widget/opengl.c")
|
||||
list(REMOVE_ITEM SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/widget/vulkan.c")
|
||||
|
||||
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()
|
||||
|
||||
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()
|
||||
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "NetBSD")
|
||||
list(APPEND CMAKE_REQUIRED_INCLUDES "/usr/X11R7/include")
|
||||
list(APPEND CMAKE_REQUIRED_INCLUDES "/usr/pkg/include")
|
||||
list(APPEND CMAKE_REQUIRED_INCLUDES "/usr/X11R7/include")
|
||||
list(APPEND CMAKE_REQUIRED_INCLUDES "/usr/pkg/include")
|
||||
endif()
|
||||
|
||||
if(MW_TRY_OPENGL)
|
||||
find_package(OpenGL)
|
||||
if(OpenGL_FOUND)
|
||||
set(MW_BUILD_OPENGL ON)
|
||||
set(MW_BUILD_OPENGL ON)
|
||||
list(APPEND SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/widget/opengl.c")
|
||||
if(APPLE)
|
||||
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()
|
||||
message(STATUS "OpenGL widget has been enabled")
|
||||
else()
|
||||
message(WARNING "OpenGL widget has been disabled")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(MW_TRY_VULKAN)
|
||||
check_include_files(vulkan/vulkan.h HAVE_VULKAN_VULKAN_H)
|
||||
if(HAVE_VULKAN_VULKAN_H)
|
||||
set(MW_BUILD_VULKAN ON)
|
||||
list(APPEND SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/widget/vulkan.c")
|
||||
message(STATUS "Vulkan widget has been enabled")
|
||||
else()
|
||||
message(WARNING "Vulkan widget has been disabled")
|
||||
endif()
|
||||
check_include_files(vulkan/vulkan.h HAVE_VULKAN_VULKAN_H)
|
||||
if(HAVE_VULKAN_VULKAN_H)
|
||||
set(MW_BUILD_VULKAN ON)
|
||||
list(APPEND SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/widget/vulkan.c")
|
||||
message(STATUS "Vulkan widget has been enabled")
|
||||
else()
|
||||
message(WARNING "Vulkan widget has been disabled")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(MW_BUILD_STATIC)
|
||||
message(STATUS "Building Milsko as a static library")
|
||||
add_library(
|
||||
Mw
|
||||
${SOURCES}
|
||||
message(STATUS "Building Milsko as a static library")
|
||||
add_library(
|
||||
Mw
|
||||
${SOURCES}
|
||||
)
|
||||
elseif(MW_BUILD_SHARED)
|
||||
message(STATUS "Building Milsko as a shared library")
|
||||
add_library(
|
||||
Mw
|
||||
SHARED
|
||||
${SOURCES}
|
||||
message(STATUS "Building Milsko as a shared library")
|
||||
add_library(
|
||||
Mw
|
||||
SHARED
|
||||
${SOURCES}
|
||||
)
|
||||
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()
|
||||
|
||||
if(MW_USE_STB_IMAGE)
|
||||
target_compile_definitions(
|
||||
Mw
|
||||
PRIVATE
|
||||
USE_STB_IMAGE
|
||||
)
|
||||
target_compile_definitions(
|
||||
Mw
|
||||
PRIVATE
|
||||
USE_STB_IMAGE
|
||||
)
|
||||
else()
|
||||
file(
|
||||
GLOB
|
||||
IMAGE_SOURCES
|
||||
external/libz/src/*.c external/libjpeg/src/*.c external/libpng/src/*.c
|
||||
)
|
||||
target_sources(
|
||||
Mw
|
||||
PRIVATE
|
||||
${MW_IMAGE_SOURCES}
|
||||
)
|
||||
target_include_directories(
|
||||
Mw
|
||||
PRIVATE
|
||||
external/libz/include external/libjpeg/include external/libpng/include
|
||||
)
|
||||
file(
|
||||
GLOB
|
||||
IMAGE_SOURCES
|
||||
external/libjpeg/src/*.c external/libpng/src/*.c
|
||||
)
|
||||
target_sources(
|
||||
Mw
|
||||
PRIVATE
|
||||
${MW_IMAGE_SOURCES}
|
||||
)
|
||||
target_include_directories(
|
||||
Mw
|
||||
PRIVATE
|
||||
external/libjpeg/include external/libpng/include
|
||||
)
|
||||
endif()
|
||||
|
||||
if(MW_USE_STB_TRUETYPE)
|
||||
target_compile_definitions(
|
||||
Mw
|
||||
PRIVATE
|
||||
USE_STB_TRUETYPE
|
||||
)
|
||||
target_compile_definitions(
|
||||
Mw
|
||||
PRIVATE
|
||||
USE_STB_TRUETYPE
|
||||
)
|
||||
endif()
|
||||
|
||||
if(MW_USE_FREETYPE2)
|
||||
target_compile_definitions(
|
||||
Mw
|
||||
PRIVATE
|
||||
USE_FREETYPE2
|
||||
)
|
||||
target_compile_definitions(
|
||||
Mw
|
||||
PRIVATE
|
||||
USE_FREETYPE2
|
||||
)
|
||||
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(FT2 REQUIRED freetype2)
|
||||
list(APPEND INCLUDE_DIRS ${FT2_INCLUDE_DIRS})
|
||||
list(APPEND LIBRARY_DIRS ${FT2_LIBRARY_DIRS})
|
||||
list(APPEND LIBRARIES ${FT2_LIBRARIES})
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(FT2 REQUIRED freetype2)
|
||||
list(APPEND INCLUDE_DIRS ${FT2_INCLUDE_DIRS})
|
||||
list(APPEND LIBRARY_DIRS ${FT2_LIBRARY_DIRS})
|
||||
list(APPEND LIBRARIES ${FT2_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(MW_USE_WAYLAND)
|
||||
|
|
@ -150,10 +150,10 @@ if(MW_USE_WAYLAND)
|
|||
COMMAND_ECHO STDOUT
|
||||
)
|
||||
target_sources(
|
||||
Mw
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/backend/wayland-core-protocol.c
|
||||
)
|
||||
Mw
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/backend/wayland-core-protocol.c
|
||||
)
|
||||
execute_process(
|
||||
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}
|
||||
|
|
@ -177,10 +177,10 @@ if(MW_USE_WAYLAND)
|
|||
COMMAND_ECHO STDOUT
|
||||
)
|
||||
target_sources(
|
||||
Mw
|
||||
PRIVATE
|
||||
Mw
|
||||
PRIVATE
|
||||
${proto_c}
|
||||
)
|
||||
)
|
||||
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
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
|
|
@ -193,11 +193,11 @@ if(MW_USE_WAYLAND)
|
|||
endfunction()
|
||||
|
||||
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)
|
||||
if(HAVE_WL_H)
|
||||
if(HAVE_XKBCOMMON_H)
|
||||
if(HAVE_CAIRO_H)
|
||||
if(HAVE_WL_H)
|
||||
if(HAVE_XKBCOMMON_H)
|
||||
if(HAVE_CAIRO_H)
|
||||
scan_wayland_protocol_core()
|
||||
scan_wayland_protocol("stable" "xdg-shell" "")
|
||||
scan_wayland_protocol("stable" "viewporter" "")
|
||||
|
|
@ -207,156 +207,163 @@ if(MW_USE_WAYLAND)
|
|||
scan_wayland_protocol("unstable" "xdg-decoration" "-unstable-v1")
|
||||
scan_wayland_protocol("unstable" "primary-selection" "-unstable-v1")
|
||||
scan_wayland_protocol("unstable" "pointer-constraints" "-unstable-v1")
|
||||
scan_wayland_protocol("unstable" "relative-pointer" "-unstable-v1")
|
||||
|
||||
target_sources(
|
||||
Mw
|
||||
PRIVATE
|
||||
src/backend/wayland.c
|
||||
)
|
||||
Mw
|
||||
PRIVATE
|
||||
src/backend/wayland.c
|
||||
)
|
||||
target_compile_definitions(
|
||||
Mw
|
||||
PRIVATE
|
||||
USE_WAYLAND
|
||||
)
|
||||
message(STATUS "Wayland backend has been enabled")
|
||||
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")
|
||||
endif()
|
||||
message(STATUS "Wayland backend has been enabled")
|
||||
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")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(APPLE AND MW_BUILD_OPENGL)
|
||||
target_compile_definitions(
|
||||
Mw
|
||||
PRIVATE
|
||||
GL_SILENCE_DEPRECATION
|
||||
)
|
||||
Mw
|
||||
PRIVATE
|
||||
GL_SILENCE_DEPRECATION
|
||||
)
|
||||
endif()
|
||||
|
||||
target_include_directories(
|
||||
Mw
|
||||
PUBLIC
|
||||
include
|
||||
Mw
|
||||
PRIVATE
|
||||
external/libz/include
|
||||
)
|
||||
|
||||
target_include_directories(
|
||||
Mw
|
||||
PUBLIC
|
||||
include
|
||||
)
|
||||
|
||||
if(MW_CLASSIC_THEME)
|
||||
target_compile_definitions(
|
||||
Mw
|
||||
PRIVATE
|
||||
USE_CLASSIC_THEME
|
||||
)
|
||||
target_compile_definitions(
|
||||
Mw
|
||||
PRIVATE
|
||||
USE_CLASSIC_THEME
|
||||
)
|
||||
endif()
|
||||
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
target_sources(
|
||||
Mw
|
||||
PRIVATE
|
||||
src/backend/gdi.c
|
||||
)
|
||||
target_compile_definitions(
|
||||
Mw
|
||||
PRIVATE
|
||||
USE_GDI
|
||||
)
|
||||
list(APPEND LIBRARIES gdi32)
|
||||
target_link_options(
|
||||
Mw
|
||||
PRIVATE
|
||||
-static-libgcc
|
||||
)
|
||||
target_sources(
|
||||
Mw
|
||||
PRIVATE
|
||||
src/backend/gdi.c
|
||||
)
|
||||
target_compile_definitions(
|
||||
Mw
|
||||
PRIVATE
|
||||
USE_GDI
|
||||
)
|
||||
list(APPEND LIBRARIES gdi32)
|
||||
target_link_options(
|
||||
Mw
|
||||
PRIVATE
|
||||
-static-libgcc
|
||||
)
|
||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||
target_sources(
|
||||
Mw
|
||||
PRIVATE
|
||||
src/backend/cocoa.m
|
||||
)
|
||||
target_compile_definitions(
|
||||
Mw
|
||||
PRIVATE
|
||||
USE_COCOA
|
||||
)
|
||||
list(APPEND LIBRARIES objc)
|
||||
target_link_options(
|
||||
Mw
|
||||
PRIVATE
|
||||
-framework Cocoa
|
||||
)
|
||||
target_sources(
|
||||
Mw
|
||||
PRIVATE
|
||||
src/backend/cocoa.m
|
||||
)
|
||||
target_compile_definitions(
|
||||
Mw
|
||||
PRIVATE
|
||||
USE_COCOA
|
||||
)
|
||||
list(APPEND LIBRARIES objc)
|
||||
target_link_options(
|
||||
Mw
|
||||
PRIVATE
|
||||
-framework Cocoa
|
||||
)
|
||||
else()
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(X11 REQUIRED x11)
|
||||
pkg_check_modules(XRENDER REQUIRED xrender)
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(X11 REQUIRED x11)
|
||||
pkg_check_modules(XRENDER REQUIRED xrender)
|
||||
|
||||
target_sources(
|
||||
Mw
|
||||
PRIVATE
|
||||
src/backend/x11.c
|
||||
)
|
||||
target_compile_definitions(
|
||||
Mw
|
||||
PRIVATE
|
||||
USE_X11
|
||||
)
|
||||
list(APPEND INCLUDE_DIRS ${X11_INCLUDE_DIRS} ${XRENDER_INCLUDE_DIRS})
|
||||
list(APPEND LIBRARY_DIRS ${X11_LIBRARY_DIRS} ${XRENDER_LIBRARY_DIRS})
|
||||
list(APPEND LIBRARIES ${X11_LIBRARIES} ${XRENDER_LIBRARIES} m)
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
list(APPEND LIBRARIES dl)
|
||||
endif()
|
||||
target_sources(
|
||||
Mw
|
||||
PRIVATE
|
||||
src/backend/x11.c
|
||||
)
|
||||
target_compile_definitions(
|
||||
Mw
|
||||
PRIVATE
|
||||
USE_X11
|
||||
)
|
||||
list(APPEND INCLUDE_DIRS ${X11_INCLUDE_DIRS} ${XRENDER_INCLUDE_DIRS})
|
||||
list(APPEND LIBRARY_DIRS ${X11_LIBRARY_DIRS} ${XRENDER_LIBRARY_DIRS})
|
||||
list(APPEND LIBRARIES ${X11_LIBRARIES} ${XRENDER_LIBRARIES} m)
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
list(APPEND LIBRARIES dl)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
target_include_directories(
|
||||
Mw
|
||||
PRIVATE
|
||||
${INCLUDE_DIRS}
|
||||
Mw
|
||||
PRIVATE
|
||||
${INCLUDE_DIRS}
|
||||
)
|
||||
target_link_directories(
|
||||
Mw
|
||||
PRIVATE
|
||||
${LIBRARY_DIRS}
|
||||
Mw
|
||||
PRIVATE
|
||||
${LIBRARY_DIRS}
|
||||
)
|
||||
target_link_libraries(
|
||||
Mw
|
||||
PRIVATE
|
||||
${LIBRARIES}
|
||||
Mw
|
||||
PRIVATE
|
||||
${LIBRARIES}
|
||||
)
|
||||
|
||||
if(MW_BUILD_VULKAN)
|
||||
check_include_files(vulkan/vk_enum_string_helper.h HAS_VK_ENUM_STRING_HELPER)
|
||||
if(HAS_VK_ENUM_STRING_HELPER)
|
||||
target_compile_definitions(
|
||||
Mw
|
||||
PRIVATE
|
||||
HAS_VK_ENUM_STRING_HELPER
|
||||
)
|
||||
endif()
|
||||
check_include_files(vulkan/vk_enum_string_helper.h HAS_VK_ENUM_STRING_HELPER)
|
||||
if(HAS_VK_ENUM_STRING_HELPER)
|
||||
target_compile_definitions(
|
||||
Mw
|
||||
PRIVATE
|
||||
HAS_VK_ENUM_STRING_HELPER
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
target_compile_definitions(
|
||||
Mw
|
||||
PRIVATE
|
||||
_MILSKO
|
||||
Mw
|
||||
PRIVATE
|
||||
_MILSKO
|
||||
)
|
||||
|
||||
install(
|
||||
TARGETS Mw
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
TARGETS Mw
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
)
|
||||
|
||||
if(MW_INSTALL_HEADERS)
|
||||
install(
|
||||
DIRECTORY include/
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
FILES_MATCHING PATTERN "*.h"
|
||||
)
|
||||
install(
|
||||
DIRECTORY include/
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
FILES_MATCHING PATTERN "*.h"
|
||||
)
|
||||
endif()
|
||||
|
||||
if(MW_BUILD_EXAMPLES)
|
||||
add_subdirectory(examples)
|
||||
add_subdirectory(examples)
|
||||
endif()
|
||||
|
|
|
|||
21
NTMakefile
generated
21
NTMakefile
generated
|
|
@ -1,11 +1,26 @@
|
|||
CC = cl /TC /c /nologo
|
||||
LD = link /nologo
|
||||
|
||||
CFLAGS = /Iinclude /D_MILSKO /DUSE_GDI /DUSE_STB_TRUETYPE /DUSE_STB_IMAGE /DSTBI_NO_SIMD
|
||||
CFLAGS = /Iinclude /Iexternal\libz\include /D_MILSKO /DUSE_GDI /DUSE_STB_TRUETYPE /DUSE_STB_IMAGE /DSTBI_NO_SIMD
|
||||
LDFLAGS = /DLL
|
||||
.SUFFIXES: .obj .c
|
||||
all: src\Mw.dll
|
||||
clean:
|
||||
del /f /q external\libz\src\adler32.obj
|
||||
del /f /q external\libz\src\compress.obj
|
||||
del /f /q external\libz\src\crc32.obj
|
||||
del /f /q external\libz\src\deflate.obj
|
||||
del /f /q external\libz\src\gzclose.obj
|
||||
del /f /q external\libz\src\gzlib.obj
|
||||
del /f /q external\libz\src\gzread.obj
|
||||
del /f /q external\libz\src\gzwrite.obj
|
||||
del /f /q external\libz\src\infback.obj
|
||||
del /f /q external\libz\src\inffast.obj
|
||||
del /f /q external\libz\src\inflate.obj
|
||||
del /f /q external\libz\src\inftrees.obj
|
||||
del /f /q external\libz\src\trees.obj
|
||||
del /f /q external\libz\src\uncompr.obj
|
||||
del /f /q external\libz\src\zutil.obj
|
||||
del /f /q external\stb_ds.obj
|
||||
del /f /q external\stb_image.obj
|
||||
del /f /q external\stb_truetype.obj
|
||||
|
|
@ -75,8 +90,8 @@ clean:
|
|||
del /f /q src\Mw.dll
|
||||
del /f /q src\Mw.lib
|
||||
|
||||
src\Mw.dll: external\stb_ds.obj external\stb_image.obj external\stb_truetype.obj src\abstract\directory.obj src\abstract\dynamic.obj src\abstract\time.obj src\backend\gdi.obj src\color.obj src\core.obj src\cursor\arrow.obj src\cursor\cross.obj src\cursor\default.obj src\cursor\hidden.obj src\cursor\text.obj src\default.obj src\dialog\colorpicker.obj src\dialog\directorychooser.obj src\dialog\filechooser.obj src\dialog\messagebox.obj src\draw.obj src\icon\back.obj src\icon\clock.obj src\icon\computer.obj src\icon\directory.obj src\icon\down.obj src\icon\error.obj src\icon\file.obj src\icon\forward.obj src\icon\info.obj src\icon\left.obj src\icon\news.obj src\icon\note.obj src\icon\right.obj src\icon\search.obj src\icon\up.obj src\icon\warning.obj src\lowlevel.obj src\string.obj src\text\font\boldfont.obj src\text\font\boldttf.obj src\text\font\font.obj src\text\font\ttf.obj src\text\ft2.obj src\text\stbtt.obj src\text\text.obj src\unicode.obj src\widget\box.obj src\widget\button.obj src\widget\checkbox.obj src\widget\combobox.obj src\widget\entry.obj src\widget\frame.obj src\widget\image.obj src\widget\label.obj src\widget\listbox.obj src\widget\menu.obj src\widget\numberentry.obj src\widget\opengl.obj src\widget\progressbar.obj src\widget\radiobox.obj src\widget\scrollbar.obj src\widget\separator.obj src\widget\submenu.obj src\widget\treeview.obj src\widget\viewport.obj src\widget\window.obj
|
||||
$(LD) $(LDFLAGS) /OUT:$@ external\stb_ds.obj external\stb_image.obj external\stb_truetype.obj src\abstract\directory.obj src\abstract\dynamic.obj src\abstract\time.obj src\backend\gdi.obj src\color.obj src\core.obj src\cursor\arrow.obj src\cursor\cross.obj src\cursor\default.obj src\cursor\hidden.obj src\cursor\text.obj src\default.obj src\dialog\colorpicker.obj src\dialog\directorychooser.obj src\dialog\filechooser.obj src\dialog\messagebox.obj src\draw.obj src\icon\back.obj src\icon\clock.obj src\icon\computer.obj src\icon\directory.obj src\icon\down.obj src\icon\error.obj src\icon\file.obj src\icon\forward.obj src\icon\info.obj src\icon\left.obj src\icon\news.obj src\icon\note.obj src\icon\right.obj src\icon\search.obj src\icon\up.obj src\icon\warning.obj src\lowlevel.obj src\string.obj src\text\font\boldfont.obj src\text\font\boldttf.obj src\text\font\font.obj src\text\font\ttf.obj src\text\ft2.obj src\text\stbtt.obj src\text\text.obj src\unicode.obj src\widget\box.obj src\widget\button.obj src\widget\checkbox.obj src\widget\combobox.obj src\widget\entry.obj src\widget\frame.obj src\widget\image.obj src\widget\label.obj src\widget\listbox.obj src\widget\menu.obj src\widget\numberentry.obj src\widget\opengl.obj src\widget\progressbar.obj src\widget\radiobox.obj src\widget\scrollbar.obj src\widget\separator.obj src\widget\submenu.obj src\widget\treeview.obj src\widget\viewport.obj src\widget\window.obj opengl32.lib gdi32.lib user32.lib
|
||||
src\Mw.dll: external\libz\src\adler32.obj external\libz\src\compress.obj external\libz\src\crc32.obj external\libz\src\deflate.obj external\libz\src\gzclose.obj external\libz\src\gzlib.obj external\libz\src\gzread.obj external\libz\src\gzwrite.obj external\libz\src\infback.obj external\libz\src\inffast.obj external\libz\src\inflate.obj external\libz\src\inftrees.obj external\libz\src\trees.obj external\libz\src\uncompr.obj external\libz\src\zutil.obj external\stb_ds.obj external\stb_image.obj external\stb_truetype.obj src\abstract\directory.obj src\abstract\dynamic.obj src\abstract\time.obj src\backend\gdi.obj src\color.obj src\core.obj src\cursor\arrow.obj src\cursor\cross.obj src\cursor\default.obj src\cursor\hidden.obj src\cursor\text.obj src\default.obj src\dialog\colorpicker.obj src\dialog\directorychooser.obj src\dialog\filechooser.obj src\dialog\messagebox.obj src\draw.obj src\icon\back.obj src\icon\clock.obj src\icon\computer.obj src\icon\directory.obj src\icon\down.obj src\icon\error.obj src\icon\file.obj src\icon\forward.obj src\icon\info.obj src\icon\left.obj src\icon\news.obj src\icon\note.obj src\icon\right.obj src\icon\search.obj src\icon\up.obj src\icon\warning.obj src\lowlevel.obj src\string.obj src\text\font\boldfont.obj src\text\font\boldttf.obj src\text\font\font.obj src\text\font\ttf.obj src\text\ft2.obj src\text\stbtt.obj src\text\text.obj src\unicode.obj src\widget\box.obj src\widget\button.obj src\widget\checkbox.obj src\widget\combobox.obj src\widget\entry.obj src\widget\frame.obj src\widget\image.obj src\widget\label.obj src\widget\listbox.obj src\widget\menu.obj src\widget\numberentry.obj src\widget\opengl.obj src\widget\progressbar.obj src\widget\radiobox.obj src\widget\scrollbar.obj src\widget\separator.obj src\widget\submenu.obj src\widget\treeview.obj src\widget\viewport.obj src\widget\window.obj
|
||||
$(LD) $(LDFLAGS) /OUT:$@ external\libz\src\adler32.obj external\libz\src\compress.obj external\libz\src\crc32.obj external\libz\src\deflate.obj external\libz\src\gzclose.obj external\libz\src\gzlib.obj external\libz\src\gzread.obj external\libz\src\gzwrite.obj external\libz\src\infback.obj external\libz\src\inffast.obj external\libz\src\inflate.obj external\libz\src\inftrees.obj external\libz\src\trees.obj external\libz\src\uncompr.obj external\libz\src\zutil.obj external\stb_ds.obj external\stb_image.obj external\stb_truetype.obj src\abstract\directory.obj src\abstract\dynamic.obj src\abstract\time.obj src\backend\gdi.obj src\color.obj src\core.obj src\cursor\arrow.obj src\cursor\cross.obj src\cursor\default.obj src\cursor\hidden.obj src\cursor\text.obj src\default.obj src\dialog\colorpicker.obj src\dialog\directorychooser.obj src\dialog\filechooser.obj src\dialog\messagebox.obj src\draw.obj src\icon\back.obj src\icon\clock.obj src\icon\computer.obj src\icon\directory.obj src\icon\down.obj src\icon\error.obj src\icon\file.obj src\icon\forward.obj src\icon\info.obj src\icon\left.obj src\icon\news.obj src\icon\note.obj src\icon\right.obj src\icon\search.obj src\icon\up.obj src\icon\warning.obj src\lowlevel.obj src\string.obj src\text\font\boldfont.obj src\text\font\boldttf.obj src\text\font\font.obj src\text\font\ttf.obj src\text\ft2.obj src\text\stbtt.obj src\text\text.obj src\unicode.obj src\widget\box.obj src\widget\button.obj src\widget\checkbox.obj src\widget\combobox.obj src\widget\entry.obj src\widget\frame.obj src\widget\image.obj src\widget\label.obj src\widget\listbox.obj src\widget\menu.obj src\widget\numberentry.obj src\widget\opengl.obj src\widget\progressbar.obj src\widget\radiobox.obj src\widget\scrollbar.obj src\widget\separator.obj src\widget\submenu.obj src\widget\treeview.obj src\widget\viewport.obj src\widget\window.obj opengl32.lib gdi32.lib user32.lib
|
||||
|
||||
|
||||
.c.obj:
|
||||
|
|
|
|||
51
WatMakefile
generated
51
WatMakefile
generated
|
|
@ -1,10 +1,25 @@
|
|||
CC = wcc386 -bt=nt -q -bd
|
||||
LD = wlink option quiet
|
||||
|
||||
CFLAGS = -i=include -d_MILSKO -dUSE_GDI -dUSE_STB_TRUETYPE -dUSE_STB_IMAGE -dSTBI_NO_SIMD
|
||||
CFLAGS = -i=include -i=external/libz/include -d_MILSKO -dUSE_GDI -dUSE_STB_TRUETYPE -dUSE_STB_IMAGE -dSTBI_NO_SIMD
|
||||
LDFLAGS = system nt_dll
|
||||
all: src/Mw.dll
|
||||
clean: .SYMBOLIC
|
||||
%erase external/libz/src/adler32.obj
|
||||
%erase external/libz/src/compress.obj
|
||||
%erase external/libz/src/crc32.obj
|
||||
%erase external/libz/src/deflate.obj
|
||||
%erase external/libz/src/gzclose.obj
|
||||
%erase external/libz/src/gzlib.obj
|
||||
%erase external/libz/src/gzread.obj
|
||||
%erase external/libz/src/gzwrite.obj
|
||||
%erase external/libz/src/infback.obj
|
||||
%erase external/libz/src/inffast.obj
|
||||
%erase external/libz/src/inflate.obj
|
||||
%erase external/libz/src/inftrees.obj
|
||||
%erase external/libz/src/trees.obj
|
||||
%erase external/libz/src/uncompr.obj
|
||||
%erase external/libz/src/zutil.obj
|
||||
%erase external/stb_ds.obj
|
||||
%erase external/stb_image.obj
|
||||
%erase external/stb_truetype.obj
|
||||
|
|
@ -74,11 +89,41 @@ clean: .SYMBOLIC
|
|||
%erase src/Mw.dll
|
||||
%erase src/Mw.lib
|
||||
|
||||
src/Mw.dll: external/stb_ds.obj external/stb_image.obj external/stb_truetype.obj src/abstract/directory.obj src/abstract/dynamic.obj src/abstract/time.obj src/backend/gdi.obj src/color.obj src/core.obj src/cursor/arrow.obj src/cursor/cross.obj src/cursor/default.obj src/cursor/hidden.obj src/cursor/text.obj src/default.obj src/dialog/colorpicker.obj src/dialog/directorychooser.obj src/dialog/filechooser.obj src/dialog/messagebox.obj src/draw.obj src/icon/back.obj src/icon/clock.obj src/icon/computer.obj src/icon/directory.obj src/icon/down.obj src/icon/error.obj src/icon/file.obj src/icon/forward.obj src/icon/info.obj src/icon/left.obj src/icon/news.obj src/icon/note.obj src/icon/right.obj src/icon/search.obj src/icon/up.obj src/icon/warning.obj src/lowlevel.obj src/string.obj src/text/font/boldfont.obj src/text/font/boldttf.obj src/text/font/font.obj src/text/font/ttf.obj src/text/ft2.obj src/text/stbtt.obj src/text/text.obj src/unicode.obj src/widget/box.obj src/widget/button.obj src/widget/checkbox.obj src/widget/combobox.obj src/widget/entry.obj src/widget/frame.obj src/widget/image.obj src/widget/label.obj src/widget/listbox.obj src/widget/menu.obj src/widget/numberentry.obj src/widget/opengl.obj src/widget/progressbar.obj src/widget/radiobox.obj src/widget/scrollbar.obj src/widget/separator.obj src/widget/submenu.obj src/widget/treeview.obj src/widget/viewport.obj src/widget/window.obj
|
||||
$(LD) $(LDFLAGS) option implib=src/Mw.lib name $@ file external/stb_ds.obj file external/stb_image.obj file external/stb_truetype.obj file src/abstract/directory.obj file src/abstract/dynamic.obj file src/abstract/time.obj file src/backend/gdi.obj file src/color.obj file src/core.obj file src/cursor/arrow.obj file src/cursor/cross.obj file src/cursor/default.obj file src/cursor/hidden.obj file src/cursor/text.obj file src/default.obj file src/dialog/colorpicker.obj file src/dialog/directorychooser.obj file src/dialog/filechooser.obj file src/dialog/messagebox.obj file src/draw.obj file src/icon/back.obj file src/icon/clock.obj file src/icon/computer.obj file src/icon/directory.obj file src/icon/down.obj file src/icon/error.obj file src/icon/file.obj file src/icon/forward.obj file src/icon/info.obj file src/icon/left.obj file src/icon/news.obj file src/icon/note.obj file src/icon/right.obj file src/icon/search.obj file src/icon/up.obj file src/icon/warning.obj file src/lowlevel.obj file src/string.obj file src/text/font/boldfont.obj file src/text/font/boldttf.obj file src/text/font/font.obj file src/text/font/ttf.obj file src/text/ft2.obj file src/text/stbtt.obj file src/text/text.obj file src/unicode.obj file src/widget/box.obj file src/widget/button.obj file src/widget/checkbox.obj file src/widget/combobox.obj file src/widget/entry.obj file src/widget/frame.obj file src/widget/image.obj file src/widget/label.obj file src/widget/listbox.obj file src/widget/menu.obj file src/widget/numberentry.obj file src/widget/opengl.obj file src/widget/progressbar.obj file src/widget/radiobox.obj file src/widget/scrollbar.obj file src/widget/separator.obj file src/widget/submenu.obj file src/widget/treeview.obj file src/widget/viewport.obj file src/widget/window.obj library clib3r.lib library opengl32.lib library gdi32.lib library user32.lib
|
||||
src/Mw.dll: external/libz/src/adler32.obj external/libz/src/compress.obj external/libz/src/crc32.obj external/libz/src/deflate.obj external/libz/src/gzclose.obj external/libz/src/gzlib.obj external/libz/src/gzread.obj external/libz/src/gzwrite.obj external/libz/src/infback.obj external/libz/src/inffast.obj external/libz/src/inflate.obj external/libz/src/inftrees.obj external/libz/src/trees.obj external/libz/src/uncompr.obj external/libz/src/zutil.obj external/stb_ds.obj external/stb_image.obj external/stb_truetype.obj src/abstract/directory.obj src/abstract/dynamic.obj src/abstract/time.obj src/backend/gdi.obj src/color.obj src/core.obj src/cursor/arrow.obj src/cursor/cross.obj src/cursor/default.obj src/cursor/hidden.obj src/cursor/text.obj src/default.obj src/dialog/colorpicker.obj src/dialog/directorychooser.obj src/dialog/filechooser.obj src/dialog/messagebox.obj src/draw.obj src/icon/back.obj src/icon/clock.obj src/icon/computer.obj src/icon/directory.obj src/icon/down.obj src/icon/error.obj src/icon/file.obj src/icon/forward.obj src/icon/info.obj src/icon/left.obj src/icon/news.obj src/icon/note.obj src/icon/right.obj src/icon/search.obj src/icon/up.obj src/icon/warning.obj src/lowlevel.obj src/string.obj src/text/font/boldfont.obj src/text/font/boldttf.obj src/text/font/font.obj src/text/font/ttf.obj src/text/ft2.obj src/text/stbtt.obj src/text/text.obj src/unicode.obj src/widget/box.obj src/widget/button.obj src/widget/checkbox.obj src/widget/combobox.obj src/widget/entry.obj src/widget/frame.obj src/widget/image.obj src/widget/label.obj src/widget/listbox.obj src/widget/menu.obj src/widget/numberentry.obj src/widget/opengl.obj src/widget/progressbar.obj src/widget/radiobox.obj src/widget/scrollbar.obj src/widget/separator.obj src/widget/submenu.obj src/widget/treeview.obj src/widget/viewport.obj src/widget/window.obj
|
||||
$(LD) $(LDFLAGS) option implib=src/Mw.lib name $@ file external/libz/src/adler32.obj file external/libz/src/compress.obj file external/libz/src/crc32.obj file external/libz/src/deflate.obj file external/libz/src/gzclose.obj file external/libz/src/gzlib.obj file external/libz/src/gzread.obj file external/libz/src/gzwrite.obj file external/libz/src/infback.obj file external/libz/src/inffast.obj file external/libz/src/inflate.obj file external/libz/src/inftrees.obj file external/libz/src/trees.obj file external/libz/src/uncompr.obj file external/libz/src/zutil.obj file external/stb_ds.obj file external/stb_image.obj file external/stb_truetype.obj file src/abstract/directory.obj file src/abstract/dynamic.obj file src/abstract/time.obj file src/backend/gdi.obj file src/color.obj file src/core.obj file src/cursor/arrow.obj file src/cursor/cross.obj file src/cursor/default.obj file src/cursor/hidden.obj file src/cursor/text.obj file src/default.obj file src/dialog/colorpicker.obj file src/dialog/directorychooser.obj file src/dialog/filechooser.obj file src/dialog/messagebox.obj file src/draw.obj file src/icon/back.obj file src/icon/clock.obj file src/icon/computer.obj file src/icon/directory.obj file src/icon/down.obj file src/icon/error.obj file src/icon/file.obj file src/icon/forward.obj file src/icon/info.obj file src/icon/left.obj file src/icon/news.obj file src/icon/note.obj file src/icon/right.obj file src/icon/search.obj file src/icon/up.obj file src/icon/warning.obj file src/lowlevel.obj file src/string.obj file src/text/font/boldfont.obj file src/text/font/boldttf.obj file src/text/font/font.obj file src/text/font/ttf.obj file src/text/ft2.obj file src/text/stbtt.obj file src/text/text.obj file src/unicode.obj file src/widget/box.obj file src/widget/button.obj file src/widget/checkbox.obj file src/widget/combobox.obj file src/widget/entry.obj file src/widget/frame.obj file src/widget/image.obj file src/widget/label.obj file src/widget/listbox.obj file src/widget/menu.obj file src/widget/numberentry.obj file src/widget/opengl.obj file src/widget/progressbar.obj file src/widget/radiobox.obj file src/widget/scrollbar.obj file src/widget/separator.obj file src/widget/submenu.obj file src/widget/treeview.obj file src/widget/viewport.obj file src/widget/window.obj library clib3r.lib library opengl32.lib library gdi32.lib library user32.lib
|
||||
|
||||
|
||||
|
||||
external/libz/src/adler32.obj: external/libz/src/adler32.c
|
||||
$(CC) $(CFLAGS) -fo=$@ $<
|
||||
external/libz/src/compress.obj: external/libz/src/compress.c
|
||||
$(CC) $(CFLAGS) -fo=$@ $<
|
||||
external/libz/src/crc32.obj: external/libz/src/crc32.c
|
||||
$(CC) $(CFLAGS) -fo=$@ $<
|
||||
external/libz/src/deflate.obj: external/libz/src/deflate.c
|
||||
$(CC) $(CFLAGS) -fo=$@ $<
|
||||
external/libz/src/gzclose.obj: external/libz/src/gzclose.c
|
||||
$(CC) $(CFLAGS) -fo=$@ $<
|
||||
external/libz/src/gzlib.obj: external/libz/src/gzlib.c
|
||||
$(CC) $(CFLAGS) -fo=$@ $<
|
||||
external/libz/src/gzread.obj: external/libz/src/gzread.c
|
||||
$(CC) $(CFLAGS) -fo=$@ $<
|
||||
external/libz/src/gzwrite.obj: external/libz/src/gzwrite.c
|
||||
$(CC) $(CFLAGS) -fo=$@ $<
|
||||
external/libz/src/infback.obj: external/libz/src/infback.c
|
||||
$(CC) $(CFLAGS) -fo=$@ $<
|
||||
external/libz/src/inffast.obj: external/libz/src/inffast.c
|
||||
$(CC) $(CFLAGS) -fo=$@ $<
|
||||
external/libz/src/inflate.obj: external/libz/src/inflate.c
|
||||
$(CC) $(CFLAGS) -fo=$@ $<
|
||||
external/libz/src/inftrees.obj: external/libz/src/inftrees.c
|
||||
$(CC) $(CFLAGS) -fo=$@ $<
|
||||
external/libz/src/trees.obj: external/libz/src/trees.c
|
||||
$(CC) $(CFLAGS) -fo=$@ $<
|
||||
external/libz/src/uncompr.obj: external/libz/src/uncompr.c
|
||||
$(CC) $(CFLAGS) -fo=$@ $<
|
||||
external/libz/src/zutil.obj: external/libz/src/zutil.c
|
||||
$(CC) $(CFLAGS) -fo=$@ $<
|
||||
external/stb_ds.obj: external/stb_ds.c
|
||||
$(CC) $(CFLAGS) -fo=$@ $<
|
||||
external/stb_image.obj: external/stb_image.c
|
||||
|
|
|
|||
3
configure
vendored
3
configure
vendored
|
|
@ -14,6 +14,7 @@ our $prefix = "/usr/local";
|
|||
our $cc = defined($ENV{CC}) ? $ENV{CC} : "*host*gcc";
|
||||
our $ar = defined($ENV{AR}) ? $ENV{AR} : "*host*ar";
|
||||
our $incdir = "-I include";
|
||||
our $incdir2 = "";
|
||||
our $cflags = "-fPIC -D_MILSKO";
|
||||
our $libdir = "";
|
||||
our $ldflags = "";
|
||||
|
|
@ -168,7 +169,7 @@ open(OUT, ">", "Makefile");
|
|||
print(OUT "PREFIX = ${prefix}\n");
|
||||
print(OUT "AR = ${ar}\n");
|
||||
print(OUT "CC = ${cc}\n");
|
||||
print(OUT "INCDIR = ${incdir}\n");
|
||||
print(OUT "INCDIR = ${incdir} ${incdir2}\n");
|
||||
print(OUT "CFLAGS = ${cflags}\n");
|
||||
print(OUT "LIBDIR = ${libdir}\n");
|
||||
print(OUT "LDFLAGS = ${ldflags}\n");
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
MwWidget window, menu, box;
|
||||
MwWidget boxes[32];
|
||||
int n = 0, row = -1;
|
||||
MwMenu e;
|
||||
MwMenu e;
|
||||
|
||||
static void resize(MwWidget handle, void* user, void* call) {
|
||||
int w = MwGetInteger(window, MwNwidth);
|
||||
|
|
@ -140,7 +140,7 @@ static MwWidget child(MwWidget w) {
|
|||
return MwGetVoid(w, "VhandledWidget");
|
||||
}
|
||||
|
||||
static void menu_handler(MwWidget handle, void* user, void* call){
|
||||
static void menu_handler(MwWidget handle, void* user, void* call) {
|
||||
if(call == e) MwDestroyWidget(window);
|
||||
}
|
||||
|
||||
|
|
@ -149,8 +149,8 @@ int main() {
|
|||
MwWidget f, w;
|
||||
MwListBoxPacket* pkt;
|
||||
int index;
|
||||
MwMenu m, m2;
|
||||
void* v;
|
||||
MwMenu m, m2;
|
||||
void* v;
|
||||
|
||||
MwLibraryInit();
|
||||
|
||||
|
|
@ -187,7 +187,7 @@ int main() {
|
|||
MwMenuAdd(menu, m, "Month");
|
||||
MwMenuAdd(menu, m, "Year");
|
||||
|
||||
m = MwMenuAdd(menu, NULL, "Options");
|
||||
m = MwMenuAdd(menu, NULL, "Options");
|
||||
m2 = MwMenuAdd(menu, m, "Font");
|
||||
MwMenuAdd(menu, m2, "Small");
|
||||
MwMenuAdd(menu, m2, "Medium");
|
||||
|
|
@ -255,13 +255,13 @@ int main() {
|
|||
add(f);
|
||||
|
||||
f = frame("ProgressBar", -PaddingContent, 24, MwProgressBarClass,
|
||||
MwNvalue, 25,
|
||||
NULL);
|
||||
MwNvalue, 25,
|
||||
NULL);
|
||||
add(f);
|
||||
|
||||
f = frame("ScrollBar", -PaddingContent, 16, MwScrollBarClass,
|
||||
MwNorientation, MwHORIZONTAL,
|
||||
NULL);
|
||||
MwNorientation, MwHORIZONTAL,
|
||||
NULL);
|
||||
add(f);
|
||||
|
||||
f = frame("Separator", -PaddingContent, -PaddingContent, MwSeparatorClass, NULL);
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ typedef int8_t MwI8;
|
|||
typedef uint8_t MwU8;
|
||||
|
||||
#define MW_OTHER_TYPES_DEFINED
|
||||
#elif __GNUC__ > 2
|
||||
#elif !defined(__STRICT_ANSI__) && (defined(__GNUC__) || defined(__clang__))
|
||||
typedef long long MwI64;
|
||||
typedef unsigned long long MwU64;
|
||||
#elif defined(_MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__)
|
||||
|
|
|
|||
|
|
@ -289,6 +289,7 @@ MwInline int wayland_load_funcs() {
|
|||
#include "Wayland/cursor-shape-client-protocol.h"
|
||||
#include "Wayland/primary-selection-client-protocol.h"
|
||||
#include "Wayland/pointer-constraints-client-protocol.h"
|
||||
#include "Wayland/relative-pointer-client-protocol.h"
|
||||
#include "Wayland/xdg-toplevel-icon-client-protocol.h"
|
||||
#endif
|
||||
|
||||
|
|
@ -311,10 +312,6 @@ struct _MwLLWaylandTopLevel {
|
|||
struct xdg_toplevel_listener xdg_toplevel_listener;
|
||||
struct xdg_surface_listener xdg_surface_listener;
|
||||
|
||||
struct xkb_context* xkb_context;
|
||||
struct xkb_keymap* xkb_keymap;
|
||||
struct xkb_state* xkb_state;
|
||||
|
||||
MwBool compositor_created;
|
||||
MwBool xdg_wm_base_created;
|
||||
MwBool xdg_surface_created;
|
||||
|
|
@ -416,6 +413,10 @@ struct _MwLLWayland {
|
|||
MwBool has_decorations;
|
||||
char title[255];
|
||||
|
||||
struct xkb_context* xkb_context;
|
||||
struct xkb_keymap* xkb_keymap;
|
||||
struct xkb_state* xkb_state;
|
||||
|
||||
struct wl_display* display;
|
||||
struct wl_registry* registry;
|
||||
struct wl_compositor* compositor;
|
||||
|
|
@ -426,10 +427,12 @@ struct _MwLLWayland {
|
|||
|
||||
struct wp_viewport* vp;
|
||||
|
||||
MwBool do_lock_pointer;
|
||||
struct zwp_pointer_constraints_v1* pointer_constraints;
|
||||
struct zwp_locked_pointer_v1* locked_pointer;
|
||||
MwBool pointer_constrained;
|
||||
MwBool do_lock_pointer;
|
||||
struct zwp_pointer_constraints_v1* pointer_constraints;
|
||||
struct zwp_relative_pointer_manager_v1* relative_pointer_manager;
|
||||
struct zwp_relative_pointer_v1* relative_pointer;
|
||||
struct zwp_locked_pointer_v1* locked_pointer;
|
||||
MwBool pointer_constrained;
|
||||
|
||||
/* clipboard related stuff.
|
||||
* Note that unlike most interfaces, we don't keep zwp_primary_selection stuff in a wayland_protocol_t because we use wl_data_device as a fallback and want to have it share memory space.*/
|
||||
|
|
@ -475,6 +478,8 @@ struct _MwLLWayland {
|
|||
MwBool force_render;
|
||||
MwBool did_event_loop_early;
|
||||
|
||||
MwBool dispatching_resize;
|
||||
|
||||
struct _MwLLWaylandShmBuffer framebuffer;
|
||||
struct _MwLLWaylandShmBuffer backbuffer;
|
||||
struct _MwLLWaylandShmBuffer cursor;
|
||||
|
|
|
|||
|
|
@ -42,12 +42,20 @@ MWDECL void MwStringSize(char* out, MwOffset size);
|
|||
MWDECL void MwStringTime(char* out, time_t t);
|
||||
|
||||
/*!
|
||||
<<<<<<< HEAD
|
||||
* @brief Prints up to n characters into a bufferMwStringPrintIntoBuffer.
|
||||
* @note On compilers that support C99, this uses vsnprintf to safely print into a buffer; on compilers that don't, vsprintf is used.
|
||||
* @param out Buffer
|
||||
* @param size Max size
|
||||
*/
|
||||
MWDECL void MwStringPrintIntoBuffer(char* out, MwU32 size, const char* fmt, ...);
|
||||
=======
|
||||
* @brief Check if the given key is UTF8
|
||||
* @param key Input
|
||||
* @return whether its utf8
|
||||
*/
|
||||
MWDECL MwBool MwIsKeyUTF8(MwU32 key);
|
||||
>>>>>>> master
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ typedef struct _MwListBoxEntry MwListBoxEntry;
|
|||
typedef struct _MwTreeViewEntry MwTreeViewEntry;
|
||||
typedef struct _MwDirectoryEntry MwDirectoryEntry;
|
||||
typedef struct _MwListBoxPacket MwListBoxPacket;
|
||||
typedef struct _MwBox* MwBox;
|
||||
typedef struct _MwBox* MwBox;
|
||||
#ifdef _MILSKO
|
||||
typedef struct _MwWidget* MwWidget;
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
add_incdir("-I/usr/X11R7/include -I/usr/pkg/include");
|
||||
add_incdir2("-I/usr/X11R7/include -I/usr/pkg/include");
|
||||
add_libdir(
|
||||
"-L/usr/X11R7/lib -Wl,-R/usr/X11R7/lib -L/usr/pkg/lib -Wl,-R/usr/pkg/lib");
|
||||
use_backend("x11");
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ if (grep(/^wayland$/, @backends)) {
|
|||
scan_wayland_protocol("unstable", "xdg-decoration", "-unstable-v1");
|
||||
scan_wayland_protocol("unstable", "primary-selection", "-unstable-v1");
|
||||
scan_wayland_protocol("unstable", "pointer-constraints", "-unstable-v1");
|
||||
scan_wayland_protocol("unstable", "relative-pointer", "-unstable-v1");
|
||||
|
||||
$gl_libs = "-lGL -lGLU";
|
||||
}
|
||||
|
|
@ -64,10 +65,17 @@ if (grep(/^cocoa$/, @backends)) {
|
|||
if (param_get("stb-image")) {
|
||||
add_cflags("-DUSE_STB_IMAGE");
|
||||
}
|
||||
else {
|
||||
new_object("external/libjpeg/src/*.c");
|
||||
new_object("external/libpng/src/*.c");
|
||||
add_incdir("-Iexternal/libjpeg/include -Iexternal/libpng/include");
|
||||
}
|
||||
if (param_get("stb-truetype")) {
|
||||
add_cflags("-DUSE_STB_TRUETYPE");
|
||||
}
|
||||
|
||||
add_incdir("-Iexternal/libz/include");
|
||||
|
||||
if (param_get("freetype2")) {
|
||||
add_cflags("-DUSE_FREETYPE2");
|
||||
if ($cross) {
|
||||
|
|
@ -120,6 +128,7 @@ new_object("src/dialog/*.c");
|
|||
new_object("src/abstract/*.c");
|
||||
|
||||
new_object("external/*.c");
|
||||
new_object("external/libz/src/*.c");
|
||||
|
||||
new_example("examples/basic/example");
|
||||
new_example("examples/basic/rotate");
|
||||
|
|
|
|||
|
|
@ -5,6 +5,13 @@ sub add_incdir {
|
|||
$incdir = "${incdir} ${input}";
|
||||
}
|
||||
|
||||
sub add_incdir2 {
|
||||
my $input = $_[0];
|
||||
$input =~ s/\r?\n/ /g;
|
||||
|
||||
$incdir2 = "${incdir2} ${input}";
|
||||
}
|
||||
|
||||
sub add_cflags {
|
||||
my $input = $_[0];
|
||||
$input =~ s/\r?\n/ /g;
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ static void wl_flush(MwLL handle) {
|
|||
}
|
||||
}
|
||||
|
||||
/* Recursively dispatch a draw event to a widget and its children */
|
||||
/* Recursively dispatch a resize event to a widget and its children */
|
||||
static void recursive_dispatch_resize(MwLL handle) {
|
||||
MwWidget h = (MwWidget)handle->common.user;
|
||||
if(h) {
|
||||
|
|
@ -118,6 +118,20 @@ static void recursive_dispatch_resize(MwLL handle) {
|
|||
}
|
||||
};
|
||||
|
||||
/* Recursively dispatch a move event to a widget and its children */
|
||||
static void recursive_dispatch_move(MwLL handle, MwLLMouse* p) {
|
||||
MwWidget h = (MwWidget)handle->common.user;
|
||||
if(h) {
|
||||
int i;
|
||||
for(i = 0; i < arrlen(h->children); i++) {
|
||||
MwLLDispatch(h->children[i]->lowlevel, move, p);
|
||||
if(arrlen(h->children[i]->children) > 0) {
|
||||
recursive_dispatch_move(h->children[i]->lowlevel, p);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/* Recursively dispatch a key event to a widget and its children */
|
||||
static void recursive_dispatch_key(MwLL handle, int* k) {
|
||||
MwWidget h = (MwWidget)handle->common.user;
|
||||
|
|
@ -482,10 +496,13 @@ static void pointer_enter(void* data, struct wl_pointer* wl_pointer, MwU32 seria
|
|||
/* `wl_pointer.leave` callback */
|
||||
static void pointer_leave(void* data, struct wl_pointer* wl_pointer, MwU32 serial,
|
||||
struct wl_surface* surface) {
|
||||
(void)data;
|
||||
MwLL self = data;
|
||||
(void)wl_pointer;
|
||||
(void)serial;
|
||||
(void)surface;
|
||||
WAYLAND_EVENT_OP_START(self);
|
||||
curSurface = NULL;
|
||||
WAYLAND_EVENT_OP_END(self);
|
||||
};
|
||||
|
||||
static void xdg_borderless_step(MwLL self, MwLLMouse p, MwU32 serial) {
|
||||
|
|
@ -514,6 +531,43 @@ static void xdg_borderless_step(MwLL self, MwLLMouse p, MwU32 serial) {
|
|||
|
||||
static MwLL currentlyHeldWidget = NULL;
|
||||
|
||||
static void relative_pointer_motion(void* data,
|
||||
struct zwp_relative_pointer_v1* pointer,
|
||||
uint32_t timeHi,
|
||||
uint32_t timeLo,
|
||||
wl_fixed_t dx,
|
||||
wl_fixed_t dy,
|
||||
wl_fixed_t dxUnaccel,
|
||||
wl_fixed_t dyUnaccel) {
|
||||
MwLL self = data;
|
||||
MwLLMouse p;
|
||||
|
||||
WAYLAND_EVENT_OP_START(self);
|
||||
|
||||
p.point.x = wl_fixed_to_int(dxUnaccel);
|
||||
p.point.y = wl_fixed_to_int(dyUnaccel);
|
||||
|
||||
recursive_dispatch_move(self, &p);
|
||||
if(self->wayland.locked_pointer) zwp_locked_pointer_v1_set_cursor_position_hint(self->wayland.locked_pointer, 0, CSD_BORDER_FRAME_TOP);
|
||||
|
||||
WAYLAND_EVENT_OP_END(self);
|
||||
}
|
||||
|
||||
struct zwp_relative_pointer_v1_listener relative_pointer_listener =
|
||||
{
|
||||
relative_pointer_motion};
|
||||
|
||||
/* zwp_primary_selection_device_manager_v1 setup function */
|
||||
static wayland_protocol_t* zwp_relative_pointer_manager_v1_setup(MwU32 name, struct _MwLLWayland* wayland) {
|
||||
wayland->relative_pointer_manager = wl_registry_bind(wayland->registry, name, &zwp_relative_pointer_manager_v1_interface, 1);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void zwp_relative_pointer_manager_v1_interface_destroy(struct _MwLLWayland* wayland, wayland_protocol_t* data) {
|
||||
(void)wayland;
|
||||
(void)data;
|
||||
}
|
||||
|
||||
/* `wl_pointer.motion` callback */
|
||||
static void pointer_motion(void* data, struct wl_pointer* wl_pointer, MwU32 time,
|
||||
wl_fixed_t surface_x, wl_fixed_t surface_y) {
|
||||
|
|
@ -528,24 +582,13 @@ static void pointer_motion(void* data, struct wl_pointer* wl_pointer, MwU32 time
|
|||
|
||||
self->wayland.cur_mouse_pos.x = wl_fixed_to_int(surface_x);
|
||||
self->wayland.cur_mouse_pos.y = wl_fixed_to_int(surface_y);
|
||||
if(self->wayland.do_lock_pointer) {
|
||||
self->wayland.cur_mouse_pos.x -= topmost_parent->wayland.ww / 2.;
|
||||
self->wayland.cur_mouse_pos.y -= topmost_parent->wayland.wh / 2.;
|
||||
}
|
||||
p.point = self->wayland.cur_mouse_pos;
|
||||
p.point = self->wayland.cur_mouse_pos;
|
||||
MwLLDispatch(self, move, &p);
|
||||
|
||||
if(currentlyHeldWidget) {
|
||||
MwLLDispatch(currentlyHeldWidget, down, &p);
|
||||
}
|
||||
|
||||
if(self->wayland.do_lock_pointer) {
|
||||
topmost_parent->wayland.locked_pointer = zwp_pointer_constraints_v1_lock_pointer(topmost_parent->wayland.pointer_constraints, topmost_parent->wayland.backbuffer.surface, topmost_parent->wayland.pointer, topmost_parent->wayland.region, ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_PERSISTENT);
|
||||
zwp_locked_pointer_v1_set_cursor_position_hint(topmost_parent->wayland.locked_pointer, wl_fixed_from_double(topmost_parent->wayland.ww / 2.), wl_fixed_from_double(topmost_parent->wayland.wh / 2.));
|
||||
wl_surface_commit(topmost_parent->wayland.backbuffer.surface);
|
||||
zwp_locked_pointer_v1_destroy(topmost_parent->wayland.locked_pointer);
|
||||
}
|
||||
|
||||
WAYLAND_EVENT_OP_END(self);
|
||||
};
|
||||
|
||||
|
|
@ -553,6 +596,7 @@ static void pointer_motion(void* data, struct wl_pointer* wl_pointer, MwU32 time
|
|||
static void pointer_button(void* data, struct wl_pointer* wl_pointer, MwU32 serial, MwU32 time, MwU32 button, MwU32 state) {
|
||||
MwLL self = data;
|
||||
MwLLMouse p;
|
||||
MwBool inArea = MwFALSE;
|
||||
|
||||
(void)wl_pointer;
|
||||
(void)serial;
|
||||
|
|
@ -562,10 +606,13 @@ static void pointer_button(void* data, struct wl_pointer* wl_pointer, MwU32 seri
|
|||
|
||||
p.point = self->wayland.cur_mouse_pos;
|
||||
|
||||
// p.point.x > x && p.point.x < x + self->wayland.ww && p.point.y > y && p.point.y < y + self->wayland.wh
|
||||
if(
|
||||
self->wayland.framebuffer.surface == curSurface ||
|
||||
self->wayland.backbuffer.surface == curSurface) {
|
||||
if(self->wayland.framebuffer.surface) {
|
||||
inArea |= self->wayland.framebuffer.surface == curSurface;
|
||||
}
|
||||
if(self->wayland.backbuffer.surface) {
|
||||
inArea |= self->wayland.backbuffer.surface == curSurface;
|
||||
}
|
||||
if(inArea) {
|
||||
int i;
|
||||
|
||||
switch(button) {
|
||||
|
|
@ -637,22 +684,24 @@ static void keyboard_keymap(void* data,
|
|||
(void)wl_keyboard;
|
||||
|
||||
if(self->wayland.type == MWLL_WAYLAND_TOPLEVEL) {
|
||||
struct _MwLLWaylandTopLevel* wayland = self->wayland.toplevel;
|
||||
assert(format == WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1);
|
||||
|
||||
char* map_shm = (char*)mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0);
|
||||
assert(map_shm != MAP_FAILED);
|
||||
|
||||
struct xkb_keymap* xkb_keymap = xkb_keymap_new_from_string(
|
||||
wayland->xkb_context, map_shm, XKB_KEYMAP_FORMAT_TEXT_V1,
|
||||
self->wayland.xkb_context, map_shm, XKB_KEYMAP_FORMAT_TEXT_V1,
|
||||
XKB_KEYMAP_COMPILE_NO_FLAGS);
|
||||
munmap(map_shm, size);
|
||||
close(fd);
|
||||
|
||||
struct xkb_state* xkb_state = xkb_state_new(xkb_keymap);
|
||||
|
||||
wayland->xkb_keymap = xkb_keymap;
|
||||
wayland->xkb_state = xkb_state;
|
||||
self->wayland.xkb_keymap = xkb_keymap;
|
||||
self->wayland.xkb_state = xkb_state;
|
||||
} else {
|
||||
self->wayland.xkb_keymap = self->wayland.parent->wayland.xkb_keymap;
|
||||
self->wayland.xkb_state = self->wayland.parent->wayland.xkb_state;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -700,37 +749,54 @@ static void keyboard_key(void* data,
|
|||
MwU32 time,
|
||||
MwU32 key,
|
||||
MwU32 state) {
|
||||
MwLL self = data;
|
||||
MwLL self = data;
|
||||
MwBool inArea;
|
||||
|
||||
(void)wl_keyboard;
|
||||
(void)serial;
|
||||
(void)time;
|
||||
|
||||
WAYLAND_EVENT_OP_START(self);
|
||||
|
||||
if(self->wayland.type == MWLL_WAYLAND_TOPLEVEL) {
|
||||
struct _MwLLWaylandTopLevel* wayland = self->wayland.toplevel;
|
||||
xkb_layout_index_t layout;
|
||||
xkb_level_index_t level;
|
||||
const xkb_keysym_t* syms_out;
|
||||
MwU32 keycode = key + 8;
|
||||
MwU64 syms_num;
|
||||
int i;
|
||||
if(self->wayland.framebuffer.surface) {
|
||||
inArea |= self->wayland.framebuffer.surface == curSurface;
|
||||
}
|
||||
|
||||
if(!wayland->xkb_keymap) {
|
||||
if(self->wayland.backbuffer.surface) {
|
||||
inArea |= self->wayland.backbuffer.surface == curSurface;
|
||||
}
|
||||
if(inArea) {
|
||||
xkb_layout_index_t layout;
|
||||
MwU32 levels;
|
||||
xkb_level_index_t level;
|
||||
const xkb_keysym_t* syms_out;
|
||||
MwU32 keycode = key + 8;
|
||||
MwU64 syms_num;
|
||||
int i;
|
||||
|
||||
if(!self->wayland.xkb_keymap) {
|
||||
return;
|
||||
}
|
||||
|
||||
layout = xkb_state_key_get_layout(wayland->xkb_state, keycode);
|
||||
level =
|
||||
xkb_keymap_num_levels_for_key(wayland->xkb_keymap, keycode, layout) - 1;
|
||||
syms_num = xkb_keymap_key_get_syms_by_level(wayland->xkb_keymap, keycode, layout, level, &syms_out);
|
||||
layout = xkb_state_key_get_layout(self->wayland.xkb_state, keycode);
|
||||
levels =
|
||||
xkb_keymap_num_levels_for_key(self->wayland.xkb_keymap, keycode, layout);
|
||||
|
||||
if((((self->wayland.mod_state & 1) == 1) || ((self->wayland.mod_state & 2) == 2)) && levels >= 2) {
|
||||
level = 1;
|
||||
} else if(levels >= 1) {
|
||||
level = 0;
|
||||
}
|
||||
syms_num = xkb_keymap_key_get_syms_by_level(self->wayland.xkb_keymap, keycode, layout, level, &syms_out);
|
||||
if(syms_out == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
for(i = 0; i < syms_num; i++) {
|
||||
int sym = syms_out[i];
|
||||
int key;
|
||||
int sym = syms_out[i];
|
||||
int key = -1;
|
||||
const char* name;
|
||||
|
||||
switch(sym) {
|
||||
case XKB_KEY_BackSpace:
|
||||
key = MwLLKeyBackSpace;
|
||||
|
|
@ -768,8 +834,11 @@ static void keyboard_key(void* data,
|
|||
key = MwLLKeyControl;
|
||||
break;
|
||||
default:
|
||||
key = sym;
|
||||
if(MwIsKeyUTF8(sym)) {
|
||||
key = sym;
|
||||
}
|
||||
}
|
||||
|
||||
if((self->wayland.mod_state & 4) == 4) {
|
||||
/* clipboard paste */
|
||||
if(key == 'V') {
|
||||
|
|
@ -785,10 +854,12 @@ static void keyboard_key(void* data,
|
|||
key |= MwLLAltMask;
|
||||
}
|
||||
|
||||
if(state == WL_KEYBOARD_KEY_STATE_PRESSED) {
|
||||
recursive_dispatch_key(self, &key);
|
||||
} else {
|
||||
recursive_dispatch_key_released(self, &key);
|
||||
if(key != -1) {
|
||||
if(state == WL_KEYBOARD_KEY_STATE_PRESSED) {
|
||||
MwLLDispatch(self, key, &key);
|
||||
} else {
|
||||
MwLLDispatch(self, key_released, &key);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1139,11 +1210,10 @@ static void xdg_toplevel_configure(void* data,
|
|||
region_setup(self);
|
||||
MwLLDispatch(self, resize, NULL);
|
||||
|
||||
MwLLDispatch(self, draw, NULL);
|
||||
recursive_dispatch_resize(self);
|
||||
|
||||
if(self->wayland.pointer_constrained) {
|
||||
zwp_locked_pointer_v1_set_cursor_position_hint(self->wayland.locked_pointer, wl_fixed_from_double(self->wayland.ww / 2.), wl_fixed_from_double(self->wayland.wh / 2.));
|
||||
zwp_locked_pointer_v1_set_cursor_position_hint(self->wayland.locked_pointer, 0, CSD_BORDER_FRAME_TOP);
|
||||
wl_surface_commit(self->wayland.framebuffer.surface);
|
||||
}
|
||||
};
|
||||
|
|
@ -1165,6 +1235,8 @@ static void xdg_surface_configure(
|
|||
|
||||
xdg_surface_ack_configure(xdg_surface, serial);
|
||||
|
||||
MwLLDispatch(self, draw, NULL);
|
||||
|
||||
if(self->wayland.configured) {
|
||||
update_buffer(self, &self->wayland.framebuffer);
|
||||
update_buffer(self, &self->wayland.backbuffer);
|
||||
|
|
@ -1188,6 +1260,7 @@ static void wl_shm_interface_destroy(struct _MwLLWayland* wayland, wayland_proto
|
|||
}
|
||||
|
||||
static void update_buffer(MwLL self, struct _MwLLWaylandShmBuffer* buffer) {
|
||||
(void)self;
|
||||
memcpy(buffer->buf, buffer->buf_back, buffer->buf_size);
|
||||
wl_surface_commit(buffer->surface);
|
||||
}
|
||||
|
|
@ -1247,10 +1320,10 @@ static void buffer_destroy(struct _MwLLWaylandShmBuffer* buffer) {
|
|||
if(!buffer->setup) {
|
||||
return;
|
||||
}
|
||||
wl_buffer_destroy(buffer->shm_buffer);
|
||||
wl_buffer_destroy(buffer->shm_buffer_back);
|
||||
wl_shm_pool_destroy(buffer->shm_pool);
|
||||
wl_shm_pool_destroy(buffer->shm_pool_back);
|
||||
if(buffer->shm_buffer) wl_buffer_destroy(buffer->shm_buffer);
|
||||
if(buffer->shm_buffer_back) wl_buffer_destroy(buffer->shm_buffer_back);
|
||||
if(buffer->shm_pool) wl_shm_pool_destroy(buffer->shm_pool);
|
||||
if(buffer->shm_pool_back) wl_shm_pool_destroy(buffer->shm_pool_back);
|
||||
close(buffer->fd);
|
||||
close(buffer->fd_back);
|
||||
buffer->setup = MwFALSE;
|
||||
|
|
@ -1383,14 +1456,14 @@ static void setup_callbacks(struct _MwLLWayland* wayland) {
|
|||
WL_INTERFACE(wl_data_device_manager);
|
||||
WL_INTERFACE(zwp_primary_selection_device_manager_v1);
|
||||
WL_INTERFACE(zwp_pointer_constraints_v1);
|
||||
WL_INTERFACE(zwp_relative_pointer_manager_v1);
|
||||
WL_INTERFACE(xdg_wm_base);
|
||||
if(wayland->type == MWLL_WAYLAND_TOPLEVEL) {
|
||||
WL_INTERFACE(xdg_wm_base);
|
||||
WL_INTERFACE(wp_viewporter);
|
||||
WL_INTERFACE(zxdg_decoration_manager_v1);
|
||||
WL_INTERFACE(xdg_toplevel_icon_manager_v1);
|
||||
WL_INTERFACE(wl_subcompositor);
|
||||
} else if(wayland->type == MWLL_WAYLAND_POPUP) {
|
||||
WL_INTERFACE(xdg_wm_base);
|
||||
} else {
|
||||
WL_INTERFACE(wl_subcompositor);
|
||||
}
|
||||
|
|
@ -1428,7 +1501,7 @@ static void setup_toplevel(MwLL r, int x, int y) {
|
|||
r->wayland.has_decorations = MwTRUE;
|
||||
}
|
||||
|
||||
r->wayland.toplevel->xkb_context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
||||
r->wayland.xkb_context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
||||
|
||||
/* Create a wl_surface, a xdg_surface and a xdg_toplevel */
|
||||
r->wayland.framebuffer.surface = wl_compositor_create_surface(r->wayland.compositor);
|
||||
|
|
@ -1489,11 +1562,11 @@ static void destroy_toplevel(MwLL r) {
|
|||
|
||||
xdg_toplevel_destroy(r->wayland.toplevel->xdg_top_level);
|
||||
|
||||
xkb_keymap_unref(r->wayland.toplevel->xkb_keymap);
|
||||
xkb_keymap_unref(r->wayland.xkb_keymap);
|
||||
|
||||
xkb_state_unref(r->wayland.toplevel->xkb_state);
|
||||
xkb_state_unref(r->wayland.xkb_state);
|
||||
|
||||
xkb_context_unref(r->wayland.toplevel->xkb_context);
|
||||
xkb_context_unref(r->wayland.xkb_context);
|
||||
|
||||
free(r->wayland.toplevel);
|
||||
|
||||
|
|
@ -1521,6 +1594,12 @@ static void setup_sublevel(MwLL parent, MwLL r, int x, int y) {
|
|||
r->wayland.registry = wl_display_get_registry(parent->wayland.display);
|
||||
r->wayland.display = parent->wayland.display;
|
||||
|
||||
if(parent->wayland.type == MWLL_WAYLAND_TOPLEVEL) {
|
||||
r->wayland.sublevel->xdg_surface = parent->wayland.toplevel->xdg_surface;
|
||||
} else {
|
||||
r->wayland.sublevel->xdg_surface = parent->wayland.sublevel->xdg_surface;
|
||||
}
|
||||
|
||||
wl_registry_add_listener(r->wayland.registry, &r->wayland.registry_listener, r);
|
||||
if(wl_display_roundtrip(r->wayland.display) == -1) {
|
||||
printf("roundtrip failed\n");
|
||||
|
|
@ -1530,10 +1609,6 @@ static void setup_sublevel(MwLL parent, MwLL r, int x, int y) {
|
|||
|
||||
r->wayland.framebuffer.surface = wl_compositor_create_surface(compositor);
|
||||
|
||||
if(WAYLAND_GET_INTERFACE(r->wayland, xdg_wm_base))
|
||||
r->wayland.sublevel->xdg_surface =
|
||||
xdg_wm_base_get_xdg_surface(WAYLAND_GET_INTERFACE(r->wayland, xdg_wm_base)->context, r->wayland.framebuffer.surface);
|
||||
|
||||
r->wayland.sublevel->subsurface = wl_subcompositor_get_subsurface(r->wayland.sublevel->subcompositor, r->wayland.framebuffer.surface, parent_surface);
|
||||
|
||||
wl_subsurface_set_desync(r->wayland.sublevel->subsurface);
|
||||
|
|
@ -1543,6 +1618,9 @@ static void setup_sublevel(MwLL parent, MwLL r, int x, int y) {
|
|||
wl_subsurface_place_above(r->wayland.sublevel->subsurface, parent->wayland.framebuffer.surface);
|
||||
}
|
||||
|
||||
r->wayland.xkb_keymap = parent->wayland.xkb_keymap;
|
||||
r->wayland.xkb_state = parent->wayland.xkb_state;
|
||||
|
||||
r->wayland.configured = MwTRUE;
|
||||
}
|
||||
|
||||
|
|
@ -1630,7 +1708,9 @@ static void setup_popup(MwLL r, int x, int y, MwLL parent) {
|
|||
r->wayland.popup->xdg_positioner,
|
||||
r->wayland.x, r->wayland.y, r->wayland.ww, r->wayland.wh);
|
||||
|
||||
xdg_surface = topmost_parent->wayland.toplevel->xdg_surface;
|
||||
xdg_surface = topmost_parent->wayland.toplevel->xdg_surface;
|
||||
r->wayland.xkb_keymap = topmost_parent->wayland.xkb_keymap;
|
||||
r->wayland.xkb_state = topmost_parent->wayland.xkb_state;
|
||||
|
||||
r->wayland.framebuffer.surface = wl_compositor_create_surface(r->wayland.compositor);
|
||||
|
||||
|
|
@ -1847,19 +1927,24 @@ static void MwLLSetWHImpl(MwLL handle, int w, int h) {
|
|||
region_invalidate(handle);
|
||||
|
||||
/* Prevent an integer underflow when the w/h is too low */
|
||||
if((w < 10 || h < 10)) {
|
||||
handle->wayland.ww = 10;
|
||||
handle->wayland.wh = 10;
|
||||
goto refresh;
|
||||
if((w < 2 || h < 2)) {
|
||||
handle->wayland.ww = 2;
|
||||
handle->wayland.wh = 2;
|
||||
} else {
|
||||
handle->wayland.ww = w;
|
||||
handle->wayland.wh = h;
|
||||
}
|
||||
|
||||
handle->wayland.ww = w;
|
||||
handle->wayland.wh = h;
|
||||
|
||||
if(handle->wayland.type == MWLL_WAYLAND_TOPLEVEL && handle->wayland.configured) {
|
||||
xdg_surface_set_window_geometry(handle->wayland.toplevel->xdg_surface, 0, 0, handle->wayland.ww, handle->wayland.wh);
|
||||
}
|
||||
|
||||
if(handle->wayland.type == MWLL_WAYLAND_SUBLEVEL && handle->wayland.configured && !handle->wayland.dispatching_resize) {
|
||||
handle->wayland.dispatching_resize = MwTRUE;
|
||||
MwLLDispatch(handle, resize, NULL);
|
||||
handle->wayland.dispatching_resize = MwFALSE;
|
||||
}
|
||||
|
||||
if(handle->wayland.type == MWLL_WAYLAND_POPUP) {
|
||||
destroy_popup(handle);
|
||||
wl_flush(handle);
|
||||
|
|
@ -2098,9 +2183,7 @@ static void MwLLNextEventImpl(MwLL handle) {
|
|||
}
|
||||
|
||||
if(handle->wayland.force_render) {
|
||||
// if(!handle->wayland.events_pending) {
|
||||
MwLLDispatch(handle, draw, NULL);
|
||||
// }
|
||||
if(handle->wayland.configured) update_buffer(handle, &handle->wayland.framebuffer);
|
||||
handle->wayland.force_render = 0;
|
||||
}
|
||||
|
|
@ -2287,7 +2370,7 @@ static void MwLLSetCursorImpl(MwLL handle, MwCursor* image, MwCursor* mask) {
|
|||
|
||||
/* If there's currently a pointer, set it up. (Otherwise, it'll be setup during the pointer enter event) */
|
||||
if(handle->wayland.pointer != NULL) {
|
||||
wl_pointer_set_cursor(handle->wayland.pointer, handle->wayland.pointer_serial, handle->wayland.cursor.surface, 0, 0);
|
||||
// wl_pointer_set_cursor(handle->wayland.pointer, handle->wayland.pointer_serial, handle->wayland.cursor.surface, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2352,10 +2435,28 @@ static void MwLLFocusImpl(MwLL handle) {
|
|||
}
|
||||
|
||||
static void MwLLGrabPointerImpl(MwLL handle, int toggle) {
|
||||
if(handle->wayland.pointer_constraints) {
|
||||
MwLL topmost_parent = handle;
|
||||
while(topmost_parent->wayland.parent) topmost_parent = topmost_parent->wayland.parent;
|
||||
if(handle->wayland.pointer_constraints && handle->wayland.relative_pointer_manager) {
|
||||
if(toggle) {
|
||||
topmost_parent->wayland.locked_pointer = zwp_pointer_constraints_v1_lock_pointer(topmost_parent->wayland.pointer_constraints, topmost_parent->wayland.backbuffer.surface, topmost_parent->wayland.pointer, topmost_parent->wayland.region, ZWP_POINTER_CONSTRAINTS_V1_LIFETIME_PERSISTENT);
|
||||
wl_surface_commit(topmost_parent->wayland.backbuffer.surface);
|
||||
zwp_locked_pointer_v1_set_cursor_position_hint(topmost_parent->wayland.locked_pointer, 0, CSD_BORDER_FRAME_TOP);
|
||||
handle->wayland.relative_pointer = zwp_relative_pointer_manager_v1_get_relative_pointer(handle->wayland.relative_pointer_manager, handle->wayland.pointer);
|
||||
zwp_relative_pointer_v1_add_listener(handle->wayland.relative_pointer, &relative_pointer_listener, topmost_parent);
|
||||
} else {
|
||||
if(topmost_parent->wayland.locked_pointer) {
|
||||
zwp_locked_pointer_v1_destroy(topmost_parent->wayland.locked_pointer);
|
||||
topmost_parent->wayland.locked_pointer = NULL;
|
||||
}
|
||||
if(topmost_parent->wayland.relative_pointer) {
|
||||
zwp_relative_pointer_v1_destroy(topmost_parent->wayland.relative_pointer);
|
||||
topmost_parent->wayland.relative_pointer = NULL;
|
||||
}
|
||||
}
|
||||
handle->wayland.do_lock_pointer = toggle;
|
||||
} else {
|
||||
printf("[WARNING] MwLLGrabPointer not supported in Wayland session, zwp_pointer_constraints_v1 required.\n");
|
||||
printf("[WARNING] MwLLGrabPointer not supported in Wayland session, zwp_pointer_constraints_v1 and relative_pointer_manager_v1 are required.\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2406,7 +2507,8 @@ static void MwLLGetScreenSizeImpl(MwLL handle, MwRect* rect) {
|
|||
}
|
||||
|
||||
static void MwLLBeginStateChangeImpl(MwLL handle) {
|
||||
MwLLShow(handle, 0);
|
||||
(void)handle;
|
||||
/* no-op */
|
||||
}
|
||||
|
||||
static void MwLLEndStateChangeImpl(MwLL handle) {
|
||||
|
|
@ -2439,9 +2541,8 @@ static void MwLLEndStateChangeImpl(MwLL handle) {
|
|||
int i;
|
||||
for(i = 0; i < arrlen(w->children); i++) {
|
||||
if(w->children[i]->lowlevel->wayland.type == MWLL_WAYLAND_SUBLEVEL) {
|
||||
MwLL child = w->children[i]->lowlevel;
|
||||
child->wayland.sublevel->xdg_surface =
|
||||
xdg_wm_base_get_xdg_surface(WAYLAND_GET_INTERFACE(handle->wayland, xdg_wm_base)->context, handle->wayland.framebuffer.surface);
|
||||
MwLL child = w->children[i]->lowlevel;
|
||||
child->wayland.sublevel->xdg_surface = handle->wayland.popup->xdg_surface;
|
||||
wl_subsurface_destroy(child->wayland.sublevel->subsurface);
|
||||
wl_flush(handle);
|
||||
|
||||
|
|
@ -2466,8 +2567,6 @@ static void MwLLEndStateChangeImpl(MwLL handle) {
|
|||
|
||||
handle->wayland.detatching = MwFALSE;
|
||||
}
|
||||
|
||||
MwLLShow(handle, 1);
|
||||
}
|
||||
|
||||
static int MwLLWaylandCallInitImpl(void) {
|
||||
|
|
|
|||
|
|
@ -558,8 +558,7 @@ static void MwLLNextEventImpl(MwLL handle) {
|
|||
strcpy(str, s);
|
||||
}
|
||||
|
||||
/* HACK: this is bad, you can guess why */
|
||||
if(strlen(str) == 1) {
|
||||
if(MwIsKeyUTF8(sym)) {
|
||||
char s = str[0];
|
||||
|
||||
if(ev.xkey.state & (ShiftMask | LockMask) && !(ev.xkey.state & (ControlMask | Mod1Mask))) {
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ void MwDrawRectFading(MwWidget handle, MwRect* rect, MwLLColor color, int rounde
|
|||
MwRect r = *rect;
|
||||
int roundness = MwGetInteger(handle, MwNroundness);
|
||||
double div;
|
||||
if(rect->width <= 0 || rect->height <= 0){
|
||||
if(rect->width <= 0 || rect->height <= 0) {
|
||||
free(data);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
65
src/string.c
65
src/string.c
|
|
@ -37,6 +37,7 @@ void MwStringTime(char* out, time_t t) {
|
|||
sprintf(out, "%s %2d %02d:%02d %d", months[tm->tm_mon], tm->tm_mday, tm->tm_hour, tm->tm_min, 1900 + tm->tm_year);
|
||||
}
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
void MwStringPrintIntoBuffer(char* out, MwU32 size, const char* fmt, ...) {
|
||||
va_list va;
|
||||
va_start(va, fmt);
|
||||
|
|
@ -49,3 +50,67 @@ void MwStringPrintIntoBuffer(char* out, MwU32 size, const char* fmt, ...) {
|
|||
|
||||
va_end(va);
|
||||
};
|
||||
=======
|
||||
|
||||
MWDECL MwBool MwIsKeyUTF8(MwU32 key) {
|
||||
unsigned char bytes[sizeof(MwU32)];
|
||||
memcpy(bytes, &key, sizeof(MwU32));
|
||||
int i = 0;
|
||||
|
||||
for(i = 0; i < sizeof(MwU32); i++) {
|
||||
if(( // ASCII
|
||||
// use bytes[0] <= 0x7F to allow ASCII control characters
|
||||
bytes[0] == 0x09 ||
|
||||
bytes[0] == 0x0A ||
|
||||
bytes[0] == 0x0D ||
|
||||
(0x20 <= bytes[0] && bytes[0] <= 0x7E))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(( // non-overlong 2-byte
|
||||
(0xC2 <= bytes[0] && bytes[0] <= 0xDF) &&
|
||||
(0x80 <= bytes[1] && bytes[1] <= 0xBF))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(( // excluding overlongs
|
||||
bytes[0] == 0xE0 &&
|
||||
(0xA0 <= bytes[1] && bytes[1] <= 0xBF) &&
|
||||
(0x80 <= bytes[2] && bytes[2] <= 0xBF)) ||
|
||||
( // straight 3-byte
|
||||
((0xE1 <= bytes[0] && bytes[0] <= 0xEC) ||
|
||||
bytes[0] == 0xEE ||
|
||||
bytes[0] == 0xEF) &&
|
||||
(0x80 <= bytes[1] && bytes[1] <= 0xBF) &&
|
||||
(0x80 <= bytes[2] && bytes[2] <= 0xBF)) ||
|
||||
( // excluding surrogates
|
||||
bytes[0] == 0xED &&
|
||||
(0x80 <= bytes[1] && bytes[1] <= 0x9F) &&
|
||||
(0x80 <= bytes[2] && bytes[2] <= 0xBF))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(( // planes 1-3
|
||||
bytes[0] == 0xF0 &&
|
||||
(0x90 <= bytes[1] && bytes[1] <= 0xBF) &&
|
||||
(0x80 <= bytes[2] && bytes[2] <= 0xBF) &&
|
||||
(0x80 <= bytes[3] && bytes[3] <= 0xBF)) ||
|
||||
( // planes 4-15
|
||||
(0xF1 <= bytes[0] && bytes[0] <= 0xF3) &&
|
||||
(0x80 <= bytes[1] && bytes[1] <= 0xBF) &&
|
||||
(0x80 <= bytes[2] && bytes[2] <= 0xBF) &&
|
||||
(0x80 <= bytes[3] && bytes[3] <= 0xBF)) ||
|
||||
( // plane 16
|
||||
bytes[0] == 0xF4 &&
|
||||
(0x80 <= bytes[1] && bytes[1] <= 0x8F) &&
|
||||
(0x80 <= bytes[2] && bytes[2] <= 0xBF) &&
|
||||
(0x80 <= bytes[3] && bytes[3] <= 0xBF))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
>>>>>>> master
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ static int create(MwWidget handle) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void destroy(MwWidget handle){
|
||||
static void destroy(MwWidget handle) {
|
||||
MwBox b = handle->internal;
|
||||
free(b);
|
||||
}
|
||||
|
|
@ -78,7 +78,7 @@ static void layout(MwWidget handle) {
|
|||
static void draw(MwWidget handle) {
|
||||
MwRect r;
|
||||
MwLLColor base = MwParseColor(handle, MwGetText(handle, MwNbackground));
|
||||
MwBox b = handle->internal;
|
||||
MwBox b = handle->internal;
|
||||
|
||||
r.x = 0;
|
||||
r.y = 0;
|
||||
|
|
@ -93,7 +93,7 @@ static void draw(MwWidget handle) {
|
|||
|
||||
MwLLFreeColor(base);
|
||||
|
||||
if(b->layout){
|
||||
if(b->layout) {
|
||||
layout(handle);
|
||||
|
||||
b->layout = 0;
|
||||
|
|
@ -101,8 +101,8 @@ static void draw(MwWidget handle) {
|
|||
}
|
||||
|
||||
static void prop_change(MwWidget handle, const char* key) {
|
||||
if(strcmp(key, MwNorientation) == 0){
|
||||
MwBox b = handle->internal;
|
||||
if(strcmp(key, MwNorientation) == 0) {
|
||||
MwBox b = handle->internal;
|
||||
b->layout = 1;
|
||||
|
||||
MwForceRender(handle);
|
||||
|
|
@ -112,8 +112,8 @@ static void prop_change(MwWidget handle, const char* key) {
|
|||
static void children_prop_change(MwWidget handle, MwWidget child, const char* key) {
|
||||
(void)child;
|
||||
|
||||
if(strcmp(key, MwNratio) == 0 || strcmp(key, MwNfixedSize) == 0){
|
||||
MwBox b = handle->internal;
|
||||
if(strcmp(key, MwNratio) == 0 || strcmp(key, MwNfixedSize) == 0) {
|
||||
MwBox b = handle->internal;
|
||||
b->layout = 1;
|
||||
|
||||
MwForceRender(handle);
|
||||
|
|
@ -121,14 +121,14 @@ static void children_prop_change(MwWidget handle, MwWidget child, const char* ke
|
|||
}
|
||||
|
||||
static void resize(MwWidget handle) {
|
||||
MwBox b = handle->internal;
|
||||
MwBox b = handle->internal;
|
||||
b->layout = 1;
|
||||
|
||||
MwForceRender(handle);
|
||||
}
|
||||
|
||||
static void children_update(MwWidget handle) {
|
||||
MwBox b = handle->internal;
|
||||
MwBox b = handle->internal;
|
||||
b->layout = 1;
|
||||
|
||||
MwForceRender(handle);
|
||||
|
|
|
|||
|
|
@ -316,6 +316,7 @@ static int create(MwWidget handle) {
|
|||
if(!eglMakeCurrent(display, surface, surface, context)) {
|
||||
printf("ERROR: eglMakeCurrent (setup): %0X\n", eglGetError());
|
||||
}
|
||||
eglSwapInterval(o->egl_display, 0);
|
||||
|
||||
o->egl_display = display;
|
||||
o->egl_surface = surface;
|
||||
|
|
@ -425,8 +426,6 @@ static void mwOpenGLMakeCurrentImpl(MwWidget handle) {
|
|||
o->egl_context)) {
|
||||
printf("ERROR: eglMakeCurrent, %0X\n", eglGetError());
|
||||
}
|
||||
|
||||
eglSwapInterval(o->egl_display, 1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
@ -450,6 +449,7 @@ static void mwOpenGLSwapBufferImpl(MwWidget handle) {
|
|||
#ifdef USE_WAYLAND
|
||||
if(handle->lowlevel->common.type == MwLLBackendWayland) {
|
||||
waylandopengl_t* o = handle->internal;
|
||||
eglSwapInterval(o->egl_display, 0);
|
||||
if(!eglSwapBuffers(o->egl_display, o->egl_surface)) {
|
||||
printf("ERROR: eglSwapBuffers, %0X\n", eglGetError());
|
||||
};
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ sub generate {
|
|||
print(OUT "LD = $link\n");
|
||||
print(OUT "\n");
|
||||
print(OUT
|
||||
"CFLAGS = ${inc}include ${def}_MILSKO ${def}USE_GDI ${def}USE_STB_TRUETYPE ${def}USE_STB_IMAGE ${def}STBI_NO_SIMD\n"
|
||||
"CFLAGS = ${inc}include ${inc}external${dir}libz${dir}include ${def}_MILSKO ${def}USE_GDI ${def}USE_STB_TRUETYPE ${def}USE_STB_IMAGE ${def}STBI_NO_SIMD\n"
|
||||
);
|
||||
print(OUT "LDFLAGS = $dll");
|
||||
print(OUT "\n");
|
||||
|
|
@ -143,6 +143,7 @@ sub generate {
|
|||
|
||||
scan("src");
|
||||
scan("external");
|
||||
scan("external/libz/src");
|
||||
scan("src/icon");
|
||||
scan("src/cursor");
|
||||
scan("src/widget");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue