~ubuntu-branches/ubuntu/natty/libsdl1.2/natty

« back to all changes in this revision

Viewing changes to src/video/gem/SDL_gemmouse.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2007-12-05 20:29:43 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20071205202943-ryogi07hodn5cdif
Tags: 1.2.12-1ubuntu1
* Merge with Debian; remaining changes:
  - Remove svgalib support.
  - Prefer libgl1-mesa-dev build-dependency over xlibmesa-gl-dev.
  - Build for lpia as for i386.
* Link using -Wl,-Bsymbolic-functions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
140
140
int GEM_ShowWMCursor(_THIS, WMcursor *cursor)
141
141
{
142
142
        GEM_cursor = cursor;
143
 
        if (cursor == NULL) {
144
 
                graf_mouse(M_OFF, NULL);
145
 
                GEM_cursor = (void *) -1;
146
 
        } else if (cursor->mform_p) {
147
 
                graf_mouse(USER_DEF, cursor->mform_p);
148
 
        }
 
143
 
 
144
        GEM_CheckMouseMode(this);
149
145
 
150
146
#ifdef DEBUG_VIDEO_GEM
151
147
        printf("sdl:video:gem: ShowWMCursor(0x%08x)\n", (long) cursor);
170
166
 
171
167
void GEM_CheckMouseMode(_THIS)
172
168
{
 
169
        const Uint8 full_focus = (SDL_APPACTIVE|SDL_APPINPUTFOCUS|SDL_APPMOUSEFOCUS);
 
170
        int set_system_cursor = 1, show_system_cursor = 1;
 
171
 
173
172
#ifdef DEBUG_VIDEO_GEM
174
173
        printf("sdl:video:gem: check mouse mode\n");
175
174
#endif
176
175
 
177
176
        /* If the mouse is hidden and input is grabbed, we use relative mode */
178
 
        if ( (!(SDL_cursorstate & CURSOR_VISIBLE)) &&
179
 
                /*(this->input_grab != SDL_GRAB_OFF) && */ /* Damn GEM can not grab */
180
 
             (SDL_GetAppState() & SDL_APPACTIVE) ) {
181
 
                GEM_mouse_relative = SDL_TRUE;
 
177
        GEM_mouse_relative = (!(SDL_cursorstate & CURSOR_VISIBLE))
 
178
                && (this->input_grab != SDL_GRAB_OFF)
 
179
                && (SDL_GetAppState() & SDL_APPACTIVE);
 
180
        SDL_AtariXbios_LockMousePosition(GEM_mouse_relative);
 
181
 
 
182
        if (SDL_cursorstate & CURSOR_VISIBLE) {
 
183
                /* Application defined cursor only over the application window */
 
184
                if ((SDL_GetAppState() & full_focus) == full_focus) {
 
185
                        if (GEM_cursor) {
 
186
                                graf_mouse(USER_DEF, GEM_cursor->mform_p);
 
187
                                set_system_cursor = 0;
 
188
                        } else {
 
189
                                show_system_cursor = 0;
 
190
                        }
 
191
                }
182
192
        } else {
183
 
                GEM_mouse_relative = SDL_FALSE;
 
193
                /* Mouse cursor hidden only over the application window */
 
194
                if ((SDL_GetAppState() & full_focus) == full_focus) {
 
195
                        set_system_cursor = 0;
 
196
                        show_system_cursor = 0;
 
197
                }
 
198
        }
 
199
 
 
200
        graf_mouse(show_system_cursor ? M_ON : M_OFF, NULL);
 
201
        if (set_system_cursor) {
 
202
                graf_mouse(ARROW, NULL);
184
203
        }
185
204
}