Just expose the minimal region instead of the whole rect.
2006-08-08 Richard Hult <richard@imendio.com> * gdk/quartz/GdkQuartzView.c: Just expose the minimal region instead of the whole rect. * gdk/quartz/gdkwindow-quartz.c: (gdk_window_quartz_process_all_updates), (gdk_window_update_idle), (gdk_window_impl_quartz_invalidate_maybe_recurse), (gdk_window_impl_quartz_process_updates), (_gdk_windowing_window_destroy): Rework the expose handling so that it works like the X11 backend, using an idle with the right priority instead of relying on quartz to do it. (gdk_window_set_type_hint): Use tornoff instead of submenu as the documentation (and Mitch) suggests.
This commit is contained in:
committed by
Richard Hult
parent
1aeea0dd15
commit
d3ee9f833a
15
ChangeLog
15
ChangeLog
@ -1,3 +1,18 @@
|
|||||||
|
2006-08-08 Richard Hult <richard@imendio.com>
|
||||||
|
|
||||||
|
* gdk/quartz/GdkQuartzView.c: Just expose the minimal region
|
||||||
|
instead of the whole rect.
|
||||||
|
|
||||||
|
* gdk/quartz/gdkwindow-quartz.c:
|
||||||
|
(gdk_window_quartz_process_all_updates), (gdk_window_update_idle),
|
||||||
|
(gdk_window_impl_quartz_invalidate_maybe_recurse),
|
||||||
|
(gdk_window_impl_quartz_process_updates),
|
||||||
|
(_gdk_windowing_window_destroy): Rework the expose handling so that
|
||||||
|
it works like the X11 backend, using an idle with the right
|
||||||
|
priority instead of relying on quartz to do it.
|
||||||
|
(gdk_window_set_type_hint): Use tornoff instead of submenu as the
|
||||||
|
documentation (and Mitch) suggests.
|
||||||
|
|
||||||
2006-08-08 Michael Natterer <mitch@imendio.com>
|
2006-08-08 Michael Natterer <mitch@imendio.com>
|
||||||
|
|
||||||
* gdk/quartz/gdkdrawable-quartz.c: some whitespace and indentation
|
* gdk/quartz/gdkdrawable-quartz.c: some whitespace and indentation
|
||||||
|
|||||||
@ -1,3 +1,18 @@
|
|||||||
|
2006-08-08 Richard Hult <richard@imendio.com>
|
||||||
|
|
||||||
|
* gdk/quartz/GdkQuartzView.c: Just expose the minimal region
|
||||||
|
instead of the whole rect.
|
||||||
|
|
||||||
|
* gdk/quartz/gdkwindow-quartz.c:
|
||||||
|
(gdk_window_quartz_process_all_updates), (gdk_window_update_idle),
|
||||||
|
(gdk_window_impl_quartz_invalidate_maybe_recurse),
|
||||||
|
(gdk_window_impl_quartz_process_updates),
|
||||||
|
(_gdk_windowing_window_destroy): Rework the expose handling so that
|
||||||
|
it works like the X11 backend, using an idle with the right
|
||||||
|
priority instead of relying on quartz to do it.
|
||||||
|
(gdk_window_set_type_hint): Use tornoff instead of submenu as the
|
||||||
|
documentation (and Mitch) suggests.
|
||||||
|
|
||||||
2006-08-08 Michael Natterer <mitch@imendio.com>
|
2006-08-08 Michael Natterer <mitch@imendio.com>
|
||||||
|
|
||||||
* gdk/quartz/gdkdrawable-quartz.c: some whitespace and indentation
|
* gdk/quartz/gdkdrawable-quartz.c: some whitespace and indentation
|
||||||
|
|||||||
@ -51,23 +51,40 @@
|
|||||||
GdkRectangle gdk_rect;
|
GdkRectangle gdk_rect;
|
||||||
GdkWindowObject *private = GDK_WINDOW_OBJECT (gdk_window);
|
GdkWindowObject *private = GDK_WINDOW_OBJECT (gdk_window);
|
||||||
GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
|
GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
|
||||||
|
const NSRect *drawn_rects;
|
||||||
|
int count, i;
|
||||||
|
GdkRegion *region;
|
||||||
|
|
||||||
GDK_QUARTZ_ALLOC_POOL;
|
GDK_QUARTZ_ALLOC_POOL;
|
||||||
|
|
||||||
|
[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);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!gdk_region_empty (region) && private->event_mask & GDK_EXPOSURE_MASK)
|
||||||
|
{
|
||||||
|
GdkEvent event;
|
||||||
|
|
||||||
gdk_rect.x = rect.origin.x;
|
gdk_rect.x = rect.origin.x;
|
||||||
gdk_rect.y = rect.origin.y;
|
gdk_rect.y = rect.origin.y;
|
||||||
gdk_rect.width = rect.size.width;
|
gdk_rect.width = rect.size.width;
|
||||||
gdk_rect.height = rect.size.height;
|
gdk_rect.height = rect.size.height;
|
||||||
|
|
||||||
if (private->event_mask & GDK_EXPOSURE_MASK)
|
|
||||||
{
|
|
||||||
GdkEvent event;
|
|
||||||
|
|
||||||
event.expose.type = GDK_EXPOSE;
|
event.expose.type = GDK_EXPOSE;
|
||||||
event.expose.window = g_object_ref (gdk_window);
|
event.expose.window = g_object_ref (gdk_window);
|
||||||
event.expose.send_event = FALSE;
|
event.expose.send_event = FALSE;
|
||||||
event.expose.count = 0;
|
event.expose.count = 0;
|
||||||
event.expose.region = gdk_region_rectangle (&gdk_rect);
|
event.expose.region = region;
|
||||||
event.expose.area = gdk_rect;
|
event.expose.area = gdk_rect;
|
||||||
|
|
||||||
impl->in_paint_rect_count ++;
|
impl->in_paint_rect_count ++;
|
||||||
|
|||||||
@ -26,6 +26,10 @@
|
|||||||
|
|
||||||
static gpointer parent_class;
|
static gpointer parent_class;
|
||||||
|
|
||||||
|
static GSList *update_windows = NULL;
|
||||||
|
static guint update_idle = 0;
|
||||||
|
|
||||||
|
|
||||||
NSView *
|
NSView *
|
||||||
gdk_quartz_window_get_nsview (GdkWindow *window)
|
gdk_quartz_window_get_nsview (GdkWindow *window)
|
||||||
{
|
{
|
||||||
@ -242,16 +246,29 @@ gdk_window_impl_quartz_end_paint (GdkPaintable *paintable)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gdk_window_impl_quartz_invalidate_maybe_recurse (GdkPaintable *paintable,
|
gdk_window_quartz_process_all_updates (void)
|
||||||
GdkRegion *region,
|
|
||||||
gboolean (*child_func) (GdkWindow *, gpointer),
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
{
|
||||||
GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (paintable);
|
GSList *old_update_windows = update_windows;
|
||||||
|
GSList *tmp_list = update_windows;
|
||||||
|
|
||||||
|
update_idle = 0;
|
||||||
|
update_windows = NULL;
|
||||||
|
|
||||||
|
g_slist_foreach (old_update_windows, (GFunc) g_object_ref, NULL);
|
||||||
|
|
||||||
|
while (tmp_list)
|
||||||
|
{
|
||||||
|
GdkWindowObject *private = tmp_list->data;
|
||||||
|
GdkWindowImplQuartz *impl = (GdkWindowImplQuartz *) private->impl;
|
||||||
int i, n_rects;
|
int i, n_rects;
|
||||||
GdkRectangle *rects;
|
GdkRectangle *rects;
|
||||||
|
|
||||||
gdk_region_get_rectangles (region, &rects, &n_rects);
|
if (private->update_area)
|
||||||
|
{
|
||||||
|
gdk_region_get_rectangles (private->update_area, &rects, &n_rects);
|
||||||
|
|
||||||
|
gdk_region_destroy (private->update_area);
|
||||||
|
private->update_area = NULL;
|
||||||
|
|
||||||
for (i = 0; i < n_rects; i++)
|
for (i = 0; i < n_rects; i++)
|
||||||
{
|
{
|
||||||
@ -259,9 +276,57 @@ gdk_window_impl_quartz_invalidate_maybe_recurse (GdkPaintable *paintable,
|
|||||||
rects[i].width, rects[i].height)];
|
rects[i].width, rects[i].height)];
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (rects);
|
[impl->view displayIfNeeded];
|
||||||
|
|
||||||
/* FIXME: Check if we need to traverse the children */
|
g_free (rects);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_object_unref (tmp_list->data);
|
||||||
|
tmp_list = tmp_list->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_slist_free (old_update_windows);
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gdk_window_update_idle (gpointer data)
|
||||||
|
{
|
||||||
|
GDK_THREADS_ENTER ();
|
||||||
|
gdk_window_quartz_process_all_updates ();
|
||||||
|
GDK_THREADS_LEAVE ();
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gdk_window_impl_quartz_invalidate_maybe_recurse (GdkPaintable *paintable,
|
||||||
|
GdkRegion *region,
|
||||||
|
gboolean (*child_func) (GdkWindow *, gpointer),
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
GdkWindowImplQuartz *window_impl = GDK_WINDOW_IMPL_QUARTZ (paintable);
|
||||||
|
GdkDrawableImplQuartz *drawable_impl = (GdkDrawableImplQuartz *) window_impl;
|
||||||
|
GdkWindow *window = (GdkWindow *) drawable_impl->wrapper;
|
||||||
|
GdkWindowObject *private = (GdkWindowObject *) window;
|
||||||
|
GdkRegion *visible_region;
|
||||||
|
|
||||||
|
visible_region = gdk_drawable_get_visible_region (window);
|
||||||
|
gdk_region_intersect (visible_region, region);
|
||||||
|
|
||||||
|
if (private->update_area)
|
||||||
|
{
|
||||||
|
gdk_region_union (private->update_area, visible_region);
|
||||||
|
gdk_region_destroy (visible_region);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
update_windows = g_slist_prepend (update_windows, window);
|
||||||
|
private->update_area = visible_region;
|
||||||
|
|
||||||
|
if (update_idle == 0)
|
||||||
|
update_idle = g_idle_add_full (GDK_PRIORITY_REDRAW,
|
||||||
|
gdk_window_update_idle, NULL, NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -269,10 +334,17 @@ gdk_window_impl_quartz_process_updates (GdkPaintable *paintable,
|
|||||||
gboolean update_children)
|
gboolean update_children)
|
||||||
{
|
{
|
||||||
GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (paintable);
|
GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (paintable);
|
||||||
|
GdkDrawableImplQuartz *drawable_impl = (GdkDrawableImplQuartz *) impl;
|
||||||
|
GdkWindowObject *private = (GdkWindowObject *) drawable_impl->wrapper;
|
||||||
|
|
||||||
[impl->view display];
|
if (private->update_area)
|
||||||
|
{
|
||||||
|
gdk_region_destroy (private->update_area);
|
||||||
|
private->update_area = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* FIXME: Check if display actually updates the children too */
|
[impl->view setNeedsDisplay: YES];
|
||||||
|
update_windows = g_slist_remove (update_windows, private);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -285,7 +357,6 @@ gdk_window_impl_quartz_paintable_init (GdkPaintableIface *iface)
|
|||||||
iface->process_updates = gdk_window_impl_quartz_process_updates;
|
iface->process_updates = gdk_window_impl_quartz_process_updates;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GType
|
GType
|
||||||
_gdk_window_impl_quartz_get_type (void)
|
_gdk_window_impl_quartz_get_type (void)
|
||||||
{
|
{
|
||||||
@ -642,7 +713,9 @@ _gdk_windowing_window_destroy (GdkWindow *window,
|
|||||||
gboolean recursing,
|
gboolean recursing,
|
||||||
gboolean foreign_destroy)
|
gboolean foreign_destroy)
|
||||||
{
|
{
|
||||||
if (!recursing && ! foreign_destroy)
|
update_windows = g_slist_remove (update_windows, window);
|
||||||
|
|
||||||
|
if (!recursing && !foreign_destroy)
|
||||||
{
|
{
|
||||||
GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (window)->impl);
|
GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (window)->impl);
|
||||||
|
|
||||||
@ -655,7 +728,6 @@ _gdk_windowing_window_destroy (GdkWindow *window,
|
|||||||
[impl->toplevel close];
|
[impl->toplevel close];
|
||||||
else if (impl->view)
|
else if (impl->view)
|
||||||
[impl->view release];
|
[impl->view release];
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1449,7 +1521,7 @@ gdk_window_set_type_hint (GdkWindow *window,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case GDK_WINDOW_TYPE_HINT_DROPDOWN_MENU: /* Menu from menubar */
|
case GDK_WINDOW_TYPE_HINT_DROPDOWN_MENU: /* Menu from menubar */
|
||||||
level = NSSubmenuWindowLevel;
|
level = NSTornOffMenuWindowLevel;
|
||||||
shadow = TRUE;
|
shadow = TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user