Date: Fri, 17 Aug 2007 01:12:31 +0200
authorSam Lantinga <slouken@libsdl.org>
Fri, 17 Aug 2007 02:54:50 +0000
changeset 2259 1e690901ecd7
parent 2258 771bd3389e3a
child 2260 202ddfd1cfb1
Date: Fri, 17 Aug 2007 01:12:31 +0200 From: Couriersud Subject: fix for audio dsp exit crash / various dfb issues improved cursor handling fixes some mouse and event related bugs
src/video/directfb/SDL_DirectFB_events.c
src/video/directfb/SDL_DirectFB_mouse.c
src/video/directfb/SDL_DirectFB_mouse.h
src/video/directfb/SDL_DirectFB_video.c
--- a/src/video/directfb/SDL_DirectFB_events.c	Fri Aug 17 02:54:12 2007 +0000
+++ b/src/video/directfb/SDL_DirectFB_events.c	Fri Aug 17 02:54:50 2007 +0000
@@ -64,7 +64,7 @@
                                         DirectFB_TranslateButton(evt.button));
                     break;
                 case DWET_MOTION:
-                    SDL_SendMouseMotion(devdata->mouse, 0, evt.x, evt.y);
+                    SDL_SendMouseMotion(devdata->mouse, 0, evt.cx, evt.cy);
                     break;
                 case DWET_KEYDOWN:
                     DirectFB_TranslateKey(evt.key_id, evt.key_symbol,
@@ -79,14 +79,14 @@
                                         keysym.scancode, keysym.sym);
                     break;
                 case DWET_POSITION_SIZE:
-                    SDL_SendWindowEvent(p->id, SDL_WINDOWEVENT_MOVED, evt.cx,
-                                        evt.cy);
+                    SDL_SendWindowEvent(p->id, SDL_WINDOWEVENT_MOVED, evt.x,
+                                        evt.y);
                     SDL_SendWindowEvent(p->id, SDL_WINDOWEVENT_RESIZED, evt.w,
                                         evt.h);
                     break;
                 case DWET_POSITION:
-                    SDL_SendWindowEvent(p->id, SDL_WINDOWEVENT_MOVED, evt.cx,
-                                        evt.cy);
+                    SDL_SendWindowEvent(p->id, SDL_WINDOWEVENT_MOVED, evt.x,
+                                        evt.y);
                     break;
                 case DWET_SIZE:
                     SDL_SendWindowEvent(p->id, SDL_WINDOWEVENT_RESIZED, evt.w,
--- a/src/video/directfb/SDL_DirectFB_mouse.c	Fri Aug 17 02:54:12 2007 +0000
+++ b/src/video/directfb/SDL_DirectFB_mouse.c	Fri Aug 17 02:54:50 2007 +0000
@@ -112,6 +112,7 @@
 static int
 DirectFB_ShowCursor(SDL_Cursor * cursor)
 {
+    //FIXME check for null cursor here
     SDL_DFB_CURSORDATA(cursor);
     SDL_VideoDevice *dev = SDL_GetVideoDevice();
     SDL_DFB_DEVICEDATA(dev);
@@ -130,32 +131,22 @@
         SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
         DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata;
         DFB_WindowData *windata = (DFB_WindowData *) window->driverdata;
-        SDL_DFB_CHECKERR(windata->window->
-                         SetCursorShape(windata->window, curdata->surf,
-                                        curdata->hotx, curdata->hoty));
+
+        if (cursor)
+            SDL_DFB_CHECKERR(windata->window->
+                             SetCursorShape(windata->window, curdata->surf,
+                                            curdata->hotx, curdata->hoty));
         //FIXME: This is somehow a directfb issue
+        //TODO: Check administrative 
         SDL_DFB_CHECKERR(dispdata->layer->
                          SetCooperativeLevel(dispdata->layer,
                                              DLSCL_ADMINISTRATIVE));
         SDL_DFB_CHECKERR(dispdata->layer->
-                         SetCursorOpacity(dispdata->layer, 0xC0));
+                         SetCursorOpacity(dispdata->layer,
+                                          cursor ? 0xC0 : 0x00));
         SDL_DFB_CHECKERR(dispdata->layer->
                          SetCooperativeLevel(dispdata->layer, DLSCL_SHARED));
     }
-#if 0
-    //TODO: Check administrative 
-    SDL_DFB_CHECKERR(dispdata->layer->
-                     SetCooperativeLevel(dispdata->layer,
-                                         DLSCL_ADMINISTRATIVE));
-    SDL_DFB_CHECKERR(dispdata->layer->
-                     SetCursorShape(dispdata->layer, curdata->surf,
-                                    curdata->hotx, curdata->hoty));
-    SDL_DFB_CHECKERR(dispdata->layer->
-                     SetCursorOpacity(dispdata->layer, 0xC0));
-    SDL_DFB_CHECKERR(dispdata->layer->
-                     SetCooperativeLevel(dispdata->layer, DLSCL_SHARED));
-
-#endif
 
     return 0;
   error:
--- a/src/video/directfb/SDL_DirectFB_mouse.h	Fri Aug 17 02:54:12 2007 +0000
+++ b/src/video/directfb/SDL_DirectFB_mouse.h	Fri Aug 17 02:54:50 2007 +0000
@@ -33,7 +33,7 @@
     int hoty;
 };
 
-#define SDL_DFB_CURSORDATA(curs)  DFB_CursorData *curdata = (DFB_CursorData *) ((curs)->driverdata)
+#define SDL_DFB_CURSORDATA(curs)  DFB_CursorData *curdata = (DFB_CursorData *) ((curs) ? (curs)->driverdata : NULL)
 
 extern void DirectFB_InitMouse(_THIS);
 extern void DirectFB_QuitMouse(_THIS);
--- a/src/video/directfb/SDL_DirectFB_video.c	Fri Aug 17 02:54:12 2007 +0000
+++ b/src/video/directfb/SDL_DirectFB_video.c	Fri Aug 17 02:54:50 2007 +0000
@@ -674,17 +674,25 @@
     } else {
         y = window->y;
     }
+    if (window->flags & SDL_WINDOW_FULLSCREEN) {
+        x = 0;
+        y = 0;
+    }
 
     desc.flags =
-        DWDESC_WIDTH | DWDESC_HEIGHT | DWDESC_CAPS | DWDESC_PIXELFORMAT;
-    desc.flags |= DWDESC_POSX | DWDESC_POSY | DWDESC_SURFACE_CAPS;
-    desc.posx = x;
-    desc.posy = y;
+        DWDESC_WIDTH | DWDESC_HEIGHT | DWDESC_CAPS | DWDESC_PIXELFORMAT |
+        DWDESC_SURFACE_CAPS;
+    if (!(window->flags & SDL_WINDOW_FULLSCREEN)
+        && window->x != SDL_WINDOWPOS_UNDEFINED
+        && window->y != SDL_WINDOWPOS_UNDEFINED) {
+        desc.flags |= DWDESC_POSX | DWDESC_POSY;
+        desc.posx = x;
+        desc.posy = y;
+    }
+
     desc.width = window->w;
     desc.height = window->h;
-
     desc.pixelformat = dispdata->pixelformat;
-
     desc.caps = 0;              //DWCAPS_DOUBLEBUFFER;
     desc.surface_caps = DSCAPS_DOUBLE | DSCAPS_TRIPLE;  //| DSCAPS_PREMULTIPLIED;
 
@@ -783,7 +791,8 @@
     SDL_DFB_WINDOWDATA(window);
     SDL_DFB_DISPLAYDATA(_this, window);
 
-    windata->window->MoveTo(windata->window, window->x, window->y);
+    if (!(window->flags & SDL_WINDOW_FULLSCREEN))
+        windata->window->MoveTo(windata->window, window->x, window->y);
 }
 
 static void
@@ -793,8 +802,8 @@
     SDL_DFB_WINDOWDATA(window);
     SDL_DFB_DISPLAYDATA(_this, window);
 
-    windata->window->Resize(windata->window, window->w, window->h);
-
+    if (!(window->flags & SDL_WINDOW_FULLSCREEN))
+        windata->window->Resize(windata->window, window->w, window->h);
 }
 static void
 DirectFB_ShowWindow(_THIS, SDL_Window * window)