Use NETWinInfo::opaqueRegion
REVIEW: 122199
This commit is contained in:
parent
82938dd96b
commit
cef84cd8a5
7 changed files with 16 additions and 38 deletions
|
@ -50,7 +50,6 @@ Atoms::Atoms()
|
|||
, net_wm_sync_request_counter(QByteArrayLiteral("_NET_WM_SYNC_REQUEST_COUNTER"))
|
||||
, net_wm_sync_request(QByteArrayLiteral("_NET_WM_SYNC_REQUEST"))
|
||||
, kde_net_wm_shadow(QByteArrayLiteral("_KDE_NET_WM_SHADOW"))
|
||||
, net_wm_opaque_region(QByteArrayLiteral("_NET_WM_OPAQUE_REGION"))
|
||||
, kde_net_wm_tab_group(QByteArrayLiteral("_KDE_NET_WM_TAB_GROUP"))
|
||||
, kde_first_in_window_list(QByteArrayLiteral("_KDE_FIRST_IN_WINDOWLIST"))
|
||||
, kde_color_sheme(QByteArrayLiteral("_KDE_NET_WM_COLOR_SCHEME"))
|
||||
|
|
1
atoms.h
1
atoms.h
|
@ -59,7 +59,6 @@ public:
|
|||
Xcb::Atom net_wm_sync_request_counter;
|
||||
Xcb::Atom net_wm_sync_request;
|
||||
Xcb::Atom kde_net_wm_shadow;
|
||||
Xcb::Atom net_wm_opaque_region;
|
||||
Xcb::Atom kde_net_wm_tab_group;
|
||||
Xcb::Atom kde_first_in_window_list;
|
||||
Xcb::Atom kde_color_sheme;
|
||||
|
|
|
@ -638,6 +638,9 @@ bool Client::windowEvent(xcb_generic_event_t *e)
|
|||
if (dirtyProperties2.testFlag(NET::WM2Urgency)) {
|
||||
updateUrgency();
|
||||
}
|
||||
if (dirtyProperties2 & NET::WM2OpaqueRegion) {
|
||||
getWmOpaqueRegion();
|
||||
}
|
||||
}
|
||||
|
||||
const uint8_t eventType = e->response_type & ~0x80;
|
||||
|
@ -1587,6 +1590,9 @@ bool Unmanaged::windowEvent(xcb_generic_event_t *e)
|
|||
emit opacityChanged(this, old_opacity);
|
||||
}
|
||||
}
|
||||
if (dirtyProperties2 & NET::WM2OpaqueRegion) {
|
||||
getWmOpaqueRegion();
|
||||
}
|
||||
if (dirtyProperties2.testFlag(NET::WM2WindowRole)) {
|
||||
emit windowRoleChanged();
|
||||
}
|
||||
|
@ -1671,8 +1677,6 @@ void Toplevel::propertyNotifyEvent(xcb_property_notify_event_t *e)
|
|||
getWmClientLeader();
|
||||
else if (e->atom == atoms->kde_net_wm_shadow)
|
||||
getShadow();
|
||||
else if (e->atom == atoms->net_wm_opaque_region)
|
||||
getWmOpaqueRegion();
|
||||
else if (e->atom == atoms->kde_skip_close_animation)
|
||||
getSkipCloseAnimation();
|
||||
break;
|
||||
|
|
|
@ -96,7 +96,8 @@ bool Client::manage(xcb_window_t w, bool isMapped)
|
|||
NET::WM2Input |
|
||||
NET::WM2Protocols |
|
||||
NET::WM2InitialMappingState |
|
||||
NET::WM2IconPixmap;
|
||||
NET::WM2IconPixmap |
|
||||
NET::WM2OpaqueRegion;
|
||||
|
||||
auto wmClientLeaderCookie = fetchWmClientLeader();
|
||||
auto skipCloseAnimationCookie = fetchSkipCloseAnimation();
|
||||
|
|
|
@ -106,7 +106,8 @@ RootInfo *RootInfo::create()
|
|||
NET::WM2DesktopLayout |
|
||||
NET::WM2FullPlacement |
|
||||
NET::WM2FullscreenMonitors |
|
||||
NET::WM2KDEShadow;
|
||||
NET::WM2KDEShadow |
|
||||
NET::WM2OpaqueRegion;
|
||||
#ifdef KWIN_BUILD_ACTIVITIES
|
||||
properties2 |= NET::WM2Activities;
|
||||
#endif
|
||||
|
|
35
toplevel.cpp
35
toplevel.cpp
|
@ -364,38 +364,11 @@ bool Toplevel::wantsShadowToBeRendered() const
|
|||
|
||||
void Toplevel::getWmOpaqueRegion()
|
||||
{
|
||||
const int length=32768;
|
||||
unsigned long bytes_after_return=0;
|
||||
const auto rects = info->opaqueRegion();
|
||||
QRegion new_opaque_region;
|
||||
do {
|
||||
unsigned long* data;
|
||||
Atom type;
|
||||
int rformat;
|
||||
unsigned long nitems;
|
||||
if (XGetWindowProperty(display(), m_client,
|
||||
atoms->net_wm_opaque_region, 0, length, false, XCB_ATOM_CARDINAL,
|
||||
&type, &rformat, &nitems, &bytes_after_return,
|
||||
reinterpret_cast< unsigned char** >(&data)) == Success) {
|
||||
if (type != XCB_ATOM_CARDINAL || rformat != 32 || nitems%4) {
|
||||
// it can happen, that the window does not provide this property
|
||||
XFree(data);
|
||||
break;
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < nitems;) {
|
||||
const int x = data[i++];
|
||||
const int y = data[i++];
|
||||
const int w = data[i++];
|
||||
const int h = data[i++];
|
||||
|
||||
new_opaque_region += QRect(x,y,w,h);
|
||||
}
|
||||
XFree(data);
|
||||
} else {
|
||||
qCWarning(KWIN_CORE) << "XGetWindowProperty failed";
|
||||
break;
|
||||
}
|
||||
} while (bytes_after_return > 0);
|
||||
for (const auto &r : rects) {
|
||||
new_opaque_region += QRect(r.pos.x, r.pos.y, r.size.width, r.size.height);
|
||||
}
|
||||
|
||||
opaque_region = new_opaque_region;
|
||||
}
|
||||
|
|
|
@ -71,7 +71,8 @@ bool Unmanaged::track(Window w)
|
|||
NET::WMWindowType | NET::WMPid,
|
||||
NET::WM2Opacity |
|
||||
NET::WM2WindowRole |
|
||||
NET::WM2WindowClass);
|
||||
NET::WM2WindowClass |
|
||||
NET::WM2OpaqueRegion);
|
||||
getResourceClass();
|
||||
getWmClientLeader();
|
||||
getWmClientMachine();
|
||||
|
|
Loading…
Reference in a new issue