text pasting support for macosx. updated macosx error dialog procedure.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@745 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
Ozkan Sezer 2012-09-28 20:10:30 +00:00
parent ddfc90fd36
commit 642bb168ba
4 changed files with 29 additions and 9 deletions

View file

@ -37,16 +37,36 @@ void PL_VID_Shutdown (void)
{
}
#define MAX_CLIPBOARDTXT MAXCMDLINE /* 256 */
char *PL_GetClipboardData (void)
{
/* TODO */
return NULL;
char *data = NULL;
NSPasteboard* pasteboard = [NSPasteboard generalPasteboard];
NSArray* types = [pasteboard types];
if ([types containsObject: NSStringPboardType]) {
NSString* clipboardString = [pasteboard stringForType: NSStringPboardType];
if (clipboardString != NULL && [clipboardString length] > 0) {
size_t sz = [clipboardString length] + 1;
sz = q_min(MAX_CLIPBOARDTXT, sz);
data = (char *) Z_Malloc(sz);
#if (MAC_OS_X_VERSION_MIN_REQUIRED < 1040) /* for ppc builds targeting 10.3 and older */
q_strlcpy (data, [clipboardString cString], sz);
#else
q_strlcpy (data, [clipboardString cStringUsingEncoding: NSASCIIStringEncoding], sz);
#endif
}
}
return data;
}
void PL_ErrorDialog(const char *errorMsg)
{
NSRunCriticalAlertPanel(@"Quake Error",
[NSString stringWithUTF8String:errorMsg],
@"OK", nil, nil);
#if (MAC_OS_X_VERSION_MIN_REQUIRED < 1040) /* ppc builds targeting 10.3 and older */
NSString* msg = [NSString stringWithCString:errorMsg];
#else
NSString* msg = [NSString stringWithCString:errorMsg encoding:NSASCIIStringEncoding];
#endif
NSRunCriticalAlertPanel (@"Quake Error", msg, @"OK", nil, nil);
}

View file

@ -176,7 +176,7 @@ these patched libSDL binaries may help.
<LI> Made Quake shareware 1.00 and 1.01 versions to be recognized properly.</LI>
<LI> Fixed control-character handling in unicode mode.</LI>
<LI> Made the keypad keys to send separate key events in game mode.</LI>
<LI> Ctrl-V text pasting support from OS clipboard to console (windows-only for now.)</LI>
<LI> Text pasting support from OS clipboard to console. (windows and macosx.)</LI>
<LI> Fixed increased (more than 32) dynamic lights.</LI>
<LI> Music playback: Made sure that the file's channels count is supported.</LI>
<LI> Support for Solaris.</LI>

View file

@ -102,7 +102,7 @@ these patched libSDL binaries may help.
<item> Made Quake shareware 1.00 and 1.01 versions to be recognized properly.
<item> Fixed control-character handling in unicode mode.
<item> Made the keypad keys to send separate key events in game mode.
<item> Ctrl-V text pasting support from OS clipboard to console (windows-only for now.)
<item> Text pasting support from OS clipboard to console. (windows and macosx.)
<item> Fixed increased (more than 32) dynamic lights.
<item> Music playback: Made sure that the file's channels count is supported.
<item> Support for Solaris.

View file

@ -165,8 +165,8 @@
o Made the keypad keys to send separate key events in game mode.
o Ctrl-V text pasting support from OS clipboard to console (windows-
only for now.)
o Text pasting support from OS clipboard to console. (windows and
macosx.)
o Fixed increased (more than 32) dynamic lights.