Hi Tomasz.

IDirectFB is a singleton.
If you create it multiple times, it will only be instantiated the first time. It has to be created (and released) for each program at least once. Note: the reference counter is increased, so you will need to do exactly the same amount of Release() calls as Create calls to avoid memory leaks.

If you call SetCooperativeLevel multiple times from the same program, then only the first time will change the level, and the consecutive calls will return DFB_OK right away - this is because IDirectFB is a singleton. From another application you can except the mentioned error code.

hth
Niels


tomaszdro...@interia.eu wrote:
My code.
No errors - all goes ok.

------------------------------------------------------------
DFBResult dfberr;

if( (dfberr = DirectFBInit( &argc, &argv )) != DFB_OK )
{ DirectFBErrorFatal("DirectFBInit( &argc, &argv )", dfberr); }

IDirectFB * main_interface = NULL;
IDirectFB * main_interface_2 = NULL; /* 1) */

if( (dfberr = DirectFBCreate( &main_interface )) != DFB_OK )
{ DirectFBErrorFatal( "DirectFBCreate( &main_interface )", dfberr); }
if( (dfberr = DirectFBCreate( &main_interface )) != DFB_OK ) /* 2) */
{ DirectFBErrorFatal( "DirectFBCreate( &main_interface )", dfberr); } */

if( (dfberr = DirectFBCreate( &main_interface_2 )) != DFB_/*if( (dfberr = main_dfb_interface->SetVideoMode( main_interface, 100, 100, 0 )) != DFB_OK ) { fprintf(stderr, "File: %s, Line: %d:\n", __FILE__, __LINE__); DirectFBErrorFatal( "SetVideoMode( main_interface, 100, 100, 100 )", dfberr); }*/
OK )
{ DirectFBErrorFatal( "DirectFBCreate( &main_interface_2 )", dfberr); }


if( (dfberr = main_interface->SetCooperativeLevel( main_interface, DFSCL_FULLSCREEN )) != DFB_OK ) { DirectFBErrorFatal( "SetCooperativeLevel( main_interface, DFSCL_FULLSCREEN )", dfberr); } if( (dfberr = main_interface_2->SetCooperativeLevel( main_interface_2, DFSCL_FULLSCREEN )) != DFB_OK ) /* 3) */ { DirectFBErrorFatal( "SetCooperativeLevel( main_interface_2, DFSCL_FULLSCREEN )", dfberr); }

...

------------------------------------------------------------

Questions.

1. Is it ok to have 2 instances of main interface ? Or may by main interface is just super interface - and there is nothing wrong to have multiple instances?
   If so, what for may I use multiple instances of super interface?
2. Is it ok to Create main_interface twice (remind no error while program execution)?
3. In documentation to SetCooperativeLevel is:
"Function fails with DFB_LOCKED if another instance already is in a cooperative level other than DFSCL_NORMAL."
   But my program run with no errors.
So - if it means that one program may have many super instances with cooperative level set to FULLSCREEN, or EXCLUSIVE, but if one program has some super interface with cooperative level set to FULLSCREEN, or EXCLUSIVE this function will fail for another one program ?

----------------------------------------------------------------------
Ten program odstrasza komary.
Sprawdz >> http://link.interia.pl/f22d9

_______________________________________________
directfb-users mailing list
directfb-users@directfb.org
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users



--

.------------------------------------------.
| DirectFB - Hardware accelerated graphics |
| http://www.directfb.org/                 |
"------------------------------------------"
_______________________________________________
directfb-users mailing list
directfb-users@directfb.org
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users

Reply via email to