summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXXStubs.c
diff options
context:
space:
mode:
authordas <das>2007-11-09 06:26:53 (GMT)
committerdas <das>2007-11-09 06:26:53 (GMT)
commitb0e3f55fe56f3f1fa4ad3cf7c63dddcfff5a9846 (patch)
tree40938979466c8caac1c03c907753bc43175304bd /macosx/tkMacOSXXStubs.c
parent455d9dc4b8b50ed064729851295535018eb99449 (diff)
downloadtk-b0e3f55fe56f3f1fa4ad3cf7c63dddcfff5a9846.zip
tk-b0e3f55fe56f3f1fa4ad3cf7c63dddcfff5a9846.tar.gz
tk-b0e3f55fe56f3f1fa4ad3cf7c63dddcfff5a9846.tar.bz2
Backport from HEAD of Aqua changes from 2007-10-12 to 2007-11-09
Diffstat (limited to 'macosx/tkMacOSXXStubs.c')
-rw-r--r--macosx/tkMacOSXXStubs.c109
1 files changed, 99 insertions, 10 deletions
diff --git a/macosx/tkMacOSXXStubs.c b/macosx/tkMacOSXXStubs.c
index 1232a01..1f48753 100644
--- a/macosx/tkMacOSXXStubs.c
+++ b/macosx/tkMacOSXXStubs.c
@@ -13,12 +13,16 @@
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkMacOSXXStubs.c,v 1.2.2.19 2007/07/04 18:10:52 hobbs Exp $
+ * RCS: @(#) $Id: tkMacOSXXStubs.c,v 1.2.2.20 2007/11/09 06:26:57 das Exp $
*/
#include "tkMacOSXPrivate.h"
#include "tkMacOSXEvent.h"
+#if 0
+#include <IOKit/IOKitLib.h>
+#endif
+
/*
* Because this file is still under major development Debugger statements are
* used through out this file. The define TCL_DEBUG will decide whether
@@ -704,15 +708,7 @@ XSetClipRectangles(
int n,
int ordering)
{
- TkRegion clipRgn;
-
- if (gc->clip_mask && ((TkpClipMask*)gc->clip_mask)->type
- == TKP_CLIP_REGION) {
- clipRgn = ((TkpClipMask*)gc->clip_mask)->value.region;
- SetEmptyRgn((RgnHandle) clipRgn);
- } else {
- clipRgn = TkCreateRegion(); /* LEAK! */
- }
+ TkRegion clipRgn = TkCreateRegion();
while (n--) {
XRectangle rect = *rectangles;
@@ -723,6 +719,7 @@ XSetClipRectangles(
rectangles++;
}
TkSetRegion(d, gc, clipRgn);
+ TkDestroyRegion(clipRgn);
return 1;
}
#endif
@@ -1198,3 +1195,95 @@ TkGetDefaultScreenName(
#endif
return macScreenName;
}
+#if 0
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Tk_GetUserInactiveTime --
+ *
+ * Return the number of milliseconds the user was inactive.
+ *
+ * Results:
+ * The number of milliseconds the user has been inactive,
+ * or -1 if querying the inactive time is not supported.
+ *
+ * Side effects:
+ * None.
+ *----------------------------------------------------------------------
+ */
+
+long
+Tk_GetUserInactiveTime(Display *dpy)
+{
+ io_registry_entry_t regEntry;
+ CFMutableDictionaryRef props = NULL;
+ CFTypeRef timeObj;
+ long ret = -1l;
+ uint64_t time;
+
+ regEntry = IOServiceGetMatchingService(kIOMasterPortDefault,
+ IOServiceMatching("IOHIDSystem"));
+
+ if (regEntry == 0) {
+ return -1l;
+ }
+
+ IOReturn result = IORegistryEntryCreateCFProperties(regEntry, &props,
+ kCFAllocatorDefault, 0);
+ IOObjectRelease(regEntry);
+
+ if (result != KERN_SUCCESS || props == NULL) {
+ return -1l;
+ }
+
+ timeObj = CFDictionaryGetValue(props, CFSTR("HIDIdleTime"));
+
+ if (timeObj) {
+ CFTypeID type = CFGetTypeID(timeObj);
+
+ if (type == CFDataGetTypeID()) { /* Jaguar */
+ CFDataGetBytes((CFDataRef) timeObj,
+ CFRangeMake(0, sizeof(time)), (UInt8 *) &time);
+ /* Convert nanoseconds to milliseconds. */
+ /* ret /= kMillisecondScale; */
+ ret = (long)(time/kMillisecondScale);
+ } else if (type == CFNumberGetTypeID()) { /* Panther+ */
+ CFNumberGetValue((CFNumberRef)timeObj,
+ kCFNumberSInt64Type, &time);
+ /* Convert nanoseconds to milliseconds. */
+ /* ret /= kMillisecondScale; */
+ ret = (long)(time/kMillisecondScale);
+ } else {
+ ret = -1l;
+ }
+ }
+ /* Cleanup */
+ CFRelease(props);
+
+ return ret;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
+ * Tk_ResetUserInactiveTime --
+ *
+ * Reset the user inactivity timer
+ *
+ * Results:
+ * none
+ *
+ * Side effects:
+ * The user inactivity timer of the underlaying windowing system
+ * is reset to zero.
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+Tk_ResetUserInactiveTime(Display *dpy)
+{
+ UpdateSystemActivity(OverallAct);
+}
+#endif