Fixed uninitialised variable in x11 null cursor creation

Fully initialised color var.
Clarified intent a little with comments/layout.
This commit is contained in:
Ibrahn Sahir 2019-05-23 11:47:28 +01:00
parent c088386c5b
commit b660247216

View file

@ -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
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;
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);