Author: mlytwyn
Date: Fri Jan 29 19:23:25 2016
New Revision: 39321

URL: http://svn.gna.org/viewcvs/gnustep?rev=39321&view=rev
Log:
Override lock focus rectangle since controls always draw their bounds causing 
partial rectangle flushes when mixing HDC and cairo drawing (i.e. WinUXTheme)

Modified:
    libs/gui/branches/gnustep_testplant_branch/Source/NSControl.m

Modified: libs/gui/branches/gnustep_testplant_branch/Source/NSControl.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/gui/branches/gnustep_testplant_branch/Source/NSControl.m?rev=39321&r1=39320&r2=39321&view=diff
==============================================================================
--- libs/gui/branches/gnustep_testplant_branch/Source/NSControl.m       
(original)
+++ libs/gui/branches/gnustep_testplant_branch/Source/NSControl.m       Fri Jan 
29 19:23:25 2016
@@ -50,6 +50,13 @@
 #import "AppKit/NSWindow.h"
 #import "GSBindingHelpers.h"
 #import "NSViewPrivate.h"
+#import "GNUstepGUI/GSTheme.h"
+
+#if defined(__MINGW__)
+@interface NSView ()
+- (void) _lockFocusInContext: (NSGraphicsContext *)ctxt inRect: (NSRect)rect;
+@end
+#endif
 
 /*
  * Class variables
@@ -670,7 +677,27 @@
   return [_cell isOpaque];
 }
 
-- (void) drawRect: (NSRect)aRect
+#if defined(__MINGW__)
+- (void) _lockFocusInContext: (NSGraphicsContext *)ctxt inRect: (NSRect)rect
+{
+  // Our drawing bypasses the dirtyRect and draws the entire control causing 
issues
+  // if the dirty rectangle is a partial rectangle since only the dirty 
rectangle
+  // gets flushed.  This causes problems with cairo drawing on windows since 
the
+  // theme drawing (i.e. like WinUXTheme) draws directly into the HDC then 
does not
+  // get flushed out causing partial control/text...
+  if ([[[GSTheme theme] name] isEqualToString: @"GNUstep"] == NO)
+  {
+    // We'll have to assume that any them outside ours is mixing HDC and cairo 
drawing...
+    [super _lockFocusInContext: ctxt inRect: _bounds];
+    return;
+  }
+  
+  // Otherwise use the dirty rectangle given us...
+  [super _lockFocusInContext: ctxt inRect: rect];
+}
+#endif
+
+- (void) drawRect: (NSRect)dirtyRect
 {
   [self drawCell: _cell];
 }
@@ -682,8 +709,7 @@
 {
   if (_cell == aCell)
     {
-      [_cell drawWithFrame: _bounds
-             inView: self];
+      [_cell drawWithFrame: _bounds inView: self];
     }
 }
 


_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs

Reply via email to