Extract X11 Display wrapper class in a private header.
No real changes, just extract a private Dpy class used by wxGTK to a header and rename it to wxX11Display. This will allow reusing it from X11 wxUIActionSimulator implementation in the upcoming commits. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65380 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1,11 +1,12 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: wx/unix/utilsx11.h
|
// Name: wx/unix/utilsx11.h
|
||||||
// Purpose: Miscellaneous X11 functions
|
// Purpose: Miscellaneous X11 functions
|
||||||
// Author: Mattia Barbon, Vaclav Slavik
|
// Author: Mattia Barbon, Vaclav Slavik, Vadim Zeitlin
|
||||||
// Modified by:
|
// Modified by:
|
||||||
// Created: 25.03.02
|
// Created: 25.03.02
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) wxWidgets team
|
// Copyright: (c) wxWidgets team
|
||||||
|
// (c) 2010 Vadim Zeitlin
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@@ -15,6 +16,8 @@
|
|||||||
#include "wx/defs.h"
|
#include "wx/defs.h"
|
||||||
#include "wx/gdicmn.h"
|
#include "wx/gdicmn.h"
|
||||||
|
|
||||||
|
#include <X11/Xlib.h>
|
||||||
|
|
||||||
// NB: Content of this header is for wxWidgets' private use! It is not
|
// NB: Content of this header is for wxWidgets' private use! It is not
|
||||||
// part of public API and may be modified or even disappear in the future!
|
// part of public API and may be modified or even disappear in the future!
|
||||||
|
|
||||||
@@ -46,8 +49,27 @@ void wxSetFullScreenStateX11(WXDisplay* display, WXWindow rootWindow,
|
|||||||
WXWindow window, bool show, wxRect *origSize,
|
WXWindow window, bool show, wxRect *origSize,
|
||||||
wxX11FullScreenMethod method);
|
wxX11FullScreenMethod method);
|
||||||
|
|
||||||
#endif
|
|
||||||
// __WXMOTIF__, __WXGTK__, __WXX11__
|
|
||||||
|
|
||||||
#endif
|
// Class wrapping X11 Display: it opens it in ctor and closes it in dtor.
|
||||||
// _WX_UNIX_UTILSX11_H_
|
class wxX11Display
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxX11Display() { m_dpy = XOpenDisplay(NULL); }
|
||||||
|
~wxX11Display() { if ( m_dpy ) XCloseDisplay(m_dpy); }
|
||||||
|
|
||||||
|
operator Display *() const { return m_dpy; }
|
||||||
|
|
||||||
|
// Using DefaultRootWindow() with an object of wxX11Display class doesn't
|
||||||
|
// compile because it is a macro which tries to cast wxX11Display so
|
||||||
|
// provide a convenient helper.
|
||||||
|
Window DefaultRoot() const { return DefaultRootWindow(m_dpy); }
|
||||||
|
|
||||||
|
private:
|
||||||
|
Display *m_dpy;
|
||||||
|
|
||||||
|
wxDECLARE_NO_COPY_CLASS(wxX11Display);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // __WXMOTIF__, __WXGTK__, __WXX11__
|
||||||
|
|
||||||
|
#endif // _WX_UNIX_UTILSX11_H_
|
||||||
|
@@ -48,6 +48,8 @@
|
|||||||
#if wxUSE_DETECT_SM
|
#if wxUSE_DETECT_SM
|
||||||
#include "X11/Xlib.h"
|
#include "X11/Xlib.h"
|
||||||
#include "X11/SM/SMlib.h"
|
#include "X11/SM/SMlib.h"
|
||||||
|
|
||||||
|
#include "wx/unix/utilsx11.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -242,17 +244,7 @@ wxTimerImpl *wxGUIAppTraits::CreateTimerImpl(wxTimer *timer)
|
|||||||
#if wxUSE_DETECT_SM
|
#if wxUSE_DETECT_SM
|
||||||
static wxString GetSM()
|
static wxString GetSM()
|
||||||
{
|
{
|
||||||
class Dpy
|
wxX11Display dpy;
|
||||||
{
|
|
||||||
public:
|
|
||||||
Dpy() { m_dpy = XOpenDisplay(NULL); }
|
|
||||||
~Dpy() { if ( m_dpy ) XCloseDisplay(m_dpy); }
|
|
||||||
|
|
||||||
operator Display *() const { return m_dpy; }
|
|
||||||
private:
|
|
||||||
Display *m_dpy;
|
|
||||||
} dpy;
|
|
||||||
|
|
||||||
if ( !dpy )
|
if ( !dpy )
|
||||||
return wxEmptyString;
|
return wxEmptyString;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user