上面的xfwm4中未引发SWT Shell [英] SWT Shell is not raised above in xfwm4

查看:57
本文介绍了上面的xfwm4中未引发SWT Shell的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对xfwm4有问题.使用以下代码:

I have problem with xfwm4. Using following code:

Shell s = windowVector.get(0).getShell();
s.setActive();

被其他外壳覆盖的外壳窗口未在上方引发.使用kwin(KDE窗口管理器)可以正常工作.Shell是使用以下构造函数创建的:

Shell window that is covered by other shells is not raised above. Using kwin (KDE window manager) it works correctly. Shell is created using following constructor:

shell = new Shell(mainShell, SWT.NO_TRIM | SWT.MODELESS);

在两种情况下都是SWT方法:

In both cases SWT method:

OS.gdk_window_focus (window, OS.GDK_CURRENT_TIME);

被调用,但是在xfwm4 shell中获得了焦点,并且没有出现在所有其他shell窗口之上(在我的应用程序中).这是xfwm4中的错误吗?也许是一些配置问题,或者我想念一些东西.

is called but in xfwm4 shell get focus and is NOT raised above all other shell windows (in my application). Is this bug in xfwm4? Maybe some configuration issue or I am missig something.

我可能不准确.我尝试setActive的外壳在其他子外壳下.以下代码解释并简化了我要实现的目标:

I might be not precise. Shell that i try to setActive is "under" other child shells. Following code explains and simplfy what I am trying to achieve:

Shell mainShell = new Shell(Display.getDefault(), SWT.NO_TRIM);
mainShell.setBounds(0, 0, 300, 200);
mainShell.open();
final Shell shell1 = new Shell(mainShell, SWT.NO_TRIM | SWT.MODELESS);
shell1.setBounds(0, 0, 300, 200);
shell1.open();
Shell shell2 = new Shell(mainShell, SWT.NO_TRIM | SWT.MODELESS);
shell2.setBounds(0, 0, 300, 200);
shell2.open();
Thread thread = new Thread() {

    @Override
    public void run() {
        try {
                Thread.sleep(2000);
                System.out.println("Raise shell1 above");
                shell1.setActive();
        }
        catch(InterruptedException e) {
            e.printStackTrace();
        }
    }
};
thread.start();
while( !mainShell.isDisposed()) {
    if( !Display.getDefault().readAndDispatch()) {
        Display.getDefault().sleep();
    }
}
Display.getDefault().dispose();

此代码在kwin中正常工作,在xfwm4中,shell1停留在shell2下并保持隐藏状态.

This code works correctly in kwin, in xfwm4 shell1 stays "under" shell2 and remains hidden.

推荐答案

我不能专门谈论 xfwm4 ,但是是的,许多窗口管理器都具有某种形式的防止输入窃取的功能.

I can't speak about xfwm4 specifically but yes, many window managers have some form of input stealing prevention.

您不希望任何随机应用程序都可以窃取您的注意力或迫使您的注意力远离正在做的事情.

You don't want any random application being allowed to steal your focus or force your attention away from what you are doing.

但是,它们如何实现此行为在窗口管理器之间是不同的.大多数人应该(理想情况下)允许当前关注的应用程序将焦点放在该应用程序的新创建的窗口上,但我想并不是所有的人都这样做.

How they implement this behaviour differs between window managers however. Most should (ideally) allow the currently focused application to give focus to a newly created window of that application but I imagine not all do that.

这篇关于上面的xfwm4中未引发SWT Shell的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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