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
158 Additionally, all <function>gtk_*_interp()</function> functions were removed.
159 <function>gtk_*_full()</function> versions were provided as of GTK+ 1.0 and
160 should be used instead.
166 <structname>GtkButton</structname> has been changed to derive from
167 <structname>GtkBin</structname>.
168 To access a button's child, use <literal>GTK_BIN (button)->child</literal>,
169 instead of the old <literal>GTK_BUTTON (button)->child</literal>.
175 The selection API has been slightly modified:
177 <function>gtk_selection_add_handler()</function> and
178 <function>gtk_selection_add_handler_full()</function>
179 have been removed. To supply the selection, one now registers
180 the targets one is interested in with:
183 void gtk_selection_add_target (GtkWidget *widget,
192 void gtk_selection_add_targets (GtkWidget *widget,
194 GtkTargetEntry *targets,
198 When a request for a selection is received, the new "selection_get"
199 signal will be called:
202 void "selection_get" (GtkWidget *widget,
203 GtkSelectionData *selection_data,
208 A "time" parameter has also been added to the "selection_received"
212 void "selection_received" (GtkWidget *widget,
213 GtkSelectionData *selection_data,
221 The old drag and drop API has been completely removed and replaced.
222 See the reference documentation for details on the new API.
228 Support for Themes has been added. In general, this does
229 not affect application code, however, a few new rules should
234 <para>To set a shape for a window, you must use
235 <function>gtk_widget_shape_combine_mask()</function> instead of
236 <function>gdk_window_shape_combine_mask()</function>, or the shape will be
237 reset when switching themes.
242 <para>It is no longer permissable to draw directly on an arbitrary
243 widget, or to set an arbitrary widget's background pixmap.
244 If you need to do that, use a <structname>GtkDrawingArea</structname> or
245 (for a toplevel) a <structname>GtkWindow</structname> where
246 <function>gtk_widget_set_app_paintable()</function>
256 The <structname>GtkScrolledWindow</structname> widget no longer creates a
257 <structname>GtkViewport</structname> automatically. Instead, it has been
258 generalized to accept any "self-scrolling" widget.
262 The self-scrolling widgets in the GTK+ core are
263 <structname>GtkViewport</structname>,
264 <structname>GtkCList</structname>, <structname>GtkCTree</structname>,
265 <structname>GtkText</structname>, and <structname>GtkLayout</structname>.
266 All of these widgets can be added to a scrolled window as normal children with
267 <function>gtk_container_add()</function> and scrollbars will be set up
272 To add scrollbars to a non self-scrolling widget, (such as a
273 <structname>GtkList</structname>),
274 first add it to a viewport, then add the viewport to a scrolled window.
275 The scrolled window code provides a convenience function to do this:
278 void gtk_scrolled_window_add_with_viewport (GtkScrolledWindow *scrollwin,
282 This does exactly what it says - it creates a viewport, adds the child
283 widget to it, then adds the viewport to the scrolled window.
287 The scrollbars have been removed from the <structname>GtkCList</structname>
288 and <structname>GtkCTree</structname>, because they are now scrolled by simply
289 adding them to a scrolled window. The scrollbar policy is set on the scrolled
290 window with <function>gtk_scrolled_window_set_policy()</function> and not on
291 the child widgets (e.g. <structname>GtkCList</structname>'s
292 <function>gtk_clist_set_policy()</function> was removed).
298 The "main loop" of GTK+ has been moved to GLib. This should not
299 affect existing programs, since compatibility functions have
300 been provided. However, you may want to consider migrating
301 your code to use the GLib main loop directly.
307 the <literal>GTK_BASIC</literal> flag was removed, and with it the corresponding
308 macro and function <function>GTK_WIDGET_BASIC()</function> and
309 <function>gtk_widget_basic()</function>.
315 All freeze/thaw methods are now recursive - that is, if you
316 freeze a widget n times, you must also thaw it n times.
318 Therefore, if you have code like:
320 <informalexample><programlisting>
322 frozen = GTK_CLIST_FROZEN (clist);
323 gtk_clist_freeze (clist);
326 gtk_clist_thaw (clist);
327 </programlisting></informalexample>
329 it will not work anymore. It must be, simply:
331 <informalexample><programlisting>
332 gtk_clist_freeze (clist);
334 gtk_clist_thaw (clist);
335 </programlisting></informalexample>
341 The thread safety in GTK+ 1.2 is slightly different than
342 that which appeared in early versions in the 1.1
343 development track. The main difference is that it relies on
344 the thread primitives in GLib, and on the thread-safe
353 <para>You must call <function>g_thread_init()</function> before
354 executing any other GTK+ or GDK functions in a threaded GTK+ program.
359 <para>Idles, timeouts, and input functions are executed outside
360 of the main GTK+ lock. So, if you need to call GTK+
361 inside of such a callback, you must surround the callback
362 with a <function>gdk_threads_enter()</function>/<function>gdk_threads_leave()</function>
366 <para>However, signals are still executed within the main
370 <para>In particular, this means, if you are writing widgets
371 that might be used in threaded programs, you <emphasis>must</emphasis>
372 surround timeouts and idle functions in this matter.
375 <para>As always, you must also surround any calls to GTK+
376 not made within a signal handler with a
377 <function>gdk_threads_enter()</function>/<function>gdk_threads_leave()</function>
383 <para>There is no longer a special <option>--with-threads</option>
384 <command>configure</command> option for GTK+. To use threads in a GTK+
389 <para>If you want to use the native thread implementation,
390 make sure GLib found this in configuration, otherwise,
391 call you must provide a thread implementation to
392 <function>g_thread_init()</function>.
396 <para>Link with the libraries returned by
397 <command>gtk-config --libs gthread</command>
398 and use the cflags from
399 <command>gtk-config --cflags gthread</command>.
400 You can get these <envar>CFLAGS</envar> and <envar>LIBS</envar> by
401 passing <literal>gthread</literal> as the fourth parameter to the
402 <literal>AM_PATH_GTK</literal> <application>automake</application>
415 Prior to GTK+ 1.2, there were two conflicting interpretations
416 of <literal>widget->requisition</literal>. It was either taken to be
417 the size that the widget requested, or that size modified by calls to
418 <function>gtk_widget_set_usize()</function>. In GTK+ 1.2,
419 it is always interpreted the first way.
423 Container widgets are affected in two ways by this:
427 <para>Container widgets should not pass
428 <literal>widget->requisition</literal> as the second parameter to
429 <function>gtk_widget_size_request()</function>.
430 Instead they should call it like:
432 GtkRequisition child_requisition;
433 gtk_widget_size_request (widget, &child_requisition);
438 <para>Container widgets should not access
439 <literal>child->requisition</literal> directly. Either they should use
440 the values returned by <function>gtk_widget_size_request()</function>,
441 or they should call the new function:
443 void gtk_widget_get_child_requisition (GtkWidget *widget,
444 GtkRequisition *requisition);
446 which returns the requisition of the given widget, modified
447 by calls to <function>gtk_widget_set_usize()</function>.