Changeset View
Standalone View
abstract_wayland_output.cpp
Show First 20 Lines • Show All 48 Lines • ▼ Show 20 Line(s) | |||||
49 | } | 49 | } | ||
50 | 50 | | |||
51 | AbstractWaylandOutput::~AbstractWaylandOutput() | 51 | AbstractWaylandOutput::~AbstractWaylandOutput() | ||
52 | { | 52 | { | ||
53 | } | 53 | } | ||
54 | 54 | | |||
55 | QString AbstractWaylandOutput::name() const | 55 | QString AbstractWaylandOutput::name() const | ||
56 | { | 56 | { | ||
57 | return QStringLiteral("%1 %2").arg(m_waylandOutputDevice->manufacturer()).arg( | 57 | return m_name; | ||
58 | m_waylandOutputDevice->model()); | | |||
59 | } | 58 | } | ||
60 | 59 | | |||
61 | QByteArray AbstractWaylandOutput::uuid() const | 60 | QByteArray AbstractWaylandOutput::uuid() const | ||
62 | { | 61 | { | ||
63 | return m_waylandOutputDevice->uuid(); | 62 | return m_waylandOutputDevice->uuid(); | ||
64 | } | 63 | } | ||
65 | 64 | | |||
66 | QRect AbstractWaylandOutput::geometry() const | 65 | QRect AbstractWaylandOutput::geometry() const | ||
▲ Show 20 Lines • Show All 162 Lines • ▼ Show 20 Line(s) | 219 | { | |||
229 | } else { | 228 | } else { | ||
230 | m_waylandOutputDevice->setEnabled(DeviceInterface::Enablement::Disabled); | 229 | m_waylandOutputDevice->setEnabled(DeviceInterface::Enablement::Disabled); | ||
231 | m_waylandOutput->destroy(); | 230 | m_waylandOutput->destroy(); | ||
232 | // xdg-output is destroyed in KWayland on wl_output going away. | 231 | // xdg-output is destroyed in KWayland on wl_output going away. | ||
233 | updateEnablement(false); | 232 | updateEnablement(false); | ||
234 | } | 233 | } | ||
235 | } | 234 | } | ||
236 | 235 | | |||
236 | QString AbstractWaylandOutput::description() const | ||||
237 | { | ||||
238 | return QStringLiteral("%1 %2").arg(m_waylandOutputDevice->manufacturer()).arg( | ||||
239 | m_waylandOutputDevice->model()); | ||||
240 | } | ||||
241 | | ||||
237 | void AbstractWaylandOutput::setWaylandMode(const QSize &size, int refreshRate) | 242 | void AbstractWaylandOutput::setWaylandMode(const QSize &size, int refreshRate) | ||
238 | { | 243 | { | ||
239 | m_waylandOutput->setCurrentMode(size, refreshRate); | 244 | m_waylandOutput->setCurrentMode(size, refreshRate); | ||
240 | m_xdgOutput->setLogicalSize(pixelSize() / scale()); | 245 | m_xdgOutput->setLogicalSize(pixelSize() / scale()); | ||
241 | m_xdgOutput->done(); | 246 | m_xdgOutput->done(); | ||
242 | } | 247 | } | ||
243 | 248 | | |||
244 | void AbstractWaylandOutput::initInterfaces(const QString &model, const QString &manufacturer, | 249 | void AbstractWaylandOutput::initInterfaces(const QString &model, const QString &manufacturer, | ||
Show All 25 Lines | 274 | if (mode.flags & DeviceInterface::ModeFlag::Current) { | |||
270 | flags |= KWayland::Server::OutputInterface::ModeFlag::Current; | 275 | flags |= KWayland::Server::OutputInterface::ModeFlag::Current; | ||
271 | } | 276 | } | ||
272 | if (mode.flags & DeviceInterface::ModeFlag::Preferred) { | 277 | if (mode.flags & DeviceInterface::ModeFlag::Preferred) { | ||
273 | flags |= KWayland::Server::OutputInterface::ModeFlag::Preferred; | 278 | flags |= KWayland::Server::OutputInterface::ModeFlag::Preferred; | ||
274 | } | 279 | } | ||
275 | m_waylandOutput->addMode(mode.size, flags, mode.refreshRate); | 280 | m_waylandOutput->addMode(mode.size, flags, mode.refreshRate); | ||
276 | } | 281 | } | ||
277 | 282 | | |||
283 | m_waylandOutputDevice->create(); | ||||
284 | | ||||
278 | // start off enabled | 285 | // start off enabled | ||
286 | | ||||
279 | m_waylandOutput->create(); | 287 | m_waylandOutput->create(); | ||
280 | m_waylandOutputDevice->create(); | 288 | m_xdgOutput->setName(name()); | ||
289 | m_xdgOutput->setDescription(description()); | ||||
281 | m_xdgOutput->setLogicalSize(pixelSize() / scale()); | 290 | m_xdgOutput->setLogicalSize(pixelSize() / scale()); | ||
282 | m_xdgOutput->done(); | 291 | m_xdgOutput->done(); | ||
zzag: Please rename `AbstractOutput::name()` to `AbstractOutput::description()` to keep… | |||||
I had looked. Without bringing in further behavioural changes it makes things worse. You then need to change screens to be in sync, and that one gets used a lot. Then instead of having one piece of code refer to name when they mean description, we have dozens refer to description when they just want a simple readable name. davidedmundson: I had looked. Without bringing in further behavioural changes it makes things worse.
You then… | |||||
So, I assume you're talking about output mapping for touch devices. If that's the case, we could set the udev 'WL_OUTPUT` property on the input device, but nobody does it. Alternatively, we could follow libinput's documentation [1] and use something else. My main concern about this code is that we start mixing identifiers, names, and descriptions, which makes code more difficult to work with and reason about. zzag: So, I assume you're talking about output mapping for touch devices. If that's the case, we… | |||||
No I was referring to OutputScreens::name(int screen) Following that, it gets used in the UI in context menus. I initially was trying to avoid a behavioural change on that, but it turns out we probably want that. davidedmundson: No I was referring to OutputScreens::name(int screen)
Following that, it gets used in the UI… | |||||
We probably don't even need to bother with libinput_device_get_output_name() as long as our output names match weston's output names. I also believe that libinput_device_get_output_name() returns NULL in many cases since I don't see who sets WL_OUTPUT. Either way, worth checking... zzag: We probably don't even need to bother with libinput_device_get_output_name() as long as our… | |||||
Maybe it's not so bad. It seems on X11 the name is in the form HDMI-0 which is what we call "name" here. So this actually is an opportunity to make things more consistent. davidedmundson: Maybe it's not so bad.
It seems on X11 the name is in the form HDMI-0 which is what we call… | |||||
283 | } | 292 | } | ||
284 | 293 | | |||
285 | QSize AbstractWaylandOutput::orientateSize(const QSize &size) const | 294 | QSize AbstractWaylandOutput::orientateSize(const QSize &size) const | ||
286 | { | 295 | { | ||
287 | using Transform = DeviceInterface::Transform; | 296 | using Transform = DeviceInterface::Transform; | ||
288 | const Transform transform = m_waylandOutputDevice->transform(); | 297 | const Transform transform = m_waylandOutputDevice->transform(); | ||
289 | if (transform == Transform::Rotated90 || transform == Transform::Rotated270 || | 298 | if (transform == Transform::Rotated90 || transform == Transform::Rotated270 || | ||
290 | transform == Transform::Flipped90 || transform == Transform::Flipped270) { | 299 | transform == Transform::Flipped90 || transform == Transform::Flipped270) { | ||
Show All 21 Lines |
Please rename AbstractOutput::name() to AbstractOutput::description() to keep AbstractOutput::name() and XdgOutputInterface::name() in sync.