summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXRegion.c
diff options
context:
space:
mode:
authorKevin Walzer <kw@codebykevin.com>2014-07-24 02:30:25 (GMT)
committerKevin Walzer <kw@codebykevin.com>2014-07-24 02:30:25 (GMT)
commitc14530201df3f512c68f49728a3b8fcd2755bfcc (patch)
treed1885a3da1b2008efb5acfb893efd85c995688f6 /macosx/tkMacOSXRegion.c
parent5a7df0cabf3670fae0c85b2cf48b5455b6aaa054 (diff)
downloadtk-c14530201df3f512c68f49728a3b8fcd2755bfcc.zip
tk-c14530201df3f512c68f49728a3b8fcd2755bfcc.tar.gz
tk-c14530201df3f512c68f49728a3b8fcd2755bfcc.tar.bz2
Fix for display of images when scrolling a text widget on OS X; thanks to Marc Culler for patch
Diffstat (limited to 'macosx/tkMacOSXRegion.c')
-rw-r--r--macosx/tkMacOSXRegion.c64
1 files changed, 32 insertions, 32 deletions
diff --git a/macosx/tkMacOSXRegion.c b/macosx/tkMacOSXRegion.c
index 8432299..c716ab7 100644
--- a/macosx/tkMacOSXRegion.c
+++ b/macosx/tkMacOSXRegion.c
@@ -158,6 +158,29 @@ TkUnionRectWithRegion(
/*
*----------------------------------------------------------------------
*
+ * TkMacOSXIsEmptyRegion --
+ *
+ * Return native region for given tk region.
+ *
+ * Results:
+ * 1 if empty, 0 otherwise.
+ *
+ * Side effects:
+ * None.
+ *
+ *----------------------------------------------------------------------
+ */
+
+int
+TkMacOSXIsEmptyRegion(
+ TkRegion r)
+{
+ return HIShapeIsEmpty((HIMutableShapeRef) r) ? 1 : 0;
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* TkRectInRegion --
*
* Implements the equivelent of the X window function XRectInRegion. See
@@ -181,12 +204,14 @@ TkRectInRegion(
unsigned int width,
unsigned int height)
{
- int result;
- const CGRect r = CGRectMake(x, y, width, height);
-
- result = HIShapeIntersectsRect((HIShapeRef) region, &r) ?
+ if ( TkMacOSXIsEmptyRegion(region) ) {
+ return RectangleOut;
+ }
+ else {
+ const CGRect r = CGRectMake(x, y, width, height);
+ return HIShapeIntersectsRect((HIShapeRef) region, &r) ?
RectanglePart : RectangleOut;
- return result;
+ }
}
/*
@@ -332,12 +357,11 @@ TkpReleaseRegion(
{
CFRelease(r);
}
-#if 0
/*
*----------------------------------------------------------------------
*
- * TkMacOSXEmtpyRegion --
+ * TkMacOSXSetEmptyRegion --
*
* Set region to emtpy.
*
@@ -351,7 +375,7 @@ TkpReleaseRegion(
*/
void
-TkMacOSXEmtpyRegion(
+TkMacOSXSetEmptyRegion(
TkRegion r)
{
ChkErr(HIShapeSetEmpty, (HIMutableShapeRef) r);
@@ -360,30 +384,6 @@ TkMacOSXEmtpyRegion(
/*
*----------------------------------------------------------------------
*
- * TkMacOSXIsEmptyRegion --
- *
- * Return native region for given tk region.
- *
- * Results:
- * 1 if empty, 0 otherwise.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-int
-TkMacOSXIsEmptyRegion(
- TkRegion r)
-{
- return HIShapeIsEmpty((HIMutableShapeRef) r) ? 1 : 0;
-}
-#endif
-
-/*
- *----------------------------------------------------------------------
- *
* TkMacOSXGetNativeRegion --
*
* Return native region for given tk region.