1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-19 14:31:59 +00:00

Merge pull request #29123 from ibrahn/init-x11-nullcursor-color

Fixed uninitialised variable in x11 null cursor creation
This commit is contained in:
Rémi Verschelde
2019-05-23 17:01:11 +02:00
committed by GitHub

View File

@@ -534,22 +534,26 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
} }
{ {
Pixmap cursormask; // Creating an empty/transparent cursor
XGCValues xgc;
GC gc;
XColor col;
Cursor cursor;
cursormask = XCreatePixmap(x11_display, RootWindow(x11_display, DefaultScreen(x11_display)), 1, 1, 1); // Create 1x1 bitmap
Pixmap cursormask = XCreatePixmap(x11_display,
RootWindow(x11_display, DefaultScreen(x11_display)), 1, 1, 1);
// Fill with zero
XGCValues xgc;
xgc.function = GXclear; 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); XFillRectangle(x11_display, cursormask, gc, 0, 0, 1, 1);
col.pixel = 0;
col.red = 0; // Color value doesn't matter. Mask zero means no foreground or background will be drawn
col.flags = 4; XColor col = {};
cursor = XCreatePixmapCursor(x11_display,
cursormask, cursormask, Cursor cursor = XCreatePixmapCursor(x11_display,
cursormask, // source (using cursor mask as placeholder, since it'll all be ignored)
cursormask, // mask
&col, &col, 0, 0); &col, &col, 0, 0);
XFreePixmap(x11_display, cursormask); XFreePixmap(x11_display, cursormask);
XFreeGC(x11_display, gc); XFreeGC(x11_display, gc);