Expose application menu via KWindowInfo
ClosedPublic

Authored by cblack on Mar 18 2020, 2:07 AM.

Details

Summary

Application menu information is now available via KWindowInfo's APIs on X11.

Diff Detail

Repository
R278 KWindowSystem
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
cblack created this revision.Mar 18 2020, 2:07 AM
Restricted Application added a project: Frameworks. · View Herald TranscriptMar 18 2020, 2:07 AM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
cblack requested review of this revision.Mar 18 2020, 2:07 AM
zzag requested changes to this revision.Mar 18 2020, 8:29 AM
zzag added a reviewer: KWin.
zzag added a subscriber: zzag.
zzag added inline comments.
autotests/netwininfotestclient.cpp
281–319

You have to change properties via xcb_change_property().

void NetWinInfoTestClient::testAppMenuObjectPath()
{
    ATOM(_KDE_NET_WM_APPMENU_OBJECT_PATH)
    INFO

    QVERIFY(!info.appMenuObjectPath());

    xcb_change_property(connection(), XCB_PROP_MODE_REPLACE, m_testWindow,
                        atom, XCB_ATOM_STRING, 8, 4, "foo\0");
    xcb_flush(connection());

    waitForPropertyChange(&info, atom, NET::Property(0), NET::WM2AppMenuObjectPath);
    QCOMPARE(info.appMenuObjectPath(), "foo");
}

void NetWinInfoTestClient::testAppMenuServiceName()
{
    ATOM(_KDE_NET_WM_APPMENU_SERVICE_NAME)
    INFO

    QVERIFY(!info.appMenuServiceName());

    xcb_change_property(connection(), XCB_PROP_MODE_REPLACE, m_testWindow,
                        atom, XCB_ATOM_STRING, 8, 4, "foo\0");
    xcb_flush(connection());

    waitForPropertyChange(&info, atom, NET::Property(0), NET::WM2AppMenuServiceName);
    QCOMPARE(info.appMenuServiceName(), "foo");
}
src/netwm_def.h
727–728

Missing // NOT STANDARD @since

src/platforms/xcb/netwm.cpp
3536

s/p->atom(UTF8_STRING)/XCB_ATOM_STRING/

3550

s/p->atom(UTF8_STRING)/XCB_ATOM_STRING/

4681

s/p->atom(UTF8_STRING)/XCB_ATOM_STRING/

4691

s/p->atom(UTF8_STRING)/XCB_ATOM_STRING/

This revision now requires changes to proceed.Mar 18 2020, 8:29 AM
zzag added inline comments.Mar 18 2020, 8:31 AM
autotests/netwininfotestclient.cpp
281–319

please get rid of '\0'

zzag added inline comments.Mar 18 2020, 8:37 AM
src/platforms/xcb/netwm.cpp
4677–4707

Please move WM2GTKFrameExtents above WM2AppMenuObjectPath to match the order in which cookies is filled.

cblack updated this revision to Diff 77915.Mar 18 2020, 1:51 PM
cblack marked 8 inline comments as done.

Address feedback

zzag added inline comments.Mar 18 2020, 2:11 PM
src/platforms/xcb/netwm.cpp
3554

nit: add whitespace before *

3559

ditto

cblack updated this revision to Diff 77921.Mar 18 2020, 2:36 PM

Plonk a space

cblack retitled this revision from [WIP] Expose application menu via KWindowInfo to Expose application menu via KWindowInfo.Mar 18 2020, 2:36 PM
cblack marked 2 inline comments as done.
cblack edited the summary of this revision. (Show Details)
zzag accepted this revision.Mar 18 2020, 2:38 PM
This revision is now accepted and ready to land.Mar 18 2020, 2:38 PM
This revision was automatically updated to reflect the committed changes.
broulik added inline comments.Mar 18 2020, 3:07 PM
src/kwindowinfo.h
579

Copy paste error, requires NET::WM2ApplicationMenuServiceName

588

Copy paste error

src/platforms/xcb/netwm.h
1622

application menu, or just menu?

1628

application menu, or just menu?