Bug 550939 - GtkFileChooser listbox does not refresh selection

Make the quartz backend support the new queued translations.  We do this
by keeping our own copy of the region that has been set to need display.
Using this region we can intersect by the given area, translate this and also
set needs display for the resulting area.
This commit is contained in:
Kristian Rietveld 2009-09-20 15:27:14 +02:00
parent bfc88240b4
commit 3043155796
5 changed files with 60 additions and 12 deletions

View File

@ -72,6 +72,13 @@
if (NSEqualRects (rect, NSZeroRect))
return;
/* Clear our own bookkeeping of regions that need display */
if (impl->needs_display_region)
{
gdk_region_destroy (impl->needs_display_region);
impl->needs_display_region = NULL;
}
[self getRectsBeingDrawn:&drawn_rects count:&count];
/* Note: arbitrary limit here to not degrade performace too much. It would

View File

@ -29,6 +29,32 @@ _gdk_quartz_window_queue_translation (GdkWindow *window,
gint dx,
gint dy)
{
GdkWindowObject *private = (GdkWindowObject *)window;
GdkWindowImplQuartz *impl = (GdkWindowImplQuartz *)private->impl;
int i, n_rects;
GdkRegion *intersection;
GdkRectangle *rects;
/* We will intersect the known region that needs display with the given
* area. This intersection will be translated by dx, dy. For the end
* result, we will also set that it needs display.
*/
if (!impl->needs_display_region)
return;
intersection = gdk_region_copy (impl->needs_display_region);
gdk_region_intersect (intersection, area);
gdk_region_offset (intersection, dx, dy);
gdk_region_get_rectangles (intersection, &rects, &n_rects);
for (i = 0; i < n_rects; i++)
_gdk_quartz_window_set_needs_display_in_rect (window, &rects[i]);
g_free (rects);
gdk_region_destroy (intersection);
}
gboolean

View File

@ -149,6 +149,9 @@ void _gdk_quartz_window_did_resign_main (GdkWindow *window);
void _gdk_quartz_window_debug_highlight (GdkWindow *window,
gint number);
void _gdk_quartz_window_set_needs_display_in_rect (GdkWindow *window,
GdkRectangle *rect);
/* Events */
typedef enum {
GDK_QUARTZ_EVENT_SUBTYPE_EVENTLOOP

View File

@ -347,12 +347,30 @@ gdk_window_impl_quartz_end_paint (GdkPaintable *paintable)
}
}
void
_gdk_quartz_window_set_needs_display_in_rect (GdkWindow *window,
GdkRectangle *rect)
{
GdkWindowObject *private;
GdkWindowImplQuartz *impl;
private = GDK_WINDOW_OBJECT (window);
impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
if (!impl->needs_display_region)
impl->needs_display_region = gdk_region_new ();
gdk_region_union_with_rect (impl->needs_display_region, rect);
[impl->view setNeedsDisplayInRect:NSMakeRect (rect->x, rect->y,
rect->width, rect->height)];
}
void
_gdk_windowing_window_process_updates_recurse (GdkWindow *window,
GdkRegion *region)
{
GdkWindowObject *private = (GdkWindowObject *)window;
GdkWindowImplQuartz *impl = (GdkWindowImplQuartz *)private->impl;
int i, n_rects;
GdkRectangle *rects;
@ -389,10 +407,7 @@ _gdk_windowing_window_process_updates_recurse (GdkWindow *window,
gdk_region_get_rectangles (region, &rects, &n_rects);
for (i = 0; i < n_rects; i++)
{
[impl->view setNeedsDisplayInRect:NSMakeRect (rects[i].x, rects[i].y,
rects[i].width, rects[i].height)];
}
_gdk_quartz_window_set_needs_display_in_rect (window, &rects[i]);
g_free (rects);
@ -1294,12 +1309,7 @@ move_resize_window_internal (GdkWindow *window,
gdk_region_get_rectangles (expose_region, &rects, &n_rects);
for (n = 0; n < n_rects; ++n)
{
[impl->view setNeedsDisplayInRect:NSMakeRect (rects[n].x,
rects[n].y,
rects[n].width,
rects[n].height)];
}
_gdk_quartz_window_set_needs_display_in_rect (window, &rects[n]);
g_free (rects);
}

View File

@ -59,6 +59,8 @@ struct _GdkWindowImplQuartz
/* Sorted by z-order */
GList *sorted_children;
GdkRegion *needs_display_region;
};
struct _GdkWindowImplQuartzClass