From c769502ca286aca607423b420d6460dee5442bb8 Mon Sep 17 00:00:00 2001 From: "pkw%us.ibm.com" Date: Wed, 23 Jun 2004 17:49:48 +0000 Subject: [PATCH] Bug 126066 - Changing caret (cursor) color. r=tor@acm.org, sr=dbaron@dbaron.org --- gfx/src/gtk/nsRenderingContextGTK.cpp | 9 ++++++++- gfx/src/xlib/nsRenderingContextXlib.cpp | 7 +++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/gfx/src/gtk/nsRenderingContextGTK.cpp b/gfx/src/gtk/nsRenderingContextGTK.cpp index 26dbd411f96..090aa9fd741 100644 --- a/gfx/src/gtk/nsRenderingContextGTK.cpp +++ b/gfx/src/gtk/nsRenderingContextGTK.cpp @@ -979,6 +979,10 @@ NS_IMETHODIMP nsRenderingContextGTK::InvertRect(nscoord aX, nscoord aY, nscoord return NS_ERROR_FAILURE; } + // Back up the current color, and use GXxor against white to get a + // visible result. + nscolor backupColor = mCurrentColor; + mCurrentColor = NS_RGB(255, 255, 255); nscoord x,y,w,h; x = aX; @@ -993,7 +997,7 @@ NS_IMETHODIMP nsRenderingContextGTK::InvertRect(nscoord aX, nscoord aY, nscoord // It's all way off the screen anyway. ConditionRect(x,y,w,h); - mFunction = GDK_INVERT; + mFunction = GDK_XOR; UpdateGC(); @@ -1005,6 +1009,9 @@ NS_IMETHODIMP nsRenderingContextGTK::InvertRect(nscoord aX, nscoord aY, nscoord // Back to normal copy drawing mode mFunction = GDK_COPY; + // Restore current color + mCurrentColor = backupColor; + return NS_OK; } diff --git a/gfx/src/xlib/nsRenderingContextXlib.cpp b/gfx/src/xlib/nsRenderingContextXlib.cpp index b5f10526283..b35a7ef9865 100644 --- a/gfx/src/xlib/nsRenderingContextXlib.cpp +++ b/gfx/src/xlib/nsRenderingContextXlib.cpp @@ -965,6 +965,10 @@ nsRenderingContextXlib::InvertRect(nscoord aX, nscoord aY, nscoord aWidth, nscoo NS_ENSURE_TRUE(mTranMatrix != nsnull, NS_ERROR_FAILURE); NS_ENSURE_TRUE(mSurface != nsnull, NS_ERROR_FAILURE); + // Back up the current color, and use GXxor against white to get a + // visible result. + nscolor backupColor = mCurrentColor; + mCurrentColor = NS_RGB(255, 255, 255); nscoord x,y,w,h; x = aX; @@ -993,6 +997,9 @@ nsRenderingContextXlib::InvertRect(nscoord aX, nscoord aY, nscoord aWidth, nscoo mFunction = GXcopy; + // Restore current color + mCurrentColor = backupColor; + return NS_OK; }