diff src/video/gem/SDL_gemmouse.c @ 1857:417f2af2bd52

Fix mouse cursor change
author Patrice Mandin <patmandin@gmail.com>
date Wed, 14 Jun 2006 18:57:58 +0000
parents d910939febfa
children c121d94672cb b2d9881c8c88
line wrap: on
line diff
--- a/src/video/gem/SDL_gemmouse.c	Tue May 23 15:07:56 2006 +0000
+++ b/src/video/gem/SDL_gemmouse.c	Wed Jun 14 18:57:58 2006 +0000
@@ -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 @@
 	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 @@
 	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 @@
 		}
 	} 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 @@
 
 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_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 */