Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Date: Fri, 17 Aug 2007 01:12:31 +0200
Browse files Browse the repository at this point in the history
From: Couriersud
Subject: fix for audio dsp exit crash / various dfb issues

improved cursor handling
fixes some mouse and event related bugs
  • Loading branch information
slouken committed Aug 17, 2007
1 parent b3aa32b commit 88a2993
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 33 deletions.
10 changes: 5 additions & 5 deletions src/video/directfb/SDL_DirectFB_events.c
Expand Up @@ -64,7 +64,7 @@ DirectFB_PumpEventsWindow(_THIS)
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,
Expand All @@ -79,14 +79,14 @@ DirectFB_PumpEventsWindow(_THIS)
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,
Expand Down
27 changes: 9 additions & 18 deletions src/video/directfb/SDL_DirectFB_mouse.c
Expand Up @@ -112,6 +112,7 @@ DirectFB_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y)
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);
Expand All @@ -130,32 +131,22 @@ DirectFB_ShowCursor(SDL_Cursor * cursor)
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:
Expand Down
2 changes: 1 addition & 1 deletion src/video/directfb/SDL_DirectFB_mouse.h
Expand Up @@ -33,7 +33,7 @@ struct _DFB_CursorData
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);
Expand Down
27 changes: 18 additions & 9 deletions src/video/directfb/SDL_DirectFB_video.c
Expand Up @@ -674,17 +674,25 @@ DirectFB_CreateWindow(_THIS, SDL_Window * window)
} 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;

Expand Down Expand Up @@ -783,7 +791,8 @@ DirectFB_SetWindowPosition(_THIS, SDL_Window * window)
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
Expand All @@ -793,8 +802,8 @@ DirectFB_SetWindowSize(_THIS, SDL_Window * window)
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)
Expand Down

0 comments on commit 88a2993

Please sign in to comment.