Commit 4bf4c5ef authored by cutealien's avatar cutealien

Cleanup - membervariables start with uppercase letters.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@4745 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 6bbb9b1b
...@@ -75,10 +75,10 @@ const char wmDeleteWindow[] = "WM_DELETE_WINDOW"; ...@@ -75,10 +75,10 @@ const char wmDeleteWindow[] = "WM_DELETE_WINDOW";
CIrrDeviceLinux::CIrrDeviceLinux(const SIrrlichtCreationParameters& param) CIrrDeviceLinux::CIrrDeviceLinux(const SIrrlichtCreationParameters& param)
: CIrrDeviceStub(param), : CIrrDeviceStub(param),
#ifdef _IRR_COMPILE_WITH_X11_ #ifdef _IRR_COMPILE_WITH_X11_
display(0), visual(0), screennr(0), window(0), StdHints(0), SoftwareImage(0), XDisplay(0), VisualInfo(0), Screennr(0), XWindow(0), StdHints(0), SoftwareImage(0),
XInputMethod(0), XInputContext(0), XInputMethod(0), XInputContext(0),
#ifdef _IRR_COMPILE_WITH_OPENGL_ #ifdef _IRR_COMPILE_WITH_OPENGL_
glxWin(0), GlxWin(0),
Context(0), Context(0),
#endif #endif
#endif #endif
...@@ -168,24 +168,24 @@ CIrrDeviceLinux::~CIrrDeviceLinux() ...@@ -168,24 +168,24 @@ CIrrDeviceLinux::~CIrrDeviceLinux()
destroyInputContext(); destroyInputContext();
if (display) if (XDisplay)
{ {
#ifdef _IRR_COMPILE_WITH_OPENGL_ #ifdef _IRR_COMPILE_WITH_OPENGL_
if (Context) if (Context)
{ {
if (glxWin) if (GlxWin)
{ {
if (!glXMakeContextCurrent(display, None, None, NULL)) if (!glXMakeContextCurrent(XDisplay, None, None, NULL))
os::Printer::log("Could not release glx context.", ELL_WARNING); os::Printer::log("Could not release glx context.", ELL_WARNING);
} }
else else
{ {
if (!glXMakeCurrent(display, None, NULL)) if (!glXMakeCurrent(XDisplay, None, NULL))
os::Printer::log("Could not release glx context.", ELL_WARNING); os::Printer::log("Could not release glx context.", ELL_WARNING);
} }
glXDestroyContext(display, Context); glXDestroyContext(XDisplay, Context);
if (glxWin) if (GlxWin)
glXDestroyWindow(display, glxWin); glXDestroyWindow(XDisplay, GlxWin);
} }
#endif // #ifdef _IRR_COMPILE_WITH_OPENGL_ #endif // #ifdef _IRR_COMPILE_WITH_OPENGL_
...@@ -197,12 +197,12 @@ CIrrDeviceLinux::~CIrrDeviceLinux() ...@@ -197,12 +197,12 @@ CIrrDeviceLinux::~CIrrDeviceLinux()
if (!ExternalWindow) if (!ExternalWindow)
{ {
XDestroyWindow(display,window); XDestroyWindow(XDisplay,XWindow);
XCloseDisplay(display); XCloseDisplay(XDisplay);
} }
} }
if (visual) if (VisualInfo)
XFree(visual); XFree(VisualInfo);
#endif // #ifdef _IRR_COMPILE_WITH_X11_ #endif // #ifdef _IRR_COMPILE_WITH_X11_
...@@ -243,15 +243,15 @@ bool CIrrDeviceLinux::switchToFullscreen(bool reset) ...@@ -243,15 +243,15 @@ bool CIrrDeviceLinux::switchToFullscreen(bool reset)
#ifdef _IRR_LINUX_X11_VIDMODE_ #ifdef _IRR_LINUX_X11_VIDMODE_
if (UseXVidMode && CreationParams.Fullscreen) if (UseXVidMode && CreationParams.Fullscreen)
{ {
XF86VidModeSwitchToMode(display, screennr, &oldVideoMode); XF86VidModeSwitchToMode(XDisplay, Screennr, &OldVideoMode);
XF86VidModeSetViewPort(display, screennr, 0, 0); XF86VidModeSetViewPort(XDisplay, Screennr, 0, 0);
} }
#endif #endif
#ifdef _IRR_LINUX_X11_RANDR_ #ifdef _IRR_LINUX_X11_RANDR_
if (UseXRandR && CreationParams.Fullscreen) if (UseXRandR && CreationParams.Fullscreen)
{ {
XRRScreenConfiguration *config=XRRGetScreenInfo(display,DefaultRootWindow(display)); XRRScreenConfiguration *config=XRRGetScreenInfo(XDisplay,DefaultRootWindow(XDisplay));
XRRSetScreenConfig(display,config,DefaultRootWindow(display),oldRandrMode,oldRandrRotation,CurrentTime); XRRSetScreenConfig(XDisplay,config,DefaultRootWindow(XDisplay),OldRandrMode,OldRandrRotation,CurrentTime);
XRRFreeScreenConfigInfo(config); XRRFreeScreenConfigInfo(config);
} }
#endif #endif
...@@ -265,13 +265,13 @@ bool CIrrDeviceLinux::switchToFullscreen(bool reset) ...@@ -265,13 +265,13 @@ bool CIrrDeviceLinux::switchToFullscreen(bool reset)
#endif #endif
#ifdef _IRR_LINUX_X11_VIDMODE_ #ifdef _IRR_LINUX_X11_VIDMODE_
if (XF86VidModeQueryExtension(display, &eventbase, &errorbase)) if (XF86VidModeQueryExtension(XDisplay, &eventbase, &errorbase))
{ {
// enumerate video modes // enumerate video modes
s32 modeCount; s32 modeCount;
XF86VidModeModeInfo** modes; XF86VidModeModeInfo** modes;
XF86VidModeGetAllModeLines(display, screennr, &modeCount, &modes); XF86VidModeGetAllModeLines(XDisplay, Screennr, &modeCount, &modes);
// find fitting mode // find fitting mode
for (s32 i = 0; i<modeCount; ++i) for (s32 i = 0; i<modeCount; ++i)
...@@ -291,8 +291,8 @@ bool CIrrDeviceLinux::switchToFullscreen(bool reset) ...@@ -291,8 +291,8 @@ bool CIrrDeviceLinux::switchToFullscreen(bool reset)
os::Printer::log("hdisplay: ", core::stringc(modes[bestMode]->hdisplay).c_str(), ELL_INFORMATION); os::Printer::log("hdisplay: ", core::stringc(modes[bestMode]->hdisplay).c_str(), ELL_INFORMATION);
os::Printer::log("vdisplay: ", core::stringc(modes[bestMode]->vdisplay).c_str(), ELL_INFORMATION); os::Printer::log("vdisplay: ", core::stringc(modes[bestMode]->vdisplay).c_str(), ELL_INFORMATION);
XF86VidModeSwitchToMode(display, screennr, modes[bestMode]); XF86VidModeSwitchToMode(XDisplay, Screennr, modes[bestMode]);
XF86VidModeSetViewPort(display, screennr, 0, 0); XF86VidModeSetViewPort(XDisplay, Screennr, 0, 0);
UseXVidMode=true; UseXVidMode=true;
} }
else else
...@@ -306,10 +306,10 @@ bool CIrrDeviceLinux::switchToFullscreen(bool reset) ...@@ -306,10 +306,10 @@ bool CIrrDeviceLinux::switchToFullscreen(bool reset)
else else
#endif #endif
#ifdef _IRR_LINUX_X11_RANDR_ #ifdef _IRR_LINUX_X11_RANDR_
if (XRRQueryExtension(display, &eventbase, &errorbase)) if (XRRQueryExtension(XDisplay, &eventbase, &errorbase))
{ {
s32 modeCount; s32 modeCount;
XRRScreenConfiguration *config=XRRGetScreenInfo(display,DefaultRootWindow(display)); XRRScreenConfiguration *config=XRRGetScreenInfo(XDisplay,DefaultRootWindow(XDisplay));
XRRScreenSize *modes=XRRConfigSizes(config,&modeCount); XRRScreenSize *modes=XRRConfigSizes(config,&modeCount);
for (s32 i = 0; i<modeCount; ++i) for (s32 i = 0; i<modeCount; ++i)
{ {
...@@ -328,7 +328,7 @@ bool CIrrDeviceLinux::switchToFullscreen(bool reset) ...@@ -328,7 +328,7 @@ bool CIrrDeviceLinux::switchToFullscreen(bool reset)
os::Printer::log("width: ", core::stringc(modes[bestMode].width).c_str(), ELL_INFORMATION); os::Printer::log("width: ", core::stringc(modes[bestMode].width).c_str(), ELL_INFORMATION);
os::Printer::log("height: ", core::stringc(modes[bestMode].height).c_str(), ELL_INFORMATION); os::Printer::log("height: ", core::stringc(modes[bestMode].height).c_str(), ELL_INFORMATION);
XRRSetScreenConfig(display,config,DefaultRootWindow(display),bestMode,oldRandrRotation,CurrentTime); XRRSetScreenConfig(XDisplay,config,DefaultRootWindow(XDisplay),bestMode,OldRandrRotation,CurrentTime);
UseXRandR=true; UseXRandR=true;
} }
XRRFreeScreenConfigInfo(config); XRRFreeScreenConfigInfo(config);
...@@ -383,8 +383,8 @@ bool CIrrDeviceLinux::createWindow() ...@@ -383,8 +383,8 @@ bool CIrrDeviceLinux::createWindow()
XSetErrorHandler(IrrPrintXError); XSetErrorHandler(IrrPrintXError);
#endif #endif
display = XOpenDisplay(0); XDisplay = XOpenDisplay(0);
if (!display) if (!XDisplay)
{ {
os::Printer::log("Error: Need running XServer to start Irrlicht Engine.", ELL_ERROR); os::Printer::log("Error: Need running XServer to start Irrlicht Engine.", ELL_ERROR);
if (XDisplayName(0)[0]) if (XDisplayName(0)[0])
...@@ -394,7 +394,7 @@ bool CIrrDeviceLinux::createWindow() ...@@ -394,7 +394,7 @@ bool CIrrDeviceLinux::createWindow()
return false; return false;
} }
screennr = DefaultScreen(display); Screennr = DefaultScreen(XDisplay);
switchToFullscreen(); switchToFullscreen();
...@@ -405,8 +405,8 @@ bool CIrrDeviceLinux::createWindow() ...@@ -405,8 +405,8 @@ bool CIrrDeviceLinux::createWindow()
bool isAvailableGLX=false; bool isAvailableGLX=false;
if (CreationParams.DriverType==video::EDT_OPENGL) if (CreationParams.DriverType==video::EDT_OPENGL)
{ {
isAvailableGLX=glXQueryExtension(display,&major,&minor); isAvailableGLX=glXQueryExtension(XDisplay,&major,&minor);
if (isAvailableGLX && glXQueryVersion(display, &major, &minor)) if (isAvailableGLX && glXQueryVersion(XDisplay, &major, &minor))
{ {
#ifdef GLX_VERSION_1_3 #ifdef GLX_VERSION_1_3
typedef GLXFBConfig * ( * PFNGLXCHOOSEFBCONFIGPROC) (Display *dpy, int screen, const int *attrib_list, int *nelements); typedef GLXFBConfig * ( * PFNGLXCHOOSEFBCONFIGPROC) (Display *dpy, int screen, const int *attrib_list, int *nelements);
...@@ -457,19 +457,19 @@ bool CIrrDeviceLinux::createWindow() ...@@ -457,19 +457,19 @@ bool CIrrDeviceLinux::createWindow()
} }
// first round with unchanged values // first round with unchanged values
{ {
configList=glxChooseFBConfig(display, screennr, visualAttrBuffer,&nitems); configList=glxChooseFBConfig(XDisplay, Screennr, visualAttrBuffer,&nitems);
if (!configList && CreationParams.AntiAlias) if (!configList && CreationParams.AntiAlias)
{ {
while (!configList && (visualAttrBuffer[19]>1)) while (!configList && (visualAttrBuffer[19]>1))
{ {
visualAttrBuffer[19] -= 1; visualAttrBuffer[19] -= 1;
configList=glxChooseFBConfig(display, screennr, visualAttrBuffer,&nitems); configList=glxChooseFBConfig(XDisplay, Screennr, visualAttrBuffer,&nitems);
} }
if (!configList) if (!configList)
{ {
visualAttrBuffer[17] = 0; visualAttrBuffer[17] = 0;
visualAttrBuffer[19] = 0; visualAttrBuffer[19] = 0;
configList=glxChooseFBConfig(display, screennr, visualAttrBuffer,&nitems); configList=glxChooseFBConfig(XDisplay, Screennr, visualAttrBuffer,&nitems);
if (configList) if (configList)
{ {
os::Printer::log("No FSAA available.", ELL_WARNING); os::Printer::log("No FSAA available.", ELL_WARNING);
...@@ -495,19 +495,19 @@ bool CIrrDeviceLinux::createWindow() ...@@ -495,19 +495,19 @@ bool CIrrDeviceLinux::createWindow()
CreationParams.Stencilbuffer = !CreationParams.Stencilbuffer; CreationParams.Stencilbuffer = !CreationParams.Stencilbuffer;
visualAttrBuffer[15]=CreationParams.Stencilbuffer?1:0; visualAttrBuffer[15]=CreationParams.Stencilbuffer?1:0;
configList=glxChooseFBConfig(display, screennr, visualAttrBuffer,&nitems); configList=glxChooseFBConfig(XDisplay, Screennr, visualAttrBuffer,&nitems);
if (!configList && CreationParams.AntiAlias) if (!configList && CreationParams.AntiAlias)
{ {
while (!configList && (visualAttrBuffer[19]>1)) while (!configList && (visualAttrBuffer[19]>1))
{ {
visualAttrBuffer[19] -= 1; visualAttrBuffer[19] -= 1;
configList=glxChooseFBConfig(display, screennr, visualAttrBuffer,&nitems); configList=glxChooseFBConfig(XDisplay, Screennr, visualAttrBuffer,&nitems);
} }
if (!configList) if (!configList)
{ {
visualAttrBuffer[17] = 0; visualAttrBuffer[17] = 0;
visualAttrBuffer[19] = 0; visualAttrBuffer[19] = 0;
configList=glxChooseFBConfig(display, screennr, visualAttrBuffer,&nitems); configList=glxChooseFBConfig(XDisplay, Screennr, visualAttrBuffer,&nitems);
if (configList) if (configList)
{ {
os::Printer::log("No FSAA available.", ELL_WARNING); os::Printer::log("No FSAA available.", ELL_WARNING);
...@@ -530,19 +530,19 @@ bool CIrrDeviceLinux::createWindow() ...@@ -530,19 +530,19 @@ bool CIrrDeviceLinux::createWindow()
visualAttrBuffer[13] = GLX_DONT_CARE; visualAttrBuffer[13] = GLX_DONT_CARE;
CreationParams.Stencilbuffer = false; CreationParams.Stencilbuffer = false;
visualAttrBuffer[15]=0; visualAttrBuffer[15]=0;
configList=glxChooseFBConfig(display, screennr, visualAttrBuffer,&nitems); configList=glxChooseFBConfig(XDisplay, Screennr, visualAttrBuffer,&nitems);
if (!configList && CreationParams.AntiAlias) if (!configList && CreationParams.AntiAlias)
{ {
while (!configList && (visualAttrBuffer[19]>1)) while (!configList && (visualAttrBuffer[19]>1))
{ {
visualAttrBuffer[19] -= 1; visualAttrBuffer[19] -= 1;
configList=glxChooseFBConfig(display, screennr, visualAttrBuffer,&nitems); configList=glxChooseFBConfig(XDisplay, Screennr, visualAttrBuffer,&nitems);
} }
if (!configList) if (!configList)
{ {
visualAttrBuffer[17] = 0; visualAttrBuffer[17] = 0;
visualAttrBuffer[19] = 0; visualAttrBuffer[19] = 0;
configList=glxChooseFBConfig(display, screennr, visualAttrBuffer,&nitems); configList=glxChooseFBConfig(XDisplay, Screennr, visualAttrBuffer,&nitems);
if (configList) if (configList)
{ {
os::Printer::log("No FSAA available.", ELL_WARNING); os::Printer::log("No FSAA available.", ELL_WARNING);
...@@ -566,9 +566,9 @@ bool CIrrDeviceLinux::createWindow() ...@@ -566,9 +566,9 @@ bool CIrrDeviceLinux::createWindow()
typedef XVisualInfo * ( * PFNGLXGETVISUALFROMFBCONFIGPROC) (Display *dpy, GLXFBConfig config); typedef XVisualInfo * ( * PFNGLXGETVISUALFROMFBCONFIGPROC) (Display *dpy, GLXFBConfig config);
PFNGLXGETVISUALFROMFBCONFIGPROC glxGetVisualFromFBConfig= (PFNGLXGETVISUALFROMFBCONFIGPROC)glXGetProcAddress(reinterpret_cast<const GLubyte*>("glXGetVisualFromFBConfig")); PFNGLXGETVISUALFROMFBCONFIGPROC glxGetVisualFromFBConfig= (PFNGLXGETVISUALFROMFBCONFIGPROC)glXGetProcAddress(reinterpret_cast<const GLubyte*>("glXGetVisualFromFBConfig"));
if (glxGetVisualFromFBConfig) if (glxGetVisualFromFBConfig)
visual = glxGetVisualFromFBConfig(display,glxFBConfig); VisualInfo = glxGetVisualFromFBConfig(XDisplay,glxFBConfig);
#else #else
visual = glXGetVisualFromFBConfig(display,glxFBConfig); VisualInfo = glXGetVisualFromFBConfig(XDisplay,glxFBConfig);
#endif #endif
} }
} }
...@@ -598,21 +598,21 @@ bool CIrrDeviceLinux::createWindow() ...@@ -598,21 +598,21 @@ bool CIrrDeviceLinux::createWindow()
None None
}; };
visual=glXChooseVisual(display, screennr, visualAttrBuffer); VisualInfo=glXChooseVisual(XDisplay, Screennr, visualAttrBuffer);
if (!visual) if (!VisualInfo)
{ {
if (CreationParams.Stencilbuffer) if (CreationParams.Stencilbuffer)
os::Printer::log("No stencilbuffer available, disabling.", ELL_WARNING); os::Printer::log("No stencilbuffer available, disabling.", ELL_WARNING);
CreationParams.Stencilbuffer = !CreationParams.Stencilbuffer; CreationParams.Stencilbuffer = !CreationParams.Stencilbuffer;
visualAttrBuffer[13]=CreationParams.Stencilbuffer?1:0; visualAttrBuffer[13]=CreationParams.Stencilbuffer?1:0;
visual=glXChooseVisual(display, screennr, visualAttrBuffer); VisualInfo=glXChooseVisual(XDisplay, Screennr, visualAttrBuffer);
if (!visual && CreationParams.Doublebuffer) if (!VisualInfo && CreationParams.Doublebuffer)
{ {
os::Printer::log("No doublebuffering available.", ELL_WARNING); os::Printer::log("No doublebuffering available.", ELL_WARNING);
CreationParams.Doublebuffer=false; CreationParams.Doublebuffer=false;
visualAttrBuffer[14] = GLX_USE_GL; visualAttrBuffer[14] = GLX_USE_GL;
visual=glXChooseVisual(display, screennr, visualAttrBuffer); VisualInfo=glXChooseVisual(XDisplay, Screennr, visualAttrBuffer);
} }
} }
} }
...@@ -622,7 +622,7 @@ bool CIrrDeviceLinux::createWindow() ...@@ -622,7 +622,7 @@ bool CIrrDeviceLinux::createWindow()
} }
// don't use the XVisual with OpenGL, because it ignores all requested // don't use the XVisual with OpenGL, because it ignores all requested
// properties of the CreationParams // properties of the CreationParams
else if (!visual) else if (!VisualInfo)
#endif // _IRR_COMPILE_WITH_OPENGL_ #endif // _IRR_COMPILE_WITH_OPENGL_
// create visual with standard X methods // create visual with standard X methods
...@@ -631,40 +631,40 @@ bool CIrrDeviceLinux::createWindow() ...@@ -631,40 +631,40 @@ bool CIrrDeviceLinux::createWindow()
XVisualInfo visTempl; //Template to hold requested values XVisualInfo visTempl; //Template to hold requested values
int visNumber; // Return value of available visuals int visNumber; // Return value of available visuals
visTempl.screen = screennr; visTempl.screen = Screennr;
// ARGB visuals should be avoided for usual applications // ARGB visuals should be avoided for usual applications
visTempl.depth = CreationParams.WithAlphaChannel?32:24; visTempl.depth = CreationParams.WithAlphaChannel?32:24;
while ((!visual) && (visTempl.depth>=16)) while ((!VisualInfo) && (visTempl.depth>=16))
{ {
visual = XGetVisualInfo(display, VisualScreenMask|VisualDepthMask, VisualInfo = XGetVisualInfo(XDisplay, VisualScreenMask|VisualDepthMask,
&visTempl, &visNumber); &visTempl, &visNumber);
visTempl.depth -= 8; visTempl.depth -= 8;
} }
} }
if (!visual) if (!VisualInfo)
{ {
os::Printer::log("Fatal error, could not get visual.", ELL_ERROR); os::Printer::log("Fatal error, could not get visual.", ELL_ERROR);
XCloseDisplay(display); XCloseDisplay(XDisplay);
display=0; XDisplay=0;
return false; return false;
} }
#ifdef _DEBUG #ifdef _DEBUG
else else
os::Printer::log("Visual chosen: ", core::stringc(static_cast<u32>(visual->visualid)).c_str(), ELL_DEBUG); os::Printer::log("Visual chosen: ", core::stringc(static_cast<u32>(VisualInfo->visualid)).c_str(), ELL_DEBUG);
#endif #endif
// create color map // create color map
Colormap colormap; Colormap colormap;
colormap = XCreateColormap(display, colormap = XCreateColormap(XDisplay,
RootWindow(display, visual->screen), RootWindow(XDisplay, VisualInfo->screen),
visual->visual, AllocNone); VisualInfo->visual, AllocNone);
attributes.colormap = colormap; WndAttributes.colormap = colormap;
attributes.border_pixel = 0; WndAttributes.border_pixel = 0;
attributes.event_mask = StructureNotifyMask | FocusChangeMask | ExposureMask; WndAttributes.event_mask = StructureNotifyMask | FocusChangeMask | ExposureMask;
if (!CreationParams.IgnoreInput) if (!CreationParams.IgnoreInput)
attributes.event_mask |= PointerMotionMask | WndAttributes.event_mask |= PointerMotionMask |
ButtonPressMask | KeyPressMask | ButtonPressMask | KeyPressMask |
ButtonReleaseMask | KeyReleaseMask; ButtonReleaseMask | KeyReleaseMask;
...@@ -683,46 +683,46 @@ bool CIrrDeviceLinux::createWindow() ...@@ -683,46 +683,46 @@ bool CIrrDeviceLinux::createWindow()
// create new Window // create new Window
// Remove window manager decoration in fullscreen // Remove window manager decoration in fullscreen
attributes.override_redirect = CreationParams.Fullscreen; WndAttributes.override_redirect = CreationParams.Fullscreen;
window = XCreateWindow(display, XWindow = XCreateWindow(XDisplay,
RootWindow(display, visual->screen), RootWindow(XDisplay, VisualInfo->screen),
x, y, Width, Height, 0, visual->depth, x, y, Width, Height, 0, VisualInfo->depth,
InputOutput, visual->visual, InputOutput, VisualInfo->visual,
CWBorderPixel | CWColormap | CWEventMask | CWOverrideRedirect, CWBorderPixel | CWColormap | CWEventMask | CWOverrideRedirect,
&attributes); &WndAttributes);
XMapRaised(display, window); XMapRaised(XDisplay, XWindow);
CreationParams.WindowId = (void*)window; CreationParams.WindowId = (void*)XWindow;
Atom wmDelete; Atom wmDelete;
wmDelete = XInternAtom(display, wmDeleteWindow, True); wmDelete = XInternAtom(XDisplay, wmDeleteWindow, True);
XSetWMProtocols(display, window, &wmDelete, 1); XSetWMProtocols(XDisplay, XWindow, &wmDelete, 1);
if (CreationParams.Fullscreen) if (CreationParams.Fullscreen)
{ {
XSetInputFocus(display, window, RevertToParent, CurrentTime); XSetInputFocus(XDisplay, XWindow, RevertToParent, CurrentTime);
int grabKb = XGrabKeyboard(display, window, True, GrabModeAsync, int grabKb = XGrabKeyboard(XDisplay, XWindow, True, GrabModeAsync,
GrabModeAsync, CurrentTime); GrabModeAsync, CurrentTime);
IrrPrintXGrabError(grabKb, "XGrabKeyboard"); IrrPrintXGrabError(grabKb, "XGrabKeyboard");
int grabPointer = XGrabPointer(display, window, True, ButtonPressMask, int grabPointer = XGrabPointer(XDisplay, XWindow, True, ButtonPressMask,
GrabModeAsync, GrabModeAsync, window, None, CurrentTime); GrabModeAsync, GrabModeAsync, XWindow, None, CurrentTime);
IrrPrintXGrabError(grabPointer, "XGrabPointer"); IrrPrintXGrabError(grabPointer, "XGrabPointer");
XWarpPointer(display, None, window, 0, 0, 0, 0, 0, 0); XWarpPointer(XDisplay, None, XWindow, 0, 0, 0, 0, 0, 0);
} }
} }
else else
{ {
// attach external window // attach external window
window = (Window)CreationParams.WindowId; XWindow = (Window)CreationParams.WindowId;
if (!CreationParams.IgnoreInput) if (!CreationParams.IgnoreInput)
{ {
XCreateWindow(display, XCreateWindow(XDisplay,
window, XWindow,
0, 0, Width, Height, 0, visual->depth, 0, 0, Width, Height, 0, VisualInfo->depth,
InputOutput, visual->visual, InputOutput, VisualInfo->visual,
CWBorderPixel | CWColormap | CWEventMask, CWBorderPixel | CWColormap | CWEventMask,
&attributes); &WndAttributes);
} }
XWindowAttributes wa; XWindowAttributes wa;
XGetWindowAttributes(display, window, &wa); XGetWindowAttributes(XDisplay, XWindow, &wa);
CreationParams.WindowSize.Width = wa.width; CreationParams.WindowSize.Width = wa.width;
CreationParams.WindowSize.Height = wa.height; CreationParams.WindowSize.Height = wa.height;
CreationParams.Fullscreen = false; CreationParams.Fullscreen = false;
...@@ -731,7 +731,7 @@ bool CIrrDeviceLinux::createWindow() ...@@ -731,7 +731,7 @@ bool CIrrDeviceLinux::createWindow()
WindowMinimized=false; WindowMinimized=false;
// Currently broken in X, see Bug ID 2795321 // Currently broken in X, see Bug ID 2795321
// XkbSetDetectableAutoRepeat(display, True, &AutorepeatSupport); // XkbSetDetectableAutoRepeat(XDisplay, True, &AutorepeatSupport);
#ifdef _IRR_COMPILE_WITH_OPENGL_ #ifdef _IRR_COMPILE_WITH_OPENGL_
...@@ -741,17 +741,17 @@ bool CIrrDeviceLinux::createWindow() ...@@ -741,17 +741,17 @@ bool CIrrDeviceLinux::createWindow()
{ {
if (UseGLXWindow) if (UseGLXWindow)
{ {
glxWin=glXCreateWindow(display,glxFBConfig,window,NULL); GlxWin=glXCreateWindow(XDisplay,glxFBConfig,XWindow,NULL);
if (glxWin) if (GlxWin)
{ {
// create glx context // create glx context
Context = glXCreateNewContext(display, glxFBConfig, GLX_RGBA_TYPE, NULL, True); Context = glXCreateNewContext(XDisplay, glxFBConfig, GLX_RGBA_TYPE, NULL, True);
if (Context) if (Context)
{ {
if (!glXMakeContextCurrent(display, glxWin, glxWin, Context)) if (!glXMakeContextCurrent(XDisplay, GlxWin, GlxWin, Context))
{ {
os::Printer::log("Could not make context current.", ELL_WARNING); os::Printer::log("Could not make context current.", ELL_WARNING);
glXDestroyContext(display, Context); glXDestroyContext(XDisplay, Context);
} }
} }
else else
...@@ -766,13 +766,13 @@ bool CIrrDeviceLinux::createWindow() ...@@ -766,13 +766,13 @@ bool CIrrDeviceLinux::createWindow()
} }
else else
{ {
Context = glXCreateContext(display, visual, NULL, True); Context = glXCreateContext(XDisplay, VisualInfo, NULL, True);
if (Context) if (Context)
{ {
if (!glXMakeCurrent(display, window, Context)) if (!glXMakeCurrent(XDisplay, XWindow, Context))
{ {
os::Printer::log("Could not make context current.", ELL_WARNING); os::Printer::log("Could not make context current.", ELL_WARNING);
glXDestroyContext(display, Context); glXDestroyContext(XDisplay, Context);
} }
} }
else else
...@@ -788,24 +788,24 @@ bool CIrrDeviceLinux::createWindow() ...@@ -788,24 +788,24 @@ bool CIrrDeviceLinux::createWindow()
int x,y; int x,y;
unsigned int bits; unsigned int bits;
XGetGeometry(display, window, &tmp, &x, &y, &Width, &Height, &borderWidth, &bits); XGetGeometry(XDisplay, XWindow, &tmp, &x, &y, &Width, &Height, &borderWidth, &bits);
CreationParams.Bits = bits; CreationParams.Bits = bits;
CreationParams.WindowSize.Width = Width; CreationParams.WindowSize.Width = Width;
CreationParams.WindowSize.Height = Height; CreationParams.WindowSize.Height = Height;
StdHints = XAllocSizeHints(); StdHints = XAllocSizeHints();
long num; long num;
XGetWMNormalHints(display, window, StdHints, &num); XGetWMNormalHints(XDisplay, XWindow, StdHints, &num);
// create an XImage for the software renderer // create an XImage for the software renderer
//(thx to Nadav for some clues on how to do that!) //(thx to Nadav for some clues on how to do that!)
if (CreationParams.DriverType == video::EDT_SOFTWARE || CreationParams.DriverType == video::EDT_BURNINGSVIDEO) if (CreationParams.DriverType == video::EDT_SOFTWARE || CreationParams.DriverType == video::EDT_BURNINGSVIDEO)
{ {
SoftwareImage = XCreateImage(display, SoftwareImage = XCreateImage(XDisplay,
visual->visual, visual->depth, VisualInfo->visual, VisualInfo->depth,
ZPixmap, 0, 0, Width, Height, ZPixmap, 0, 0, Width, Height,
BitmapPad(display), 0); BitmapPad(XDisplay), 0);
// use malloc because X will free it later on // use malloc because X will free it later on
if (SoftwareImage) if (SoftwareImage)
...@@ -892,7 +892,7 @@ bool CIrrDeviceLinux::createInputContext() ...@@ -892,7 +892,7 @@ bool CIrrDeviceLinux::createInputContext()
return false; return false;
} }
XInputMethod = XOpenIM(display, NULL, NULL, NULL); XInputMethod = XOpenIM(XDisplay, NULL, NULL, NULL);
if ( !XInputMethod ) if ( !XInputMethod )
{ {
setlocale(LC_CTYPE, oldLocale.c_str()); setlocale(LC_CTYPE, oldLocale.c_str());
...@@ -928,7 +928,7 @@ bool CIrrDeviceLinux::createInputContext() ...@@ -928,7 +928,7 @@ bool CIrrDeviceLinux::createInputContext()
XInputContext = XCreateIC(XInputMethod, XInputContext = XCreateIC(XInputMethod,
XNInputStyle, bestStyle, XNInputStyle, bestStyle,
XNClientWindow, window, XNClientWindow, XWindow,
(char*)NULL); (char*)NULL);
if (!XInputContext ) if (!XInputContext )
{ {
...@@ -961,8 +961,8 @@ EKEY_CODE CIrrDeviceLinux::getKeyCode(XEvent &event) ...@@ -961,8 +961,8 @@ EKEY_CODE CIrrDeviceLinux::getKeyCode(XEvent &event)
EKEY_CODE keyCode = (EKEY_CODE)0; EKEY_CODE keyCode = (EKEY_CODE)0;
SKeyMap mp; SKeyMap mp;
mp.X11Key = XkbKeycodeToKeysym(display, event.xkey.keycode, 0, 0); mp.X11Key = XkbKeycodeToKeysym(XDisplay, event.xkey.keycode, 0, 0);
// mp.X11Key = XKeycodeToKeysym(display, event.xkey.keycode, 0); // deprecated, if we still find platforms which need that we have to use some define // mp.X11Key = XKeycodeToKeysym(XDisplay, event.xkey.keycode, 0); // deprecated, if we still find platforms which need that we have to use some define
const s32 idx = KeyMap.binary_search(mp); const s32 idx = KeyMap.binary_search(mp);
if (idx != -1) if (idx != -1)
{ {
...@@ -1003,15 +1003,15 @@ bool CIrrDeviceLinux::run() ...@@ -1003,15 +1003,15 @@ bool CIrrDeviceLinux::run()
if ( CursorControl ) if ( CursorControl )
static_cast<CCursorControl*>(CursorControl)->update(); static_cast<CCursorControl*>(CursorControl)->update();
if ((CreationParams.DriverType != video::EDT_NULL) && display) if ((CreationParams.DriverType != video::EDT_NULL) && XDisplay)
{ {
SEvent irrevent; SEvent irrevent;
irrevent.MouseInput.ButtonStates = 0xffffffff; irrevent.MouseInput.ButtonStates = 0xffffffff;
while (XPending(display) > 0 && !Close) while (XPending(XDisplay) > 0 && !Close)
{ {
XEvent event; XEvent event;
XNextEvent(display, &event); XNextEvent(XDisplay, &event);
switch (event.type) switch (event.type)
{ {
...@@ -1028,10 +1028,10 @@ bool CIrrDeviceLinux::run() ...@@ -1028,10 +1028,10 @@ bool CIrrDeviceLinux::run()
{ {
XDestroyImage(SoftwareImage); XDestroyImage(SoftwareImage);
SoftwareImage = XCreateImage(display, SoftwareImage = XCreateImage(XDisplay,
visual->visual, visual->depth, VisualInfo->visual, VisualInfo->depth,
ZPixmap, 0, 0, Width, Height, ZPixmap, 0, 0, Width, Height,
BitmapPad(display), 0); BitmapPad(XDisplay), 0);
// use malloc because X will free it later on // use malloc because X will free it later on
if (SoftwareImage) if (SoftwareImage)
...@@ -1157,7 +1157,7 @@ bool CIrrDeviceLinux::run() ...@@ -1157,7 +1157,7 @@ bool CIrrDeviceLinux::run()
break; break;
case KeyRelease: case KeyRelease:
if (0 == AutorepeatSupport && (XPending( display ) > 0) ) if (0 == AutorepeatSupport && (XPending( XDisplay ) > 0) )
{ {
// check for Autorepeat manually // check for Autorepeat manually
// We'll do the same as Windows does: Only send KeyPressed // We'll do the same as Windows does: Only send KeyPressed
...@@ -1237,7 +1237,7 @@ bool CIrrDeviceLinux::run() ...@@ -1237,7 +1237,7 @@ bool CIrrDeviceLinux::run()
case ClientMessage: case ClientMessage:
{ {
char *atom = XGetAtomName(display, event.xclient.message_type); char *atom = XGetAtomName(XDisplay, event.xclient.message_type);
if (*atom == *wmDeleteWindow) if (*atom == *wmDeleteWindow)
{ {
os::Printer::log("Quit message received.", ELL_INFORMATION); os::Printer::log("Quit message received.", ELL_INFORMATION);
...@@ -1261,7 +1261,7 @@ bool CIrrDeviceLinux::run() ...@@ -1261,7 +1261,7 @@ bool CIrrDeviceLinux::run()
XSelectionRequestEvent *req = &(event.xselectionrequest); XSelectionRequestEvent *req = &(event.xselectionrequest);
if ( req->target == XA_STRING) if ( req->target == XA_STRING)
{ {
XChangeProperty (display, XChangeProperty (XDisplay,
req->requestor, req->requestor,
req->property, req->target, req->property, req->target,
8, // format 8, // format
...@@ -1277,7 +1277,7 @@ bool CIrrDeviceLinux::run() ...@@ -1277,7 +1277,7 @@ bool CIrrDeviceLinux::run()
data[0] = X_ATOM_TEXT; data[0] = X_ATOM_TEXT;
data[1] = XA_STRING; data[1] = XA_STRING;
XChangeProperty (display, req->requestor, XChangeProperty (XDisplay, req->requestor,
req->property, req->target, req->property, req->target,
8, PropModeReplace, 8, PropModeReplace,
(unsigned char *) &data, (unsigned char *) &data,
...@@ -1294,8 +1294,8 @@ bool CIrrDeviceLinux::run() ...@@ -1294,8 +1294,8 @@ bool CIrrDeviceLinux::run()
respond.xselection.selection=req->selection; respond.xselection.selection=req->selection;
respond.xselection.target= req->target; respond.xselection.target= req->target;
respond.xselection.time = req->time; respond.xselection.time = req->time;
XSendEvent (display, req->requestor,0,0,&respond); XSendEvent (XDisplay, req->requestor,0,0,&respond);
XFlush (display); XFlush (XDisplay);
} }
break; break;
...@@ -1349,11 +1349,11 @@ void CIrrDeviceLinux::setWindowCaption(const wchar_t* text) ...@@ -1349,11 +1349,11 @@ void CIrrDeviceLinux::setWindowCaption(const wchar_t* text)
return; return;
XTextProperty txt; XTextProperty txt;
if (Success==XwcTextListToTextProperty(display, const_cast<wchar_t**>(&text), if (Success==XwcTextListToTextProperty(XDisplay, const_cast<wchar_t**>(&text),
1, XStdICCTextStyle, &txt)) 1, XStdICCTextStyle, &txt))
{ {
XSetWMName(display, window, &txt); XSetWMName(XDisplay, XWindow, &txt);
XSetWMIconName(display, window, &txt); XSetWMIconName(XDisplay, XWindow, &txt);
XFree(txt.value); XFree(txt.value);
} }
#endif #endif
...@@ -1405,11 +1405,11 @@ bool CIrrDeviceLinux::present(video::IImage* image, void* windowId, core::rect<s ...@@ -1405,11 +1405,11 @@ bool CIrrDeviceLinux::present(video::IImage* image, void* windowId, core::rect<s
} }
image->unlock(); image->unlock();
GC gc = DefaultGC(display, DefaultScreen(display)); GC gc = DefaultGC(XDisplay, DefaultScreen(XDisplay));
Window myWindow=window; Window myWindow=XWindow;
if (windowId) if (windowId)
myWindow = reinterpret_cast<Window>(windowId); myWindow = reinterpret_cast<Window>(windowId);
XPutImage(display, myWindow, gc, SoftwareImage, 0, 0, 0, 0, destwidth, destheight); XPutImage(XDisplay, myWindow, gc, SoftwareImage, 0, 0, 0, 0, destwidth, destheight);
#endif #endif
return true; return true;
} }
...@@ -1447,7 +1447,7 @@ bool CIrrDeviceLinux::isWindowMinimized() const ...@@ -1447,7 +1447,7 @@ bool CIrrDeviceLinux::isWindowMinimized() const
video::ECOLOR_FORMAT CIrrDeviceLinux::getColorFormat() const video::ECOLOR_FORMAT CIrrDeviceLinux::getColorFormat() const
{ {
#ifdef _IRR_COMPILE_WITH_X11_ #ifdef _IRR_COMPILE_WITH_X11_
if (visual && (visual->depth != 16)) if (VisualInfo && (VisualInfo->depth != 16))
return video::ECF_R8G8B8; return video::ECF_R8G8B8;
else else
#endif #endif
...@@ -1462,7 +1462,7 @@ void CIrrDeviceLinux::setResizable(bool resize) ...@@ -1462,7 +1462,7 @@ void CIrrDeviceLinux::setResizable(bool resize)
if (CreationParams.DriverType == video::EDT_NULL || CreationParams.Fullscreen ) if (CreationParams.DriverType == video::EDT_NULL || CreationParams.Fullscreen )
return; return;
XUnmapWindow(display, window); XUnmapWindow(XDisplay, XWindow);
if ( !resize ) if ( !resize )
{ {
// Must be heap memory because data size depends on X Server // Must be heap memory because data size depends on X Server
...@@ -1470,15 +1470,15 @@ void CIrrDeviceLinux::setResizable(bool resize) ...@@ -1470,15 +1470,15 @@ void CIrrDeviceLinux::setResizable(bool resize)
hints->flags=PSize|PMinSize|PMaxSize; hints->flags=PSize|PMinSize|PMaxSize;
hints->min_width=hints->max_width=hints->base_width=Width; hints->min_width=hints->max_width=hints->base_width=Width;
hints->min_height=hints->max_height=hints->base_height=Height; hints->min_height=hints->max_height=hints->base_height=Height;
XSetWMNormalHints(display, window, hints); XSetWMNormalHints(XDisplay, XWindow, hints);
XFree(hints); XFree(hints);
} }
else else
{ {
XSetWMNormalHints(display, window, StdHints); XSetWMNormalHints(XDisplay, XWindow, StdHints);
} }
XMapWindow(display, window); XMapWindow(XDisplay, XWindow);
XFlush(display); XFlush(XDisplay);
#endif // #ifdef _IRR_COMPILE_WITH_X11_ #endif // #ifdef _IRR_COMPILE_WITH_X11_
} }
...@@ -1492,8 +1492,8 @@ void CIrrDeviceLinux::setWindowSize(const irr::core::dimension2d<u32>& size) ...@@ -1492,8 +1492,8 @@ void CIrrDeviceLinux::setWindowSize(const irr::core::dimension2d<u32>& size)
XWindowChanges values; XWindowChanges values;
values.width = size.Width; values.width = size.Width;
values.height = size.Height; values.height = size.Height;
XConfigureWindow(display, window, CWWidth | CWHeight, &values); XConfigureWindow(XDisplay, XWindow, CWWidth | CWHeight, &values);
XFlush(display); XFlush(XDisplay);
#endif // #ifdef _IRR_COMPILE_WITH_X11_ #endif // #ifdef _IRR_COMPILE_WITH_X11_
} }
...@@ -1505,29 +1505,29 @@ video::IVideoModeList* CIrrDeviceLinux::getVideoModeList() ...@@ -1505,29 +1505,29 @@ video::IVideoModeList* CIrrDeviceLinux::getVideoModeList()
{ {
bool temporaryDisplay = false; bool temporaryDisplay = false;
if (!display) if (!XDisplay)
{ {
display = XOpenDisplay(0); XDisplay = XOpenDisplay(0);
temporaryDisplay=true; temporaryDisplay=true;
} }
if (display) if (XDisplay)
{ {
#if defined(_IRR_LINUX_X11_VIDMODE_) || defined(_IRR_LINUX_X11_RANDR_) #if defined(_IRR_LINUX_X11_VIDMODE_) || defined(_IRR_LINUX_X11_RANDR_)
s32 eventbase, errorbase; s32 eventbase, errorbase;
s32 defaultDepth=DefaultDepth(display,screennr); s32 defaultDepth=DefaultDepth(XDisplay,Screennr);
#endif #endif
#ifdef _IRR_LINUX_X11_VIDMODE_ #ifdef _IRR_LINUX_X11_VIDMODE_
if (XF86VidModeQueryExtension(display, &eventbase, &errorbase)) if (XF86VidModeQueryExtension(XDisplay, &eventbase, &errorbase))
{ {
// enumerate video modes // enumerate video modes
int modeCount; int modeCount;
XF86VidModeModeInfo** modes; XF86VidModeModeInfo** modes;
XF86VidModeGetAllModeLines(display, screennr, &modeCount, &modes); XF86VidModeGetAllModeLines(XDisplay, Screennr, &modeCount, &modes);
// save current video mode // save current video mode
oldVideoMode = *modes[0]; OldVideoMode = *modes[0];
// find fitting mode // find fitting mode
...@@ -1543,14 +1543,14 @@ video::IVideoModeList* CIrrDeviceLinux::getVideoModeList() ...@@ -1543,14 +1543,14 @@ video::IVideoModeList* CIrrDeviceLinux::getVideoModeList()
else else
#endif #endif
#ifdef _IRR_LINUX_X11_RANDR_ #ifdef _IRR_LINUX_X11_RANDR_
if (XRRQueryExtension(display, &eventbase, &errorbase)) if (XRRQueryExtension(XDisplay, &eventbase, &errorbase))
{ {
int modeCount; int modeCount;
XRRScreenConfiguration *config=XRRGetScreenInfo(display,DefaultRootWindow(display)); XRRScreenConfiguration *config=XRRGetScreenInfo(XDisplay,DefaultRootWindow(XDisplay));
oldRandrMode=XRRConfigCurrentConfiguration(config,&oldRandrRotation); OldRandrMode=XRRConfigCurrentConfiguration(config,&OldRandrRotation);
XRRScreenSize *modes=XRRConfigSizes(config,&modeCount); XRRScreenSize *modes=XRRConfigSizes(config,&modeCount);
VideoModeList->setDesktop(defaultDepth, core::dimension2d<u32>( VideoModeList->setDesktop(defaultDepth, core::dimension2d<u32>(
modes[oldRandrMode].width, modes[oldRandrMode].height)); modes[OldRandrMode].width, modes[OldRandrMode].height));
for (int i = 0; i<modeCount; ++i) for (int i = 0; i<modeCount; ++i)
{ {
VideoModeList->addMode(core::dimension2d<u32>( VideoModeList->addMode(core::dimension2d<u32>(
...@@ -1564,10 +1564,10 @@ video::IVideoModeList* CIrrDeviceLinux::getVideoModeList() ...@@ -1564,10 +1564,10 @@ video::IVideoModeList* CIrrDeviceLinux::getVideoModeList()
os::Printer::log("VidMode or RandR X11 extension requireed for VideoModeList." , ELL_WARNING); os::Printer::log("VidMode or RandR X11 extension requireed for VideoModeList." , ELL_WARNING);
} }
} }
if (display && temporaryDisplay) if (XDisplay && temporaryDisplay)
{ {
XCloseDisplay(display); XCloseDisplay(XDisplay);
display=0; XDisplay=0;
} }
} }
#endif #endif
...@@ -1580,7 +1580,7 @@ video::IVideoModeList* CIrrDeviceLinux::getVideoModeList() ...@@ -1580,7 +1580,7 @@ video::IVideoModeList* CIrrDeviceLinux::getVideoModeList()
void CIrrDeviceLinux::minimizeWindow() void CIrrDeviceLinux::minimizeWindow()
{ {
#ifdef _IRR_COMPILE_WITH_X11_ #ifdef _IRR_COMPILE_WITH_X11_
XIconifyWindow(display, window, screennr); XIconifyWindow(XDisplay, XWindow, Screennr);
#endif #endif
} }
...@@ -1589,7 +1589,7 @@ void CIrrDeviceLinux::minimizeWindow() ...@@ -1589,7 +1589,7 @@ void CIrrDeviceLinux::minimizeWindow()
void CIrrDeviceLinux::maximizeWindow() void CIrrDeviceLinux::maximizeWindow()
{ {
#ifdef _IRR_COMPILE_WITH_X11_ #ifdef _IRR_COMPILE_WITH_X11_
XMapWindow(display, window); XMapWindow(XDisplay, XWindow);
#endif #endif
} }
...@@ -1598,7 +1598,7 @@ void CIrrDeviceLinux::maximizeWindow() ...@@ -1598,7 +1598,7 @@ void CIrrDeviceLinux::maximizeWindow()
void CIrrDeviceLinux::restoreWindow() void CIrrDeviceLinux::restoreWindow()
{ {
#ifdef _IRR_COMPILE_WITH_X11_ #ifdef _IRR_COMPILE_WITH_X11_
XMapWindow(display, window); XMapWindow(XDisplay, XWindow);
#endif #endif
} }
...@@ -1606,7 +1606,7 @@ core::position2di CIrrDeviceLinux::getWindowPosition() ...@@ -1606,7 +1606,7 @@ core::position2di CIrrDeviceLinux::getWindowPosition()
{ {
int wx = 0, wy = 0; int wx = 0, wy = 0;
Window child; Window child;
XTranslateCoordinates(display, window, DefaultRootWindow(display), 0, 0, &wx, &wy, &child); XTranslateCoordinates(XDisplay, XWindow, DefaultRootWindow(XDisplay), 0, 0, &wx, &wy, &child);
return core::position2di(wx, wy); return core::position2di(wx, wy);
} }
...@@ -1954,13 +1954,13 @@ bool CIrrDeviceLinux::setGammaRamp( f32 red, f32 green, f32 blue, f32 brightness ...@@ -1954,13 +1954,13 @@ bool CIrrDeviceLinux::setGammaRamp( f32 red, f32 green, f32 blue, f32 brightness
#if defined(_IRR_LINUX_X11_VIDMODE_) || defined(_IRR_LINUX_X11_RANDR_) #if defined(_IRR_LINUX_X11_VIDMODE_) || defined(_IRR_LINUX_X11_RANDR_)
s32 eventbase, errorbase; s32 eventbase, errorbase;
#ifdef _IRR_LINUX_X11_VIDMODE_ #ifdef _IRR_LINUX_X11_VIDMODE_
if (XF86VidModeQueryExtension(display, &eventbase, &errorbase)) if (XF86VidModeQueryExtension(XDisplay, &eventbase, &errorbase))
{ {
XF86VidModeGamma gamma; XF86VidModeGamma gamma;
gamma.red=red; gamma.red=red;
gamma.green=green; gamma.green=green;
gamma.blue=blue; gamma.blue=blue;
XF86VidModeSetGamma(display, screennr, &gamma); XF86VidModeSetGamma(XDisplay, Screennr, &gamma);
return true; return true;
} }
#endif #endif
...@@ -1968,19 +1968,19 @@ bool CIrrDeviceLinux::setGammaRamp( f32 red, f32 green, f32 blue, f32 brightness ...@@ -1968,19 +1968,19 @@ bool CIrrDeviceLinux::setGammaRamp( f32 red, f32 green, f32 blue, f32 brightness
else else
#endif #endif
#ifdef _IRR_LINUX_X11_RANDR_ #ifdef _IRR_LINUX_X11_RANDR_
if (XRRQueryExtension(display, &eventbase, &errorbase)) if (XRRQueryExtension(XDisplay, &eventbase, &errorbase))
{ {
XRRQueryVersion(display, &eventbase, &errorbase); // major, minor XRRQueryVersion(XDisplay, &eventbase, &errorbase); // major, minor
if (eventbase>=1 && errorbase>1) if (eventbase>=1 && errorbase>1)
{ {
#if (RANDR_MAJOR>1 || RANDR_MINOR>1) #if (RANDR_MAJOR>1 || RANDR_MINOR>1)
XRRCrtcGamma *gamma = XRRGetCrtcGamma(display, screennr); XRRCrtcGamma *gamma = XRRGetCrtcGamma(XDisplay, Screennr);
if (gamma) if (gamma)
{ {
*gamma->red=(u16)red; *gamma->red=(u16)red;
*gamma->green=(u16)green; *gamma->green=(u16)green;
*gamma->blue=(u16)blue; *gamma->blue=(u16)blue;
XRRSetCrtcGamma(display, screennr, gamma); XRRSetCrtcGamma(XDisplay, Screennr, gamma);
XRRFreeGamma(gamma); XRRFreeGamma(gamma);
return true; return true;
} }
...@@ -2001,10 +2001,10 @@ bool CIrrDeviceLinux::getGammaRamp( f32 &red, f32 &green, f32 &blue, f32 &bright ...@@ -2001,10 +2001,10 @@ bool CIrrDeviceLinux::getGammaRamp( f32 &red, f32 &green, f32 &blue, f32 &bright
#if defined(_IRR_LINUX_X11_VIDMODE_) || defined(_IRR_LINUX_X11_RANDR_) #if defined(_IRR_LINUX_X11_VIDMODE_) || defined(_IRR_LINUX_X11_RANDR_)
s32 eventbase, errorbase; s32 eventbase, errorbase;
#ifdef _IRR_LINUX_X11_VIDMODE_ #ifdef _IRR_LINUX_X11_VIDMODE_
if (XF86VidModeQueryExtension(display, &eventbase, &errorbase)) if (XF86VidModeQueryExtension(XDisplay, &eventbase, &errorbase))
{ {
XF86VidModeGamma gamma; XF86VidModeGamma gamma;
XF86VidModeGetGamma(display, screennr, &gamma); XF86VidModeGetGamma(XDisplay, Screennr, &gamma);
red = gamma.red; red = gamma.red;
green = gamma.green; green = gamma.green;
blue = gamma.blue; blue = gamma.blue;
...@@ -2015,13 +2015,13 @@ bool CIrrDeviceLinux::getGammaRamp( f32 &red, f32 &green, f32 &blue, f32 &bright ...@@ -2015,13 +2015,13 @@ bool CIrrDeviceLinux::getGammaRamp( f32 &red, f32 &green, f32 &blue, f32 &bright
else else
#endif #endif
#ifdef _IRR_LINUX_X11_RANDR_ #ifdef _IRR_LINUX_X11_RANDR_
if (XRRQueryExtension(display, &eventbase, &errorbase)) if (XRRQueryExtension(XDisplay, &eventbase, &errorbase))
{ {
XRRQueryVersion(display, &eventbase, &errorbase); // major, minor XRRQueryVersion(XDisplay, &eventbase, &errorbase); // major, minor
if (eventbase>=1 && errorbase>1) if (eventbase>=1 && errorbase>1)
{ {
#if (RANDR_MAJOR>1 || RANDR_MINOR>1) #if (RANDR_MAJOR>1 || RANDR_MINOR>1)
XRRCrtcGamma *gamma = XRRGetCrtcGamma(display, screennr); XRRCrtcGamma *gamma = XRRGetCrtcGamma(XDisplay, Screennr);
if (gamma) if (gamma)
{ {
red = *gamma->red; red = *gamma->red;
...@@ -2044,23 +2044,23 @@ bool CIrrDeviceLinux::getGammaRamp( f32 &red, f32 &green, f32 &blue, f32 &bright ...@@ -2044,23 +2044,23 @@ bool CIrrDeviceLinux::getGammaRamp( f32 &red, f32 &green, f32 &blue, f32 &bright
const c8* CIrrDeviceLinux::getTextFromClipboard() const const c8* CIrrDeviceLinux::getTextFromClipboard() const
{ {
#if defined(_IRR_COMPILE_WITH_X11_) #if defined(_IRR_COMPILE_WITH_X11_)
Window ownerWindow = XGetSelectionOwner (display, X_ATOM_CLIPBOARD); Window ownerWindow = XGetSelectionOwner (XDisplay, X_ATOM_CLIPBOARD);
if ( ownerWindow == window ) if ( ownerWindow == XWindow )
{ {
return Clipboard.c_str(); return Clipboard.c_str();
} }
Clipboard = ""; Clipboard = "";
if (ownerWindow != None ) if (ownerWindow != None )
{ {
XConvertSelection (display, X_ATOM_CLIPBOARD, XA_STRING, None, ownerWindow, CurrentTime); XConvertSelection (XDisplay, X_ATOM_CLIPBOARD, XA_STRING, None, ownerWindow, CurrentTime);
XFlush (display); XFlush (XDisplay);
// check for data // check for data
Atom type; Atom type;
int format; int format;
unsigned long numItems, bytesLeft, dummy; unsigned long numItems, bytesLeft, dummy;
unsigned char *data; unsigned char *data;
XGetWindowProperty (display, ownerWindow, XGetWindowProperty (XDisplay, ownerWindow,
XA_STRING, // property name XA_STRING, // property name
0, // offset 0, // offset
0, // length (we only check for data, so 0) 0, // length (we only check for data, so 0)
...@@ -2074,7 +2074,7 @@ const c8* CIrrDeviceLinux::getTextFromClipboard() const ...@@ -2074,7 +2074,7 @@ const c8* CIrrDeviceLinux::getTextFromClipboard() const
if ( bytesLeft > 0 ) if ( bytesLeft > 0 )
{ {
// there is some data to get // there is some data to get
int result = XGetWindowProperty (display, ownerWindow, XA_STRING, 0, int result = XGetWindowProperty (XDisplay, ownerWindow, XA_STRING, 0,
bytesLeft, 0, AnyPropertyType, &type, &format, bytesLeft, 0, AnyPropertyType, &type, &format,
&numItems, &dummy, &data); &numItems, &dummy, &data);
if (result == Success) if (result == Success)
...@@ -2097,8 +2097,8 @@ void CIrrDeviceLinux::copyToClipboard(const c8* text) const ...@@ -2097,8 +2097,8 @@ void CIrrDeviceLinux::copyToClipboard(const c8* text) const
// Actually there is no clipboard on X but applications just say they own the clipboard and return text when asked. // Actually there is no clipboard on X but applications just say they own the clipboard and return text when asked.
// Which btw. also means that on X you lose clipboard content when closing applications. // Which btw. also means that on X you lose clipboard content when closing applications.
Clipboard = text; Clipboard = text;
XSetSelectionOwner (display, X_ATOM_CLIPBOARD, window, CurrentTime); XSetSelectionOwner (XDisplay, X_ATOM_CLIPBOARD, XWindow, CurrentTime);
XFlush (display); XFlush (XDisplay);
#endif #endif
} }
...@@ -2123,15 +2123,15 @@ void CIrrDeviceLinux::clearSystemMessages() ...@@ -2123,15 +2123,15 @@ void CIrrDeviceLinux::clearSystemMessages()
{ {
XEvent event; XEvent event;
int usrArg = ButtonPress; int usrArg = ButtonPress;
while ( XCheckIfEvent(display, &event, PredicateIsEventType, XPointer(&usrArg)) == True ) {} while ( XCheckIfEvent(XDisplay, &event, PredicateIsEventType, XPointer(&usrArg)) == True ) {}
usrArg = ButtonRelease; usrArg = ButtonRelease;
while ( XCheckIfEvent(display, &event, PredicateIsEventType, XPointer(&usrArg)) == True ) {} while ( XCheckIfEvent(XDisplay, &event, PredicateIsEventType, XPointer(&usrArg)) == True ) {}
usrArg = MotionNotify; usrArg = MotionNotify;
while ( XCheckIfEvent(display, &event, PredicateIsEventType, XPointer(&usrArg)) == True ) {} while ( XCheckIfEvent(XDisplay, &event, PredicateIsEventType, XPointer(&usrArg)) == True ) {}
usrArg = KeyRelease; usrArg = KeyRelease;
while ( XCheckIfEvent(display, &event, PredicateIsEventType, XPointer(&usrArg)) == True ) {} while ( XCheckIfEvent(XDisplay, &event, PredicateIsEventType, XPointer(&usrArg)) == True ) {}
usrArg = KeyPress; usrArg = KeyPress;
while ( XCheckIfEvent(display, &event, PredicateIsEventType, XPointer(&usrArg)) == True ) {} while ( XCheckIfEvent(XDisplay, &event, PredicateIsEventType, XPointer(&usrArg)) == True ) {}
} }
#endif //_IRR_COMPILE_WITH_X11_ #endif //_IRR_COMPILE_WITH_X11_
} }
...@@ -2139,10 +2139,10 @@ void CIrrDeviceLinux::clearSystemMessages() ...@@ -2139,10 +2139,10 @@ void CIrrDeviceLinux::clearSystemMessages()
void CIrrDeviceLinux::initXAtoms() void CIrrDeviceLinux::initXAtoms()
{ {
#ifdef _IRR_COMPILE_WITH_X11_ #ifdef _IRR_COMPILE_WITH_X11_
X_ATOM_CLIPBOARD = XInternAtom(display, "CLIPBOARD", False); X_ATOM_CLIPBOARD = XInternAtom(XDisplay, "CLIPBOARD", False);
X_ATOM_TARGETS = XInternAtom(display, "TARGETS", False); X_ATOM_TARGETS = XInternAtom(XDisplay, "TARGETS", False);
X_ATOM_UTF8_STRING = XInternAtom (display, "UTF8_STRING", False); X_ATOM_UTF8_STRING = XInternAtom (XDisplay, "UTF8_STRING", False);
X_ATOM_TEXT = XInternAtom (display, "TEXT", False); X_ATOM_TEXT = XInternAtom (XDisplay, "TEXT", False);
#endif #endif
} }
...@@ -2151,7 +2151,7 @@ void CIrrDeviceLinux::initXAtoms() ...@@ -2151,7 +2151,7 @@ void CIrrDeviceLinux::initXAtoms()
Cursor CIrrDeviceLinux::TextureToMonochromeCursor(irr::video::ITexture * tex, const core::rect<s32>& sourceRect, const core::position2d<s32> &hotspot) Cursor CIrrDeviceLinux::TextureToMonochromeCursor(irr::video::ITexture * tex, const core::rect<s32>& sourceRect, const core::position2d<s32> &hotspot)
{ {
XImage * sourceImage = XCreateImage(display, visual->visual, XImage * sourceImage = XCreateImage(XDisplay, VisualInfo->visual,
1, // depth, 1, // depth,
ZPixmap, // XYBitmap (depth=1), ZPixmap(depth=x) ZPixmap, // XYBitmap (depth=1), ZPixmap(depth=x)
0, 0, sourceRect.getWidth(), sourceRect.getHeight(), 0, 0, sourceRect.getWidth(), sourceRect.getHeight(),
...@@ -2159,7 +2159,7 @@ Cursor CIrrDeviceLinux::TextureToMonochromeCursor(irr::video::ITexture * tex, co ...@@ -2159,7 +2159,7 @@ Cursor CIrrDeviceLinux::TextureToMonochromeCursor(irr::video::ITexture * tex, co
0// bytes_per_line (0 means continuos in memory) 0// bytes_per_line (0 means continuos in memory)
); );
sourceImage->data = new char[sourceImage->height * sourceImage->bytes_per_line]; sourceImage->data = new char[sourceImage->height * sourceImage->bytes_per_line];
XImage * maskImage = XCreateImage(display, visual->visual, XImage * maskImage = XCreateImage(XDisplay, VisualInfo->visual,
1, // depth, 1, // depth,
ZPixmap, ZPixmap,
0, 0, sourceRect.getWidth(), sourceRect.getHeight(), 0, 0, sourceRect.getWidth(), sourceRect.getHeight(),
...@@ -2202,18 +2202,18 @@ Cursor CIrrDeviceLinux::TextureToMonochromeCursor(irr::video::ITexture * tex, co ...@@ -2202,18 +2202,18 @@ Cursor CIrrDeviceLinux::TextureToMonochromeCursor(irr::video::ITexture * tex, co
} }
tex->unlock(); tex->unlock();
Pixmap sourcePixmap = XCreatePixmap(display, window, sourceImage->width, sourceImage->height, sourceImage->depth); Pixmap sourcePixmap = XCreatePixmap(XDisplay, XWindow, sourceImage->width, sourceImage->height, sourceImage->depth);
Pixmap maskPixmap = XCreatePixmap(display, window, maskImage->width, maskImage->height, maskImage->depth); Pixmap maskPixmap = XCreatePixmap(XDisplay, XWindow, maskImage->width, maskImage->height, maskImage->depth);
XGCValues values; XGCValues values;
values.foreground = 1; values.foreground = 1;
values.background = 1; values.background = 1;
GC gc = XCreateGC( display, sourcePixmap, GCForeground | GCBackground, &values ); GC gc = XCreateGC( XDisplay, sourcePixmap, GCForeground | GCBackground, &values );
XPutImage(display, sourcePixmap, gc, sourceImage, 0, 0, 0, 0, sourceImage->width, sourceImage->height); XPutImage(XDisplay, sourcePixmap, gc, sourceImage, 0, 0, 0, 0, sourceImage->width, sourceImage->height);
XPutImage(display, maskPixmap, gc, maskImage, 0, 0, 0, 0, maskImage->width, maskImage->height); XPutImage(XDisplay, maskPixmap, gc, maskImage, 0, 0, 0, 0, maskImage->width, maskImage->height);
XFreeGC(display, gc); XFreeGC(XDisplay, gc);
XDestroyImage(sourceImage); XDestroyImage(sourceImage);
XDestroyImage(maskImage); XDestroyImage(maskImage);
...@@ -2228,10 +2228,10 @@ Cursor CIrrDeviceLinux::TextureToMonochromeCursor(irr::video::ITexture * tex, co ...@@ -2228,10 +2228,10 @@ Cursor CIrrDeviceLinux::TextureToMonochromeCursor(irr::video::ITexture * tex, co
background.blue = 0; background.blue = 0;
background.flags = DoRed | DoGreen | DoBlue; background.flags = DoRed | DoGreen | DoBlue;
cursorResult = XCreatePixmapCursor(display, sourcePixmap, maskPixmap, &foreground, &background, hotspot.X, hotspot.Y); cursorResult = XCreatePixmapCursor(XDisplay, sourcePixmap, maskPixmap, &foreground, &background, hotspot.X, hotspot.Y);
XFreePixmap(display, sourcePixmap); XFreePixmap(XDisplay, sourcePixmap);
XFreePixmap(display, maskPixmap); XFreePixmap(XDisplay, maskPixmap);
return cursorResult; return cursorResult;
} }
...@@ -2267,7 +2267,7 @@ Cursor CIrrDeviceLinux::TextureToARGBCursor(irr::video::ITexture * tex, const co ...@@ -2267,7 +2267,7 @@ Cursor CIrrDeviceLinux::TextureToARGBCursor(irr::video::ITexture * tex, const co
} }
tex->unlock(); tex->unlock();
Cursor cursorResult=XcursorImageLoadCursor(display, image); Cursor cursorResult=XcursorImageLoadCursor(XDisplay, image);
XcursorImageDestroy(image); XcursorImageDestroy(image);
...@@ -2290,7 +2290,7 @@ Cursor CIrrDeviceLinux::TextureToCursor(irr::video::ITexture * tex, const core:: ...@@ -2290,7 +2290,7 @@ Cursor CIrrDeviceLinux::TextureToCursor(irr::video::ITexture * tex, const core::
CIrrDeviceLinux::CCursorControl::CCursorControl(CIrrDeviceLinux* dev, bool null) CIrrDeviceLinux::CCursorControl::CCursorControl(CIrrDeviceLinux* dev, bool null)
: Device(dev) : Device(dev)
#ifdef _IRR_COMPILE_WITH_X11_ #ifdef _IRR_COMPILE_WITH_X11_
, PlatformBehavior(gui::ECPB_NONE), lastQuery(0) , PlatformBehavior(gui::ECPB_NONE), LastQuery(0)
#endif #endif
, IsVisible(true), Null(null), UseReferenceRect(false) , IsVisible(true), Null(null), UseReferenceRect(false)
, ActiveIcon(gui::ECI_NORMAL), ActiveIconStartTime(0) , ActiveIcon(gui::ECI_NORMAL), ActiveIconStartTime(0)
...@@ -2307,22 +2307,22 @@ CIrrDeviceLinux::CCursorControl::CCursorControl(CIrrDeviceLinux* dev, bool null) ...@@ -2307,22 +2307,22 @@ CIrrDeviceLinux::CCursorControl::CCursorControl(CIrrDeviceLinux* dev, bool null)
// Sirshane, thank your very much! // Sirshane, thank your very much!
Pixmap invisBitmap = XCreatePixmap(Device->display, Device->window, 32, 32, 1); Pixmap invisBitmap = XCreatePixmap(Device->XDisplay, Device->XWindow, 32, 32, 1);
Pixmap maskBitmap = XCreatePixmap(Device->display, Device->window, 32, 32, 1); Pixmap maskBitmap = XCreatePixmap(Device->XDisplay, Device->XWindow, 32, 32, 1);
Colormap screen_colormap = DefaultColormap( Device->display, DefaultScreen( Device->display ) ); Colormap screen_colormap = DefaultColormap( Device->XDisplay, DefaultScreen( Device->XDisplay ) );
XAllocNamedColor( Device->display, screen_colormap, "black", &fg, &fg ); XAllocNamedColor( Device->XDisplay, screen_colormap, "black", &fg, &fg );
XAllocNamedColor( Device->display, screen_colormap, "white", &bg, &bg ); XAllocNamedColor( Device->XDisplay, screen_colormap, "white", &bg, &bg );
GC gc = XCreateGC( Device->display, invisBitmap, valuemask, &values ); GC gc = XCreateGC( Device->XDisplay, invisBitmap, valuemask, &values );
XSetForeground( Device->display, gc, BlackPixel( Device->display, DefaultScreen( Device->display ) ) ); XSetForeground( Device->XDisplay, gc, BlackPixel( Device->XDisplay, DefaultScreen( Device->XDisplay ) ) );
XFillRectangle( Device->display, invisBitmap, gc, 0, 0, 32, 32 ); XFillRectangle( Device->XDisplay, invisBitmap, gc, 0, 0, 32, 32 );
XFillRectangle( Device->display, maskBitmap, gc, 0, 0, 32, 32 ); XFillRectangle( Device->XDisplay, maskBitmap, gc, 0, 0, 32, 32 );
invisCursor = XCreatePixmapCursor( Device->display, invisBitmap, maskBitmap, &fg, &bg, 1, 1 ); InvisCursor = XCreatePixmapCursor( Device->XDisplay, invisBitmap, maskBitmap, &fg, &bg, 1, 1 );
XFreeGC(Device->display, gc); XFreeGC(Device->XDisplay, gc);
XFreePixmap(Device->display, invisBitmap); XFreePixmap(Device->XDisplay, invisBitmap);
XFreePixmap(Device->display, maskBitmap); XFreePixmap(Device->XDisplay, maskBitmap);
initCursors(); initCursors();
} }
...@@ -2339,31 +2339,31 @@ CIrrDeviceLinux::CCursorControl::~CCursorControl() ...@@ -2339,31 +2339,31 @@ CIrrDeviceLinux::CCursorControl::~CCursorControl()
void CIrrDeviceLinux::CCursorControl::clearCursors() void CIrrDeviceLinux::CCursorControl::clearCursors()
{ {
if (!Null) if (!Null)
XFreeCursor(Device->display, invisCursor); XFreeCursor(Device->XDisplay, InvisCursor);
for ( u32 i=0; i < Cursors.size(); ++i ) for ( u32 i=0; i < Cursors.size(); ++i )
{ {
for ( u32 f=0; f < Cursors[i].Frames.size(); ++f ) for ( u32 f=0; f < Cursors[i].Frames.size(); ++f )
{ {
XFreeCursor(Device->display, Cursors[i].Frames[f].IconHW); XFreeCursor(Device->XDisplay, Cursors[i].Frames[f].IconHW);
} }
} }
} }
void CIrrDeviceLinux::CCursorControl::initCursors() void CIrrDeviceLinux::CCursorControl::initCursors()
{ {
Cursors.push_back( CursorX11(XCreateFontCursor(Device->display, XC_top_left_arrow)) ); // (or XC_arrow?) Cursors.push_back( CursorX11(XCreateFontCursor(Device->XDisplay, XC_top_left_arrow)) ); // (or XC_arrow?)
Cursors.push_back( CursorX11(XCreateFontCursor(Device->display, XC_crosshair)) ); Cursors.push_back( CursorX11(XCreateFontCursor(Device->XDisplay, XC_crosshair)) );
Cursors.push_back( CursorX11(XCreateFontCursor(Device->display, XC_hand2)) ); // (or XC_hand1? ) Cursors.push_back( CursorX11(XCreateFontCursor(Device->XDisplay, XC_hand2)) ); // (or XC_hand1? )
Cursors.push_back( CursorX11(XCreateFontCursor(Device->display, XC_question_arrow)) ); Cursors.push_back( CursorX11(XCreateFontCursor(Device->XDisplay, XC_question_arrow)) );
Cursors.push_back( CursorX11(XCreateFontCursor(Device->display, XC_xterm)) ); Cursors.push_back( CursorX11(XCreateFontCursor(Device->XDisplay, XC_xterm)) );
Cursors.push_back( CursorX11(XCreateFontCursor(Device->display, XC_X_cursor)) ); // (or XC_pirate?) Cursors.push_back( CursorX11(XCreateFontCursor(Device->XDisplay, XC_X_cursor)) ); // (or XC_pirate?)
Cursors.push_back( CursorX11(XCreateFontCursor(Device->display, XC_watch)) ); // (or XC_clock?) Cursors.push_back( CursorX11(XCreateFontCursor(Device->XDisplay, XC_watch)) ); // (or XC_clock?)
Cursors.push_back( CursorX11(XCreateFontCursor(Device->display, XC_fleur)) ); Cursors.push_back( CursorX11(XCreateFontCursor(Device->XDisplay, XC_fleur)) );
Cursors.push_back( CursorX11(XCreateFontCursor(Device->display, XC_top_right_corner)) ); // NESW not available in X11 Cursors.push_back( CursorX11(XCreateFontCursor(Device->XDisplay, XC_top_right_corner)) ); // NESW not available in X11
Cursors.push_back( CursorX11(XCreateFontCursor(Device->display, XC_top_left_corner)) ); // NWSE not available in X11 Cursors.push_back( CursorX11(XCreateFontCursor(Device->XDisplay, XC_top_left_corner)) ); // NWSE not available in X11
Cursors.push_back( CursorX11(XCreateFontCursor(Device->display, XC_sb_v_double_arrow)) ); Cursors.push_back( CursorX11(XCreateFontCursor(Device->XDisplay, XC_sb_v_double_arrow)) );
Cursors.push_back( CursorX11(XCreateFontCursor(Device->display, XC_sb_h_double_arrow)) ); Cursors.push_back( CursorX11(XCreateFontCursor(Device->XDisplay, XC_sb_h_double_arrow)) );
Cursors.push_back( CursorX11(XCreateFontCursor(Device->display, XC_sb_up_arrow)) ); // (or XC_center_ptr?) Cursors.push_back( CursorX11(XCreateFontCursor(Device->XDisplay, XC_sb_up_arrow)) ); // (or XC_center_ptr?)
} }
void CIrrDeviceLinux::CCursorControl::update() void CIrrDeviceLinux::CCursorControl::update()
...@@ -2373,7 +2373,7 @@ void CIrrDeviceLinux::CCursorControl::update() ...@@ -2373,7 +2373,7 @@ void CIrrDeviceLinux::CCursorControl::update()
// update animated cursors. This could also be done by X11 in case someone wants to figure that out (this way was just easier to implement) // update animated cursors. This could also be done by X11 in case someone wants to figure that out (this way was just easier to implement)
u32 now = Device->getTimer()->getRealTime(); u32 now = Device->getTimer()->getRealTime();
u32 frame = ((now - ActiveIconStartTime) / Cursors[ActiveIcon].FrameTime) % Cursors[ActiveIcon].Frames.size(); u32 frame = ((now - ActiveIconStartTime) / Cursors[ActiveIcon].FrameTime) % Cursors[ActiveIcon].Frames.size();
XDefineCursor(Device->display, Device->window, Cursors[ActiveIcon].Frames[frame].IconHW); XDefineCursor(Device->XDisplay, Device->XWindow, Cursors[ActiveIcon].Frames[frame].IconHW);
} }
} }
#endif #endif
...@@ -2386,7 +2386,7 @@ void CIrrDeviceLinux::CCursorControl::setActiveIcon(gui::ECURSOR_ICON iconId) ...@@ -2386,7 +2386,7 @@ void CIrrDeviceLinux::CCursorControl::setActiveIcon(gui::ECURSOR_ICON iconId)
return; return;
if ( Cursors[iconId].Frames.size() ) if ( Cursors[iconId].Frames.size() )
XDefineCursor(Device->display, Device->window, Cursors[iconId].Frames[0].IconHW); XDefineCursor(Device->XDisplay, Device->XWindow, Cursors[iconId].Frames[0].IconHW);
ActiveIconStartTime = Device->getTimer()->getRealTime(); ActiveIconStartTime = Device->getTimer()->getRealTime();
ActiveIcon = iconId; ActiveIcon = iconId;
...@@ -2427,7 +2427,7 @@ void CIrrDeviceLinux::CCursorControl::changeIcon(gui::ECURSOR_ICON iconId, const ...@@ -2427,7 +2427,7 @@ void CIrrDeviceLinux::CCursorControl::changeIcon(gui::ECURSOR_ICON iconId, const
return; return;
for ( u32 i=0; i < Cursors[iconId].Frames.size(); ++i ) for ( u32 i=0; i < Cursors[iconId].Frames.size(); ++i )
XFreeCursor(Device->display, Cursors[iconId].Frames[i].IconHW); XFreeCursor(Device->XDisplay, Cursors[iconId].Frames[i].IconHW);
if ( icon.SpriteId >= 0 ) if ( icon.SpriteId >= 0 )
{ {
...@@ -2452,7 +2452,7 @@ irr::core::dimension2di CIrrDeviceLinux::CCursorControl::getSupportedIconSize() ...@@ -2452,7 +2452,7 @@ irr::core::dimension2di CIrrDeviceLinux::CCursorControl::getSupportedIconSize()
// this returns the closest match that is smaller or same size, so we just pass a value which should be large enough for cursors // this returns the closest match that is smaller or same size, so we just pass a value which should be large enough for cursors
unsigned int width=0, height=0; unsigned int width=0, height=0;
#ifdef _IRR_COMPILE_WITH_X11_ #ifdef _IRR_COMPILE_WITH_X11_
XQueryBestCursor(Device->display, Device->window, 64, 64, &width, &height); XQueryBestCursor(Device->XDisplay, Device->XWindow, 64, 64, &width, &height);
#endif #endif
return core::dimension2di(width, height); return core::dimension2di(width, height);
} }
......
...@@ -182,9 +182,9 @@ namespace irr ...@@ -182,9 +182,9 @@ namespace irr
if (!Null) if (!Null)
{ {
if ( !IsVisible ) if ( !IsVisible )
XDefineCursor( Device->display, Device->window, invisCursor ); XDefineCursor( Device->XDisplay, Device->XWindow, InvisCursor );
else else
XUndefineCursor( Device->display, Device->window ); XUndefineCursor( Device->XDisplay, Device->XWindow );
} }
#endif #endif
} }
...@@ -222,9 +222,9 @@ namespace irr ...@@ -222,9 +222,9 @@ namespace irr
{ {
if (UseReferenceRect) if (UseReferenceRect)
{ {
XWarpPointer(Device->display, XWarpPointer(Device->XDisplay,
None, None,
Device->window, 0, 0, Device->XWindow, 0, 0,
Device->Width, Device->Width,
Device->Height, Device->Height,
ReferenceRect.UpperLeftCorner.X + x, ReferenceRect.UpperLeftCorner.X + x,
...@@ -233,13 +233,13 @@ namespace irr ...@@ -233,13 +233,13 @@ namespace irr
} }
else else
{ {
XWarpPointer(Device->display, XWarpPointer(Device->XDisplay,
None, None,
Device->window, 0, 0, Device->XWindow, 0, 0,
Device->Width, Device->Width,
Device->Height, x, y); Device->Height, x, y);
} }
XFlush(Device->display); XFlush(Device->XDisplay);
} }
#endif #endif
CursorPos.X = x; CursorPos.X = x;
...@@ -326,15 +326,15 @@ namespace irr ...@@ -326,15 +326,15 @@ namespace irr
if ( PlatformBehavior&gui::ECPB_X11_CACHE_UPDATES && !os::Timer::isStopped() ) if ( PlatformBehavior&gui::ECPB_X11_CACHE_UPDATES && !os::Timer::isStopped() )
{ {
u32 now = os::Timer::getTime(); u32 now = os::Timer::getTime();
if (now <= lastQuery) if (now <= LastQuery)
return; return;
lastQuery = now; LastQuery = now;
} }
Window tmp; Window tmp;
int itmp1, itmp2; int itmp1, itmp2;
unsigned int maskreturn; unsigned int maskreturn;
XQueryPointer(Device->display, Device->window, XQueryPointer(Device->XDisplay, Device->XWindow,
&tmp, &tmp, &tmp, &tmp,
&itmp1, &itmp2, &itmp1, &itmp2,
&CursorPos.X, &CursorPos.Y, &maskreturn); &CursorPos.X, &CursorPos.Y, &maskreturn);
...@@ -355,8 +355,8 @@ namespace irr ...@@ -355,8 +355,8 @@ namespace irr
core::rect<s32> ReferenceRect; core::rect<s32> ReferenceRect;
#ifdef _IRR_COMPILE_WITH_X11_ #ifdef _IRR_COMPILE_WITH_X11_
gui::ECURSOR_PLATFORM_BEHAVIOR PlatformBehavior; gui::ECURSOR_PLATFORM_BEHAVIOR PlatformBehavior;
u32 lastQuery; u32 LastQuery;
Cursor invisCursor; Cursor InvisCursor;
struct CursorFrameX11 struct CursorFrameX11
{ {
...@@ -393,25 +393,25 @@ namespace irr ...@@ -393,25 +393,25 @@ namespace irr
#ifdef _IRR_COMPILE_WITH_X11_ #ifdef _IRR_COMPILE_WITH_X11_
friend class COpenGLDriver; friend class COpenGLDriver;
Display *display; Display *XDisplay;
XVisualInfo* visual; XVisualInfo* VisualInfo;
int screennr; int Screennr;
Window window; Window XWindow;
XSetWindowAttributes attributes; XSetWindowAttributes WndAttributes;
XSizeHints* StdHints; XSizeHints* StdHints;
XImage* SoftwareImage; XImage* SoftwareImage;
XIM XInputMethod; XIM XInputMethod;
XIC XInputContext; XIC XInputContext;
mutable core::stringc Clipboard; mutable core::stringc Clipboard;
#ifdef _IRR_LINUX_X11_VIDMODE_ #ifdef _IRR_LINUX_X11_VIDMODE_
XF86VidModeModeInfo oldVideoMode; XF86VidModeModeInfo OldVideoMode;
#endif #endif
#ifdef _IRR_LINUX_X11_RANDR_ #ifdef _IRR_LINUX_X11_RANDR_
SizeID oldRandrMode; SizeID OldRandrMode;
Rotation oldRandrRotation; Rotation OldRandrRotation;
#endif #endif
#ifdef _IRR_COMPILE_WITH_OPENGL_ #ifdef _IRR_COMPILE_WITH_OPENGL_
GLXWindow glxWin; GLXWindow GlxWin;
GLXContext Context; GLXContext Context;
#endif #endif
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment