mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-23 18:32:49 +00:00
generic: port some functionality to XCB
the module for finding the library is simple and kdeui now has to link to both X11 and XCB libraries but this allows clients that make use of the KDE window management API to not use Xlib API.
This commit is contained in:
parent
928843400c
commit
332bb23e15
7 changed files with 151 additions and 96 deletions
|
@ -44,6 +44,10 @@ if(UNIX AND Q_WS_X11)
|
|||
if(NOT X11_SM_FOUND)
|
||||
message(FATAL_ERROR "\nThe X11 Session Management (SM) development package could not be found.\nPlease install libSM.\n")
|
||||
endif(NOT X11_SM_FOUND)
|
||||
find_package(XCB)
|
||||
if(NOT XCB_FOUND)
|
||||
message(FATAL_ERROR "\nThe XCB development package could not be found.\nPlease install libxcb.\n")
|
||||
endif(NOT XCB_FOUND)
|
||||
endif(UNIX AND Q_WS_X11)
|
||||
|
||||
#required features:
|
||||
|
|
39
cmake/modules/FindXCB.cmake
Normal file
39
cmake/modules/FindXCB.cmake
Normal file
|
@ -0,0 +1,39 @@
|
|||
# - Try to find XCB
|
||||
# Once done this will define
|
||||
#
|
||||
# XCB_FOUND - system has XCB
|
||||
# XCB_INCLUDES - the libxcb include directory
|
||||
# XCB_LIBRARIES - The libraries needed to use libxcb
|
||||
#
|
||||
# Copyright (c) 2015, Ivailo Monev, <xakepa10@gmail.com>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
|
||||
if(XCB_INCLUDES AND XCB_LIBRARIES)
|
||||
set(XCB_FIND_QUIETLY TRUE)
|
||||
endif(XCB_INCLUDES AND XCB_LIBRARIES)
|
||||
|
||||
find_path(XCB_INCLUDES
|
||||
NAMES
|
||||
xcb.h
|
||||
PATH_SUFFIXES xcb
|
||||
HINTS
|
||||
$ENV{NASDIR}/include
|
||||
/usr/include
|
||||
/usr/local/include
|
||||
${INCLUDE_INSTALL_DIR}
|
||||
)
|
||||
|
||||
find_library(XCB_LIBRARIES
|
||||
xcb
|
||||
HINTS
|
||||
$ENV{NASDIR}/lib
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
${LIB_INSTALL_DIR}
|
||||
)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(XCB DEFAULT_MSG XCB_INCLUDES XCB_LIBRARIES)
|
||||
|
||||
mark_as_advanced(XCB_INCLUDES XCB_LIBRARIES)
|
|
@ -314,6 +314,7 @@ if (Q_WS_X11 AND X11_Xkb_FOUND)
|
|||
include_directories (
|
||||
${X11_Xkb_INCLUDE_PATH}
|
||||
${X11_Xlib_INCLUDE_PATH}
|
||||
${XCB_INCLUDES}
|
||||
)
|
||||
set(kdeui_LIB_SRCS ${kdeui_LIB_SRCS} util/kmodifierkeyinfoprovider_x11.cpp)
|
||||
else (Q_WS_X11 AND X11_Xkb_FOUND)
|
||||
|
@ -372,9 +373,8 @@ qt4_add_dbus_interface(kdeui_LIB_SRCS ${knotify_xml} knotify_interface)
|
|||
kde4_add_library(kdeui ${LIBRARY_TYPE} ${kdeui_LIB_SRCS})
|
||||
|
||||
target_link_libraries(kdeui PRIVATE ${KDE4_KDECORE_LIBS} ${X11_LIBRARIES} ${QT_QTGUI_LIBRARY}
|
||||
${QT_QTXML_LIBRARY} ${KDEUI_EXTRA_LIBS} ${QT_QTNETWORK_LIBRARY})
|
||||
|
||||
target_link_libraries(kdeui PRIVATE ${QT_QTSVG_LIBRARY} ${DBUSMENUQT_LIBRARIES})
|
||||
${QT_QTXML_LIBRARY} ${KDEUI_EXTRA_LIBS} ${QT_QTNETWORK_LIBRARY}
|
||||
${QT_QTSVG_LIBRARY} ${DBUSMENUQT_LIBRARIES})
|
||||
|
||||
if(X11_XTest_FOUND)
|
||||
target_link_libraries(kdeui PRIVATE ${X11_XTest_LIB})
|
||||
|
@ -392,6 +392,10 @@ if (X11_Xrender_FOUND)
|
|||
target_link_libraries(kdeui PRIVATE ${X11_Xrender_LIB})
|
||||
endif(X11_Xrender_FOUND)
|
||||
|
||||
if (XCB_FOUND)
|
||||
target_link_libraries(kdeui PRIVATE ${XCB_LIBRARIES})
|
||||
endif(XCB_FOUND)
|
||||
|
||||
target_link_libraries(kdeui PUBLIC kdecore ${QT_QTGUI_LIBRARY} ${QT_QTSVG_LIBRARY})
|
||||
|
||||
set_target_properties(kdeui PROPERTIES
|
||||
|
|
|
@ -106,8 +106,8 @@ public:
|
|||
int xfixesEventBase;
|
||||
bool mapViewport();
|
||||
|
||||
void addClient(Window);
|
||||
void removeClient(Window);
|
||||
void addClient(xcb_window_t);
|
||||
void removeClient(xcb_window_t);
|
||||
|
||||
bool x11Event( XEvent * ev );
|
||||
|
||||
|
@ -264,7 +264,7 @@ void KWindowSystemPrivate::updateStackingOrder()
|
|||
stackingOrder.append( clientListStacking()[i] );
|
||||
}
|
||||
|
||||
void KWindowSystemPrivate::addClient(Window w)
|
||||
void KWindowSystemPrivate::addClient(xcb_window_t w)
|
||||
{
|
||||
KWindowSystem* s_q = KWindowSystem::self();
|
||||
|
||||
|
@ -289,7 +289,7 @@ void KWindowSystemPrivate::addClient(Window w)
|
|||
emit s_q->strutChanged();
|
||||
}
|
||||
|
||||
void KWindowSystemPrivate::removeClient(Window w)
|
||||
void KWindowSystemPrivate::removeClient(xcb_window_t w)
|
||||
{
|
||||
KWindowSystem* s_q = KWindowSystem::self();
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
#include <X11/Xmd.h>
|
||||
#include <X11/Xlibint.h> // for access to _Display
|
||||
|
||||
// UTF-8 string
|
||||
static Atom UTF8_STRING = 0;
|
||||
|
@ -181,10 +182,10 @@ static char *nstrndup(const char *s1, int l) {
|
|||
}
|
||||
|
||||
|
||||
static Window *nwindup(const Window *w1, int n) {
|
||||
if (! w1 || n == 0) return (Window *) 0;
|
||||
static xcb_window_t *nwindup(const xcb_window_t *w1, int n) {
|
||||
if (! w1 || n == 0) return (xcb_window_t *) 0;
|
||||
|
||||
Window *w2 = new Window[n];
|
||||
xcb_window_t *w2 = new xcb_window_t[n];
|
||||
while (n--) w2[n] = w1[n];
|
||||
return w2;
|
||||
}
|
||||
|
@ -244,9 +245,9 @@ static void refdec_nwi(NETWinInfoPrivate *p) {
|
|||
|
||||
|
||||
static int wcmp(const void *a, const void *b) {
|
||||
if (*((Window *) a) < *((Window *) b))
|
||||
if (*((xcb_window_t *) a) < *((xcb_window_t *) b))
|
||||
return -1;
|
||||
else if (*((Window *) a) > *((Window *) b))
|
||||
else if (*((xcb_window_t *) a) > *((xcb_window_t *) b))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
|
@ -469,7 +470,7 @@ static void create_netwm_atoms(Display *d) {
|
|||
}
|
||||
|
||||
|
||||
static void readIcon(Display* display, Window window, Atom property, NETRArray<NETIcon>& icons, int& icon_count) {
|
||||
static void readIcon(Display* display, xcb_window_t window, Atom property, NETRArray<NETIcon>& icons, int& icon_count) {
|
||||
|
||||
#ifdef NETWMDEBUG
|
||||
fprintf(stderr, "NET: readIcon\n");
|
||||
|
@ -620,7 +621,7 @@ Z &NETRArray<Z>::operator[](int index) {
|
|||
|
||||
// Construct a new NETRootInfo object.
|
||||
|
||||
NETRootInfo::NETRootInfo(Display *display, Window supportWindow, const char *wmName,
|
||||
NETRootInfo::NETRootInfo(Display *display, xcb_window_t supportWindow, const char *wmName,
|
||||
const unsigned long properties[], int properties_size,
|
||||
int screen, bool doActivate)
|
||||
{
|
||||
|
@ -645,7 +646,7 @@ NETRootInfo::NETRootInfo(Display *display, Window supportWindow, const char *wmN
|
|||
p->supportwindow = supportWindow;
|
||||
p->number_of_desktops = p->current_desktop = 0;
|
||||
p->active = None;
|
||||
p->clients = p->stacking = p->virtual_roots = (Window *) 0;
|
||||
p->clients = p->stacking = p->virtual_roots = (xcb_window_t *) 0;
|
||||
p->clients_count = p->stacking_count = p->virtual_roots_count = 0;
|
||||
p->showing_desktop = false;
|
||||
p->desktop_layout_orientation = OrientationHorizontal;
|
||||
|
@ -700,7 +701,7 @@ NETRootInfo::NETRootInfo(Display *display, const unsigned long properties[], int
|
|||
p->supportwindow = None;
|
||||
p->number_of_desktops = p->current_desktop = 0;
|
||||
p->active = None;
|
||||
p->clients = p->stacking = p->virtual_roots = (Window *) 0;
|
||||
p->clients = p->stacking = p->virtual_roots = (xcb_window_t *) 0;
|
||||
p->clients_count = p->stacking_count = p->virtual_roots_count = 0;
|
||||
p->showing_desktop = false;
|
||||
p->desktop_layout_orientation = OrientationHorizontal;
|
||||
|
@ -759,7 +760,7 @@ NETRootInfo::NETRootInfo(Display *display, unsigned long properties, int screen,
|
|||
p->supportwindow = None;
|
||||
p->number_of_desktops = p->current_desktop = 0;
|
||||
p->active = None;
|
||||
p->clients = p->stacking = p->virtual_roots = (Window *) 0;
|
||||
p->clients = p->stacking = p->virtual_roots = (xcb_window_t *) 0;
|
||||
p->clients_count = p->stacking_count = p->virtual_roots_count = 0;
|
||||
p->showing_desktop = false;
|
||||
p->desktop_layout_orientation = OrientationHorizontal;
|
||||
|
@ -838,7 +839,7 @@ void NETRootInfo::activate() {
|
|||
}
|
||||
|
||||
|
||||
void NETRootInfo::setClientList(const Window *windows, unsigned int count) {
|
||||
void NETRootInfo::setClientList(const xcb_window_t *windows, unsigned int count) {
|
||||
if (p->role != WindowManager) return;
|
||||
|
||||
p->clients_count = count;
|
||||
|
@ -857,7 +858,7 @@ void NETRootInfo::setClientList(const Window *windows, unsigned int count) {
|
|||
}
|
||||
|
||||
|
||||
void NETRootInfo::setClientListStacking(const Window *windows, unsigned int count) {
|
||||
void NETRootInfo::setClientListStacking(const xcb_window_t *windows, unsigned int count) {
|
||||
if (p->role != WindowManager) return;
|
||||
|
||||
p->stacking_count = count;
|
||||
|
@ -1532,12 +1533,12 @@ void NETRootInfo::updateSupportedProperties( Atom atom )
|
|||
p->properties[ PROTOCOLS2 ] |= WM2KDEShadow;
|
||||
}
|
||||
|
||||
void NETRootInfo::setActiveWindow(Window window) {
|
||||
void NETRootInfo::setActiveWindow(xcb_window_t window) {
|
||||
setActiveWindow( window, FromUnknown, QX11Info::appUserTime(), None );
|
||||
}
|
||||
|
||||
void NETRootInfo::setActiveWindow(Window window, NET::RequestSource src,
|
||||
Time timestamp, Window active_window ) {
|
||||
void NETRootInfo::setActiveWindow(xcb_window_t window, NET::RequestSource src,
|
||||
xcb_timestamp_t timestamp, xcb_window_t active_window ) {
|
||||
|
||||
#ifdef NETWMDEBUG
|
||||
fprintf(stderr, "NETRootInfo::setActiveWindow(0x%lx) (%s)\n",
|
||||
|
@ -1596,7 +1597,7 @@ void NETRootInfo::setWorkArea(int desktop, const NETRect &workarea) {
|
|||
}
|
||||
|
||||
|
||||
void NETRootInfo::setVirtualRoots(const Window *windows, unsigned int count) {
|
||||
void NETRootInfo::setVirtualRoots(const xcb_window_t *windows, unsigned int count) {
|
||||
if (p->role != WindowManager) return;
|
||||
|
||||
p->virtual_roots_count = count;
|
||||
|
@ -1666,7 +1667,7 @@ bool NETRootInfo::showingDesktop() const {
|
|||
}
|
||||
|
||||
|
||||
void NETRootInfo::closeWindowRequest(Window window) {
|
||||
void NETRootInfo::closeWindowRequest(xcb_window_t window) {
|
||||
|
||||
#ifdef NETWMDEBUG
|
||||
fprintf(stderr, "NETRootInfo::closeWindowRequest: requesting close for 0x%lx\n",
|
||||
|
@ -1690,7 +1691,7 @@ void NETRootInfo::closeWindowRequest(Window window) {
|
|||
}
|
||||
|
||||
|
||||
void NETRootInfo::moveResizeRequest(Window window, int x_root, int y_root,
|
||||
void NETRootInfo::moveResizeRequest(xcb_window_t window, int x_root, int y_root,
|
||||
Direction direction)
|
||||
{
|
||||
|
||||
|
@ -1716,7 +1717,7 @@ void NETRootInfo::moveResizeRequest(Window window, int x_root, int y_root,
|
|||
XSendEvent(p->display, p->root, False, netwm_sendevent_mask, &e);
|
||||
}
|
||||
|
||||
void NETRootInfo::moveResizeWindowRequest(Window window, int flags, int x, int y, int width, int height )
|
||||
void NETRootInfo::moveResizeWindowRequest(xcb_window_t window, int flags, int x, int y, int width, int height )
|
||||
{
|
||||
|
||||
#ifdef NETWMDEBUG
|
||||
|
@ -1741,7 +1742,7 @@ void NETRootInfo::moveResizeWindowRequest(Window window, int flags, int x, int y
|
|||
XSendEvent(p->display, p->root, False, netwm_sendevent_mask, &e);
|
||||
}
|
||||
|
||||
void NETRootInfo::restackRequest(Window window, RequestSource src, Window above, int detail, Time timestamp )
|
||||
void NETRootInfo::restackRequest(xcb_window_t window, RequestSource src, xcb_window_t above, int detail, xcb_timestamp_t timestamp )
|
||||
{
|
||||
#ifdef NETWMDEBUG
|
||||
fprintf(stderr,
|
||||
|
@ -1765,7 +1766,7 @@ void NETRootInfo::restackRequest(Window window, RequestSource src, Window above,
|
|||
XSendEvent(p->display, p->root, False, netwm_sendevent_mask, &e);
|
||||
}
|
||||
|
||||
void NETRootInfo::sendPing( Window window, Time timestamp )
|
||||
void NETRootInfo::sendPing( xcb_window_t window, xcb_timestamp_t timestamp )
|
||||
{
|
||||
if (p->role != WindowManager) return;
|
||||
#ifdef NETWMDEBUG
|
||||
|
@ -1787,7 +1788,7 @@ void NETRootInfo::sendPing( Window window, Time timestamp )
|
|||
XSendEvent(p->display, window, False, 0, &e);
|
||||
}
|
||||
|
||||
void NETRootInfo::takeActivity( Window window, Time timestamp, long flags )
|
||||
void NETRootInfo::takeActivity( xcb_window_t window, xcb_timestamp_t timestamp, long flags )
|
||||
{
|
||||
if (p->role != WindowManager) return;
|
||||
#ifdef NETWMDEBUG
|
||||
|
@ -1907,8 +1908,8 @@ void NETRootInfo::event(XEvent *event, unsigned long* properties, int properties
|
|||
#endif
|
||||
|
||||
RequestSource src = FromUnknown;
|
||||
Time timestamp = CurrentTime;
|
||||
Window active_window = None;
|
||||
xcb_timestamp_t timestamp = CurrentTime;
|
||||
xcb_window_t active_window = None;
|
||||
// make sure there aren't unknown values
|
||||
if( event->xclient.data.l[0] >= FromUnknown
|
||||
&& event->xclient.data.l[0] <= FromTool )
|
||||
|
@ -1968,7 +1969,7 @@ void NETRootInfo::event(XEvent *event, unsigned long* properties, int properties
|
|||
#endif
|
||||
|
||||
RequestSource src = FromUnknown;
|
||||
Time timestamp = CurrentTime;
|
||||
xcb_timestamp_t timestamp = CurrentTime;
|
||||
// make sure there aren't unknown values
|
||||
if( event->xclient.data.l[0] >= FromUnknown
|
||||
&& event->xclient.data.l[0] <= FromTool )
|
||||
|
@ -2132,8 +2133,8 @@ void NETRootInfo::update( const unsigned long dirty_props[] )
|
|||
}
|
||||
|
||||
if (dirty & ClientList) {
|
||||
QList<Window> clientsToRemove;
|
||||
QList<Window> clientsToAdd;
|
||||
QList<xcb_window_t> clientsToRemove;
|
||||
QList<xcb_window_t> clientsToAdd;
|
||||
|
||||
bool read_ok = false;
|
||||
if (XGetWindowProperty(p->display, p->root, net_client_list,
|
||||
|
@ -2141,9 +2142,9 @@ void NETRootInfo::update( const unsigned long dirty_props[] )
|
|||
&format_ret, &nitems_ret, &unused, &data_ret)
|
||||
== Success) {
|
||||
if (type_ret == XA_WINDOW && format_ret == 32) {
|
||||
Window *wins = (Window *) data_ret;
|
||||
xcb_window_t *wins = (xcb_window_t *) data_ret;
|
||||
|
||||
qsort(wins, nitems_ret, sizeof(Window), wcmp);
|
||||
qsort(wins, nitems_ret, sizeof(xcb_window_t), wcmp);
|
||||
|
||||
if (p->clients) {
|
||||
if (p->role == Client) {
|
||||
|
@ -2220,7 +2221,7 @@ void NETRootInfo::update( const unsigned long dirty_props[] )
|
|||
&format_ret, &nitems_ret, &unused, &data_ret)
|
||||
== Success) {
|
||||
if (type_ret == XA_WINDOW && format_ret == 32) {
|
||||
Window *wins = (Window *) data_ret;
|
||||
xcb_window_t *wins = (xcb_window_t *) data_ret;
|
||||
|
||||
p->stacking_count = nitems_ret;
|
||||
p->stacking = nwindup(wins, p->stacking_count);
|
||||
|
@ -2369,7 +2370,7 @@ void NETRootInfo::update( const unsigned long dirty_props[] )
|
|||
&nitems_ret, &unused, &data_ret)
|
||||
== Success) {
|
||||
if (type_ret == XA_WINDOW && format_ret == 32 && nitems_ret == 1) {
|
||||
p->active = *((Window *) data_ret);
|
||||
p->active = *((xcb_window_t *) data_ret);
|
||||
}
|
||||
|
||||
#ifdef NETWMDEBUG
|
||||
|
@ -2419,7 +2420,7 @@ void NETRootInfo::update( const unsigned long dirty_props[] )
|
|||
&nitems_ret, &unused, &data_ret)
|
||||
== Success) {
|
||||
if (type_ret == XA_WINDOW && format_ret == 32 && nitems_ret == 1) {
|
||||
p->supportwindow = *((Window *) data_ret);
|
||||
p->supportwindow = *((xcb_window_t *) data_ret);
|
||||
|
||||
unsigned char *name_ret;
|
||||
if (XGetWindowProperty(p->display, p->supportwindow,
|
||||
|
@ -2454,7 +2455,7 @@ void NETRootInfo::update( const unsigned long dirty_props[] )
|
|||
&format_ret, &nitems_ret, &unused, &data_ret)
|
||||
== Success) {
|
||||
if (type_ret == XA_WINDOW && format_ret == 32) {
|
||||
Window *wins = (Window *) data_ret;
|
||||
xcb_window_t *wins = (xcb_window_t *) data_ret;
|
||||
|
||||
p->virtual_roots_count = nitems_ret;
|
||||
p->virtual_roots = nwindup(wins, p->virtual_roots_count);
|
||||
|
@ -2525,12 +2526,12 @@ Display *NETRootInfo::x11Display() const {
|
|||
}
|
||||
|
||||
|
||||
Window NETRootInfo::rootWindow() const {
|
||||
xcb_window_t NETRootInfo::rootWindow() const {
|
||||
return p->root;
|
||||
}
|
||||
|
||||
|
||||
Window NETRootInfo::supportWindow() const {
|
||||
xcb_window_t NETRootInfo::supportWindow() const {
|
||||
return p->supportwindow;
|
||||
}
|
||||
|
||||
|
@ -2640,7 +2641,7 @@ bool NETRootInfo::isSupported( NET::Action action ) const {
|
|||
return p->properties[ ACTIONS ] & action;
|
||||
}
|
||||
|
||||
const Window *NETRootInfo::clientList() const {
|
||||
const xcb_window_t *NETRootInfo::clientList() const {
|
||||
return p->clients;
|
||||
}
|
||||
|
||||
|
@ -2650,7 +2651,7 @@ int NETRootInfo::clientListCount() const {
|
|||
}
|
||||
|
||||
|
||||
const Window *NETRootInfo::clientListStacking() const {
|
||||
const xcb_window_t *NETRootInfo::clientListStacking() const {
|
||||
return p->stacking;
|
||||
}
|
||||
|
||||
|
@ -2694,7 +2695,7 @@ const char *NETRootInfo::desktopName(int desktop) const {
|
|||
}
|
||||
|
||||
|
||||
const Window *NETRootInfo::virtualRoots( ) const {
|
||||
const xcb_window_t *NETRootInfo::virtualRoots( ) const {
|
||||
return p->virtual_roots;
|
||||
}
|
||||
|
||||
|
@ -2733,7 +2734,7 @@ int NETRootInfo::currentDesktop( bool ignore_viewport ) const {
|
|||
}
|
||||
|
||||
|
||||
Window NETRootInfo::activeWindow() const {
|
||||
xcb_window_t NETRootInfo::activeWindow() const {
|
||||
return p->active;
|
||||
}
|
||||
|
||||
|
@ -2742,7 +2743,7 @@ Window NETRootInfo::activeWindow() const {
|
|||
|
||||
const int NETWinInfo::OnAllDesktops = NET::OnAllDesktops;
|
||||
|
||||
NETWinInfo::NETWinInfo(Display *display, Window window, Window rootWindow,
|
||||
NETWinInfo::NETWinInfo(Display *display, xcb_window_t window, xcb_window_t rootWindow,
|
||||
const unsigned long properties[], int properties_size,
|
||||
Role role)
|
||||
{
|
||||
|
@ -2806,7 +2807,7 @@ NETWinInfo::NETWinInfo(Display *display, Window window, Window rootWindow,
|
|||
}
|
||||
|
||||
|
||||
NETWinInfo::NETWinInfo(Display *display, Window window, Window rootWindow,
|
||||
NETWinInfo::NETWinInfo(Display *display, xcb_window_t window, xcb_window_t rootWindow,
|
||||
unsigned long properties, Role role)
|
||||
{
|
||||
|
||||
|
@ -3639,7 +3640,7 @@ NETIcon NETWinInfo::iconInternal(NETRArray<NETIcon>& icons, int icon_count, int
|
|||
return result;
|
||||
}
|
||||
|
||||
void NETWinInfo::setUserTime( Time time ) {
|
||||
void NETWinInfo::setUserTime( xcb_timestamp_t time ) {
|
||||
if (p->role != Client) return;
|
||||
|
||||
p->user_time = time;
|
||||
|
@ -4429,7 +4430,13 @@ void NETWinInfo::update(const unsigned long dirty_props[]) {
|
|||
|
||||
if (dirty2 & WM2TransientFor) {
|
||||
p->transient_for = None;
|
||||
XGetTransientForHint(p->display, p->window, &p->transient_for);
|
||||
xcb_connection_t *c = xcb_connect(p->display->display_name, NULL);
|
||||
if(c) {
|
||||
xcb_get_property_cookie_t cookie = xcb_get_property_unchecked(c, 0, p->window, XCB_ATOM_WM_TRANSIENT_FOR, XCB_ATOM_WINDOW, 0, 1);
|
||||
xcb_get_property_reply_t *reply = xcb_get_property_reply(c, cookie, NULL);
|
||||
if(reply)
|
||||
p->transient_for = *reinterpret_cast<xcb_window_t *>(xcb_get_property_value(reply));
|
||||
}
|
||||
}
|
||||
|
||||
if (dirty2 & WM2GroupLeader) {
|
||||
|
@ -4585,7 +4592,7 @@ int NETWinInfo::pid() const {
|
|||
return p->pid;
|
||||
}
|
||||
|
||||
Time NETWinInfo::userTime() const {
|
||||
xcb_timestamp_t NETWinInfo::userTime() const {
|
||||
return p->user_time;
|
||||
}
|
||||
|
||||
|
@ -4605,11 +4612,11 @@ bool NETWinInfo::hasNETSupport() const {
|
|||
return p->has_net_support;
|
||||
}
|
||||
|
||||
Window NETWinInfo::transientFor() const {
|
||||
xcb_window_t NETWinInfo::transientFor() const {
|
||||
return p->transient_for;
|
||||
}
|
||||
|
||||
Window NETWinInfo::groupLeader() const {
|
||||
xcb_window_t NETWinInfo::groupLeader() const {
|
||||
return p->window_group;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/Xatom.h>
|
||||
#include <xcb/xcb.h>
|
||||
#include <fixx11h.h>
|
||||
|
||||
#include "netwm_def.h"
|
||||
|
@ -95,7 +96,7 @@ public:
|
|||
|
||||
@param doActivate true to activate the window
|
||||
**/
|
||||
NETRootInfo(Display *display, Window supportWindow, const char *wmName,
|
||||
NETRootInfo(Display *display, xcb_window_t supportWindow, const char *wmName,
|
||||
const unsigned long properties[], int properties_size,
|
||||
int screen = -1, bool doActivate = true);
|
||||
|
||||
|
@ -157,14 +158,14 @@ public:
|
|||
|
||||
@return the id of the root window
|
||||
**/
|
||||
Window rootWindow() const;
|
||||
xcb_window_t rootWindow() const;
|
||||
|
||||
/**
|
||||
Returns the Window id of the supportWindow.
|
||||
|
||||
@return the id of the support window
|
||||
**/
|
||||
Window supportWindow() const;
|
||||
xcb_window_t supportWindow() const;
|
||||
|
||||
/**
|
||||
Returns the name of the Window Manager.
|
||||
|
@ -261,7 +262,7 @@ public:
|
|||
|
||||
@see clientListCount()
|
||||
**/
|
||||
const Window *clientList() const;
|
||||
const xcb_window_t *clientList() const;
|
||||
|
||||
/**
|
||||
Returns the number of managed windows in clientList array.
|
||||
|
@ -280,7 +281,7 @@ public:
|
|||
|
||||
@see clientListStackingCount()
|
||||
**/
|
||||
const Window *clientListStacking() const;
|
||||
const xcb_window_t *clientListStacking() const;
|
||||
|
||||
/**
|
||||
Returns the number of managed windows in the clientListStacking array.
|
||||
|
@ -345,7 +346,7 @@ public:
|
|||
|
||||
@see virtualRootsCount()
|
||||
**/
|
||||
const Window *virtualRoots( ) const;
|
||||
const xcb_window_t *virtualRoots( ) const;
|
||||
|
||||
/**
|
||||
Returns the number of window in the virtualRoots array.
|
||||
|
@ -403,7 +404,7 @@ public:
|
|||
|
||||
@return the id of the active window
|
||||
**/
|
||||
Window activeWindow() const;
|
||||
xcb_window_t activeWindow() const;
|
||||
|
||||
/**
|
||||
Window Managers must call this after creating the NETRootInfo object, and
|
||||
|
@ -422,7 +423,7 @@ public:
|
|||
|
||||
@param count The number of windows in the array
|
||||
**/
|
||||
void setClientList(const Window *windows, unsigned int count);
|
||||
void setClientList(const xcb_window_t *windows, unsigned int count);
|
||||
|
||||
/**
|
||||
Sets the list of managed windows in stacking order on the Root/Desktop
|
||||
|
@ -432,7 +433,7 @@ public:
|
|||
|
||||
@param count The number of windows in the array.
|
||||
**/
|
||||
void setClientListStacking(const Window *windows, unsigned int count);
|
||||
void setClientListStacking(const xcb_window_t *windows, unsigned int count);
|
||||
|
||||
/**
|
||||
Sets the current desktop to the specified desktop.
|
||||
|
@ -509,8 +510,8 @@ public:
|
|||
caused the request
|
||||
@param active_window active window of the requesting application, if any
|
||||
**/
|
||||
void setActiveWindow(Window window, NET::RequestSource src,
|
||||
Time timestamp, Window active_window);
|
||||
void setActiveWindow(xcb_window_t window, NET::RequestSource src,
|
||||
xcb_timestamp_t timestamp, xcb_window_t active_window);
|
||||
|
||||
/**
|
||||
Sets the active (focused) window the specified window. This should
|
||||
|
@ -518,7 +519,7 @@ public:
|
|||
|
||||
@param window the if of the new active window
|
||||
**/
|
||||
void setActiveWindow(Window window);
|
||||
void setActiveWindow(xcb_window_t window);
|
||||
|
||||
/**
|
||||
Sets the workarea for the specified desktop
|
||||
|
@ -536,7 +537,7 @@ public:
|
|||
|
||||
@param count The number of windows in the array.
|
||||
**/
|
||||
void setVirtualRoots(const Window *windows, unsigned int count);
|
||||
void setVirtualRoots(const xcb_window_t *windows, unsigned int count);
|
||||
|
||||
/**
|
||||
Sets the desktop layout. This is set by the pager. When setting, the pager must
|
||||
|
@ -567,7 +568,7 @@ public:
|
|||
|
||||
@param window the id of the window to close
|
||||
**/
|
||||
void closeWindowRequest(Window window);
|
||||
void closeWindowRequest(xcb_window_t window);
|
||||
|
||||
/**
|
||||
Clients (such as pagers/taskbars) that wish to start a WMMoveResize
|
||||
|
@ -584,7 +585,7 @@ public:
|
|||
@param direction One of NET::Direction (see base class documentation for
|
||||
a description of the different directions).
|
||||
**/
|
||||
void moveResizeRequest(Window window, int x_root, int y_root,
|
||||
void moveResizeRequest(xcb_window_t window, int x_root, int y_root,
|
||||
Direction direction);
|
||||
|
||||
/**
|
||||
|
@ -600,18 +601,18 @@ public:
|
|||
@param width Requested width for the window
|
||||
@param height Requested height for the window
|
||||
**/
|
||||
void moveResizeWindowRequest(Window window, int flags, int x, int y, int width, int height );
|
||||
void moveResizeWindowRequest(xcb_window_t window, int flags, int x, int y, int width, int height );
|
||||
|
||||
/**
|
||||
Sends the _NET_RESTACK_WINDOW request.
|
||||
**/
|
||||
void restackRequest(Window window, RequestSource source, Window above, int detail, Time timestamp);
|
||||
void restackRequest(xcb_window_t window, RequestSource source, xcb_window_t above, int detail, xcb_timestamp_t timestamp);
|
||||
|
||||
/**
|
||||
Sends a ping with the given timestamp to the window, using
|
||||
the _NET_WM_PING protocol.
|
||||
*/
|
||||
void sendPing( Window window, Time timestamp );
|
||||
void sendPing( xcb_window_t window, xcb_timestamp_t timestamp );
|
||||
|
||||
/**
|
||||
Sends a take activity message with the given timestamp to the window, using
|
||||
|
@ -620,7 +621,7 @@ public:
|
|||
@param timestamp timestamp of the message
|
||||
@param flags arbitrary flags
|
||||
*/
|
||||
void takeActivity( Window window, Time timestamp, long flags );
|
||||
void takeActivity( xcb_window_t window, xcb_timestamp_t timestamp, long flags );
|
||||
|
||||
/**
|
||||
This function takes the passed XEvent and returns an OR'ed list of
|
||||
|
@ -659,7 +660,7 @@ protected:
|
|||
|
||||
@param window the id of the window to add
|
||||
**/
|
||||
virtual void addClient(Window window) { Q_UNUSED(window); }
|
||||
virtual void addClient(xcb_window_t window) { Q_UNUSED(window); }
|
||||
|
||||
/**
|
||||
A Client should subclass NETRootInfo and reimplement this function when
|
||||
|
@ -667,7 +668,7 @@ protected:
|
|||
|
||||
@param window the id of the window to remove
|
||||
**/
|
||||
virtual void removeClient(Window window) { Q_UNUSED(window); }
|
||||
virtual void removeClient(xcb_window_t window) { Q_UNUSED(window); }
|
||||
|
||||
/**
|
||||
A Window Manager should subclass NETRootInfo and reimplement this function
|
||||
|
@ -715,7 +716,7 @@ protected:
|
|||
|
||||
@param window the id of the window to close
|
||||
**/
|
||||
virtual void closeWindow(Window window) { Q_UNUSED(window); }
|
||||
virtual void closeWindow(xcb_window_t window) { Q_UNUSED(window); }
|
||||
|
||||
/**
|
||||
A Window Manager should subclass NETRootInfo and reimplement this function
|
||||
|
@ -730,7 +731,7 @@ protected:
|
|||
@param direction One of NET::Direction (see base class documentation for
|
||||
a description of the different directions).
|
||||
**/
|
||||
virtual void moveResize(Window window, int x_root, int y_root,
|
||||
virtual void moveResize(xcb_window_t window, int x_root, int y_root,
|
||||
unsigned long direction) { Q_UNUSED(window); Q_UNUSED(x_root); Q_UNUSED(y_root); Q_UNUSED(direction); }
|
||||
|
||||
/**
|
||||
|
@ -739,7 +740,7 @@ protected:
|
|||
@param window the window from which the reply came
|
||||
@param timestamp timestamp of the ping
|
||||
*/
|
||||
virtual void gotPing( Window window, Time timestamp ) { Q_UNUSED(window); Q_UNUSED(timestamp); }
|
||||
virtual void gotPing( xcb_window_t window, xcb_timestamp_t timestamp ) { Q_UNUSED(window); Q_UNUSED(timestamp); }
|
||||
/**
|
||||
A Window Manager should subclass NETRootInfo and reimplement this function
|
||||
when it wants to know when a Client made a request to change the active
|
||||
|
@ -750,8 +751,8 @@ protected:
|
|||
@param timestamp the timestamp of the user action causing this request
|
||||
@param active_window active window of the requesting application, if any
|
||||
**/
|
||||
virtual void changeActiveWindow(Window window,NET::RequestSource src,
|
||||
Time timestamp, Window active_window ) { Q_UNUSED(window); Q_UNUSED(src); Q_UNUSED(timestamp); Q_UNUSED(active_window);}
|
||||
virtual void changeActiveWindow(xcb_window_t window,NET::RequestSource src,
|
||||
xcb_timestamp_t timestamp, xcb_window_t active_window ) { Q_UNUSED(window); Q_UNUSED(src); Q_UNUSED(timestamp); Q_UNUSED(active_window);}
|
||||
|
||||
/**
|
||||
A Window Manager should subclass NETRootInfo and reimplement this function
|
||||
|
@ -765,7 +766,7 @@ protected:
|
|||
@param width Requested width for the window
|
||||
@param height Requested height for the window
|
||||
**/
|
||||
virtual void moveResizeWindow(Window window, int flags, int x, int y, int width, int height) { Q_UNUSED(window); Q_UNUSED(flags); Q_UNUSED(x); Q_UNUSED(y); Q_UNUSED(width); Q_UNUSED(height); }
|
||||
virtual void moveResizeWindow(xcb_window_t window, int flags, int x, int y, int width, int height) { Q_UNUSED(window); Q_UNUSED(flags); Q_UNUSED(x); Q_UNUSED(y); Q_UNUSED(width); Q_UNUSED(height); }
|
||||
|
||||
/**
|
||||
A Window Manager should subclass NETRootInfo and reimplement this function
|
||||
|
@ -778,8 +779,8 @@ protected:
|
|||
@param detail restack detail
|
||||
@param timestamp the timestamp of the request
|
||||
**/
|
||||
virtual void restackWindow(Window window, RequestSource source,
|
||||
Window above, int detail, Time timestamp) { Q_UNUSED(window); Q_UNUSED(source); Q_UNUSED(above); Q_UNUSED(detail); Q_UNUSED(timestamp); }
|
||||
virtual void restackWindow(xcb_window_t window, RequestSource source,
|
||||
xcb_window_t above, int detail, xcb_timestamp_t timestamp) { Q_UNUSED(window); Q_UNUSED(source); Q_UNUSED(above); Q_UNUSED(detail); Q_UNUSED(timestamp); }
|
||||
/**
|
||||
A Window Manager should subclass NETRootInfo and reimplement this function
|
||||
when it wants to receive replies to the _NET_WM_TAKE_ACTIVITY protocol.
|
||||
|
@ -787,7 +788,7 @@ protected:
|
|||
@param timestamp timestamp of the ping
|
||||
@param flags flags passed in the original message
|
||||
*/
|
||||
virtual void gotTakeActivity(Window window, Time timestamp, long flags ) { Q_UNUSED(window); Q_UNUSED(timestamp); Q_UNUSED(flags); }
|
||||
virtual void gotTakeActivity(xcb_window_t window, xcb_timestamp_t timestamp, long flags ) { Q_UNUSED(window); Q_UNUSED(timestamp); Q_UNUSED(flags); }
|
||||
|
||||
/**
|
||||
A Window Manager should subclass NETRootInfo and reimplement this function
|
||||
|
@ -851,7 +852,7 @@ public:
|
|||
@param role Select the application role. If this argument is omitted,
|
||||
the role will default to Client.
|
||||
**/
|
||||
NETWinInfo(Display *display, Window window, Window rootWindow,
|
||||
NETWinInfo(Display *display, xcb_window_t window, xcb_window_t rootWindow,
|
||||
const unsigned long properties[], int properties_size,
|
||||
Role role = Client);
|
||||
|
||||
|
@ -861,8 +862,8 @@ public:
|
|||
is equivalent to the first element of the properties array
|
||||
in the above constructor.
|
||||
**/
|
||||
NETWinInfo(Display *display, Window window,
|
||||
Window rootWindow, unsigned long properties,
|
||||
NETWinInfo(Display *display, xcb_window_t window,
|
||||
xcb_window_t rootWindow, unsigned long properties,
|
||||
Role role = Client);
|
||||
|
||||
/**
|
||||
|
@ -1193,12 +1194,12 @@ public:
|
|||
* user action, it won't be activated after being shown, with the special
|
||||
* value 0 meaning not to activate the window after being shown.
|
||||
*/
|
||||
void setUserTime( Time time );
|
||||
void setUserTime( xcb_timestamp_t time );
|
||||
|
||||
/**
|
||||
* Returns the time of last user action on the window, or -1 if not set.
|
||||
*/
|
||||
Time userTime() const;
|
||||
xcb_timestamp_t userTime() const;
|
||||
|
||||
/**
|
||||
* Sets the startup notification id @p id on the window.
|
||||
|
@ -1234,12 +1235,12 @@ public:
|
|||
* Returns the WM_TRANSIENT_FOR property for the window, i.e. the mainwindow
|
||||
* for this window.
|
||||
*/
|
||||
Window transientFor() const;
|
||||
xcb_window_t transientFor() const;
|
||||
|
||||
/**
|
||||
* Returns the leader window for the group the window is in, if any.
|
||||
*/
|
||||
Window groupLeader() const;
|
||||
xcb_window_t groupLeader() const;
|
||||
|
||||
/**
|
||||
* Returns the class component of the window class for the window
|
||||
|
|
|
@ -86,8 +86,8 @@ struct NETRootInfoPrivate {
|
|||
// information about the X server
|
||||
Display *display;
|
||||
NETSize rootSize;
|
||||
Window root;
|
||||
Window supportwindow;
|
||||
xcb_window_t root;
|
||||
xcb_window_t supportwindow;
|
||||
const char *name;
|
||||
int screen;
|
||||
|
||||
|
@ -96,8 +96,8 @@ struct NETRootInfoPrivate {
|
|||
NETRArray<NETPoint> viewport;
|
||||
NETRArray<NETRect> workarea;
|
||||
NETSize geometry;
|
||||
Window active;
|
||||
Window *clients, *stacking, *virtual_roots;
|
||||
xcb_window_t active;
|
||||
xcb_window_t *clients, *stacking, *virtual_roots;
|
||||
NETRArray<const char *> desktop_names;
|
||||
int number_of_desktops;
|
||||
int current_desktop;
|
||||
|
@ -124,7 +124,7 @@ struct NETWinInfoPrivate {
|
|||
NET::Role role;
|
||||
|
||||
Display *display;
|
||||
Window window, root;
|
||||
xcb_window_t window, root;
|
||||
NET::MappingState mapping_state;
|
||||
Bool mapping_state_dirty;
|
||||
|
||||
|
@ -146,7 +146,7 @@ struct NETWinInfoPrivate {
|
|||
Time user_time;
|
||||
char* startup_id;
|
||||
unsigned long opacity;
|
||||
Window transient_for, window_group;
|
||||
xcb_window_t transient_for, window_group;
|
||||
unsigned long allowed_actions;
|
||||
char* class_class, *class_name, *window_role, *client_machine;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue