src/video/directfb/SDL_DirectFB_mouse.c
changeset 3011 8f4ed5ec2b06
parent 2998 d364ee9b9c15
child 3013 8cc00819c8d6
equal deleted inserted replaced
3010:a6694a812119 3011:8f4ed5ec2b06
   130     dsc.caps = DSCAPS_VIDEOONLY;
   130     dsc.caps = DSCAPS_VIDEOONLY;
   131     dsc.width = surface->w;
   131     dsc.width = surface->w;
   132     dsc.height = surface->h;
   132     dsc.height = surface->h;
   133     dsc.pixelformat = DSPF_ARGB;
   133     dsc.pixelformat = DSPF_ARGB;
   134 
   134 
   135     SDL_DFB_CHECKERR(devdata->dfb->
   135     SDL_DFB_CHECKERR(devdata->
   136                      CreateSurface(devdata->dfb, &dsc, &curdata->surf));
   136                      dfb->CreateSurface(devdata->dfb, &dsc, &curdata->surf));
   137     curdata->hotx = hot_x;
   137     curdata->hotx = hot_x;
   138     curdata->hoty = hot_y;
   138     curdata->hoty = hot_y;
   139     cursor->driverdata = curdata;
   139     cursor->driverdata = curdata;
   140 
   140 
   141     SDL_DFB_CHECKERR(curdata->surf->
   141     SDL_DFB_CHECKERR(curdata->
   142                      Lock(curdata->surf, DSLF_WRITE, (void *) &dest, &pitch));
   142                      surf->Lock(curdata->surf, DSLF_WRITE, (void *) &dest,
       
   143                                 &pitch));
   143 
   144 
   144     /* Relies on the fact that this is only called with ARGB surface. */
   145     /* Relies on the fact that this is only called with ARGB surface. */
   145     p = surface->pixels;
   146     p = surface->pixels;
   146     for (i = 0; i < surface->h; i++)
   147     for (i = 0; i < surface->h; i++)
   147         memcpy((char *) dest + i * pitch, (char *) p + i * surface->pitch,
   148         memcpy((char *) dest + i * pitch, (char *) p + i * surface->pitch,
   172             DFB_DisplayData *dispdata =
   173             DFB_DisplayData *dispdata =
   173                 (DFB_DisplayData *) display->driverdata;
   174                 (DFB_DisplayData *) display->driverdata;
   174             DFB_WindowData *windata = (DFB_WindowData *) window->driverdata;
   175             DFB_WindowData *windata = (DFB_WindowData *) window->driverdata;
   175 
   176 
   176             if (cursor)
   177             if (cursor)
   177                 SDL_DFB_CHECKERR(windata->window->
   178                 SDL_DFB_CHECKERR(windata->
   178                                  SetCursorShape(windata->window,
   179                                  window->SetCursorShape(windata->window,
   179                                                 curdata->surf, curdata->hotx,
   180                                                         curdata->surf,
   180                                                 curdata->hoty));
   181                                                         curdata->hotx,
       
   182                                                         curdata->hoty));
   181 
   183 
   182             /* fprintf(stdout, "Cursor is %s\n", cursor ? "on" : "off"); */
   184             /* fprintf(stdout, "Cursor is %s\n", cursor ? "on" : "off"); */
   183             SDL_DFB_CHECKERR(dispdata->layer->
   185             SDL_DFB_CHECKERR(dispdata->
   184                              SetCooperativeLevel(dispdata->layer,
   186                              layer->SetCooperativeLevel(dispdata->layer,
   185                                                  DLSCL_ADMINISTRATIVE));
   187                                                         DLSCL_ADMINISTRATIVE));
   186             SDL_DFB_CHECKERR(dispdata->layer->
   188             SDL_DFB_CHECKERR(dispdata->
   187                              SetCursorOpacity(dispdata->layer,
   189                              layer->SetCursorOpacity(dispdata->layer,
   188                                               cursor ? 0xC0 : 0x00));
   190                                                      cursor ? 0xC0 : 0x00));
   189             SDL_DFB_CHECKERR(dispdata->layer->
   191             SDL_DFB_CHECKERR(dispdata->
   190                              SetCooperativeLevel(dispdata->layer,
   192                              layer->SetCooperativeLevel(dispdata->layer,
   191                                                  DLSCL_SHARED));
   193                                                         DLSCL_SHARED));
   192         }
   194         }
   193     }
   195     }
   194 
   196 
   195     return 0;
   197     return 0;
   196   error:
   198   error:
   225     DFB_WindowData *windata = (DFB_WindowData *) window->driverdata;
   227     DFB_WindowData *windata = (DFB_WindowData *) window->driverdata;
   226     DFBResult ret;
   228     DFBResult ret;
   227     int cx, cy;
   229     int cx, cy;
   228 
   230 
   229     SDL_DFB_CHECKERR(windata->window->GetPosition(windata->window, &cx, &cy));
   231     SDL_DFB_CHECKERR(windata->window->GetPosition(windata->window, &cx, &cy));
   230     SDL_DFB_CHECKERR(dispdata->layer->
   232     SDL_DFB_CHECKERR(dispdata->
   231                      WarpCursor(dispdata->layer, cx + x, cy + y));
   233                      layer->WarpCursor(dispdata->layer, cx + x, cy + y));
   232 
   234 
   233   error:
   235   error:
   234     return;
   236     return;
   235 }
   237 }
   236 
   238