【发布时间】:2016-06-05 22:04:25
【问题描述】:
我正在使用 fltk2.0(现已弃用)来管理我的窗口。我的问题是在 Linux 上,当我想创建一个全屏窗口时,该窗口被创建,但 KDE 任务栏出现在顶部。相关的 Xlib 代码如下:
#if USE_X11
// This will make some window managers obey the border being turned on/off.
// Most other modern window managers will allow the border to be placed
// off-screen:
// Unfortunatly stoopid MetaCity raises the window. Sigh
CreatedWindow::find(window)->sendxjunk();
# if 1
// Supposedly this tells the new X window managers to put this atop
// the taskbar. My tests have shown absolutly zero effect, so this is
// either wrong or the window managers are ignoreing it. Newer X
// window managers seem to work without this, they probably recognize
// attempts to make the window the size of the screen
// this method does in fact work, and is used below in my maximize()
// so it should probably work here as well
// possible problem is that sometimes one have to process/flush events
// i.e. by using fltk::wait(1) to have this working
// Perhaps below code can be done correctly(?) again - look at maximize()
// (or perhaps Im totally wrong, Im new to Xlib ;) --Rafal
static Atom _NET_WM_STATE;
static Atom _NET_WM_STATE_REMOVE;
static Atom _NET_WM_STATE_ADD;
static Atom _NET_WM_STATE_FULLSCREEN;
if (!_NET_WM_STATE) {
# define MAX_ATOMS 30
Atom* atom_ptr[MAX_ATOMS];
const char* names[MAX_ATOMS];
int i = 0;
# define atom(a,b) atom_ptr[i] = &a; names[i] = b; i++
atom(_NET_WM_STATE , "_NET_WM_STATE");
atom(_NET_WM_STATE_REMOVE , "_NET_WM_STATE_REMOVE");
atom(_NET_WM_STATE_ADD , "_NET_WM_STATE_ADD");
atom(_NET_WM_STATE_FULLSCREEN, "_NET_WM_STATE_FULLSCREEN");
# undef atom
Atom atoms[MAX_ATOMS];
XInternAtoms(xdisplay, (char**)names, i, 0, atoms);
for (; i--;) *atom_ptr[i] = atoms[i];
}
XEvent e;
memset( &e, 0, sizeof(e) );
e.type = ClientMessage;
e.xclient.window = xid(window);
e.xclient.message_type = _NET_WM_STATE;
e.xclient.format = 32;
e.xclient.data.l[0] = fullscreen ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE;
e.xclient.data.l[1] = _NET_WM_STATE_FULLSCREEN;
e.xclient.data.l[2] = 0;
e.xclient.data.l[3] = 0;
e.xclient.data.l[4] = 0;
XSendEvent(xdisplay, RootWindow(xdisplay, xscreen), 0,
SubstructureNotifyMask|SubstructureRedirectMask, &e);
# endif
# endif
如果我去 ALT+F3->More actions->Fullscreen(这涵盖了任务栏),窗口就会像我想要的那样全屏显示。任何帮助看看我可能做错了什么?
【问题讨论】:
-
您是否尝试过其他桌面环境?
-
我用 XCF 和 Xubuntu Desktop 试了一下,结果也一样
-
好吧,我不确定缺少什么,但这里有一个小sn-p,在这个答案askubuntu.com/a/576739/26246 中对我有用,也在Xubuntu 16.04 上进行了测试。这里应该如何显示youtube.com/watch?v=zw_ECdeyc-s
标签: window fullscreen xlib