1
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
4
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
5
<title>Changes from 1.0 to 1.2</title>
6
<meta name="generator" content="DocBook XSL Stylesheets V1.72.0">
7
<link rel="start" href="index.html" title="GTK+ Reference Manual">
8
<link rel="up" href="migrating.html" title="Part IV. Migrating from Previous Versions of GTK+">
9
<link rel="prev" href="checklist-named-icons.html" title="Use named icons">
10
<link rel="next" href="gtk-changes-2-0.html" title="Changes from 1.2 to 2.0">
11
<meta name="generator" content="GTK-Doc V1.7 (XML mode)">
12
<link rel="stylesheet" href="style.css" type="text/css">
13
<link rel="part" href="gtk.html" title="Part I. GTK+ Overview">
14
<link rel="part" href="gtkbase.html" title="Part II. GTK+ Core Reference">
15
<link rel="part" href="gtkobjects.html" title="Part III. GTK+ Widgets and Objects">
16
<link rel="chapter" href="ch01.html" title="Object Hierarchy">
17
<link rel="chapter" href="ch02.html" title="Widget Gallery">
18
<link rel="chapter" href="WindowWidgets.html" title="Windows">
19
<link rel="chapter" href="DisplayWidgets.html" title="Display Widgets">
20
<link rel="chapter" href="ButtonWidgets.html" title="Buttons and Toggles">
21
<link rel="chapter" href="NumericEntry.html" title="Numeric/Text Data Entry">
22
<link rel="chapter" href="TextWidgetObjects.html" title="Multiline Text Editor">
23
<link rel="chapter" href="TreeWidgetObjects.html" title="Tree, List and Icon Grid Widgets">
24
<link rel="chapter" href="MenusAndCombos.html" title="Menus, Combo Box, Toolbar">
25
<link rel="chapter" href="Actions.html" title="Action-based menus and toolbars">
26
<link rel="chapter" href="SelectorWidgets.html" title="Selectors (File/Font/Color/Input Devices)">
27
<link rel="chapter" href="LayoutContainers.html" title="Layout Containers">
28
<link rel="chapter" href="Ornaments.html" title="Ornaments">
29
<link rel="chapter" href="ScrollingWidgets.html" title="Scrolling">
30
<link rel="chapter" href="Printing.html" title="Printing">
31
<link rel="chapter" href="MiscObjects.html" title="Miscellaneous">
32
<link rel="chapter" href="AbstractObjects.html" title="Abstract Base Classes">
33
<link rel="chapter" href="PlugSocket.html" title="Cross-process Embedding">
34
<link rel="chapter" href="SpecialObjects.html" title="Special-purpose features">
35
<link rel="chapter" href="RecentDocuments.html" title="Recently Used Documents">
36
<link rel="chapter" href="DeprecatedObjects.html" title="Deprecated">
37
<link rel="part" href="migrating.html" title="Part IV. Migrating from Previous Versions of GTK+">
38
<link rel="chapter" href="gtk-migrating-checklist.html" title="Migration Checklist">
39
<link rel="chapter" href="gtk-migrating-GtkFileChooser.html" title="Migrating from GtkFileSelection to GtkFileChooser">
40
<link rel="chapter" href="gtk-migrating-GtkAction.html" title="Migrating from old menu and toolbar systems to GtkAction">
41
<link rel="chapter" href="gtk-migrating-GtkComboBox.html" title="Migrating from GtkOptionMenu and GtkCombo to GtkComboBox and GtkComboBoxEntry">
42
<link rel="chapter" href="gtk-migrating-GtkIconView.html" title="Migrating from GnomeIconList to GtkIconView">
43
<link rel="chapter" href="gtk-migrating-GtkAboutDialog.html" title="Migrating from GnomeAbout to GtkAboutDialog">
44
<link rel="chapter" href="gtk-migrating-GtkColorButton.html" title="Migrating from GnomeColorPicker to GtkColorButton">
45
<link rel="chapter" href="gtk-migrating-GtkAssistant.html" title="Migrating from GnomeDruid to GtkAssistant">
46
<link rel="chapter" href="gtk-migrating-GtkRecentChooser.html" title="Migrating from EggRecent to GtkRecentChooser">
47
<link rel="chapter" href="gtk-migrating-GtkLinkButton.html" title="Migrating from GnomeHRef to GtkLinkButton">
48
<link rel="part" href="pt05.html" title="Part V. GTK+ Tools">
49
<link rel="glossary" href="glossary.html" title="Glossary">
50
<link rel="index" href="ix01.html" title="Index">
51
<link rel="index" href="ix02.html" title="Index of deprecated symbols">
52
<link rel="index" href="ix03.html" title="Index of new symbols in 2.2">
53
<link rel="index" href="ix04.html" title="Index of new symbols in 2.4">
54
<link rel="index" href="ix05.html" title="Index of new symbols in 2.6">
55
<link rel="index" href="ix06.html" title="Index of new symbols in 2.8">
56
<link rel="index" href="ix07.html" title="Index of new symbols in 2.10">
58
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
59
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
60
<td><a accesskey="p" href="checklist-named-icons.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
61
<td><a accesskey="u" href="migrating.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
62
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
63
<th width="100%" align="center">GTK+ Reference Manual</th>
64
<td><a accesskey="n" href="gtk-changes-2-0.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
66
<div class="refentry" lang="en">
67
<a name="gtk-changes-1-2"></a><div class="titlepage"></div>
68
<div class="refnamediv"><table width="100%"><tr>
70
<h2><span class="refentrytitle">Changes from 1.0 to 1.2</span></h2>
71
<p>Changes from 1.0 to 1.2 —
72
Incompatible changes made between version 1.0 and version 1.2
75
<td valign="top" align="right"></td>
77
<div class="refsect1" lang="en">
78
<a name="id4005488"></a><h2>Incompatible changes from 1.0 to 1.2</h2>
79
<div class="itemizedlist"><ul type="disc">
81
<span class="structname">GtkAcceleratorTable</span> has been replaced with
82
<span class="structname">GtkAccelGroup</span>.
85
<span class="structname">GtkMenuFactory</span> has been replaced with
86
<span class="structname">GtkItemFactory</span>, although
87
a version of <span class="structname">GtkMenuFactory</span> is currently still
88
provided to ease the migration phase.
92
The <span class="structname">GtkTypeInfo</span> structures used in the
93
<code class="function">gtk_*_type_init()</code> functions have
94
changed a bit, the old format:
96
<pre class="programlisting">
97
GtkTypeInfo bin_info =
101
sizeof (GtkBinClass),
102
(GtkClassInitFunc) gtk_bin_class_init,
103
(GtkObjectInitFunc) gtk_bin_init,
104
(GtkArgSetFunc) NULL,
105
(GtkArgGetFunc) NULL,
110
needs to be converted to:
113
<pre class="programlisting">
114
static const GtkTypeInfo bin_info =
118
sizeof (GtkBinClass),
119
(GtkClassInitFunc) gtk_bin_class_init,
120
(GtkObjectInitFunc) gtk_bin_init,
121
/* reserved_1 */ NULL,
122
/* reserved_2 */ NULL,
123
(GtkClassInitFunc) NULL,
128
the <code class="function">GtkArgSetFunc</code> and <code class="function">GtkArgGetFunc</code>
129
functions are not supported from the type system anymore, and you should make
130
sure that your code only fills in these fields with <code class="literal">NULL</code>
131
and doesn't use the deprecated function typedefs
132
<code class="literal">(GtkArgSetFunc)</code> and <code class="literal">(GtkArgGetFunc)</code>
138
A number of GTK+ functions were renamed. For compatibility,
139
<code class="filename">gtkcompat.h</code> #define's the old 1.0.x function names in
140
terms of the new names. To assure your GTK+ program doesn't rely on outdated
141
function variants, compile your program with
142
<code class="option">-DGTK_DISABLE_COMPAT_H</code> to disable
143
the compatibility aliases.
145
Here is the list of the old names and replacements:
148
<div class="informaltable"><table border="1">
159
<td><code class="function">gtk_accel_label_accelerator_width</code></td>
160
<td><code class="function">gtk_accel_label_get_accel_width</code></td>
163
<td><code class="function">gtk_check_menu_item_set_state</code></td>
164
<td><code class="function">gtk_check_menu_item_set_active</code></td>
167
<td><code class="function">gtk_container_border_width</code></td>
168
<td><code class="function">gtk_container_set_border_width</code></td>
171
<td><code class="function">gtk_label_set</code></td>
172
<td><code class="function">gtk_label_set_text</code></td>
175
<td><code class="function">gtk_notebook_current_page</code></td>
176
<td><code class="function">gtk_notebook_get_current_page</code></td>
179
<td><code class="function">gtk_packer_configure</code></td>
180
<td><code class="function">gtk_packer_set_child_packing</code></td>
183
<td><code class="function">gtk_paned_gutter_size</code></td>
184
<td><code class="function">gtk_paned_set_gutter_size</code></td>
187
<td><code class="function">gtk_paned_handle_size</code></td>
188
<td><code class="function">gtk_paned_set_handle_size</code></td>
191
<td><code class="function">gtk_scale_value_width</code></td>
192
<td><code class="function">gtk_scale_get_value_width</code></td>
195
<td><code class="function">gtk_style_apply_default_pixmap</code></td>
196
<td><code class="function">gtk_style_apply_default_background</code></td>
199
<td><code class="function">gtk_toggle_button_set_state</code></td>
200
<td><code class="function">gtk_toggle_button_set_active</code></td>
203
<td><code class="function">gtk_window_position</code></td>
204
<td><code class="function">gtk_window_set_position</code></td>
209
Note that <code class="function">gtk_style_apply_default_background()</code> has an
210
additional argument, <code class="literal">set_bg</code>. This parameter should be
211
<code class="literal">FALSE</code> if the background is being set for a
212
<code class="literal">NO_WINDOW</code> widget, otherwise <code class="literal">TRUE</code>.
217
During the development phase of the 1.1.x line of GTK+ certain functions
218
were deprecated and later removed. Functions affected are:
221
<div class="informaltable"><table border="1">
232
<td><code class="function">gtk_clist_set_border</code></td>
233
<td><code class="function">gtk_clist_set_shadow_type</code></td>
236
<td><code class="function">gtk_container_block_resize</code></td>
237
<td><code class="function">gtk_container_set_resize_mode</code></td>
240
<td><code class="function">gtk_container_unblock_resize</code></td>
241
<td><code class="function">gtk_container_set_resize_mode</code></td>
244
<td><code class="function">gtk_container_need_resize</code></td>
245
<td><code class="function">gtk_container_check_resize</code></td>
248
<td><code class="function">gtk_ctree_show_stub</code></td>
249
<td><code class="function">gtk_ctree_set_show_stub</code></td>
252
<td><code class="function">gtk_ctree_set_reorderable</code></td>
253
<td><code class="function">gtk_clist_set_reorderable</code></td>
256
<td><code class="function">gtk_ctree_set_use_drag_icons</code></td>
257
<td><code class="function">gtk_clist_set_use_drag_icons</code></td>
260
<td><code class="function">gtk_entry_adjust_scroll</code></td>
261
<td><code class="function">-</code></td>
264
<td><code class="function">gtk_object_class_add_user_signal</code></td>
265
<td><code class="function">gtk_object_class_user_signal_new</code></td>
268
<td><code class="function">gtk_preview_put_row</code></td>
269
<td><code class="function">gtk_preview_put</code></td>
272
<td><code class="function">gtk_progress_bar_construct</code></td>
273
<td><code class="function">gtk_progress_set_adjustment</code></td>
276
<td><code class="function">gtk_scrolled_window_construct</code></td>
277
<td><code class="function">gtk_scrolled_window_set_{h|v}adjustment</code></td>
280
<td><code class="function">gtk_spin_button_construct</code></td>
281
<td><code class="function">gtk_spin_button_configure</code></td>
284
<td><code class="function">gtk_widget_thaw_accelerators</code></td>
285
<td><code class="function">gtk_widget_unlock_accelerators</code></td>
288
<td><code class="function">gtk_widget_freeze_accelerators</code></td>
289
<td><code class="function">gtk_widget_lock_accelerators</code></td>
295
Note that <code class="function">gtk_entry_adjust_scroll()</code> is no longer needed
296
as <span class="structname">GtkEntry</span> should automatically keep the scroll
301
Additionally, all <code class="function">gtk_*_interp()</code> functions were removed.
302
<code class="function">gtk_*_full()</code> versions were provided as of GTK+ 1.0 and
303
should be used instead.
306
<span class="structname">GtkButton</span> has been changed to derive from
307
<span class="structname">GtkBin</span>.
308
To access a button's child, use <code class="literal">GTK_BIN (button)->child</code>,
309
instead of the old <code class="literal">GTK_BUTTON (button)->child</code>.
313
The selection API has been slightly modified:
315
<code class="function">gtk_selection_add_handler()</code> and
316
<code class="function">gtk_selection_add_handler_full()</code>
317
have been removed. To supply the selection, one now registers
318
the targets one is interested in with:
321
<pre class="programlisting">
322
void gtk_selection_add_target (GtkWidget *widget,
332
<pre class="programlisting">
333
void gtk_selection_add_targets (GtkWidget *widget,
335
GtkTargetEntry *targets,
340
When a request for a selection is received, the new "selection_get"
341
signal will be called:
344
<pre class="programlisting">
345
void "selection_get" (GtkWidget *widget,
346
GtkSelectionData *selection_data,
352
A "time" parameter has also been added to the "selection_received"
356
<pre class="programlisting">
357
void "selection_received" (GtkWidget *widget,
358
GtkSelectionData *selection_data,
365
The old drag and drop API has been completely removed and replaced.
366
See the reference documentation for details on the new API.
370
Support for Themes has been added. In general, this does
371
not affect application code, however, a few new rules should
375
<div class="itemizedlist"><ul type="circle">
376
<li><p>To set a shape for a window, you must use
377
<code class="function">gtk_widget_shape_combine_mask()</code> instead of
378
<code class="function">gdk_window_shape_combine_mask()</code>, or the shape will be
379
reset when switching themes.
381
<li><p>It is no longer permissable to draw directly on an arbitrary
382
widget, or to set an arbitrary widget's background pixmap.
383
If you need to do that, use a <span class="structname">GtkDrawingArea</span> or
384
(for a toplevel) a <span class="structname">GtkWindow</span> where
385
<code class="function">gtk_widget_set_app_paintable()</code>
394
The <span class="structname">GtkScrolledWindow</span> widget no longer creates a
395
<span class="structname">GtkViewport</span> automatically. Instead, it has been
396
generalized to accept any "self-scrolling" widget.
399
The self-scrolling widgets in the GTK+ core are
400
<span class="structname">GtkViewport</span>,
401
<span class="structname">GtkCList</span>, <span class="structname">GtkCTree</span>,
402
<span class="structname">GtkText</span>, and <span class="structname">GtkLayout</span>.
403
All of these widgets can be added to a scrolled window as normal children with
404
<code class="function">gtk_container_add()</code> and scrollbars will be set up
408
To add scrollbars to a non self-scrolling widget, (such as a
409
<span class="structname">GtkList</span>),
410
first add it to a viewport, then add the viewport to a scrolled window.
411
The scrolled window code provides a convenience function to do this:
414
<pre class="programlisting">
415
void gtk_scrolled_window_add_with_viewport (GtkScrolledWindow *scrollwin,
420
This does exactly what it says - it creates a viewport, adds the child
421
widget to it, then adds the viewport to the scrolled window.
424
The scrollbars have been removed from the <span class="structname">GtkCList</span>
425
and <span class="structname">GtkCTree</span>, because they are now scrolled by simply
426
adding them to a scrolled window. The scrollbar policy is set on the scrolled
427
window with <code class="function">gtk_scrolled_window_set_policy()</code> and not on
428
the child widgets (e.g. <span class="structname">GtkCList</span>'s
429
<code class="function">gtk_clist_set_policy()</code> was removed).
433
The "main loop" of GTK+ has been moved to GLib. This should not
434
affect existing programs, since compatibility functions have
435
been provided. However, you may want to consider migrating
436
your code to use the GLib main loop directly.
439
the <code class="literal">GTK_BASIC</code> flag was removed, and with it the corresponding
440
macro and function <code class="function">GTK_WIDGET_BASIC()</code> and
441
<code class="function">gtk_widget_basic()</code>.
445
All freeze/thaw methods are now recursive - that is, if you
446
freeze a widget n times, you must also thaw it n times.
448
Therefore, if you have code like:
451
<div class="informalexample"><pre class="programlisting">
453
frozen = GTK_CLIST_FROZEN (clist);
454
gtk_clist_freeze (clist);
457
gtk_clist_thaw (clist);
461
it will not work anymore. It must be, simply:
464
<div class="informalexample"><pre class="programlisting">
465
gtk_clist_freeze (clist);
467
gtk_clist_thaw (clist);
474
The thread safety in GTK+ 1.2 is slightly different than
475
that which appeared in early versions in the 1.1
476
development track. The main difference is that it relies on
477
the thread primitives in GLib, and on the thread-safe
484
<div class="itemizedlist"><ul type="circle">
485
<li><p>You must call <code class="function">g_thread_init()</code> before
486
executing any other GTK+ or GDK functions in a threaded GTK+ program.
489
<p>Idles, timeouts, and input functions are executed outside
490
of the main GTK+ lock. So, if you need to call GTK+
491
inside of such a callback, you must surround the callback
492
with a <code class="function">gdk_threads_enter()</code>/<code class="function">gdk_threads_leave()</code>
495
<p>However, signals are still executed within the main
498
<p>In particular, this means, if you are writing widgets
499
that might be used in threaded programs, you <span class="emphasis"><em>must</em></span>
500
surround timeouts and idle functions in this matter.
502
<p>As always, you must also surround any calls to GTK+
503
not made within a signal handler with a
504
<code class="function">gdk_threads_enter()</code>/<code class="function">gdk_threads_leave()</code>
509
<p>There is no longer a special <code class="option">--with-threads</code>
510
<span><strong class="command">configure</strong></span> option for GTK+. To use threads in a GTK+
514
<div class="orderedlist"><ol type="1">
515
<li><p>If you want to use the native thread implementation,
516
make sure GLib found this in configuration, otherwise,
517
call you must provide a thread implementation to
518
<code class="function">g_thread_init()</code>.
520
<li><p>Link with the libraries returned by
521
<span><strong class="command">gtk-config --libs gthread</strong></span>
522
and use the cflags from
523
<span><strong class="command">gtk-config --cflags gthread</strong></span>.
524
You can get these <code class="envar">CFLAGS</code> and <code class="envar">LIBS</code> by
525
passing <code class="literal">gthread</code> as the fourth parameter to the
526
<code class="literal">AM_PATH_GTK</code> <span class="application">automake</span>
539
Prior to GTK+ 1.2, there were two conflicting interpretations
540
of <code class="literal">widget->requisition</code>. It was either taken to be
541
the size that the widget requested, or that size modified by calls to
542
<code class="function">gtk_widget_set_usize()</code>. In GTK+ 1.2,
543
it is always interpreted the first way.
546
Container widgets are affected in two ways by this:
549
<div class="orderedlist"><ol type="1">
551
<p>Container widgets should not pass
552
<code class="literal">widget->requisition</code> as the second parameter to
553
<code class="function">gtk_widget_size_request()</code>.
554
Instead they should call it like:
556
<pre class="programlisting">
557
GtkRequisition child_requisition;
558
gtk_widget_size_request (widget, &child_requisition);
564
<p>Container widgets should not access
565
<code class="literal">child->requisition</code> directly. Either they should use
566
the values returned by <code class="function">gtk_widget_size_request()</code>,
567
or they should call the new function:
569
<pre class="programlisting">
570
void gtk_widget_get_child_requisition (GtkWidget *widget,
571
GtkRequisition *requisition);
574
which returns the requisition of the given widget, modified
575
by calls to <code class="function">gtk_widget_set_usize()</code>.