Commit 4e19d730 authored by Sam Lantinga's avatar Sam Lantinga

Couriersud to Sam

I have done some quick changes and at least the code compiles again. It
also works with a number of the test executables with the DFB X11
backend. I hope to find time to get SDLMAME to work with latest SDL1.3
(i.e. rip out multi-keyboard, multi-mice & cursor support) next week to
test it further.

Regards,

André
parent b0a24ac8
...@@ -210,7 +210,7 @@ DirectFB_WM_MaximizeWindow(_THIS, SDL_Window * window) ...@@ -210,7 +210,7 @@ DirectFB_WM_MaximizeWindow(_THIS, SDL_Window * window)
windata->window->MoveTo(windata->window, 0, 0); windata->window->MoveTo(windata->window, 0, 0);
windata->window->Resize(windata->window, windata->window->Resize(windata->window,
display->current_mode.w, display->current_mode.h); display->current_mode.w, display->current_mode.h);
SDL_SendWindowEvent(windata->sdl_id, SDL_WINDOWEVENT_MAXIMIZED, 0, 0); SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MAXIMIZED, 0, 0);
} }
void void
...@@ -226,7 +226,7 @@ DirectFB_WM_RestoreWindow(_THIS, SDL_Window * window) ...@@ -226,7 +226,7 @@ DirectFB_WM_RestoreWindow(_THIS, SDL_Window * window)
windata->restore.y); windata->restore.y);
windata->window->Resize(windata->window, windata->restore.w, windata->window->Resize(windata->window, windata->restore.w,
windata->restore.h); windata->restore.h);
SDL_SendWindowEvent(windata->sdl_id, SDL_WINDOWEVENT_RESTORED, 0, 0); SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESTORED, 0, 0);
} }
enum enum
...@@ -304,7 +304,7 @@ DirectFB_WM_ProcessEvent(_THIS, SDL_Window * window, DFBWindowEvent * evt) ...@@ -304,7 +304,7 @@ DirectFB_WM_ProcessEvent(_THIS, SDL_Window * window, DFBWindowEvent * evt)
case WM_POS_NONE: case WM_POS_NONE:
return 0; return 0;
case WM_POS_CLOSE: case WM_POS_CLOSE:
SDL_SendWindowEvent(windata->sdl_id, SDL_WINDOWEVENT_CLOSE, 0, SDL_SendWindowEvent(window, SDL_WINDOWEVENT_CLOSE, 0,
0); 0);
return 1; return 1;
case WM_POS_MAX: case WM_POS_MAX:
......
...@@ -32,6 +32,19 @@ ...@@ -32,6 +32,19 @@
#include "../../events/scancodes_linux.h" #include "../../events/scancodes_linux.h"
#include "SDL_DirectFB_events.h" #include "SDL_DirectFB_events.h"
#if USE_MULTI_API
#define SDL_SendMouseMotion_ex(id, relative, x, y, p) SDL_SendMouseMotion(id, relative, x, y, p)
#define SDL_SendMouseButton_ex(id, state, button) SDL_SendMouseButton(id, state, button)
#define SDL_SendKeyboardKey_ex(id, state, scancode) SDL_SendKeyboardKey(id, state, scancode)
#define SDL_SendKeyboardText_ex(id, text) SDL_SendKeyboardText(id, text)
#else
#define SDL_SendMouseMotion_ex(id, relative, x, y, p) SDL_SendMouseMotion(relative, x, y)
#define SDL_SendMouseButton_ex(id, state, button) SDL_SendMouseButton(state, button)
#define SDL_SendKeyboardKey_ex(id, state, scancode) SDL_SendKeyboardKey(state, scancode)
#define SDL_SendKeyboardText_ex(id, text) SDL_SendKeyboardText(text)
#endif
/* The translation tables from a DirectFB keycode to a SDL keysym */ /* The translation tables from a DirectFB keycode to a SDL keysym */
static SDLKey oskeymap[256]; static SDLKey oskeymap[256];
static int sys_ids; static int sys_ids;
...@@ -54,7 +67,6 @@ DirectFB_SetContext(_THIS, SDL_Window *window) ...@@ -54,7 +67,6 @@ DirectFB_SetContext(_THIS, SDL_Window *window)
* This has simply no effect. * This has simply no effect.
*/ */
SDL_Window *window = SDL_GetWindowFromID(id);
SDL_VideoDisplay *display = window->display; SDL_VideoDisplay *display = window->display;
DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata; DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata;
int ret; int ret;
...@@ -72,27 +84,36 @@ DirectFB_SetContext(_THIS, SDL_Window *window) ...@@ -72,27 +84,36 @@ DirectFB_SetContext(_THIS, SDL_Window *window)
static void static void
FocusAllMice(_THIS, SDL_Window *window) FocusAllMice(_THIS, SDL_Window *window)
{ {
#if USE_MULTI_API
SDL_DFB_DEVICEDATA(_this); SDL_DFB_DEVICEDATA(_this);
int index; int index;
for (index = 0; index < devdata->num_mice; index++) for (index = 0; index < devdata->num_mice; index++)
SDL_SetMouseFocus(devdata->mouse_id[index], id); SDL_SetMouseFocus(devdata->mouse_id[index], id);
#else
SDL_SetMouseFocus(window);
#endif
} }
static void static void
FocusAllKeyboards(_THIS, SDL_Window *window) FocusAllKeyboards(_THIS, SDL_Window *window)
{ {
#if USE_MULTI_API
SDL_DFB_DEVICEDATA(_this); SDL_DFB_DEVICEDATA(_this);
int index; int index;
for (index = 0; index < devdata->num_keyboard; index++) for (index = 0; index < devdata->num_keyboard; index++)
SDL_SetKeyboardFocus(index, id); SDL_SetKeyboardFocus(index, id);
#else
SDL_SetKeyboardFocus(window);
#endif
} }
static void static void
MotionAllMice(_THIS, int x, int y) MotionAllMice(_THIS, int x, int y)
{ {
#if USE_MULTI_API
SDL_DFB_DEVICEDATA(_this); SDL_DFB_DEVICEDATA(_this);
int index; int index;
...@@ -102,6 +123,7 @@ MotionAllMice(_THIS, int x, int y) ...@@ -102,6 +123,7 @@ MotionAllMice(_THIS, int x, int y)
mouse->y = mouse->last_y = y; mouse->y = mouse->last_y = y;
//SDL_SendMouseMotion(devdata->mouse_id[index], 0, x, y, 0); //SDL_SendMouseMotion(devdata->mouse_id[index], 0, x, y, 0);
} }
#endif
} }
static int static int
...@@ -150,9 +172,9 @@ ProcessWindowEvent(_THIS, DFB_WindowData * p, Uint32 flags, ...@@ -150,9 +172,9 @@ ProcessWindowEvent(_THIS, DFB_WindowData * p, Uint32 flags,
case DWET_BUTTONDOWN: case DWET_BUTTONDOWN:
if (ClientXY(p, &evt->x, &evt->y)) { if (ClientXY(p, &evt->x, &evt->y)) {
if (!devdata->use_linux_input) { if (!devdata->use_linux_input) {
SDL_SendMouseMotion(devdata->mouse_id[0], 0, evt->x, SDL_SendMouseMotion_ex(devdata->mouse_id[0], 0, evt->x,
evt->y, 0); evt->y, 0);
SDL_SendMouseButton(devdata->mouse_id[0], SDL_SendMouseButton_ex(devdata->mouse_id[0],
SDL_PRESSED, SDL_PRESSED,
DirectFB_TranslateButton DirectFB_TranslateButton
(evt->button)); (evt->button));
...@@ -164,9 +186,9 @@ ProcessWindowEvent(_THIS, DFB_WindowData * p, Uint32 flags, ...@@ -164,9 +186,9 @@ ProcessWindowEvent(_THIS, DFB_WindowData * p, Uint32 flags,
case DWET_BUTTONUP: case DWET_BUTTONUP:
if (ClientXY(p, &evt->x, &evt->y)) { if (ClientXY(p, &evt->x, &evt->y)) {
if (!devdata->use_linux_input) { if (!devdata->use_linux_input) {
SDL_SendMouseMotion(devdata->mouse_id[0], 0, evt->x, SDL_SendMouseMotion_ex(devdata->mouse_id[0], 0, evt->x,
evt->y, 0); evt->y, 0);
SDL_SendMouseButton(devdata->mouse_id[0], SDL_SendMouseButton_ex(devdata->mouse_id[0],
SDL_RELEASED, SDL_RELEASED,
DirectFB_TranslateButton DirectFB_TranslateButton
(evt->button)); (evt->button));
...@@ -177,10 +199,10 @@ ProcessWindowEvent(_THIS, DFB_WindowData * p, Uint32 flags, ...@@ -177,10 +199,10 @@ ProcessWindowEvent(_THIS, DFB_WindowData * p, Uint32 flags,
break; break;
case DWET_MOTION: case DWET_MOTION:
if (ClientXY(p, &evt->x, &evt->y)) { if (ClientXY(p, &evt->x, &evt->y)) {
SDL_Window *window = p->window; SDL_Window *window = p->sdl_window;
if (!devdata->use_linux_input) { if (!devdata->use_linux_input) {
if (!(flags & SDL_WINDOW_INPUT_GRABBED)) if (!(flags & SDL_WINDOW_INPUT_GRABBED))
SDL_SendMouseMotion(devdata->mouse_id[0], 0, SDL_SendMouseMotion_ex(devdata->mouse_id[0], 0,
evt->x, evt->y, 0); evt->x, evt->y, 0);
} else { } else {
/* relative movements are not exact! /* relative movements are not exact!
...@@ -200,12 +222,12 @@ ProcessWindowEvent(_THIS, DFB_WindowData * p, Uint32 flags, ...@@ -200,12 +222,12 @@ ProcessWindowEvent(_THIS, DFB_WindowData * p, Uint32 flags,
case DWET_KEYDOWN: case DWET_KEYDOWN:
if (!devdata->use_linux_input) { if (!devdata->use_linux_input) {
DirectFB_TranslateKey(_this, evt, &keysym); DirectFB_TranslateKey(_this, evt, &keysym);
SDL_SendKeyboardKey(0, SDL_PRESSED, keysym.scancode); SDL_SendKeyboardKey_ex(0, SDL_PRESSED, keysym.scancode);
if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) { if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) {
SDL_memcpy(text, &keysym.unicode, 4); SDL_memcpy(text, &keysym.unicode, 4);
text[4] = 0; text[4] = 0;
if (*text) { if (*text) {
SDL_SendKeyboardText(0, text); SDL_SendKeyboardText_ex(0, text);
} }
} }
} }
...@@ -213,18 +235,18 @@ ProcessWindowEvent(_THIS, DFB_WindowData * p, Uint32 flags, ...@@ -213,18 +235,18 @@ ProcessWindowEvent(_THIS, DFB_WindowData * p, Uint32 flags,
case DWET_KEYUP: case DWET_KEYUP:
if (!devdata->use_linux_input) { if (!devdata->use_linux_input) {
DirectFB_TranslateKey(_this, evt, &keysym); DirectFB_TranslateKey(_this, evt, &keysym);
SDL_SendKeyboardKey(0, SDL_RELEASED, keysym.scancode); SDL_SendKeyboardKey_ex(0, SDL_RELEASED, keysym.scancode);
} }
break; break;
case DWET_POSITION: case DWET_POSITION:
if (ClientXY(p, &evt->x, &evt->y)) { if (ClientXY(p, &evt->x, &evt->y)) {
SDL_SendWindowEvent(p->window, SDL_WINDOWEVENT_MOVED, SDL_SendWindowEvent(p->sdl_window, SDL_WINDOWEVENT_MOVED,
evt->x, evt->y); evt->x, evt->y);
} }
break; break;
case DWET_POSITION_SIZE: case DWET_POSITION_SIZE:
if (ClientXY(p, &evt->x, &evt->y)) { if (ClientXY(p, &evt->x, &evt->y)) {
SDL_SendWindowEvent(p->window, SDL_WINDOWEVENT_MOVED, SDL_SendWindowEvent(p->sdl_window, SDL_WINDOWEVENT_MOVED,
evt->x, evt->y); evt->x, evt->y);
} }
/* fall throught */ /* fall throught */
...@@ -234,32 +256,32 @@ ProcessWindowEvent(_THIS, DFB_WindowData * p, Uint32 flags, ...@@ -234,32 +256,32 @@ ProcessWindowEvent(_THIS, DFB_WindowData * p, Uint32 flags,
evt->h -= evt->h -=
(p->theme.top_size + p->theme.bottom_size + (p->theme.top_size + p->theme.bottom_size +
p->theme.caption_size); p->theme.caption_size);
SDL_SendWindowEvent(p->window, SDL_WINDOWEVENT_RESIZED, SDL_SendWindowEvent(p->sdl_window, SDL_WINDOWEVENT_RESIZED,
evt->w, evt->h); evt->w, evt->h);
break; break;
case DWET_CLOSE: case DWET_CLOSE:
SDL_SendWindowEvent(p->window, SDL_WINDOWEVENT_CLOSE, 0, 0); SDL_SendWindowEvent(p->sdl_window, SDL_WINDOWEVENT_CLOSE, 0, 0);
break; break;
case DWET_GOTFOCUS: case DWET_GOTFOCUS:
DirectFB_SetContext(_this, p->window); DirectFB_SetContext(_this, p->sdl_window);
FocusAllKeyboards(_this, p->window); FocusAllKeyboards(_this, p->sdl_window);
SDL_SendWindowEvent(p->window, SDL_WINDOWEVENT_FOCUS_GAINED, SDL_SendWindowEvent(p->sdl_window, SDL_WINDOWEVENT_FOCUS_GAINED,
0, 0); 0, 0);
break; break;
case DWET_LOSTFOCUS: case DWET_LOSTFOCUS:
SDL_SendWindowEvent(p->window, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0); SDL_SendWindowEvent(p->sdl_window, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0);
FocusAllKeyboards(_this, 0); FocusAllKeyboards(_this, 0);
break; break;
case DWET_ENTER: case DWET_ENTER:
/* SDL_DirectFB_ReshowCursor(_this, 0); */ /* SDL_DirectFB_ReshowCursor(_this, 0); */
FocusAllMice(_this, p->window); FocusAllMice(_this, p->sdl_window);
// FIXME: when do we really enter ? // FIXME: when do we really enter ?
if (ClientXY(p, &evt->x, &evt->y)) if (ClientXY(p, &evt->x, &evt->y))
MotionAllMice(_this, evt->x, evt->y); MotionAllMice(_this, evt->x, evt->y);
SDL_SendWindowEvent(p->window, SDL_WINDOWEVENT_ENTER, 0, 0); SDL_SendWindowEvent(p->sdl_window, SDL_WINDOWEVENT_ENTER, 0, 0);
break; break;
case DWET_LEAVE: case DWET_LEAVE:
SDL_SendWindowEvent(p->window, SDL_WINDOWEVENT_LEAVE, 0, 0); SDL_SendWindowEvent(p->sdl_window, SDL_WINDOWEVENT_LEAVE, 0, 0);
FocusAllMice(_this, 0); FocusAllMice(_this, 0);
/* SDL_DirectFB_ReshowCursor(_this, 1); */ /* SDL_DirectFB_ReshowCursor(_this, 1); */
break; break;
...@@ -271,7 +293,7 @@ ProcessWindowEvent(_THIS, DFB_WindowData * p, Uint32 flags, ...@@ -271,7 +293,7 @@ ProcessWindowEvent(_THIS, DFB_WindowData * p, Uint32 flags,
} }
static void static void
ProcessInputEvent(_THIS, Sint32 grabbed_window, DFBInputEvent * ievt) ProcessInputEvent(_THIS, SDL_Window *grabbed_window, DFBInputEvent * ievt)
{ {
SDL_DFB_DEVICEDATA(_this); SDL_DFB_DEVICEDATA(_this);
SDL_keysym keysym; SDL_keysym keysym;
...@@ -280,16 +302,17 @@ ProcessInputEvent(_THIS, Sint32 grabbed_window, DFBInputEvent * ievt) ...@@ -280,16 +302,17 @@ ProcessInputEvent(_THIS, Sint32 grabbed_window, DFBInputEvent * ievt)
if (!devdata->use_linux_input) { if (!devdata->use_linux_input) {
if (ievt->type == DIET_AXISMOTION) { if (ievt->type == DIET_AXISMOTION) {
if ((grabbed_window >= 0) && (ievt->flags & DIEF_AXISREL)) { if ((grabbed_window != NULL) && (ievt->flags & DIEF_AXISREL)) {
if (ievt->axis == DIAI_X) if (ievt->axis == DIAI_X)
SDL_SendMouseMotion(ievt->device_id, 1, SDL_SendMouseMotion_ex(ievt->device_id, 1,
ievt->axisrel, 0, 0); ievt->axisrel, 0, 0);
else if (ievt->axis == DIAI_Y) else if (ievt->axis == DIAI_Y)
SDL_SendMouseMotion(ievt->device_id, 1, 0, SDL_SendMouseMotion_ex(ievt->device_id, 1, 0,
ievt->axisrel, 0); ievt->axisrel, 0);
} }
} }
} else { } else {
#if USE_MULTI_API
static int last_x, last_y; static int last_x, last_y;
switch (ievt->type) { switch (ievt->type) {
...@@ -308,34 +331,34 @@ ProcessInputEvent(_THIS, Sint32 grabbed_window, DFBInputEvent * ievt) ...@@ -308,34 +331,34 @@ ProcessInputEvent(_THIS, Sint32 grabbed_window, DFBInputEvent * ievt)
int x, y; int x, y;
windata->window->GetPosition(windata->window, &x, &y); windata->window->GetPosition(windata->window, &x, &y);
SDL_SendMouseMotion(ievt->device_id, 0, SDL_SendMouseMotion_ex(ievt->device_id, 0,
last_x - (x + last_x - (x +
windata->client.x), windata->client.x),
last_y - (y + last_y - (y +
windata->client.y), 0); windata->client.y), 0);
} else { } else {
SDL_SendMouseMotion(ievt->device_id, 0, last_x, SDL_SendMouseMotion_ex(ievt->device_id, 0, last_x,
last_y, 0); last_y, 0);
} }
} }
} else if (ievt->flags & DIEF_AXISREL) { } else if (ievt->flags & DIEF_AXISREL) {
if (ievt->axis == DIAI_X) if (ievt->axis == DIAI_X)
SDL_SendMouseMotion(ievt->device_id, 1, SDL_SendMouseMotion_ex(ievt->device_id, 1,
ievt->axisrel, 0, 0); ievt->axisrel, 0, 0);
else if (ievt->axis == DIAI_Y) else if (ievt->axis == DIAI_Y)
SDL_SendMouseMotion(ievt->device_id, 1, 0, SDL_SendMouseMotion_ex(ievt->device_id, 1, 0,
ievt->axisrel, 0); ievt->axisrel, 0);
} }
break; break;
case DIET_KEYPRESS: case DIET_KEYPRESS:
kbd_idx = KbdIndex(_this, ievt->device_id); kbd_idx = KbdIndex(_this, ievt->device_id);
DirectFB_TranslateKeyInputEvent(_this, kbd_idx, ievt, &keysym); DirectFB_TranslateKeyInputEvent(_this, kbd_idx, ievt, &keysym);
SDL_SendKeyboardKey(kbd_idx, SDL_PRESSED, keysym.scancode); SDL_SendKeyboardKey_ex(kbd_idx, SDL_PRESSED, keysym.scancode);
if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) { if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) {
SDL_memcpy(text, &keysym.unicode, 4); SDL_memcpy(text, &keysym.unicode, 4);
text[4] = 0; text[4] = 0;
if (*text) { if (*text) {
SDL_SendKeyboardText(kbd_idx, text); SDL_SendKeyboardText_ex(kbd_idx, text);
} }
} }
break; break;
...@@ -363,6 +386,7 @@ ProcessInputEvent(_THIS, Sint32 grabbed_window, DFBInputEvent * ievt) ...@@ -363,6 +386,7 @@ ProcessInputEvent(_THIS, Sint32 grabbed_window, DFBInputEvent * ievt)
default: default:
break; /* please gcc */ break; /* please gcc */
} }
#endif
} }
} }
...@@ -378,7 +402,7 @@ DirectFB_PumpEventsWindow(_THIS) ...@@ -378,7 +402,7 @@ DirectFB_PumpEventsWindow(_THIS)
for (p = devdata->firstwin; p != NULL; p = p->next) { for (p = devdata->firstwin; p != NULL; p = p->next) {
DFBWindowEvent evt; DFBWindowEvent evt;
SDL_Window *w = SDL_GetWindowFromID(p->window); SDL_Window *w = p->sdl_window;
if (w->flags & SDL_WINDOW_INPUT_GRABBED) { if (w->flags & SDL_WINDOW_INPUT_GRABBED) {
grabbed_window = w; grabbed_window = w;
...@@ -603,19 +627,27 @@ input_device_cb(DFBInputDeviceID device_id, ...@@ -603,19 +627,27 @@ input_device_cb(DFBInputDeviceID device_id,
DFBInputDeviceDescription desc, void *callbackdata) DFBInputDeviceDescription desc, void *callbackdata)
{ {
DFB_DeviceData *devdata = callbackdata; DFB_DeviceData *devdata = callbackdata;
#if USE_MULTI_API
SDL_Keyboard keyboard; SDL_Keyboard keyboard;
#endif
SDLKey keymap[SDL_NUM_SCANCODES]; SDLKey keymap[SDL_NUM_SCANCODES];
if ((desc.caps & DIDTF_KEYBOARD) && device_id == DIDID_KEYBOARD) { if ((desc.caps & DIDTF_KEYBOARD) && device_id == DIDID_KEYBOARD) {
#if USE_MULTI_API
SDL_zero(keyboard); SDL_zero(keyboard);
SDL_AddKeyboard(&keyboard, 0); SDL_AddKeyboard(&keyboard, 0);
#endif
devdata->keyboard[0].id = device_id; devdata->keyboard[0].id = device_id;
devdata->keyboard[0].is_generic = 0; devdata->keyboard[0].is_generic = 0;
if (!strncmp("X11", desc.name, 3)) if (!strncmp("X11", desc.name, 3))
devdata->keyboard[0].is_generic = 1; devdata->keyboard[0].is_generic = 1;
SDL_GetDefaultKeymap(keymap); SDL_GetDefaultKeymap(keymap);
#if USE_MULTI_API
SDL_SetKeymap(0, 0, keymap, SDL_NUM_SCANCODES); SDL_SetKeymap(0, 0, keymap, SDL_NUM_SCANCODES);
#else
SDL_SetKeymap(0, keymap, SDL_NUM_SCANCODES);
#endif
devdata->num_keyboard++; devdata->num_keyboard++;
return DFENUM_CANCEL; return DFENUM_CANCEL;
...@@ -623,6 +655,7 @@ input_device_cb(DFBInputDeviceID device_id, ...@@ -623,6 +655,7 @@ input_device_cb(DFBInputDeviceID device_id,
return DFENUM_OK; return DFENUM_OK;
} }
#if USE_MULTI_API
static DFBEnumerationResult static DFBEnumerationResult
EnumKeyboards(DFBInputDeviceID device_id, EnumKeyboards(DFBInputDeviceID device_id,
DFBInputDeviceDescription desc, void *callbackdata) DFBInputDeviceDescription desc, void *callbackdata)
...@@ -652,6 +685,7 @@ EnumKeyboards(DFBInputDeviceID device_id, ...@@ -652,6 +685,7 @@ EnumKeyboards(DFBInputDeviceID device_id,
} }
return DFENUM_OK; return DFENUM_OK;
} }
#endif
void void
DirectFB_InitKeyboard(_THIS) DirectFB_InitKeyboard(_THIS)
...@@ -662,6 +696,7 @@ DirectFB_InitKeyboard(_THIS) ...@@ -662,6 +696,7 @@ DirectFB_InitKeyboard(_THIS)
DirectFB_InitOSKeymap(_this, &oskeymap[0], SDL_arraysize(oskeymap)); DirectFB_InitOSKeymap(_this, &oskeymap[0], SDL_arraysize(oskeymap));
devdata->num_keyboard = 0; devdata->num_keyboard = 0;
#if USE_MULTI_API
if (devdata->use_linux_input) { if (devdata->use_linux_input) {
sys_ids = 0; sys_ids = 0;
SDL_DFB_CHECK(devdata->dfb-> SDL_DFB_CHECK(devdata->dfb->
...@@ -672,11 +707,14 @@ DirectFB_InitKeyboard(_THIS) ...@@ -672,11 +707,14 @@ DirectFB_InitKeyboard(_THIS)
EnumKeyboards, EnumKeyboards,
devdata)); devdata));
} }
} else { } else
#else
{
SDL_DFB_CHECK(devdata->dfb->EnumInputDevices(devdata->dfb, SDL_DFB_CHECK(devdata->dfb->EnumInputDevices(devdata->dfb,
input_device_cb, input_device_cb,
devdata)); devdata));
} }
#endif
} }
void void
...@@ -759,3 +797,4 @@ DirectFB_PumpEvents(_THIS) ...@@ -759,3 +797,4 @@ DirectFB_PumpEvents(_THIS)
} }
} }
#endif #endif
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#include "SDL_DirectFB_video.h" #include "SDL_DirectFB_video.h"
#define SDL_DFB_DISPLAYDATA(dev, win) DFB_DisplayData *dispdata = ((win && dev) ? (DFB_DisplayData *) (dev)->displays[(win)->display].driverdata : NULL) #define SDL_DFB_DISPLAYDATA(dev, win) DFB_DisplayData *dispdata = ((win && dev) ? (DFB_DisplayData *) (win)->display->driverdata : NULL)
typedef struct _DFB_DisplayData DFB_DisplayData; typedef struct _DFB_DisplayData DFB_DisplayData;
struct _DFB_DisplayData struct _DFB_DisplayData
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "../SDL_sysvideo.h" #include "../SDL_sysvideo.h"
#include "../../events/SDL_mouse_c.h" #include "../../events/SDL_mouse_c.h"
#if USE_MULTI_API
static SDL_Cursor *DirectFB_CreateCursor(SDL_Surface * surface, static SDL_Cursor *DirectFB_CreateCursor(SDL_Surface * surface,
int hot_x, int hot_y); int hot_x, int hot_y);
static int DirectFB_ShowCursor(SDL_Cursor * cursor); static int DirectFB_ShowCursor(SDL_Cursor * cursor);
...@@ -239,4 +240,23 @@ DirectFB_FreeMouse(SDL_Mouse * mouse) ...@@ -239,4 +240,23 @@ DirectFB_FreeMouse(SDL_Mouse * mouse)
/* nothing yet */ /* nothing yet */
} }
#else /* USE_MULTI_API */
void
DirectFB_InitMouse(_THIS)
{
SDL_DFB_DEVICEDATA(_this);
devdata->num_mice = 1;
}
void
DirectFB_QuitMouse(_THIS)
{
SDL_DFB_DEVICEDATA(_this);
}
#endif
/* vi: set ts=4 sw=4 expandtab: */ /* vi: set ts=4 sw=4 expandtab: */
...@@ -423,7 +423,7 @@ static int ...@@ -423,7 +423,7 @@ static int
DirectFB_ActivateRenderer(SDL_Renderer * renderer) DirectFB_ActivateRenderer(SDL_Renderer * renderer)
{ {
SDL_DFB_RENDERERDATA(renderer); SDL_DFB_RENDERERDATA(renderer);
SDL_Window *window = SDL_GetWindowFromID(renderer->window); SDL_Window *window = renderer->window;
SDL_DFB_WINDOWDATA(window); SDL_DFB_WINDOWDATA(window);
if (renddata->size_changed || windata->wm_needs_redraw) { if (renddata->size_changed || windata->wm_needs_redraw) {
...@@ -445,7 +445,7 @@ static int ...@@ -445,7 +445,7 @@ static int
DirectFB_AcquireVidLayer(SDL_Renderer * renderer, SDL_Texture * texture) DirectFB_AcquireVidLayer(SDL_Renderer * renderer, SDL_Texture * texture)
{ {
SDL_DFB_RENDERERDATA(renderer); SDL_DFB_RENDERERDATA(renderer);
SDL_Window *window = SDL_GetWindowFromID(renderer->window); SDL_Window *window = renderer->window;
SDL_VideoDisplay *display = window->display; SDL_VideoDisplay *display = window->display;
SDL_DFB_DEVICEDATA(display->device); SDL_DFB_DEVICEDATA(display->device);
DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata; DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata;
...@@ -501,7 +501,7 @@ DirectFB_AcquireVidLayer(SDL_Renderer * renderer, SDL_Texture * texture) ...@@ -501,7 +501,7 @@ DirectFB_AcquireVidLayer(SDL_Renderer * renderer, SDL_Texture * texture)
static int static int
DirectFB_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) DirectFB_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
{ {
SDL_Window *window = SDL_GetWindowFromID(renderer->window); SDL_Window *window = renderer->window;
SDL_VideoDisplay *display = window->display; SDL_VideoDisplay *display = window->display;
SDL_DFB_DEVICEDATA(display->device); SDL_DFB_DEVICEDATA(display->device);
DirectFB_TextureData *data; DirectFB_TextureData *data;
...@@ -950,7 +950,7 @@ DirectFB_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, ...@@ -950,7 +950,7 @@ DirectFB_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
if (texturedata->display) { if (texturedata->display) {
int px, py; int px, py;
SDL_Window *window = SDL_GetWindowFromID(renderer->window); SDL_Window *window = renderer->window;
SDL_DFB_WINDOWDATA(window); SDL_DFB_WINDOWDATA(window);
SDL_VideoDisplay *display = texturedata->display; SDL_VideoDisplay *display = texturedata->display;
DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata; DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata;
...@@ -1048,7 +1048,7 @@ static void ...@@ -1048,7 +1048,7 @@ static void
DirectFB_RenderPresent(SDL_Renderer * renderer) DirectFB_RenderPresent(SDL_Renderer * renderer)
{ {
DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata;
SDL_Window *window = SDL_GetWindowFromID(renderer->window); SDL_Window *window = renderer->window;
SDL_DFB_WINDOWDATA(window); SDL_DFB_WINDOWDATA(window);
DFBRectangle sr; DFBRectangle sr;
......
...@@ -129,7 +129,7 @@ DirectFB_CreateDevice(int devindex) ...@@ -129,7 +129,7 @@ DirectFB_CreateDevice(int devindex)
#endif #endif
device->free = DirectFB_DeleteDevice; device->free = DirectFB_DeleteDevice;
fprintf(LOG_CHANNEL, "Device setup %p!!\n", device->ShowWindow);
return device; return device;
error: error:
if (device) if (device)
...@@ -163,19 +163,20 @@ DirectFB_DeviceInformation(IDirectFB * dfb) ...@@ -163,19 +163,20 @@ DirectFB_DeviceInformation(IDirectFB * dfb)
fprintf(LOG_CHANNEL, "\nBlitting flags:\n"); fprintf(LOG_CHANNEL, "\nBlitting flags:\n");
for (n = 0; blitting_flags[n].flag; n++) { for (n = 0; blitting_flags[n].flag; n++) {
if (desc.blitting_flags & blitting_flags[n].flag) if (desc.blitting_flags & blitting_flags[n].flag)
printf(" %s\n", blitting_flags[n].name); fprintf(LOG_CHANNEL, " %s\n", blitting_flags[n].name);
} }
fprintf(LOG_CHANNEL, "\nDrawing flags:\n"); fprintf(LOG_CHANNEL, "\nDrawing flags:\n");
for (n = 0; drawing_flags[n].flag; n++) { for (n = 0; drawing_flags[n].flag; n++) {
if (desc.drawing_flags & drawing_flags[n].flag) if (desc.drawing_flags & drawing_flags[n].flag)
printf(" %s\n", drawing_flags[n].name); fprintf(LOG_CHANNEL, " %s\n", drawing_flags[n].name);
} }
fprintf(LOG_CHANNEL, "\nAcceleration flags:\n"); fprintf(LOG_CHANNEL, "\nAcceleration flags:\n");
for (n = 0; acceleration_mask[n].mask; n++) { for (n = 0; acceleration_mask[n].mask; n++) {
if (desc.acceleration_mask & acceleration_mask[n].mask) if (desc.acceleration_mask & acceleration_mask[n].mask)
printf(" %s\n", acceleration_mask[n].name); fprintf(LOG_CHANNEL, " %s\n", acceleration_mask[n].name);
} }
...@@ -208,10 +209,14 @@ DirectFB_VideoInit(_THIS) ...@@ -208,10 +209,14 @@ DirectFB_VideoInit(_THIS)
DirectFBSetOption("disable-module", "x11input"); DirectFBSetOption("disable-module", "x11input");
} }
devdata->use_linux_input = 1; /* default: on */ #if USE_MULTI_API
devdata->use_linux_input = 1; /* default: on */
stemp = SDL_getenv(DFBENV_USE_LINUX_INPUT); stemp = SDL_getenv(DFBENV_USE_LINUX_INPUT);
if (stemp) if (stemp)
devdata->use_linux_input = atoi(stemp); devdata->use_linux_input = atoi(stemp);
#else
devdata->use_linux_input = 0; /* no way to support this ... */
#endif
if (!devdata->use_linux_input) if (!devdata->use_linux_input)
DirectFBSetOption("disable-module", "linux_input"); DirectFBSetOption("disable-module", "linux_input");
......
...@@ -31,7 +31,14 @@ ...@@ -31,7 +31,14 @@
#include "SDL_mouse.h" #include "SDL_mouse.h"
#define DEBUG 0
/* Set below to 1 to compile with (old) multi mice/keyboard api. Code left in
* in case we see this again ...
*/
#define USE_MULTI_API (0)
#define DEBUG 1
#define LOG_CHANNEL stdout #define LOG_CHANNEL stdout
#define DFB_VERSIONNUM(X, Y, Z) \ #define DFB_VERSIONNUM(X, Y, Z) \
......
...@@ -140,7 +140,7 @@ DirectFB_CreateWindow(_THIS, SDL_Window * window) ...@@ -140,7 +140,7 @@ DirectFB_CreateWindow(_THIS, SDL_Window * window)
windata->window->RaiseToTop(windata->window); windata->window->RaiseToTop(windata->window);
/* remember parent */ /* remember parent */
windata->window = window; windata->sdl_window = window;
/* Add to list ... */ /* Add to list ... */
......
...@@ -36,7 +36,7 @@ struct _DFB_WindowData ...@@ -36,7 +36,7 @@ struct _DFB_WindowData
IDirectFBWindow *window; IDirectFBWindow *window;
DirectFB_GLContext *gl_context; DirectFB_GLContext *gl_context;
IDirectFBEventBuffer *eventbuffer; IDirectFBEventBuffer *eventbuffer;
SDL_Window *window; SDL_Window *sdl_window;
DFB_WindowData *next; DFB_WindowData *next;
Uint8 opacity; Uint8 opacity;
DFBRectangle client; DFBRectangle client;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment