GTK Window Cover Entire Screen

陌路散爱 提交于 2019-11-27 08:48:58

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/31366706/gtk-window-cover-entire-screen

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