1 /* GDK - The GIMP Drawing Kit
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
21 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
22 * file for a list of people on the GTK+ Team.
26 * GTK+ DirectFB backend
27 * Copyright (C) 2001-2002 convergence integrated media GmbH
28 * Copyright (C) 2002-2004 convergence GmbH
29 * Written by Denis Oliver Kropp <dok@convergence.de> and
30 * Sven Neumann <sven@convergence.de>
34 #include "gdk.h" /* For gdk_rectangle_intersect */
36 #include "gdkdirectfb.h"
37 #include "gdkprivate-directfb.h"
39 #include "gdkinternals.h"
44 _gdk_windowing_window_get_offsets (GdkWindow *window,
55 _gdk_windowing_window_queue_antiexpose (GdkWindow *window,
63 * @window: a #GdkWindow
64 * @dx: Amount to scroll in the X direction
65 * @dy: Amount to scroll in the Y direction
67 * Scroll the contents of its window, both pixels and children, by
68 * the given amount. Portions of the window that the scroll operation
69 * brings in from offscreen areas are invalidated.
72 gdk_window_scroll (GdkWindow *window,
76 GdkWindowObject *private;
77 GdkDrawableImplDirectFB *impl;
78 GdkRegion *invalidate_region = NULL;
81 g_return_if_fail (GDK_IS_WINDOW (window));
83 if (GDK_WINDOW_DESTROYED (window))
86 private = GDK_WINDOW_OBJECT (window);
87 impl = GDK_DRAWABLE_IMPL_DIRECTFB (private->impl);
89 if (dx == 0 && dy == 0)
92 /* Move the current invalid region */
93 if (private->update_area)
94 gdk_region_offset (private->update_area, dx, dy);
96 if (GDK_WINDOW_IS_MAPPED (window))
98 GdkRectangle clip_rect = { 0, 0, impl->width, impl->height };
99 GdkRectangle rect = { dx, dy, impl->width, impl->height };
101 invalidate_region = gdk_region_rectangle (&clip_rect);
103 if (gdk_rectangle_intersect (&rect, &clip_rect, &rect) &&
104 (!private->update_area ||
105 !gdk_region_rect_in (private->update_area, &rect)))
109 region = gdk_region_rectangle (&rect);
110 gdk_region_subtract (invalidate_region, region);
111 gdk_region_destroy (region);
115 DFBRegion update = { rect.x, rect.y,
116 rect.x + rect.width - 1,
117 rect.y + rect.height - 1 };
119 impl->surface->SetClip (impl->surface, &update);
120 impl->surface->Blit (impl->surface, impl->surface, NULL, dx, dy);
121 impl->surface->SetClip (impl->surface, NULL);
122 impl->surface->Flip(impl->surface,&update,0);
127 for (list = private->children; list; list = list->next)
129 GdkWindowObject *obj = GDK_WINDOW_OBJECT (list->data);
130 GdkDrawableImplDirectFB *obj_impl = GDK_DRAWABLE_IMPL_DIRECTFB (obj->impl);
132 _gdk_directfb_move_resize_child (list->data,
139 _gdk_directfb_calc_abs (window);
141 if (invalidate_region)
143 gdk_window_invalidate_region (window, invalidate_region, TRUE);
144 gdk_region_destroy (invalidate_region);
149 * gdk_window_move_region:
150 * @window: a #GdkWindow
151 * @region: The #GdkRegion to move
152 * @dx: Amount to move in the X direction
153 * @dy: Amount to move in the Y direction
155 * Move the part of @window indicated by @region by @dy pixels in the Y
156 * direction and @dx pixels in the X direction. The portions of @region
157 * that not covered by the new position of @region are invalidated.
159 * Child windows are not moved.
164 gdk_window_move_region (GdkWindow *window,
169 GdkWindowObject *private;
170 GdkDrawableImplDirectFB *impl;
171 GdkRegion *window_clip;
172 GdkRegion *src_region;
173 GdkRegion *brought_in;
174 GdkRegion *dest_region;
175 GdkRegion *moving_invalid_region;
176 GdkRectangle dest_extents;
178 g_return_if_fail (GDK_IS_WINDOW (window));
179 g_return_if_fail (region != NULL);
181 if (GDK_WINDOW_DESTROYED (window))
184 private = GDK_WINDOW_OBJECT (window);
185 impl = GDK_DRAWABLE_IMPL_DIRECTFB (private->impl);
187 if (dx == 0 && dy == 0)
190 GdkRectangle clip_rect = { 0, 0, impl->width, impl->height };
191 window_clip = gdk_region_rectangle (&clip_rect);
193 /* compute source regions */
194 src_region = gdk_region_copy (region);
195 brought_in = gdk_region_copy (region);
196 gdk_region_intersect (src_region, window_clip);
198 gdk_region_subtract (brought_in, src_region);
199 gdk_region_offset (brought_in, dx, dy);
201 /* compute destination regions */
202 dest_region = gdk_region_copy (src_region);
203 gdk_region_offset (dest_region, dx, dy);
204 gdk_region_intersect (dest_region, window_clip);
205 gdk_region_get_clipbox (dest_region, &dest_extents);
207 gdk_region_destroy (window_clip);
209 /* calculating moving part of current invalid area */
210 moving_invalid_region = NULL;
211 if (private->update_area)
213 moving_invalid_region = gdk_region_copy (private->update_area);
214 gdk_region_intersect (moving_invalid_region, src_region);
215 gdk_region_offset (moving_invalid_region, dx, dy);
218 /* invalidate all of the src region */
219 gdk_window_invalidate_region (window, src_region, FALSE);
221 /* un-invalidate destination region */
222 if (private->update_area)
223 gdk_region_subtract (private->update_area, dest_region);
225 /* invalidate moving parts of existing update area */
226 if (moving_invalid_region)
228 gdk_window_invalidate_region (window, moving_invalid_region, FALSE);
229 gdk_region_destroy (moving_invalid_region);
232 /* invalidate area brought in from off-screen */
233 gdk_window_invalidate_region (window, brought_in, FALSE);
234 gdk_region_destroy (brought_in);
236 /* Actually do the moving */
239 DFBRectangle source = { dest_extents.x - dx,
242 dest_extents.height};
243 DFBRegion destination = { dest_extents.x,
245 dest_extents.x+dest_extents.width-1,
246 dest_extents.y+dest_extents.height-1};
248 impl->surface->SetClip (impl->surface, &destination);
249 impl->surface->Blit (impl->surface, impl->surface,&source,dx,dy);
250 impl->surface->SetClip (impl->surface, NULL);
251 impl->surface->Flip(impl->surface,&destination,0);
253 gdk_region_destroy (src_region);
254 gdk_region_destroy (dest_region);
257 #define __GDK_GEOMETRY_X11_C__
258 #include "gdkaliasdef.c"