]> Pileus Git - ~andy/gtk/blob - docs/reference/gtk/changes-2.0.sgml
move README.linux-fb in here
[~andy/gtk] / docs / reference / gtk / changes-2.0.sgml
1 <refentry id="gtk-changes-2-0" revision="1 Jan 2002">
2 <refmeta>
3 <refentrytitle>Changes from 1.2 to 2.0</refentrytitle>
4 <manvolnum>3</manvolnum>
5 <refmiscinfo>Changes from 1.2 to 2.0</refmiscinfo>
6 </refmeta>
7
8 <refnamediv>
9 <refname>Changes from 1.2 to 2.0</refname>
10 <refpurpose>
11 Incompatible changes made between version 1.2 and version 2.0
12 </refpurpose>
13 </refnamediv>
14
15
16 <refsect1>
17 <title>Incompatible changes from 1.2 to 2.0</title>
18
19 <para>
20 The <ulink url="http://developer.gnome.org/dotplan/porting/">GNOME 2.0
21 porting guide</ulink> on <ulink
22 url="http://developer.gnome.org">http://developer.gnome.org</ulink>
23 has some more detailed discussion of porting from 1.2 to 2.0.
24 See the sections on GLib and GTK+.
25 </para>
26
27 <para>
28 GTK+ changed fairly substantially from version 1.2 to 2.0, much more
29 so than from 1.0 to 1.2. Subsequent updates (possibilities are 2.0 to
30 2.2, 2.2 to 2.4, then to 3.0) will almost certainly be much, much
31 smaller. Nonetheless, most programs written for 1.2 compile against
32 2.0 with few changes. The bulk of changes listed below are to obscure
33 features or very specialized features, and compatibility interfaces
34 exist whenever possible.
35 </para>
36
37 <itemizedlist>
38
39 <listitem>
40 <para>
41 gtk_container_get_toplevels() was removed and replaced with
42   gtk_window_list_toplevels(), which has different memory management 
43   on the return value (gtk_window_list_toplevels() copies the GList
44   and also references each widget in the list, so you have to
45   g_list_free() the list after first unref'ing each list member).
46 </para>
47 </listitem>
48
49 <listitem>
50 <para>
51 The gdk_time* functions have been removed. This functionality
52   has been unused since the main loop was moved into GLib
53   prior to 1.2. 
54 </para>
55 </listitem>
56
57 <listitem>
58 <para>
59 The signature for GtkPrintFunc (used for gtk_item_factory_dump_items)
60   has been changed to take a 'const gchar *' instead of 'gchar *', to
61   match what we do for glib, and other similar cases.
62 </para>
63 </listitem>
64
65 <listitem>
66 <para>
67 The detail arguments in the GtkStyleClass structure are now 'const gchar *'.
68 </para>
69 </listitem>
70
71 <listitem>
72 <para>
73 gtk_paned_set_gutter_size() has been removed, since the small handle tab
74   has been changed to include the entire area previously occupied by
75   the gutter.
76 </para>
77 </listitem>
78
79 <listitem>
80 <para>
81 gtk_paned_set_handle_size() has been removed, in favor of a style property,
82   since this is an option that only makes sense for themes to adjust.
83 </para>
84 </listitem>
85
86 <listitem>
87 <para>
88 GDK no longer selects OwnerGrabButtonMask for button presses. This means  
89   that the automatic grab that occurs when the user presses a button
90   will have owner_events = FALSE, so all events are redirected to the
91   grab window, even events that would normally go to  other windows of the
92   window's owner.
93 </para>
94 </listitem>
95
96 <listitem>
97 <para>
98 GtkColorSelectionDialog has now been moved into it's own set of files,
99   gtkcolorseldialog.c and gtkcolorseldialog.h.
100 </para>
101 </listitem>
102
103 <listitem>
104 <para>
105 gtk_widget_shape_combine_mask() now keeps a reference count on the 
106   mask pixmap that is passed in.
107 </para>
108 </listitem>
109
110 <listitem>
111 <para>
112 The GtkPatternSpec has been moved to glib as GPatternSpec, the pattern
113   arguments to gtk_item_factory_dump_items() and gtk_item_factory_dump_rc()
114   have thusly been changed to take a GPatternSpec instead of GtkPatternSpec.
115 </para>
116 </listitem> 
117
118 <listitem>
119 <para>
120 Type system changes:
121 <itemizedlist>
122 <listitem>
123 <para>
124    GTK_TYPE_OBJECT is not a fundamental type anymore. Type checks of the
125     style (GTK_FUNDAMENTAL_TYPE (some_type) == GTK_TYPE_OBJECT)
126     will not work anymore. As a replacement, (GTK_TYPE_IS_OBJECT (some_type))
127     can be used now.
128 </para>
129 </listitem>
130 <listitem>
131 <para>
132 The following types vanished: GTK_TYPE_ARGS, GTK_TYPE_CALLBACK,
133     GTK_TYPE_C_CALLBACK, GTK_TYPE_FOREIGN. The corresponding GtkArg
134     fields and field access macros are also gone.
135 </para>
136 </listitem>
137 <listitem>
138 <para>
139 The following type aliases vanished: GTK_TYPE_FLAT_FIRST,
140     GTK_TYPE_FLAT_LAST, GTK_TYPE_STRUCTURED_FIRST,
141     GTK_TYPE_STRUCTURED_LAST.
142 </para>
143 </listitem>
144 <listitem>
145 <para>
146 The type macros GTK_TYPE_MAKE() and GTK_TYPE_SEQNO() vanished, use of
147     GTK_FUNDAMENTAL_TYPE() is discouraged. Instead, the corresponding GType
148     API should be used: G_TYPE_FUNDAMENTAL(), G_TYPE_DERIVE_ID(),
149     G_TYPE_BRANCH_SEQNO(). Note that the GLib type system doesn't build new
150     type ids based on a global incremental sequential number anymore, but
151     numbers new type ids sequentially per fundamental type branch.
152 </para>
153 </listitem>
154 <listitem>
155 <para>
156 The following type functions vanished/were replaced:
157 <programlisting>
158     Old Function                 Replacement
159     gtk_type_query()             - being investigated -
160     gtk_type_set_varargs_type()  -
161     gtk_type_get_varargs_type()  -
162     gtk_type_check_object_cast() g_type_check_instance_cast()
163     gtk_type_check_class_cast()  g_type_check_class_cast()
164     gtk_type_describe_tree()     -
165     gtk_type_describe_heritage() -
166     gtk_type_free()              -
167     gtk_type_children_types()    g_type_children()
168     gtk_type_set_chunk_alloc()   GTypeInfo.n_preallocs
169     gtk_type_register_enum()     g_enum_register_static()
170     gtk_type_register_flags()    g_flags_register_static()
171     gtk_type_parent_class()      g_type_parent() /
172     g_type_class_peek_parent()
173 </programlisting>
174     Use of g_type_class_ref() / g_type_class_unref() and g_type_class_peek()
175     is recommended over usage of gtk_type_class().
176     Use of g_type_register_static() / g_type_register_dynamic() is recommended
177     over usage of gtk_type_unique().
178 </para>
179 </listitem>
180 </itemizedlist>
181 </para>
182 </listitem>
183
184 <listitem>
185 <para>
186 Object system changes:
187   GtkObject derives from GObject, so is not the basic object type anymore.
188   This imposes the following source incompatible changes:
189 <itemizedlist>
190
191 <listitem>
192 <para>
193 GtkObject has no klass field anymore, an object's class can be retrived
194     with the object's coresponding GTK_&lt;OBJECT&gt;_GET_CLASS (object)
195     macro.
196 </para>
197 </listitem>
198 <listitem>
199 <para>
200 GtkObjectClass has no type field anymore, a class's type can be retrived
201     with the GTK_CLASS_TYPE (class) macro.
202 </para>
203 </listitem>
204 <listitem>
205 <para>
206 GtkObjectClass does not introduce the finalize() and shutdown() methods
207     anymore. While shutdown() is intended for GTK+ internal use only, finalize()
208     is required by a variety of object implementations. GObjectClass.finalize
209     should be overriden here, e.g.:
210 <programlisting>
211     static void gtk_label_finalize (GObject *gobject)
212     {
213       GtkLabel *label = GTK_LABEL (gobject);
214       
215       G_OBJECT_CLASS (parent_class)-&gt;finalize (object);
216     }
217     static void gtk_label_class_init (GtkLabelClass *class)
218     {
219       GObjectClass *gobject_class = G_OBJECT_CLASS (class);
220       
221       gobject_class-&gt;finalize = gtk_label_finalize;
222     }
223 </programlisting>
224 </para>
225 </listitem>
226
227 </itemizedlist>
228 </para>
229 </listitem>
230
231 <listitem>
232 <para>
233 The GtkObject::destroy signal can now be emitted multiple times on an object.
234     ::destroy implementations should check that make sure that they take this
235     into account, by checking to make sure that resources are there before
236     freeing them. For example:
237 <programlisting>
238     if (object-&gt;foo_data)
239       { 
240         g_free (object-&gt;foo_data);
241         object-&gt;foo_data = NULL;
242       }
243 </programlisting>
244
245     Also, ::destroy implementations have to release object references that
246     the object holds. Code in finalize implementations such as:
247 <programlisting>
248     if (object-&gt;adjustment)
249       {
250         gtk_object_unref (object-&gt;adjustment);
251         object-&gt;adjustment = NULL;
252       }
253 </programlisting>
254     have to be moved into the ::destroy implementations. The reason for doing
255     this is that all object reference cycles should be broken at destruction 
256     time.
257
258     Because the ::destroy signal can be emitted multiple times, it no longer
259     makes sense to check if a widget has been destroyed using the 
260     GTK_OBJECT_DESTROYED() macro, and this macro has been removed. If 
261     catching destruction is still needed, it can be done with a signal
262     connection to ::destroy.
263 </para>
264 </listitem>
265     
266 <listitem>
267 <para>
268 Signal system changes:
269   The Gtk 2.0 signal merly proxies the GSignal system now.
270   For future usage, direct use of the GSignal API is recommended,
271   this avoids significant performance hits where GtkArg structures
272   have to be converted into GValues. For language bindings,
273   GSignal+GClosure provide a much more flexible and convenient
274   mechanism to hook into signal emissions or install class default
275   handlers, so the old GtkSignal API for language bindings is not
276   supported anymore.
277 </para>
278 <para>
279   Functions that got removed in the Gtk signal API:
280   gtk_signal_n_emissions(), gtk_signal_n_emissions_by_name(),
281   gtk_signal_set_funcs(), gtk_signal_handler_pending_by_id(),
282   gtk_signal_add_emission_hook(), gtk_signal_add_emission_hook_full(),
283   gtk_signal_remove_emission_hook(), gtk_signal_query().
284   Also, the GtkCallbackMarshal argument to gtk_signal_connect_full() is
285   not supported anymore.
286   For many of the removed functions, similar variants are available
287   in the g_signal_* namespace.
288   The GSignal system perfomrs emissions in a slightly different manner than
289   the old GtkSignal code. Signal handlers that are connected to signal "foo"
290   on object "bar" while "foo" is being emitted, will not be called anymore
291   during the emission they were connected within.
292 </para>
293 </listitem>
294
295 <listitem>
296 <para>
297 Inserting and deleting text in GtkEntry though functions such
298   as gtk_entry_insert_text() now leave the cursor at its original
299   position in the text instead of moving it to the location of
300   the insertion/deletion.
301 </para>
302 </listitem>
303
304 <listitem>
305 <para>
306 The -&gt;label field of GtkFrame widgets has been removed. (As part of
307   a change to allow the arbitrary widgets in the title position.) The
308   text can now be retrieved with the new function gtk_frame_get_text().
309 </para>
310 </listitem>
311
312 <listitem>
313 <para>
314 The 'font' and 'font_set' declarations in RC files are now ignored. There
315   is a new 'font_name' field that holds the string form of a Pango font
316 </para>
317 </listitem>
318
319 <listitem>
320 <para>
321 A number of types in GDK have become subclasses of GObject. For the
322   most part, this should not break anyone's code. However, it's now 
323   possible/encouraged to use g_object_ref()/g_object_unref() and other
324   GObject features with these GDK types. The converted types are:
325   GdkWindow, GdkDrawable, GdkPixmap, GdkImage, GdkGC, GdkDragContext,
326   GdkColormap
327 </para>
328 </listitem>
329
330 <listitem>
331 <para>
332 All drawables including pixmaps used to have a type tag, the
333   GdkWindowType enumeration, which included GDK_WINDOW_PIXMAP.
334   GdkWindowType is now a property of GdkWindow
335   <emphasis>only</emphasis>, and there is no GDK_WINDOW_PIXMAP. You
336   can use the GDK_IS_PIXMAP() macro to see if you have a pixmap, if
337   you need to know that.
338 </para>
339 </listitem>
340
341 <listitem>
342 <para>
343 GtkStyle and GtkRcStyle are now subclasses of GObject as well.  This
344   requires fairly extensive changes to theme engines, but
345   shouldn't affect most other code.
346 </para>
347 </listitem>
348
349 <listitem>
350 <para>
351 xthickness/ythickness have moved from GtkStyleClass to GtkStyle
352   (from class to instance). This gives themes a bit more flexibility
353   and is generally more of the Right Thing. You can trivially fix
354   your code with s/style-&gt;klass-&gt;xthickness/style-&gt;xthickness/g and 
355   same for ythickness.
356 </para>
357 </listitem>
358
359 <listitem>
360 <para>
361 Some GtkStyle draw_ methods have been removed (cross, oval, ramp) 
362   and others have been added (expander, layout). This will require
363   changes to theme engines.
364 </para>
365 </listitem>
366
367 <listitem>
368 <para>
369 If you were using private GDK types, they have been rearranged
370   significantly. You shouldn't use private types. ;-) 
371 </para>
372 </listitem>
373
374 <listitem>
375 <para>
376 The visual for a widget, and also the default visual is now derived
377   from the colormap for the widget and the default colormap.
378   gtk_widget_set_visual(), gtk_widget_set_default_visual(),
379   gtk_widget_push_visual() and gtk_widget_pop_visual() now do
380   nothing. Since the visual always had to match that of the colormap,
381   it is safe to simply delete all references to these functions.
382 </para>
383 </listitem>
384
385
386 <listitem>
387 <para>
388 A number of functions in GDK have been renamed for consistency and
389   clarity. #defines to provide backwards compatibility have been
390   included, but can be disabled by defining GDK_DISABLE_DEPRECATED.
391
392 <programlisting>
393   #define gdk_draw_pixmap                gdk_draw_drawable
394   #define gdk_draw_bitmap                gdk_draw_drawable
395
396   #define gdk_window_get_size            gdk_drawable_get_size
397   #define gdk_window_get_type            gdk_window_get_window_type
398   #define gdk_window_get_colormap        gdk_drawable_get_colormap
399   #define gdk_window_set_colormap        gdk_drawable_set_colormap
400   #define gdk_window_get_visual          gdk_drawable_get_visual
401
402   #define gdk_window_ref                 gdk_drawable_ref
403   #define gdk_window_unref               gdk_drawable_unref
404   #define gdk_bitmap_ref                 gdk_drawable_ref
405   #define gdk_bitmap_unref               gdk_drawable_unref
406   #define gdk_pixmap_ref                 gdk_drawable_ref
407   #define gdk_pixmap_unref               gdk_drawable_unref
408
409   #define gdk_gc_destroy                 gdk_gc_unref
410   #define gdk_image_destroy              gdk_image_unref
411   #define gdk_cursor_destroy             gdk_cursor_unref
412
413   (Note that g_object_ref() and g_object_unref() may be used for all of
414   the above _ref and _unref functions.)
415
416   #define gdk_window_copy_area(drawable,gc,x,y,source_drawable,source_x,source_y,width,height) \
417      gdk_draw_pixmap(drawable,gc,source_drawable,source_x,source_y,x,y,width,height)
418
419   #define gdk_rgb_get_cmap               gdk_rgb_get_colormap
420 </programlisting>  
421
422   gtk_widget_popup() was removed, it was only usable for GtkWindows, and
423   there the same effect can be achieved by gtk_window_move() and
424   gtk_widget_show().
425 </para>
426 </listitem>
427
428 <listitem>
429 <para>
430 gdk_pixmap_foreign_new() no longer calls XFreePixmap() on the 
431   pixmap when the GdkPixmap is finalized. This change corresponds
432   to the behavior of gdk_window_foreign_new(), and fixes a lot
433   of problems with code where the pixmap wasn't supposed to be
434   freed. If XFreePixmap() is needed, it can be done using the
435   destroy-notification facilities of g_object_set_data().
436 </para>
437 </listitem>
438
439 <listitem>
440 <para>
441 GtkProgress/GtkProgressBar had serious problems in GTK 1.2.
442 <itemizedlist>
443 <listitem>
444 <para>
445 Only 3 or 4 functions are really needed for 95% of progress  
446     interfaces; GtkProgress[Bar] had about 25 functions, and 
447     didn't even include these 3 or 4.
448 </para>
449 </listitem>
450
451 <listitem>
452 <para>
453 In activity mode, the API involves setting the adjustment 
454     to any random value, just to have the side effect of 
455     calling the progress bar update function - the adjustment
456     is totally ignored in activity mode
457 </para>
458 </listitem>
459
460 <listitem>
461 <para>
462 You set the activity step as a pixel value, which means to 
463     set the activity step you basically need to connect to 
464     size_allocate
465 </para>
466 </listitem>
467
468 <listitem>
469 <para>
470 There are ctree_set_expander_style()-functions, to randomly 
471     change look-and-feel for no good reason
472 </para>
473 </listitem>
474
475 <listitem>
476 <para>
477 The split between GtkProgress and GtkProgressBar makes no sense 
478     to me whatsoever.
479 </para>
480 </listitem>
481
482 </itemizedlist>
483
484   This was a big wart on GTK and made people waste lots of time,
485   both learning and using the interface.
486   So, we have added what we feel is the correct API, and marked all the
487   rest deprecated. However, the changes are 100% backward-compatible and
488   should break no existing code.
489   The following 5 functions are the new programming interface and you 
490   should consider changing your code to use them:
491 <programlisting>
492   void       gtk_progress_bar_pulse                (GtkProgressBar *pbar);
493   void       gtk_progress_bar_set_text             (GtkProgressBar *pbar,
494                                                     const gchar    *text);
495   void       gtk_progress_bar_set_fraction         (GtkProgressBar *pbar,
496                                                     gfloat          fraction);
497
498   void       gtk_progress_bar_set_pulse_step       (GtkProgressBar *pbar,
499                                                     gfloat          fraction);
500   void       gtk_progress_bar_set_orientation      (GtkProgressBar *pbar,
501                                                     GtkProgressBarOrientation orientation);
502 </programlisting>
503 </para>
504 </listitem>
505
506 <listitem>
507 <para>
508 The GtkNotebookPage structure has been removed from the public header files;
509   this was never meant to be a public structure, and all functionality that
510   could be done by accessing the struct fields of this structure should be 
511   accesible otherwise.
512 </para>
513 </listitem>
514
515 <listitem>
516 <para>
517 GtkMenuPositionFunc has a new parameter push_in which controls how
518   menus placed outside the screen is handled. If this is set to true and
519   part of the menu is outside the screen then Gtk+ pushes it into the visible
520   area. Otherwise the menu is cut of at the end of the visible screen area.
521 </para>
522 <para>
523   Regardles of what happens to the size of the menu, the result is always
524   that the items are placed in the same place as if the menu was placed
525   outside the screen, using menu scrolling if necessary.
526 </para>
527 </listitem>
528   
529 <listitem>
530 <para>
531 The "draw" signal and virtual method on GtkWidget has been removed.
532   All drawing should now occur by invalidating a region of the widget
533   (call gdk_window_invalidate_rect() or gtk_widget_queue_draw() for
534   example to invalidate a region). GTK+ merges all invalid regions,
535   and sends expose events to the widget in an idle handler for the
536   invalid regions. gtk_widget_draw() is deprecated but still works; it
537   adds the passed-in area to the invalid region and immediately sends
538   expose events for the current invalid region. 
539   Most widgets will work fine if you just delete their "draw"
540   implementation, since they will already have working expose_event
541   implementations. The draw method was rarely called in practice
542   anyway.
543 </para>
544 </listitem>
545
546 <listitem>
547 <para>
548 The GdkExposeEvent has a new region field. This can be used instead
549   of the area field if you want a more exact representation of the
550   area to update.
551 </para>
552 </listitem>
553
554 <listitem>
555 <para>
556 Sending synthetic exposes using gtk_widget_event is no longer allowed.
557   If you just need an expose call you should use gdk_window_invalidate_rect()
558   or gdk_window_invalidate_region() instead. For the case of container
559   widgets that need to propagate expose events to NO_WINDOW children
560   you can either use gtk_container_propagate_expose(), or chain to the
561   default container expose handler.
562 </para>
563 </listitem> 
564
565 <listitem>
566 <para>
567 The draw_default and draw_focus methods/signals on GtkWidget are
568   gone; simply draw things in your expose handler. 
569   gtk_widget_draw_focus() and gtk_widget_draw_default() wrapper
570   functions are also gone; just queue a draw on the widget,  
571   or the part affected by the focus/default anyway.
572   Also, GtkWidget now has default implementations for focus_in_event
573   and focus_out_event. These set/unset GTK_HAS_FOCUS, and queue a
574   draw. So if your focus in/out handler just does that, you can delete
575   it.
576 </para>
577 </listitem>
578
579 <listitem>
580 <para>
581 GtkText and GtkTree are buggy and broken. We don't recommend using
582   them, and changing old code to avoid them is a good idea. The
583   recommended alternatives are GtkTextView and GtkTreeView.  The
584   broken widgets are not declared in the headers by default; to use
585   them, define the symbol GTK_ENABLE_BROKEN during compilation.  In
586   some future release, these widgets will be removed from GTK+.
587 </para>
588 </listitem>
589
590 <listitem>
591 <para>
592 GdkColorContext is gone; you probably weren't using it anyway.
593   Use GdkColormap and the gdk_rgb_* functions instead.
594 </para>
595 </listitem>
596
597 <listitem>
598 <para>
599 GtkMenuBar now draws the GtkContainer::border_width space outside
600   the frame, not inside the frame
601 </para>
602 </listitem>
603
604
605 <listitem>
606 <para>
607 In GTK 1.2, if an event handler returned TRUE it prevented
608   propagation of that event to parent widgets. That is, the 
609   event signal would not be emitted on parent widgets. In 
610   GTK 2.0, if an event handler returns TRUE, the current signal 
611   emission on the current widget is immediately stopped. That is,
612   other callbacks connected to the signal will not be invoked.
613 </para>
614 </listitem>
615
616 <listitem>
617 <para>
618 gtk_toolbar_new() no longer has arguments. This function 
619   was broken because the default GtkToolbarStyle (icons, text, both)
620   is now a user preference, which is overridden when you call
621   gtk_toolbar_set_style(). The constructor forced everyone to 
622   override the preference, which was undesirable. So to port
623   your app, decide if you want to force the toolbar style 
624   or conform to the user's global defaults; if you want to force
625   it, call gtk_toolbar_set_style().
626 </para>
627
628 <para>
629   The orientation arg was removed from toolbar_new() as well, just
630   because it wasn't very useful and we were breaking the function
631   anyway so had an opportunity to lose it. Call
632   gtk_toolbar_set_orientation() to set toolbar orientation.
633 </para>
634 </listitem>
635
636
637 <listitem>
638 <para>
639 GtkRange/GtkScrollbar/GtkScale were rewritten; this means that most
640   theme engines won't draw them properly, and any custom subclasses of
641   these widgets will need a rewrite (though if you could figure out
642   how to subclass the old version of GtkRange, you have our
643   respect). Also, GtkTroughType is gone.
644 </para>
645 </listitem>
646
647 <listitem>
648 <para>
649 The GtkContainer::focus signal/virtualfunction and
650   gtk_container_focus() call were replaced by 
651   GtkWidget::focus and gtk_widget_child_focus(). 
652   The semantics are the same, so you should be able to just 
653   replace "container_class-&gt;focus = mywidget_focus" with 
654   "widget_class-&gt;focus = mywidget_focus" and replace 
655   gtk_container_focus() calls with gtk_widget_child_focus() calls.
656 </para>
657 <para>
658   The purpose of this change was to allow non-containers to have 
659   focusable elements.
660 </para>
661 </listitem>
662  
663 <listitem>
664 <para>
665 gtk_rc_set_image_loader() and gtk_rc_load_image() has been removed, now 
666   that GTK+ includes decent image loading capabilities itself.
667 </para>
668 </listitem>
669
670 <listitem>
671 <para>
672 An extra GtkSettings argument has been added to
673   gtk_rc_find_pixmap_in_path(). This function is only actually useful
674   from a theme engine during parsing, at which point the GtkSettings
675   is provided.
676 </para>
677 </listitem>
678
679 <listitem>
680 <para>
681 The child argument facility in gtkcontainer.c has been converted
682   to a child property facility using GParamSpec and other facilities
683   for GObject.   
684 </para>
685 </listitem>
686
687  <listitem>
688 <para>
689 The set_child_arg and get_child_arg virtual methods have been
690      replaced with set_child_property / get_child_property, which
691      work similar to GObject-&gt;set_property/get_property.
692 </para>
693 </listitem>
694
695
696  <listitem>
697 <para>
698 Other removed GtkContainer unctions with the replacements:
699
700 <programlisting>
701      gtk_container_add_child_arg_type => gtk_container_class_install_child_property
702      gtk_container_query_child_args   => gtk_container_class_list_child_properties
703      gtk_container_child_getv         => gtk_container_child_set_property
704      gtk_container_child_setv         => gtk_container_child_get_property
705      gtk_container_add_with_args      => gtk_container_add_with_properties
706      gtk_container_addv               => gtk_container_add / gtk_container_child_set_property
707 </programlisting>
708 </para>
709 </listitem>
710
711
712 <listitem>
713 <para>
714 gdk_image_get() (or rather its replacement,
715   gdk_drawable_get_image()) now handles errors properly by returning
716   NULL, previously it would crash. Also, a window being offscreen is
717   no longer considered an error; instead, the area being contains
718   undefined contents for the offscreen areas. In most cases, code
719   using gdk_image_get() should really be ported to
720   gdk_pixbuf_get_from_drawable().
721 </para>
722 </listitem>
723
724 <listitem>
725 <para>
726 gtk_widget_set_usize() has been renamed to
727   gtk_widget_set_size_request(), however the old name still exists
728   unless you define GTK_DISABLE_DEPRECATED.
729 </para>
730 </listitem>
731
732 <listitem>
733 <para>
734 gtk_widget_set_uposition() is deprecated; use gtk_window_move(), 
735   gtk_fixed_put(), or gtk_layout_put() instead.
736 </para>
737 </listitem>
738
739 <listitem>
740 <para>
741 gtk_window_set_policy() is deprecated. To get the effect of
742   "allow_shrink", call gtk_widget_set_size_request(window, 0, 0).  To
743   get the effect of "allow_grow", call
744   gtk_window_set_resizable(window, TRUE). You didn't want the effect
745   of auto_shrink, it made no sense. But maybe if you were using it you
746   want to use gtk_window_resize (window, 1, 1) to snap a window back
747   to its minimum size (the 1, 1 will be rounded up to the minimum
748   window size).
749 </para>
750 </listitem>
751
752 <listitem>
753 <para>
754 The core GTK+ now takes care of handling mapping, unmapping and
755   realizing the child widgets of containers in
756   gtk_widget_set_parent(). In most cases, this allows container
757   implementations to be simplifid by removing the code in add()
758   methods to map and realize children. However, there are 
759   a couple of things to watch out for here:
760 </para>
761 </listitem>
762
763
764  <listitem>
765 <para>
766 If the parent is realized before the add() happens, 
767      gtk_widget_set_parent_window() must be called before
768      gtk_widget_set_parent(), since gtk_widget_set_parent()
769      will realize the child.
770 </para>
771 </listitem>
772
773  <listitem>
774 <para>
775 If a container depended on its children not being mapped
776      unless it did so itself (for example, GtkNotebook only
777      mapped the current page), then the new function
778      gtk_widget_set_child_visible() must be called to keep
779      widgets that should not be mapped not mapped.
780 </para>
781
782 <para>
783   As part of this change, most containers also will no longer need
784   custom implementations of the map() and unmap() virtual
785   functions. The only cases where this is necessary are:
786
787 <itemizedlist>
788  <listitem>
789 <para>
790 For !NO_WINDOW widgets, if you create children of widget-&gt;window 
791      and don't map them in realize() then you must map them
792      in map(). [ In almost all cases, you can simply map the
793      windows in realize() ]
794 </para>
795 </listitem>
796
797  <listitem>
798 <para>
799 For NO_WINDOW widgets, if you create windows in your realize()
800      method, you must map then in map() and unmap them in unmap().
801 </para>
802 </listitem>
803 </itemizedlist>
804 </para>
805 </listitem>
806
807 <listitem>
808 <para>
809 gtk_widget_set_default_style (), gtk_widget_push_style (),
810   and gtk_widget_pop_style () have been removed, since they
811   did not work properly with themes and there were better
812   alternatives for modifying the appearance of widgets.
813
814   You should generally use gtk_widget_modify_fg/bg/base/text/font
815   instead.
816 </para>
817 </listitem>
818
819   
820 <listitem>
821 <para>
822 gtk_image_new() now takes no arguments and creates an empty GtkImage
823   widget. To create a GtkImage widget from a GdkImage (the least
824   common usage of GdkImage), use gtk_image_new_from_image.
825 </para>
826 </listitem>
827
828 <listitem>
829 <para>
830 GTK_SELECTION_EXTENDED is now deprecated, and neither the
831   GtkList/GtkTree nor the GtkCList/GtkCTree support
832   GTK_SELECTION_EXTENDED anymore.  However, the old extended behavior
833   replaces MULTIPLE behavior.
834 </para>
835 </listitem>
836
837 <listitem>
838 <para>
839 The following variables are no longer exported from GDK. (Other variables
840   are also no longer exported; the following are the ones found used
841   externally in a large sample of GTK+ code.)
842
843 <programlisting>
844    Variable                               Replacement
845    ========                               ===========
846    gdk_null_window_warnings               None - did nothing in GTK+-1.2.
847    gdk_leader_window                      None - private variable
848    gdk_screen                             gdk_x11_get_default_screen ()
849    gdk_root_window                        gdk_x11_get_default_root_xwindow ()
850    gdk_root_parent                        gdk_get_default_root_window ()
851    gdk_error_code/gdk_error_warnings      gdk_error_trap_push()/pop()
852    gdk_display_name                       gdk_get_display ()
853    gdk_wm_delete_window                   gdk_atom_intern ("WM_DELETE_WINDOW", FALSE)
854    gdk_wm_take_focus                      gdk_atom_intern ("WM_TAKE_FOCUS", FALSE)
855    gdk_wm_protocols                       gdk_atom_intern ("WM_PROTOCOLS", FALSE)
856 </programlisting>
857 </para>
858 </listitem>
859    
860
861 <listitem>
862 <para>
863 The handling of Colormaps and widgets has been changed:
864
865 <itemizedlist>
866   <listitem>
867 <para>
868 The default colormap for widgets is now the GdkRGB colormap, not
869       the system default colormap. If you try to use resources created for  
870       a widget (e.g., widget-&gt;style) with a window using the system
871       colormap, errors will result on some machines.
872 </para>
873 </listitem>
874
875
876   <listitem>
877 <para>
878 gtk_widget_push/pop_colormap() only cause the colormap to be
879       explicitely set on toplevel widgets not on all widgets. The
880       colormap for other widgets (when not set using 
881       gtk_widget_set_colormap()), is determined by finding the nearest
882       ancestor with a colormap set on it explicitely, or if that
883       fails, the default colormap.
884 </para>
885 </listitem>
886
887 </itemizedlist>
888
889 </para>
890 </listitem>
891
892
893 <listitem>
894 <para>
895 The default selected day for GtkCalendar is now the current day in the
896   month, not the first day in the month. The current month and year
897   were already used.
898 </para>
899 </listitem>
900
901
902 <listitem>
903 <para>
904 GDK is no longer put into threaded mode automatically when 
905   g_thread_init() has been called. In order to use the 
906   global GDK thread mutex with gdk_threads_enter() and 
907   gdk_threads_leave(), you must call gdk_threads_init() explicitely.
908
909   If you aren't using GDK and GTK+ functions from multiple threads,
910   there is no reason to call gdk_threads_init().
911 </para>
912 </listitem>
913
914 <listitem>
915 <para>
916 The GtkPreviewInfo struct has had its visual and colormap fields
917   removed.  Also, gtk_preview_get_cmap() and gtk_preview_get_visual()
918   are deprecated, as GdkRgb works on any colormap and visual.  You no
919   longer need to gtk_widget_push_cmap (gtk_preview_get_cmap ()) in
920   your code.
921 </para>
922 </listitem>
923
924
925 <listitem>
926 <para>
927 The GtkBox, GtkTable, and GtkAlignment widgets now call
928   gtk_widget_set_redraw_on_allocate (widget, FALSE); on themselves.
929   If you want to actually draw contents in a widget derived from
930   one of these widgets, you'll probably want to change this
931   in your init() function.
932 </para>
933 </listitem>
934
935
936 <listitem>
937 <para>
938 A number of widgets are now NO_WINDOW widgets (most importantly
939   GtkButton, but also GtkRange and GtkNotebook)
940
941   This has a couple of effects:
942
943 <itemizedlist>
944  <listitem>
945 <para>
946 If you are deriving from one of these widgets, you need to
947      adapt your code appropriately -- for instance, drawing coordinates
948      start from widget-&gt;allocation.x, widget-&gt;allocation.y.
949 </para>
950 </listitem>
951
952
953  <listitem>
954 <para>
955 If you are embedding one of these widgets in a custom widget,
956      you must make sure you call gtk_container_propagate_expose()
957      correctly, as you must for any NO_WINDOW widgets.
958 </para>
959 </listitem>
960 </itemizedlist>
961 </para>
962
963 <para>
964   GtkFixed is a little special; it is now created by default as
965   a NO_WINDOW widget, but if you do 
966
967 <programlisting>
968     gtk_fixed_set_has_window (fixed, TRUE);
969 </programlisting>
970
971   after creating a fixed widget, it will create a window and
972   handle it properly.
973 </para>
974 </listitem>
975
976 <listitem>
977 <para>
978 GtkLayout no longer has the xoffset, yoffset fields, which used
979   to store the difference between world and window coordinates for
980   layout-&gt;bin_window. These coordinate systems are now always
981   the same.
982 </para>
983 </listitem>
984
985 <listitem>
986 <para>
987 gtk_paint_focus(), gtk_draw_focus() and GtkStyle::draw_focus()
988   have been changed a bit:
989
990 <itemizedlist>
991  <listitem>
992 <para>
993 A GtkStateType argument has been added to gtk_paint_focus()
994 </para>
995 </listitem>
996
997  <listitem>
998 <para>
999 The default implementation of GtkStyle::draw_focus virtual
1000      function now draws a focus rectangle whose width is 
1001      determinted by the GtkWidget::focus-width style property.
1002 </para>
1003 </listitem>
1004
1005  <listitem>
1006 <para>
1007 The rectangle passed in is the bounding box, instead of
1008      the rectangle used in the gdk_draw_rectangle() call, so it is
1009      no longer necessary to subtract 1 from the width and height.
1010 </para>
1011 </listitem>
1012
1013 </itemizedlist>
1014
1015 </para>
1016 </listitem>
1017
1018
1019 </itemizedlist>
1020
1021 </refsect1>
1022
1023 </refentry>