src/video/directfb/SDL_DirectFB_window.c
changeset 3011 8f4ed5ec2b06
parent 2859 99210400e8b9
child 3013 8cc00819c8d6
equal deleted inserted replaced
3010:a6694a812119 3011:8f4ed5ec2b06
    41                   window->w, window->h);
    41                   window->w, window->h);
    42     window->driverdata = NULL;
    42     window->driverdata = NULL;
    43     SDL_DFB_CALLOC(window->driverdata, 1, sizeof(DFB_WindowData));
    43     SDL_DFB_CALLOC(window->driverdata, 1, sizeof(DFB_WindowData));
    44     windata = (DFB_WindowData *) window->driverdata;
    44     windata = (DFB_WindowData *) window->driverdata;
    45 
    45 
    46     SDL_DFB_CHECKERR(devdata->dfb->
    46     SDL_DFB_CHECKERR(devdata->
    47                      SetCooperativeLevel(devdata->dfb, DFSCL_NORMAL));
    47                      dfb->SetCooperativeLevel(devdata->dfb, DFSCL_NORMAL));
    48     SDL_DFB_CHECKERR(dispdata->layer->
    48     SDL_DFB_CHECKERR(dispdata->
    49                      SetCooperativeLevel(dispdata->layer,
    49                      layer->SetCooperativeLevel(dispdata->layer,
    50                                          DLSCL_ADMINISTRATIVE));
    50                                                 DLSCL_ADMINISTRATIVE));
    51 
    51 
    52     /* Fill the window description. */
    52     /* Fill the window description. */
    53     if (window->x == SDL_WINDOWPOS_CENTERED) {
    53     if (window->x == SDL_WINDOWPOS_CENTERED) {
    54         x = (dispdata->cw - window->w) / 2;
    54         x = (dispdata->cw - window->w) / 2;
    55     } else if (window->x == SDL_WINDOWPOS_UNDEFINED) {
    55     } else if (window->x == SDL_WINDOWPOS_UNDEFINED) {
    98 #endif
    98 #endif
    99     desc.surface_caps = DSCAPS_PREMULTIPLIED;
    99     desc.surface_caps = DSCAPS_PREMULTIPLIED;
   100     /* DSCAPS_VIDEOONLY has negative impact on performance */
   100     /* DSCAPS_VIDEOONLY has negative impact on performance */
   101 
   101 
   102     /* Create the window. */
   102     /* Create the window. */
   103     SDL_DFB_CHECKERR(dispdata->layer->
   103     SDL_DFB_CHECKERR(dispdata->
   104                      CreateWindow(dispdata->layer, &desc, &windata->window));
   104                      layer->CreateWindow(dispdata->layer, &desc,
       
   105                                          &windata->window));
   105 
   106 
   106     windata->window->GetOptions(windata->window, &wopts);
   107     windata->window->GetOptions(windata->window, &wopts);
   107 #if (DIRECTFB_MAJOR_VERSION == 1) && (DIRECTFB_MINOR_VERSION >= 0)
   108 #if (DIRECTFB_MAJOR_VERSION == 1) && (DIRECTFB_MINOR_VERSION >= 0)
   108 
   109 
   109     if (window->flags & SDL_WINDOW_RESIZABLE)
   110     if (window->flags & SDL_WINDOW_RESIZABLE)
   117     if (window->flags & SDL_WINDOW_FULLSCREEN)
   118     if (window->flags & SDL_WINDOW_FULLSCREEN)
   118         wopts |= DWOP_KEEP_POSITION | DWOP_KEEP_STACKING | DWOP_KEEP_SIZE;
   119         wopts |= DWOP_KEEP_POSITION | DWOP_KEEP_STACKING | DWOP_KEEP_SIZE;
   119 
   120 
   120     windata->window->SetOptions(windata->window, wopts);
   121     windata->window->SetOptions(windata->window, wopts);
   121     /* Get the window's surface. */
   122     /* Get the window's surface. */
   122     SDL_DFB_CHECKERR(windata->window->
   123     SDL_DFB_CHECKERR(windata->
   123                      GetSurface(windata->window, &windata->surface));
   124                      window->GetSurface(windata->window, &windata->surface));
   124     windata->window->SetOpacity(windata->window, 0xFF);
   125     windata->window->SetOpacity(windata->window, 0xFF);
   125     SDL_DFB_CHECKERR(windata->window->
   126     SDL_DFB_CHECKERR(windata->window->CreateEventBuffer(windata->window,
   126                      CreateEventBuffer(windata->window,
   127                                                         &(windata->
   127                                        &(windata->eventbuffer)));
   128                                                           eventbuffer)));
   128     SDL_DFB_CHECKERR(windata->window->
   129     SDL_DFB_CHECKERR(windata->
   129                      EnableEvents(windata->window, DWET_ALL));
   130                      window->EnableEvents(windata->window, DWET_ALL));
   130 
   131 
   131     if (window->flags & SDL_WINDOW_FULLSCREEN)
   132     if (window->flags & SDL_WINDOW_FULLSCREEN)
   132         windata->window->SetStackingClass(windata->window, DWSC_UPPER);
   133         windata->window->SetStackingClass(windata->window, DWSC_UPPER);
   133     /* Make it the top most window. */
   134     /* Make it the top most window. */
   134     windata->window->RaiseToTop(windata->window);
   135     windata->window->RaiseToTop(windata->window);
   200 #if (DIRECTFB_MAJOR_VERSION == 1) && (DIRECTFB_MINOR_VERSION >= 0)
   201 #if (DIRECTFB_MAJOR_VERSION == 1) && (DIRECTFB_MINOR_VERSION >= 0)
   201         int cw;
   202         int cw;
   202         int ch;
   203         int ch;
   203 
   204 
   204         /* Make sure all events are disabled for this operation ! */
   205         /* Make sure all events are disabled for this operation ! */
   205         SDL_DFB_CHECKERR(windata->window->
   206         SDL_DFB_CHECKERR(windata->
   206                          DisableEvents(windata->window, DWET_ALL));
   207                          window->DisableEvents(windata->window, DWET_ALL));
   207 
   208 
   208         SDL_DFB_CHECKERR(windata->window->GetSize(windata->window, &cw, &ch));
   209         SDL_DFB_CHECKERR(windata->window->GetSize(windata->window, &cw, &ch));
   209         if (cw != window->w || ch != window->h)
   210         if (cw != window->w || ch != window->h)
   210             SDL_DFB_CHECKERR(windata->window->
   211             SDL_DFB_CHECKERR(windata->
   211                              Resize(windata->window, window->w, window->h));
   212                              window->Resize(windata->window, window->w,
   212         SDL_DFB_CHECKERR(windata->window->
   213                                             window->h));
   213                          EnableEvents(windata->window, DWET_ALL));
   214         SDL_DFB_CHECKERR(windata->
       
   215                          window->EnableEvents(windata->window, DWET_ALL));
   214 
   216 
   215 #else
   217 #else
   216         SDL_DFB_CHECKERR(windata->window->
   218         SDL_DFB_CHECKERR(windata->
   217                          Resize(windata->window, window->w, window->h));
   219                          window->Resize(windata->window, window->w,
       
   220                                         window->h));
   218 #endif
   221 #endif
   219         SDL_DFB_CHECKERR(windata->window->GetSize(windata->window, &window->w, &window->h));    /* if a window manager should have decided otherwise */
   222         SDL_DFB_CHECKERR(windata->window->GetSize(windata->window, &window->w, &window->h));    /* if a window manager should have decided otherwise */
   220 
   223 
   221         SDL_OnWindowResized(window);
   224         SDL_OnWindowResized(window);
   222     }
   225     }