comparison src/video/maccommon/SDL_macmouse.c @ 1668:4da1ee79c9af SDL-1.3

more tweaking indent options
author Sam Lantinga <slouken@libsdl.org>
date Mon, 29 May 2006 04:04:35 +0000
parents 782fd950bd46
children
comparison
equal deleted inserted replaced
1667:1fddae038bc8 1668:4da1ee79c9af
44 Cursor curs; 44 Cursor curs;
45 }; 45 };
46 46
47 47
48 void 48 void
49 Mac_FreeWMCursor (_THIS, WMcursor * cursor) 49 Mac_FreeWMCursor(_THIS, WMcursor * cursor)
50 { 50 {
51 SDL_free (cursor); 51 SDL_free(cursor);
52 } 52 }
53 53
54 WMcursor * 54 WMcursor *
55 Mac_CreateWMCursor (_THIS, 55 Mac_CreateWMCursor(_THIS,
56 Uint8 * data, Uint8 * mask, int w, int h, int hot_x, 56 Uint8 * data, Uint8 * mask, int w, int h, int hot_x,
57 int hot_y) 57 int hot_y)
58 { 58 {
59 WMcursor *cursor; 59 WMcursor *cursor;
60 int row, bytes; 60 int row, bytes;
61 61
62 /* Allocate the cursor memory */ 62 /* Allocate the cursor memory */
63 cursor = (WMcursor *) SDL_malloc (sizeof (WMcursor)); 63 cursor = (WMcursor *) SDL_malloc(sizeof(WMcursor));
64 if (cursor == NULL) { 64 if (cursor == NULL) {
65 SDL_OutOfMemory (); 65 SDL_OutOfMemory();
66 return (NULL); 66 return (NULL);
67 } 67 }
68 SDL_memset (cursor, 0, sizeof (*cursor)); 68 SDL_memset(cursor, 0, sizeof(*cursor));
69 69
70 if (w > 16) 70 if (w > 16)
71 w = 16; 71 w = 16;
72 72
73 if (h > 16) 73 if (h > 16)
74 h = 16; 74 h = 16;
75 75
76 bytes = (w + 7) / 8; 76 bytes = (w + 7) / 8;
77 77
78 for (row = 0; row < h; ++row) { 78 for (row = 0; row < h; ++row) {
79 SDL_memcpy (&cursor->curs.data[row], data, bytes); 79 SDL_memcpy(&cursor->curs.data[row], data, bytes);
80 data += bytes; 80 data += bytes;
81 } 81 }
82 for (row = 0; row < h; ++row) { 82 for (row = 0; row < h; ++row) {
83 SDL_memcpy (&cursor->curs.mask[row], mask, bytes); 83 SDL_memcpy(&cursor->curs.mask[row], mask, bytes);
84 mask += bytes; 84 mask += bytes;
85 } 85 }
86 cursor->curs.hotSpot.h = hot_x; 86 cursor->curs.hotSpot.h = hot_x;
87 cursor->curs.hotSpot.v = hot_y; 87 cursor->curs.hotSpot.v = hot_y;
88 88
91 } 91 }
92 92
93 int Mac_cursor_showing = 1; 93 int Mac_cursor_showing = 1;
94 94
95 int 95 int
96 Mac_ShowWMCursor (_THIS, WMcursor * cursor) 96 Mac_ShowWMCursor(_THIS, WMcursor * cursor)
97 { 97 {
98 if (cursor == NULL) { 98 if (cursor == NULL) {
99 if (Mac_cursor_showing) { 99 if (Mac_cursor_showing) {
100 HideCursor (); 100 HideCursor();
101 Mac_cursor_showing = 0; 101 Mac_cursor_showing = 0;
102 } 102 }
103 } else { 103 } else {
104 SetCursor (&cursor->curs); 104 SetCursor(&cursor->curs);
105 if (!Mac_cursor_showing) { 105 if (!Mac_cursor_showing) {
106 ShowCursor (); 106 ShowCursor();
107 Mac_cursor_showing = 1; 107 Mac_cursor_showing = 1;
108 } 108 }
109 } 109 }
110 return (1); 110 return (1);
111 } 111 }
112 112
113 void 113 void
114 Mac_WarpWMCursor (_THIS, Uint16 x, Uint16 y) 114 Mac_WarpWMCursor(_THIS, Uint16 x, Uint16 y)
115 { 115 {
116 #if !TARGET_API_MAC_CARBON 116 #if !TARGET_API_MAC_CARBON
117 CursorDevice *cursordevice; 117 CursorDevice *cursordevice;
118 118
119 cursordevice = nil; 119 cursordevice = nil;
120 CursorDeviceNextDevice (&cursordevice); 120 CursorDeviceNextDevice(&cursordevice);
121 if (cursordevice != nil) { 121 if (cursordevice != nil) {
122 WindowPtr saveport; 122 WindowPtr saveport;
123 Point where; 123 Point where;
124 124
125 GetPort (&saveport); 125 GetPort(&saveport);
126 SetPort (SDL_Window); 126 SetPort(SDL_Window);
127 where.h = x; 127 where.h = x;
128 where.v = y; 128 where.v = y;
129 LocalToGlobal (&where); 129 LocalToGlobal(&where);
130 SetPort (saveport); 130 SetPort(saveport);
131 CursorDeviceMoveTo (cursordevice, where.h, where.v); 131 CursorDeviceMoveTo(cursordevice, where.h, where.v);
132 } 132 }
133 #endif /* !TARGET_API_MAC_CARBON */ 133 #endif /* !TARGET_API_MAC_CARBON */
134 } 134 }
135 135
136 /* vi: set ts=4 sw=4 expandtab: */ 136 /* vi: set ts=4 sw=4 expandtab: */