diff --git a/src/dde-session/impl/iowait/xcursor_remap.c b/src/dde-session/impl/iowait/xcursor_remap.c index 6997412e..6ebf9e5a 100644 --- a/src/dde-session/impl/iowait/xcursor_remap.c +++ b/src/dde-session/impl/iowait/xcursor_remap.c @@ -3,10 +3,6 @@ // SPDX-License-Identifier: GPL-3.0-or-later #include -#include -#include - -#include #include #include @@ -14,12 +10,12 @@ #include "xcursor_remap.h" -static int xc_remap(char *theme, char *src, char *dst, int size); +static int xc_remap(const char *src, const char *dst); static XcursorImages* xc_load_images(const char *theme, const char *name, int size) { - printf("Will load cursor file: %s - %s\n", theme, name); + printf("Will load cursor file: %s - %s\n", theme ? theme : "(default)", name); return XcursorLibraryLoadImages(name, theme, size); } @@ -27,10 +23,6 @@ static void xc_change_cursor_by_name(Display *dpy, const char *theme, const char *src, const char* dst, int size) { - if (size == -1) { - size = XcursorGetDefaultSize(dpy); - } - // load cursor images XcursorImages *dst_images = xc_load_images(theme, dst, size); if (!dst_images) { @@ -53,7 +45,7 @@ xc_change_cursor_by_name(Display *dpy, const char *theme, } static int -xc_remap(char *theme, char *src, char *dst, int size) +xc_remap(const char *src, const char *dst) { Display *dpy = XOpenDisplay(NULL); if (!dpy) { @@ -61,6 +53,9 @@ xc_remap(char *theme, char *src, char *dst, int size) return -1; } + const char *theme = XcursorGetTheme(dpy); + int size = XcursorGetDefaultSize(dpy); + xc_change_cursor_by_name(dpy, theme, src, dst, size); XCloseDisplay(dpy); @@ -70,28 +65,9 @@ xc_remap(char *theme, char *src, char *dst, int size) int xc_left_ptr_to_watch(int enabled) { - char *theme = "deepin"; - int size = 24; - double scale = 1.0; - - GSettings *s = g_settings_new("com.deepin.xsettings"); - if (s) { - theme = g_settings_get_string(s, "gtk-cursor-theme-name"); - size = g_settings_get_int(s, "gtk-cursor-theme-size"); - scale = g_settings_get_double(s, "scale-factor"); - g_object_unref(s); - } - - // if 1.7 < scale < 2, scale = 2 - int tmp = (int)(trunc((scale+0.3)*10) / 10); - if (tmp < 1) { - tmp = 1; - } - size *= tmp; - if (enabled) { - return xc_remap(theme, "left_ptr", "left_ptr_watch", size); + return xc_remap("left_ptr", "left_ptr_watch"); } else { - return xc_remap(theme, "left_ptr_watch", "left_ptr", size); + return xc_remap("left_ptr_watch", "left_ptr"); } } diff --git a/tools/dde-xsettings-checker/CMakeLists.txt b/tools/dde-xsettings-checker/CMakeLists.txt index afdd0b21..0ab202a1 100644 --- a/tools/dde-xsettings-checker/CMakeLists.txt +++ b/tools/dde-xsettings-checker/CMakeLists.txt @@ -6,8 +6,6 @@ set(CMAKE_AUTORCC ON) find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core DBus REQUIRED) find_package(PkgConfig REQUIRED) -pkg_check_modules(GLIB2 REQUIRED IMPORTED_TARGET glib-2.0) -pkg_check_modules(GIO2 REQUIRED IMPORTED_TARGET gio-2.0) pkg_check_modules(XCURSOR REQUIRED IMPORTED_TARGET xcursor) pkg_check_modules(XFIXES REQUIRED IMPORTED_TARGET xfixes) pkg_check_modules(X11 REQUIRED IMPORTED_TARGET x11) @@ -24,8 +22,6 @@ add_executable(${BIN_NAME} target_link_libraries(${BIN_NAME} Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::DBus - PkgConfig::GLIB2 - PkgConfig::GIO2 PkgConfig::XCURSOR PkgConfig::XFIXES PkgConfig::X11