mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-12-16 20:17:10 +08:00
Compare commits
2 Commits
7d3ecf789d
...
8d09bf53c3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8d09bf53c3 | ||
|
|
131b4f1795 |
@@ -12,9 +12,6 @@
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
#elif __linux__
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xresource.h>
|
||||
#include <X11/extensions/Xrandr.h>
|
||||
#include <fcntl.h>
|
||||
#include <net/if.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -77,13 +77,7 @@
|
||||
#define SELF_HOSTED_SERVER_CONFIG_OK_BUTTON_PADDING_EN 91 * dpi_scale_
|
||||
#define UPDATE_NOTIFICATION_OK_BUTTON_PADDING_CN 162 * dpi_scale_
|
||||
#define UPDATE_NOTIFICATION_OK_BUTTON_PADDING_EN 146 * dpi_scale_
|
||||
#ifdef _WIN32
|
||||
#define UPDATE_NOTIFICATION_RESERVED_HEIGHT 130 * dpi_scale_
|
||||
#elif __APPLE__
|
||||
#define UPDATE_NOTIFICATION_RESERVED_HEIGHT 100 * dpi_scale_
|
||||
#else
|
||||
#define UPDATE_NOTIFICATION_RESERVED_HEIGHT 100 * dpi_scale_
|
||||
#endif
|
||||
#define UPDATE_NOTIFICATION_RESERVED_HEIGHT 120 * dpi_scale_
|
||||
#define REQUEST_PERMISSION_WINDOW_WIDTH_CN 130 * dpi_scale_
|
||||
#define REQUEST_PERMISSION_WINDOW_HEIGHT_CN 125 * dpi_scale_
|
||||
#define REQUEST_PERMISSION_WINDOW_WIDTH_EN 260 * dpi_scale_
|
||||
|
||||
@@ -37,7 +37,7 @@ int Render::RecentConnectionsWindow() {
|
||||
}
|
||||
|
||||
int Render::ShowRecentConnections() {
|
||||
ImGui::SetCursorPosX(25.0f);
|
||||
ImGui::SetCursorPosX(25.0f * dpi_scale_);
|
||||
ImVec2 sub_window_pos = ImGui::GetCursorPos();
|
||||
std::map<std::string, ImVec2> sub_containers_pos;
|
||||
float recent_connection_sub_container_width =
|
||||
@@ -115,10 +115,11 @@ int Render::ShowRecentConnections() {
|
||||
it.second.remote_host_name = "unknown";
|
||||
}
|
||||
|
||||
ImVec2 image_screen_pos = ImVec2(ImGui::GetCursorScreenPos().x + 5.0f,
|
||||
ImGui::GetCursorScreenPos().y + 5.0f);
|
||||
ImVec2 image_pos =
|
||||
ImVec2(ImGui::GetCursorPosX() + 5.0f, ImGui::GetCursorPosY() + 5.0f);
|
||||
ImVec2 image_screen_pos =
|
||||
ImVec2(ImGui::GetCursorScreenPos().x + 5.0f * dpi_scale_,
|
||||
ImGui::GetCursorScreenPos().y + 5.0f * dpi_scale_);
|
||||
ImVec2 image_pos = ImVec2(ImGui::GetCursorPosX() + 5.0f * dpi_scale_,
|
||||
ImGui::GetCursorPosY() + 5.0f * dpi_scale_);
|
||||
ImGui::SetCursorPos(image_pos);
|
||||
ImGui::Image((ImTextureID)(intptr_t)it.second.texture,
|
||||
ImVec2((float)recent_connection_image_width_,
|
||||
@@ -208,11 +209,11 @@ int Render::ShowRecentConnections() {
|
||||
if (count != recent_connections_count - 1) {
|
||||
ImVec2 line_start =
|
||||
ImVec2(image_screen_pos.x + recent_connection_image_width_ +
|
||||
20.0f * dpi_scale_,
|
||||
25.0f * dpi_scale_,
|
||||
image_screen_pos.y);
|
||||
ImVec2 line_end = ImVec2(
|
||||
image_screen_pos.x + recent_connection_image_width_ +
|
||||
20.0f * dpi_scale_,
|
||||
25.0f * dpi_scale_,
|
||||
image_screen_pos.y + recent_connection_image_height_ + button_height);
|
||||
ImGui::GetWindowDrawList()->AddLine(line_start, line_end,
|
||||
IM_COL32(0, 0, 0, 122), 1.0f);
|
||||
@@ -220,7 +221,7 @@ int Render::ShowRecentConnections() {
|
||||
|
||||
count++;
|
||||
ImGui::SameLine(
|
||||
0, count != recent_connections_count ? 26.0f * dpi_scale_ : 0.0f);
|
||||
0, count != recent_connections_count ? (35.0f * dpi_scale_) : 0.0f);
|
||||
}
|
||||
|
||||
ImGui::EndChild();
|
||||
|
||||
@@ -85,10 +85,6 @@ int Render::UpdateNotificationWindow() {
|
||||
ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse |
|
||||
ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoTitleBar);
|
||||
|
||||
if (system_chinese_font_ != nullptr) {
|
||||
ImGui::PushFont(system_chinese_font_);
|
||||
}
|
||||
|
||||
ImGui::SetCursorPosY(ImGui::GetCursorPosY() + window_height * 0.05f);
|
||||
|
||||
// title: new version available
|
||||
@@ -115,6 +111,9 @@ int Render::UpdateNotificationWindow() {
|
||||
float scrollable_height =
|
||||
window_height - UPDATE_NOTIFICATION_RESERVED_HEIGHT;
|
||||
|
||||
if (system_chinese_font_ != nullptr) {
|
||||
ImGui::PushFont(system_chinese_font_);
|
||||
}
|
||||
// scrollable content area
|
||||
ImGui::SetCursorPosX(window_width * 0.05f);
|
||||
ImGui::BeginChild("ScrollableContent",
|
||||
@@ -163,6 +162,11 @@ int Render::UpdateNotificationWindow() {
|
||||
|
||||
ImGui::EndChild();
|
||||
|
||||
// pop system font
|
||||
if (system_chinese_font_ != nullptr) {
|
||||
ImGui::PopFont();
|
||||
}
|
||||
|
||||
ImGui::Spacing();
|
||||
|
||||
if (ConfigCenter::LANGUAGE::CHINESE == localization_language_) {
|
||||
@@ -199,11 +203,6 @@ int Render::UpdateNotificationWindow() {
|
||||
|
||||
ImGui::SetWindowFontScale(1.0f);
|
||||
|
||||
// pop system font
|
||||
if (system_chinese_font_ != nullptr) {
|
||||
ImGui::PopFont();
|
||||
}
|
||||
|
||||
ImGui::End();
|
||||
ImGui::PopStyleVar(3);
|
||||
ImGui::PopStyleColor();
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
#include "screen_capturer_x11.h"
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/extensions/Xfixes.h>
|
||||
#include <X11/extensions/Xrandr.h>
|
||||
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
|
||||
@@ -7,10 +7,14 @@
|
||||
#ifndef _SCREEN_CAPTURER_X11_H_
|
||||
#define _SCREEN_CAPTURER_X11_H_
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/extensions/Xrandr.h>
|
||||
#include <X11/extensions/Xfixes.h>
|
||||
// forward declarations for X11 types
|
||||
struct _XDisplay;
|
||||
typedef struct _XDisplay Display;
|
||||
typedef unsigned long Window;
|
||||
struct _XRRScreenResources;
|
||||
typedef struct _XRRScreenResources XRRScreenResources;
|
||||
struct _XImage;
|
||||
typedef struct _XImage XImage;
|
||||
|
||||
#include <atomic>
|
||||
#include <cstring>
|
||||
@@ -43,6 +47,9 @@ class ScreenCapturerX11 : public ScreenCapturer {
|
||||
|
||||
void OnFrame();
|
||||
|
||||
private:
|
||||
void DrawCursor(XImage* image, int x, int y);
|
||||
|
||||
private:
|
||||
Display* display_ = nullptr;
|
||||
Window root_ = 0;
|
||||
@@ -60,12 +67,8 @@ class ScreenCapturerX11 : public ScreenCapturer {
|
||||
cb_desktop_data callback_;
|
||||
std::vector<DisplayInfo> display_info_list_;
|
||||
|
||||
// 缓冲区
|
||||
std::vector<uint8_t> y_plane_;
|
||||
std::vector<uint8_t> uv_plane_;
|
||||
|
||||
// 鼠标光标相关
|
||||
void DrawCursor(XImage* image, int x, int y);
|
||||
};
|
||||
} // namespace crossdesk
|
||||
#endif
|
||||
Reference in New Issue
Block a user