gdk: Make window moves a custom vfunc

The window move code needs special attention for multiple reasons:
- invalid areas for expose events need to be modified
- self-copy is not supported by Cairo
- in X11, copying from an overlapped Window might cause unexposed areas
  to be copied in, spo expose events for those need to be generated.

This was all special cased in various parts of the code. By making it an
explicit vfunc, we can work around it.
This commit is contained in:
Benjamin Otte
2010-07-21 20:37:33 +02:00
parent a581401920
commit 65ac54bb23
9 changed files with 133 additions and 99 deletions

View File

@ -22,34 +22,32 @@
#include "gdkprivate-quartz.h"
/* FIXME: Tis function has never been compiled.
* Please make it work. */
void
_gdk_quartz_window_queue_translation (GdkWindow *window,
GdkGC *gc,
cairo_region_t *area,
gint dx,
gint dy)
_gdk_quartz_window_translate (GdkWindow *window,
cairo_region_t *area,
gint dx,
gint dy)
{
GdkWindowObject *private = (GdkWindowObject *)window;
GdkWindowImplQuartz *impl = (GdkWindowImplQuartz *)private->impl;
GdkRectangle extents;
int i, n_rects;
cairo_region_t *intersection;
GdkRectangle rect;
cairo_region_get_extents (area, &extents);
/* 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.
*/
[window_impl->view scrollRect:NSMakeRect (extents.x, extents.y, extents.width, extents.height)
by:NSMakeSize (dx, dy)];
if (!impl->needs_display_region)
return;
if (impl->needs_display_region)
{
intersection = cairo_region_copy (impl->needs_display_region);
cairo_region_intersect_rectangle (intersection, extents);
cairo_region_translate (intersection, dx, dy);
intersection = cairo_region_copy (impl->needs_display_region);
cairo_region_intersect (intersection, area);
cairo_region_translate (intersection, dx, dy);
_gdk_quartz_window_set_needs_display_in_region (window, intersection);
cairo_region_destroy (intersection);
_gdk_quartz_window_set_needs_display_in_region (window, intersection);
cairo_region_destroy (intersection);
}
}
gboolean

View File

@ -3102,6 +3102,6 @@ gdk_window_impl_iface_init (GdkWindowImplIface *iface)
iface->input_shape_combine_region = gdk_window_quartz_input_shape_combine_region;
iface->set_static_gravities = gdk_window_quartz_set_static_gravities;
iface->queue_antiexpose = _gdk_quartz_window_queue_antiexpose;
iface->queue_translation = _gdk_quartz_window_queue_translation;
iface->translate = _gdk_quartz_window_translate;
iface->destroy = _gdk_quartz_window_destroy;
}