Use XCB Shape instead of XLib Shape in KWin core
This commit is contained in:
parent
bf3bcd7f6f
commit
e21225fa47
6 changed files with 11 additions and 16 deletions
|
@ -246,7 +246,6 @@ set(kwin_KDE_LIBS
|
||||||
set(kwin_XLIB_LIBS
|
set(kwin_XLIB_LIBS
|
||||||
${X11_X11_LIB}
|
${X11_X11_LIB}
|
||||||
${X11_Xcursor_LIB}
|
${X11_Xcursor_LIB}
|
||||||
${X11_Xext_LIB} # XShapeSelectInput
|
|
||||||
${X11_ICE_LIB}
|
${X11_ICE_LIB}
|
||||||
${X11_SM_LIB}
|
${X11_SM_LIB}
|
||||||
)
|
)
|
||||||
|
|
|
@ -53,7 +53,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#include <kkeyserver.h>
|
#include <kkeyserver.h>
|
||||||
|
|
||||||
#include <X11/extensions/shape.h>
|
|
||||||
#include <X11/extensions/Xfixes.h>
|
#include <X11/extensions/Xfixes.h>
|
||||||
#include <X11/extensions/Xrandr.h>
|
#include <X11/extensions/Xrandr.h>
|
||||||
#include <X11/Xatom.h>
|
#include <X11/Xatom.h>
|
||||||
|
|
|
@ -25,7 +25,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#include <kstartupinfo.h>
|
#include <kstartupinfo.h>
|
||||||
#include <kglobal.h>
|
#include <kglobal.h>
|
||||||
#include <X11/extensions/shape.h>
|
|
||||||
|
|
||||||
#ifdef KWIN_BUILD_ACTIVITIES
|
#ifdef KWIN_BUILD_ACTIVITIES
|
||||||
#include "activities.h"
|
#include "activities.h"
|
||||||
|
@ -39,6 +38,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include "workspace.h"
|
#include "workspace.h"
|
||||||
#include "xcbutils.h"
|
#include "xcbutils.h"
|
||||||
|
|
||||||
|
#include <xcb/shape.h>
|
||||||
|
|
||||||
namespace KWin
|
namespace KWin
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -117,7 +118,7 @@ bool Client::manage(xcb_window_t w, bool isMapped)
|
||||||
setCaption(cap_normal, true);
|
setCaption(cap_normal, true);
|
||||||
|
|
||||||
if (Xcb::Extensions::self()->isShapeAvailable())
|
if (Xcb::Extensions::self()->isShapeAvailable())
|
||||||
XShapeSelectInput(display(), window(), ShapeNotifyMask);
|
xcb_shape_select_input(connection(), window(), true);
|
||||||
detectShape(window());
|
detectShape(window());
|
||||||
detectNoBorder();
|
detectNoBorder();
|
||||||
fetchIconicName();
|
fetchIconicName();
|
||||||
|
|
13
scene.cpp
13
scene.cpp
|
@ -68,8 +68,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
#include "scene.h"
|
#include "scene.h"
|
||||||
|
|
||||||
#include <X11/extensions/shape.h>
|
|
||||||
|
|
||||||
#include <QQuickWindow>
|
#include <QQuickWindow>
|
||||||
#include <QVector2D>
|
#include <QVector2D>
|
||||||
|
|
||||||
|
@ -594,17 +592,16 @@ const QRegion &Scene::Window::shape() const
|
||||||
if (!shape_valid) {
|
if (!shape_valid) {
|
||||||
Client* c = dynamic_cast< Client* >(toplevel);
|
Client* c = dynamic_cast< Client* >(toplevel);
|
||||||
if (toplevel->shape() || (c != NULL && !c->mask().isEmpty())) {
|
if (toplevel->shape() || (c != NULL && !c->mask().isEmpty())) {
|
||||||
int count, order;
|
auto cookie = xcb_shape_get_rectangles_unchecked(connection(), toplevel->frameId(), XCB_SHAPE_SK_BOUNDING);
|
||||||
XRectangle* rects = XShapeGetRectangles(display(), toplevel->frameId(),
|
ScopedCPointer<xcb_shape_get_rectangles_reply_t> reply(xcb_shape_get_rectangles_reply(connection(), cookie, nullptr));
|
||||||
ShapeBounding, &count, &order);
|
if (!reply.isNull()) {
|
||||||
if (rects) {
|
|
||||||
shape_region = QRegion();
|
shape_region = QRegion();
|
||||||
|
auto *rects = xcb_shape_get_rectangles_rectangles(reply.data());
|
||||||
for (int i = 0;
|
for (int i = 0;
|
||||||
i < count;
|
i < xcb_shape_get_rectangles_rectangles_length(reply.data());
|
||||||
++i)
|
++i)
|
||||||
shape_region += QRegion(rects[ i ].x, rects[ i ].y,
|
shape_region += QRegion(rects[ i ].x, rects[ i ].y,
|
||||||
rects[ i ].width, rects[ i ].height);
|
rects[ i ].width, rects[ i ].height);
|
||||||
XFree(rects);
|
|
||||||
// make sure the shape is sane (X is async, maybe even XShape is broken)
|
// make sure the shape is sane (X is async, maybe even XShape is broken)
|
||||||
shape_region &= QRegion(0, 0, width(), height());
|
shape_region &= QRegion(0, 0, width(), height());
|
||||||
} else
|
} else
|
||||||
|
|
|
@ -28,7 +28,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
#include <X11/extensions/shape.h>
|
#include <xcb/shape.h>
|
||||||
|
|
||||||
namespace KWin
|
namespace KWin
|
||||||
{
|
{
|
||||||
|
@ -77,7 +77,7 @@ bool Unmanaged::track(Window w)
|
||||||
getWmClientLeader();
|
getWmClientLeader();
|
||||||
getWmClientMachine();
|
getWmClientMachine();
|
||||||
if (Xcb::Extensions::self()->isShapeAvailable())
|
if (Xcb::Extensions::self()->isShapeAvailable())
|
||||||
XShapeSelectInput(display(), w, ShapeNotifyMask);
|
xcb_shape_select_input(connection(), w, true);
|
||||||
detectShape(w);
|
detectShape(w);
|
||||||
getWmOpaqueRegion();
|
getWmOpaqueRegion();
|
||||||
setupCompositing();
|
setupCompositing();
|
||||||
|
@ -97,7 +97,7 @@ void Unmanaged::release(bool on_shutdown)
|
||||||
finishCompositing();
|
finishCompositing();
|
||||||
if (!QWidget::find(window())) { // don't affect our own windows
|
if (!QWidget::find(window())) { // don't affect our own windows
|
||||||
if (Xcb::Extensions::self()->isShapeAvailable())
|
if (Xcb::Extensions::self()->isShapeAvailable())
|
||||||
XShapeSelectInput(display(), window(), NoEventMask);
|
xcb_shape_select_input(connection(), window(), false);
|
||||||
Xcb::selectInput(window(), XCB_EVENT_MASK_NO_EVENT);
|
Xcb::selectInput(window(), XCB_EVENT_MASK_NO_EVENT);
|
||||||
}
|
}
|
||||||
if (!on_shutdown) {
|
if (!on_shutdown) {
|
||||||
|
|
|
@ -36,7 +36,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include <kkeyserver.h>
|
#include <kkeyserver.h>
|
||||||
|
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <X11/extensions/shape.h>
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue