comparison src/video/directfb/SDL_DirectFB_video.c @ 2698:e1da92da346c gsoc2008_nds

Clean up.
author Darren Alton <dalton@stevens.edu>
date Wed, 27 Aug 2008 04:23:38 +0000
parents 1e690901ecd7
children
comparison
equal deleted inserted replaced
2697:c9121b04cffa 2698:e1da92da346c
321 IDirectFBScreen *screen; 321 IDirectFBScreen *screen;
322 322
323 SDL_DFB_CHECKERR(dfb->GetScreen(dfb, devdata->screenid[i], &screen)); 323 SDL_DFB_CHECKERR(dfb->GetScreen(dfb, devdata->screenid[i], &screen));
324 324
325 devdata->aux = i; 325 devdata->aux = i;
326 SDL_DFB_CHECKERR(screen-> 326 SDL_DFB_CHECKERR(screen->EnumDisplayLayers
327 EnumDisplayLayers(screen, &cbLayers, devdata)); 327 (screen, &cbLayers, devdata));
328 screen->GetSize(screen, &tcw[i], &tch[i]); 328 screen->GetSize(screen, &tcw[i], &tch[i]);
329 screen->Release(screen); 329 screen->Release(screen);
330 } 330 }
331 331
332 /* Query card capabilities */ 332 /* Query card capabilities */
337 SDL_DFB_DEBUG("Using %s (%s) driver.\n", caps.name, caps.vendor); 337 SDL_DFB_DEBUG("Using %s (%s) driver.\n", caps.name, caps.vendor);
338 SDL_DFB_DEBUG("Found %d screens\n", devdata->numscreens); 338 SDL_DFB_DEBUG("Found %d screens\n", devdata->numscreens);
339 339
340 for (i = 0; i < devdata->numscreens; i++) { 340 for (i = 0; i < devdata->numscreens; i++) {
341 //SDL_DFB_CHECKERR( dfb->GetDisplayLayer (dfb, DLID_PRIMARY, &layer) ); 341 //SDL_DFB_CHECKERR( dfb->GetDisplayLayer (dfb, DLID_PRIMARY, &layer) );
342 SDL_DFB_CHECKERR(dfb-> 342 SDL_DFB_CHECKERR(dfb->GetDisplayLayer
343 GetDisplayLayer(dfb, devdata->gralayer[i], &layer)); 343 (dfb, devdata->gralayer[i], &layer));
344 //SDL_DFB_CHECKERR( dfb->CreateInputEventBuffer (dfb, DICAPS_ALL, DFB_FALSE, &events) ); 344 //SDL_DFB_CHECKERR( dfb->CreateInputEventBuffer (dfb, DICAPS_ALL, DFB_FALSE, &events) );
345 345
346 SDL_DFB_CHECKERR(layer-> 346 SDL_DFB_CHECKERR(layer->SetCooperativeLevel
347 SetCooperativeLevel(layer, DLSCL_ADMINISTRATIVE)); 347 (layer, DLSCL_ADMINISTRATIVE));
348 layer->EnableCursor(layer, 1); 348 layer->EnableCursor(layer, 1);
349 SDL_DFB_CHECKERR(layer->SetCursorOpacity(layer, 0xC0)); 349 SDL_DFB_CHECKERR(layer->SetCursorOpacity(layer, 0xC0));
350 SDL_DFB_CHECKERR(layer->SetCooperativeLevel(layer, DLSCL_SHARED)); 350 SDL_DFB_CHECKERR(layer->SetCooperativeLevel(layer, DLSCL_SHARED));
351 351
352 /* Query layer configuration to determine the current mode and pixelformat */ 352 /* Query layer configuration to determine the current mode and pixelformat */
377 display.driverdata = dispdata; 377 display.driverdata = dispdata;
378 378
379 /* Enumerate the available fullscreen modes */ 379 /* Enumerate the available fullscreen modes */
380 SDL_DFB_CALLOC(dispdata->modelist, DFB_MAX_MODES, 380 SDL_DFB_CALLOC(dispdata->modelist, DFB_MAX_MODES,
381 sizeof(SDL_DisplayMode)); 381 sizeof(SDL_DisplayMode));
382 SDL_DFB_CHECKERR(dfb-> 382 SDL_DFB_CHECKERR(dfb->EnumVideoModes
383 EnumVideoModes(dfb, EnumModesCallback, &display)); 383 (dfb, EnumModesCallback, &display));
384 384
385 SDL_AddVideoDisplay(&display); 385 SDL_AddVideoDisplay(&display);
386 } 386 }
387 387
388 devdata->initialized = 1; 388 devdata->initialized = 1;
432 432
433 for (i = 0; i < devdata->numscreens; i++) { 433 for (i = 0; i < devdata->numscreens; i++) {
434 DFB_DisplayData *dispdata = 434 DFB_DisplayData *dispdata =
435 (DFB_DisplayData *) _this->displays[i].driverdata; 435 (DFB_DisplayData *) _this->displays[i].driverdata;
436 if (dispdata->layer) { 436 if (dispdata->layer) {
437 SDL_DFB_CHECK(dispdata->layer-> 437 SDL_DFB_CHECK(dispdata->
438 SetCooperativeLevel(dispdata->layer, 438 layer->SetCooperativeLevel(dispdata->layer,
439 DLSCL_ADMINISTRATIVE)); 439 DLSCL_ADMINISTRATIVE));
440 SDL_DFB_CHECK(dispdata->layer-> 440 SDL_DFB_CHECK(dispdata->
441 SetCursorOpacity(dispdata->layer, 0x00)); 441 layer->SetCursorOpacity(dispdata->layer, 0x00));
442 SDL_DFB_CHECK(dispdata->layer-> 442 SDL_DFB_CHECK(dispdata->
443 SetCooperativeLevel(dispdata->layer, DLSCL_SHARED)); 443 layer->SetCooperativeLevel(dispdata->layer,
444 DLSCL_SHARED));
444 } 445 }
445 SDL_DFB_RELEASE(dispdata->layer); 446 SDL_DFB_RELEASE(dispdata->layer);
446 447
447 /* Free video mode list */ 448 /* Free video mode list */
448 if (dispdata->modelist) { 449 if (dispdata->modelist) {
578 DFB_DisplayData *data = (DFB_DisplayData *) SDL_CurrentDisplay.driverdata; 579 DFB_DisplayData *data = (DFB_DisplayData *) SDL_CurrentDisplay.driverdata;
579 DFBDisplayLayerConfig config, rconfig; 580 DFBDisplayLayerConfig config, rconfig;
580 DFBDisplayLayerConfigFlags fail = 0; 581 DFBDisplayLayerConfigFlags fail = 0;
581 DFBResult ret; 582 DFBResult ret;
582 583
583 SDL_DFB_CHECKERR(data->layer-> 584 SDL_DFB_CHECKERR(data->layer->SetCooperativeLevel(data->layer,
584 SetCooperativeLevel(data->layer, DLSCL_ADMINISTRATIVE)); 585 DLSCL_ADMINISTRATIVE));
585 586
586 SDL_DFB_CHECKERR(data->layer->GetConfiguration(data->layer, &config)); 587 SDL_DFB_CHECKERR(data->layer->GetConfiguration(data->layer, &config));
587 config.flags = DLCONF_WIDTH | DLCONF_HEIGHT | DLCONF_BUFFERMODE; 588 config.flags = DLCONF_WIDTH | DLCONF_HEIGHT | DLCONF_BUFFERMODE;
588 if (mode->format != SDL_PIXELFORMAT_UNKNOWN) { 589 if (mode->format != SDL_PIXELFORMAT_UNKNOWN) {
589 config.flags |= DLCONF_PIXELFORMAT; 590 config.flags |= DLCONF_PIXELFORMAT;
604 return -1; 605 return -1;
605 } 606 }
606 SDL_DFB_DEBUG("Trace\n"); 607 SDL_DFB_DEBUG("Trace\n");
607 config.flags &= ~fail; 608 config.flags &= ~fail;
608 SDL_DFB_CHECKERR(data->layer->SetConfiguration(data->layer, &config)); 609 SDL_DFB_CHECKERR(data->layer->SetConfiguration(data->layer, &config));
609 SDL_DFB_CHECKERR(data->layer-> 610 SDL_DFB_CHECKERR(data->layer->SetCooperativeLevel(data->layer,
610 SetCooperativeLevel(data->layer, DLSCL_ADMINISTRATIVE)); 611 DLSCL_ADMINISTRATIVE));
611 612
612 /* Double check */ 613 /* Double check */
613 SDL_DFB_CHECKERR(data->layer->GetConfiguration(data->layer, &rconfig)); 614 SDL_DFB_CHECKERR(data->layer->GetConfiguration(data->layer, &rconfig));
614 615
615 if ((config.width != rconfig.width) || 616 if ((config.width != rconfig.width) ||
651 window->w, window->h); 652 window->w, window->h);
652 window->driverdata = NULL; 653 window->driverdata = NULL;
653 SDL_DFB_CALLOC(window->driverdata, 1, sizeof(DFB_WindowData)); 654 SDL_DFB_CALLOC(window->driverdata, 1, sizeof(DFB_WindowData));
654 windata = (DFB_WindowData *) window->driverdata; 655 windata = (DFB_WindowData *) window->driverdata;
655 656
656 SDL_DFB_CHECKERR(devdata->dfb-> 657 SDL_DFB_CHECKERR(devdata->
657 SetCooperativeLevel(devdata->dfb, DFSCL_NORMAL)); 658 dfb->SetCooperativeLevel(devdata->dfb, DFSCL_NORMAL));
658 SDL_DFB_CHECKERR(dispdata->layer-> 659 SDL_DFB_CHECKERR(dispdata->
659 SetCooperativeLevel(dispdata->layer, 660 layer->SetCooperativeLevel(dispdata->layer,
660 DLSCL_ADMINISTRATIVE)); 661 DLSCL_ADMINISTRATIVE));
661 662
662 /* Fill the window description. */ 663 /* Fill the window description. */
663 if (window->x == SDL_WINDOWPOS_CENTERED) { 664 if (window->x == SDL_WINDOWPOS_CENTERED) {
664 x = (dispdata->cw - window->w) / 2; 665 x = (dispdata->cw - window->w) / 2;
665 } else if (window->x == SDL_WINDOWPOS_UNDEFINED) { 666 } else if (window->x == SDL_WINDOWPOS_UNDEFINED) {
695 desc.pixelformat = dispdata->pixelformat; 696 desc.pixelformat = dispdata->pixelformat;
696 desc.caps = 0; //DWCAPS_DOUBLEBUFFER; 697 desc.caps = 0; //DWCAPS_DOUBLEBUFFER;
697 desc.surface_caps = DSCAPS_DOUBLE | DSCAPS_TRIPLE; //| DSCAPS_PREMULTIPLIED; 698 desc.surface_caps = DSCAPS_DOUBLE | DSCAPS_TRIPLE; //| DSCAPS_PREMULTIPLIED;
698 699
699 /* Create the window. */ 700 /* Create the window. */
700 SDL_DFB_CHECKERR(dispdata->layer-> 701 SDL_DFB_CHECKERR(dispdata->layer->CreateWindow(dispdata->layer, &desc,
701 CreateWindow(dispdata->layer, &desc, &windata->window)); 702 &windata->window));
702 703
703 windata->window->GetOptions(windata->window, &wopts); 704 windata->window->GetOptions(windata->window, &wopts);
704 #if (DIRECTFB_MAJOR_VERSION == 1) && (DIRECTFB_MINOR_VERSION >= 0) 705 #if (DIRECTFB_MAJOR_VERSION == 1) && (DIRECTFB_MINOR_VERSION >= 0)
705 706
706 if (window->flags & SDL_WINDOW_RESIZABLE) 707 if (window->flags & SDL_WINDOW_RESIZABLE)
714 if (window->flags & SDL_WINDOW_FULLSCREEN) 715 if (window->flags & SDL_WINDOW_FULLSCREEN)
715 wopts |= DWOP_KEEP_POSITION | DWOP_KEEP_STACKING | DWOP_KEEP_SIZE; 716 wopts |= DWOP_KEEP_POSITION | DWOP_KEEP_STACKING | DWOP_KEEP_SIZE;
716 717
717 windata->window->SetOptions(windata->window, wopts); 718 windata->window->SetOptions(windata->window, wopts);
718 /* Get the window's surface. */ 719 /* Get the window's surface. */
719 SDL_DFB_CHECKERR(windata->window-> 720 SDL_DFB_CHECKERR(windata->
720 GetSurface(windata->window, &windata->surface)); 721 window->GetSurface(windata->window, &windata->surface));
721 windata->window->SetOpacity(windata->window, 0xFF); 722 windata->window->SetOpacity(windata->window, 0xFF);
722 SDL_DFB_CHECKERR(windata->window-> 723 SDL_DFB_CHECKERR(windata->window->CreateEventBuffer(windata->window,
723 CreateEventBuffer(windata->window, 724 &
724 &(windata->eventbuffer))); 725 (windata->
726 eventbuffer)));
725 SDL_DFB_CHECKERR(windata->window-> 727 SDL_DFB_CHECKERR(windata->window->
726 EnableEvents(windata->window, 728 EnableEvents(windata->window,
727 DWET_POSITION | DWET_SIZE | DWET_CLOSE | 729 DWET_POSITION | DWET_SIZE | DWET_CLOSE |
728 DWET_ALL)); 730 DWET_ALL));
729 731
782 784
783 SDL_Unsupported(); 785 SDL_Unsupported();
784 //return -1; 786 //return -1;
785 787
786 } 788 }
789
787 static void 790 static void
788 DirectFB_SetWindowPosition(_THIS, SDL_Window * window) 791 DirectFB_SetWindowPosition(_THIS, SDL_Window * window)
789 { 792 {
790 SDL_DFB_DEVICEDATA(_this); 793 SDL_DFB_DEVICEDATA(_this);
791 SDL_DFB_WINDOWDATA(window); 794 SDL_DFB_WINDOWDATA(window);
803 SDL_DFB_DISPLAYDATA(_this, window); 806 SDL_DFB_DISPLAYDATA(_this, window);
804 807
805 if (!(window->flags & SDL_WINDOW_FULLSCREEN)) 808 if (!(window->flags & SDL_WINDOW_FULLSCREEN))
806 windata->window->Resize(windata->window, window->w, window->h); 809 windata->window->Resize(windata->window, window->w, window->h);
807 } 810 }
811
808 static void 812 static void
809 DirectFB_ShowWindow(_THIS, SDL_Window * window) 813 DirectFB_ShowWindow(_THIS, SDL_Window * window)
810 { 814 {
811 SDL_DFB_DEVICEDATA(_this); 815 SDL_DFB_DEVICEDATA(_this);
812 SDL_DFB_WINDOWDATA(window); 816 SDL_DFB_WINDOWDATA(window);
825 829
826 windata->window->GetOpacity(windata->window, &windata->opacity); 830 windata->window->GetOpacity(windata->window, &windata->opacity);
827 windata->window->SetOpacity(windata->window, 0); 831 windata->window->SetOpacity(windata->window, 0);
828 832
829 } 833 }
834
830 static void 835 static void
831 DirectFB_RaiseWindow(_THIS, SDL_Window * window) 836 DirectFB_RaiseWindow(_THIS, SDL_Window * window)
832 { 837 {
833 SDL_DFB_DEVICEDATA(_this); 838 SDL_DFB_DEVICEDATA(_this);
834 SDL_DFB_WINDOWDATA(window); 839 SDL_DFB_WINDOWDATA(window);
846 SDL_DFB_DISPLAYDATA(_this, window); 851 SDL_DFB_DISPLAYDATA(_this, window);
847 852
848 SDL_Unsupported(); 853 SDL_Unsupported();
849 854
850 } 855 }
856
851 static void 857 static void
852 DirectFB_MinimizeWindow(_THIS, SDL_Window * window) 858 DirectFB_MinimizeWindow(_THIS, SDL_Window * window)
853 { 859 {
854 SDL_DFB_DEVICEDATA(_this); 860 SDL_DFB_DEVICEDATA(_this);
855 SDL_DFB_WINDOWDATA(window); 861 SDL_DFB_WINDOWDATA(window);
867 SDL_DFB_DISPLAYDATA(_this, window); 873 SDL_DFB_DISPLAYDATA(_this, window);
868 874
869 SDL_Unsupported(); 875 SDL_Unsupported();
870 876
871 } 877 }
878
872 static void 879 static void
873 DirectFB_SetWindowGrab(_THIS, SDL_Window * window) 880 DirectFB_SetWindowGrab(_THIS, SDL_Window * window)
874 { 881 {
875 SDL_DFB_DEVICEDATA(_this); 882 SDL_DFB_DEVICEDATA(_this);
876 SDL_DFB_WINDOWDATA(window); 883 SDL_DFB_WINDOWDATA(window);
1095 devdata->glFinish(); 1102 devdata->glFinish();
1096 else if (devdata->glFlush) 1103 else if (devdata->glFlush)
1097 devdata->glFlush(); 1104 devdata->glFlush();
1098 1105
1099 SDL_DFB_CHECKERR(windata->gl_context->Unlock(windata->gl_context)); 1106 SDL_DFB_CHECKERR(windata->gl_context->Unlock(windata->gl_context));
1100 SDL_DFB_CHECKERR(windata->surface-> 1107 SDL_DFB_CHECKERR(windata->
1101 Flip(windata->surface, &region, DSFLIP_ONSYNC)); 1108 surface->Flip(windata->surface, &region, DSFLIP_ONSYNC));
1102 SDL_DFB_CHECKERR(windata->gl_context->Lock(windata->gl_context)); 1109 SDL_DFB_CHECKERR(windata->gl_context->Lock(windata->gl_context));
1103 1110
1104 return; 1111 return;
1105 error: 1112 error:
1106 return; 1113 return;