Skip to content
Permalink
Browse files

Fix mouse cursor change

  • Loading branch information
pmandin committed Jun 14, 2006
1 parent 02d908f commit bc511e1e180b3067c549c3ceeaff3bba804a92dd
Showing with 46 additions and 11 deletions.
  1. +10 −0 src/video/gem/SDL_gemevents.c
  2. +28 −11 src/video/gem/SDL_gemmouse.c
  3. +1 −0 src/video/gem/SDL_gemvideo.c
  4. +7 −0 src/video/gem/SDL_gemvideo.h
@@ -186,8 +186,18 @@ void GEM_PumpEvents(_THIS)
if (this->input_grab == SDL_GRAB_OFF) {
if (SDL_GetAppState() & SDL_APPMOUSEFOCUS) {
SDL_PrivateAppActive(0, SDL_APPMOUSEFOCUS);
if (SDL_GetAppState() & SDL_APPINPUTFOCUS) {
graf_mouse(ARROW, NULL);
}
} else {
SDL_PrivateAppActive(1, SDL_APPMOUSEFOCUS);
if (SDL_GetAppState() & SDL_APPINPUTFOCUS) {
if (GEM_cursor == (void *) -1) {
graf_mouse(M_OFF, NULL);
} else if (GEM_cursor) {
graf_mouse(USER_DEF, GEM_cursor->mform_p);
}
}
}
}
}
@@ -33,6 +33,7 @@
#include "../../events/SDL_events_c.h"
#include "../SDL_cursor_c.h"
#include "SDL_gemmouse_c.h"
#include "SDL_gemvideo.h"

/* Defines */

@@ -41,14 +42,12 @@
#define MAXCURWIDTH 16
#define MAXCURHEIGHT 16

/* The implementation dependent data for the window manager cursor */
struct WMcursor {
MFORM *mform_p;
};


void GEM_FreeWMCursor(_THIS, WMcursor *cursor)
{
#ifdef DEBUG_VIDEO_GEM
printf("sdl:video:gem: free cursor\n");
#endif

if (cursor == NULL)
return;

@@ -67,6 +66,12 @@ WMcursor *GEM_CreateWMCursor(_THIS,
MFORM *new_mform;
int i;

#ifdef DEBUG_VIDEO_GEM
Uint16 *data1, *mask1;

printf("sdl:video:gem: create cursor\n");
#endif

/* Check the size */
if ( (w > MAXCURWIDTH) || (h > MAXCURHEIGHT) ) {
SDL_SetError("Only cursors of dimension (%dx%d) are allowed",
@@ -100,6 +105,12 @@ WMcursor *GEM_CreateWMCursor(_THIS,
for (i=0;i<MAXCURHEIGHT;i++) {
new_mform->mf_mask[i]=0;
new_mform->mf_data[i]=0;
#ifdef DEBUG_VIDEO_GEM
data1 = (Uint16 *) &data[i<<1];
mask1 = (Uint16 *) &mask[i<<1];
printf("sdl:video:gem: source: line %d: data=0x%04x, mask=0x%04x\n",
i, data1[i], mask1[i]);
#endif
}

if (w<=8) {
@@ -109,14 +120,15 @@ WMcursor *GEM_CreateWMCursor(_THIS,
}
} else {
for (i=0;i<h;i++) {
new_mform->mf_mask[i]= mask[i<<1]<<8 | mask[(i<<1)+1];
new_mform->mf_data[i]= data[i<<1]<<8 | data[(i<<1)+1];
new_mform->mf_mask[i]= (mask[i<<1]<<8) | mask[(i<<1)+1];
new_mform->mf_data[i]= (data[i<<1]<<8) | data[(i<<1)+1];
}
}

#ifdef DEBUG_VIDEO_GEM
for (i=0; i<h ;i++) {
printf("sdl:video:gem: cursor, line %d = 0x%04x\n", i, new_mform->mf_mask[i]);
printf("sdl:video:gem: cursor: line %d: data=0x%04x, mask=0x%04x\n",
i, new_mform->mf_data[i], new_mform->mf_mask[i]);
}

printf("sdl:video:gem: CreateWMCursor(): done\n");
@@ -127,13 +139,14 @@ WMcursor *GEM_CreateWMCursor(_THIS,

int GEM_ShowWMCursor(_THIS, WMcursor *cursor)
{
/*
GEM_cursor = cursor;
if (cursor == NULL) {
graf_mouse(M_OFF, NULL);
GEM_cursor = (void *) -1;
} else if (cursor->mform_p) {
graf_mouse(USER_DEF, cursor->mform_p);
}
*/

#ifdef DEBUG_VIDEO_GEM
printf("sdl:video:gem: ShowWMCursor(0x%08x)\n", (long) cursor);
#endif
@@ -157,6 +170,10 @@ void GEM_WarpWMCursor(_THIS, Uint16 x, Uint16 y)

void GEM_CheckMouseMode(_THIS)
{
#ifdef DEBUG_VIDEO_GEM
printf("sdl:video:gem: check mouse mode\n");
#endif

/* If the mouse is hidden and input is grabbed, we use relative mode */
if ( (!(SDL_cursorstate & CURSOR_VISIBLE)) &&
/*(this->input_grab != SDL_GRAB_OFF) && */ /* Damn GEM can not grab */
@@ -440,6 +440,7 @@ int GEM_VideoInit(_THIS, SDL_PixelFormat *vformat)

/* Set mouse cursor to arrow */
graf_mouse(ARROW, NULL);
GEM_cursor = NULL;

/* Init chunky to planar routine */
SDL_Atari_C2pConvert = SDL_Atari_C2pConvert8;
@@ -27,6 +27,11 @@
#include "SDL_mutex.h"
#include "../SDL_sysvideo.h"

/* The implementation dependent data for the window manager cursor */
struct WMcursor {
MFORM *mform_p;
};

/* Hidden "this" pointer for the video functions */
#define _THIS SDL_VideoDevice *this

@@ -82,6 +87,7 @@ struct SDL_PrivateVideoData {
short message[8]; /* To self-send an AES message */
void *menubar; /* Menu bar save buffer when going fullscreen */
SDL_bool use_dev_mouse; /* Use /dev/mouse ? */
WMcursor *cursor; /* To restore cursor when leaving/entering window */

SDL_bool fullscreen; /* Fullscreen or windowed mode ? */
SDL_Rect *SDL_modelist[SDL_NUMMODES+1]; /* Mode list */
@@ -131,6 +137,7 @@ struct SDL_PrivateVideoData {
#define GEM_fullscreen (this->hidden->fullscreen)
#define GEM_menubar (this->hidden->menubar)
#define GEM_usedevmouse (this->hidden->use_dev_mouse)
#define GEM_cursor (this->hidden->cursor)

#define GEM_buffer1 (this->hidden->buffer1)
#define GEM_buffer2 (this->hidden->buffer2)

0 comments on commit bc511e1

Please sign in to comment.