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.
22
#import "GdkQuartzView.h"
23
#include "gdkwindow-quartz.h"
24
#include "gdkprivate-quartz.h"
26
@implementation GdkQuartzView
28
-(void)setGdkWindow:(GdkWindow *)window
33
-(GdkWindow *)gdkWindow
45
/* A view is opaque if its GdkWindow doesn't have the RGBA colormap */
46
return gdk_drawable_get_colormap (gdk_window) != gdk_screen_get_rgba_colormap (_gdk_screen);
49
-(void)drawRect:(NSRect)rect
51
GdkRectangle gdk_rect;
52
GdkWindowObject *private = GDK_WINDOW_OBJECT (gdk_window);
53
GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
54
const NSRect *drawn_rects;
58
GDK_QUARTZ_ALLOC_POOL;
60
[self getRectsBeingDrawn:&drawn_rects count:&count];
62
region = gdk_region_new ();
64
for (i = 0; i < count; i++)
66
gdk_rect.x = drawn_rects[i].origin.x;
67
gdk_rect.y = drawn_rects[i].origin.y;
68
gdk_rect.width = drawn_rects[i].size.width;
69
gdk_rect.height = drawn_rects[i].size.height;
71
gdk_region_union_with_rect (region, &gdk_rect);
74
if (!gdk_region_empty (region) && private->event_mask & GDK_EXPOSURE_MASK)
78
gdk_rect.x = rect.origin.x;
79
gdk_rect.y = rect.origin.y;
80
gdk_rect.width = rect.size.width;
81
gdk_rect.height = rect.size.height;
83
event.expose.type = GDK_EXPOSE;
84
event.expose.window = g_object_ref (gdk_window);
85
event.expose.send_event = FALSE;
86
event.expose.count = 0;
87
event.expose.region = region;
88
event.expose.area = gdk_rect;
90
impl->in_paint_rect_count ++;
92
(*_gdk_event_func) (&event, _gdk_event_data);
94
impl->in_paint_rect_count --;
96
g_object_unref (gdk_window);
97
gdk_region_destroy (event.expose.region);
100
GDK_QUARTZ_RELEASE_POOL;