From ff46d7268c50569c81390ad82c4747a6d35f6ab9 Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 2 Nov 2010 20:46:15 +0100 Subject: [PATCH] Changed: #1034 Implement CCustomMouse for Linux --- .../3d/driver/opengl/driver_opengl_inputs.cpp | 4 +- .../3d/driver/opengl/driver_opengl_window.cpp | 63 ++----------------- 2 files changed, 8 insertions(+), 59 deletions(-) diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_inputs.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_inputs.cpp index 9f3f050d6..5d577a025 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_inputs.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_inputs.cpp @@ -506,8 +506,8 @@ void CDriverGL::setMousePos(float x, float y) if (_win == EmptyWindow) return; - sint x1 = (sint)((float)_CurrentMode.Width*x); - sint y1 = (sint)((float)_CurrentMode.Height*(1.0f-y)); + sint x1 = (sint)((float)_WindowWidth*x); + sint y1 = (sint)((float)_WindowHeight*(1.0f-y)); #ifdef NL_OS_WINDOWS diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp index 3d23721be..1f7bf1e9b 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp @@ -357,10 +357,13 @@ bool CDriverGL::init (uint windowIcon, emptyProc exitFunc) #ifdef HAVE_XRENDER sint render_major, render_event, render_error; - if (XQueryExtension(_dpy, "RENDER", &render_major, &render_event, &render_error)) + if (XQueryExtension(_dpy, "RENDER", &render_major, &render_event, &render_error) && + XRenderQueryExtension(_dpy, &render_event, &render_error)) { - _xrender_version = render_major * 100; - nlinfo("3D: XRender %d.%d found", render_major, 0); + sint render_minor = 0; + XRenderQueryVersion(_dpy, &render_major, &render_minor); + _xrender_version = render_major * 100 + render_minor; + nlinfo("3D: XRender %d.%d found", render_major, render_minor); } #endif // HAVE_XRENDER @@ -2846,60 +2849,6 @@ bool CDriverGL::convertBitmapToCursor(const NLMISC::CBitmap &bitmap, Cursor &cur #endif } -/* -XRenderPictFormat* format = None; - - { - XRenderPictFormat alpha_format; - unsigned long mask = PictFormatType|PictFormatDepth|PictFormatAlpha|PictFormatAlphaMask; - alpha_format.type = PictTypeDirect; - alpha_format.depth = 8; - alpha_format.direct.alpha = 0; - alpha_format.direct.alphaMask = 0xff; - - format = XRenderFindFormat(dpy, mask, &alpha_format, 0); - } - - if (!format) { - printf("%s", "error, couldnt find valid format for alpha.\n"); - XFreePixmap(dpy, dst_pm); - XFreePixmap(dpy, src_pm); - return 0; - } - - { /* fill the alpha-picture */ - Pixmap alpha_pm = None; - - XRenderColor alpha_color; - XRenderPictureAttributes alpha_attr; - - alpha_color.alpha = 0xffff * (shade)/100; - - alpha_attr.repeat = True; - - alpha_pm = XCreatePixmap(dpy, src_pm, 1, 1, 8); - alpha_pic = XRenderCreatePicture(dpy, alpha_pm, format, CPRepeat, &alpha_attr); - XRenderFillRectangle(dpy, PictOpSrc, alpha_pic, &alpha_color, 0, 0, 1, 1); - XFreePixmap(dpy, alpha_pm); - } - - { /* blend all together */ - Picture src_pic; - Picture dst_pic; - - format = XRenderFindVisualFormat(dpy, vis); - - src_pic = XRenderCreatePicture(dpy, src_pm, format, 0, 0); - dst_pic = XRenderCreatePicture(dpy, dst_pm, format, 0, 0); - - XRenderComposite(dpy, PictOpOver, - src_pic, alpha_pic, dst_pic, - src_x, src_y, 0, 0, dst_x, dst_y, width, height); - XRenderFreePicture(dpy, src_pic); - XRenderFreePicture(dpy, dst_pic); - } -*/ - #endif } // NL3D