kwin: Drop the xcb_icccm dependency

This dependency is causing build problems on a number of systems,
and it doesn't make much sense to bring in a whole library for three
one-line convenience functions.
icc-effect-5.14.5
Fredrik Höglund 2013-06-27 01:05:13 +02:00
parent a3d502338d
commit a87e8f5e8e
3 changed files with 21 additions and 13 deletions

View File

@ -253,7 +253,6 @@ set(kwin_XCB_LIBS
${XCB_RENDER_LIBRARIES}
${XCB_RANDR_LIBRARIES}
${XCB_KEYSYMS_LIBRARIES}
${XCB_ICCCM_LIBRARIES}
)
set(kwin_WAYLAND_LIBS

View File

@ -816,7 +816,7 @@ xcb_window_t Client::verifyTransientFor(xcb_window_t new_transient_for, bool set
new_transient_for = rootWindow();
}
if (new_property_value != m_originalTransientForId)
xcb_icccm_set_wm_transient_for(connection(), window(), new_property_value);
Xcb::setTransientFor(window(), new_property_value);
return new_transient_for;
}

View File

@ -29,11 +29,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <xcb/xcb.h>
#include <xcb/composite.h>
#define class class_name //HACK: work around a non-C++ safe problem in xcb_iccm.h
//where they put a variable called "class" in function signatures.
//Needed at least for xcb v0.3.8
#include <xcb/xcb_icccm.h>
#undef class //UNDO HACK
namespace KWin {
@ -211,10 +206,15 @@ public:
}
};
class TransientFor : public Wrapper<xcb_get_property_reply_t, xcb_get_property_cookie_t, &xcb_get_property_reply, &xcb_icccm_get_wm_transient_for_unchecked>
inline xcb_get_property_cookie_t get_transient_for(xcb_connection_t *c, xcb_window_t window)
{
return xcb_get_property_unchecked(c, 0, window, XCB_ATOM_WM_TRANSIENT_FOR, XCB_ATOM_WINDOW, 0, 1);
}
class TransientFor : public Wrapper<xcb_get_property_reply_t, xcb_get_property_cookie_t, &xcb_get_property_reply, &get_transient_for>
{
public:
explicit TransientFor(WindowId window) : Wrapper<xcb_get_property_reply_t, xcb_get_property_cookie_t, &xcb_get_property_reply, &xcb_icccm_get_wm_transient_for_unchecked>(window) {}
explicit TransientFor(WindowId window) : Wrapper<xcb_get_property_reply_t, xcb_get_property_cookie_t, &xcb_get_property_reply, &get_transient_for>(window) {}
/**
* @brief Fill given window pointer with the WM_TRANSIENT_FOR property of a window.
@ -225,10 +225,13 @@ public:
if (isNull()) {
return false;
}
if (xcb_icccm_get_wm_transient_for_from_reply(prop, const_cast<xcb_get_property_reply_t*>(data()))) {
return true;
}
return false;
const xcb_get_property_reply_t *reply = data();
if (!reply || reply->type != XCB_ATOM_WINDOW || reply->format != 32 || reply->length == 0)
return false;
*prop = *reinterpret_cast<WindowId *>(xcb_get_property_value(reply));
return true;
}
};
@ -685,6 +688,12 @@ static inline void setInputFocus(xcb_window_t window, uint8_t revertTo, xcb_time
xcb_set_input_focus(connection(), revertTo, window, time);
}
static inline void setTransientFor(xcb_window_t window, xcb_window_t transient_for_window)
{
xcb_change_property(connection(), XCB_PROP_MODE_REPLACE, window, XCB_ATOM_WM_TRANSIENT_FOR,
XCB_ATOM_WINDOW, 32, 1, &transient_for_window);
}
} // namespace X11
} // namespace KWin