mirror of
https://github.com/kunkundi/crossdesk.git
synced 2026-10-18 01:46:47 +08:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5b60695a52 | ||
|
|
0002bcea74 |
@@ -1,6 +1,9 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
|
# Keep readelf and ldd output stable for the runtime dependency checks below.
|
||||||
|
export LC_ALL=C
|
||||||
|
|
||||||
if [[ $# -lt 3 || $# -gt 4 ]]; then
|
if [[ $# -lt 3 || $# -gt 4 ]]; then
|
||||||
echo "Usage: $0 <debian-arch> <xmake-arch> <version> [extra-recommendation]" >&2
|
echo "Usage: $0 <debian-arch> <xmake-arch> <version> [extra-recommendation]" >&2
|
||||||
exit 2
|
exit 2
|
||||||
@@ -169,11 +172,12 @@ EOF
|
|||||||
|
|
||||||
cat > "$DESKTOP_DIR/$PKG_NAME.desktop" <<EOF
|
cat > "$DESKTOP_DIR/$PKG_NAME.desktop" <<EOF
|
||||||
[Desktop Entry]
|
[Desktop Entry]
|
||||||
Version=$DEB_VERSION
|
Version=1.0
|
||||||
Name=$APP_NAME
|
Name=$APP_NAME
|
||||||
Comment=$DESCRIPTION
|
Comment=$DESCRIPTION
|
||||||
Exec=/usr/bin/$PKG_NAME
|
Exec=/usr/bin/$PKG_NAME
|
||||||
Icon=$PKG_NAME
|
Icon=$PKG_NAME
|
||||||
|
StartupWMClass=$PKG_NAME
|
||||||
Terminal=false
|
Terminal=false
|
||||||
Type=Application
|
Type=Application
|
||||||
Categories=Utility;
|
Categories=Utility;
|
||||||
|
|||||||
@@ -1111,6 +1111,9 @@ void GuiApplication::InitializeUi() {
|
|||||||
wayland_display_guard.emplace("WAYLAND_DISPLAY");
|
wayland_display_guard.emplace("WAYLAND_DISPLAY");
|
||||||
wayland_socket_guard.emplace("WAYLAND_SOCKET");
|
wayland_socket_guard.emplace("WAYLAND_SOCKET");
|
||||||
}
|
}
|
||||||
|
// Match crossdesk.desktop even when the Debian launcher runs crossdesk-bin.
|
||||||
|
// Set this before creating any windows so X11 and Wayland share the same id.
|
||||||
|
slint::set_xdg_app_id("crossdesk");
|
||||||
#endif
|
#endif
|
||||||
ui_ = std::make_unique<SlintUi>();
|
ui_ = std::make_unique<SlintUi>();
|
||||||
ui_->video_presenter =
|
ui_->video_presenter =
|
||||||
@@ -1151,6 +1154,7 @@ void GuiApplication::InitializeSystemTray() {
|
|||||||
ui_->main->show();
|
ui_->main->show();
|
||||||
ui_->main->window().set_minimized(false);
|
ui_->main->window().set_minimized(false);
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
|
MacActivateWindow(ui_->main->window().appkit_view());
|
||||||
// A window restored from the tray may only obtain its NSWindow after the
|
// A window restored from the tray may only obtain its NSWindow after the
|
||||||
// callback returns, so let the regular UI tick configure it.
|
// callback returns, so let the regular UI tick configure it.
|
||||||
ui_->main_native_titlebar_attempts = 30;
|
ui_->main_native_titlebar_attempts = 30;
|
||||||
@@ -1161,16 +1165,12 @@ void GuiApplication::InitializeSystemTray() {
|
|||||||
ui_->main->hide();
|
ui_->main->hide();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
auto open_settings = [this] {
|
auto open_settings = [this, show_window] {
|
||||||
if (!ui_) {
|
if (!ui_) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ui_->main->show();
|
show_window();
|
||||||
ui_->main->window().set_minimized(false);
|
|
||||||
ui_->main->set_settings_open(true);
|
ui_->main->set_settings_open(true);
|
||||||
#if defined(__APPLE__)
|
|
||||||
ui_->main_native_titlebar_attempts = 30;
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
auto exit_app = [this] {
|
auto exit_app = [this] {
|
||||||
exit_ = true;
|
exit_ = true;
|
||||||
|
|||||||
@@ -186,6 +186,7 @@ component ConnectionDialogButton inherits Rectangle {
|
|||||||
|
|
||||||
export component MainWindow inherits Window {
|
export component MainWindow inherits Window {
|
||||||
title: "CrossDesk";
|
title: "CrossDesk";
|
||||||
|
icon: @image-url("../../../resources/linux/crossdesk_256x256.png");
|
||||||
preferred-width: 640px;
|
preferred-width: 640px;
|
||||||
preferred-height: 450px + root.titlebar-height;
|
preferred-height: 450px + root.titlebar-height;
|
||||||
min-width: 640px;
|
min-width: 640px;
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ export struct ControllerEntry {
|
|||||||
|
|
||||||
export component ServerWindow inherits Window {
|
export component ServerWindow inherits Window {
|
||||||
title: "CrossDesk";
|
title: "CrossDesk";
|
||||||
|
icon: @image-url("../../../resources/linux/crossdesk_256x256.png");
|
||||||
preferred-width: root.language-index == 0 ? 250px : root.language-index == 1 ? 330px : 430px;
|
preferred-width: root.language-index == 0 ? 250px : root.language-index == 1 ? 330px : 430px;
|
||||||
preferred-height: 150px;
|
preferred-height: 150px;
|
||||||
min-width: root.language-index == 0 ? 250px : root.language-index == 1 ? 330px : 430px;
|
min-width: root.language-index == 0 ? 250px : root.language-index == 1 ? 330px : 430px;
|
||||||
|
|||||||
@@ -111,6 +111,7 @@ component ControlBarButton inherits Rectangle {
|
|||||||
|
|
||||||
export component StreamWindow inherits Window {
|
export component StreamWindow inherits Window {
|
||||||
title: "CrossDesk";
|
title: "CrossDesk";
|
||||||
|
icon: @image-url("../../../resources/linux/crossdesk_256x256.png");
|
||||||
preferred-width: 1280px;
|
preferred-width: 1280px;
|
||||||
preferred-height: 720px + (root.custom-titlebar ? 32px : 0px);
|
preferred-height: 720px + (root.custom-titlebar ? 32px : 0px);
|
||||||
min-width: 640px;
|
min-width: 640px;
|
||||||
|
|||||||
@@ -17,6 +17,9 @@ namespace crossdesk {
|
|||||||
|
|
||||||
struct MacTrayImpl;
|
struct MacTrayImpl;
|
||||||
|
|
||||||
|
// Activates the app and focuses the restored Slint window's current NSView.
|
||||||
|
void MacActivateWindow(void* appkit_view);
|
||||||
|
|
||||||
class MacTray {
|
class MacTray {
|
||||||
public:
|
public:
|
||||||
MacTray(::SDL_Window* app_window, const std::string& tooltip,
|
MacTray(::SDL_Window* app_window, const std::string& tooltip,
|
||||||
|
|||||||
@@ -57,6 +57,8 @@ struct MacTrayImpl {
|
|||||||
} else if (app_window) {
|
} else if (app_window) {
|
||||||
SDL_HideWindow(app_window);
|
SDL_HideWindow(app_window);
|
||||||
}
|
}
|
||||||
|
// Keep running through the menu-bar tray without a Dock application icon.
|
||||||
|
[NSApp setActivationPolicy:NSApplicationActivationPolicyAccessory];
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoveTrayIcon() {
|
void RemoveTrayIcon() {
|
||||||
@@ -69,6 +71,8 @@ struct MacTrayImpl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ShowWindow() {
|
void ShowWindow() {
|
||||||
|
// Restore normal application behavior before showing or focusing a window.
|
||||||
|
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
|
||||||
if (show_window) {
|
if (show_window) {
|
||||||
show_window();
|
show_window();
|
||||||
} else if (app_window) {
|
} else if (app_window) {
|
||||||
@@ -142,6 +146,7 @@ struct MacTrayImpl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void OpenSettings() {
|
void OpenSettings() {
|
||||||
|
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
|
||||||
if (open_settings) {
|
if (open_settings) {
|
||||||
open_settings();
|
open_settings();
|
||||||
} else {
|
} else {
|
||||||
@@ -279,6 +284,13 @@ MacTray::MacTray(std::function<void()> show_window,
|
|||||||
|
|
||||||
MacTray::~MacTray() = default;
|
MacTray::~MacTray() = default;
|
||||||
|
|
||||||
|
void MacActivateWindow(void *appkit_view) {
|
||||||
|
NSView *view = (__bridge NSView *)appkit_view;
|
||||||
|
NSWindow *window = [view window];
|
||||||
|
[NSApp activateIgnoringOtherApps:YES];
|
||||||
|
[window makeKeyAndOrderFront:nil];
|
||||||
|
}
|
||||||
|
|
||||||
void MacTray::MinimizeToTray() { impl_->MinimizeToTray(); }
|
void MacTray::MinimizeToTray() { impl_->MinimizeToTray(); }
|
||||||
|
|
||||||
void MacTray::RemoveTrayIcon() { impl_->RemoveTrayIcon(); }
|
void MacTray::RemoveTrayIcon() { impl_->RemoveTrayIcon(); }
|
||||||
|
|||||||
Reference in New Issue
Block a user