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:
@@ -67,6 +67,13 @@ public:
|
|||||||
wxX11Display() { m_dpy = XOpenDisplay(NULL); }
|
wxX11Display() { m_dpy = XOpenDisplay(NULL); }
|
||||||
~wxX11Display() { if ( m_dpy ) XCloseDisplay(m_dpy); }
|
~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; }
|
operator Display *() const { return m_dpy; }
|
||||||
|
|
||||||
// Using DefaultRootWindow() with an object of wxX11Display class doesn't
|
// Using DefaultRootWindow() with an object of wxX11Display class doesn't
|
||||||
|
Reference in New Issue
Block a user