[maemo-commits] [maemo-commits] r13915 - in projects/haf/trunk/gtk+: . gtk
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Wed Sep 19 15:04:12 EEST 2007
- Previous message: [maemo-commits] r13914 - in projects/haf/trunk/gtk+: . gtk
- Next message: [maemo-commits] r13916 - projects/haf/trunk/hildon-fm/hildon-fm
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: timj Date: 2007-09-19 15:04:03 +0300 (Wed, 19 Sep 2007) New Revision: 13915 Modified: projects/haf/trunk/gtk+/ChangeLog projects/haf/trunk/gtk+/gtk/gtkcontainer.c projects/haf/trunk/gtk+/gtk/gtkcontainer.h projects/haf/trunk/gtk+/gtk/gtkwidget.c Log: 2007-09-19 13:58:27 Tim Janik <timj at imendio.com> * gtk/gtkcontainer.h, gtk/gtkcontainer.c: added _gtk_container_post_size_allocate() for gtkwidget.c to notify containers about size allocation. adjust scroll area around focussed widget for every window after any container got resized. * gtk/gtkwidget.c: call _gtk_container_post_size_allocate() at the end of gtk_widget_size_allocate() to allow containers to adjust to size allocation. Modified: projects/haf/trunk/gtk+/ChangeLog =================================================================== --- projects/haf/trunk/gtk+/ChangeLog 2007-09-19 11:53:51 UTC (rev 13914) +++ projects/haf/trunk/gtk+/ChangeLog 2007-09-19 12:04:03 UTC (rev 13915) @@ -1,3 +1,13 @@ +2007-09-19 13:58:27 Tim Janik <timj at imendio.com> + + * gtk/gtkcontainer.h, gtk/gtkcontainer.c: added _gtk_container_post_size_allocate() + for gtkwidget.c to notify containers about size allocation. + adjust scroll area around focussed widget for every window after any container + got resized. + + * gtk/gtkwidget.c: call _gtk_container_post_size_allocate() at the + end of gtk_widget_size_allocate() to allow containers to adjust to size allocation. + 2007-09-19 Kristian Rietveld <kris at imendio.com> * gtk/gtktreeview.c (gtk_tree_view_maybe_begin_dragging_row): add Modified: projects/haf/trunk/gtk+/gtk/gtkcontainer.c =================================================================== --- projects/haf/trunk/gtk+/gtk/gtkcontainer.c 2007-09-19 11:53:51 UTC (rev 13914) +++ projects/haf/trunk/gtk+/gtk/gtkcontainer.c 2007-09-19 12:04:03 UTC (rev 13915) @@ -1303,6 +1303,18 @@ return GTK_IS_RESIZE_CONTAINER (widget) ? (GtkContainer*) widget : NULL; } +#ifdef MAEMO_CHANGES +static GSList *size_allocated_containers = NULL; +static guint collect_size_allocated_containers = 0; +void +_gtk_container_post_size_allocate (GtkContainer *container) +{ + size_allocated_containers = g_slist_prepend (size_allocated_containers, container); +} + +static void container_scroll_focus_adjustments (GtkContainer *container); +#endif + static gboolean gtk_container_idle_sizer (gpointer data) { @@ -1325,9 +1337,49 @@ g_slist_free_1 (slist); GTK_PRIVATE_UNSET_FLAG (widget, GTK_RESIZE_PENDING); +#ifdef MAEMO_CHANGES + collect_size_allocated_containers++; +#endif gtk_container_check_resize (GTK_CONTAINER (widget)); +#ifdef MAEMO_CHANGES + collect_size_allocated_containers--; +#endif } +#ifdef MAEMO_CHANGES + /* adjust scroll position in all windows that recently resized a container */ + if (collect_size_allocated_containers == 0) + { + GtkWidget *last = NULL; + GSList *current; + /* collect involved toplevels */ + for (current = size_allocated_containers; current; current = current->next) + current->data = gtk_widget_get_toplevel (current->data); + /* sort toplevels to allow deduping */ + size_allocated_containers = g_slist_sort (size_allocated_containers, g_direct_equal); + /* adjust focus position on toplevels */ + for (current = size_allocated_containers; current; current = current->next) + if (last != current->data) /* dedup toplevels */ + { + last = current->data; + if (GTK_IS_WINDOW (current->data)) + { + GtkWidget *focus = GTK_WINDOW (current->data)->focus_widget; + if (focus && !GTK_IS_CONTAINER (focus)) + focus = focus->parent; + while (focus) + { + /* adjust all focus widget parents that could possibly scroll */ + container_scroll_focus_adjustments (GTK_CONTAINER (focus)); + focus = focus->parent; + } + } + } + g_slist_free (size_allocated_containers); + size_allocated_containers = NULL; + } +#endif + gdk_window_process_all_updates (); GDK_THREADS_LEAVE (); @@ -1686,7 +1738,14 @@ g_object_ref (container->focus_child); } +#ifdef MAEMO_CHANGES + container_scroll_focus_adjustments (container); +} +static void +container_scroll_focus_adjustments (GtkContainer *container) +{ +#endif /* check for h/v adjustments */ if (container->focus_child) Modified: projects/haf/trunk/gtk+/gtk/gtkcontainer.h =================================================================== --- projects/haf/trunk/gtk+/gtk/gtkcontainer.h 2007-09-19 11:53:51 UTC (rev 13914) +++ projects/haf/trunk/gtk+/gtk/gtkcontainer.h 2007-09-19 12:04:03 UTC (rev 13915) @@ -156,6 +156,10 @@ GtkAdjustment *adjustment); GtkAdjustment *gtk_container_get_focus_hadjustment (GtkContainer *container); +#ifdef MAEMO_CHANGES +void _gtk_container_post_size_allocate (GtkContainer *container); +#endif + void gtk_container_resize_children (GtkContainer *container); GType gtk_container_child_type (GtkContainer *container); Modified: projects/haf/trunk/gtk+/gtk/gtkwidget.c =================================================================== --- projects/haf/trunk/gtk+/gtk/gtkwidget.c 2007-09-19 11:53:51 UTC (rev 13914) +++ projects/haf/trunk/gtk+/gtk/gtkwidget.c 2007-09-19 12:04:03 UTC (rev 13915) @@ -3419,6 +3419,11 @@ gtk_widget_invalidate_widget_windows (widget->parent, invalidate); gdk_region_destroy (invalidate); } + +#ifdef MAEMO_CHANGES + if (GTK_IS_CONTAINER (widget)) + _gtk_container_post_size_allocate (GTK_CONTAINER (widget)); +#endif } /**
- Previous message: [maemo-commits] r13914 - in projects/haf/trunk/gtk+: . gtk
- Next message: [maemo-commits] r13916 - projects/haf/trunk/hildon-fm/hildon-fm
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]