1 <refentry id="gtk-changes-1-2" revision="1 Jan 2002">
3 <refentrytitle>Changes from 1.0 to 1.2</refentrytitle>
4 <manvolnum>3</manvolnum>
5 <refmiscinfo>Changes from 1.0 to 1.2</refmiscinfo>
9 <refname>Changes from 1.0 to 1.2</refname>
11 Incompatible changes made between version 1.0 and version 1.2
17 <title>Incompatible changes from 1.0 to 1.2</title>
23 <structname>GtkAcceleratorTable</structname> has been replaced with
24 <structname>GtkAccelGroup</structname>.
30 <structname>GtkMenuFactory</structname> has been replaced with
31 <structname>GtkItemFactory</structname>, although
32 a version of <structname>GtkMenuFactory</structname> is currently still
33 provided to ease the migration phase.
39 The <structname>GtkTypeInfo</structname> structures used in the
40 <function>gtk_*_type_init()</function> functions have
41 changed a bit, the old format:
43 GtkTypeInfo bin_info =
48 (GtkClassInitFunc) gtk_bin_class_init,
49 (GtkObjectInitFunc) gtk_bin_init,
55 needs to be converted to:
58 static const GtkTypeInfo bin_info =
63 (GtkClassInitFunc) gtk_bin_class_init,
64 (GtkObjectInitFunc) gtk_bin_init,
65 /* reserved_1 */ NULL,
66 /* reserved_2 */ NULL,
67 (GtkClassInitFunc) NULL,
71 the <function>GtkArgSetFunc</function> and <function>GtkArgGetFunc</function>
72 functions are not supported from the type system anymore, and you should make
73 sure that your code only fills in these fields with <literal>NULL</literal>
74 and doesn't use the deprecated function typedefs
75 <literal>(GtkArgSetFunc)</literal> and <literal>(GtkArgGetFunc)</literal>
82 A number of GTK+ functions were renamed. For compatibility,
83 <filename>gtkcompat.h</filename> #define's the old 1.0.x function names in
84 terms of the new names. To assure your GTK+ program doesn't rely on outdated
85 function variants, compile your program with
86 <option>-DGTK_DISABLE_COMPAT_H</option> to disable
87 the compatibility aliases.
89 Here is the list of the old names and replacements:
94 <row><entry>Old</entry><entry>Replacement</entry></row>
97 <row><entry><function>gtk_accel_label_accelerator_width</function></entry><entry><function>gtk_accel_label_get_accel_width</function></entry></row>
98 <row><entry><function>gtk_check_menu_item_set_state</function></entry><entry><function>gtk_check_menu_item_set_active</function></entry></row>
99 <row><entry><function>gtk_container_border_width</function></entry><entry><function>gtk_container_set_border_width</function></entry></row>
100 <row><entry><function>gtk_label_set</function></entry><entry><function>gtk_label_set_text</function></entry></row>
101 <row><entry><function>gtk_notebook_current_page</function></entry><entry><function>gtk_notebook_get_current_page</function></entry></row>
102 <row><entry><function>gtk_packer_configure</function></entry><entry><function>gtk_packer_set_child_packing</function></entry></row>
103 <row><entry><function>gtk_paned_gutter_size</function></entry><entry><function>gtk_paned_set_gutter_size</function></entry></row>
104 <row><entry><function>gtk_paned_handle_size</function></entry><entry><function>gtk_paned_set_handle_size</function></entry></row>
105 <row><entry><function>gtk_scale_value_width</function></entry><entry><function>gtk_scale_get_value_width</function></entry></row>
106 <row><entry><function>gtk_style_apply_default_pixmap</function></entry><entry><function>gtk_style_apply_default_background</function></entry></row>
107 <row><entry><function>gtk_toggle_button_set_state</function></entry><entry><function>gtk_toggle_button_set_active</function></entry></row>
108 <row><entry><function>gtk_window_position</function></entry><entry><function>gtk_window_set_position</function></entry></row>
112 Note that <function>gtk_style_apply_default_background()</function> has an
113 additional argument, <literal>set_bg</literal>. This parameter should be
114 <literal>FALSE</literal> if the background is being set for a
115 <literal>NO_WINDOW</literal> widget, otherwise <literal>TRUE</literal>.
121 During the development phase of the 1.1.x line of GTK+ certain functions
122 were deprecated and later removed. Functions affected are:
127 <row><entry>Removed</entry><entry>Replacement</entry></row>
130 <row><entry><function>gtk_clist_set_border</function></entry><entry><function>gtk_clist_set_shadow_type</function></entry></row>
131 <row><entry><function>gtk_container_block_resize</function></entry><entry><function>gtk_container_set_resize_mode</function></entry></row>
132 <row><entry><function>gtk_container_unblock_resize</function></entry><entry><function>gtk_container_set_resize_mode</function></entry></row>
133 <row><entry><function>gtk_container_need_resize</function></entry><entry><function>gtk_container_check_resize</function></entry></row>
134 <row><entry><function>gtk_ctree_show_stub</function></entry><entry><function>gtk_ctree_set_show_stub</function></entry></row>
135 <row><entry><function>gtk_ctree_set_reorderable</function></entry><entry><function>gtk_clist_set_reorderable</function></entry></row>
136 <row><entry><function>gtk_ctree_set_use_drag_icons</function></entry><entry><function>gtk_clist_set_use_drag_icons</function></entry></row>
137 <row><entry><function>gtk_entry_adjust_scroll</function></entry><entry><function>-</function></entry></row>
138 <row><entry><function>gtk_object_class_add_user_signal</function></entry><entry><function>gtk_object_class_user_signal_new</function></entry></row>
139 <row><entry><function>gtk_preview_put_row</function></entry><entry><function>gtk_preview_put</function></entry></row>
140 <row><entry><function>gtk_progress_bar_construct</function></entry><entry><function>gtk_progress_set_adjustment</function></entry></row>
141 <row><entry><function>gtk_scrolled_window_construct</function></entry><entry><function>gtk_scrolled_window_set_{h|v}adjustment</function></entry></row>
142 <row><entry><function>gtk_spin_button_construct</function></entry><entry><function>gtk_spin_button_configure</function></entry></row>
143 <row><entry><function>gtk_widget_thaw_accelerators</function></entry><entry><function>gtk_widget_unlock_accelerators</function></entry></row>
144 <row><entry><function>gtk_widget_freeze_accelerators</function></entry><entry><function>gtk_widget_lock_accelerators</function></entry></row>
149 Note that <function>gtk_entry_adjust_scroll()</function> is no longer needed
150 as <structname>GtkEntry</structname> should automatically keep the scroll
159 Additionally, all <function>gtk_*_interp()</function> functions were removed.
160 <function>gtk_*_full()</function> versions were provided as of GTK+ 1.0 and
161 should be used instead.
167 <structname>GtkButton</structname> has been changed to derive from
168 <structname>GtkBin</structname>.
169 To access a button's child, use <literal>GTK_BIN (button)->child</literal>,
170 instead of the old <literal>GTK_BUTTON (button)->child</literal>.
176 The selection API has been slightly modified:
178 <function>gtk_selection_add_handler()</function> and
179 <function>gtk_selection_add_handler_full()</function>
180 have been removed. To supply the selection, one now registers
181 the targets one is interested in with:
184 void gtk_selection_add_target (GtkWidget *widget,
193 void gtk_selection_add_targets (GtkWidget *widget,
195 GtkTargetEntry *targets,
199 When a request for a selection is received, the new "selection_get"
200 signal will be called:
203 void "selection_get" (GtkWidget *widget,
204 GtkSelectionData *selection_data,
209 A "time" parameter has also been added to the "selection_received"
213 void "selection_received" (GtkWidget *widget,
214 GtkSelectionData *selection_data,
222 The old drag and drop API has been completely removed and replaced.
223 See the reference documentation for details on the new API.
229 Support for Themes has been added. In general, this does
230 not affect application code, however, a few new rules should
235 <para>To set a shape for a window, you must use
236 <function>gtk_widget_shape_combine_mask()</function> instead of
237 <function>gdk_window_shape_combine_mask()</function>, or the shape will be
238 reset when switching themes.
243 <para>It is no longer permissable to draw directly on an arbitrary
244 widget, or to set an arbitrary widget's background pixmap.
245 If you need to do that, use a <structname>GtkDrawingArea</structname> or
246 (for a toplevel) a <structname>GtkWindow</structname> where
247 <function>gtk_widget_set_app_paintable()</function>
257 The <structname>GtkScrolledWindow</structname> widget no longer creates a
258 <structname>GtkViewport</structname> automatically. Instead, it has been
259 generalized to accept any "self-scrolling" widget.
263 The self-scrolling widgets in the GTK+ core are
264 <structname>GtkViewport</structname>,
265 <structname>GtkCList</structname>, <structname>GtkCTree</structname>,
266 <structname>GtkText</structname>, and <structname>GtkLayout</structname>.
267 All of these widgets can be added to a scrolled window as normal children with
268 <function>gtk_container_add()</function> and scrollbars will be set up
273 To add scrollbars to a non self-scrolling widget, (such as a
274 <structname>GtkList</structname>),
275 first add it to a viewport, then add the viewport to a scrolled window.
276 The scrolled window code provides a convenience function to do this:
279 void gtk_scrolled_window_add_with_viewport (GtkScrolledWindow *scrollwin,
283 This does exactly what it says - it creates a viewport, adds the child
284 widget to it, then adds the viewport to the scrolled window.
288 The scrollbars have been removed from the <structname>GtkCList</structname>
289 and <structname>GtkCTree</structname>, because they are now scrolled by simply
290 adding them to a scrolled window. The scrollbar policy is set on the scrolled
291 window with <function>gtk_scrolled_window_set_policy()</function> and not on
292 the child widgets (e.g. <structname>GtkCList</structname>'s
293 <function>gtk_clist_set_policy()</function> was removed).
299 The "main loop" of GTK+ has been moved to GLib. This should not
300 affect existing programs, since compatibility functions have
301 been provided. However, you may want to consider migrating
302 your code to use the GLib main loop directly.
308 the <literal>GTK_BASIC</literal> flag was removed, and with it the corresponding
309 macro and function <function>GTK_WIDGET_BASIC()</function> and
310 <function>gtk_widget_basic()</function>.
316 All freeze/thaw methods are now recursive - that is, if you
317 freeze a widget n times, you must also thaw it n times.
319 Therefore, if you have code like:
321 <informalexample><programlisting>
323 frozen = GTK_CLIST_FROZEN (clist);
324 gtk_clist_freeze (clist);
327 gtk_clist_thaw (clist);
328 </programlisting></informalexample>
330 it will not work anymore. It must be, simply:
332 <informalexample><programlisting>
333 gtk_clist_freeze (clist);
335 gtk_clist_thaw (clist);
336 </programlisting></informalexample>
342 The thread safety in GTK+ 1.2 is slightly different than
343 that which appeared in early versions in the 1.1
344 development track. The main difference is that it relies on
345 the thread primitives in GLib, and on the thread-safe
354 <para>You must call <function>g_thread_init()</function> before
355 executing any other GTK+ or GDK functions in a threaded GTK+ program.
360 <para>Idles, timeouts, and input functions are executed outside
361 of the main GTK+ lock. So, if you need to call GTK+
362 inside of such a callback, you must surround the callback
363 with a <function>gdk_threads_enter()</function>/<function>gdk_threads_leave()</function>
367 <para>However, signals are still executed within the main
371 <para>In particular, this means, if you are writing widgets
372 that might be used in threaded programs, you <emphasis>must</emphasis>
373 surround timeouts and idle functions in this matter.
376 <para>As always, you must also surround any calls to GTK+
377 not made within a signal handler with a
378 <function>gdk_threads_enter()</function>/<function>gdk_threads_leave()</function>
384 <para>There is no longer a special <option>--with-threads</option>
385 <command>configure</command> option for GTK+. To use threads in a GTK+
390 <para>If you want to use the native thread implementation,
391 make sure GLib found this in configuration, otherwise,
392 call you must provide a thread implementation to
393 <function>g_thread_init()</function>.
397 <para>Link with the libraries returned by
398 <command>gtk-config --libs gthread</command>
399 and use the cflags from
400 <command>gtk-config --cflags gthread</command>.
401 You can get these <envar>CFLAGS</envar> and <envar>LIBS</envar> by
402 passing <literal>gthread</literal> as the fourth parameter to the
403 <literal>AM_PATH_GTK</literal> <application>automake</application>
416 Prior to GTK+ 1.2, there were two conflicting interpretations
417 of <literal>widget->requisition</literal>. It was either taken to be
418 the size that the widget requested, or that size modified by calls to
419 <function>gtk_widget_set_usize()</function>. In GTK+ 1.2,
420 it is always interpreted the first way.
424 Container widgets are affected in two ways by this:
428 <para>Container widgets should not pass
429 <literal>widget->requisition</literal> as the second parameter to
430 <function>gtk_widget_size_request()</function>.
431 Instead they should call it like:
433 GtkRequisition child_requisition;
434 gtk_widget_size_request (widget, &child_requisition);
439 <para>Container widgets should not access
440 <literal>child->requisition</literal> directly. Either they should use
441 the values returned by <function>gtk_widget_size_request()</function>,
442 or they should call the new function:
444 void gtk_widget_get_child_requisition (GtkWidget *widget,
445 GtkRequisition *requisition);
447 which returns the requisition of the given widget, modified
448 by calls to <function>gtk_widget_set_usize()</function>.