问题
Is it possible to create a Window in maximized or minimized state with Xlib? If so, how would I go about doing that?
回答1:
Something like this;
XEvent xev;
Atom wm_state = XInternAtom(dpy, "_NET_WM_STATE", False);
Atom max_horz = XInternAtom(dpy, "_NET_WM_STATE_MAXIMIZED_HORZ", False);
Atom max_vert = XInternAtom(dpy, "_NET_WM_STATE_MAXIMIZED_VERT", False);
memset(&xev, 0, sizeof(xev));
xev.type = ClientMessage;
xev.xclient.window = win;
xev.xclient.message_type = wm_state;
xev.xclient.format = 32;
xev.xclient.data.l[0] = _NET_WM_STATE_ADD;
xev.xclient.data.l[1] = max_horz;
xev.xclient.data.l[2] = max_vert;
XSendEvent(dpy, DefaultRootWindow(dpy), False, SubstructureNotifyMask, &xev);
回答2:
Check out _NET_WM_STATE in the EWMH.
来源:https://stackoverflow.com/questions/4530786/xlib-create-window-in-mimized-or-maximized-state