~vcs-imports/libsdl/trunk

« back to all changes in this revision

Viewing changes to src/video/directfb/SDL_DirectFB_events.c

  • Committer: slouken
  • Date: 2010-01-21 06:21:52 UTC
  • Revision ID: svn-v4:c70aab31-4412-0410-b14c-859654838e24:trunk/SDL:5525
Switched from SDL_WindowID and SDL_TextureID to SDL_Window* and SDL_Texture* for code simplicity and improved performance.

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
static int DirectFB_TranslateButton(DFBInputDeviceButtonIdentifier button);
47
47
 
48
48
static void
49
 
DirectFB_SetContext(_THIS, SDL_WindowID id)
 
49
DirectFB_SetContext(_THIS, SDL_Window *window)
50
50
{
51
51
#if (DFB_VERSION_ATLEAST(1,0,0))
52
52
    /* FIXME: does not work on 1.0/1.2 with radeon driver
55
55
     */
56
56
 
57
57
    SDL_Window *window = SDL_GetWindowFromID(id);
58
 
    SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
 
58
    SDL_VideoDisplay *display = window->display;
59
59
    DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata;
60
60
    int ret;
61
61
 
70
70
}
71
71
 
72
72
static void
73
 
FocusAllMice(_THIS, SDL_WindowID id)
 
73
FocusAllMice(_THIS, SDL_Window *window)
74
74
{
75
75
    SDL_DFB_DEVICEDATA(_this);
76
76
    int index;
81
81
 
82
82
 
83
83
static void
84
 
FocusAllKeyboards(_THIS, SDL_WindowID id)
 
84
FocusAllKeyboards(_THIS, SDL_Window *window)
85
85
{
86
86
    SDL_DFB_DEVICEDATA(_this);
87
87
    int index;
177
177
            break;
178
178
        case DWET_MOTION:
179
179
            if (ClientXY(p, &evt->x, &evt->y)) {
180
 
                SDL_Window *window = SDL_GetWindowFromID(p->sdl_id);
 
180
                SDL_Window *window = p->window;
181
181
                if (!devdata->use_linux_input) {
182
182
                    if (!(flags & SDL_WINDOW_INPUT_GRABBED))
183
183
                        SDL_SendMouseMotion(devdata->mouse_id[0], 0,
193
193
                    }
194
194
                }
195
195
                if (!(window->flags & SDL_WINDOW_MOUSE_FOCUS))
196
 
                    SDL_SendWindowEvent(p->sdl_id, SDL_WINDOWEVENT_ENTER, 0,
 
196
                    SDL_SendWindowEvent(p->window, SDL_WINDOWEVENT_ENTER, 0,
197
197
                                        0);
198
198
            }
199
199
            break;
218
218
            break;
219
219
        case DWET_POSITION:
220
220
            if (ClientXY(p, &evt->x, &evt->y)) {
221
 
                SDL_SendWindowEvent(p->sdl_id, SDL_WINDOWEVENT_MOVED,
 
221
                SDL_SendWindowEvent(p->window, SDL_WINDOWEVENT_MOVED,
222
222
                                    evt->x, evt->y);
223
223
            }
224
224
            break;
225
225
        case DWET_POSITION_SIZE:
226
226
            if (ClientXY(p, &evt->x, &evt->y)) {
227
 
                SDL_SendWindowEvent(p->sdl_id, SDL_WINDOWEVENT_MOVED,
 
227
                SDL_SendWindowEvent(p->window, SDL_WINDOWEVENT_MOVED,
228
228
                                    evt->x, evt->y);
229
229
            }
230
230
            /* fall throught */
234
234
            evt->h -=
235
235
                (p->theme.top_size + p->theme.bottom_size +
236
236
                 p->theme.caption_size);
237
 
            SDL_SendWindowEvent(p->sdl_id, SDL_WINDOWEVENT_RESIZED,
 
237
            SDL_SendWindowEvent(p->window, SDL_WINDOWEVENT_RESIZED,
238
238
                                evt->w, evt->h);
239
239
            break;
240
240
        case DWET_CLOSE:
241
 
            SDL_SendWindowEvent(p->sdl_id, SDL_WINDOWEVENT_CLOSE, 0, 0);
 
241
            SDL_SendWindowEvent(p->window, SDL_WINDOWEVENT_CLOSE, 0, 0);
242
242
            break;
243
243
        case DWET_GOTFOCUS:
244
 
            DirectFB_SetContext(_this, p->sdl_id);
245
 
            FocusAllKeyboards(_this, p->sdl_id);
246
 
            SDL_SendWindowEvent(p->sdl_id, SDL_WINDOWEVENT_FOCUS_GAINED,
 
244
            DirectFB_SetContext(_this, p->window);
 
245
            FocusAllKeyboards(_this, p->window);
 
246
            SDL_SendWindowEvent(p->window, SDL_WINDOWEVENT_FOCUS_GAINED,
247
247
                                0, 0);
248
248
            break;
249
249
        case DWET_LOSTFOCUS:
250
 
            SDL_SendWindowEvent(p->sdl_id, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0);
 
250
            SDL_SendWindowEvent(p->window, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0);
251
251
            FocusAllKeyboards(_this, 0);
252
252
            break;
253
253
        case DWET_ENTER:
254
254
            /* SDL_DirectFB_ReshowCursor(_this, 0); */
255
 
            FocusAllMice(_this, p->sdl_id);
 
255
            FocusAllMice(_this, p->window);
256
256
            // FIXME: when do we really enter ?
257
257
            if (ClientXY(p, &evt->x, &evt->y))
258
258
                MotionAllMice(_this, evt->x, evt->y);
259
 
            SDL_SendWindowEvent(p->sdl_id, SDL_WINDOWEVENT_ENTER, 0, 0);
 
259
            SDL_SendWindowEvent(p->window, SDL_WINDOWEVENT_ENTER, 0, 0);
260
260
            break;
261
261
        case DWET_LEAVE:
262
 
            SDL_SendWindowEvent(p->sdl_id, SDL_WINDOWEVENT_LEAVE, 0, 0);
 
262
            SDL_SendWindowEvent(p->window, SDL_WINDOWEVENT_LEAVE, 0, 0);
263
263
            FocusAllMice(_this, 0);
264
264
            /* SDL_DirectFB_ReshowCursor(_this, 1); */
265
265
            break;
372
372
    SDL_DFB_DEVICEDATA(_this);
373
373
    DFB_WindowData *p;
374
374
    DFBInputEvent ievt;
375
 
    Sint32 /* SDL_WindowID */ grabbed_window;
 
375
    SDL_Window *grabbed_window;
376
376
 
377
 
    grabbed_window = -1;
 
377
    grabbed_window = NULL;
378
378
 
379
379
    for (p = devdata->firstwin; p != NULL; p = p->next) {
380
380
        DFBWindowEvent evt;
381
 
        SDL_Window *w = SDL_GetWindowFromID(p->sdl_id);
 
381
        SDL_Window *w = SDL_GetWindowFromID(p->window);
382
382
 
383
383
        if (w->flags & SDL_WINDOW_INPUT_GRABBED) {
384
 
            grabbed_window = p->sdl_id;
 
384
            grabbed_window = w;
385
385
        }
386
386
 
387
387
        while (p->eventbuffer->GetEvent(p->eventbuffer,