Changeset View
Changeset View
Standalone View
Standalone View
plugins/platforms/x11/standalone/x11_platform.cpp
Show First 20 Lines • Show All 75 Lines • ▼ Show 20 Line(s) | |||||
76 | #endif | 76 | #endif | ||
77 | connect(kwinApp(), &Application::workspaceCreated, this, | 77 | connect(kwinApp(), &Application::workspaceCreated, this, | ||
78 | [this] { | 78 | [this] { | ||
79 | if (Xcb::Extensions::self()->isSyncAvailable()) { | 79 | if (Xcb::Extensions::self()->isSyncAvailable()) { | ||
80 | m_syncFilter = std::make_unique<SyncFilter>(); | 80 | m_syncFilter = std::make_unique<SyncFilter>(); | ||
81 | } | 81 | } | ||
82 | } | 82 | } | ||
83 | ); | 83 | ); | ||
84 | | ||||
85 | setSupportsGammaControl(true); | ||||
84 | } | 86 | } | ||
85 | 87 | | |||
86 | X11StandalonePlatform::~X11StandalonePlatform() | 88 | X11StandalonePlatform::~X11StandalonePlatform() | ||
87 | { | 89 | { | ||
88 | if (m_openGLFreezeProtectionThread) { | 90 | if (m_openGLFreezeProtectionThread) { | ||
89 | m_openGLFreezeProtectionThread->quit(); | 91 | m_openGLFreezeProtectionThread->quit(); | ||
90 | m_openGLFreezeProtectionThread->wait(); | 92 | m_openGLFreezeProtectionThread->wait(); | ||
91 | delete m_openGLFreezeProtectionThread; | 93 | delete m_openGLFreezeProtectionThread; | ||
▲ Show 20 Lines • Show All 359 Lines • ▼ Show 20 Line(s) | 452 | { | |||
451 | doUpdateOutputs<Xcb::RandR::CurrentResources>(); | 453 | doUpdateOutputs<Xcb::RandR::CurrentResources>(); | ||
452 | } | 454 | } | ||
453 | 455 | | |||
454 | template <typename T> | 456 | template <typename T> | ||
455 | void X11StandalonePlatform::doUpdateOutputs() | 457 | void X11StandalonePlatform::doUpdateOutputs() | ||
456 | { | 458 | { | ||
457 | auto fallback = [this]() { | 459 | auto fallback = [this]() { | ||
458 | auto *o = new X11Output(this); | 460 | auto *o = new X11Output(this); | ||
461 | o->setGammaRampSize(0); | ||||
459 | o->setRefreshRate(-1.0f); | 462 | o->setRefreshRate(-1.0f); | ||
460 | o->setName(QStringLiteral("Xinerama")); | 463 | o->setName(QStringLiteral("Xinerama")); | ||
461 | m_outputs << o; | 464 | m_outputs << o; | ||
462 | }; | 465 | }; | ||
463 | 466 | | |||
464 | // TODO: instead of resetting all outputs, check if new output is added/removed | 467 | // TODO: instead of resetting all outputs, check if new output is added/removed | ||
465 | // or still available and leave still available outputs in m_outputs | 468 | // or still available and leave still available outputs in m_outputs | ||
466 | // untouched (like in DRM backend) | 469 | // untouched (like in DRM backend) | ||
▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Line(s) | 504 | if (modes[j].htotal != 0 && modes[j].vtotal != 0) { // BUG 313996 | |||
509 | refreshRate = dotclock/float(modes[j].htotal*vtotal); | 512 | refreshRate = dotclock/float(modes[j].htotal*vtotal); | ||
510 | } | 513 | } | ||
511 | break; // found mode | 514 | break; // found mode | ||
512 | } | 515 | } | ||
513 | } | 516 | } | ||
514 | 517 | | |||
515 | const QRect geo = info.rect(); | 518 | const QRect geo = info.rect(); | ||
516 | if (geo.isValid()) { | 519 | if (geo.isValid()) { | ||
520 | xcb_randr_crtc_t crtc = crtcs[i]; | ||||
521 | | ||||
522 | // TODO: Perhaps the output has to save the inherited gamma ramp and | ||||
523 | // restore it during tear down. Currently neither standalone x11 nor | ||||
524 | // drm platform do this. | ||||
525 | Xcb::RandR::CrtcGamma gamma(crtc); | ||||
526 | | ||||
517 | auto *o = new X11Output(this); | 527 | auto *o = new X11Output(this); | ||
528 | o->setCrtc(crtc); | ||||
529 | o->setGammaRampSize(gamma.isNull() ? 0 : gamma->size); | ||||
518 | o->setGeometry(geo); | 530 | o->setGeometry(geo); | ||
519 | o->setRefreshRate(refreshRate); | 531 | o->setRefreshRate(refreshRate); | ||
520 | 532 | | |||
521 | QString name; | 533 | QString name; | ||
522 | for (int j = 0; j < info->num_outputs; ++j) { | 534 | for (int j = 0; j < info->num_outputs; ++j) { | ||
523 | Xcb::RandR::OutputInfo outputInfo(outputInfos.at(j)); | 535 | Xcb::RandR::OutputInfo outputInfo(outputInfos.at(j)); | ||
524 | if (crtcs[i] == outputInfo->crtc) { | 536 | if (crtc == outputInfo->crtc) { | ||
525 | name = outputInfo.name(); | 537 | name = outputInfo.name(); | ||
526 | break; | 538 | break; | ||
527 | } | 539 | } | ||
528 | } | 540 | } | ||
529 | o->setName(name); | 541 | o->setName(name); | ||
530 | m_outputs << o; | 542 | m_outputs << o; | ||
531 | } | 543 | } | ||
532 | } | 544 | } | ||
Show All 17 Lines |