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:
Jeff Teunissen 2000-10-11 09:54:27 +00:00
parent 8138b9c4e8
commit 4173134bae

View file

@ -58,6 +58,7 @@
#include "commdef.h"
#include "context_x11.h"
#include "dga_check.h"
#include "qargs.h"
#include "qtypes.h"
#include "vid.h"
#include "sys.h"
@ -303,6 +304,9 @@ void
x11_create_window (int width, int height)
{
XSetWindowAttributes attr;
XClassHint *ClassHint;
XSizeHints *SizeHints;
char *resname;
unsigned long mask;
/* window attributes */
@ -321,12 +325,37 @@ x11_create_window(int width, int height)
0, x_visinfo->depth, InputOutput,
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
x11_set_caption (va ("%s %s", PROGRAM, VERSION));
// Set icon name
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);
XSetWMProtocols (x_disp, x_win, &aWMDelete, 1);