1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <title>Use GdkEventExpose.region</title>
6 <meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
7 <link rel="home" href="index.html" title="GTK+ 3 Reference Manual">
8 <link rel="up" href="gtk-migrating-checklist.html" title="Migration Details Checklist">
9 <link rel="prev" href="gtk-migrating-checklist.html" title="Migration Details Checklist">
10 <link rel="next" href="checklist-modifiers.html" title="Test for modifier keys correctly">
11 <meta name="generator" content="GTK-Doc V1.18 (XML mode)">
12 <link rel="stylesheet" href="style.css" type="text/css">
14 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
15 <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
16 <td><a accesskey="p" href="gtk-migrating-checklist.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
17 <td><a accesskey="u" href="gtk-migrating-checklist.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
18 <td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
19 <th width="100%" align="center">GTK+ 3 Reference Manual</th>
20 <td><a accesskey="n" href="checklist-modifiers.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
23 <div class="titlepage"><div><div><h2 class="title" style="clear: both">
24 <a name="checklist-gdkeventexpose-region"></a>Use GdkEventExpose.region</h2></div></div></div>
26 The <em class="structfield"><code>region</code></em> field of
27 <span class="structname">GdkEventExpose</span> allows you to redraw
28 less than the traditional <em class="structfield"><code>GdkEventRegion.area</code></em>.
31 In early GTK+ versions, the <span class="structname">GdkEventExpose</span>
32 structure only had an <em class="structfield"><code>area</code></em> field to
33 let you determine the region that you needed to redraw. In current
34 GTK+, this field still exists for compatibility and as a simple
35 interface. However, there is also a <em class="structfield"><code>region</code></em>
36 field which contains a fine-grained region. The
37 <em class="structfield"><code>area</code></em> field is simply the bounding rectangle
38 of the <em class="structfield"><code>region</code></em>.
41 Widgets that are very expensive to re-render, such as an image
42 editor, may prefer to use the
43 <em class="structfield"><code>GdkEventExpose.region</code></em> field to paint
44 as little as possible. Widgets that just use a few drawing
45 primitives, such as labels and buttons, may prefer to use the
46 traditional <em class="structfield"><code>GdkEventExpose.area</code></em> field
50 Regions have an internal representation that is accessible as a
51 list of rectangles. To turn the
52 <em class="structfield"><code>GdkEventExpose.region</code></em> field into such
53 a list, use <code class="function">gdk_region_get_rectangles()</code>:
55 <a name="gdkregion-get-rectangles"></a><pre class="programlisting">
57 my_widget_expose_event_handler (GtkWidget *widget, GdkEventExpose *event)
63 gdk_region_get_rectangles (event->region, &rects, &n_rects);
65 for (i = 0; i < n_rects; i++)
67 /* Repaint rectangle: (rects[i].x, rects[i].y),
68 * (rects[i].width, rects[i].height)
80 Generated by GTK-Doc V1.18</div>