]> Pileus Git - ~andy/gtk/blob - gdk/directfb/gdkgeometry-directfb.c
Remove duplicate doc comments that cause problems when building the docs.
[~andy/gtk] / gdk / directfb / gdkgeometry-directfb.c
1 /* GDK - The GIMP Drawing Kit
2  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3  *
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.
8  *
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.
13  *
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.
18  */
19
20 /*
21  * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
22  * file for a list of people on the GTK+ Team.
23  */
24
25 /*
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>
31  */
32
33 #include "config.h"
34 #include "gdk.h"        /* For gdk_rectangle_intersect */
35
36 #include "gdkdirectfb.h"
37 #include "gdkprivate-directfb.h"
38
39 #include "gdkinternals.h"
40 #include "gdkalias.h"
41
42
43 void
44 _gdk_windowing_window_get_offsets (GdkWindow *window,
45                                    gint      *x_offset,
46                                    gint      *y_offset)
47 {
48   if (x_offset)
49     *x_offset = 0;
50   if (y_offset)
51     *y_offset = 0;
52 }
53
54 gboolean
55 _gdk_windowing_window_queue_antiexpose (GdkWindow *window,
56                                         GdkRegion *area)
57 {
58   return FALSE;
59 }
60
61 /**
62  * gdk_window_scroll:
63  * @window: a #GdkWindow
64  * @dx: Amount to scroll in the X direction
65  * @dy: Amount to scroll in the Y direction
66  *
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.
70  **/
71 void
72 gdk_window_scroll (GdkWindow *window,
73                    gint       dx,
74                    gint       dy)
75 {
76   GdkWindowObject         *private;
77   GdkDrawableImplDirectFB *impl;
78   GdkRegion               *invalidate_region = NULL;
79   GList                   *list;
80
81   g_return_if_fail (GDK_IS_WINDOW (window));
82
83   if (GDK_WINDOW_DESTROYED (window))
84     return;
85
86   private = GDK_WINDOW_OBJECT (window);
87   impl = GDK_DRAWABLE_IMPL_DIRECTFB (private->impl);
88
89   if (dx == 0 && dy == 0)
90     return;
91
92   /* Move the current invalid region */
93   if (private->update_area)
94     gdk_region_offset (private->update_area, dx, dy);
95
96   if (GDK_WINDOW_IS_MAPPED (window))
97     {
98       GdkRectangle  clip_rect = {  0,  0, impl->width, impl->height };
99       GdkRectangle  rect      = { dx, dy, impl->width, impl->height };
100
101       invalidate_region = gdk_region_rectangle (&clip_rect);
102
103       if (gdk_rectangle_intersect (&rect, &clip_rect, &rect) &&
104           (!private->update_area ||
105            !gdk_region_rect_in (private->update_area, &rect)))
106         {
107           GdkRegion *region;
108
109           region = gdk_region_rectangle (&rect);
110           gdk_region_subtract (invalidate_region, region);
111           gdk_region_destroy (region);
112
113           if (impl->surface)
114             {
115               DFBRegion update = { rect.x, rect.y,
116                                    rect.x + rect.width  - 1,
117                                    rect.y + rect.height - 1 };
118
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);
123             }
124         }
125     }
126
127   for (list = private->children; list; list = list->next)
128     {
129       GdkWindowObject         *obj      = GDK_WINDOW_OBJECT (list->data);
130       GdkDrawableImplDirectFB *obj_impl = GDK_DRAWABLE_IMPL_DIRECTFB (obj->impl);
131
132       _gdk_directfb_move_resize_child (list->data,
133                                        obj->x + dx,
134                                        obj->y + dy,
135                                        obj_impl->width,
136                                        obj_impl->height);
137     }
138
139   _gdk_directfb_calc_abs (window);
140
141   if (invalidate_region)
142     {
143       gdk_window_invalidate_region (window, invalidate_region, TRUE);
144       gdk_region_destroy (invalidate_region);
145     }
146 }
147
148 /**
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
154  * 
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.
158  * 
159  * Child windows are not moved.
160  * 
161  * Since: 2.8
162  **/
163 void
164 gdk_window_move_region (GdkWindow *window,
165                         GdkRegion *region,
166                         gint       dx,
167                         gint       dy)
168 {
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;
177   
178   g_return_if_fail (GDK_IS_WINDOW (window));
179   g_return_if_fail (region != NULL);
180   
181   if (GDK_WINDOW_DESTROYED (window))
182     return;
183   
184   private = GDK_WINDOW_OBJECT (window);
185   impl = GDK_DRAWABLE_IMPL_DIRECTFB (private->impl);  
186
187   if (dx == 0 && dy == 0)
188     return;
189
190   GdkRectangle  clip_rect = {  0,  0, impl->width, impl->height };
191   window_clip = gdk_region_rectangle (&clip_rect);
192
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);
197
198   gdk_region_subtract (brought_in, src_region);
199   gdk_region_offset (brought_in, dx, dy);
200
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);
206
207   gdk_region_destroy (window_clip);
208
209   /* calculating moving part of current invalid area */
210   moving_invalid_region = NULL;
211   if (private->update_area)
212     {
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);
216     }
217   
218   /* invalidate all of the src region */
219   gdk_window_invalidate_region (window, src_region, FALSE);
220
221   /* un-invalidate destination region */
222   if (private->update_area)
223     gdk_region_subtract (private->update_area, dest_region);
224   
225   /* invalidate moving parts of existing update area */
226   if (moving_invalid_region)
227     {
228       gdk_window_invalidate_region (window, moving_invalid_region, FALSE);
229       gdk_region_destroy (moving_invalid_region);
230     }
231
232   /* invalidate area brought in from off-screen */
233   gdk_window_invalidate_region (window, brought_in, FALSE);
234   gdk_region_destroy (brought_in);
235
236   /* Actually do the moving */
237         if (impl->surface)
238         {
239         DFBRectangle source = { dest_extents.x - dx, 
240                                             dest_extents.y - dy,
241                              dest_extents.width,
242                              dest_extents.height};
243         DFBRegion destination = { dest_extents.x, 
244                                                  dest_extents.y,
245                                  dest_extents.x+dest_extents.width-1,
246                                  dest_extents.y+dest_extents.height-1};
247
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);
252         }
253   gdk_region_destroy (src_region);
254   gdk_region_destroy (dest_region);
255 }
256
257 #define __GDK_GEOMETRY_X11_C__
258 #include "gdkaliasdef.c"