diff options
author | Ken Moore <moorekou@gmail.com> | 2015-11-13 10:26:58 -0500 |
---|---|---|
committer | Ken Moore <moorekou@gmail.com> | 2015-11-13 10:26:58 -0500 |
commit | 1284f761d5993f38e5e1239b20e0a08e1b1e4ad2 (patch) | |
tree | 684810674968d8b39b1c4fa689f9c5c9dd3e8041 /libLumina | |
parent | Add a bunch more of the window-level EWMH standards support into luminaX11. O... (diff) | |
download | lumina-1284f761d5993f38e5e1239b20e0a08e1b1e4ad2.tar.gz lumina-1284f761d5993f38e5e1239b20e0a08e1b1e4ad2.tar.bz2 lumina-1284f761d5993f38e5e1239b20e0a08e1b1e4ad2.zip |
Add the final pieces of the EWMH support functions to the Lumina library.
Diffstat (limited to 'libLumina')
-rw-r--r-- | libLumina/LuminaX11.cpp | 96 | ||||
-rw-r--r-- | libLumina/LuminaX11.h | 39 |
2 files changed, 128 insertions, 7 deletions
diff --git a/libLumina/LuminaX11.cpp b/libLumina/LuminaX11.cpp index cecadc99..0bdea55e 100644 --- a/libLumina/LuminaX11.cpp +++ b/libLumina/LuminaX11.cpp @@ -1867,13 +1867,50 @@ QIcon LXCB::WM_Get_Icon(WId win){ } // _NET_WM_PID - +unsigned int LXCB::WM_Get_Pid(WId win){ + xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_pid_unchecked(&EWMH, win); + uint32_t pid = 0; + xcb_ewmh_get_wm_pid_reply(&EWMH, cookie, &pid, NULL); + return pid; +} + // _NET_WM_HANDLED_ICONS - +bool LXCB::WM_Get_Handled_Icons(WId win){ + xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_handled_icons_unchecked(&EWMH, win); + uint32_t num = 0; + xcb_ewmh_get_wm_handled_icons_reply(&EWMH, cookie, &num, NULL); + return (num!=0); //This flag is set on the window +} + +void LXCB::WM_Set_Handled_Icons(WId win, bool set){ + xcb_ewmh_set_wm_handled_icons(&EWMH, win, (set ? 1 : 0)); +} + // _NET_WM_USER_TIME - +unsigned int LXCB::WM_Get_User_Time(WId win){ + xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_user_time_unchecked(&EWMH, win); + uint32_t out = 0; + xcb_ewmh_get_wm_user_time_reply(&EWMH, cookie, &out, NULL); + return out; +} + +void LXCB::WM_Set_User_Time(WId win, unsigned int xtime){ + xcb_ewmh_set_wm_user_time(&EWMH, win, xtime); +} + // _NET_WM_USER_TIME_WINDOW - +/* +WId LXCB::WM_Get_User_Time_WIndow(WId win){ + xcb_get_property_cookie_t cookie = xcb_ewmh_get_user_time_window_unchecked(&EWMH, win); + xcb_window_t out; + xcb_ewmh_get_user_time_window_reply(&EWMH, cookie, &out, NULL); + return out; +} + +void LXCB::WM_Set_User_Time_Window(WId win, WId utwin){ + xcb_ewmh_set_wm_user_time_window(&EWMH, win, utwin); +}*/ + // _NET_FRAME_EXTENTS QList<unsigned int> LXCB::WM_Get_Frame_Extents(WId win){ //Returns: [left,right,top,bottom] margins in pixels (always length 4) @@ -1894,7 +1931,56 @@ void LXCB::WM_Set_Frame_Extents(WId win, QList<unsigned int> margins){ while(margins.length()<4){ margins << 0; } xcb_ewmh_set_frame_extents(&EWMH, win, margins[0], margins[1], margins[2], margins[3]); } + // _NET_WM_OPAQUE_REGION // _NET_WM_BYPASS_COMPOSITOR -
\ No newline at end of file + +// === SPECIAL WM PROTOCOLS (EWMH) === +// _NET_WM_PING +void LXCB::WM_Send_Ping(WId win){ + xcb_ewmh_send_wm_ping(&EWMH, win, XCB_TIME_CURRENT_TIME); +} + +// _NET_WM_SYNC_REQUEST +uint64_t LXCB::WM_Get_Sync_Request_Counter(WId win){ + xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_sync_request_counter_unchecked(&EWMH, win); + uint64_t count = 0; + xcb_ewmh_get_wm_sync_request_counter_reply(&EWMH, cookie, &count, NULL); + return count; +} + +/*void LXCB::WM_Set_Sync_Request_Counter(WId win, uint64_t count){ + +}*/ + +// _NET_WM_FULLSCREEN_MONITORS +QList<unsigned int> LXCB::WM_Get_Fullscreen_Monitors(WId win){ + //Returns: [top,bottom,left,right] monitor numbers for window to use when fullscreen + QList<unsigned int> out; out << 0 << 0 << 0 << 0; //init the output array + xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_fullscreen_monitors_unchecked(&EWMH, win); + xcb_ewmh_get_wm_fullscreen_monitors_reply_t reply; + if(1==xcb_ewmh_get_wm_fullscreen_monitors_reply(&EWMH, cookie, &reply, NULL) ){ + out[0] = reply.top; out[1] = reply.bottom; + out[2] = reply.left; out[3] = reply.right; + } + return out; +} + +void LXCB::WM_Set_Fullscreen_Montors(WId win, QList<unsigned int> list){ + //Input: [top,bottom,left,right] monitor numbers + while(list.length()<4){ list << 0; } + xcb_ewmh_set_wm_fullscreen_monitors(&EWMH, win, list[0], list[1], list[2], list[3]); +} + +// _NET_WM_CM_S(n) +WId LXCB::WM_Get_CM_Owner(){ + xcb_get_selection_owner_cookie_t cookie = xcb_ewmh_get_wm_cm_owner_unchecked(&EWMH, QX11Info::appScreen()); + xcb_window_t owner = 0; + xcb_ewmh_get_wm_cm_owner_reply(&EWMH, cookie, &owner, NULL); + return owner; +} + +void LXCB::WM_Set_CM_Owner(WId win){ + xcb_ewmh_set_wm_cm_owner(&EWMH, QX11Info::appScreen(), win, XCB_TIME_CURRENT_TIME,0,0); +}
\ No newline at end of file diff --git a/libLumina/LuminaX11.h b/libLumina/LuminaX11.h index a66a0c3a..0106515d 100644 --- a/libLumina/LuminaX11.h +++ b/libLumina/LuminaX11.h @@ -300,25 +300,60 @@ public: void WM_Set_Icon_Geometry(WId win, QRect geom); // _NET_WM_ICON - // Note: Don't write a "Set" routine for this - that is handled on the client side and not the WM/DE side + // Note: Don't write a "Set" routine for this - is handled on the client side and not the WM/DE side QIcon WM_Get_Icon(WId win); // _NET_WM_PID + // Note: Don't write a "Set" routine for this - is handled on the client side and not the WM/DE side + unsigned int WM_Get_Pid(WId win); // _NET_WM_HANDLED_ICONS + // Note: Probably not going to need this - is used by pagers exclusively to tell the WM + // not to provide task manager icons (not needed for an integrated WM/DE combination) + bool WM_Get_Handled_Icons(WId win); + void WM_Set_Handled_Icons(WId win, bool set); // _NET_WM_USER_TIME + // Note: The user time property on a client window is supposed to be updated on user activity, + // allowing the WM to be able to distinguish user activity from automated window actions + unsigned int WM_Get_User_Time(WId win); + void WM_Set_User_Time(WId win, unsigned int xtime); // _NET_WM_USER_TIME_WINDOW + // This returns the window to watch for time update events, + // instead of constantly polling all the (toplevel?) windows for the app + // IGNORED - xcb_ewmh library does not appear to have valid support for this property yet (11/13/15) + //WId WM_Get_User_Time_WIndow(WId win); + //void WM_Set_User_Time_Window(WId win, WId utwin); // _NET_FRAME_EXTENTS QList<unsigned int> WM_Get_Frame_Extents(WId win); //Returns: [left,right,top,bottom] margins in pixels (always length 4) void WM_Set_Frame_Extents(WId win, QList<unsigned int> margins); //Input: [left, right, top, bottom] - must be length 4 // _NET_WM_OPAQUE_REGION + // NOT SUPPORTED - missing in xcb_ewmh library (11/13/15) // _NET_WM_BYPASS_COMPOSITOR - + // NOT SUPPORTED - missing in xcb_ewmh library (11/13/15) + + // === SPECIAL WM PROTOCOLS (EWMH) === + // _NET_WM_PING + // Note: Used to determine if a window/app is hung before killing the process (with PID) + // The client window should respond instantly if it is still active (waiting on user input for instance) + void WM_Send_Ping(WId win); + + // _NET_WM_SYNC_REQUEST + uint64_t WM_Get_Sync_Request_Counter(WId win); + //void WM_Set_Sync_Request_Counter(WId win, uint64_t count); + + // _NET_WM_FULLSCREEN_MONITORS + QList<unsigned int> WM_Get_Fullscreen_Monitors(WId win); //Returns: [top,bottom,left,right] monitor numbers for window to use when fullscreen + void WM_Set_Fullscreen_Montors(WId win, QList<unsigned int> list); //Input: [top,bottom,left,right] monitor numbers + + // _NET_WM_CM_S(n) + // Note: This is used to check/register the compositing manager for the current X screen (#n) + WId WM_Get_CM_Owner(); + void WM_Set_CM_Owner(WId win); private: QList<xcb_atom_t> ATOMS; |