Changeset View
Changeset View
Standalone View
Standalone View
composite.cpp
Show First 20 Lines • Show All 317 Lines • ▼ Show 20 Line(s) | 307 | { | |||
---|---|---|---|---|---|
318 | if (m_scene->syncsToVBlank()) { // if we do vsync, set the fps to the next multiple of the vblank rate | 318 | if (m_scene->syncsToVBlank()) { // if we do vsync, set the fps to the next multiple of the vblank rate | ||
319 | vBlankInterval = milliToNano(1000) / m_xrrRefreshRate; | 319 | vBlankInterval = milliToNano(1000) / m_xrrRefreshRate; | ||
320 | fpsInterval = qMax((fpsInterval / vBlankInterval) * vBlankInterval, vBlankInterval); | 320 | fpsInterval = qMax((fpsInterval / vBlankInterval) * vBlankInterval, vBlankInterval); | ||
321 | } else | 321 | } else | ||
322 | vBlankInterval = milliToNano(1); // no sync - DO NOT set "0", would cause div-by-zero segfaults. | 322 | vBlankInterval = milliToNano(1); // no sync - DO NOT set "0", would cause div-by-zero segfaults. | ||
323 | m_timeSinceLastVBlank = fpsInterval - (options->vBlankTime() + 1); // means "start now" - we don't have even a slight idea when the first vsync will occur | 323 | m_timeSinceLastVBlank = fpsInterval - (options->vBlankTime() + 1); // means "start now" - we don't have even a slight idea when the first vsync will occur | ||
324 | scheduleRepaint(); | 324 | scheduleRepaint(); | ||
325 | kwinApp()->platform()->createEffectsHandler(this, m_scene); // sets also the 'effects' pointer | 325 | kwinApp()->platform()->createEffectsHandler(this, m_scene); // sets also the 'effects' pointer | ||
326 | connect(Workspace::self(), &Workspace::deletedRemoved, m_scene, &Scene::windowDeleted); | 326 | connect(Workspace::self(), &Workspace::deletedRemoved, m_scene, &Scene::removeToplevel); | ||
327 | connect(effects, SIGNAL(screenGeometryChanged(QSize)), SLOT(addRepaintFull())); | 327 | connect(effects, SIGNAL(screenGeometryChanged(QSize)), SLOT(addRepaintFull())); | ||
328 | addRepaintFull(); | 328 | addRepaintFull(); | ||
329 | foreach (Client * c, Workspace::self()->clientList()) { | 329 | foreach (Client * c, Workspace::self()->clientList()) { | ||
330 | c->setupCompositing(); | 330 | c->setupCompositing(); | ||
331 | c->getShadow(); | 331 | c->getShadow(); | ||
332 | } | 332 | } | ||
333 | foreach (Client * c, Workspace::self()->desktopList()) | 333 | foreach (Client * c, Workspace::self()->desktopList()) | ||
334 | c->setupCompositing(); | 334 | c->setupCompositing(); | ||
▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Line(s) | 370 | { | |||
376 | // Some effects might need access to effect windows when they are about to | 376 | // Some effects might need access to effect windows when they are about to | ||
377 | // be destroyed, for example to unreference deleted windows, so we have to | 377 | // be destroyed, for example to unreference deleted windows, so we have to | ||
378 | // make sure that effect windows outlive effects. | 378 | // make sure that effect windows outlive effects. | ||
379 | delete effects; | 379 | delete effects; | ||
380 | effects = nullptr; | 380 | effects = nullptr; | ||
381 | 381 | | |||
382 | if (Workspace::self()) { | 382 | if (Workspace::self()) { | ||
383 | foreach (Client * c, Workspace::self()->clientList()) | 383 | foreach (Client * c, Workspace::self()->clientList()) | ||
384 | m_scene->windowClosed(c, NULL); | 384 | m_scene->removeToplevel(c); | ||
385 | foreach (Client * c, Workspace::self()->desktopList()) | 385 | foreach (Client * c, Workspace::self()->desktopList()) | ||
386 | m_scene->windowClosed(c, NULL); | 386 | m_scene->removeToplevel(c); | ||
387 | foreach (Unmanaged * c, Workspace::self()->unmanagedList()) | 387 | foreach (Unmanaged * c, Workspace::self()->unmanagedList()) | ||
388 | m_scene->windowClosed(c, NULL); | 388 | m_scene->removeToplevel(c); | ||
389 | foreach (Deleted * c, Workspace::self()->deletedList()) | 389 | foreach (Deleted * c, Workspace::self()->deletedList()) | ||
390 | m_scene->windowDeleted(c); | 390 | m_scene->removeToplevel(c); | ||
391 | foreach (Client * c, Workspace::self()->clientList()) | 391 | foreach (Client * c, Workspace::self()->clientList()) | ||
392 | c->finishCompositing(); | 392 | c->finishCompositing(); | ||
393 | foreach (Client * c, Workspace::self()->desktopList()) | 393 | foreach (Client * c, Workspace::self()->desktopList()) | ||
394 | c->finishCompositing(); | 394 | c->finishCompositing(); | ||
395 | foreach (Unmanaged * c, Workspace::self()->unmanagedList()) | 395 | foreach (Unmanaged * c, Workspace::self()->unmanagedList()) | ||
396 | c->finishCompositing(); | 396 | c->finishCompositing(); | ||
397 | foreach (Deleted * c, Workspace::self()->deletedList()) | 397 | foreach (Deleted * c, Workspace::self()->deletedList()) | ||
398 | c->finishCompositing(); | 398 | c->finishCompositing(); | ||
399 | if (auto c = kwinApp()->x11Connection()) { | 399 | if (auto c = kwinApp()->x11Connection()) { | ||
400 | xcb_composite_unredirect_subwindows(c, kwinApp()->x11RootWindow(), XCB_COMPOSITE_REDIRECT_MANUAL); | 400 | xcb_composite_unredirect_subwindows(c, kwinApp()->x11RootWindow(), XCB_COMPOSITE_REDIRECT_MANUAL); | ||
401 | } | 401 | } | ||
402 | } | 402 | } | ||
403 | if (waylandServer()) { | 403 | if (waylandServer()) { | ||
404 | foreach (ShellClient *c, waylandServer()->clients()) { | 404 | foreach (ShellClient *c, waylandServer()->clients()) { | ||
405 | m_scene->windowClosed(c, nullptr); | 405 | m_scene->removeToplevel(c); | ||
406 | } | 406 | } | ||
407 | foreach (ShellClient *c, waylandServer()->internalClients()) { | 407 | foreach (ShellClient *c, waylandServer()->internalClients()) { | ||
408 | m_scene->windowClosed(c, nullptr); | 408 | m_scene->removeToplevel(c); | ||
409 | } | 409 | } | ||
410 | foreach (ShellClient *c, waylandServer()->clients()) { | 410 | foreach (ShellClient *c, waylandServer()->clients()) { | ||
411 | c->finishCompositing(); | 411 | c->finishCompositing(); | ||
412 | } | 412 | } | ||
413 | foreach (ShellClient *c, waylandServer()->internalClients()) { | 413 | foreach (ShellClient *c, waylandServer()->internalClients()) { | ||
414 | c->finishCompositing(); | 414 | c->finishCompositing(); | ||
415 | } | 415 | } | ||
416 | } | 416 | } | ||
▲ Show 20 Lines • Show All 533 Lines • ▼ Show 20 Line(s) | 943 | { | |||
950 | if (kwinApp()->operationMode() == Application::OperationModeX11 && !surface()) { | 950 | if (kwinApp()->operationMode() == Application::OperationModeX11 && !surface()) { | ||
951 | damage_handle = xcb_generate_id(connection()); | 951 | damage_handle = xcb_generate_id(connection()); | ||
952 | xcb_damage_create(connection(), damage_handle, frameId(), XCB_DAMAGE_REPORT_LEVEL_NON_EMPTY); | 952 | xcb_damage_create(connection(), damage_handle, frameId(), XCB_DAMAGE_REPORT_LEVEL_NON_EMPTY); | ||
953 | } | 953 | } | ||
954 | 954 | | |||
955 | damage_region = QRegion(0, 0, width(), height()); | 955 | damage_region = QRegion(0, 0, width(), height()); | ||
956 | effect_window = new EffectWindowImpl(this); | 956 | effect_window = new EffectWindowImpl(this); | ||
957 | 957 | | |||
958 | Compositor::self()->scene()->windowAdded(this); | 958 | Compositor::self()->scene()->addToplevel(this); | ||
959 | 959 | | |||
960 | // With unmanaged windows there is a race condition between the client painting the window | 960 | // With unmanaged windows there is a race condition between the client painting the window | ||
961 | // and us setting up damage tracking. If the client wins we won't get a damage event even | 961 | // and us setting up damage tracking. If the client wins we won't get a damage event even | ||
962 | // though the window has been painted. To avoid this we mark the whole window as damaged | 962 | // though the window has been painted. To avoid this we mark the whole window as damaged | ||
963 | // and schedule a repaint immediately after creating the damage object. | 963 | // and schedule a repaint immediately after creating the damage object. | ||
964 | if (dynamic_cast<Unmanaged*>(this)) | 964 | if (dynamic_cast<Unmanaged*>(this)) | ||
965 | addDamageFull(); | 965 | addDamageFull(); | ||
966 | 966 | | |||
▲ Show 20 Lines • Show All 249 Lines • Show Last 20 Lines |