]>
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
)
95 wxSize size
= wxGetDisplaySize();
97 p
.x
<= size
.GetWidth() &&
99 p
.y
<= size
.GetHeight())
108 wxDisplay::wxDisplay(size_t index
) : wxDisplayBase ( index
), m_priv( new wxDisplayUnixPriv
)
110 Display
*disp
= (Display
*)wxGetDisplay();
112 if ( XineramaIsActive(disp
) )
114 XineramaScreenInfo
*screenarr
;
116 screenarr
= XineramaQueryScreens(disp
, &numscreens
);
117 m_priv
->m_rect
= wxRect(screenarr
[index
].x_org
, screenarr
[index
].y_org
,
118 screenarr
[index
].width
, screenarr
[index
].height
);
119 m_priv
->m_depth
= DefaultDepth(disp
, DefaultScreen(disp
));
124 wxSize size
= wxGetDisplaySize();
125 m_priv
->m_rect
= wxRect(0, 0, size
.GetWidth(), size
.GetHeight());
126 m_priv
->m_depth
= wxDisplayDepth();
130 wxDisplay::~wxDisplay()
135 wxRect
wxDisplay::GetGeometry() const
137 return m_priv
->m_rect
;
140 int wxDisplay::GetDepth() const
142 return m_priv
->m_depth
;
145 wxString
wxDisplay::GetName() const
147 return wxEmptyString
;
150 #endif /* wxUSE_DISPLAY */