// Created: 12/05/02
// RCS-ID: $Id$
// Copyright: (c) wxWidgets team
-// Licence: wxWidgets licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
- #pragma implementation "display.h"
-#endif
-
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
* Xlibint.h conflicts with a function declaration in wx/list.h. */
extern "C" {
#include <X11/Xlib.h>
+#ifndef __VMS
#include <X11/Xlibint.h>
- #include <X11/extensions/Xinerama.h>
+# include <X11/extensions/Xinerama.h>
#ifdef HAVE_X11_EXTENSIONS_XF86VMODE_H
#include <X11/extensions/xf86vmode.h>
#endif
+#endif
}
class wxDisplayUnixPriv
{
Display *disp = (Display*)wxGetDisplay();
- if ( XineramaIsActive(disp) )
+#ifndef __VMS
+ if ( XineramaIsActive(disp) )
{
XineramaScreenInfo *screenarr;
int numscreens;
return numscreens;
}
else
+#endif
{
return 1;
}
{
Display *disp = (Display*)wxGetDisplay();
- if ( XineramaIsActive(disp) )
+#ifndef __VMS
+ if ( XineramaIsActive(disp) )
{
int which_screen = -1;
XineramaScreenInfo *screenarr;
return which_screen;
}
else
- {
+#endif
+ {
wxSize size = wxGetDisplaySize();
if (p.x >= 0 &&
p.x < size.GetWidth() &&
{
Display *disp = (Display*)wxGetDisplay();
- if ( XineramaIsActive(disp) )
+#ifndef __VMS
+ if ( XineramaIsActive(disp) )
{
XineramaScreenInfo *screenarr;
int numscreens;
XFree(screenarr);
}
else
- {
+#endif
+ {
wxSize size = wxGetDisplaySize();
m_priv->m_rect = wxRect(0, 0, size.GetWidth(), size.GetHeight());
m_priv->m_depth = wxDisplayDepth();
//free private data common to x (usually s3) servers
#define wxClearXVM(vm) if(vm.privsize) XFree(vm.c_private)
-//Correct res rate from GLFW, which probably has the perfect license :)
+// Correct res rate from GLFW
#define wxCRR2(v,dc) (int) (((1000.0f * (float) dc) /*PIXELS PER SECOND */) / ((float) v.htotal * v.vtotal /*PIXELS PER FRAME*/) + 0.5f)
#define wxCRR(v) wxCRR2(v,v.dotclock)
#define wxCVM2(v, dc) wxVideoMode(v.hdisplay, v.vdisplay, DefaultDepth((Display*)wxGetDisplay(), DefaultScreen((Display*)wxGetDisplay())), wxCRR2(v,dc))
bool wxDisplay::ChangeMode(const wxVideoMode& mode)
{
- //This gets kind of tricky AND complicated :) :\ :( :)
+ XF86VidModeModeInfo** ppXModes; //Enumerated Modes (Don't forget XFree() :))
+ int nNumModes; //Number of modes enumerated....
+
+ if( !XF86VidModeGetAllModeLines((Display*)wxGetDisplay(), DefaultScreen((Display*)wxGetDisplay()), &nNumModes, &ppXModes) )
+ {
+ wxLogSysError(_("Failed to change video mode"));
+ return false;
+ }
+
+ bool bRet = false;
+ if (mode == wxDefaultVideoMode)
{
- bool bRet = false;
- //Some variables..
- XF86VidModeModeInfo** ppXModes; //Enumerated Modes (Don't forget XFree() :))
- int nNumModes; //Number of modes enumerated....
+ bRet = XF86VidModeSwitchToMode((Display*)wxGetDisplay(), DefaultScreen((Display*)wxGetDisplay()),
+ ppXModes[0]) == TRUE;
- if(XF86VidModeGetAllModeLines((Display*)wxGetDisplay(), DefaultScreen((Display*)wxGetDisplay()), &nNumModes, &ppXModes) == TRUE)
+ for (int i = 0; i < nNumModes; ++i)
+ {
+ wxClearXVM((*ppXModes[i]));
+ // XFree(ppXModes[i]); //supposed to free?
+ }
+ }
+ else
+ {
+ for (int i = 0; i < nNumModes; ++i)
{
- if (mode == wxDefaultVideoMode)
+ if (!bRet &&
+ ppXModes[i]->hdisplay == mode.w &&
+ ppXModes[i]->vdisplay == mode.h &&
+ wxCRR((*ppXModes[i])) == mode.refresh)
{
+ //switch!
bRet = XF86VidModeSwitchToMode((Display*)wxGetDisplay(), DefaultScreen((Display*)wxGetDisplay()),
- ppXModes[0]) == TRUE;
-
- for (int i = 0; i < nNumModes; ++i)
- {
- wxClearXVM((*ppXModes[i]));
- // XFree(ppXModes[i]); //supposed to free?
- }
- XFree(ppXModes);
-
- return bRet;
- }
- for (int i = 0; i < nNumModes; ++i)
- {
- if (!bRet &&
- ppXModes[i]->hdisplay == mode.w &&
- ppXModes[i]->vdisplay == mode.h &&
- wxCRR((*ppXModes[i])) == mode.refresh)
- {
- //switch!
- bRet = XF86VidModeSwitchToMode((Display*)wxGetDisplay(), DefaultScreen((Display*)wxGetDisplay()),
- ppXModes[i]) == TRUE;
- }
- wxClearXVM((*ppXModes[i]));
- // XFree(ppXModes[i]); //supposed to free?
+ ppXModes[i]) == TRUE;
}
- XFree(ppXModes);
-
- return bRet;
- }
- else //OOPS!
- {
- wxLogSysError(_("Failed to change video mode"));
- return false;
+ wxClearXVM((*ppXModes[i]));
+ // XFree(ppXModes[i]); //supposed to free?
}
}
+
+ XFree(ppXModes);
+
+ return bRet;
}