我正在尝试创建一个无边框窗口,其背景占据整个窗口区域。窗口大小 685x336 ,背景大小相同。问题是,在窗口的垂直轴上,背景仅在(窗口高度 - 标题栏高度)占据的空间上绘制。在窗口的底部,在标题栏占用的空间上重复背景。 像这样的东西:
我正在创建窗口并对其应用这些更改:
Screen* DisplayScreen = NULL;
DisplayScreen = DefaultScreenOfDisplay(d);
enum
{
WM_HINTS_FUNCTIONS = (1L << 0),
WM_HINTS_DECORATIONS = (1L << 1),
WM_FUNC_ALL = (1L << 0),
WM_FUNC_RESIZE = (1L << 1),
WM_FUNC_MOVE = (1L << 2),
WM_FUNC_MINIMIZE = (1L << 3),
WM_FUNC_MAXIMIZE = (1L << 4),
WM_FUNC_CLOSE = (1L << 5)
};
struct WindowHints
{
unsigned long flags, functions, decorations, status;
long input_mode;
};
Atom wmHintsProperty = XInternAtom(d, "_MOTIF_WM_HINTS", 0);
struct WindowHints hints;
hints.flags = WM_HINTS_DECORATIONS;
hints.decorations = 0;
XChangeProperty
(
d,
window,
wmHintsProperty,
wmHintsProperty,
32,
PropModeReplace,
(unsigned char *)&hints,
5
);
Atom WindowType = XInternAtom(d, "_NET_WM_WINDOW_TYPE", False);
Atom DialogType = XInternAtom(d, "_NET_WM_WINDOW_TYPE_DIALOG", False);
XChangeProperty(
d,
window,
WindowType,
XA_ATOM,
32,
PropModeReplace,
reinterpret_cast<unsigned char*>(&DialogType), 1
);
这将创建一个无边框的平面窗口,我在其上应用背景。如果我将其更改为普通窗口,则会在其整个宽度和高度上正确绘制背景。删除边框和标题栏后,标题栏占用的空间不会在窗口底部绘制(就像背景重复一样)。 会导致这种情况发生的原因是什么?