Compare commits

...

3 Commits

Author SHA1 Message Date
dijunkun
ecbec4d301 [ci] use rolling cache keys for xmake dependency caches 2026-04-14 02:16:17 +08:00
dijunkun
21425c7132 [fix] fix system tray icon display issue 2026-04-14 01:54:03 +08:00
dijunkun
3e95a7ba29 [fix] fix startup failure caused by wgc_plugin working directory change 2026-04-14 01:53:20 +08:00
5 changed files with 42 additions and 10 deletions

View File

@@ -115,7 +115,7 @@ jobs:
uses: actions/cache@v5 uses: actions/cache@v5
with: with:
path: ~/.xmake/packages path: ~/.xmake/packages
key: ${{ runner.os }}-xmake-deps-${{ matrix.cache-key }}-${{ github.sha }} key: "${{ runner.os }}-xmake-deps-${{ matrix.cache-key }}-${{ github.run_id }}"
restore-keys: | restore-keys: |
${{ runner.os }}-xmake-deps-${{ matrix.cache-key }}- ${{ runner.os }}-xmake-deps-${{ matrix.cache-key }}-
@@ -172,7 +172,7 @@ jobs:
uses: actions/cache@v5 uses: actions/cache@v5
with: with:
path: D:\xmake_global\.xmake\packages path: D:\xmake_global\.xmake\packages
key: ${{ runner.os }}-xmake-deps-intel-${{ github.sha }} key: "${{ runner.os }}-xmake-deps-intel-${{ github.run_id }}"
restore-keys: | restore-keys: |
${{ runner.os }}-xmake-deps-intel- ${{ runner.os }}-xmake-deps-intel-

View File

@@ -1,2 +1,2 @@
// Application icon (IDI_ICON1 = 1, which is the default app icon resource ID) // Application icon resource; load by the resource name IDI_ICON1.
IDI_ICON1 ICON "..\\..\\icons\\windows\\crossdesk.ico" IDI_ICON1 ICON "..\\..\\icons\\windows\\crossdesk.ico"

View File

@@ -7,8 +7,8 @@
#include <X11/Xlib.h> #include <X11/Xlib.h>
#endif #endif
#include <cstdlib>
#include <cmath> #include <cmath>
#include <cstdlib>
#include <cstring> #include <cstring>
#include <filesystem> #include <filesystem>
#include <fstream> #include <fstream>
@@ -28,6 +28,7 @@
#include "screen_capturer_factory.h" #include "screen_capturer_factory.h"
#include "version_checker.h" #include "version_checker.h"
#if defined(__APPLE__) #if defined(__APPLE__)
#include "window_util_mac.h" #include "window_util_mac.h"
#endif #endif
@@ -63,6 +64,19 @@ bool CanReadFontFile(const char* font_path) {
return font_file.good(); return font_file.good();
} }
#if _WIN32
HICON LoadTrayIcon() {
HMODULE module = GetModuleHandleW(nullptr);
HICON icon = reinterpret_cast<HICON>(
LoadImageW(module, L"IDI_ICON1", IMAGE_ICON, 0, 0, LR_DEFAULTSIZE));
if (icon) {
return icon;
}
return LoadIconW(nullptr, IDI_APPLICATION);
}
#endif
#if defined(__linux__) && !defined(__APPLE__) #if defined(__linux__) && !defined(__APPLE__)
inline bool X11GetDisplayAndWindow(SDL_Window* window, Display** display_out, inline bool X11GetDisplayAndWindow(SDL_Window* window, Display** display_out,
::Window* x11_window_out) { ::Window* x11_window_out) {
@@ -975,8 +989,9 @@ void Render::UpdateInteractions() {
screen_capturer_is_started_ && !start_mouse_controller_ && screen_capturer_is_started_ && !start_mouse_controller_ &&
mouse_controller_is_started_; mouse_controller_is_started_;
if (stop_wayland_mouse_before_screen) { if (stop_wayland_mouse_before_screen) {
LOG_INFO("Stopping Wayland mouse controller before screen capturer to " LOG_INFO(
"cleanly release the shared portal session"); "Stopping Wayland mouse controller before screen capturer to "
"cleanly release the shared portal session");
StopMouseController(); StopMouseController();
mouse_controller_is_started_ = false; mouse_controller_is_started_ = false;
} }
@@ -1087,8 +1102,7 @@ int Render::CreateMainWindow() {
HWND main_hwnd = (HWND)SDL_GetPointerProperty( HWND main_hwnd = (HWND)SDL_GetPointerProperty(
props, SDL_PROP_WINDOW_WIN32_HWND_POINTER, NULL); props, SDL_PROP_WINDOW_WIN32_HWND_POINTER, NULL);
HICON tray_icon = (HICON)LoadImageW(NULL, L"crossdesk.ico", IMAGE_ICON, 0, 0, HICON tray_icon = LoadTrayIcon();
LR_LOADFROMFILE | LR_DEFAULTSIZE);
tray_ = std::make_unique<WinTray>(main_hwnd, tray_icon, L"CrossDesk", tray_ = std::make_unique<WinTray>(main_hwnd, tray_icon, L"CrossDesk",
localization_language_index_); localization_language_index_);
#endif #endif
@@ -2311,7 +2325,8 @@ void Render::UpdateRenderRect() {
rect_f.h = render_area_width * video_ratio_reverse; rect_f.h = render_area_width * video_ratio_reverse;
} else if (render_area_width > render_area_height * video_ratio) { } else if (render_area_width > render_area_height * video_ratio) {
rect_f.x = rect_f.x =
std::abs(render_area_width - render_area_height * video_ratio) / 2.0f + std::abs(render_area_width - render_area_height * video_ratio) /
2.0f +
props->render_window_x_; props->render_window_x_;
rect_f.y = props->render_window_y_; rect_f.y = props->render_window_y_;
rect_f.w = render_area_height * video_ratio; rect_f.w = render_area_height * video_ratio;

View File

@@ -1,9 +1,26 @@
#include <mutex>
#include "path_manager.h"
#include "rd_log.h"
#include "screen_capturer_wgc.h" #include "screen_capturer_wgc.h"
#include "wgc_plugin_api.h" #include "wgc_plugin_api.h"
namespace {
void InitializePluginLogger() {
static std::once_flag once;
std::call_once(once, []() {
crossdesk::PathManager path_manager("CrossDesk");
crossdesk::InitLogger(path_manager.GetLogPath().string());
});
}
} // namespace
extern "C" { extern "C" {
crossdesk::ScreenCapturer* CrossDeskCreateWgcCapturer() { crossdesk::ScreenCapturer* CrossDeskCreateWgcCapturer() {
InitializePluginLogger();
return new crossdesk::ScreenCapturerWgc(); return new crossdesk::ScreenCapturerWgc();
} }

View File

@@ -155,7 +155,7 @@ function setup_targets()
target("wgc_plugin") target("wgc_plugin")
set_kind("shared") set_kind("shared")
add_packages("libyuv") add_packages("libyuv")
add_deps("rd_log") add_deps("rd_log", "path_manager")
add_defines("CROSSDESK_WGC_PLUGIN_BUILD=1") add_defines("CROSSDESK_WGC_PLUGIN_BUILD=1")
add_links("windowsapp") add_links("windowsapp")
add_files("src/screen_capturer/windows/screen_capturer_wgc.cpp", add_files("src/screen_capturer/windows/screen_capturer_wgc.cpp",