Skip to content

Commit 0860959

Browse files
authored
UI: Upgrade to wxWidgets 3.3.1 and add dark mode support for Windows (#1647)
1 parent 4efa40c commit 0860959

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+1226
-1647
lines changed

CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ if (ENABLE_VCPKG)
3737
endif()
3838

3939
if(UNIX AND NOT APPLE)
40-
set(VCPKG_OVERLAY_PORTS "${CMAKE_CURRENT_LIST_DIR}/dependencies/vcpkg_overlay_ports_linux")
40+
set(VCPKG_OVERLAY_PORTS "${CMAKE_CURRENT_LIST_DIR}/dependencies/vcpkg_overlay_ports_linux;${CMAKE_CURRENT_LIST_DIR}/dependencies/vcpkg_overlay_ports")
4141
elseif(APPLE)
42-
set(VCPKG_OVERLAY_PORTS "${CMAKE_CURRENT_LIST_DIR}/dependencies/vcpkg_overlay_ports_mac")
42+
set(VCPKG_OVERLAY_PORTS "${CMAKE_CURRENT_LIST_DIR}/dependencies/vcpkg_overlay_ports_mac;${CMAKE_CURRENT_LIST_DIR}/dependencies/vcpkg_overlay_ports")
4343
else()
44-
set(VCPKG_OVERLAY_PORTS "${CMAKE_CURRENT_LIST_DIR}/dependencies/vcpkg_overlay_ports")
44+
set(VCPKG_OVERLAY_PORTS "${CMAKE_CURRENT_LIST_DIR}/dependencies/vcpkg_overlay_ports_win;${CMAKE_CURRENT_LIST_DIR}/dependencies/vcpkg_overlay_ports")
4545
endif()
4646
set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/vcpkg/scripts/buildsystems/vcpkg.cmake"
4747
CACHE STRING "Vcpkg toolchain file")
@@ -199,7 +199,7 @@ if(UNIX AND NOT APPLE)
199199
endif()
200200

201201
if (ENABLE_WXWIDGETS)
202-
find_package(wxWidgets 3.2 REQUIRED COMPONENTS base core gl propgrid xrc)
202+
find_package(wxWidgets 3.3 REQUIRED COMPONENTS base core gl propgrid xrc)
203203
endif()
204204

205205
if (ENABLE_CUBEB)

dependencies/vcpkg

Submodule vcpkg updated 2682 files
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
cmake_minimum_required(VERSION 3.7)
2+
3+
project(wxwidgets-example)
4+
5+
add_executable(main WIN32 popup.cpp)
6+
7+
find_package(wxWidgets REQUIRED)
8+
target_compile_definitions(main PRIVATE ${wxWidgets_DEFINITIONS} "$<$<CONFIG:DEBUG>:${wxWidgets_DEFINITIONS_DEBUG}>")
9+
target_include_directories(main PRIVATE ${wxWidgets_INCLUDE_DIRS})
10+
target_link_libraries(main PRIVATE ${wxWidgets_LIBRARIES})
11+
12+
add_executable(main2 WIN32 popup.cpp)
13+
14+
find_package(wxWidgets CONFIG REQUIRED)
15+
target_link_libraries(main2 PRIVATE wx::core wx::base)
16+
17+
option(USE_WXRC "Use the wxrc resource compiler" ON)
18+
if(USE_WXRC)
19+
execute_process(
20+
COMMAND "${wxWidgets_wxrc_EXECUTABLE}" --help
21+
RESULTS_VARIABLE error_result
22+
)
23+
if(error_result)
24+
message(FATAL_ERROR "Failed to run wxWidgets_wxrc_EXECUTABLE (${wxWidgets_wxrc_EXECUTABLE})")
25+
endif()
26+
endif()
27+
28+
set(PRINT_VARS "" CACHE STRING "Variables to print at the end of configuration")
29+
foreach(var IN LISTS PRINT_VARS)
30+
message(STATUS "${var}:=${${var}}")
31+
endforeach()
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp
2+
index 2b9e0d7f7e..7eab8b37df 100644
3+
--- a/src/msw/listctrl.cpp
4+
+++ b/src/msw/listctrl.cpp
5+
@@ -3110,6 +3110,11 @@ bool HandleSubItemPrepaint(wxListCtrl* listctrl, LPNMLVCUSTOMDRAW pLVCD, HFONT h
6+
7+
if ( it.iImage != -1 )
8+
{
9+
+ if ( !listctrl->HasCheckBoxes() )
10+
+ {
11+
+ rc.left -= 6;
12+
+ }
13+
+
14+
const int yImage = rc.top + ((rc.bottom - rc.top) / 2 - hImage / 2);
15+
ImageList_Draw(himl, it.iImage, hdc, rc.left, yImage,
16+
nmcd.uItemState & CDIS_SELECTED ? ILD_SELECTED
17+
@@ -3235,7 +3240,7 @@ void HandleItemPaint(wxListCtrl* listctrl, LPNMLVCUSTOMDRAW pLVCD, HFONT hfont)
18+
// do not draw item background colour under the checkbox/image
19+
RECT rcIcon;
20+
wxGetListCtrlItemRect(nmcd.hdr.hwndFrom, nmcd.dwItemSpec, LVIR_ICON, rcIcon);
21+
- if ( !::IsRectEmpty(&rcIcon) )
22+
+ if ( !::IsRectEmpty(&rcIcon) && listctrl->HasCheckBoxes() )
23+
rc.left = rcIcon.right + listctrl->FromDIP(GAP_BETWEEN_CHECKBOX_AND_TEXT);
24+
}
25+
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
diff --git a/build/cmake/config.cmake b/build/cmake/config.cmake
2+
index b359560..7504458 100644
3+
--- a/build/cmake/config.cmake
4+
+++ b/build/cmake/config.cmake
5+
@@ -39,8 +39,14 @@ macro(wx_get_dependencies var lib)
6+
else()
7+
# For the value like $<$<CONFIG:DEBUG>:LIB_PATH>
8+
# Or $<$<NOT:$<CONFIG:DEBUG>>:LIB_PATH>
9+
- string(REGEX REPLACE "^.+>:(.+)>$" "\\1" dep_name ${dep})
10+
- if (NOT dep_name)
11+
+ if(dep MATCHES "^(.+>):(.+)>$")
12+
+ if(CMAKE_BUILD_TYPE STREQUAL "Debug" AND CMAKE_MATCH_1 STREQUAL [[$<$<NOT:$<CONFIG:DEBUG>>]])
13+
+ continue()
14+
+ elseif(CMAKE_BUILD_TYPE STREQUAL "Release" AND CMAKE_MATCH_1 STREQUAL [[$<$<CONFIG:DEBUG>]])
15+
+ continue()
16+
+ endif()
17+
+ set(dep_name "${CMAKE_MATCH_2}")
18+
+ else()
19+
set(dep_name ${dep})
20+
endif()
21+
endif()
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
diff --git a/build/cmake/modules/FindPCRE2.cmake b/build/cmake/modules/FindPCRE2.cmake
2+
index a27693a..455675a 100644
3+
--- a/build/cmake/modules/FindPCRE2.cmake
4+
+++ b/build/cmake/modules/FindPCRE2.cmake
5+
@@ -24,7 +24,10 @@ set(PCRE2_CODE_UNIT_WIDTH_USED "${PCRE2_CODE_UNIT_WIDTH}" CACHE INTERNAL "")
6+
7+
find_package(PkgConfig QUIET)
8+
pkg_check_modules(PC_PCRE2 QUIET libpcre2-${PCRE2_CODE_UNIT_WIDTH})
9+
+set(PCRE2_LIBRARIES ${PC_PCRE2_LINK_LIBRARIES})
10+
+set(PCRE2_INCLUDE_DIRS ${PC_PCRE2_INCLUDE_DIRS})
11+
12+
+if (0)
13+
find_path(PCRE2_INCLUDE_DIRS
14+
NAMES pcre2.h
15+
HINTS ${PC_PCRE2_INCLUDEDIR}
16+
@@ -36,6 +39,7 @@ find_library(PCRE2_LIBRARIES
17+
HINTS ${PC_PCRE2_LIBDIR}
18+
${PC_PCRE2_LIBRARY_DIRS}
19+
)
20+
+endif()
21+
22+
include(FindPackageHandleStandardArgs)
23+
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PCRE2 REQUIRED_VARS PCRE2_LIBRARIES PCRE2_INCLUDE_DIRS VERSION_VAR PC_PCRE2_VERSION)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
diff --git a/build/cmake/modules/FindGTK3.cmake b/build/cmake/modules/FindGTK3.cmake
2+
index d2939a1..daf33fe 100644
3+
--- a/build/cmake/modules/FindGTK3.cmake
4+
+++ b/build/cmake/modules/FindGTK3.cmake
5+
@@ -47,6 +47,12 @@ include(CheckSymbolExists)
6+
set(CMAKE_REQUIRED_INCLUDES ${GTK3_INCLUDE_DIRS})
7+
check_symbol_exists(GDK_WINDOWING_WAYLAND "gdk/gdk.h" wxHAVE_GDK_WAYLAND)
8+
check_symbol_exists(GDK_WINDOWING_X11 "gdk/gdk.h" wxHAVE_GDK_X11)
9+
+# With Lerc support in TIFF, Gtk3 may carry C++ compiler libs which break FindWxWidgets.cmake.
10+
+# WxWidgets is C++, so we can remove them here using the inverse pattern.
11+
+set(cxx_libs "${CMAKE_CXX_IMPLICIT_LINK_LIBRARIES}")
12+
+list(REMOVE_ITEM cxx_libs ${CMAKE_C_IMPLICIT_LINK_LIBRARIES})
13+
+list(REMOVE_ITEM GTK3_LINK_LIBRARIES ${cxx_libs})
14+
+set(GTK3_LIBRARIES "${GTK3_LINK_LIBRARIES}" CACHE INTERNAL "")
15+
include(FindPackageHandleStandardArgs)
16+
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK3 DEFAULT_MSG GTK3_INCLUDE_DIRS GTK3_LIBRARIES VERSION_OK)
17+
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
diff --git a/build/cmake/init.cmake b/build/cmake/init.cmake
2+
index f044d22d4d..48fc5ad072 100644
3+
--- a/build/cmake/init.cmake
4+
+++ b/build/cmake/init.cmake
5+
@@ -198,7 +198,7 @@ if(WIN32)
6+
endif()
7+
endif()
8+
9+
-if(WIN32_MSVC_NAMING)
10+
+if(0)
11+
if(wxBUILD_SHARED)
12+
set(lib_suffix "_dll")
13+
else()
14+
diff --git a/build/cmake/install.cmake b/build/cmake/install.cmake
15+
index a373983043..2e1ace7bf9 100644
16+
--- a/build/cmake/install.cmake
17+
+++ b/build/cmake/install.cmake
18+
@@ -63,7 +63,7 @@ else()
19+
20+
install(DIRECTORY DESTINATION "bin")
21+
install(CODE "execute_process( \
22+
- COMMAND ${CMAKE_COMMAND} -E create_symlink \
23+
+ COMMAND ${CMAKE_COMMAND} -E copy \
24+
\"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/wx/config/${wxBUILD_FILE_ID}\" \
25+
\"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/wx-config\" \
26+
)"
27+
diff --git a/build/cmake/utils/CMakeLists.txt b/build/cmake/utils/CMakeLists.txt
28+
index 15f4339ef9..f93849e025 100644
29+
--- a/build/cmake/utils/CMakeLists.txt
30+
+++ b/build/cmake/utils/CMakeLists.txt
31+
@@ -39,7 +39,7 @@ if(wxUSE_XRC)
32+
33+
# Don't use wx_install() here to preserve escaping.
34+
install(CODE "execute_process( \
35+
- COMMAND ${CMAKE_COMMAND} -E create_symlink \
36+
+ COMMAND ${CMAKE_COMMAND} -E copy \
37+
\"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/${wxrc_output_name}${EXE_SUFFIX}\" \
38+
\"\$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/bin/wxrc${EXE_SUFFIX}\" \
39+
)"
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/build/cmake/wxWidgetsConfig.cmake.in b/build/cmake/wxWidgetsConfig.cmake.in
2+
index b251109..60cf762 100644
3+
--- a/build/cmake/wxWidgetsConfig.cmake.in
4+
+++ b/build/cmake/wxWidgetsConfig.cmake.in
5+
@@ -1,5 +1,8 @@
6+
@PACKAGE_INIT@
7+
8+
+include(CMakeFindDependencyMacro)
9+
+find_dependency(NanoSVG CONFIG)
10+
+
11+
cmake_policy(PUSH)
12+
# Set policies to prevent warnings
13+
if(POLICY CMP0057)

0 commit comments

Comments
 (0)