Commit 4e4aa03a authored by Patrice Mandin's avatar Patrice Mandin

Fix mouse cursor change

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%401843
parent 27e82c6f
...@@ -186,8 +186,18 @@ void GEM_PumpEvents(_THIS) ...@@ -186,8 +186,18 @@ void GEM_PumpEvents(_THIS)
if (this->input_grab == SDL_GRAB_OFF) { if (this->input_grab == SDL_GRAB_OFF) {
if (SDL_GetAppState() & SDL_APPMOUSEFOCUS) { if (SDL_GetAppState() & SDL_APPMOUSEFOCUS) {
SDL_PrivateAppActive(0, SDL_APPMOUSEFOCUS); SDL_PrivateAppActive(0, SDL_APPMOUSEFOCUS);
if (SDL_GetAppState() & SDL_APPINPUTFOCUS) {
graf_mouse(ARROW, NULL);
}
} else { } else {
SDL_PrivateAppActive(1, SDL_APPMOUSEFOCUS); 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 @@ ...@@ -33,6 +33,7 @@
#include "../../events/SDL_events_c.h" #include "../../events/SDL_events_c.h"
#include "../SDL_cursor_c.h" #include "../SDL_cursor_c.h"
#include "SDL_gemmouse_c.h" #include "SDL_gemmouse_c.h"
#include "SDL_gemvideo.h"
/* Defines */ /* Defines */
...@@ -41,14 +42,12 @@ ...@@ -41,14 +42,12 @@
#define MAXCURWIDTH 16 #define MAXCURWIDTH 16
#define MAXCURHEIGHT 16 #define MAXCURHEIGHT 16
/* The implementation dependent data for the window manager cursor */
struct WMcursor {
MFORM *mform_p;
};
void GEM_FreeWMCursor(_THIS, WMcursor *cursor) void GEM_FreeWMCursor(_THIS, WMcursor *cursor)
{ {
#ifdef DEBUG_VIDEO_GEM
printf("sdl:video:gem: free cursor\n");
#endif
if (cursor == NULL) if (cursor == NULL)
return; return;
...@@ -67,6 +66,12 @@ WMcursor *GEM_CreateWMCursor(_THIS, ...@@ -67,6 +66,12 @@ WMcursor *GEM_CreateWMCursor(_THIS,
MFORM *new_mform; MFORM *new_mform;
int i; int i;
#ifdef DEBUG_VIDEO_GEM
Uint16 *data1, *mask1;
printf("sdl:video:gem: create cursor\n");
#endif
/* Check the size */ /* Check the size */
if ( (w > MAXCURWIDTH) || (h > MAXCURHEIGHT) ) { if ( (w > MAXCURWIDTH) || (h > MAXCURHEIGHT) ) {
SDL_SetError("Only cursors of dimension (%dx%d) are allowed", SDL_SetError("Only cursors of dimension (%dx%d) are allowed",
...@@ -100,6 +105,12 @@ WMcursor *GEM_CreateWMCursor(_THIS, ...@@ -100,6 +105,12 @@ WMcursor *GEM_CreateWMCursor(_THIS,
for (i=0;i<MAXCURHEIGHT;i++) { for (i=0;i<MAXCURHEIGHT;i++) {
new_mform->mf_mask[i]=0; new_mform->mf_mask[i]=0;
new_mform->mf_data[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) { if (w<=8) {
...@@ -109,14 +120,15 @@ WMcursor *GEM_CreateWMCursor(_THIS, ...@@ -109,14 +120,15 @@ WMcursor *GEM_CreateWMCursor(_THIS,
} }
} else { } else {
for (i=0;i<h;i++) { for (i=0;i<h;i++) {
new_mform->mf_mask[i]= mask[i<<1]<<8 | mask[(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]; new_mform->mf_data[i]= (data[i<<1]<<8) | data[(i<<1)+1];
} }
} }
#ifdef DEBUG_VIDEO_GEM #ifdef DEBUG_VIDEO_GEM
for (i=0; i<h ;i++) { 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"); printf("sdl:video:gem: CreateWMCursor(): done\n");
...@@ -127,13 +139,14 @@ WMcursor *GEM_CreateWMCursor(_THIS, ...@@ -127,13 +139,14 @@ WMcursor *GEM_CreateWMCursor(_THIS,
int GEM_ShowWMCursor(_THIS, WMcursor *cursor) int GEM_ShowWMCursor(_THIS, WMcursor *cursor)
{ {
/* GEM_cursor = cursor;
if (cursor == NULL) { if (cursor == NULL) {
graf_mouse(M_OFF, NULL); graf_mouse(M_OFF, NULL);
GEM_cursor = (void *) -1;
} else if (cursor->mform_p) { } else if (cursor->mform_p) {
graf_mouse(USER_DEF, cursor->mform_p); graf_mouse(USER_DEF, cursor->mform_p);
} }
*/
#ifdef DEBUG_VIDEO_GEM #ifdef DEBUG_VIDEO_GEM
printf("sdl:video:gem: ShowWMCursor(0x%08x)\n", (long) cursor); printf("sdl:video:gem: ShowWMCursor(0x%08x)\n", (long) cursor);
#endif #endif
...@@ -157,6 +170,10 @@ void GEM_WarpWMCursor(_THIS, Uint16 x, Uint16 y) ...@@ -157,6 +170,10 @@ void GEM_WarpWMCursor(_THIS, Uint16 x, Uint16 y)
void GEM_CheckMouseMode(_THIS) 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 the mouse is hidden and input is grabbed, we use relative mode */
if ( (!(SDL_cursorstate & CURSOR_VISIBLE)) && if ( (!(SDL_cursorstate & CURSOR_VISIBLE)) &&
/*(this->input_grab != SDL_GRAB_OFF) && */ /* Damn GEM can not grab */ /*(this->input_grab != SDL_GRAB_OFF) && */ /* Damn GEM can not grab */
......
...@@ -440,6 +440,7 @@ int GEM_VideoInit(_THIS, SDL_PixelFormat *vformat) ...@@ -440,6 +440,7 @@ int GEM_VideoInit(_THIS, SDL_PixelFormat *vformat)
/* Set mouse cursor to arrow */ /* Set mouse cursor to arrow */
graf_mouse(ARROW, NULL); graf_mouse(ARROW, NULL);
GEM_cursor = NULL;
/* Init chunky to planar routine */ /* Init chunky to planar routine */
SDL_Atari_C2pConvert = SDL_Atari_C2pConvert8; SDL_Atari_C2pConvert = SDL_Atari_C2pConvert8;
......
...@@ -27,6 +27,11 @@ ...@@ -27,6 +27,11 @@
#include "SDL_mutex.h" #include "SDL_mutex.h"
#include "../SDL_sysvideo.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 */ /* Hidden "this" pointer for the video functions */
#define _THIS SDL_VideoDevice *this #define _THIS SDL_VideoDevice *this
...@@ -82,6 +87,7 @@ struct SDL_PrivateVideoData { ...@@ -82,6 +87,7 @@ struct SDL_PrivateVideoData {
short message[8]; /* To self-send an AES message */ short message[8]; /* To self-send an AES message */
void *menubar; /* Menu bar save buffer when going fullscreen */ void *menubar; /* Menu bar save buffer when going fullscreen */
SDL_bool use_dev_mouse; /* Use /dev/mouse ? */ 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_bool fullscreen; /* Fullscreen or windowed mode ? */
SDL_Rect *SDL_modelist[SDL_NUMMODES+1]; /* Mode list */ SDL_Rect *SDL_modelist[SDL_NUMMODES+1]; /* Mode list */
...@@ -131,6 +137,7 @@ struct SDL_PrivateVideoData { ...@@ -131,6 +137,7 @@ struct SDL_PrivateVideoData {
#define GEM_fullscreen (this->hidden->fullscreen) #define GEM_fullscreen (this->hidden->fullscreen)
#define GEM_menubar (this->hidden->menubar) #define GEM_menubar (this->hidden->menubar)
#define GEM_usedevmouse (this->hidden->use_dev_mouse) #define GEM_usedevmouse (this->hidden->use_dev_mouse)
#define GEM_cursor (this->hidden->cursor)
#define GEM_buffer1 (this->hidden->buffer1) #define GEM_buffer1 (this->hidden->buffer1)
#define GEM_buffer2 (this->hidden->buffer2) #define GEM_buffer2 (this->hidden->buffer2)
......
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