diff src/video/directfb/SDL_DirectFB_mouse.c @ 3023:d72a0dd80e8b

DirectFB cleanups & simple window manager - use SDL_getenv, not getenv ... - no more support for 0.9.25 - not even mentioned any longer on directfb.org - fix fullscreen issues - add a simple window manager unless the directfb team comes up with a working wm. The driver has support for a very, very basic window manager you may want to use when runnning with "wm=default". Use export SDL_DIRECTFB_WM=1 to enable basic window borders including icon support. In order to have the window title rendered, you need to have the following font installed: /usr/share/fonts/truetype/freefont/FreeSans.ttf
author Couriersud <couriersud@arcor.de>
date Sun, 11 Jan 2009 23:49:23 +0000
parents 8cc00819c8d6
children 64ce267332c6
line wrap: on
line diff
--- a/src/video/directfb/SDL_DirectFB_mouse.c	Sun Jan 11 23:39:11 2009 +0000
+++ b/src/video/directfb/SDL_DirectFB_mouse.c	Sun Jan 11 23:49:23 2009 +0000
@@ -26,8 +26,8 @@
 #include "../SDL_sysvideo.h"
 #include "../../events/SDL_mouse_c.h"
 
-static SDL_Cursor *DirectFB_CreateCursor(SDL_Surface * surface, int hot_x,
-                                         int hot_y);
+static SDL_Cursor *DirectFB_CreateCursor(SDL_Surface * surface,
+                                         int hot_x, int hot_y);
 static int DirectFB_ShowCursor(SDL_Cursor * cursor);
 static void DirectFB_MoveCursor(SDL_Cursor * cursor);
 static void DirectFB_FreeCursor(SDL_Cursor * cursor);
@@ -38,8 +38,8 @@
 static int id_mask;
 
 static DFBEnumerationResult
-EnumMice(DFBInputDeviceID device_id,
-         DFBInputDeviceDescription desc, void *callbackdata)
+EnumMice(DFBInputDeviceID device_id, DFBInputDeviceDescription desc,
+         void *callbackdata)
 {
     DFB_DeviceData *devdata = callbackdata;
 
@@ -132,20 +132,20 @@
     dsc.height = surface->h;
     dsc.pixelformat = DSPF_ARGB;
 
-    SDL_DFB_CHECKERR(devdata->dfb->
-                     CreateSurface(devdata->dfb, &dsc, &curdata->surf));
+    SDL_DFB_CHECKERR(devdata->dfb->CreateSurface(devdata->dfb, &dsc,
+                                                 &curdata->surf));
     curdata->hotx = hot_x;
     curdata->hoty = hot_y;
     cursor->driverdata = curdata;
 
-    SDL_DFB_CHECKERR(curdata->surf->
-                     Lock(curdata->surf, DSLF_WRITE, (void *) &dest, &pitch));
+    SDL_DFB_CHECKERR(curdata->surf->Lock(curdata->surf, DSLF_WRITE,
+                                         (void *) &dest, &pitch));
 
     /* Relies on the fact that this is only called with ARGB surface. */
     p = surface->pixels;
     for (i = 0; i < surface->h; i++)
-        memcpy((char *) dest + i * pitch, (char *) p + i * surface->pitch,
-               4 * surface->w);
+        memcpy((char *) dest + i * pitch,
+               (char *) p + i * surface->pitch, 4 * surface->w);
 
     curdata->surf->Unlock(curdata->surf);
     return cursor;
@@ -162,7 +162,7 @@
     SDL_WindowID wid;
 
     wid = SDL_GetFocusWindow();
-    if (wid < 0)
+    if (wid <= 0)
         return -1;
     else {
         SDL_Window *window = SDL_GetWindowFromID(wid);
@@ -179,7 +179,6 @@
                                                 curdata->surf, curdata->hotx,
                                                 curdata->hoty));
 
-            /* fprintf(stdout, "Cursor is %s\n", cursor ? "on" : "off"); */
             SDL_DFB_CHECKERR(dispdata->layer->
                              SetCooperativeLevel(dispdata->layer,
                                                  DLSCL_ADMINISTRATIVE));
@@ -227,8 +226,9 @@
     int cx, cy;
 
     SDL_DFB_CHECKERR(windata->window->GetPosition(windata->window, &cx, &cy));
-    SDL_DFB_CHECKERR(dispdata->layer->
-                     WarpCursor(dispdata->layer, cx + x, cy + y));
+    SDL_DFB_CHECKERR(dispdata->layer->WarpCursor(dispdata->layer,
+                                                 cx + x + windata->client.x,
+                                                 cy + y + windata->client.y));
 
   error:
     return;