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