]>
git.saurik.com Git - wxWidgets.git/blob - src/unix/displayx11.cpp
1 ///////////////////////////////////////////////////////////////////////////
2 // Name: displayx11.cpp
3 // Purpose: Unix/X11 implementation of wxDisplay class
4 // Author: Brian Victor
8 // Copyright: (c) wxWindows team
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
13 #pragma implementation "display.h"
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
23 #include "wx/display.h"
26 #include "wx/dynarray.h"
27 #include "wx/gdicmn.h"
28 #include "wx/string.h"
30 #endif /* WX_PRECOMP */
34 /* These must be included after the wx files. Otherwise the Data macro in
35 * Xlibint.h conflicts with a function declaration in wx/list.h. */
38 #include <X11/Xlibint.h>
39 #include <X11/extensions/Xinerama.h>
42 class wxDisplayUnixPriv
49 size_t wxDisplayBase::GetCount()
51 Display
*disp
= (Display
*)wxGetDisplay();
53 if ( XineramaIsActive(disp
) )
55 XineramaScreenInfo
*screenarr
;
57 screenarr
= XineramaQueryScreens(disp
, &numscreens
);
67 int wxDisplayBase::GetFromPoint(const wxPoint
&p
)
69 Display
*disp
= (Display
*)wxGetDisplay();
71 if ( XineramaIsActive(disp
) )
73 int which_screen
= -1;
74 XineramaScreenInfo
*screenarr
;
76 screenarr
= XineramaQueryScreens(disp
, &numscreens
);
79 for (i
= 0; i
< numscreens
; ++i
)
81 if (p
.x
>= screenarr
[i
].x_org
&&
82 p
.x
<= screenarr
[i
].x_org
+ screenarr
[i
].width
&&
83 p
.y
>= screenarr
[i
].y_org
&&
84 p
.y
<= screenarr
[i
].y_org
+ screenarr
[i
].height
)
99 wxDisplay::wxDisplay(size_t index
) : wxDisplayBase ( index
), m_priv( new wxDisplayUnixPriv
)
101 Display
*disp
= (Display
*)wxGetDisplay();
103 if ( XineramaIsActive(disp
) )
105 XineramaScreenInfo
*screenarr
;
107 screenarr
= XineramaQueryScreens(disp
, &numscreens
);
108 m_priv
->m_rect
= wxRect(screenarr
[index
].x_org
, screenarr
[index
].y_org
,
109 screenarr
[index
].width
, screenarr
[index
].height
);
110 m_priv
->m_depth
= DefaultDepth(disp
, DefaultScreen(disp
));
115 wxSize size
= wxGetDisplaySize();
116 m_priv
->m_rect
= wxRect(0, 0, size
.GetWidth(), size
.GetHeight());
117 m_priv
->m_depth
= wxDisplayDepth();
121 wxDisplay::~wxDisplay()
126 wxRect
wxDisplay::GetGeometry() const
128 return m_priv
->m_rect
;
131 int wxDisplay::GetDepth() const
133 return m_priv
->m_depth
;
136 wxString
wxDisplay::GetName() const
141 #endif /* wxUSE_DISPLAY */