diff src/video/quartz/SDL_QuartzWM.m @ 168:e92aa316c517

Added Max's patches for building MacOS X apps on command line
author Sam Lantinga <slouken@libsdl.org>
date Tue, 04 Sep 2001 23:18:45 +0000
parents 4382c38dfbee
children e8157fcb3114
line wrap: on
line diff
--- a/src/video/quartz/SDL_QuartzWM.m	Tue Sep 04 22:53:46 2001 +0000
+++ b/src/video/quartz/SDL_QuartzWM.m	Tue Sep 04 23:18:45 2001 +0000
@@ -35,46 +35,52 @@
                                           int w, int h, int hot_x, int hot_y) { 
 	WMcursor *cursor;
 	int row, bytes;
+		
+	/* Allocate the cursor memory */
 	cursor = (WMcursor *)malloc(sizeof(WMcursor));
 	if ( cursor == NULL ) {
 		SDL_OutOfMemory();
 		return(NULL);
 	}
 	memset(cursor, 0, sizeof(*cursor));
-		
-	bytes = (w/8);
-	if ( bytes > 2 ) {
-		bytes = 2;
+    
+    if (w > 16)
+        w = 16;
+    
+    if (h > 16)
+        h = 16;
+    
+	bytes = (w+7)/8;
+
+	for ( row=0; row<h; ++row ) {
+		memcpy(&cursor->curs.data[row], data, bytes);
+		data += bytes;
 	}
-	for ( row=0; row<h && (row < 16); ++row ) {
-		memcpy(&cursor->curs.data[row], data, bytes);
-		data += w/8;
-	}
-	for ( row=0; row<h && (row < 16); ++row ) {
+	for ( row=0; row<h; ++row ) {
 		memcpy(&cursor->curs.mask[row], mask, bytes);
-		mask += w/8;
+		mask += bytes;
 	}
 	cursor->curs.hotSpot.h = hot_x;
 	cursor->curs.hotSpot.v = hot_y;
 	
-        return(cursor);
+    return(cursor);
 }
 
+static int QZ_cursor_visible = 1;
+    
 static int QZ_ShowWMCursor (_THIS, WMcursor *cursor) { 
 
-    static int visible = 1;
-    
     if ( cursor == NULL) {
-        if ( visible ) {
+        if ( QZ_cursor_visible ) {
             HideCursor ();
-            visible = 0;
+            QZ_cursor_visible = 0;
         }
     }
     else {
         SetCursor(&cursor->curs);
-        if ( ! visible ) {
+        if ( ! QZ_cursor_visible ) {
             ShowCursor ();
-            visible = 1;
+            QZ_cursor_visible = 1;
         }
     }