diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-05-23 17:01:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-23 17:01:11 +0200 |
commit | c20388f2e18d7a96907bc9abaa50604448d6d63b (patch) | |
tree | fd2b9dcf5b3de92a7b5b77ce4fdbce9993d7f5c1 | |
parent | 1deb41226d5219346157744eed5fe85b7069c3d4 (diff) | |
parent | b660247216acc8a5c7295b1f729f39f1235f5a70 (diff) |
Merge pull request #29123 from ibrahn/init-x11-nullcursor-color
Fixed uninitialised variable in x11 null cursor creation
-rw-r--r-- | platform/x11/os_x11.cpp | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index 56389578f7..f034b2389b 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -534,22 +534,26 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a } { - Pixmap cursormask; - XGCValues xgc; - GC gc; - XColor col; - Cursor cursor; + // Creating an empty/transparent cursor + + // Create 1x1 bitmap + Pixmap cursormask = XCreatePixmap(x11_display, + RootWindow(x11_display, DefaultScreen(x11_display)), 1, 1, 1); - cursormask = XCreatePixmap(x11_display, RootWindow(x11_display, DefaultScreen(x11_display)), 1, 1, 1); + // Fill with zero + XGCValues xgc; xgc.function = GXclear; - gc = XCreateGC(x11_display, cursormask, GCFunction, &xgc); + GC gc = XCreateGC(x11_display, cursormask, GCFunction, &xgc); XFillRectangle(x11_display, cursormask, gc, 0, 0, 1, 1); - col.pixel = 0; - col.red = 0; - col.flags = 4; - cursor = XCreatePixmapCursor(x11_display, - cursormask, cursormask, + + // Color value doesn't matter. Mask zero means no foreground or background will be drawn + XColor col = {}; + + Cursor cursor = XCreatePixmapCursor(x11_display, + cursormask, // source (using cursor mask as placeholder, since it'll all be ignored) + cursormask, // mask &col, &col, 0, 0); + XFreePixmap(x11_display, cursormask); XFreeGC(x11_display, gc); |