mirror of
https://git.code.sf.net/p/quake/newtree
synced 2025-01-21 23:50:58 +00:00
Imported nullcursor code from QF.
This commit is contained in:
parent
1fc4396f12
commit
8d35343a0a
1 changed files with 33 additions and 21 deletions
|
@ -191,33 +191,41 @@ void TragicDeath(int signal_num)
|
||||||
{
|
{
|
||||||
XAutoRepeatOn(x_disp);
|
XAutoRepeatOn(x_disp);
|
||||||
XCloseDisplay(x_disp);
|
XCloseDisplay(x_disp);
|
||||||
Sys_Error("This death brought to you by the number %d\n", signal_num);
|
Sys_Error("This death brought to you by signal number %d\n", signal_num);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ========================================================================
|
|
||||||
// makes a null cursor
|
|
||||||
// ========================================================================
|
|
||||||
|
|
||||||
static Cursor CreateNullCursor(Display *display, Window root)
|
/*
|
||||||
|
========================================================================
|
||||||
|
Create an empty cursor
|
||||||
|
========================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
static Cursor nullcursor = None;
|
||||||
|
|
||||||
|
static Cursor
|
||||||
|
CreateNullCursor(Display *display, Window root)
|
||||||
{
|
{
|
||||||
Pixmap cursormask;
|
Pixmap cursormask;
|
||||||
XGCValues xgc;
|
XGCValues xgc;
|
||||||
GC gc;
|
GC gc;
|
||||||
XColor dummycolour;
|
XColor dummycolour;
|
||||||
Cursor cursor;
|
|
||||||
|
|
||||||
cursormask = XCreatePixmap(display, root, 1, 1, 1/*depth*/);
|
if (nullcursor != None) return nullcursor;
|
||||||
xgc.function = GXclear;
|
|
||||||
gc = XCreateGC(display, cursormask, GCFunction, &xgc);
|
cursormask = XCreatePixmap(display, root, 1, 1, 1/*depth*/);
|
||||||
XFillRectangle(display, cursormask, gc, 0, 0, 1, 1);
|
xgc.function = GXclear;
|
||||||
dummycolour.pixel = 0;
|
gc = XCreateGC(display, cursormask, GCFunction, &xgc);
|
||||||
dummycolour.red = 0;
|
XFillRectangle(display, cursormask, gc, 0, 0, 1, 1);
|
||||||
dummycolour.flags = 04;
|
dummycolour.pixel = 0;
|
||||||
cursor = XCreatePixmapCursor(display, cursormask, cursormask,
|
dummycolour.red = 0;
|
||||||
&dummycolour,&dummycolour, 0,0);
|
dummycolour.flags = 04;
|
||||||
XFreePixmap(display,cursormask);
|
nullcursor = XCreatePixmapCursor(display, cursormask, cursormask,
|
||||||
XFreeGC(display,gc);
|
&dummycolour,&dummycolour, 0,0);
|
||||||
return cursor;
|
XFreePixmap(display,cursormask);
|
||||||
|
XFreeGC(display,gc);
|
||||||
|
|
||||||
|
return nullcursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResetFrameBuffer(void)
|
void ResetFrameBuffer(void)
|
||||||
|
@ -542,7 +550,7 @@ void VID_Init (unsigned char *palette)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// inviso cursor
|
/* Invisible Cursor */
|
||||||
XDefineCursor(x_disp, x_win, CreateNullCursor(x_disp, x_win));
|
XDefineCursor(x_disp, x_win, CreateNullCursor(x_disp, x_win));
|
||||||
|
|
||||||
// create the GC
|
// create the GC
|
||||||
|
@ -553,7 +561,7 @@ void VID_Init (unsigned char *palette)
|
||||||
x_gc = XCreateGC(x_disp, x_win, valuemask, &xgcvalues );
|
x_gc = XCreateGC(x_disp, x_win, valuemask, &xgcvalues );
|
||||||
}
|
}
|
||||||
|
|
||||||
// map the window
|
/* Map the window */
|
||||||
XMapWindow(x_disp, x_win);
|
XMapWindow(x_disp, x_win);
|
||||||
|
|
||||||
// wait for first exposure event
|
// wait for first exposure event
|
||||||
|
@ -646,6 +654,10 @@ void VID_Shutdown (void)
|
||||||
{
|
{
|
||||||
Con_Printf("VID_Shutdown\n");
|
Con_Printf("VID_Shutdown\n");
|
||||||
XAutoRepeatOn(x_disp);
|
XAutoRepeatOn(x_disp);
|
||||||
|
if (nullcursor != None) {
|
||||||
|
XFreeCursor(x_disp, nullcursor);
|
||||||
|
nullcursor = None;
|
||||||
|
}
|
||||||
XCloseDisplay(x_disp);
|
XCloseDisplay(x_disp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue