Merge revision 4743:4745 from trunk to ogl-es (could not do a compile check for this as I have no egl environment set-up).

- Cleanup - membervariables start with uppercase letters. No good deed goes unpunished - that was no fun to merge.
- Fix typo.


git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@4835 dfc29bdd-3216-0410-991c-e03cc46cb475
master
cutealien 2014-05-08 15:10:42 +00:00
parent 7df315e8e1
commit cb5e99dade
4 changed files with 236 additions and 236 deletions

View File

@ -29,7 +29,7 @@ namespace video
{
CGLXManager::CGLXManager(const SIrrlichtCreationParameters& params, const SExposedVideoData& videodata, int screennr)
: Params(params), PrimaryContext(videodata), visual(0)
: Params(params), PrimaryContext(videodata), VisualInfo(0), glxFBConfig(0), GlxWin(0)
{
#ifdef _DEBUG
setDebugName("CGLXManager");
@ -201,9 +201,9 @@ os::Printer::log("GLX >= 1.3", ELL_DEBUG);
typedef XVisualInfo * ( * PFNGLXGETVISUALFROMFBCONFIGPROC) (Display *dpy, GLXFBConfig config);
PFNGLXGETVISUALFROMFBCONFIGPROC glxGetVisualFromFBConfig= (PFNGLXGETVISUALFROMFBCONFIGPROC)glXGetProcAddress(reinterpret_cast<const GLubyte*>("glXGetVisualFromFBConfig"));
if (glxGetVisualFromFBConfig)
visual = glxGetVisualFromFBConfig(display,(GLXFBConfig)glxFBConfig);
VisualInfo = glxGetVisualFromFBConfig(display,(GLXFBConfig)glxFBConfig);
#else
visual = glXGetVisualFromFBConfig(display,(GLXFBConfig)glxFBConfig);
VisualInfo = glXGetVisualFromFBConfig(display,(GLXFBConfig)glxFBConfig);
#endif
}
}
@ -233,21 +233,21 @@ os::Printer::log("GLX >= 1.3", ELL_DEBUG);
None
};
visual=glXChooseVisual(display, screennr, visualAttrBuffer);
if (!visual)
VisualInfo=glXChooseVisual(display, screennr, visualAttrBuffer);
if (!VisualInfo)
{
if (Params.Stencilbuffer)
os::Printer::log("No stencilbuffer available, disabling.", ELL_WARNING);
Params.Stencilbuffer = !Params.Stencilbuffer;
visualAttrBuffer[13]=Params.Stencilbuffer?1:0;
visual=glXChooseVisual(display, screennr, visualAttrBuffer);
if (!visual && Params.Doublebuffer)
VisualInfo=glXChooseVisual(display, screennr, visualAttrBuffer);
if (!VisualInfo && Params.Doublebuffer)
{
os::Printer::log("No doublebuffering available.", ELL_WARNING);
Params.Doublebuffer=false;
visualAttrBuffer[14] = GLX_USE_GL;
visual=glXChooseVisual(display, screennr, visualAttrBuffer);
VisualInfo=glXChooseVisual(display, screennr, visualAttrBuffer);
}
}
}
@ -287,22 +287,22 @@ bool CGLXManager::generateSurface()
{
if (glxFBConfig)
{
glxWin=glXCreateWindow((Display*)CurrentContext.OpenGLLinux.X11Display,(GLXFBConfig)glxFBConfig,CurrentContext.OpenGLLinux.X11Window,NULL);
if (!glxWin)
GlxWin=glXCreateWindow((Display*)CurrentContext.OpenGLLinux.X11Display,(GLXFBConfig)glxFBConfig,CurrentContext.OpenGLLinux.X11Window,NULL);
if (!GlxWin)
{
os::Printer::log("Could not create GLX window.", ELL_WARNING);
return false;
}
CurrentContext.OpenGLLinux.X11Window=glxWin;
CurrentContext.OpenGLLinux.X11Window=GlxWin;
}
return true;
}
void CGLXManager::destroySurface()
{
if (glxWin)
glXDestroyWindow((Display*)CurrentContext.OpenGLLinux.X11Display, glxWin);
if (GlxWin)
glXDestroyWindow((Display*)CurrentContext.OpenGLLinux.X11Display, GlxWin);
}
bool CGLXManager::generateContext()
@ -311,7 +311,7 @@ bool CGLXManager::generateContext()
if (glxFBConfig)
{
if (glxWin)
if (GlxWin)
{
// create glx context
context = glXCreateNewContext((Display*)CurrentContext.OpenGLLinux.X11Display, (GLXFBConfig)glxFBConfig, GLX_RGBA_TYPE, NULL, True);
@ -329,7 +329,7 @@ bool CGLXManager::generateContext()
}
else
{
context = glXCreateContext((Display*)CurrentContext.OpenGLLinux.X11Display, visual, NULL, True);
context = glXCreateContext((Display*)CurrentContext.OpenGLLinux.X11Display, VisualInfo, NULL, True);
if (!context)
{
os::Printer::log("Could not create GLX rendering context.", ELL_WARNING);
@ -397,7 +397,7 @@ void CGLXManager::destroyContext()
{
if (CurrentContext.OpenGLLinux.X11Context)
{
if (glxWin)
if (GlxWin)
{
if (!glXMakeContextCurrent((Display*)CurrentContext.OpenGLLinux.X11Display, None, None, NULL))
os::Printer::log("Could not release glx context.", ELL_WARNING);

View File

@ -60,15 +60,15 @@ namespace video
// Swap buffers.
bool swapBuffers();
XVisualInfo* getVisual() const {return visual;} // return XVisualInfo
XVisualInfo* getVisual() const {return VisualInfo;} // return XVisualInfo
private:
SIrrlichtCreationParameters Params;
SExposedVideoData PrimaryContext;
SExposedVideoData CurrentContext;
XVisualInfo* visual;
XVisualInfo* VisualInfo;
void* glxFBConfig; // GLXFBConfig
XID glxWin; // GLXWindow
XID GlxWin; // GLXWindow
ECOLOR_FORMAT ColorFormat;
};
}

View File

@ -100,7 +100,7 @@ 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),
#endif
Width(param.WindowSize.Width), Height(param.WindowSize.Height),
@ -189,7 +189,7 @@ CIrrDeviceLinux::~CIrrDeviceLinux()
destroyInputContext();
if (display)
if (XDisplay)
{
if (ContextManager)
{
@ -205,12 +205,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_
@ -251,15 +251,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
@ -273,13 +273,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)
@ -299,8 +299,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
@ -314,10 +314,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)
{
@ -336,7 +336,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);
@ -391,8 +391,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])
@ -402,7 +402,7 @@ bool CIrrDeviceLinux::createWindow()
return false;
}
screennr = DefaultScreen(display);
Screennr = DefaultScreen(XDisplay);
switchToFullscreen();
@ -411,52 +411,52 @@ bool CIrrDeviceLinux::createWindow()
if (CreationParams.DriverType==video::EDT_OPENGL)
{
video::SExposedVideoData data;
data.OpenGLLinux.X11Display = display;
data.OpenGLLinux.X11Display = XDisplay;
ContextManager = new video::CGLXManager(CreationParams,data, screennr);
visual = ((video::CGLXManager*)ContextManager)->getVisual();
VisualInfo = ((video::CGLXManager*)ContextManager)->getVisual();
}
if (!visual)
if (!VisualInfo)
{
// create visual with standard X methods
os::Printer::log("Using plain X visual");
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;
@ -475,46 +475,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;
@ -523,31 +523,31 @@ bool CIrrDeviceLinux::createWindow()
WindowMinimized=false;
// Currently broken in X, see Bug ID 2795321
// XkbSetDetectableAutoRepeat(display, True, &AutorepeatSupport);
// XkbSetDetectableAutoRepeat(XDisplay, True, &AutorepeatSupport);
Window tmp;
u32 borderWidth;
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)
@ -588,8 +588,8 @@ void CIrrDeviceLinux::createDriver()
#ifdef _IRR_COMPILE_WITH_OPENGL_
{
video::SExposedVideoData data;
data.OpenGLLinux.X11Window = window;
data.OpenGLLinux.X11Display = display;
data.OpenGLLinux.X11Window = XWindow;
data.OpenGLLinux.X11Display = XDisplay;
ContextManager->initialize(CreationParams, data);
VideoDriver = video::createOpenGLDriver(CreationParams, FileSystem, ContextManager);
}
@ -602,8 +602,8 @@ void CIrrDeviceLinux::createDriver()
#ifdef _IRR_COMPILE_WITH_OGLES1_
{
video::SExposedVideoData data;
data.OpenGLLinux.X11Window = window;
data.OpenGLLinux.X11Display = display;
data.OpenGLLinux.X11Window = XWindow;
data.OpenGLLinux.X11Display = XDisplay;
ContextManager = new video::CEGLManager();
ContextManager->initialize(CreationParams, data);
VideoDriver = video::createOGLES1Driver(CreationParams, FileSystem, ContextManager);
@ -617,8 +617,8 @@ void CIrrDeviceLinux::createDriver()
#ifdef _IRR_COMPILE_WITH_OGLES2_
{
video::SExposedVideoData data;
data.OpenGLLinux.X11Window = window;
data.OpenGLLinux.X11Display = display;
data.OpenGLLinux.X11Window = XWindow;
data.OpenGLLinux.X11Display = XDisplay;
ContextManager = new video::CEGLManager();
ContextManager->initialize(CreationParams, data);
VideoDriver = video::createOGLES2Driver(CreationParams, FileSystem, ContextManager);
@ -658,9 +658,9 @@ bool CIrrDeviceLinux::createInputContext()
// One one side it would be nicer to let users do that - on the other hand
// not setting the environment locale will not work when using i18n X11 functions.
// So users would have to call it always or their input is broken badly.
// We can restore immediately - so shouldn't mess with anything in users apps.
// We can restore immediately - so won't mess with anything in users apps.
core::stringc oldLocale(setlocale(LC_CTYPE, NULL));
setlocale(LC_CTYPE, ""); // use environmenbt locale
setlocale(LC_CTYPE, ""); // use environment locale
if ( !XSupportsLocale() )
{
@ -669,7 +669,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());
@ -705,7 +705,7 @@ bool CIrrDeviceLinux::createInputContext()
XInputContext = XCreateIC(XInputMethod,
XNInputStyle, bestStyle,
XNClientWindow, window,
XNClientWindow, XWindow,
(char*)NULL);
if (!XInputContext )
{
@ -738,8 +738,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)
{
@ -780,15 +780,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)
{
@ -805,10 +805,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)
@ -934,7 +934,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
@ -1014,7 +1014,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);
@ -1038,7 +1038,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
@ -1054,7 +1054,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,
@ -1071,8 +1071,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;
@ -1126,11 +1126,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
@ -1182,11 +1182,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;
}
@ -1224,7 +1224,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
@ -1239,7 +1239,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
@ -1247,15 +1247,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_
}
@ -1269,8 +1269,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_
}
@ -1282,29 +1282,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
@ -1320,14 +1320,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>(
@ -1341,10 +1341,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
@ -1357,7 +1357,7 @@ video::IVideoModeList* CIrrDeviceLinux::getVideoModeList()
void CIrrDeviceLinux::minimizeWindow()
{
#ifdef _IRR_COMPILE_WITH_X11_
XIconifyWindow(display, window, screennr);
XIconifyWindow(XDisplay, XWindow, Screennr);
#endif
}
@ -1366,7 +1366,7 @@ void CIrrDeviceLinux::minimizeWindow()
void CIrrDeviceLinux::maximizeWindow()
{
#ifdef _IRR_COMPILE_WITH_X11_
XMapWindow(display, window);
XMapWindow(XDisplay, XWindow);
#endif
}
@ -1375,7 +1375,7 @@ void CIrrDeviceLinux::maximizeWindow()
void CIrrDeviceLinux::restoreWindow()
{
#ifdef _IRR_COMPILE_WITH_X11_
XMapWindow(display, window);
XMapWindow(XDisplay, XWindow);
#endif
}
@ -1383,7 +1383,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);
}
@ -1731,13 +1731,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
@ -1745,19 +1745,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;
}
@ -1778,10 +1778,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;
@ -1792,13 +1792,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;
@ -1821,23 +1821,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)
@ -1851,7 +1851,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)
@ -1874,8 +1874,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
}
@ -1900,15 +1900,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_
}
@ -1916,10 +1916,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
}
@ -1928,7 +1928,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(),
@ -1936,7 +1936,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(),
@ -1979,18 +1979,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);
@ -2005,10 +2005,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;
}
@ -2044,7 +2044,7 @@ Cursor CIrrDeviceLinux::TextureToARGBCursor(irr::video::ITexture * tex, const co
}
tex->unlock();
Cursor cursorResult=XcursorImageLoadCursor(display, image);
Cursor cursorResult=XcursorImageLoadCursor(XDisplay, image);
XcursorImageDestroy(image);
@ -2067,7 +2067,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)
@ -2084,22 +2084,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();
}
@ -2116,31 +2116,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()
@ -2150,7 +2150,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
@ -2163,7 +2163,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;
@ -2204,7 +2204,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 )
{
@ -2229,7 +2229,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);
}

View File

@ -147,12 +147,12 @@ namespace irr
void initXAtoms();
bool switchToFullscreen(bool reset=false);
#ifdef _IRR_COMPILE_WITH_X11_
#ifdef _IRR_COMPILE_WITH_X11_
bool createInputContext();
void destroyInputContext();
EKEY_CODE getKeyCode(XEvent &event);
#endif
#endif
//! Implementation of the linux cursor control
class CCursorControl : public gui::ICursorControl
@ -173,9 +173,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
}
@ -213,9 +213,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,
@ -224,13 +224,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;
@ -317,15 +317,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);
@ -346,8 +346,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
{
@ -384,22 +384,22 @@ 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
#endif
u32 Width, Height;