Changeset View
Changeset View
Standalone View
Standalone View
src/cursortheme/xcursortheme.cpp
Show First 20 Lines • Show All 152 Lines • ▼ Show 20 Line(s) | |||||
153 | { | 153 | { | ||
154 | /* This code is basically borrowed from display.c of the XCursor library | 154 | /* This code is basically borrowed from display.c of the XCursor library | ||
155 | We can't use "int XcursorGetDefaultSize(Display *dpy)" because if | 155 | We can't use "int XcursorGetDefaultSize(Display *dpy)" because if | ||
156 | previously the cursor size was set to a custom value, it would return | 156 | previously the cursor size was set to a custom value, it would return | ||
157 | this custom value. */ | 157 | this custom value. */ | ||
158 | int size = 0; | 158 | int size = 0; | ||
159 | int dpi = 0; | 159 | int dpi = 0; | ||
160 | Display *dpy = QX11Info::display(); | 160 | Display *dpy = QX11Info::display(); | ||
161 | // Fallback on wayland | ||||
162 | if (!dpy) | ||||
163 | return 24; | ||||
161 | // The string "v" is owned and will be destroyed by Xlib | 164 | // The string "v" is owned and will be destroyed by Xlib | ||
162 | char *v = XGetDefault(dpy, "Xft", "dpi"); | 165 | char *v = XGetDefault(dpy, "Xft", "dpi"); | ||
163 | if (v) | 166 | if (v) | ||
164 | dpi = atoi(v); | 167 | dpi = atoi(v); | ||
165 | if (dpi) | 168 | if (dpi) | ||
166 | size = dpi * 16 / 72; | 169 | size = dpi * 16 / 72; | ||
167 | if (size == 0) | 170 | if (size == 0) | ||
168 | { | 171 | { | ||
▲ Show 20 Lines • Show All 61 Lines • Show Last 20 Lines |