mirror of
https://git.code.sf.net/p/quake/quake2forge
synced 2024-12-13 14:11:35 +00:00
- Confirming addition of xlib niceties: icon,
wm_delete_window handling, etc. (icculus patchset #8)
This commit is contained in:
parent
9f69eb11f1
commit
3cea7ff14a
2 changed files with 30 additions and 30 deletions
26
src/gl_glx.c
26
src/gl_glx.c
|
@ -1092,24 +1092,24 @@ int GLimp_SetMode( unsigned int *pwidth, unsigned int *pheight, int mode, qboole
|
||||||
if (wmhints) {
|
if (wmhints) {
|
||||||
#include "../data/pixmaps/q2icon.xbm"
|
#include "../data/pixmaps/q2icon.xbm"
|
||||||
|
|
||||||
Pixmap icon_pixmap, icon_mask;
|
Pixmap icon_pixmap, icon_mask;
|
||||||
unsigned long fg, bg;
|
unsigned long fg, bg;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
fg = BlackPixel(dpy, visinfo->screen);
|
fg = BlackPixel(dpy, visinfo->screen);
|
||||||
bg = WhitePixel(dpy, visinfo->screen);
|
bg = WhitePixel(dpy, visinfo->screen);
|
||||||
icon_pixmap = XCreatePixmapFromBitmapData(dpy, win, (char *)q2icon_bits, q2icon_width, q2icon_height, fg, bg, visinfo->depth);
|
icon_pixmap = XCreatePixmapFromBitmapData(dpy, win, (char *)q2icon_bits, q2icon_width, q2icon_height, fg, bg, visinfo->depth);
|
||||||
for (i = 0; i < sizeof(q2icon_bits); i++)
|
for (i = 0; i < sizeof(q2icon_bits); i++)
|
||||||
q2icon_bits[i] = ~q2icon_bits[i];
|
q2icon_bits[i] = ~q2icon_bits[i];
|
||||||
icon_mask = XCreatePixmapFromBitmapData(dpy, win, (char *)q2icon_bits, q2icon_width, q2icon_height, bg, fg, visinfo->depth);
|
icon_mask = XCreatePixmapFromBitmapData(dpy, win, (char *)q2icon_bits, q2icon_width, q2icon_height, bg, fg, visinfo->depth);
|
||||||
|
|
||||||
wmhints->flags = IconPixmapHint|IconMaskHint;
|
wmhints->flags = IconPixmapHint|IconMaskHint;
|
||||||
wmhints->icon_pixmap = icon_pixmap;
|
wmhints->icon_pixmap = icon_pixmap;
|
||||||
wmhints->icon_mask = icon_mask;
|
wmhints->icon_mask = icon_mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
XSetWMProperties(dpy, win, NULL, NULL, NULL, 0,
|
XSetWMProperties(dpy, win, NULL, NULL, NULL, 0,
|
||||||
sizehints, wmhints, None);
|
sizehints, wmhints, None);
|
||||||
if (sizehints)
|
if (sizehints)
|
||||||
XFree(sizehints);
|
XFree(sizehints);
|
||||||
if (wmhints)
|
if (wmhints)
|
||||||
|
|
34
src/rw_x11.c
34
src/rw_x11.c
|
@ -1028,9 +1028,9 @@ void HandleEvents(void)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ClientMessage:
|
case ClientMessage:
|
||||||
if (event.xclient.data.l[0] == wmDeleteWindow)
|
if (event.xclient.data.l[0] == wmDeleteWindow)
|
||||||
ri.Cmd_ExecuteText(EXEC_NOW, "quit");
|
ri.Cmd_ExecuteText(EXEC_NOW, "quit");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (doShm && event.type == x_shmeventtype)
|
if (doShm && event.type == x_shmeventtype)
|
||||||
|
@ -1173,7 +1173,7 @@ static qboolean SWimp_InitGraphics( qboolean fullscreen )
|
||||||
int attribmask = CWEventMask | CWColormap | CWBorderPixel;
|
int attribmask = CWEventMask | CWColormap | CWBorderPixel;
|
||||||
XSetWindowAttributes attribs;
|
XSetWindowAttributes attribs;
|
||||||
XSizeHints *sizehints;
|
XSizeHints *sizehints;
|
||||||
XWMHints *wmhints;
|
XWMHints * wmhints;
|
||||||
Colormap tmpcmap;
|
Colormap tmpcmap;
|
||||||
|
|
||||||
tmpcmap = XCreateColormap(dpy, root, x_vis, AllocNone);
|
tmpcmap = XCreateColormap(dpy, root, x_vis, AllocNone);
|
||||||
|
@ -1203,24 +1203,24 @@ static qboolean SWimp_InitGraphics( qboolean fullscreen )
|
||||||
if (wmhints) {
|
if (wmhints) {
|
||||||
#include "../data/pixmaps/q2icon.xbm"
|
#include "../data/pixmaps/q2icon.xbm"
|
||||||
|
|
||||||
Pixmap icon_pixmap, icon_mask;
|
Pixmap icon_pixmap, icon_mask;
|
||||||
unsigned long fg, bg;
|
unsigned long fg, bg;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
fg = BlackPixel(dpy, x_visinfo->screen);
|
fg = BlackPixel(dpy, x_visinfo->screen);
|
||||||
bg = WhitePixel(dpy, x_visinfo->screen);
|
bg = WhitePixel(dpy, x_visinfo->screen);
|
||||||
icon_pixmap = XCreatePixmapFromBitmapData(dpy, win, (char *)q2icon_bits, q2icon_width, q2icon_height, fg, bg, x_visinfo->depth);
|
icon_pixmap = XCreatePixmapFromBitmapData(dpy, win, (char *)q2icon_bits, q2icon_width, q2icon_height, fg, bg, x_visinfo->depth);
|
||||||
for (i = 0; i < sizeof(q2icon_bits); i++)
|
for (i = 0; i < sizeof(q2icon_bits); i++)
|
||||||
q2icon_bits[i] = ~q2icon_bits[i];
|
q2icon_bits[i] = ~q2icon_bits[i];
|
||||||
icon_mask = XCreatePixmapFromBitmapData(dpy, win, (char *)q2icon_bits, q2icon_width, q2icon_height, bg, fg, x_visinfo->depth);
|
icon_mask = XCreatePixmapFromBitmapData(dpy, win, (char *)q2icon_bits, q2icon_width, q2icon_height, bg, fg, x_visinfo->depth);
|
||||||
|
|
||||||
wmhints->flags = IconPixmapHint|IconMaskHint;
|
wmhints->flags = IconPixmapHint|IconMaskHint;
|
||||||
wmhints->icon_pixmap = icon_pixmap;
|
wmhints->icon_pixmap = icon_pixmap;
|
||||||
wmhints->icon_mask = icon_mask;
|
wmhints->icon_mask = icon_mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
XSetWMProperties(dpy, win, NULL, NULL, NULL, 0,
|
XSetWMProperties(dpy, win, NULL, NULL, NULL, 0,
|
||||||
sizehints, wmhints, None);
|
sizehints, wmhints, None);
|
||||||
if (sizehints)
|
if (sizehints)
|
||||||
XFree(sizehints);
|
XFree(sizehints);
|
||||||
if (wmhints)
|
if (wmhints)
|
||||||
|
|
Loading…
Reference in a new issue