mirror of
https://github.com/kunkundi/crossdesk.git
synced 2026-08-26 21:35:52 +08:00
[fix] eliminate Slint UI frame rate cap on macOS and Linux
This commit is contained in:
@@ -117,7 +117,8 @@ sudo apt-get install -y \
|
|||||||
libxinerama-dev libxcursor-dev libxi-dev libxfixes-dev libxv-dev \
|
libxinerama-dev libxcursor-dev libxi-dev libxfixes-dev libxv-dev \
|
||||||
libxtst-dev libxcb-randr0-dev libxcb-xtest0-dev libxcb-xinerama0-dev \
|
libxtst-dev libxcb-randr0-dev libxcb-xtest0-dev libxcb-xinerama0-dev \
|
||||||
libxcb-shape0-dev libxcb-xkb-dev libxcb-xfixes0-dev libxcb-shm0-dev \
|
libxcb-shape0-dev libxcb-xkb-dev libxcb-xfixes0-dev libxcb-shm0-dev \
|
||||||
libasound2-dev libsndio-dev libpulse-dev
|
libasound2-dev libsndio-dev libpulse-dev \
|
||||||
|
libgl1-mesa-dev
|
||||||
```
|
```
|
||||||
|
|
||||||
Ubuntu 20.04 自带的 CMake 3.16 不满足要求时,xmake 会自动下载并使用
|
Ubuntu 20.04 自带的 CMake 3.16 不满足要求时,xmake 会自动下载并使用
|
||||||
|
|||||||
+2
-1
@@ -120,7 +120,8 @@ sudo apt-get install -y \
|
|||||||
libxinerama-dev libxcursor-dev libxi-dev libxfixes-dev libxv-dev \
|
libxinerama-dev libxcursor-dev libxi-dev libxfixes-dev libxv-dev \
|
||||||
libxtst-dev libxcb-randr0-dev libxcb-xtest0-dev libxcb-xinerama0-dev \
|
libxtst-dev libxcb-randr0-dev libxcb-xtest0-dev libxcb-xinerama0-dev \
|
||||||
libxcb-shape0-dev libxcb-xkb-dev libxcb-xfixes0-dev libxcb-shm0-dev \
|
libxcb-shape0-dev libxcb-xkb-dev libxcb-xfixes0-dev libxcb-shm0-dev \
|
||||||
libasound2-dev libsndio-dev libpulse-dev
|
libasound2-dev libsndio-dev libpulse-dev \
|
||||||
|
libgl1-mesa-dev
|
||||||
```
|
```
|
||||||
|
|
||||||
When Ubuntu 20.04's bundled CMake 3.16 is too old, xmake automatically
|
When Ubuntu 20.04's bundled CMake 3.16 is too old, xmake automatically
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ Depends: libc6 (>= 2.31), libstdc++6 (>= 10), libx11-6, libxext6,
|
|||||||
libxrender1, libxft2, libxrandr2, libxfixes3, libxcb1, libxcb-randr0,
|
libxrender1, libxft2, libxrandr2, libxfixes3, libxcb1, libxcb-randr0,
|
||||||
libxcb-xtest0, libxcb-xinerama0, libxcb-shape0, libxcb-xkb1,
|
libxcb-xtest0, libxcb-xinerama0, libxcb-shape0, libxcb-xkb1,
|
||||||
libxcb-xfixes0, libxv1, libxtst6, $ALSA_RUNTIME_DEP, libsndio7.0,
|
libxcb-xfixes0, libxv1, libxtst6, $ALSA_RUNTIME_DEP, libsndio7.0,
|
||||||
libxcb-shm0, libpulse0, libdrm2, libdbus-1-3
|
libxcb-shm0, libpulse0, libdrm2, libdbus-1-3, libgl1
|
||||||
Recommends: $RECOMMENDS
|
Recommends: $RECOMMENDS
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Section: utils
|
Section: utils
|
||||||
|
|||||||
@@ -36,9 +36,15 @@
|
|||||||
|
|
||||||
#include "platform/tray/win_tray.h"
|
#include "platform/tray/win_tray.h"
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
|
#ifndef GL_SILENCE_DEPRECATION
|
||||||
|
#define GL_SILENCE_DEPRECATION
|
||||||
|
#endif
|
||||||
|
#include <OpenGL/gl.h>
|
||||||
|
|
||||||
#include "platform/tray/mac_tray.h"
|
#include "platform/tray/mac_tray.h"
|
||||||
#include "platform/window_drag.h"
|
#include "platform/window_drag.h"
|
||||||
#elif defined(__linux__)
|
#elif defined(__linux__)
|
||||||
|
#include <GL/gl.h>
|
||||||
#include <X11/Xatom.h>
|
#include <X11/Xatom.h>
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@@ -53,9 +59,7 @@ namespace {
|
|||||||
|
|
||||||
using namespace std::chrono_literals;
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
#if _WIN32
|
|
||||||
constexpr GLint kGlClampToEdge = 0x812F;
|
constexpr GLint kGlClampToEdge = 0x812F;
|
||||||
#endif
|
|
||||||
|
|
||||||
struct VideoRenderSize {
|
struct VideoRenderSize {
|
||||||
int width = 0;
|
int width = 0;
|
||||||
@@ -860,7 +864,6 @@ struct GuiApplication::SlintUi {
|
|||||||
std::make_shared<slint::VectorModel<slint::SharedString>>();
|
std::make_shared<slint::VectorModel<slint::SharedString>>();
|
||||||
std::unordered_map<std::string, uint64_t> displayed_frame_sequence;
|
std::unordered_map<std::string, uint64_t> displayed_frame_sequence;
|
||||||
std::vector<uint8_t> scaled_video_frame;
|
std::vector<uint8_t> scaled_video_frame;
|
||||||
#if _WIN32
|
|
||||||
std::mutex video_gl_mutex;
|
std::mutex video_gl_mutex;
|
||||||
std::vector<uint8_t> video_gl_conversion_frame;
|
std::vector<uint8_t> video_gl_conversion_frame;
|
||||||
std::vector<uint8_t> video_gl_pending_frame;
|
std::vector<uint8_t> video_gl_pending_frame;
|
||||||
@@ -869,7 +872,6 @@ struct GuiApplication::SlintUi {
|
|||||||
VideoRenderSize video_gl_image_size;
|
VideoRenderSize video_gl_image_size;
|
||||||
VideoRenderSize video_gl_pending_size;
|
VideoRenderSize video_gl_pending_size;
|
||||||
bool video_gl_pending_dirty = false;
|
bool video_gl_pending_dirty = false;
|
||||||
#endif
|
|
||||||
std::vector<std::string> tab_order;
|
std::vector<std::string> tab_order;
|
||||||
std::vector<std::string> tab_ids;
|
std::vector<std::string> tab_ids;
|
||||||
std::string tab_model_signature;
|
std::string tab_model_signature;
|
||||||
@@ -2837,7 +2839,6 @@ void GuiApplication::SyncStreamVideoFrame() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if _WIN32
|
|
||||||
uint32_t texture_id = 0;
|
uint32_t texture_id = 0;
|
||||||
{
|
{
|
||||||
std::lock_guard lock(ui_->video_gl_mutex);
|
std::lock_guard lock(ui_->video_gl_mutex);
|
||||||
@@ -2878,7 +2879,6 @@ void GuiApplication::SyncStreamVideoFrame() {
|
|||||||
++props->frame_count_;
|
++props->frame_count_;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
slint::SharedPixelBuffer<slint::Rgb8Pixel> pixels(output_width,
|
slint::SharedPixelBuffer<slint::Rgb8Pixel> pixels(output_width,
|
||||||
output_height);
|
output_height);
|
||||||
@@ -2897,7 +2897,6 @@ void GuiApplication::SyncStreamVideoFrame() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GuiApplication::ConfigureStreamVideoRenderer() {
|
void GuiApplication::ConfigureStreamVideoRenderer() {
|
||||||
#if _WIN32
|
|
||||||
if (!ui_ || !ui_->stream) {
|
if (!ui_ || !ui_->stream) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -2972,7 +2971,6 @@ void GuiApplication::ConfigureStreamVideoRenderer() {
|
|||||||
if (error.has_value()) {
|
if (error.has_value()) {
|
||||||
LOG_WARN("Slint OpenGL video renderer unavailable, using pixel buffers");
|
LOG_WARN("Slint OpenGL video renderer unavailable, using pixel buffers");
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GuiApplication::ScheduleNextVideoFrame() {
|
void GuiApplication::ScheduleNextVideoFrame() {
|
||||||
|
|||||||
@@ -282,6 +282,7 @@ function setup_targets()
|
|||||||
add_files("src/gui/runtime/*.mm", "src/gui/platform/tray/*.mm",
|
add_files("src/gui/runtime/*.mm", "src/gui/platform/tray/*.mm",
|
||||||
"src/gui/platform/window_drag_mac.mm")
|
"src/gui/platform/window_drag_mac.mm")
|
||||||
elseif is_os("linux") then
|
elseif is_os("linux") then
|
||||||
|
add_links("GL")
|
||||||
add_files("src/gui/platform/tray/linux_tray.cpp")
|
add_files("src/gui/platform/tray/linux_tray.cpp")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user