From 2d5434e9abf570ffd19b22c90963ea71cfb91d3d Mon Sep 17 00:00:00 2001 From: xenia Date: Tue, 2 Jul 2024 02:34:29 -0400 Subject: [PATCH] fix window app_id in KDE/wayland --- bitmap2component/CMakeLists.txt | 2 +- common/single_top.cpp | 17 ++++++++++++++++- eeschema/CMakeLists.txt | 2 +- gerbview/CMakeLists.txt | 2 +- kicad/kicad.cpp | 14 +++++++++++++- pagelayout_editor/CMakeLists.txt | 2 +- pcb_calculator/CMakeLists.txt | 2 +- pcbnew/CMakeLists.txt | 2 +- 8 files changed, 35 insertions(+), 8 deletions(-) diff --git a/bitmap2component/CMakeLists.txt b/bitmap2component/CMakeLists.txt index 4c33940d45..36e25aa5d8 100644 --- a/bitmap2component/CMakeLists.txt +++ b/bitmap2component/CMakeLists.txt @@ -22,7 +22,7 @@ set( BITMAP2COMPONENT_SRCS ) set_source_files_properties( ${CMAKE_SOURCE_DIR}/common/single_top.cpp PROPERTIES - COMPILE_DEFINITIONS "TOP_FRAME=FRAME_BM2CMP" + COMPILE_DEFINITIONS "TOP_FRAME=FRAME_BM2CMP;KICAD_WINDOW_APP_ID=org.kicad.bitmap2component" ) if( WIN32 ) diff --git a/common/single_top.cpp b/common/single_top.cpp index f6ddbc261a..66c5780458 100644 --- a/common/single_top.cpp +++ b/common/single_top.cpp @@ -298,7 +298,22 @@ struct APP_SINGLE_TOP : public wxApp #endif }; -IMPLEMENT_APP( APP_SINGLE_TOP ) +wxIMPLEMENT_WX_THEME_SUPPORT +wxIMPLEMENT_APP_NO_MAIN( APP_SINGLE_TOP ); +#if defined(__WINDOWS__) +wxIMPLEMENT_WXWIN_MAIN +#else +int main(int argc, char** argv) { + wxDISABLE_DEBUG_SUPPORT(); + // replace argv[0] and thus the window app_id +#define _APP_ID_STR(app_id) #app_id +#define _APP_ID_STR2(app_id) _APP_ID_STR(app_id) + argv[0] = (char*) _APP_ID_STR2(KICAD_WINDOW_APP_ID); +#undef _APP_ID_STR2 +#undef _APP_ID_STR + return wxEntry(argc, argv); +} +#endif bool PGM_SINGLE_TOP::OnPgmInit() diff --git a/eeschema/CMakeLists.txt b/eeschema/CMakeLists.txt index 734fb5fc29..c703b22992 100644 --- a/eeschema/CMakeLists.txt +++ b/eeschema/CMakeLists.txt @@ -520,7 +520,7 @@ if( KICAD_USE_SENTRY ) endif() set_source_files_properties( ${CMAKE_SOURCE_DIR}/common/single_top.cpp PROPERTIES - COMPILE_DEFINITIONS "TOP_FRAME=FRAME_SCH;PGM_DATA_FILE_EXT=\"kicad_sch\";BUILD_KIWAY_DLL" + COMPILE_DEFINITIONS "TOP_FRAME=FRAME_SCH;PGM_DATA_FILE_EXT=\"kicad_sch\";BUILD_KIWAY_DLL;KICAD_WINDOW_APP_ID=org.kicad.eeschema" ) target_link_libraries( eeschema #singletop # replaces common, giving us restrictive control and link warnings. diff --git a/gerbview/CMakeLists.txt b/gerbview/CMakeLists.txt index 669a26d366..0fb17ac7fc 100644 --- a/gerbview/CMakeLists.txt +++ b/gerbview/CMakeLists.txt @@ -112,7 +112,7 @@ if( KICAD_USE_SENTRY ) endif() set_source_files_properties( ${CMAKE_SOURCE_DIR}/common/single_top.cpp PROPERTIES - COMPILE_DEFINITIONS "TOP_FRAME=FRAME_GERBER;BUILD_KIWAY_DLL" + COMPILE_DEFINITIONS "TOP_FRAME=FRAME_GERBER;BUILD_KIWAY_DLL;KICAD_WINDOW_APP_ID=org.kicad.gerbview" ) target_link_libraries( gerbview #singletop # replaces common, giving us restrictive control and link warnings. diff --git a/kicad/kicad.cpp b/kicad/kicad.cpp index 8c4ac5cf7b..0817f7f699 100644 --- a/kicad/kicad.cpp +++ b/kicad/kicad.cpp @@ -583,7 +583,19 @@ struct APP_KICAD : public wxApp #endif }; -IMPLEMENT_APP( APP_KICAD ) +wxIMPLEMENT_WX_THEME_SUPPORT +wxIMPLEMENT_APP_NO_MAIN( APP_KICAD ); +#if defined(__WINDOWS__) +wxIMPLEMENT_WXWIN_MAIN +#else +int main(int argc, char** argv) +{ + wxDISABLE_DEBUG_SUPPORT(); + // replace argv[0] and thus the window app_id + argv[0] = (char*) "org.kicad.kicad"; + return wxEntry(argc, argv); +} +#endif // The C++ project manager supports one open PROJECT, so Prj() calls within diff --git a/pagelayout_editor/CMakeLists.txt b/pagelayout_editor/CMakeLists.txt index 731b7e712f..8185cb7430 100644 --- a/pagelayout_editor/CMakeLists.txt +++ b/pagelayout_editor/CMakeLists.txt @@ -83,7 +83,7 @@ if( KICAD_USE_SENTRY ) endif() set_source_files_properties( ${CMAKE_SOURCE_DIR}/common/single_top.cpp PROPERTIES - COMPILE_DEFINITIONS "TOP_FRAME=FRAME_PL_EDITOR;PGM_DATA_FILE_EXT=\"kicad_wks\";BUILD_KIWAY_DLL" + COMPILE_DEFINITIONS "TOP_FRAME=FRAME_PL_EDITOR;PGM_DATA_FILE_EXT=\"kicad_wks\";BUILD_KIWAY_DLL;KICAD_WINDOW_APP_ID=org.kicad.pl_editor" ) target_link_libraries( pl_editor #singletop # replaces common, giving us restrictive control and link warnings. diff --git a/pcb_calculator/CMakeLists.txt b/pcb_calculator/CMakeLists.txt index b1e4be0f54..7ed85b4fc3 100644 --- a/pcb_calculator/CMakeLists.txt +++ b/pcb_calculator/CMakeLists.txt @@ -97,7 +97,7 @@ if( KICAD_USE_SENTRY ) endif() set_source_files_properties( ${CMAKE_SOURCE_DIR}/common/single_top.cpp PROPERTIES - COMPILE_DEFINITIONS "TOP_FRAME=FRAME_CALC;BUILD_KIWAY_DLL" + COMPILE_DEFINITIONS "TOP_FRAME=FRAME_CALC;BUILD_KIWAY_DLL;KICAD_WINDOW_APP_ID=org.kicad.pcbcalculator" ) target_link_libraries( pcb_calculator #singletop # replaces common, giving us restrictive control and link warnings. diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt index 21e452cf34..55d88c6cf9 100644 --- a/pcbnew/CMakeLists.txt +++ b/pcbnew/CMakeLists.txt @@ -609,7 +609,7 @@ add_executable( pcbnew WIN32 MACOSX_BUNDLE ${PCBNEW_RESOURCES} ) set_source_files_properties( ${CMAKE_SOURCE_DIR}/common/single_top.cpp pcbnew.cpp PROPERTIES - COMPILE_DEFINITIONS "TOP_FRAME=FRAME_PCB_EDITOR;PGM_DATA_FILE_EXT=\"kicad_pcb\";BUILD_KIWAY_DLL" + COMPILE_DEFINITIONS "TOP_FRAME=FRAME_PCB_EDITOR;PGM_DATA_FILE_EXT=\"kicad_pcb\";BUILD_KIWAY_DLL;KICAD_WINDOW_APP_ID=org.kicad.pcbnew" ) target_link_libraries( pcbnew #singletop # replaces common, giving us restrictive control and link warnings.