summaryrefslogtreecommitdiff
path: root/gtk/gtkrbtree.c
Commit message (Collapse)AuthorAgeFilesLines
* Don't use g_print for debug outputMatthias Clasen2016-02-281-28/+54
| | | | | | The g_print documentation explicitly says not to do this, since g_print is meant to be redirected by applications. Instead use g_message for logging that can be triggered via GTK_DEBUG.
* gtk: Strip newlines from g_warning and g_errorMatthias Clasen2016-02-281-1/+1
| | | | g_logv adds one for us already.
* Clean up debug featuresMatthias Clasen2015-09-091-30/+30
| | | | | Introduce a GTK_DEBUG_CHECK() macro and use it to check for GTK_DEBUG flags everywhere. Also guard all such places by
* gtk: Make functions static that don't need to be non-staticBenjamin Otte2012-10-021-17/+17
| | | | | | | | Also remove the starting underscore from function names where appropriate, as those functions are static now and not exported anymore. This is part of a bunch of fixes for gcc complaining about -Wmissing-declarations.
* Change FSF AddressJavier Jardón2012-02-271-3/+1
|
* rbtree: Add _gtk_rbtree_contains()Benjamin Otte2011-12-101-0/+25
| | | | It's useful in a bunch of places, so split it out
* rbtree: Rewrite to not lose node orderBenjamin Otte2011-11-221-88/+74
| | | | | | | | _gtk_rbtree_reorder() was moving the node's data while reordering. As we use the node pointer in the a11y code as a hash key, this didn't work. So this rewrite changes that. As a bonus, it is less code and faster. Woohoo!
* rbtree: Remove needless testsBenjamin Otte2011-11-221-8/+8
| | | | | if the checks are run on the nil node, they will get the second test the way we expect it anyway, so it's unnecessary.
* rbtree: Simplify rotation functionsBenjamin Otte2011-11-221-54/+32
| | | | | | - Make sure the rotated nodes aren't nil - Use existing functions for complex computations - Don't use NULL checks for variables guaranteed to not be NULL/nil
* rbtree: Remove the nil memberBenjamin Otte2011-11-221-9/+6
|
* rbtree: Introduce _gtk_rbtree_is_nil()Benjamin Otte2011-11-221-87/+93
| | | | | Makes for more readable code than "== tree->nil" and allows removing the nil member later.
* rbtree: Introduce _gtk_rbtree_first()Benjamin Otte2011-11-221-19/+21
| | | | ... and use it.
* rbtree: Replace nil node allocation with a preallocated nilBenjamin Otte2011-11-221-9/+6
| | | | | | This has one major caveat: The new value is const, so read-only memory. Any attempt to write to it will cause a crash. Note that we are not ever supposed to write to it, but bugs happen...
* rbtree: Don't write to nil nodeBenjamin Otte2011-11-211-11/+10
| | | | | | The code used to set nil->parent, which could cause segfaults. Don't do that. We also need to pass the parent explicitly to the fixup code, because the node during fixup may be the nil node.
* rbtree: Add a local variableBenjamin Otte2011-11-211-19/+23
| | | | | This will be needed in the next patch, and I wanted to split that patch up.
* rbtree: Move to an approach where we don't move contentsBenjamin Otte2011-11-211-24/+41
| | | | | | | | | | So instead of copying the children and height to the new node, we keep the old node and copy all the old stuff to it. This is necessary so the accessibility code can use the node as a key in the hash table or store the node as a reference to the row instead of GtkTreeRowReference. And because it already does that (oops), this fixes a bunch of segfaults with a11y enabled.
* rbtree: Use gtk_rbnode_adjust() even moreBenjamin Otte2011-11-211-27/+15
| | | | | Use it for the modified node in gtk_rbnode_remove(). Cleans up the code quite a lot.
* rbtree: Use gtk_rbnode_adjust()Benjamin Otte2011-11-211-41/+3
| | | | Make gtk_rbnode_remove() use it when unlinking the node.
* rbtree: Use gtk_rbnode_adjust() more.Benjamin Otte2011-11-211-12/+2
| | | | Make _gtk_rbtree_node_set_height() use it.
* rbtree: Use gtk_rbnode_adjust() moreBenjamin Otte2011-11-211-23/+4
| | | | Make _gtk_rbtree_insert_before() use it.
* rbtree: Use gtk_rbnode_adjust()Benjamin Otte2011-11-211-23/+4
| | | | Make _gtk_rbtree_insert_after() use it.
* rbtree: Split out a common functionBenjamin Otte2011-11-211-22/+33
| | | | | | gtk_rbtree_adjust() will adjust the summed values of a node and all its parents in the tree. Currently only implemented by splitting out the function from gtk_rbtree_free().
* rbtree: Don't set variable twiceBenjamin Otte2011-11-211-1/+0
|
* rbtree: Add assertions to clarify usageBenjamin Otte2011-11-211-0/+2
|
* rbtree: Mark all debug sections as debugBenjamin Otte2011-11-211-0/+2
|
* rbtree: Make debug functions privateBenjamin Otte2011-11-211-2/+7
| | | | They're not used elsewhere
* treeview: Add _gtk_rbtree_node_get_index()Benjamin Otte2011-11-161-5/+5
| | | | | | | .. as a replacement for _gtk_rbtree_node_find_parity(). Instead of 1 or 0, the function now returns the index of node in the complete tree (counting from the root). And this is of course identical to the row number.
* treeview: Add _gtk_rbtree_find_index()Benjamin Otte2011-11-161-0/+50
| | | | | Uses the parity to do an O(log N) search for the nth element in the tree in display order of the treeview.
* treeview: Rename "parity" to "total_count"Benjamin Otte2011-11-161-53/+44
| | | | | Now that we use it to actually count the rows instead of just even/odd, it's better to reflect that in the variable name.
* treeview: Make the parity actually store the row numberBenjamin Otte2011-11-161-16/+7
| | | | | | Instead of just storing the least significant bit of the row number, store the full row number. This will soon be useful for accessibility. But CSS could like it, too.
* treeview: Remove special cases when computing parityBenjamin Otte2011-11-161-3/+2
| | | | | The parity of the nil npode is always 0, so no need to check for the nil node first.
* Replace gtk_debug_flags with getter and setter functionsTor Lillqvist2010-09-081-11/+11
| | | | | | Preferrably should be made just into a local variable for libgtk like _gdk_debug_flags for libgdk. But for now used by gtk/tests/textbuffer.c and modules/printbackends/cups/gtkprintbackendcups.c.
* gtk/: fully remove gtkalias hacksJavier Jardón2010-07-101-1/+0
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=623845
* Fix compilation warning: move function to proper locationJavier Jardón2010-04-121-22/+20
| | | | | Move _count_nodes() auxiliar function inside the G_ENABLE_DEBUG define, where other auxiliar functions are.
* Include "config.h" instead of <config.h> Command used: find -nameJohan Dahlin2008-06-221-1/+1
| | | | | | | | | | | | 2008-06-21 Johan Dahlin <jdahlin@async.com.br> * *.[ch]: Include "config.h" instead of <config.h> Command used: find -name \*.[ch]|xargs perl -p -i -e 's/^#include <config.h>/#include "config.h"/g' Rubberstamped by Mitch and Tim svn path=/trunk/; revision=20669
* Apply a cleanup patch by Kjartan Maraas (#341812)Matthias Clasen2006-10-081-1/+1
| | | | | | 2006-10-08 Matthias Clasen <mclasen@redhat.com> * Apply a cleanup patch by Kjartan Maraas (#341812)
* Fix several g_new() calls which were using extra indirections or pointlessMatthias Clasen2006-01-181-1/+1
| | | | | | | | | 2006-01-18 Matthias Clasen <mclasen@redhat.com> * gtk/gtkrbtree.c: * gtk/gtktreemodel.c: Fix several g_new() calls which were using extra indirections or pointless casts. (#327423, Morten Welinder)
* get rid of GAllocator usage, allocate and free nodes via the g_slice_*()Tim Janik2005-11-011-102/+4
| | | | | | | | Tue Nov 1 16:18:24 2005 Tim Janik <timj@imendio.com> * gtk/gtkrbtree.[hc]: get rid of GAllocator usage, allocate and free nodes via the g_slice_*() API. _gtk_rbtree_new(): fixed wrong node allocation via g_new().
* Various cleanups. (#315360, Kjartan Maraas)Matthias Clasen2005-09-131-2/+0
| | | | | | 2005-09-13 Matthias Clasen <mclasen@redhat.com> * gtk/*.c: Various cleanups. (#315360, Kjartan Maraas)
* Fixes #165034, reported by Jorn Baayen.Kristian Rietveld2005-07-081-3/+8
| | | | | | | | | | | | | | | | | | 2005-07-08 Kristian Rietveld <kris@gtk.org> Fixes #165034, reported by Jorn Baayen. * gtk/gtkrbtree.[ch] (_gtk_rbtree_set_fixed_height): add a mark_valid parameter (so we can mark all nodes as valid when we are setting them to the fixed height). * gtk/gtktreeview.c (initialized_fixed_height_mode): mark all nodes as valid when setting the fixed height, (do_validate_rows): update call to _set_fixed_height, (gtk_tree_view_row_inserted): mark node as valid when fixed height mode is enabled and a height has been set, (gtk_tree_view_build_tree): if fixed height mode is enabled, mark new nodes as valid in addition to setting the height.
* Make PLT-reduction work with gcc4, and don't include everything inMatthias Clasen2005-03-201-1/+1
| | | | | | | | | | | | | | | | | | 2005-03-20 Matthias Clasen <mclasen@redhat.com> Make PLT-reduction work with gcc4, and don't include everything in gdkalias.h: * gtk/grk.symbols: Group symbols by header and source file. * gtk/makegtkalias.pl: Protect definitions by the same preprocessor symbols used to guard the headers. Move the alias declarations to a separate file which is produced when calling makegtkalias.pl -def * gdk/Makefile.am (gtkaliasdef.c): Add a rule to generate this file. * gtk/*.c: Include gtkalias.h after the other headers, include gtkaliasdef.c at the bottom. * gtk/*.h: Small cleanups.
* Fix many sparse warnings.Matthias Clasen2004-10-281-1/+1
|
* Add hidden aliases for exported symbols which are used internally in orderMatthias Clasen2004-08-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Mon Aug 9 12:48:04 2004 Matthias Clasen <maclas@gmx.de> Add hidden aliases for exported symbols which are used internally in order to get rid of many PLT entries. (#145519, Arjan van de Ven) * gtk/Makefile.am: Add rules to generate gtk.def and from gtk.symbols, and make make check check the abi with abicheck.sh. (gtk_private_h_sources): Add gtkinternals.h (gtk_built_private_headers): Add gtkalias.h (gtk_extra_sources): Add gtk.symbols (EXTRA_DIST): Add makegtkalias.pl and abicheck.sh * gtk/gtk.symbols: New file. Definition of the GTK+ ABI. The file can be processed by cpp to filter out certain subsets of symbols. * gtk/abicheck.sh: New file. Script to check the actually symbols exported from libgtk-x11.2.0.so against the symbols found in gtk.symbols. * gtk/makegtkalias.pl: New file. Perl script to generate the header containing the alias definitions for internally used exported symbols from a list of symbols. * gtk/gtkinternals.h: New file. An uninstalled header listing symbols which must be exported for some reason and do not appear in any other header. * gtk/*.c: Include gtkalias.h
* Fixes #136082 and #135265, patch by Morten Welinder.Federico Mena Quintero2004-03-061-0/+1
| | | | | | | | | | 2004-03-05 Federico Mena Quintero <federico@ximian.com> Fixes #136082 and #135265, patch by Morten Welinder. * configure.in: Use AC_SYS_LARGEFILE. * */*.c: #include <config.h>
* null initialize reorder's members so Purify won't complain.Jonathan Blandford2003-03-311-1/+1
| | | | | | | Mon Mar 31 13:52:13 2003 Jonathan Blandford <jrb@redhat.com> * gtk/gtkrbtree.c (_gtk_rbtree_reorder): null initialize reorder's members so Purify won't complain.
* return a value in the range of [-1, 1] instead [0, 1],Kristian Rietveld2002-11-201-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Wed Nov 20 19:29:50 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtkrbtree.c (gtk_rbtree_reorder_sort_func): return a value in the range of [-1, 1] instead [0, 1], (gtk_rbtree_reorder_invert_func): ditto, This makes treeview reordering working on platforms as FreeBSD and solaris, thanks go to Heiner Eichmann for finding this out and sending in a patch (#98251). Wed Nov 20 19:27:07 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtktreestore.c (node_free): only free the data list if node->data is not NULL, (gtk_tree_store_remove): free the data list from the node if needed. (#94728, pointed out by Peter Bloomfield). Wed Nov 20 19:23:13 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtktreeview.c (gtk_tree_view_remove_column): stop editing and set the edited_column to NULL if edited_column is set. (#91288, modified patch from Josh Parsons). Wed Nov 20 19:20:34 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtktreeview.c (gtk_tree_view_size_allocate): do a full redraw if vadjustment->value is bigger than tree_view->priv->height, (gtk_tree_view_row_deleted): free the row ref if it isn't valid anymore. (#83726, reported by Robert Kinsella).
* don't leak the GArray (figured out by Matthias Clasen, fixes #82026).Kristian Rietveld2002-06-061-0/+2
| | | | | | | Thu Jun 6 17:27:01 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtkrbtree.c (_gtk_rbtree_reorder): don't leak the GArray (figured out by Matthias Clasen, fixes #82026).
* include missing #ifdef G_ENA\BLE_DEBUGJonathan Blandford2002-05-161-1/+9
| | | | | | Thu May 16 17:29:08 2002 Jonathan Blandford <jrb@redhat.com> * gtk/gtkrbtree.c (_gtk_rbtree_remove): include missing #ifdef G_ENA\BLE_DEBUG
* Fixes for #78258Owen Taylor2002-05-161-8/+24
| | | | | | | | | | | | | | | | Thu May 16 14:51:14 2002 Owen Taylor <otaylor@redhat.com> Fixes for #78258 * gtk/gtkrbtree.c demos/gtk-demo/editable-cells.c: Fix some 64-bit warning problems. (Patch from Matthias Clasen.) * gtk/gtkrbtree.c (_gtk_rbtree_debug_spew_helper): Surround a bunch of debug code with G_ENABLE_DEBUG. * configure.in demos/gtk-demo/main.c: Replace #ifndef G_OS_WIN32 with proper #ifdef HAVE_FLOCKFILE.
* add _gtk_rbtree_set_fixed_height()Kristian Rietveld2002-03-201-0/+26
| | | | | | | | | | | | | | | | | Wed Mar 20 22:59:23 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtkrbtree.[ch]: add _gtk_rbtree_set_fixed_height() * gtk/gtktreeprivate.h: add fixed_height_check field * gtk/gtktreeview.c (gtk_tree_view_init): initialize scroll_sync_timer and fixed_height_check (do_validate_rows): add fixed_height_check. If all validated rows in the first cycle have the same height, then we set that height for the entire tree. This is some sort of 'fake' optimization, but helps a lot for the common case. We keep validating the entire tree in the background though. (gtk_tree_view_set_model): reset fixed_height_check