GTK窗口覆盖整个屏幕 [英] GTK Window Cover Entire Screen

查看:238
本文介绍了GTK窗口覆盖整个屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做一小段教育工作,我创建了一个窗口,它应该覆盖整个显示器。然而,特殊领域没有被涵盖在底部的视角中。我的窗口是一个坚实的红色,没有菜单栏滚动条等,有无论如何使此顶盖菜单栏和码头。在我的屏幕截图中,我正在测试Ubuntu和Mint,这是在Gtk OS上的一致行为,我需要放弃我的窗口,以便覆盖所有的东西,这是可能的吗?

我试过 gdk_window_fullscreen 但它没有做任何事情,甚至没有全屏,你认为它是因为我从另一个线程运行这个函数?我怎么知道这个函数是否需要从主线程运行?



Ubuntu的覆盖范围不完整:





Mint的不完整覆盖范围:





代码尝试




  1. 使用主线程中的Firefox代码打开无框窗口:

      var aEditorDOMWindow = Services.ww.openWindow(null,core.addon.path.content +'panel.xul','_blank','chrome,width = 1,height = 1,screenX = 0,screenY = 0,null); 


  2. 现在,在完成加载之后,此窗口的GdkWindow *线程并以字符串的形式传递给另一个线程


  3. 线程现在将字符串转换为GdkWindow *然后转换为GtkWindow *

      var gdkWinPtr = ostypes.TYPE.GdkWindow.ptr(ctypes.UInt64(aHwndStr)); 
    var gtkWinPtr = ostypes.HELPER.gdkWinPtrToGtkWinPtr(gdkWinPtr);然后执行 gtk_window_set_keep_above
  4. 因为如果有另一个应用程序专注于它将关注这个人,这将使他在现有的全屏窗口之上

      var rez_topIt = ostypes.API('gtk_window_set_keep_above')(gtkWinPtr,true); 


  5. 用于运行 gtk_window_present

      var rez_focus = ostypes.API ( 'gtk_window_present')(gtkWinPtr); 


  6. 我试过了,但它并不能使窗口覆盖特殊的UI:




    • ostypes.API('gdk_window_set_type_hint')(gdkWinPtr,ostypes.CONST.WINDOW_TYPE_HINT_SPLASHSCREEN);

    • ostypes.API('gtk_window_set_position')(gtkWinPtr,ostypes.CONST.GTK_WIN_POS_NONE);

    •   var geom = ostypes.TYPE.GdkGeometry(); 
      geom.max_width = aOptions.fullWidth;
      geom.max_height = aOptions.fullHeight;
      var rez_geo = ostypes.API('gtk_window_set_geometry_hints')(gtkWinPtr,null,geom.address(),ostypes.CONST.GDK_HINT_MAX_SIZE);



  7. 并转到主线程。现在主线程使用firefox javascript将窗口移动到最左上角(我之前使用Gdk调用计算),并将此窗口的宽度和高度设置为计算所有显示器的宽度和高度(我之前使用其他gdk调用)

      aEditorDOMWindow.moveTo(collCanMonInfos [0] .xTopLeft,collCanMonInfos [0] .yTopLeft); 
    aEditorDOMWindow.resizeTo(collCanMonInfos [0] .nWidth,collCanMonInfos [0] .nHeight);


这会导致窗口SOMETIMES覆盖所有监视器,其他时间就是它开启的那个时间。它不会覆盖像任务栏/停靠/菜单栏这样的特殊用户界面。



如果您可以建议如何实现一个完全涵盖所有非常赞赏的窗口,我试图教给一些人一些东西,我遇到了一个混乱。



这是一个YouTube插件的YouTube视频: https://www.youtube.com/watch?v=aJM5NQK67N4



我停止使用 gdk_fullscreen ,因为它间歇性地工作时,它不允许窗口扩展到一台显示器之外。

解决方案

面板通常使用struts实现,窗口管理器可以决定永远不允许窗口覆盖它们;这就是为什么引入全屏窗口的全部理念的原因之一:它给了窗口管理器一个暗示,要求全屏的窗口应该覆盖所有其他窗口;没有装饰;还涵盖了所有最终的系统组件,如面板。

I'm working on a small educational piece of work, I create a window and its supposed to cover the entire monitor. However "special" areas are not being covered as seen in the screnshot at bottom. My window is a solid red with no menu bar scroll bar etc, is there anyway to make this cover the top menu bar and the dock. In my screenshot I am testing on Ubuntu and Mint, this is consistent behavior on Gtk OS's I need to be ablve ot set my window so it covers all things is this possible?

I tried gdk_window_fullscreen but it's not doing anything, not even fullscreen, do you think its because I'm running this function from another thread? How would I know if this function needs to be run from the main thread?

Incomplete coverage on Ubuntu:

Incomplete coverage on Mint:

Code Tried

  1. A frameless window is opened using Firefox code from main thread:

    var aEditorDOMWindow = Services.ww.openWindow(null, core.addon.path.content + 'panel.xul', '_blank', 'chrome,width=1,height=1,screenX=0,screenY=0', null); 
    

  2. Now after load of it completes then the GdkWindow* of this window is obtained on the main thread and passed to another thread as a string

  3. The thread now takes the string to GdkWindow* then that to GtkWindow*

            var gdkWinPtr = ostypes.TYPE.GdkWindow.ptr(ctypes.UInt64(aHwndStr));
            var gtkWinPtr = ostypes.HELPER.gdkWinPtrToGtkWinPtr(gdkWinPtr);
    

  4. The thread then executes gtk_window_set_keep_above because if there was another app was focused it will focus this guy, and it will keep him on top of existing full screen windows

     var rez_topIt = ostypes.API('gtk_window_set_keep_above')(gtkWinPtr, true);
    

  5. The thread used to then run gtk_window_present but I removed it as I noticed it would crash the app, this was the code:

       var rez_focus = ostypes.API('gtk_window_present')(gtkWinPtr);
    

  6. EXPERIMENTAL STUFF I tried but it didnt work to make the window cover the special UI:

    • ostypes.API('gdk_window_set_type_hint')(gdkWinPtr, ostypes.CONST.WINDOW_TYPE_HINT_SPLASHSCREEN);
    • ostypes.API('gtk_window_set_position')(gtkWinPtr, ostypes.CONST.GTK_WIN_POS_NONE);
    • var geom = ostypes.TYPE.GdkGeometry();
      geom.max_width = aOptions.fullWidth;
      geom.max_height = aOptions.fullHeight;
      var rez_geo = ostypes.API('gtk_window_set_geometry_hints')(gtkWinPtr, null, geom.address(), ostypes.CONST.GDK_HINT_MAX_SIZE);
      

  7. Now the thread work is done and it goes to main thread. Now the main thread uses firefox javascript to move the window to top left most origin (which i calculated earlier with Gdk calls) and also sets the width and height of this window to that calculated of all the monitors (i did this earlier with other gdk calls)

            aEditorDOMWindow.moveTo(collCanMonInfos[0].xTopLeft, collCanMonInfos[0].yTopLeft);
            aEditorDOMWindow.resizeTo(collCanMonInfos[0].nWidth, collCanMonInfos[0].nHeight);
    

This results in the window SOMETIMES covering all monitors, other times just the one it opened on. And it never covers special UI like the taskbar/dock/menubars.

If you can please advise on how to acheive a window that fully covers everything that would be very appreciated, I'm trying to teach some people some stuff and I ran into a mess.

Here is a youtube video of the addon I am making: https://www.youtube.com/watch?v=aJM5NQK67N4

I discontinued using gdk_fullscreen because when it worked intermittently it would not allow the window to expand outside the one monitor.

解决方案

Panels are usually implemented with struts, and window managers can decide never to allow windows to cover them; that's one of the reasons why the whole idea of "full screen window" was introduced: it gives the window manager a hint that the window that requested to be full screen should cover all other windows; have no decorations; and also cover all eventual "system" components, like panels.

这篇关于GTK窗口覆盖整个屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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