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