Macintosh

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@2200 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
master
Damien Doligez 1998-11-28 00:32:02 +00:00
parent e62bfafb00
commit e88706ce22
4 changed files with 24 additions and 8 deletions

View File

@ -3,7 +3,7 @@
MacVersion = "Mac{MAJOR}.{MINOR}{STAGE}{REV}"
CAMLC = :boot:ocamlrun :boot:ocamlc -I :boot:
COMPFLAGS = {INCLUDES}
COMPFLAGS = -w s {INCLUDES}
LINKFLAGS =
CAMLYACC = :boot:ocamlyacc
YACCFLAGS =

View File

@ -16,17 +16,23 @@
UInt32 evtSleep = 0;
static RgnHandle mouseRegion = NULL;
static RgnHandle pointRegion = NULL;
static long cursor_timeout;
static void AdjustCursor (Point mouse, RgnHandle mouseRegion)
{
WindowPtr w = FrontWindow ();
WEHandle we = WinGetWE (w);
int k = WinGetKind (w);
Boolean res;
if (caml_at_work && w == winToplevel) return;
if (caml_at_work && TickCount () > cursor_timeout){
DisplayRotatingCursor ();
return;
}
SetRectRgn (mouseRegion, -SHRT_MAX, -SHRT_MAX, SHRT_MAX, SHRT_MAX);
if (we != NULL && k != kWinAbout){
if (WEAdjustCursor (mouse, mouseRegion, we)) return;
res = WEAdjustCursor (mouse, mouseRegion, we);
if (res) return;
}
SetCursor (&qd.arrow);
}
@ -229,9 +235,16 @@ static void DoDialogEvent (EventRecord *evt)
}
}
Point latestpos = {-1, -1};
static pascal Boolean ProcessEvent (EventRecord *evt, long *sleep,
RgnHandle *rgn)
{
if (evt->what != nullEvent
|| evt->where.h != latestpos.h || evt->where.v != latestpos.v){
latestpos = evt->where;
cursor_timeout = TickCount () + 60;
}
if (evt->what <= osEvt) AdjustCursor (evt->where, mouseRegion);
if (IsDialogEvent (evt)){
DoDialogEvent (evt);

View File

@ -402,14 +402,16 @@ pascal void InitCursorCtl (acurHandle newCursors)
/* In O'Caml, counter is always a multiple of 32. */
pascal void RotateCursor (long counter)
{
if (FrontWindow () == winToplevel){
(*acurh)->current += (*acurh)->nframes + (counter >= 0 ? 1 : -1);
(*acurh)->current %= (*acurh)->nframes;
SetCursor (*((*acurh)->frames[(*acurh)->current].h));
}
(*acurh)->current += (*acurh)->nframes + (counter >= 0 ? 1 : -1);
(*acurh)->current %= (*acurh)->nframes;
GetAndProcessEvents (noWait, 0, 0);
}
void DisplayRotatingCursor (void)
{
SetCursor (*((*acurh)->frames[(*acurh)->current].h));
}
/***
"getenv" in the standalone application
envPtr is set up by launch_caml_main

View File

@ -147,6 +147,7 @@ extern int caml_at_work;
void Caml_working (int newstate);
void GlueInterrupt (void);
OSErr launch_caml_main (void);
void DisplayRotatingCursor (void);
/* graph.c */
void GraphGotEvent (EventRecord *evt);