13
0

provide a GDK function to enable/disable use of Cocoa-provided rect in drawRect

This commit is contained in:
Paul Davis 2024-03-22 13:11:46 -06:00
parent 7324070628
commit fe6a635c3a
3 changed files with 19 additions and 3 deletions

View File

@ -717,17 +717,17 @@
return;
}
if (!impl->needs_display_region) {
if (!impl->needs_display_region || gdk_quartz_get_use_cocoa_invalidation()) {
[self getRectsBeingDrawn: &drawn_rects count: &count];
region = gdk_region_new ();
for (i = 0; i < count; i++)
{
gdk_rect.x = drawn_rects[i].origin.x;
gdk_rect.y = drawn_rects[i].origin.y;
gdk_rect.width = drawn_rects[i].size.width;
gdk_rect.height = drawn_rects[i].size.height;
gdk_region_union_with_rect (region, &gdk_rect);
}
} else {

View File

@ -27,6 +27,8 @@ GdkDisplay *_gdk_display = NULL;
GdkScreen *_gdk_screen = NULL;
GdkWindow *_gdk_root = NULL;
static int _gdk_quartz_use_cocoa_invalidation = FALSE;
GdkOSXVersion
gdk_quartz_osx_version (void)
{
@ -53,3 +55,15 @@ gdk_quartz_osx_version (void)
else
return vkey;
}
void
gdk_quartz_set_use_cocoa_invalidation (int yn)
{
_gdk_quartz_use_cocoa_invalidation = yn;
}
int
gdk_quartz_get_use_cocoa_invalidation (void)
{
return _gdk_quartz_use_cocoa_invalidation;
}

View File

@ -68,6 +68,8 @@ NSImage *gdk_quartz_pixbuf_to_ns_image_libgtk_only (GdkPixbuf
id gdk_quartz_drag_context_get_dragging_info_libgtk_only (GdkDragContext *context);
NSEvent *gdk_quartz_event_get_nsevent (GdkEvent *event);
GdkOSXVersion gdk_quartz_osx_version (void);
void gdk_quartz_set_use_cocoa_invalidation (int);
int gdk_quartz_get_use_cocoa_invalidation (void);
GdkAtom gdk_quartz_pasteboard_type_to_atom_libgtk_only (NSString *type);
NSString *gdk_quartz_target_to_pasteboard_type_libgtk_only (const gchar *target);