mirror of
https://git.code.sf.net/p/quake/newtree
synced 2025-06-02 01:51:37 +00:00
Create a window class ICCCM hint, so the window manager knows what the
name of the program is. It's "`basename $0`.PROGRAM". Also, create a window size ICCCM hint, forcing the window to the size it should be -- we don't want it resized, so now the window manager ought to get the picture. :)
This commit is contained in:
parent
8138b9c4e8
commit
4173134bae
1 changed files with 56 additions and 27 deletions
|
@ -58,6 +58,7 @@
|
||||||
#include "commdef.h"
|
#include "commdef.h"
|
||||||
#include "context_x11.h"
|
#include "context_x11.h"
|
||||||
#include "dga_check.h"
|
#include "dga_check.h"
|
||||||
|
#include "qargs.h"
|
||||||
#include "qtypes.h"
|
#include "qtypes.h"
|
||||||
#include "vid.h"
|
#include "vid.h"
|
||||||
#include "sys.h"
|
#include "sys.h"
|
||||||
|
@ -303,6 +304,9 @@ void
|
||||||
x11_create_window (int width, int height)
|
x11_create_window (int width, int height)
|
||||||
{
|
{
|
||||||
XSetWindowAttributes attr;
|
XSetWindowAttributes attr;
|
||||||
|
XClassHint *ClassHint;
|
||||||
|
XSizeHints *SizeHints;
|
||||||
|
char *resname;
|
||||||
unsigned long mask;
|
unsigned long mask;
|
||||||
|
|
||||||
/* window attributes */
|
/* window attributes */
|
||||||
|
@ -321,12 +325,37 @@ x11_create_window(int width, int height)
|
||||||
0, x_visinfo->depth, InputOutput,
|
0, x_visinfo->depth, InputOutput,
|
||||||
x_vis, mask, &attr);
|
x_vis, mask, &attr);
|
||||||
|
|
||||||
|
// Set window size hints
|
||||||
|
SizeHints = XAllocSizeHints ();
|
||||||
|
if (SizeHints) {
|
||||||
|
SizeHints->flags = (PMinSize | PMaxSize);
|
||||||
|
SizeHints->min_width = width;
|
||||||
|
SizeHints->min_height = height;
|
||||||
|
SizeHints->max_width = width;
|
||||||
|
SizeHints->max_height = height;
|
||||||
|
XSetWMNormalHints (x_disp, x_win, SizeHints);
|
||||||
|
|
||||||
|
XFree (SizeHints);
|
||||||
|
}
|
||||||
|
|
||||||
// Set window title
|
// Set window title
|
||||||
x11_set_caption (va ("%s %s", PROGRAM, VERSION));
|
x11_set_caption (va ("%s %s", PROGRAM, VERSION));
|
||||||
|
|
||||||
// Set icon name
|
// Set icon name
|
||||||
XSetIconName (x_disp, x_win, PROGRAM);
|
XSetIconName (x_disp, x_win, PROGRAM);
|
||||||
|
|
||||||
/* Make window respond to Delete events */
|
// Set window class
|
||||||
|
ClassHint = XAllocClassHint ();
|
||||||
|
if (ClassHint) {
|
||||||
|
resname = strrchr (com_argv[0], '/');
|
||||||
|
|
||||||
|
ClassHint->res_name = (resname ? resname + 1 : resname);
|
||||||
|
ClassHint->res_class = PROGRAM;
|
||||||
|
XSetClassHint (x_disp, x_win, ClassHint);
|
||||||
|
XFree (ClassHint);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make window respond to Delete events
|
||||||
aWMDelete = XInternAtom (x_disp, "WM_DELETE_WINDOW", False);
|
aWMDelete = XInternAtom (x_disp, "WM_DELETE_WINDOW", False);
|
||||||
XSetWMProtocols (x_disp, x_win, &aWMDelete, 1);
|
XSetWMProtocols (x_disp, x_win, &aWMDelete, 1);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue