Changeset View
Changeset View
Standalone View
Standalone View
x11client.cpp
Show First 20 Lines • Show All 346 Lines • ▼ Show 20 Line(s) | 346 | if (region.isEmpty()) { | |||
---|---|---|---|---|---|
347 | m_decoInputExtent.reset(); | 347 | m_decoInputExtent.reset(); | ||
348 | return; | 348 | return; | ||
349 | } | 349 | } | ||
350 | 350 | | |||
351 | QRect bounds = region.boundingRect(); | 351 | QRect bounds = region.boundingRect(); | ||
352 | input_offset = bounds.topLeft(); | 352 | input_offset = bounds.topLeft(); | ||
353 | 353 | | |||
354 | // Move the bounding rect to screen coordinates | 354 | // Move the bounding rect to screen coordinates | ||
355 | bounds.translate(geometry().topLeft()); | 355 | bounds.translate(frameGeometry().topLeft()); | ||
356 | 356 | | |||
357 | // Move the region to input window coordinates | 357 | // Move the region to input window coordinates | ||
358 | region.translate(-input_offset); | 358 | region.translate(-input_offset); | ||
359 | 359 | | |||
360 | if (!m_decoInputExtent.isValid()) { | 360 | if (!m_decoInputExtent.isValid()) { | ||
361 | const uint32_t mask = XCB_CW_OVERRIDE_REDIRECT | XCB_CW_EVENT_MASK; | 361 | const uint32_t mask = XCB_CW_OVERRIDE_REDIRECT | XCB_CW_EVENT_MASK; | ||
362 | const uint32_t values[] = {true, | 362 | const uint32_t values[] = {true, | ||
363 | XCB_EVENT_MASK_ENTER_WINDOW | | 363 | XCB_EVENT_MASK_ENTER_WINDOW | | ||
Show All 14 Lines | 377 | xcb_shape_rectangles(connection(), XCB_SHAPE_SO_SET, XCB_SHAPE_SK_INPUT, XCB_CLIP_ORDERING_UNSORTED, | |||
378 | m_decoInputExtent, 0, 0, rects.count(), rects.constData()); | 378 | m_decoInputExtent, 0, 0, rects.count(), rects.constData()); | ||
379 | } | 379 | } | ||
380 | 380 | | |||
381 | void X11Client::updateDecoration(bool check_workspace_pos, bool force) | 381 | void X11Client::updateDecoration(bool check_workspace_pos, bool force) | ||
382 | { | 382 | { | ||
383 | if (!force && | 383 | if (!force && | ||
384 | ((!isDecorated() && noBorder()) || (isDecorated() && !noBorder()))) | 384 | ((!isDecorated() && noBorder()) || (isDecorated() && !noBorder()))) | ||
385 | return; | 385 | return; | ||
386 | QRect oldgeom = geometry(); | 386 | QRect oldgeom = frameGeometry(); | ||
387 | QRect oldClientGeom = oldgeom.adjusted(borderLeft(), borderTop(), -borderRight(), -borderBottom()); | 387 | QRect oldClientGeom = oldgeom.adjusted(borderLeft(), borderTop(), -borderRight(), -borderBottom()); | ||
388 | blockGeometryUpdates(true); | 388 | blockGeometryUpdates(true); | ||
389 | if (force) | 389 | if (force) | ||
390 | destroyDecoration(); | 390 | destroyDecoration(); | ||
391 | if (!noBorder()) { | 391 | if (!noBorder()) { | ||
392 | createDecoration(oldgeom); | 392 | createDecoration(oldgeom); | ||
393 | } else | 393 | } else | ||
394 | destroyDecoration(); | 394 | destroyDecoration(); | ||
Show All 15 Lines | 406 | if (decoration) { | |||
410 | connect(decoration, &KDecoration2::Decoration::bordersChanged, this, | 410 | connect(decoration, &KDecoration2::Decoration::bordersChanged, this, | ||
411 | [this]() { | 411 | [this]() { | ||
412 | updateFrameExtents(); | 412 | updateFrameExtents(); | ||
413 | GeometryUpdatesBlocker blocker(this); | 413 | GeometryUpdatesBlocker blocker(this); | ||
414 | // TODO: this is obviously idempotent | 414 | // TODO: this is obviously idempotent | ||
415 | // calculateGravitation(true) would have to operate on the old border sizes | 415 | // calculateGravitation(true) would have to operate on the old border sizes | ||
416 | // move(calculateGravitation(true)); | 416 | // move(calculateGravitation(true)); | ||
417 | // move(calculateGravitation(false)); | 417 | // move(calculateGravitation(false)); | ||
418 | QRect oldgeom = geometry(); | 418 | QRect oldgeom = frameGeometry(); | ||
419 | plainResize(sizeForClientSize(clientSize()), ForceGeometrySet); | 419 | plainResize(sizeForClientSize(clientSize()), ForceGeometrySet); | ||
420 | if (!isShade()) | 420 | if (!isShade()) | ||
421 | checkWorkspacePosition(oldgeom); | 421 | checkWorkspacePosition(oldgeom); | ||
422 | emit geometryShapeChanged(this, oldgeom); | 422 | emit geometryShapeChanged(this, oldgeom); | ||
423 | } | 423 | } | ||
424 | ); | 424 | ); | ||
425 | connect(decoratedClient()->decoratedClient(), &KDecoration2::DecoratedClient::widthChanged, this, &X11Client::updateInputWindow); | 425 | connect(decoratedClient()->decoratedClient(), &KDecoration2::DecoratedClient::widthChanged, this, &X11Client::updateInputWindow); | ||
426 | connect(decoratedClient()->decoratedClient(), &KDecoration2::DecoratedClient::heightChanged, this, &X11Client::updateInputWindow); | 426 | connect(decoratedClient()->decoratedClient(), &KDecoration2::DecoratedClient::heightChanged, this, &X11Client::updateInputWindow); | ||
427 | } | 427 | } | ||
428 | setDecoration(decoration); | 428 | setDecoration(decoration); | ||
429 | 429 | | |||
430 | move(calculateGravitation(false)); | 430 | move(calculateGravitation(false)); | ||
431 | plainResize(sizeForClientSize(clientSize()), ForceGeometrySet); | 431 | plainResize(sizeForClientSize(clientSize()), ForceGeometrySet); | ||
432 | if (Compositor::compositing()) { | 432 | if (Compositor::compositing()) { | ||
433 | discardWindowPixmap(); | 433 | discardWindowPixmap(); | ||
434 | } | 434 | } | ||
435 | emit geometryShapeChanged(this, oldgeom); | 435 | emit geometryShapeChanged(this, oldgeom); | ||
436 | } | 436 | } | ||
437 | 437 | | |||
438 | void X11Client::destroyDecoration() | 438 | void X11Client::destroyDecoration() | ||
439 | { | 439 | { | ||
440 | QRect oldgeom = geometry(); | 440 | QRect oldgeom = frameGeometry(); | ||
441 | if (isDecorated()) { | 441 | if (isDecorated()) { | ||
442 | QPoint grav = calculateGravitation(true); | 442 | QPoint grav = calculateGravitation(true); | ||
443 | AbstractClient::destroyDecoration(); | 443 | AbstractClient::destroyDecoration(); | ||
444 | plainResize(sizeForClientSize(clientSize()), ForceGeometrySet); | 444 | plainResize(sizeForClientSize(clientSize()), ForceGeometrySet); | ||
445 | move(grav); | 445 | move(grav); | ||
446 | if (compositing()) | 446 | if (compositing()) | ||
447 | discardWindowPixmap(); | 447 | discardWindowPixmap(); | ||
448 | if (!deleting) { | 448 | if (!deleting) { | ||
▲ Show 20 Lines • Show All 207 Lines • ▼ Show 20 Line(s) | 636 | { | |||
656 | 656 | | |||
657 | // Decoration mask (i.e. 'else' here) setting is done in setMask() | 657 | // Decoration mask (i.e. 'else' here) setting is done in setMask() | ||
658 | // when the decoration calls it or when the decoration is created/destroyed | 658 | // when the decoration calls it or when the decoration is created/destroyed | ||
659 | updateInputShape(); | 659 | updateInputShape(); | ||
660 | if (compositing()) { | 660 | if (compositing()) { | ||
661 | addRepaintFull(); | 661 | addRepaintFull(); | ||
662 | addWorkspaceRepaint(visibleRect()); // In case shape change removes part of this window | 662 | addWorkspaceRepaint(visibleRect()); // In case shape change removes part of this window | ||
663 | } | 663 | } | ||
664 | emit geometryShapeChanged(this, geometry()); | 664 | emit geometryShapeChanged(this, frameGeometry()); | ||
665 | } | 665 | } | ||
666 | 666 | | |||
667 | static Xcb::Window shape_helper_window(XCB_WINDOW_NONE); | 667 | static Xcb::Window shape_helper_window(XCB_WINDOW_NONE); | ||
668 | 668 | | |||
669 | void X11Client::cleanupX11() | 669 | void X11Client::cleanupX11() | ||
670 | { | 670 | { | ||
671 | shape_helper_window.reset(); | 671 | shape_helper_window.reset(); | ||
672 | } | 672 | } | ||
▲ Show 20 Lines • Show All 177 Lines • ▼ Show 20 Line(s) | 829 | if (isShade()) { | |||
850 | } | 850 | } | ||
851 | } else { | 851 | } else { | ||
852 | shade_geometry_change = true; | 852 | shade_geometry_change = true; | ||
853 | if (decoratedClient()) | 853 | if (decoratedClient()) | ||
854 | decoratedClient()->signalShadeChange(); | 854 | decoratedClient()->signalShadeChange(); | ||
855 | QSize s(sizeForClientSize(clientSize())); | 855 | QSize s(sizeForClientSize(clientSize())); | ||
856 | shade_geometry_change = false; | 856 | shade_geometry_change = false; | ||
857 | plainResize(s); | 857 | plainResize(s); | ||
858 | geom_restore = geometry(); | 858 | setGeometryRestore(frameGeometry()); | ||
859 | if ((shade_mode == ShadeHover || shade_mode == ShadeActivated) && rules()->checkAcceptFocus(info->input())) | 859 | if ((shade_mode == ShadeHover || shade_mode == ShadeActivated) && rules()->checkAcceptFocus(info->input())) | ||
860 | setActive(true); | 860 | setActive(true); | ||
861 | if (shade_mode == ShadeHover) { | 861 | if (shade_mode == ShadeHover) { | ||
862 | ToplevelList order = workspace()->stackingOrder(); | 862 | ToplevelList order = workspace()->stackingOrder(); | ||
863 | // invalidate, since "this" could be the topmost toplevel and shade_below dangeling | 863 | // invalidate, since "this" could be the topmost toplevel and shade_below dangeling | ||
864 | shade_below = nullptr; | 864 | shade_below = nullptr; | ||
865 | // this is likely related to the index parameter?! | 865 | // this is likely related to the index parameter?! | ||
866 | for (int idx = order.indexOf(this) + 1; idx < order.count(); ++idx) { | 866 | for (int idx = order.indexOf(this) + 1; idx < order.count(); ++idx) { | ||
▲ Show 20 Lines • Show All 1268 Lines • Show Last 20 Lines |