Use an Xcb::Window for Client::wrapper
The Xcb::Window nicely encapsulates the created wrapper window. As almost all code is adjusted, the variable is also renamed to m_wrapper to follow the normal naming scheme.
This commit is contained in:
parent
8b2a5f9936
commit
424589ab4a
4 changed files with 22 additions and 23 deletions
24
client.cpp
24
client.cpp
|
@ -90,7 +90,7 @@ bool Client::s_haveResizeEffect = false;
|
||||||
Client::Client()
|
Client::Client()
|
||||||
: Toplevel()
|
: Toplevel()
|
||||||
, client(None)
|
, client(None)
|
||||||
, wrapper(None)
|
, m_wrapper()
|
||||||
, decoration(NULL)
|
, decoration(NULL)
|
||||||
, bridge(new Bridge(this))
|
, bridge(new Bridge(this))
|
||||||
, m_activityUpdatesBlocked(false)
|
, m_activityUpdatesBlocked(false)
|
||||||
|
@ -233,7 +233,7 @@ Client::~Client()
|
||||||
#endif
|
#endif
|
||||||
assert(!moveResizeMode);
|
assert(!moveResizeMode);
|
||||||
assert(client == None);
|
assert(client == None);
|
||||||
assert(wrapper == None);
|
assert(m_wrapper == XCB_WINDOW_NONE);
|
||||||
//assert( frameId() == None );
|
//assert( frameId() == None );
|
||||||
assert(decoration == NULL);
|
assert(decoration == NULL);
|
||||||
assert(block_geometry_updates == 0);
|
assert(block_geometry_updates == 0);
|
||||||
|
@ -303,8 +303,7 @@ void Client::releaseWindow(bool on_shutdown)
|
||||||
// may do map+unmap before we initially map the window by calling rawShow() from manage().
|
// may do map+unmap before we initially map the window by calling rawShow() from manage().
|
||||||
XUnmapWindow(display(), client);
|
XUnmapWindow(display(), client);
|
||||||
client = None;
|
client = None;
|
||||||
XDestroyWindow(display(), wrapper);
|
m_wrapper.reset();
|
||||||
wrapper = None;
|
|
||||||
XDestroyWindow(display(), frameId());
|
XDestroyWindow(display(), frameId());
|
||||||
//frame = None;
|
//frame = None;
|
||||||
--block_geometry_updates; // Don't use GeometryUpdatesBlocker, it would now set the geometry
|
--block_geometry_updates; // Don't use GeometryUpdatesBlocker, it would now set the geometry
|
||||||
|
@ -345,8 +344,7 @@ void Client::destroyClient()
|
||||||
cleanGrouping();
|
cleanGrouping();
|
||||||
workspace()->removeClient(this);
|
workspace()->removeClient(this);
|
||||||
client = None; // invalidate
|
client = None; // invalidate
|
||||||
XDestroyWindow(display(), wrapper);
|
m_wrapper.reset();
|
||||||
wrapper = None;
|
|
||||||
XDestroyWindow(display(), frameId());
|
XDestroyWindow(display(), frameId());
|
||||||
//frame = None;
|
//frame = None;
|
||||||
--block_geometry_updates; // Don't use GeometryUpdatesBlocker, it would now set the geometry
|
--block_geometry_updates; // Don't use GeometryUpdatesBlocker, it would now set the geometry
|
||||||
|
@ -981,10 +979,10 @@ void Client::setShade(ShadeMode mode)
|
||||||
shade_geometry_change = true;
|
shade_geometry_change = true;
|
||||||
QSize s(sizeForClientSize(QSize(clientSize())));
|
QSize s(sizeForClientSize(QSize(clientSize())));
|
||||||
s.setHeight(border_top + border_bottom);
|
s.setHeight(border_top + border_bottom);
|
||||||
XSelectInput(display(), wrapper, ClientWinMask); // Avoid getting UnmapNotify
|
XSelectInput(display(), m_wrapper, ClientWinMask); // Avoid getting UnmapNotify
|
||||||
XUnmapWindow(display(), wrapper);
|
m_wrapper.unmap();
|
||||||
XUnmapWindow(display(), client);
|
XUnmapWindow(display(), client);
|
||||||
XSelectInput(display(), wrapper, ClientWinMask | SubstructureNotifyMask);
|
XSelectInput(display(), m_wrapper, ClientWinMask | SubstructureNotifyMask);
|
||||||
exportMappingState(IconicState);
|
exportMappingState(IconicState);
|
||||||
plainResize(s);
|
plainResize(s);
|
||||||
shade_geometry_change = false;
|
shade_geometry_change = false;
|
||||||
|
@ -1208,7 +1206,7 @@ void Client::map()
|
||||||
decoration->widget()->show(); // Not really necessary, but let it know the state
|
decoration->widget()->show(); // Not really necessary, but let it know the state
|
||||||
XMapWindow(display(), frameId());
|
XMapWindow(display(), frameId());
|
||||||
if (!isShade()) {
|
if (!isShade()) {
|
||||||
XMapWindow(display(), wrapper);
|
m_wrapper.map();
|
||||||
XMapWindow(display(), client);
|
XMapWindow(display(), client);
|
||||||
m_decoInputExtent.map();
|
m_decoInputExtent.map();
|
||||||
exportMappingState(NormalState);
|
exportMappingState(NormalState);
|
||||||
|
@ -1227,12 +1225,12 @@ void Client::unmap()
|
||||||
// which won't be missed, so this shouldn't be a problem. The chance the real UnmapNotify
|
// which won't be missed, so this shouldn't be a problem. The chance the real UnmapNotify
|
||||||
// will be missed is also very minimal, so I don't think it's needed to grab the server
|
// will be missed is also very minimal, so I don't think it's needed to grab the server
|
||||||
// here.
|
// here.
|
||||||
XSelectInput(display(), wrapper, ClientWinMask); // Avoid getting UnmapNotify
|
XSelectInput(display(), m_wrapper, ClientWinMask); // Avoid getting UnmapNotify
|
||||||
XUnmapWindow(display(), frameId());
|
XUnmapWindow(display(), frameId());
|
||||||
XUnmapWindow(display(), wrapper);
|
m_wrapper.unmap();
|
||||||
XUnmapWindow(display(), client);
|
XUnmapWindow(display(), client);
|
||||||
m_decoInputExtent.unmap();
|
m_decoInputExtent.unmap();
|
||||||
XSelectInput(display(), wrapper, ClientWinMask | SubstructureNotifyMask);
|
XSelectInput(display(), m_wrapper, ClientWinMask | SubstructureNotifyMask);
|
||||||
if (decoration != NULL)
|
if (decoration != NULL)
|
||||||
decoration->widget()->hide(); // Not really necessary, but let it know the state
|
decoration->widget()->hide(); // Not really necessary, but let it know the state
|
||||||
exportMappingState(IconicState);
|
exportMappingState(IconicState);
|
||||||
|
|
8
client.h
8
client.h
|
@ -270,7 +270,7 @@ class Client
|
||||||
Q_PROPERTY(bool decorationHasAlpha READ decorationHasAlpha)
|
Q_PROPERTY(bool decorationHasAlpha READ decorationHasAlpha)
|
||||||
public:
|
public:
|
||||||
explicit Client();
|
explicit Client();
|
||||||
Window wrapperId() const;
|
xcb_window_t wrapperId() const;
|
||||||
Window decorationId() const;
|
Window decorationId() const;
|
||||||
xcb_window_t inputId() const { return m_decoInputExtent; }
|
xcb_window_t inputId() const { return m_decoInputExtent; }
|
||||||
|
|
||||||
|
@ -833,7 +833,7 @@ private:
|
||||||
bool tabTo(Client *other, bool behind, bool activate);
|
bool tabTo(Client *other, bool behind, bool activate);
|
||||||
|
|
||||||
Window client;
|
Window client;
|
||||||
Window wrapper;
|
Xcb::Window m_wrapper;
|
||||||
KDecoration* decoration;
|
KDecoration* decoration;
|
||||||
Bridge* bridge;
|
Bridge* bridge;
|
||||||
int desk;
|
int desk;
|
||||||
|
@ -1011,9 +1011,9 @@ private:
|
||||||
Client* cl;
|
Client* cl;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline Window Client::wrapperId() const
|
inline xcb_window_t Client::wrapperId() const
|
||||||
{
|
{
|
||||||
return wrapper;
|
return m_wrapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline Window Client::decorationId() const
|
inline Window Client::decorationId() const
|
||||||
|
|
|
@ -591,7 +591,7 @@ void Client::unmapNotifyEvent(XUnmapEvent* e)
|
||||||
// but just destroy the client
|
// but just destroy the client
|
||||||
Xcb::Tree tree(client);
|
Xcb::Tree tree(client);
|
||||||
xcb_window_t daddy = tree.parent();
|
xcb_window_t daddy = tree.parent();
|
||||||
if (daddy == wrapper) {
|
if (daddy == m_wrapper) {
|
||||||
releaseWindow(); // unmapped from a regular client state
|
releaseWindow(); // unmapped from a regular client state
|
||||||
} else {
|
} else {
|
||||||
destroyClient(); // the client was moved to some other parent
|
destroyClient(); // the client was moved to some other parent
|
||||||
|
|
11
manage.cpp
11
manage.cpp
|
@ -630,7 +630,7 @@ void Client::embedClient(Window w, const XWindowAttributes& attr)
|
||||||
{
|
{
|
||||||
assert(client == None);
|
assert(client == None);
|
||||||
assert(frameId() == None);
|
assert(frameId() == None);
|
||||||
assert(wrapper == None);
|
assert(m_wrapper == XCB_WINDOW_NONE);
|
||||||
client = w;
|
client = w;
|
||||||
|
|
||||||
const xcb_visualid_t visualid = XVisualIDFromVisual(attr.visual);
|
const xcb_visualid_t visualid = XVisualIDFromVisual(attr.visual);
|
||||||
|
@ -681,17 +681,18 @@ void Client::embedClient(Window w, const XWindowAttributes& attr)
|
||||||
setWindowHandles(client, frame);
|
setWindowHandles(client, frame);
|
||||||
|
|
||||||
// Create the wrapper window
|
// Create the wrapper window
|
||||||
wrapper = xcb_generate_id(conn);
|
xcb_window_t wrapperId = xcb_generate_id(conn);
|
||||||
xcb_create_window(conn, attr.depth, wrapper, frame, 0, 0, 1, 1, 0,
|
xcb_create_window(conn, attr.depth, wrapperId, frame, 0, 0, 1, 1, 0,
|
||||||
XCB_WINDOW_CLASS_INPUT_OUTPUT, visualid, cw_mask, cw_values);
|
XCB_WINDOW_CLASS_INPUT_OUTPUT, visualid, cw_mask, cw_values);
|
||||||
|
m_wrapper.reset(wrapperId);
|
||||||
|
|
||||||
xcb_reparent_window(conn, client, wrapper, 0, 0);
|
xcb_reparent_window(conn, client, m_wrapper, 0, 0);
|
||||||
|
|
||||||
// We could specify the event masks when we create the windows, but the original
|
// We could specify the event masks when we create the windows, but the original
|
||||||
// Xlib code didn't. Let's preserve that behavior here for now so we don't end up
|
// Xlib code didn't. Let's preserve that behavior here for now so we don't end up
|
||||||
// receiving any unexpected events from the wrapper creation or the reparenting.
|
// receiving any unexpected events from the wrapper creation or the reparenting.
|
||||||
xcb_change_window_attributes(conn, frame, XCB_CW_EVENT_MASK, &frame_event_mask);
|
xcb_change_window_attributes(conn, frame, XCB_CW_EVENT_MASK, &frame_event_mask);
|
||||||
xcb_change_window_attributes(conn, wrapper, XCB_CW_EVENT_MASK, &wrapper_event_mask);
|
xcb_change_window_attributes(conn, m_wrapper, XCB_CW_EVENT_MASK, &wrapper_event_mask);
|
||||||
xcb_change_window_attributes(conn, client, XCB_CW_EVENT_MASK, &client_event_mask);
|
xcb_change_window_attributes(conn, client, XCB_CW_EVENT_MASK, &client_event_mask);
|
||||||
|
|
||||||
updateMouseGrab();
|
updateMouseGrab();
|
||||||
|
|
Loading…
Reference in a new issue