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()
|
||||
: Toplevel()
|
||||
, client(None)
|
||||
, wrapper(None)
|
||||
, m_wrapper()
|
||||
, decoration(NULL)
|
||||
, bridge(new Bridge(this))
|
||||
, m_activityUpdatesBlocked(false)
|
||||
|
@ -233,7 +233,7 @@ Client::~Client()
|
|||
#endif
|
||||
assert(!moveResizeMode);
|
||||
assert(client == None);
|
||||
assert(wrapper == None);
|
||||
assert(m_wrapper == XCB_WINDOW_NONE);
|
||||
//assert( frameId() == None );
|
||||
assert(decoration == NULL);
|
||||
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().
|
||||
XUnmapWindow(display(), client);
|
||||
client = None;
|
||||
XDestroyWindow(display(), wrapper);
|
||||
wrapper = None;
|
||||
m_wrapper.reset();
|
||||
XDestroyWindow(display(), frameId());
|
||||
//frame = None;
|
||||
--block_geometry_updates; // Don't use GeometryUpdatesBlocker, it would now set the geometry
|
||||
|
@ -345,8 +344,7 @@ void Client::destroyClient()
|
|||
cleanGrouping();
|
||||
workspace()->removeClient(this);
|
||||
client = None; // invalidate
|
||||
XDestroyWindow(display(), wrapper);
|
||||
wrapper = None;
|
||||
m_wrapper.reset();
|
||||
XDestroyWindow(display(), frameId());
|
||||
//frame = None;
|
||||
--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;
|
||||
QSize s(sizeForClientSize(QSize(clientSize())));
|
||||
s.setHeight(border_top + border_bottom);
|
||||
XSelectInput(display(), wrapper, ClientWinMask); // Avoid getting UnmapNotify
|
||||
XUnmapWindow(display(), wrapper);
|
||||
XSelectInput(display(), m_wrapper, ClientWinMask); // Avoid getting UnmapNotify
|
||||
m_wrapper.unmap();
|
||||
XUnmapWindow(display(), client);
|
||||
XSelectInput(display(), wrapper, ClientWinMask | SubstructureNotifyMask);
|
||||
XSelectInput(display(), m_wrapper, ClientWinMask | SubstructureNotifyMask);
|
||||
exportMappingState(IconicState);
|
||||
plainResize(s);
|
||||
shade_geometry_change = false;
|
||||
|
@ -1208,7 +1206,7 @@ void Client::map()
|
|||
decoration->widget()->show(); // Not really necessary, but let it know the state
|
||||
XMapWindow(display(), frameId());
|
||||
if (!isShade()) {
|
||||
XMapWindow(display(), wrapper);
|
||||
m_wrapper.map();
|
||||
XMapWindow(display(), client);
|
||||
m_decoInputExtent.map();
|
||||
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
|
||||
// will be missed is also very minimal, so I don't think it's needed to grab the server
|
||||
// here.
|
||||
XSelectInput(display(), wrapper, ClientWinMask); // Avoid getting UnmapNotify
|
||||
XSelectInput(display(), m_wrapper, ClientWinMask); // Avoid getting UnmapNotify
|
||||
XUnmapWindow(display(), frameId());
|
||||
XUnmapWindow(display(), wrapper);
|
||||
m_wrapper.unmap();
|
||||
XUnmapWindow(display(), client);
|
||||
m_decoInputExtent.unmap();
|
||||
XSelectInput(display(), wrapper, ClientWinMask | SubstructureNotifyMask);
|
||||
XSelectInput(display(), m_wrapper, ClientWinMask | SubstructureNotifyMask);
|
||||
if (decoration != NULL)
|
||||
decoration->widget()->hide(); // Not really necessary, but let it know the state
|
||||
exportMappingState(IconicState);
|
||||
|
|
8
client.h
8
client.h
|
@ -270,7 +270,7 @@ class Client
|
|||
Q_PROPERTY(bool decorationHasAlpha READ decorationHasAlpha)
|
||||
public:
|
||||
explicit Client();
|
||||
Window wrapperId() const;
|
||||
xcb_window_t wrapperId() const;
|
||||
Window decorationId() const;
|
||||
xcb_window_t inputId() const { return m_decoInputExtent; }
|
||||
|
||||
|
@ -833,7 +833,7 @@ private:
|
|||
bool tabTo(Client *other, bool behind, bool activate);
|
||||
|
||||
Window client;
|
||||
Window wrapper;
|
||||
Xcb::Window m_wrapper;
|
||||
KDecoration* decoration;
|
||||
Bridge* bridge;
|
||||
int desk;
|
||||
|
@ -1011,9 +1011,9 @@ private:
|
|||
Client* cl;
|
||||
};
|
||||
|
||||
inline Window Client::wrapperId() const
|
||||
inline xcb_window_t Client::wrapperId() const
|
||||
{
|
||||
return wrapper;
|
||||
return m_wrapper;
|
||||
}
|
||||
|
||||
inline Window Client::decorationId() const
|
||||
|
|
|
@ -591,7 +591,7 @@ void Client::unmapNotifyEvent(XUnmapEvent* e)
|
|||
// but just destroy the client
|
||||
Xcb::Tree tree(client);
|
||||
xcb_window_t daddy = tree.parent();
|
||||
if (daddy == wrapper) {
|
||||
if (daddy == m_wrapper) {
|
||||
releaseWindow(); // unmapped from a regular client state
|
||||
} else {
|
||||
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(frameId() == None);
|
||||
assert(wrapper == None);
|
||||
assert(m_wrapper == XCB_WINDOW_NONE);
|
||||
client = w;
|
||||
|
||||
const xcb_visualid_t visualid = XVisualIDFromVisual(attr.visual);
|
||||
|
@ -681,17 +681,18 @@ void Client::embedClient(Window w, const XWindowAttributes& attr)
|
|||
setWindowHandles(client, frame);
|
||||
|
||||
// Create the wrapper window
|
||||
wrapper = xcb_generate_id(conn);
|
||||
xcb_create_window(conn, attr.depth, wrapper, frame, 0, 0, 1, 1, 0,
|
||||
xcb_window_t wrapperId = xcb_generate_id(conn);
|
||||
xcb_create_window(conn, attr.depth, wrapperId, frame, 0, 0, 1, 1, 0,
|
||||
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
|
||||
// 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.
|
||||
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);
|
||||
|
||||
updateMouseGrab();
|
||||
|
|
Loading…
Reference in a new issue