Added Max's patches for building MacOS X apps on command line

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40169
This commit is contained in:
Sam Lantinga 2001-09-04 23:18:45 +00:00
parent 9e8567129b
commit 23d3cf9854
18 changed files with 163 additions and 37 deletions

View file

@ -72,7 +72,7 @@ static int Mac_HandleActivate(int activate)
SDL_SetCursor(NULL);
/* put our mask back case it changed during context switch */
SetEventMask(everyEvent - autoKeyMask);
SetEventMask(everyEvent & ~autoKeyMask);
} else {
#if TARGET_API_MAC_CARBON
{ Cursor cursor;
@ -617,7 +617,7 @@ void Mac_InitEvents(_THIS)
FlushEvents(everyEvent, 0);
/* Allow every event but keyrepeat */
SetEventMask(everyEvent - autoKeyMask);
SetEventMask(everyEvent & ~autoKeyMask);
}
void Mac_QuitEvents(_THIS)

View file

@ -67,18 +67,22 @@ WMcursor *Mac_CreateWMCursor(_THIS,
return(NULL);
}
memset(cursor, 0, sizeof(*cursor));
bytes = (w/8);
if ( bytes > 2 ) {
bytes = 2;
}
for ( row=0; row<h && (row < 16); ++row ) {
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 += w/8;
data += bytes;
}
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;

View file

@ -11,7 +11,7 @@ QUARTZ_SRCS = \
SDL_QuartzVideo.m
# These files are included by SDL_QuartzVideo.m (is that right??)
EXTRA_DIST = \
noinst_HEADERS = \
SDL_QuartzEvents.m \
SDL_QuartzWM.m \
SDL_QuartzWindow.m

View file

@ -206,6 +206,12 @@ static void QZ_DoActivate (_THIS)
QZ_WarpWMCursor (this, SDL_VideoSurface->w / 2, SDL_VideoSurface->h / 2);
CGAssociateMouseAndMouseCursorPosition (0);
}
/* Hide the mouse cursor if inside the app window */
// FIXME
if (!QZ_cursor_visible) {
HideCursor ();
}
SDL_PrivateAppActive (1, SDL_APPINPUTFOCUS);
}
@ -218,6 +224,12 @@ static void QZ_DoDeactivate (_THIS) {
if (currentGrabMode == SDL_GRAB_ON) {
CGAssociateMouseAndMouseCursorPosition (1);
}
/* Show the mouse cursor */
// FIXME
if (!QZ_cursor_visible) {
ShowCursor ();
}
SDL_PrivateAppActive (0, SDL_APPINPUTFOCUS);
}
@ -309,6 +321,8 @@ static void QZ_PumpEvents (_THIS)
case NSRightMouseDragged:
case 27:
case NSMouseMoved:
if ( (SDL_VideoSurface->flags & SDL_FULLSCREEN)
|| NSPointInRect([event locationInWindow], winRect) )
{
static int moves = 0;
NSPoint p;

View file

@ -35,46 +35,52 @@ static WMcursor* QZ_CreateWMCursor (_THIS, Uint8 *data, Uint8 *mask,
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;
}
for ( row=0; row<h && (row < 16); ++row ) {
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 += w/8;
data += bytes;
}
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;
}
}