This forum has been archived. All content is frozen. Please use KDE Discuss instead.

X11 damage events not generated when desktop is exposed

Tags: None
(comma "," separated)
mcottrell
Registered Member
Posts
1
Karma
0
I'm trying to use damage events in plasma 5.5.4 with Ubuntu 16.04, and I'm not seeing damage events where I used to see them in KDE/plasma 4. I'm not sure whether it is KWin or plasmashell that should be generating the events, so here's the support information from KWin:

Code: Select all
==========================

Version
=======
KWin version: 5.5.4
Qt Version: 5.5.1
Qt compile version: 5.5.1
XCB compile version: 1.11.1

Operation Mode: X11 only

Build Options
=============
KWIN_BUILD_DECORATIONS: yes
KWIN_BUILD_TABBOX: yes
KWIN_BUILD_ACTIVITIES: yes
HAVE_INPUT: yes
HAVE_DRM: yes
HAVE_GBM: yes
HAVE_X11_XCB: yes
HAVE_EPOXY_GLX: yes
HAVE_WAYLAND_EGL: yes

X11
===
Vendor: The X.Org Foundation
Vendor Release: 11803000
Protocol Version/Revision: 11/0
SHAPE: yes; Version: 0x11
RANDR: yes; Version: 0x14
DAMAGE: yes; Version: 0x11
Composite: yes; Version: 0x4
RENDER: yes; Version: 0xb
XFIXES: yes; Version: 0x50
SYNC: yes; Version: 0x31
GLX: yes; Version: 0x0

Decoration
==========
Plugin: org.kde.breeze
Theme:
Blur: 0
onAllDesktopsAvailable: false
alphaChannelSupported: false
closeOnDoubleClickOnMenu: false
decorationButtonsLeft: 0, 2
decorationButtonsRight: 6, 3, 4, 5
borderSize: 3
gridUnit: 10
font: Noto Sans,10,-1,0,50,0,0,0,0,0
smallSpacing: 2
largeSpacing: 10

Options
=======
focusPolicy: 0
nextFocusPrefersMouse: false
clickRaise: true
autoRaise: false
autoRaiseInterval: 0
delayFocusInterval: 0
shadeHover: false
shadeHoverInterval: 250
separateScreenFocus: false
placement: 4
focusPolicyIsReasonable: true
borderSnapZone: 10
windowSnapZone: 10
centerSnapZone: 0
snapOnlyWhenOverlapping: false
rollOverDesktops: true
focusStealingPreventionLevel: 1
legacyFullscreenSupport: false
operationTitlebarDblClick: 5000
operationMaxButtonLeftClick: 5000
operationMaxButtonMiddleClick: 5015
operationMaxButtonRightClick: 5014
commandActiveTitlebar1: 0
commandActiveTitlebar2: 30
commandActiveTitlebar3: 2
commandInactiveTitlebar1: 4
commandInactiveTitlebar2: 30
commandInactiveTitlebar3: 2
commandWindow1: 7
commandWindow2: 8
commandWindow3: 8
commandWindowWheel: 31
commandAll1: 10
commandAll2: 3
commandAll3: 14
keyCmdAllModKey: 16777251
showGeometryTip: false
condensedTitle: false
electricBorderMaximize: true
electricBorderTiling: true
electricBorderCornerRatio: 0.25
borderlessMaximizedWindows: false
killPingTimeout: 5000
hideUtilityWindowsForInactive: true
inactiveTabsSkipTaskbar: false
autogroupSimilarWindows: false
autogroupInForeground: true
compositingMode: 2
useCompositing: true
compositingInitialized: true
hiddenPreviews: 1
unredirectFullscreen: false
glSmoothScale: 2
colorCorrected: false
xrenderSmoothScale: false
maxFpsInterval: 16666666
refreshRate: 0
vBlankTime: 6000000
glStrictBinding: true
glStrictBindingFollowsDriver: true
glCoreProfile: false
glPreferBufferSwap: 97
glPlatformInterface: 1

Screen Edges
============
desktopSwitching: false
desktopSwitchingMovingClients: false
cursorPushBackDistance: 1x1
timeThreshold: 150
reActivateThreshold: 350
actionTopLeft: 0
actionTop: 0
actionTopRight: 0
actionRight: 0
actionBottomRight: 0
actionBottom: 0
actionBottomLeft: 0
actionLeft: 0

Screens
=======
Multi-Head: no
Active screen follows mouse:  no
Number of Screens: 1

Screen 0:
---------
Name: Mon0
Geometry: 0,0,1920x1200
Refresh Rate: 59.9201


Compositing
===========
Compositing is not active


The easiest way to reproduce the problem is to open up a fullscreen konsole instance, then expose the desktop with ctrl+F12. I have a small application that is monitoring damage events from X, and when I run it, all I see are two events for small regions. Here's the code for the application:

Code: Select all
#include <cstring>
#include <iostream>
#include <memory>

#include <sys/select.h>

#include <xcb/xcb.h>
#include <xcb/xcb_event.h>
#include <xcb/damage.h>

using namespace std;

struct xcb_connection_deleter
{
    void operator()(xcb_connection_t* c)
    {
        if (c)
        {
            xcb_disconnect(c);
        }
    }
};

xcb_screen_t* screen_of_display(xcb_connection_t* c, int screen)
{
    for (auto iter = xcb_setup_roots_iterator(xcb_get_setup(c)); iter.rem; --screen, xcb_screen_next(&iter))
    {
        if (screen == 0)
        {
            return iter.data;
        }
    }
    return nullptr;
}

int main()
{
    unique_ptr<xcb_connection_t, xcb_connection_deleter> connection{xcb_connect(nullptr, nullptr)};
    int rc = xcb_connection_has_error(connection.get());
    if (rc != 0)
    {
        cout << "xcb connection error: " << rc << endl;
        exit(1);
    }

    const auto extreply = xcb_get_extension_data(connection.get(), &xcb_damage_id);
    if (!extreply->present)
    {
        cout << "xcb-damage is not present\n";
        exit(1);
    }

    uint8_t damageEvent = extreply->first_event;
    auto cookie = xcb_damage_query_version(connection.get(), XCB_DAMAGE_MAJOR_VERSION, XCB_DAMAGE_MINOR_VERSION);
    xcb_generic_error_t* e = 0;
    auto reply = xcb_damage_query_version_reply(connection.get(), cookie, &e);
    if (!reply)
    {
        cout << "xcb_damage_use_extension error: " << e->error_code << endl;
        exit(1);
    }
    free(reply);

    auto damage_handle = xcb_generate_id(connection.get());
    xcb_damage_create(connection.get(), damage_handle, screen_of_display(connection.get(), 0)->root, XCB_DAMAGE_REPORT_LEVEL_RAW_RECTANGLES);

    xcb_flush(connection.get());

    auto xfd = xcb_get_file_descriptor(connection.get());
    if (xfd <= 0)
    {
        cout << "invalid xcb file descriptor\n";
        exit(1);
    }

    while (1)
    {
        auto tv = timeval{0, 20000};
        fd_set fds;
        FD_ZERO(&fds);
        FD_SET(xfd, &fds);

        int result = select(xfd + 1, &fds, nullptr, nullptr, &tv);
        if (result == 0)
        {
            continue;
        } else if (result < 0) {
            cerr << "select failed with error: " << strerror(errno) << endl;
            exit(1);
        }

        xcb_generic_event_t* event;
        while ((event = xcb_poll_for_event(connection.get())))
        {
            if (XCB_EVENT_RESPONSE_TYPE(event) != damageEvent)
            {
                free(event);
                continue;
            }
            auto d = reinterpret_cast<xcb_damage_notify_event_t&>(*event);
            cout << "--------- damage event ----------" << endl;
            cout << "area:     x: " << d.area.x << ", y: " << d.area.y << ", w: " << d.area.width << ", h: " << d.area.height << endl;
            cout << "geometry: x: " << d.geometry.x << ", y: " << d.geometry.y << ", w: " << d.geometry.width << ", h: " << d.geometry.height << endl;
            free(event);
        }
    }
    xcb_damage_destroy(connection.get(), damage_handle);
           
    return 0;
}


and here's the output when hitting ctrl+F12 with a full screen konsole instance (on a 1920x1200 display):

Code: Select all
--------- damage event ----------
area:     x: 0, y: 1164, w: 1920, h: 34
geometry: x: 0, y: 0, w: 1920, h: 1200
--------- damage event ----------
area:     x: 0, y: 1198, w: 1920, h: 2
geometry: x: 0, y: 0, w: 1920, h: 1200
--------- damage event ----------
area:     x: 0, y: 1164, w: 1920, h: 34
geometry: x: 0, y: 0, w: 1920, h: 1200
--------- damage event ----------
area:     x: 0, y: 1198, w: 1920, h: 2
geometry: x: 0, y: 0, w: 1920, h: 1200
--------- damage event ----------
area:     x: 0, y: 1164, w: 1920, h: 34
geometry: x: 0, y: 0, w: 1920, h: 1200
--------- damage event ----------
area:     x: 0, y: 1198, w: 1920, h: 2
geometry: x: 0, y: 0, w: 1920, h: 1200


I would expect at least one event for the whole desktop, but all I get is the two events indicating a bar across the bottom 36 pixels of the display has been damaged. Is this expected behaviour, or a known issue?

For reference, here is the output generated when performing the same test in KDE4:

Code: Select all
--------- damage event ----------
area:     x: 0, y: 0, w: 1920, h: 1165
geometry: x: 0, y: 0, w: 1920, h: 1200
--------- damage event ----------
area:     x: 70, y: 1166, w: 214, h: 34
geometry: x: 0, y: 0, w: 1920, h: 1200
--------- damage event ----------
area:     x: 0, y: 1165, w: 1920, h: 35
geometry: x: 0, y: 0, w: 1920, h: 1200
--------- damage event ----------
area:     x: 0, y: 0, w: 1920, h: 1165
geometry: x: 0, y: 0, w: 1920, h: 1200


the first event covers the entire region occupied by the konsole instance.


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Evergrowing, Google [Bot], q.ignora, watchstar