[gtk+] Bug 550939 - GtkFileChooser listbox does not refresh selection
- From: Kristian Rietveld <kristian src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gtk+] Bug 550939 - GtkFileChooser listbox does not refresh selection
- Date: Mon, 21 Sep 2009 18:47:38 +0000 (UTC)
commit 3043155796b8685ae505917d691818047833f9a2
Author: Kristian Rietveld <kris gtk org>
Date: Sun Sep 20 15:27:14 2009 +0200
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.
gdk/quartz/GdkQuartzView.c | 7 +++++++
gdk/quartz/gdkgeometry-quartz.c | 26 ++++++++++++++++++++++++++
gdk/quartz/gdkprivate-quartz.h | 3 +++
gdk/quartz/gdkwindow-quartz.c | 34 ++++++++++++++++++++++------------
gdk/quartz/gdkwindow-quartz.h | 2 ++
5 files changed, 60 insertions(+), 12 deletions(-)
---
diff --git a/gdk/quartz/GdkQuartzView.c b/gdk/quartz/GdkQuartzView.c
index 761b07f..5d643eb 100644
--- a/gdk/quartz/GdkQuartzView.c
+++ b/gdk/quartz/GdkQuartzView.c
@@ -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
diff --git a/gdk/quartz/gdkgeometry-quartz.c b/gdk/quartz/gdkgeometry-quartz.c
index 3e0a26f..06a31f1 100644
--- a/gdk/quartz/gdkgeometry-quartz.c
+++ b/gdk/quartz/gdkgeometry-quartz.c
@@ -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
diff --git a/gdk/quartz/gdkprivate-quartz.h b/gdk/quartz/gdkprivate-quartz.h
index 2152b6e..52834b3 100644
--- a/gdk/quartz/gdkprivate-quartz.h
+++ b/gdk/quartz/gdkprivate-quartz.h
@@ -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
diff --git a/gdk/quartz/gdkwindow-quartz.c b/gdk/quartz/gdkwindow-quartz.c
index a7aaf91..bbff7fb 100644
--- a/gdk/quartz/gdkwindow-quartz.c
+++ b/gdk/quartz/gdkwindow-quartz.c
@@ -348,11 +348,29 @@ 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);
}
diff --git a/gdk/quartz/gdkwindow-quartz.h b/gdk/quartz/gdkwindow-quartz.h
index 89f2ec0..8d47512 100644
--- a/gdk/quartz/gdkwindow-quartz.h
+++ b/gdk/quartz/gdkwindow-quartz.h
@@ -59,6 +59,8 @@ struct _GdkWindowImplQuartz
/* Sorted by z-order */
GList *sorted_children;
+
+ GdkRegion *needs_display_region;
};
struct _GdkWindowImplQuartzClass
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]