mirror of
https://github.com/gnustep/libs-back.git
synced 2025-04-25 00:40:55 +00:00
Work around fix for non-retained buffered windows not re-displaying correctly with cairo on MSWindows
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/branches/gnustep_testplant_branch@36907 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
7b6690c718
commit
afe41336df
2 changed files with 42 additions and 19 deletions
|
@ -38,6 +38,9 @@
|
|||
#include "cairo/CairoFontEnumerator.h"
|
||||
#include "config.h"
|
||||
|
||||
#include "win32/WIN32Server.h"
|
||||
#include "win32/WIN32Geometry.h"
|
||||
|
||||
#define CGSTATE ((CairoGState *)gstate)
|
||||
|
||||
#if BUILD_SERVER == SERVER_x11
|
||||
|
@ -118,9 +121,37 @@
|
|||
- (void) flushGraphics
|
||||
{
|
||||
// FIXME: Why is this here? When is it called?
|
||||
// Comments added 07/20/2013 to address the above question after
|
||||
// further debugging cairo/MSwindows non-retained backing store type:
|
||||
// This is called from NSWindow/flushWindow for the non-retained backing
|
||||
// store case. This code originally seems to have been added due to the
|
||||
// non-retained backing store type NOT showing up on XWindows/Cairo combination
|
||||
// and added this XFlush call to handle this case.
|
||||
|
||||
// For MSWindows a similar problem seems to occur. However, the only
|
||||
// equivalent to XFlush on MSWindows is GdiFlush, which doesn't cause
|
||||
// the window to re-display properly. So, on MSWindows, the non-retained
|
||||
// cairo backend surface is currently excluded from the build and we
|
||||
// handle it as a buffered window expose event for now.
|
||||
// FIXME: Anyone know how this can be handled/fixed correctly...
|
||||
|
||||
#if BUILD_SERVER == SERVER_x11
|
||||
XFlush([(XGServer *)server xDisplay]);
|
||||
#endif // BUILD_SERVER = SERVER_x11
|
||||
#elif BUILD_SERVER == SERVER_win32
|
||||
Win32CairoSurface *surface;
|
||||
[CGSTATE GSCurrentSurface: &surface : NULL : NULL];
|
||||
if (surface)
|
||||
{
|
||||
// Non-retained backing store types currently unsupported on MSWindows...
|
||||
// Currently handling such windows as buffered and invoking the handle
|
||||
// expose event processing...
|
||||
RECT rect;
|
||||
HWND hwnd = surface->gsDevice;
|
||||
GetClientRect(hwnd, &rect);
|
||||
NSRect frame = MSWindowRectToGS((WIN32Server*)GSCurrentServer(), hwnd, rect);
|
||||
[[self class] handleExposeRect: frame forDriver: surface];
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -171,6 +171,10 @@
|
|||
// NSBackingStoreRetained works like Buffered since 10.5 (See apple docs)...
|
||||
// NOTE: According to Apple docs NSBackingStoreBuffered should be the only one
|
||||
// ever used anymore....others are NOT recommended...
|
||||
#if 0 // FIXME:
|
||||
// Non-retained backing store type on windows doesn't re-display correctly
|
||||
// after first time (see additional comments in method -[CairoContext flushGraphics])
|
||||
// Currently handling such windows as buffered store types until a fix can be resolved.
|
||||
if (win && (win->type == NSBackingStoreNonretained))
|
||||
{
|
||||
// This is the raw DC surface...
|
||||
|
@ -194,6 +198,7 @@
|
|||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
NSSize csize = [self size];
|
||||
|
||||
|
@ -256,21 +261,8 @@
|
|||
|
||||
- (void) dealloc
|
||||
{
|
||||
if ((_surface == NULL) || (cairo_surface_status(_surface) != CAIRO_STATUS_SUCCESS))
|
||||
{
|
||||
NSWarnMLog(@"null surface or bad status\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (cairo_win32_surface_get_dc(_surface) == NULL)
|
||||
{
|
||||
NSWarnMLog(@"HDC is NULL for surface: %@\n", self);
|
||||
}
|
||||
else
|
||||
{
|
||||
ReleaseDC([self gsDevice], cairo_win32_surface_get_dc(_surface));
|
||||
}
|
||||
}
|
||||
// After further testing and monitoring USER/GDI object counts found
|
||||
// that releasing the HDC is redundant and unnecessary...
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue