Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bb6d83a

Browse files
committed
Removed (within an #ifdef) Carbon-incompatabilities:
- Use TickCount() in stead of LMGetTicks() - Don't use xxxGetFile event filter - Don't call SystemTask or HandleSysWindowEvent (is this also automatically handled under os9??) - Don't scan event queue for cmd-. (to be fixed at some point).
1 parent 14cd750 commit bb6d83a

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

Mac/Python/macglue.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
3232

3333
#include <Events.h>
3434

35+
#ifdef TARGET_API_MAC_CARBON
36+
/* Unfortunately this call is probably slower... */
37+
#define LMGetTicks() TickCount()
38+
#endif
39+
3540
#ifdef __CFM68K__
3641
#undef GetEventQueue
3742
#endif /* __CFM68K__ */
@@ -147,8 +152,15 @@ struct hook_args {
147152
int selectcur_hit; /* Set to true when "select current" selected */
148153
char *prompt; /* The prompt */
149154
};
155+
#ifdef TARGET_API_MAC_CARBON
156+
/* The StandardFile hooks don't exist in Carbon. This breaks GetDirectory,
157+
** but the macfsn code will replace it by a NavServices version anyway.
158+
*/
159+
#define myhook_upp NULL
160+
#else
150161
static DlgHookYDUPP myhook_upp;
151162
static int upp_inited = 0;
163+
#endif
152164

153165
/*
154166
** The python-code event handler
@@ -400,6 +412,10 @@ static void
400412
scan_event_queue(flush)
401413
int flush;
402414
{
415+
#ifdef TARGET_API_MAC_CARBON
416+
/* CARBONXXXX To be implemented */
417+
return;
418+
#else
403419
register EvQElPtr q;
404420

405421
q = (EvQElPtr) LMGetEventQueue()->qHead;
@@ -414,6 +430,7 @@ scan_event_queue(flush)
414430
break;
415431
}
416432
}
433+
#endif
417434
}
418435

419436
int
@@ -486,6 +503,7 @@ void
486503
PyMac_HandleEventIntern(evp)
487504
EventRecord *evp;
488505
{
506+
#ifndef TARGET_API_MAC_CARBON
489507
if ( evp->what == mouseDown ) {
490508
WindowPtr wp;
491509

@@ -494,6 +512,7 @@ PyMac_HandleEventIntern(evp)
494512
return;
495513
}
496514
}
515+
#endif
497516
#ifdef __MWERKS__
498517
{
499518
int siouxdidit;
@@ -561,9 +580,11 @@ PyMac_DoYield(int maxsleep, int maycallpython)
561580
*/
562581
if( in_here > 1 || !schedparams.process_events ||
563582
(python_event_handler && !maycallpython) ) {
583+
#ifndef TARGET_API_MAC_CARBON
564584
if ( maxsleep >= 0 ) {
565585
SystemTask();
566586
}
587+
#endif
567588
} else {
568589
latest_time_ready = LMGetTicks() + maxsleep;
569590
do {
@@ -743,10 +764,12 @@ PyMac_GetDirectory(dirfss, prompt)
743764
StandardFileReply reply;
744765
struct hook_args hook_args;
745766

767+
#ifndef TARGET_API_MAC_CARBON
746768
if ( !upp_inited ) {
747769
myhook_upp = NewDlgHookYDProc(myhook_proc);
748770
upp_inited = 1;
749771
}
772+
#endif
750773
if ( prompt && *prompt )
751774
hook_args.prompt = (char *)Pstring(prompt);
752775
else
@@ -769,10 +792,12 @@ void PyMac_PromptGetFile(short numTypes, ConstSFTypeListPtr typeList,
769792
static Point where = {-1, -1};
770793
struct hook_args hook_args;
771794

795+
#ifndef TARGET_API_MAC_CARBON
772796
if ( !upp_inited ) {
773797
myhook_upp = NewDlgHookYDProc(myhook_proc);
774798
upp_inited = 1;
775799
}
800+
#endif
776801
if ( prompt && *prompt )
777802
hook_args.prompt = (char *)Pstring(prompt);
778803
else

0 commit comments

Comments
 (0)