Changeset View
Changeset View
Standalone View
Standalone View
wayland_cursor_theme.cpp
Show First 20 Lines • Show All 57 Lines • ▼ Show 20 Line(s) | 54 | if (size == 0) { | |||
---|---|---|---|---|---|
58 | auto output = display->outputs().first(); | 58 | auto output = display->outputs().first(); | ||
59 | // calculate dots per inch, multiplied with magic constants | 59 | // calculate dots per inch, multiplied with magic constants | ||
60 | if (output->physicalSize().height()) { | 60 | if (output->physicalSize().height()) { | ||
61 | size = qreal(output->pixelSize().height()) / (qreal(output->physicalSize().height()) * 0.0393701) * 16.0 / 72.0; | 61 | size = qreal(output->pixelSize().height()) / (qreal(output->physicalSize().height()) * 0.0393701) * 16.0 / 72.0; | ||
62 | } else { | 62 | } else { | ||
63 | // use sensible default | 63 | // use sensible default | ||
64 | size = 24; | 64 | size = 24; | ||
65 | } | 65 | } | ||
66 | size *= output->scale(); | 66 | connect(output, &KWayland::Server::OutputInterface::pixelSizeChanged, this, &WaylandCursorTheme::loadTheme, Qt::UniqueConnection); | ||
67 | connect(output, &KWayland::Server::OutputInterface::scaleChanged, this, &WaylandCursorTheme::loadTheme, Qt::UniqueConnection); | 67 | connect(output, &KWayland::Server::OutputInterface::physicalSizeChanged, this, &WaylandCursorTheme::loadTheme, Qt::UniqueConnection); | ||
68 | } | 68 | } | ||
69 | | ||||
69 | auto theme = wl_cursor_theme_load(c->themeName().toUtf8().constData(), | 70 | auto theme = wl_cursor_theme_load(c->themeName().toUtf8().constData(), | ||
70 | size, m_shm->shm()); | 71 | size, m_shm->shm()); | ||
71 | if (theme) { | 72 | if (theme) { | ||
72 | if (!m_theme) { | 73 | if (!m_theme) { | ||
73 | // so far the theme had not been created, this means we need to start tracking theme changes | 74 | // so far the theme had not been created, this means we need to start tracking theme changes | ||
74 | connect(c, &Cursor::themeChanged, this, &WaylandCursorTheme::loadTheme); | 75 | connect(c, &Cursor::themeChanged, this, &WaylandCursorTheme::loadTheme); | ||
75 | } else { | 76 | } else { | ||
76 | destroyTheme(); | 77 | destroyTheme(); | ||
▲ Show 20 Lines • Show All 47 Lines • Show Last 20 Lines |