mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-01 15:01:00 +00:00
[x11] Implement mouse visibility control
That was nicely easy.
This commit is contained in:
parent
ec0c6ad906
commit
759e67bb7c
3 changed files with 14 additions and 7 deletions
|
@ -57,6 +57,7 @@ extern int x_height;
|
||||||
extern int x_shmeventtype;
|
extern int x_shmeventtype;
|
||||||
extern Time x_time;
|
extern Time x_time;
|
||||||
extern Time x_mouse_time;
|
extern Time x_mouse_time;
|
||||||
|
extern Cursor x_nullcursor;
|
||||||
extern bool oktodraw;
|
extern bool oktodraw;
|
||||||
extern bool x_have_focus;
|
extern bool x_have_focus;
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,6 @@ bool oktodraw = false;
|
||||||
int x_shmeventtype;
|
int x_shmeventtype;
|
||||||
|
|
||||||
static int x_disp_ref_count = 0;
|
static int x_disp_ref_count = 0;
|
||||||
static Cursor nullcursor = None;
|
|
||||||
|
|
||||||
Display *x_disp = NULL;
|
Display *x_disp = NULL;
|
||||||
int x_screen;
|
int x_screen;
|
||||||
|
@ -91,6 +90,7 @@ Window x_win;
|
||||||
Colormap x_cmap;
|
Colormap x_cmap;
|
||||||
Time x_time;
|
Time x_time;
|
||||||
Time x_mouse_time;
|
Time x_mouse_time;
|
||||||
|
Cursor x_nullcursor = None;
|
||||||
|
|
||||||
bool x_have_focus = false;
|
bool x_have_focus = false;
|
||||||
|
|
||||||
|
@ -315,9 +315,9 @@ X11_CloseDisplay (void)
|
||||||
|
|
||||||
X11_RestoreGamma ();
|
X11_RestoreGamma ();
|
||||||
|
|
||||||
if (nullcursor != None) {
|
if (x_nullcursor != None) {
|
||||||
XFreeCursor (x_disp, nullcursor);
|
XFreeCursor (x_disp, x_nullcursor);
|
||||||
nullcursor = None;
|
x_nullcursor = None;
|
||||||
}
|
}
|
||||||
|
|
||||||
XCloseDisplay (x_disp);
|
XCloseDisplay (x_disp);
|
||||||
|
@ -338,7 +338,7 @@ X11_CreateNullCursor (void)
|
||||||
GC gc;
|
GC gc;
|
||||||
XColor dummycolour = { };
|
XColor dummycolour = { };
|
||||||
|
|
||||||
if (nullcursor != None)
|
if (x_nullcursor != None)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
cursormask = XCreatePixmap (x_disp, x_root, 1, 1, 1);
|
cursormask = XCreatePixmap (x_disp, x_root, 1, 1, 1);
|
||||||
|
@ -351,11 +351,10 @@ X11_CreateNullCursor (void)
|
||||||
dummycolour.pixel = 0;
|
dummycolour.pixel = 0;
|
||||||
dummycolour.red = 0;
|
dummycolour.red = 0;
|
||||||
dummycolour.flags = 04;
|
dummycolour.flags = 04;
|
||||||
nullcursor = XCreatePixmapCursor (x_disp, cursormask, cursormask,
|
x_nullcursor = XCreatePixmapCursor (x_disp, cursormask, cursormask,
|
||||||
&dummycolour, &dummycolour, 0, 0);
|
&dummycolour, &dummycolour, 0, 0);
|
||||||
XFreePixmap (x_disp, cursormask);
|
XFreePixmap (x_disp, cursormask);
|
||||||
XFreeGC (x_disp, gc);
|
XFreeGC (x_disp, gc);
|
||||||
XDefineCursor (x_disp, x_win, nullcursor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_VIDMODE
|
#ifdef HAVE_VIDMODE
|
||||||
|
|
|
@ -104,6 +104,12 @@ X11_VID_SetPalette (byte *palette, byte *colormap)
|
||||||
vid_internal.set_palette (vid_internal.ctx, viddef.palette);
|
vid_internal.set_palette (vid_internal.ctx, viddef.palette);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
X11_VID_SetCursor (bool visible)
|
||||||
|
{
|
||||||
|
XDefineCursor (x_disp, x_win, visible ? None : x_nullcursor);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Set up color translation tables and the window. Takes a 256-color 8-bit
|
Set up color translation tables and the window. Takes a 256-color 8-bit
|
||||||
palette. Palette data will go away after the call, so copy it if you'll
|
palette. Palette data will go away after the call, so copy it if you'll
|
||||||
|
@ -158,6 +164,7 @@ vid_system_t vid_system = {
|
||||||
.init_cvars = X11_VID_Init_Cvars,
|
.init_cvars = X11_VID_Init_Cvars,
|
||||||
.update_fullscreen = X11_UpdateFullscreen,
|
.update_fullscreen = X11_UpdateFullscreen,
|
||||||
.set_palette = X11_VID_SetPalette,
|
.set_palette = X11_VID_SetPalette,
|
||||||
|
.set_cursor = X11_VID_SetCursor,
|
||||||
};
|
};
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|
Loading…
Reference in a new issue