diff options
author | Ken Moore <moorekou@gmail.com> | 2015-10-28 16:05:04 -0400 |
---|---|---|
committer | Ken Moore <moorekou@gmail.com> | 2015-10-28 16:05:04 -0400 |
commit | eb47ffab6182cba7330b3abb079819d0a6ec18c6 (patch) | |
tree | d071558114edb26da91565577d644fb4926fe604 /libLumina | |
parent | Merge branch 'master' of github.com:pcbsd/lumina (diff) | |
download | lumina-eb47ffab6182cba7330b3abb079819d0a6ec18c6.tar.gz lumina-eb47ffab6182cba7330b3abb079819d0a6ec18c6.tar.bz2 lumina-eb47ffab6182cba7330b3abb079819d0a6ec18c6.zip |
Add new X11 functions for about 1/2 of the ICCCM standards
Diffstat (limited to 'libLumina')
-rw-r--r-- | libLumina/LuminaX11.cpp | 80 | ||||
-rw-r--r-- | libLumina/LuminaX11.h | 28 |
2 files changed, 107 insertions, 1 deletions
diff --git a/libLumina/LuminaX11.cpp b/libLumina/LuminaX11.cpp index 392d22db..57455f16 100644 --- a/libLumina/LuminaX11.cpp +++ b/libLumina/LuminaX11.cpp @@ -1080,4 +1080,82 @@ void LXCB::closeSystemTray(WId trayID){ void LXCB::WM_CloseWindow(WId win){ xcb_destroy_window(QX11Info::connection(), win); } - + +// -------------------------------------------------- +// ICCCM Standards (older standards) +// -------------------------------------------------- +// -- WM_NAME +QString LXCB::WM_ICCCM_GetName(WId win){ + xcb_get_property_cookie_t cookie = xcb_icccm_get_wm_name_unchecked(QX11Info::connection(), win); + xcb_icccm_get_text_property_reply_t reply; + if(1 != xcb_icccm_get_wm_name_reply(QX11Info::connection(), cookie, &reply, NULL) ){ + return ""; //error in fetching name + }else{ + return QString::fromLocal8Bit(reply.name); + } +} + +void LXCB::WM_ICCCM_SetName(WId win, QString name){ + xcb_icccm_set_wm_name(QX11Info::connection(), win, XCB_ATOM_STRING, 8, name.length(), name.toLocal8Bit()); +} + +// -- WM_ICON_NAME +QString LXCB::WM_ICCCM_GetIconName(WId win){ + xcb_get_property_cookie_t cookie = xcb_icccm_get_wm_icon_name_unchecked(QX11Info::connection(), win); + xcb_icccm_get_text_property_reply_t reply; + if(1 != xcb_icccm_get_wm_icon_name_reply(QX11Info::connection(), cookie, &reply, NULL) ){ + return ""; //error in fetching name + }else{ + return QString::fromLocal8Bit(reply.name); + } +} + +void LXCB::WM_ICCCM_SetIconName(WId win, QString name){ + xcb_icccm_set_wm_icon_name(QX11Info::connection(), win, XCB_ATOM_STRING, 8, name.length(), name.toLocal8Bit()); +} + +// -- WM_CLIENT_MACHINE +QString LXCB::WM_ICCCM_GetClientMachine(WId win){ + xcb_get_property_cookie_t cookie = xcb_icccm_get_wm_client_machine_unchecked(QX11Info::connection(), win); + xcb_icccm_get_text_property_reply_t reply; + if(1 != xcb_icccm_get_wm_client_machine_reply(QX11Info::connection(), cookie, &reply, NULL) ){ + return ""; //error in fetching name + }else{ + return QString::fromLocal8Bit(reply.name); + } +} + +void LXCB::WM_ICCCM_SetClientMachine(WId win, QString name){ + xcb_icccm_set_wm_client_machine(QX11Info::connection(), win, XCB_ATOM_STRING, 8, name.length(), name.toLocal8Bit()); +} + +// -- WM_CLASS +QString LXCB::WM_ICCCM_GetClass(WId win){ + xcb_get_property_cookie_t cookie = xcb_icccm_get_wm_class_unchecked(QX11Info::connection(), win); + xcb_icccm_get_wm_class_reply_t reply; + if(1 != xcb_icccm_get_wm_class_reply(QX11Info::connection(), cookie, &reply, NULL) ){ + return ""; //error in fetching name + }else{ + //Returns: "<instance name>::::<class name>" + return ( QString::fromLocal8Bit(reply.instance_name)+"::::"+QString::fromLocal8Bit(reply.class_name) ); + } +} + +void LXCB::WM_ICCCM_SetClass(WId win, QString name){ + xcb_icccm_set_wm_class(QX11Info::connection(), win, name.length(), name.toLocal8Bit()); +} + +// -------------------------------------------------------- +// NET_WM Standards (newer standards) +// -------------------------------------------------------- +void LXCB::WM_Set_Root_Supported(){ + //NET_WM standards (ICCCM implied - no standard way to list those) + xcb_atom_t list[] = {}; + xcb_ewmh_set_supported(&EWMH, QX11Info::appScreen(), 0,list); +} + +void LXCB::WM_Set_Window_Supported(WId win){ + //NET_WM standards (ICCCM implied - no standard way to list those) + xcb_atom_t list[] = {}; + xcb_ewmh_set_wm_allowed_actions(&EWMH, win, 0, list); +}
\ No newline at end of file diff --git a/libLumina/LuminaX11.h b/libLumina/LuminaX11.h index 4c791abd..98dea587 100644 --- a/libLumina/LuminaX11.h +++ b/libLumina/LuminaX11.h @@ -122,6 +122,34 @@ public: //============ void WM_CloseWindow(WId win); + // ICCCM Standards (older standards) + // -- WM_NAME + QString WM_ICCCM_GetName(WId win); + void WM_ICCCM_SetName(WId win, QString name); + // -- WM_ICON_NAME + QString WM_ICCCM_GetIconName(WId win); + void WM_ICCCM_SetIconName(WId win, QString name); + // --- WM_CLIENT_MACHINE + QString WM_ICCCM_GetClientMachine(WId win); + void WM_ICCCM_SetClientMachine(WId win, QString name); + // -- WM_CLASS + QString WM_ICCCM_GetClass(WId win); + void WM_ICCCM_SetClass(WId win, QString name); + // -- WM_TRANSIENT_FOR + + // -- WM_SIZE_HINTS + + // -- WM_NORMAL_HINTS + + // -- WM_HINTS + + // -- WM_PROTOCOLS + + + //NET_WM Standards (newer standards) + void WM_Set_Root_Supported(); //set the atom list of supported features on the root window + void WM_Set_Window_Supported(WId win); //set the atom list of supported features on the given window + }; #endif
\ No newline at end of file |