[osg-users] full screen mode in osgviewer and options in command line

Leif Delgass ldelgass at gmail.com
Wed Oct 3 13:38:28 PDT 2007


Robert and Cedric,

I reported a fullscreen issue with GNOME (metacity WM) in the thread
Robert mentions.  For me, entering and leaving fullscreen mode works,
but the fullscreen window appears under the GNOME panels at the top
and bottom of the screen.  The fix for this is to use a fullscreen WM
hint that metacity honors.  I'm not sure if this qualifies as high
priority for 2.2 though.  Depending on the implementation,
incorporating the fix could involve changes to the GraphicsWindow
interface and all the platform-specific implementations.

I have code to set fullscreen using the EWMH hint (see below), but
haven't had time to make a clean fix for submission yet.  I think the
simplest option might be to have a separate fullscreen state setting
method in the platform specific classes.  Another option is to add the
notion of a stacking-order trait and consider fullscreen as the
combination of 3 traits: no decoration, screen size window, and
top-level stacking.  I'm not sure about other platforms, but the EWMH
spec includes some additional stacking properties in addition to the
fullscreen state (e.g. above normal windows but below panels, and
below normal windows).  Then toggling fullscreen could be done
automatically when the corresponding traits are set.  If anyone else
wants to work on this, the code to set the fullscreen hint (using a
ClientMessage event sent to the root window) looks like this (where
isFullScreen is a bool set to the desired state):

Display* display = getDisplayToUse();

Atom netWMStateAtom = XInternAtom(display, "_NET_WM_STATE", True);
Atom netWMStateFullscreenAtom = XInternAtom(display,
"_NET_WM_STATE_FULLSCREEN", True);

if (netWMStateAtom != None && netWMStateFullscreenAtom != None) {
    XEvent xev;
    xev.xclient.type = ClientMessage;
    xev.xclient.serial = 0;
    xev.xclient.send_event = True;
    xev.xclient.window = _window;
    xev.xclient.message_type = netWMStateAtom;
    xev.xclient.format = 32;
    xev.xclient.data.l[0] = isFullScreen ? 1 : 0;
    xev.xclient.data.l[1] = netWMStateFullscreenAtom;
    xev.xclient.data.l[2] = 0;

    XSendEvent(display, RootWindow(display, DefaultScreen(display)),
False,  SubstructureRedirectMask | SubstructureNotifyMask, &xev);
}

-Leif

On 10/3/07, Robert Osfield <robert.osfield at gmail.com> wrote:
> HI Cedric,
>
> Changing the order would be fine.  This would also apply to the camera
> manipulators too.  If you make some changes and your happy just post
> me the complete changed file and I'll do a review of it.  This is
> pretty low priority issue though.
>
> The window resize issue you talk about much high priority issue and
> one that it'd be nice to fix for 2.2.  Since I don't have Gnome here I
> can't chase after this one so I'd appreciate it if yourself or others
> can chase this one done.
>
> Cheers,
> Robert.
>
> On 10/3/07, Cedric Pinson <mornifle at plopbyte.net> wrote:
> > I checked the --help-keys option of osgviewer, in fact everything is
> > here to work but all EventHandler are created after the
> > process of options.
> >
> > i tested with something like that and it report the keys i know it
> > changes the order of created HandlerEvent. But what do you think ?
> >
> >     // add the window size toggle handler
> >     viewer.addEventHandler(new osgViewer::WindowSizeHandler);
> >
> >     // if user request help write it out to cout.
> >     bool helpAll = arguments.read("--help-all");
> >     unsigned int helpType = ((helpAll || arguments.read("-h") ||
> > arguments.read("--help"))? osg::ApplicationUsage::COMMAND_LINE_OPTION :
> > 0 ) |
> >                             ((helpAll ||  arguments.read("--help-env"))?
> > osg::ApplicationUsage::ENVIRONMENTAL_VARIABLE : 0 ) |
> >                             ((helpAll ||
> > arguments.read("--help-keys"))?
> > osg::ApplicationUsage::KEYBOARD_MOUSE_BINDING : 0 );
> >
> >     if (helpType)
> >     {
> >         arguments.getApplicationUsage()->write(std::cout, helpType);
> >         osg::ref_ptr<osg::ApplicationUsage> usage = new
> > osg::ApplicationUsage;
> >         viewer.getUsage(*usage);
> >         usage->write(std::cout, helpType);
> >         return 1;
> >     }
> >
> >
> > Robert Osfield wrote:
> > > HI Cederic,
> > >
> > > Have a look through Septembers archives as there was another thread
> > > about problems under that I believe under Gnome.
> > >
> > > I use KDE myself and everything is working fine so its a window
> > > manager issue - i.e. its not supporting how
> > > osgViewer::GraphicsWindowX11.cpp is try to to change the window
> > > dimensions and decoration.
> > >
> > > Robert.
> > >
> > > On 10/3/07, Cedric Pinson <mornifle at plopbyte.net> wrote:
> > >
> > >> I use the last version of the svn. from this morning. i use gnome
> > >> environnement.
> > >> I think the log in my previous are wrong.
> > >>
> > >> GraphicsContext::getWindowingSystemInterface() 0x8058a90        0xb7eef200
> > >> draw() 0x805a450
> > >> Screen resolution = 640x480
> > >> cull()
> > >> cull() got SceneView 0x805abc8
> > >> end cull() 0x805a450
> > >> draw() got SceneView 0x805abc8
> > >> end draw() 0x805a450
> > >> draw() 0x805a450
> > >> UnmapNotify event recieved
> > >> ReparentNotify event recieved
> > >> MapNotify
> > >> MapNotify x=0 y=0 width=1440, height=900
> > >> Expose x=0 y=0 width=1440, height=900
> > >> ConfigureNotify x=0 y=0 width=1440, height=900
> > >>
> > >>
> > >> Robert Osfield wrote:
> > >>
> > >>> Hi Cedric,
> > >>>
> > >>> Which version of the OSG are you working against?  What window manager
> > >>> are you using?
> > >>>
> > >>> On 10/3/07, Cedric Pinson <mornifle at plopbyte.net> wrote:
> > >>>
> > >>>
> > >>>> Hi,
> > >>>>
> > >>>> I have a strange behviour when i ran osgviewer it start in fullscreen
> > >>>> mode and when i tried to disable fullscreen to go in window mode with
> > >>>> the key F. it does not success to make the switch. I will dig but i
> > >>>> would like to know if i am alone or not.
> > >>>>
> > >>>> and i saw that
> > >>>> osgviewer --help-keys
> > >>>> Usage: osgviewerd [options] filename ...
> > >>>>
> > >>>> can someone report the same behaviour ?
> > >>>>
> > >>>> Cedric
> > >>>>
> > >>>> --
> > >>>> +33 (0) 6 63 20 03 56  Cedric Pinson mailto:mornifle at plopbyte.net http://www.plopbyte.net
> > >>>>
> > >>>>
> > >>>> _______________________________________________
> > >>>> osg-users mailing list
> > >>>> osg-users at lists.openscenegraph.org
> > >>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> > >>>>
> > >>>>
> > >>>>
> > >>> _______________________________________________
> > >>> osg-users mailing list
> > >>> osg-users at lists.openscenegraph.org
> > >>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> > >>>
> > >>>
> > >> --
> > >> +33 (0) 6 63 20 03 56  Cedric Pinson mailto:mornifle at plopbyte.net http://www.plopbyte.net
> > >>
> > >>
> > >> _______________________________________________
> > >> osg-users mailing list
> > >> osg-users at lists.openscenegraph.org
> > >> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> > >>
> > >>
> > > _______________________________________________
> > > osg-users mailing list
> > > osg-users at lists.openscenegraph.org
> > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> > >
> >
> > --
> > +33 (0) 6 63 20 03 56  Cedric Pinson mailto:mornifle at plopbyte.net http://www.plopbyte.net
> >
> >
> > _______________________________________________
> > osg-users mailing list
> > osg-users at lists.openscenegraph.org
> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>


-- 
Leif Delgass
ldelgass at gmail.com



More information about the osg-users mailing list