Use XCB Shape instead of XLib Shape in KWin core

This commit is contained in:
Martin Gräßlin 2013-08-20 09:48:14 +02:00
parent bf3bcd7f6f
commit e21225fa47
6 changed files with 11 additions and 16 deletions

View file

@ -246,7 +246,6 @@ set(kwin_KDE_LIBS
set(kwin_XLIB_LIBS
${X11_X11_LIB}
${X11_Xcursor_LIB}
${X11_Xext_LIB} # XShapeSelectInput
${X11_ICE_LIB}
${X11_SM_LIB}
)

View file

@ -53,7 +53,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <kkeyserver.h>
#include <X11/extensions/shape.h>
#include <X11/extensions/Xfixes.h>
#include <X11/extensions/Xrandr.h>
#include <X11/Xatom.h>

View file

@ -25,7 +25,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <kstartupinfo.h>
#include <kglobal.h>
#include <X11/extensions/shape.h>
#ifdef KWIN_BUILD_ACTIVITIES
#include "activities.h"
@ -39,6 +38,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "workspace.h"
#include "xcbutils.h"
#include <xcb/shape.h>
namespace KWin
{
@ -117,7 +118,7 @@ bool Client::manage(xcb_window_t w, bool isMapped)
setCaption(cap_normal, true);
if (Xcb::Extensions::self()->isShapeAvailable())
XShapeSelectInput(display(), window(), ShapeNotifyMask);
xcb_shape_select_input(connection(), window(), true);
detectShape(window());
detectNoBorder();
fetchIconicName();

View file

@ -68,8 +68,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "scene.h"
#include <X11/extensions/shape.h>
#include <QQuickWindow>
#include <QVector2D>
@ -594,17 +592,16 @@ const QRegion &Scene::Window::shape() const
if (!shape_valid) {
Client* c = dynamic_cast< Client* >(toplevel);
if (toplevel->shape() || (c != NULL && !c->mask().isEmpty())) {
int count, order;
XRectangle* rects = XShapeGetRectangles(display(), toplevel->frameId(),
ShapeBounding, &count, &order);
if (rects) {
auto cookie = xcb_shape_get_rectangles_unchecked(connection(), toplevel->frameId(), XCB_SHAPE_SK_BOUNDING);
ScopedCPointer<xcb_shape_get_rectangles_reply_t> reply(xcb_shape_get_rectangles_reply(connection(), cookie, nullptr));
if (!reply.isNull()) {
shape_region = QRegion();
auto *rects = xcb_shape_get_rectangles_rectangles(reply.data());
for (int i = 0;
i < count;
i < xcb_shape_get_rectangles_rectangles_length(reply.data());
++i)
shape_region += QRegion(rects[ i ].x, rects[ i ].y,
rects[ i ].width, rects[ i ].height);
XFree(rects);
// make sure the shape is sane (X is async, maybe even XShape is broken)
shape_region &= QRegion(0, 0, width(), height());
} else

View file

@ -28,7 +28,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QTimer>
#include <QDebug>
#include <X11/extensions/shape.h>
#include <xcb/shape.h>
namespace KWin
{
@ -77,7 +77,7 @@ bool Unmanaged::track(Window w)
getWmClientLeader();
getWmClientMachine();
if (Xcb::Extensions::self()->isShapeAvailable())
XShapeSelectInput(display(), w, ShapeNotifyMask);
xcb_shape_select_input(connection(), w, true);
detectShape(w);
getWmOpaqueRegion();
setupCompositing();
@ -97,7 +97,7 @@ void Unmanaged::release(bool on_shutdown)
finishCompositing();
if (!QWidget::find(window())) { // don't affect our own windows
if (Xcb::Extensions::self()->isShapeAvailable())
XShapeSelectInput(display(), window(), NoEventMask);
xcb_shape_select_input(connection(), window(), false);
Xcb::selectInput(window(), XCB_EVENT_MASK_NO_EVENT);
}
if (!on_shutdown) {

View file

@ -36,7 +36,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <kkeyserver.h>
#include <X11/Xlib.h>
#include <X11/extensions/shape.h>
#include <stdio.h>