防止窗口最大化/最小化在x窗口系统中 [英] preventing window maximisation/minimisation in x window system

查看:149
本文介绍了防止窗口最大化/最小化在x窗口系统中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在x(在c ++中)为窗口编写一些低级窗口代码,我想阻止用户最大化或最小化窗口。我不介意这是否通过拒绝调整大小的请求,或通过删除按钮本身。但是,我绑定到x,不能使用qt或其他更高级别的库,我知道提供这个功能。

i'm writing some low level window code for a window in x (in c++), and I want to prevent the user from either maximising or minimising the window. i don't mind whether this is done by rejecting the request to resize, or by removing the buttons themselves. however, i am tied to x and can't use qt or other higher-level libraries which i know provide this functionality.

现在我已经设法做是拦截ResizeRequest事件,然后使用XResizeWindow设置窗口大小...但这导致窗口暂时最大化,然后返回到其原始状态。有没有办法直接拒绝ResizeRequest,这似乎是正确的方法来处理这个,但一个相当一点的谷歌和文档拖网没有找出一个解决方案。

at the moment all i have managed to do is intercept the ResizeRequest event and then set the window size back using XResizeWindow... but this causes the window to momentarily maximise and then return to its original state. is there a way to directly reject a ResizeRequest, that would seem to be the proper way to handle this but a fair bit of googling and document trawling has not come up with a solution.

感谢,
james

thanks, james

推荐答案

您不能。

本质上你会像地狱对窗口管理器(和对用户结束)。
例如,您可以观察PropertyNotify事件以检查您的窗口(或窗口附加到窗口管理器)是否最小化。然后你将它最小化。然后用户最小化它,或者窗口管理器。技术上,你可以反对它,但我强烈建议反对它。

essentially you would fight like hell against the window manager (and against the user in the end). eg, you could watch PropertyNotify events to check if your window (or rather the window your window is attached to (provided by the window manager)) gets minimized. and then you unminimize it. and then the user minimizes it, or the window manager. technically, you can fight against it, but i would strongly advise against it.

说:你可以尝试给窗口管理器一些提示你认为合适为窗口。请参阅 http://standards.freedesktop.org/wm-spec/1.3/ ar01s05.html#id2523223

that said: you can try to give the window manager some hints about what you think is appropriate for the window. see http://standards.freedesktop.org/wm-spec/1.3/ar01s05.html#id2523223:

_NET_WM_ALLOWED_ACTIONS

是窗口管理器每个窗口管理的属性(告诉其他工具该窗口可能有什么)。这样的操作之一是

is a property the window manager manages per window (to tell other tools what is possible with that window). one of such actions is

_NET_WM_ACTION_RESIZE indicates that the window may be resized. 
(Implementation note: Window Managers can identify a non-resizable
window because its minimum and maximum size in WM_NORMAL_HINTS will 
be the same.)

因此,如果您的用户正在使用窗口管理器正确解释 WM_NORMAL_HINTS 最大化,最小化:那么你可以感到幸运。

so, if your users are using a window manager which interpretes WM_NORMAL_HINTS correctly and drops any resizing, maximizing, minimizing: then you can feel lucky.

你真正想要实现什么?某种kiosk模式?某些类型的公平交易模式,其中人们不能关闭,关闭,调整大小,与您正在展示的应用程序不同。

what do you really want to achieve? some kind of kiosk-mode? some kind of fair-trade mode where people walking by can not "shutdown", close, resize, fiddle around with the app you are presenting?

如果是这样:一个没有任何窗口管理器的xsession。只需启动您的应用程序,因为你需要它,并完成。

if so: consider running a xsession without any window manager involved at all. just start your app as big as you need it and done.

这篇关于防止窗口最大化/最小化在x窗口系统中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆