Xlib: Create window in mimized or maximized state

非 Y 不嫁゛ 提交于 2020-01-04 03:03:23

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!