Jorge Luis Zapata Muga wrote:
On 9/13/05, Denis Oliver Kropp <[EMAIL PROTECTED]> wrote:

Quoting Jorge Luis Zapata Muga:

hi all, i am able to set up differents windows  in the layer but can i
toggle a window to fullscreen mode? is there a way?

No, you'd have to do that on your own by destroying the window
and switching the display layer to exclusive cooperative level,
setting the configuration and getting its surface.



Ok, but in what mode does the main interface (IDirectFB) should be?
(NORMAL, FULLSCREEN, EXCLUSIVE) as setting the cooperative level in
two sides is confusing (the layer and the main interface) maybe you
can explain me a little about this. So if i understand correctly to
switch a window to fullscreen:
1. delete the window (and all other windows i might have)
2. set the exclusive mode to the layer
3. get the primary layer surface
4. and what about the events? i have to create a new eventbuffer and
handle them as i did with the window events
5. attach the logic of my program to this new surface

and to restore the windows state
1. release the layer surface
2. create all the windows i had, again

is this correct?


You don't need to release the windows,
they will be restored when the layer reverts to SHARED mode.

I have attached a small example, hope it will remove your doubts.


--
Regards,
     Claudio Ciccani

[EMAIL PROTECTED]
http://directfb.org
http://sf.net/projects/php-directfb
#include <stdio.h>
#include <stdlib.h>

#include <directfb.h>

int
main( int argc, char **argv )
{
     IDirectFB             *dfb;
     IDirectFBDisplayLayer *layer;
     IDirectFBWindow       *window;
     IDirectFBSurface      *surface;
     IDirectFBEventBuffer  *input;
     DFBWindowDescription   dsc;
     int                    quit = 0;
     
     DirectFBInit( &argc, &argv );
     DirectFBCreate( &dfb );
     
     dfb->GetDisplayLayer( dfb, DLID_PRIMARY, &layer );
     
     dsc.flags  = DWDESC_WIDTH | DWDESC_HEIGHT;
     dsc.width  = 300;
     dsc.height = 300;
     
     layer->CreateWindow( layer, &dsc, &window );
     window->GetSurface( window, &surface );
     surface->Clear( surface, 0xff, 0xff, 0xff, 0xff );
     surface->Flip( surface, NULL, 0 );
     window->SetOpacity( window, 0xff );
     window->CreateEventBuffer( window, &input );
     
     while (!quit) {
          DFBEvent    e;
          static int  fullscreen = 0;
          
          input->WaitForEvent( input );
          
          while (input->GetEvent( input, &e ) == DFB_OK) {
               int key = 0;
               
               switch (e.clazz) {
                    case DFEC_INPUT:
                         if (e.input.type != DIET_KEYPRESS)
                              continue;
                         key = e.input.key_symbol;
                         break;
                    case DFEC_WINDOW:
                         if (e.window.type != DWET_KEYDOWN)
                              continue;
                         key = e.window.key_symbol;
                         break;
                    default:
                         break;
               }
                    
               switch (key) {
                    case DIKS_SMALL_F:
                         fullscreen ^= 1;
                         
                         surface->Release( surface );
                         input->Release( input );
                         
                         if (fullscreen) {
                              puts( "Fullscreen" );
                              layer->SetCooperativeLevel( layer, DLSCL_EXCLUSIVE );
                              layer->GetSurface( layer, &surface );
                              surface->Clear( surface, 0, 0, 0, 0 );
                              surface->Flip( surface, NULL, 0 );
                              dfb->CreateInputEventBuffer( dfb, DICAPS_KEYS, 1, &input );
                         } else {
                              puts( "Desktop" );
                              layer->SetCooperativeLevel( layer, DLSCL_SHARED );
                              window->GetSurface( window, &surface );
                              window->CreateEventBuffer( window, &input );
                         }
                         break;
                    case DIKS_ESCAPE:
                         quit = 1;
                         break;
                    default:
                         break;
               }
          }
     }
     
     input->Release( input );
     surface->Release( surface );
     window->Release( window );
     layer->Release( layer );
     dfb->Release( dfb );
     
     return 0;
}
     
     
_______________________________________________
directfb-dev mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-dev

Reply via email to