1 /* gdkgeometry-quartz.c
3 * Copyright (C) 2005 Imendio AB
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
23 #include "gdkprivate-quartz.h"
26 gdk_window_scroll (GdkWindow *window,
30 NSRect visible_nsrect;
31 GdkRectangle visible_rect, scrolled_rect;
32 GdkRegion *visible_region, *scrolled_region;
35 GdkWindowObject *private = GDK_WINDOW_OBJECT (window);
36 GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
39 g_return_if_fail (GDK_IS_WINDOW (window));
41 visible_nsrect = [impl->view visibleRect];
43 visible_rect.x = visible_nsrect.origin.x;
44 visible_rect.y = visible_nsrect.origin.y;
45 visible_rect.width = visible_nsrect.size.width;
46 visible_rect.height = visible_nsrect.size.height;
48 scrolled_rect = visible_rect;
49 scrolled_rect.x += dx;
50 scrolled_rect.y += dy;
52 gdk_rectangle_intersect (&visible_rect, &scrolled_rect, &scrolled_rect);
54 visible_region = gdk_region_rectangle (&visible_rect);
55 scrolled_region = gdk_region_rectangle (&scrolled_rect);
57 gdk_region_subtract (visible_region, scrolled_region);
59 [impl->view scrollRect:[impl->view bounds] by:NSMakeSize(dx, dy)];
61 gdk_region_get_rectangles (visible_region, &rects, &n_rects);
62 for (i = 0; i < n_rects; i++)
63 [impl->view setNeedsDisplayInRect:NSMakeRect (rects[i].x, rects[i].y, rects[i].width, rects[i].height)];
67 gdk_region_destroy (visible_region);
68 gdk_region_destroy (scrolled_region);
70 /* Move child windows */
71 for (list = private->children; list; list = list->next)
73 GdkWindowObject *child = GDK_WINDOW_OBJECT (list->data);
75 gdk_window_move (list->data,
82 gdk_window_move_region (GdkWindow *window,
87 /* FIXME: Implement */