Changeset View
Changeset View
Standalone View
Standalone View
abstract_wayland_output.cpp
Show First 20 Lines • Show All 302 Lines • ▼ Show 20 Line(s) | 301 | { | |||
---|---|---|---|---|---|
303 | const Transform transform = m_waylandOutputDevice->transform(); | 303 | const Transform transform = m_waylandOutputDevice->transform(); | ||
304 | if (transform == Transform::Rotated90 || transform == Transform::Rotated270 || | 304 | if (transform == Transform::Rotated90 || transform == Transform::Rotated270 || | ||
305 | transform == Transform::Flipped90 || transform == Transform::Flipped270) { | 305 | transform == Transform::Flipped90 || transform == Transform::Flipped270) { | ||
306 | return size.transposed(); | 306 | return size.transposed(); | ||
307 | } | 307 | } | ||
308 | return size; | 308 | return size; | ||
309 | } | 309 | } | ||
310 | 310 | | |||
311 | DeviceInterface::Transform toTransform(Qt::ScreenOrientations orientation) | ||||
312 | { | ||||
313 | if (orientation | Qt::LandscapeOrientation) { | ||||
314 | if (orientation | Qt::InvertedPortraitOrientation) { | ||||
315 | return DeviceInterface::Transform::Flipped; | ||||
316 | } | ||||
317 | return DeviceInterface::Transform::Normal; | ||||
318 | } | ||||
319 | | ||||
320 | if (orientation | Qt::PortraitOrientation) { | ||||
321 | if (orientation | Qt::InvertedLandscapeOrientation) { | ||||
322 | if (orientation | Qt::InvertedPortraitOrientation) { | ||||
323 | return DeviceInterface::Transform::Flipped270; | ||||
324 | } | ||||
325 | return DeviceInterface::Transform::Flipped90; | ||||
326 | } | ||||
327 | return DeviceInterface::Transform::Rotated90; | ||||
328 | } | ||||
329 | | ||||
330 | if (orientation | Qt::InvertedLandscapeOrientation) { | ||||
331 | return DeviceInterface::Transform::Rotated180; | ||||
332 | } | ||||
333 | | ||||
334 | if (orientation | Qt::InvertedPortraitOrientation) { | ||||
335 | return DeviceInterface::Transform::Rotated270; | ||||
336 | } | ||||
337 | | ||||
338 | Q_ASSERT(orientation == Qt::PrimaryOrientation); | ||||
339 | return DeviceInterface::Transform::Normal; | ||||
340 | } | ||||
341 | | ||||
342 | void AbstractWaylandOutput::setOrientation(Qt::ScreenOrientations orientation) | ||||
343 | { | ||||
344 | const auto transform = toTransform(orientation); | ||||
345 | if (transform == m_waylandOutputDevice->transform()) { | ||||
346 | return; | ||||
347 | } | ||||
348 | setTransform(transform); | ||||
349 | emit modeChanged(); | ||||
350 | } | ||||
351 | | ||||
311 | Qt::ScreenOrientations AbstractWaylandOutput::orientation() const | 352 | Qt::ScreenOrientations AbstractWaylandOutput::orientation() const | ||
312 | { | 353 | { | ||
313 | const DeviceInterface::Transform transform = m_waylandOutputDevice->transform(); | 354 | const DeviceInterface::Transform transform = m_waylandOutputDevice->transform(); | ||
314 | 355 | | |||
315 | switch (transform) { | 356 | switch (transform) { | ||
316 | case DeviceInterface::Transform::Rotated90: | 357 | case DeviceInterface::Transform::Rotated90: | ||
317 | return Qt::PortraitOrientation; | 358 | return Qt::PortraitOrientation; | ||
318 | case DeviceInterface::Transform::Rotated180: | 359 | case DeviceInterface::Transform::Rotated180: | ||
Show All 18 Lines |