Allow "moving" wxX11Display objects
This is not a real move-ctor but std::auto_ptr<>-like "stealing" ctor. It still allows to pass Display ownership to another function which is all that is needed for our purposes.
This commit is contained in:
parent
746b91c5d3
commit
4a0938d2b7
@ -67,6 +67,13 @@ public:
|
||||
wxX11Display() { m_dpy = XOpenDisplay(NULL); }
|
||||
~wxX11Display() { if ( m_dpy ) XCloseDisplay(m_dpy); }
|
||||
|
||||
// Pseudo move ctor: steals the open display from the other object.
|
||||
explicit wxX11Display(wxX11Display& display)
|
||||
{
|
||||
m_dpy = display.m_dpy;
|
||||
display.m_dpy = NULL;
|
||||
}
|
||||
|
||||
operator Display *() const { return m_dpy; }
|
||||
|
||||
// Using DefaultRootWindow() with an object of wxX11Display class doesn't
|
||||
|
Loading…
Reference in New Issue
Block a user