X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/06c24bc0efd10e5d329d871be9112fb6ae0309e0..23897ed0d4c468bc4d78721274de5d5634e57e85:/mac/macmisc.c diff --git a/mac/macmisc.c b/mac/macmisc.c index a5cb1f5f..b2479781 100644 --- a/mac/macmisc.c +++ b/mac/macmisc.c @@ -1,4 +1,4 @@ -/* $Id: macmisc.c,v 1.1 2003/02/12 23:53:15 ben Exp $ */ +/* $Id: macmisc.c,v 1.2 2003/02/20 22:31:52 ben Exp $ */ /* * Copyright (c) 1999, 2003 Ben Harris * All rights reserved. @@ -28,6 +28,8 @@ #include #include #include +#include +#include #include #include @@ -35,6 +37,7 @@ #include #include "putty.h" +#include "mac.h" #if TARGET_API_MAC_CARBON /* @@ -48,6 +51,22 @@ const CFAllocatorRef kCFAllocatorDefault = NULL; QDGlobals qd; #endif +/* + * Like FrontWindow(), but return NULL if we aren't the front process + * (i.e. the front window isn't one of ours). + */ +WindowPtr mac_frontwindow(void) +{ + ProcessSerialNumber frontpsn; + ProcessSerialNumber curpsn = { 0, kCurrentProcess }; + Boolean result; + + GetFrontProcess(&frontpsn); + if (SameProcess(&frontpsn, &curpsn, &result) == noErr && result) + return FrontWindow(); + return NULL; +} + void fatalbox(char *fmt, ...) { va_list ap; Str255 stuff;