src/video/directfb/SDL_DirectFB_mouse.c
changeset 2735 204be4fc2726
parent 2721 e82a0e3e9b0e
child 2737 140a7edcf2bd
equal deleted inserted replaced
2734:dd25eabe441c 2735:204be4fc2726
    83     dsc.caps = DSCAPS_VIDEOONLY;
    83     dsc.caps = DSCAPS_VIDEOONLY;
    84     dsc.width = surface->w;
    84     dsc.width = surface->w;
    85     dsc.height = surface->h;
    85     dsc.height = surface->h;
    86     dsc.pixelformat = DSPF_ARGB;
    86     dsc.pixelformat = DSPF_ARGB;
    87 
    87 
    88     SDL_DFB_CHECKERR(devdata->dfb->
    88     SDL_DFB_CHECKERR(devdata->
    89                      CreateSurface(devdata->dfb, &dsc, &curdata->surf));
    89                      dfb->CreateSurface(devdata->dfb, &dsc, &curdata->surf));
    90     curdata->hotx = hot_x;
    90     curdata->hotx = hot_x;
    91     curdata->hoty = hot_y;
    91     curdata->hoty = hot_y;
    92     cursor->driverdata = curdata;
    92     cursor->driverdata = curdata;
    93 
    93 
    94     SDL_DFB_CHECKERR(curdata->surf->
    94     SDL_DFB_CHECKERR(curdata->
    95                      Lock(curdata->surf, DSLF_WRITE, (void *) &dest, &pitch));
    95                      surf->Lock(curdata->surf, DSLF_WRITE, (void *) &dest,
       
    96                                 &pitch));
    96 
    97 
    97     //FIXME: Implies a lot of things, e.g. rgba format for SDL_SURFACE ....
    98     //FIXME: Implies a lot of things, e.g. rgba format for SDL_SURFACE ....
    98     p = surface->pixels;
    99     p = surface->pixels;
    99     for (i = 0; i < surface->w * surface->h; i++)
   100     for (i = 0; i < surface->w * surface->h; i++)
   100         if (p[i] == 0x00000000)
   101         if (p[i] == 0x00000000)
   129         SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
   130         SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
   130         DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata;
   131         DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata;
   131         DFB_WindowData *windata = (DFB_WindowData *) window->driverdata;
   132         DFB_WindowData *windata = (DFB_WindowData *) window->driverdata;
   132 
   133 
   133         if (cursor)
   134         if (cursor)
   134             SDL_DFB_CHECKERR(windata->window->
   135             SDL_DFB_CHECKERR(windata->window->SetCursorShape(windata->window,
   135                              SetCursorShape(windata->window, curdata->surf,
   136                                                              curdata->surf,
   136                                             curdata->hotx, curdata->hoty));
   137                                                              curdata->hotx,
       
   138                                                              curdata->hoty));
   137         //TODO: Check administrative 
   139         //TODO: Check administrative 
   138         SDL_DFB_CHECKERR(dispdata->layer->
   140         SDL_DFB_CHECKERR(dispdata->layer->SetCooperativeLevel(dispdata->layer,
   139                          SetCooperativeLevel(dispdata->layer,
   141                                                               DLSCL_ADMINISTRATIVE));
   140                                              DLSCL_ADMINISTRATIVE));
   142         SDL_DFB_CHECKERR(dispdata->layer->SetCursorOpacity(dispdata->layer,
   141         SDL_DFB_CHECKERR(dispdata->layer->
   143                                                            cursor ? 0xC0 :
   142                          SetCursorOpacity(dispdata->layer,
   144                                                            0x00));
   143                                           cursor ? 0xC0 : 0x00));
   145         SDL_DFB_CHECKERR(dispdata->layer->SetCooperativeLevel(dispdata->layer,
   144         SDL_DFB_CHECKERR(dispdata->layer->
   146                                                               DLSCL_SHARED));
   145                          SetCooperativeLevel(dispdata->layer, DLSCL_SHARED));
       
   146     }
   147     }
   147 
   148 
   148     return 0;
   149     return 0;
   149   error:
   150   error:
   150     return -1;
   151     return -1;
   179     DFB_WindowData *windata = (DFB_WindowData *) window->driverdata;
   180     DFB_WindowData *windata = (DFB_WindowData *) window->driverdata;
   180     DFBResult ret;
   181     DFBResult ret;
   181     int cx, cy;
   182     int cx, cy;
   182 
   183 
   183     SDL_DFB_CHECKERR(windata->window->GetPosition(windata->window, &cx, &cy));
   184     SDL_DFB_CHECKERR(windata->window->GetPosition(windata->window, &cx, &cy));
   184     SDL_DFB_CHECKERR(dispdata->layer->
   185     SDL_DFB_CHECKERR(dispdata->
   185                      WarpCursor(dispdata->layer, cx + x, cy + y));
   186                      layer->WarpCursor(dispdata->layer, cx + x, cy + y));
   186 
   187 
   187   error:
   188   error:
   188     return;
   189     return;
   189 }
   190 }
   190 
   191