annotate src/video/directfb/SDL_DirectFB_mouse.c @ 2721:e82a0e3e9b0e

Date: Sun, 20 Jul 2008 22:34:37 +0200 From: Couriersud Subject: Updated DirectFB driver for SDL1.3 please find attached a patch for an updated directfb driver for SDL1.3. It does now - properly supported the new input api. - send unicode text events - support directfb windows - support multiple screens - support hardware YUV scaling for the first YUV texture created. - support hardware scaling for textures. - properly interpret streaming access - support software opengl if one manages to install the mesa directfb driver (broken/not broken in mesa svn) Within bugzilla (http://bugzilla.libsdl.org/show_bug.cgi?id=603) there is another patch which fixes a crash due to GL context creation. Kind regards, couriersud
author Sam Lantinga <slouken@libsdl.org>
date Tue, 26 Aug 2008 02:32:45 +0000
parents 1e690901ecd7
children 204be4fc2726
rev   line source
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1 /*
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
3 Copyright (C) 1997-2006 Sam Lantinga
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
4
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
6 modify it under the terms of the GNU Lesser General Public
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
8 version 2.1 of the License, or (at your option) any later version.
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
9
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
13 Lesser General Public License for more details.
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
14
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
15 You should have received a copy of the GNU Lesser General Public
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
16 License along with this library; if not, write to the Free Software
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
18
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
19 Sam Lantinga
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
20 slouken@libsdl.org
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
21 */
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
22 #include "SDL_config.h"
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
23
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
24 #include "SDL_DirectFB_video.h"
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
25 #include "SDL_DirectFB_mouse.h"
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
26
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
27 #include "../SDL_sysvideo.h"
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
28 #include "../../events/SDL_mouse_c.h"
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
29
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
30 static SDL_Cursor *DirectFB_CreateCursor(SDL_Surface * surface, int hot_x,
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
31 int hot_y);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
32 static int DirectFB_ShowCursor(SDL_Cursor * cursor);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
33 static void DirectFB_MoveCursor(SDL_Cursor * cursor);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
34 static void DirectFB_FreeCursor(SDL_Cursor * cursor);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
35 static void DirectFB_WarpMouse(SDL_Mouse * mouse, SDL_WindowID windowID,
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
36 int x, int y);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
37 static void DirectFB_FreeMouse(SDL_Mouse * mouse);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
38
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
39 void
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
40 DirectFB_InitMouse(_THIS)
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
41 {
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
42 SDL_DFB_DEVICEDATA(_this);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
43 SDL_Mouse mouse;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
44
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
45 SDL_zero(mouse);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
46 mouse.CreateCursor = DirectFB_CreateCursor;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
47 mouse.ShowCursor = DirectFB_ShowCursor;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
48 mouse.MoveCursor = DirectFB_MoveCursor;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
49 mouse.FreeCursor = DirectFB_FreeCursor;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
50 mouse.WarpMouse = DirectFB_WarpMouse;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
51 mouse.FreeMouse = DirectFB_FreeMouse;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
52 devdata->mouse = SDL_AddMouse(&mouse, -1);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
53 }
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
54
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
55 void
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
56 DirectFB_QuitMouse(_THIS)
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
57 {
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
58 SDL_DFB_DEVICEDATA(_this);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
59
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
60 SDL_DelMouse(devdata->mouse);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
61 }
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
62
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
63 /* Create a cursor from a surface */
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
64 static SDL_Cursor *
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
65 DirectFB_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y)
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
66 {
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
67 SDL_VideoDevice *dev = SDL_GetVideoDevice();
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
68
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
69 SDL_DFB_DEVICEDATA(dev);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
70 DFB_CursorData *curdata;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
71 DFBResult ret;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
72 DFBSurfaceDescription dsc;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
73 SDL_Cursor *cursor;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
74 Uint32 *dest;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
75 Uint32 *p;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
76 int pitch, i;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
77
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
78 SDL_DFB_CALLOC(cursor, 1, sizeof(*cursor));
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
79 SDL_DFB_CALLOC(curdata, 1, sizeof(*curdata));
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
80
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
81 dsc.flags =
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
82 DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT | DSDESC_CAPS;
2721
e82a0e3e9b0e Date: Sun, 20 Jul 2008 22:34:37 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2259
diff changeset
83 dsc.caps = DSCAPS_VIDEOONLY;
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
84 dsc.width = surface->w;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
85 dsc.height = surface->h;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
86 dsc.pixelformat = DSPF_ARGB;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
87
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
88 SDL_DFB_CHECKERR(devdata->dfb->
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
89 CreateSurface(devdata->dfb, &dsc, &curdata->surf));
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
90 curdata->hotx = hot_x;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
91 curdata->hoty = hot_y;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
92 cursor->driverdata = curdata;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
93
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
94 SDL_DFB_CHECKERR(curdata->surf->
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
95 Lock(curdata->surf, DSLF_WRITE, (void *) &dest, &pitch));
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
96
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
97 //FIXME: Implies a lot of things, e.g. rgba format for SDL_SURFACE ....
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
98 p = surface->pixels;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
99 for (i = 0; i < surface->w * surface->h; i++)
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
100 if (p[i] == 0x00000000)
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
101 dest[i] = 0x00000000;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
102 else
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
103 dest[i] = p[i];
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
104 curdata->surf->Unlock(curdata->surf);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
105 return cursor;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
106 error:
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
107 return NULL;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
108 }
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
109
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
110 /* Show the specified cursor, or hide if cursor is NULL */
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
111 static int
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
112 DirectFB_ShowCursor(SDL_Cursor * cursor)
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
113 {
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
114 SDL_DFB_CURSORDATA(cursor);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
115 SDL_VideoDevice *dev = SDL_GetVideoDevice();
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
116 SDL_DFB_DEVICEDATA(dev);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
117 #if 0
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
118 DFB_DisplayData *dispdata =
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
119 (DFB_DisplayData *) dev->displays[dev->current_display].driverdata;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
120 #endif
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
121 DFBResult ret;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
122 SDL_WindowID wid;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
123
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
124 wid = SDL_GetFocusWindow();
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
125 if (!wid)
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
126 return -1;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
127 else {
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
128 SDL_Window *window = SDL_GetWindowFromID(wid);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
129 SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
130 DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
131 DFB_WindowData *windata = (DFB_WindowData *) window->driverdata;
2259
1e690901ecd7 Date: Fri, 17 Aug 2007 01:12:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2226
diff changeset
132
1e690901ecd7 Date: Fri, 17 Aug 2007 01:12:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2226
diff changeset
133 if (cursor)
1e690901ecd7 Date: Fri, 17 Aug 2007 01:12:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2226
diff changeset
134 SDL_DFB_CHECKERR(windata->window->
1e690901ecd7 Date: Fri, 17 Aug 2007 01:12:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2226
diff changeset
135 SetCursorShape(windata->window, curdata->surf,
1e690901ecd7 Date: Fri, 17 Aug 2007 01:12:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2226
diff changeset
136 curdata->hotx, curdata->hoty));
1e690901ecd7 Date: Fri, 17 Aug 2007 01:12:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2226
diff changeset
137 //TODO: Check administrative
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
138 SDL_DFB_CHECKERR(dispdata->layer->
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
139 SetCooperativeLevel(dispdata->layer,
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
140 DLSCL_ADMINISTRATIVE));
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
141 SDL_DFB_CHECKERR(dispdata->layer->
2259
1e690901ecd7 Date: Fri, 17 Aug 2007 01:12:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2226
diff changeset
142 SetCursorOpacity(dispdata->layer,
1e690901ecd7 Date: Fri, 17 Aug 2007 01:12:31 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 2226
diff changeset
143 cursor ? 0xC0 : 0x00));
2226
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
144 SDL_DFB_CHECKERR(dispdata->layer->
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
145 SetCooperativeLevel(dispdata->layer, DLSCL_SHARED));
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
146 }
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
147
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
148 return 0;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
149 error:
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
150 return -1;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
151 }
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
152
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
153 /* This is called when a mouse motion event occurs */
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
154 static void
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
155 DirectFB_MoveCursor(SDL_Cursor * cursor)
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
156 {
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
157 SDL_DFB_CURSORDATA(cursor);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
158 /* Do we need to do something here ? */
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
159 }
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
160
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
161 /* Free a window manager cursor */
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
162 static void
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
163 DirectFB_FreeCursor(SDL_Cursor * cursor)
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
164 {
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
165 SDL_DFB_CURSORDATA(cursor);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
166
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
167 SDL_DFB_RELEASE(curdata->surf);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
168 SDL_DFB_FREE(cursor->driverdata);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
169 SDL_DFB_FREE(cursor);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
170 }
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
171
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
172 /* Warp the mouse to (x,y) */
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
173 static void
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
174 DirectFB_WarpMouse(SDL_Mouse * mouse, SDL_WindowID windowID, int x, int y)
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
175 {
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
176 SDL_Window *window = SDL_GetWindowFromID(windowID);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
177 SDL_VideoDisplay *display = SDL_GetDisplayFromWindow(window);
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
178 DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
179 DFB_WindowData *windata = (DFB_WindowData *) window->driverdata;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
180 DFBResult ret;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
181 int cx, cy;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
182
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
183 SDL_DFB_CHECKERR(windata->window->GetPosition(windata->window, &cx, &cy));
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
184 SDL_DFB_CHECKERR(dispdata->layer->
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
185 WarpCursor(dispdata->layer, cx + x, cy + y));
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
186
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
187 error:
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
188 return;
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
189 }
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
190
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
191 /* Free the mouse when it's time */
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
192 static void
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
193 DirectFB_FreeMouse(SDL_Mouse * mouse)
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
194 {
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
195 // nothing yet
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
196
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
197 }
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
198
0e70b4b8cf84 Date: Sat, 11 Aug 2007 02:03:16 +0200 (CEST)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
199 /* vi: set ts=4 sw=4 expandtab: */