summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@src.gnome.org>1998-05-01 04:23:59 +0000
committerOwen Taylor <otaylor@src.gnome.org>1998-05-01 04:23:59 +0000
commit05bc6a5b3639869eee69cfa4a2db8b8968b247cb (patch)
tree58bad8f48d24c88dfc95206defe79dd0464256f6 /gtk
parente909f843f8e2949144e624ce1af4fd1737396f62 (diff)
downloadgdk-pixbuf-05bc6a5b3639869eee69cfa4a2db8b8968b247cb.tar.gz
Merged changes from gtk-1-0. Check ChangeLog for details.
Diffstat (limited to 'gtk')
-rw-r--r--gtk/Makefile.am1
-rw-r--r--gtk/gtkadjustment.c34
-rw-r--r--gtk/gtkadjustment.h39
-rw-r--r--gtk/gtkbin.c34
-rw-r--r--gtk/gtkbox.c2
-rw-r--r--gtk/gtkclist.c8
-rw-r--r--gtk/gtkcombo.c5
-rw-r--r--gtk/gtkcontainer.c68
-rw-r--r--gtk/gtkcontainer.h99
-rw-r--r--gtk/gtkfilesel.c22
-rw-r--r--gtk/gtkfixed.c4
-rw-r--r--gtk/gtklist.c141
-rw-r--r--gtk/gtklist.h74
-rw-r--r--gtk/gtkobject.c57
-rw-r--r--gtk/gtkpaned.c8
-rw-r--r--gtk/gtkpixmap.c12
-rw-r--r--gtk/gtkrc.c76
-rw-r--r--gtk/gtkscrolledwindow.c94
-rw-r--r--gtk/gtkscrolledwindow.h2
-rw-r--r--gtk/gtkselection.c17
-rw-r--r--gtk/gtkstyle.c2
-rw-r--r--gtk/gtktable.c4
-rw-r--r--gtk/gtktree.c19
-rw-r--r--gtk/gtktreeitem.c33
-rw-r--r--gtk/gtkwidget.c46
-rw-r--r--gtk/gtkwidget.h2
-rw-r--r--gtk/testgtk.c103
-rw-r--r--gtk/testgtkrc20
-rw-r--r--gtk/testgtkrc221
29 files changed, 705 insertions, 342 deletions
diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index 668a428ff..d0b99fcf2 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -203,6 +203,7 @@ EXTRA_DIST = \
line-arrow.xbm \
line-wrap.xbm \
testgtkrc \
+ testgtkrc2 \
gtk.defs \
runelisp \
gentypeinfo.el \
diff --git a/gtk/gtkadjustment.c b/gtk/gtkadjustment.c
index 40de518a8..37b2aa346 100644
--- a/gtk/gtkadjustment.c
+++ b/gtk/gtkadjustment.c
@@ -34,10 +34,10 @@ static void gtk_adjustment_init (GtkAdjustment *adjustment);
static guint adjustment_signals[LAST_SIGNAL] = { 0 };
-guint
+GtkType
gtk_adjustment_get_type ()
{
- static guint adjustment_type = 0;
+ static GtkType adjustment_type = 0;
if (!adjustment_type)
{
@@ -130,3 +130,33 @@ gtk_adjustment_set_value (GtkAdjustment *adjustment,
gtk_signal_emit_by_name (GTK_OBJECT (adjustment), "value_changed");
}
+
+void
+gtk_adjustment_clamp_page (GtkAdjustment *adjustment,
+ gfloat lower,
+ gfloat upper)
+{
+ gint need_emission;
+
+ g_return_if_fail (adjustment != NULL);
+ g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
+
+ lower = CLAMP (lower, adjustment->lower, adjustment->upper);
+ upper = CLAMP (upper, adjustment->lower, adjustment->upper);
+
+ need_emission = FALSE;
+
+ if (adjustment->value + adjustment->page_size < upper)
+ {
+ adjustment->value = upper - adjustment->page_size;
+ need_emission = TRUE;
+ }
+ if (adjustment->value > lower)
+ {
+ adjustment->value = lower;
+ need_emission = TRUE;
+ }
+
+ if (need_emission)
+ gtk_signal_emit_by_name (GTK_OBJECT (adjustment), "value_changed");
+}
diff --git a/gtk/gtkadjustment.h b/gtk/gtkadjustment.h
index 1e53a31e1..75caf47e8 100644
--- a/gtk/gtkadjustment.h
+++ b/gtk/gtkadjustment.h
@@ -8,7 +8,7 @@
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
@@ -26,21 +26,22 @@
#ifdef __cplusplus
extern "C" {
+#pragma }
#endif /* __cplusplus */
-#define GTK_ADJUSTMENT(obj) GTK_CHECK_CAST (obj, gtk_adjustment_get_type (), GtkAdjustment)
-#define GTK_ADJUSTMENT_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_adjustment_get_type (), GtkAdjustmentClass)
-#define GTK_IS_ADJUSTMENT(obj) GTK_CHECK_TYPE (obj, gtk_adjustment_get_type ())
+#define GTK_ADJUSTMENT(obj) (GTK_CHECK_CAST (obj, gtk_adjustment_get_type (), GtkAdjustment))
+#define GTK_ADJUSTMENT_CLASS(klass) (GTK_CHECK_CLASS_CAST (klass, gtk_adjustment_get_type (), GtkAdjustmentClass))
+#define GTK_IS_ADJUSTMENT(obj) (GTK_CHECK_TYPE (obj, gtk_adjustment_get_type ()))
-typedef struct _GtkAdjustment GtkAdjustment;
+typedef struct _GtkAdjustment GtkAdjustment;
typedef struct _GtkAdjustmentClass GtkAdjustmentClass;
struct _GtkAdjustment
{
GtkData data;
-
+
gfloat lower;
gfloat upper;
gfloat value;
@@ -52,21 +53,25 @@ struct _GtkAdjustment
struct _GtkAdjustmentClass
{
GtkDataClass parent_class;
-
- void (* changed) (GtkAdjustment *adjustment);
+
+ void (* changed) (GtkAdjustment *adjustment);
void (* value_changed) (GtkAdjustment *adjustment);
};
-guint gtk_adjustment_get_type (void);
-GtkObject* gtk_adjustment_new (gfloat value,
- gfloat lower,
- gfloat upper,
- gfloat step_increment,
- gfloat page_increment,
- gfloat page_size);
-void gtk_adjustment_set_value (GtkAdjustment *adjustment,
- gfloat value);
+GtkType gtk_adjustment_get_type (void);
+GtkObject* gtk_adjustment_new (gfloat value,
+ gfloat lower,
+ gfloat upper,
+ gfloat step_increment,
+ gfloat page_increment,
+ gfloat page_size);
+void gtk_adjustment_set_value (GtkAdjustment *adjustment,
+ gfloat value);
+void gtk_adjustment_clamp_page (GtkAdjustment *adjustment,
+ gfloat lower,
+ gfloat upper);
+
diff --git a/gtk/gtkbin.c b/gtk/gtkbin.c
index 4e7b56e14..c1e07766d 100644
--- a/gtk/gtkbin.c
+++ b/gtk/gtkbin.c
@@ -200,27 +200,25 @@ gtk_bin_add (GtkContainer *container,
g_return_if_fail (widget != NULL);
bin = GTK_BIN (container);
+ g_return_if_fail (bin->child == NULL);
- if (!bin->child)
+ gtk_widget_set_parent (widget, GTK_WIDGET (container));
+
+ if (GTK_WIDGET_VISIBLE (widget->parent))
{
- gtk_widget_set_parent (widget, GTK_WIDGET (container));
-
- if (GTK_WIDGET_VISIBLE (widget->parent))
- {
- if (GTK_WIDGET_REALIZED (widget->parent) &&
- !GTK_WIDGET_REALIZED (widget))
- gtk_widget_realize (widget);
-
- if (GTK_WIDGET_MAPPED (widget->parent) &&
- !GTK_WIDGET_MAPPED (widget))
- gtk_widget_map (widget);
- }
-
- bin->child = widget;
-
- if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (container))
- gtk_widget_queue_resize (widget);
+ if (GTK_WIDGET_REALIZED (widget->parent) &&
+ !GTK_WIDGET_REALIZED (widget))
+ gtk_widget_realize (widget);
+
+ if (GTK_WIDGET_MAPPED (widget->parent) &&
+ !GTK_WIDGET_MAPPED (widget))
+ gtk_widget_map (widget);
}
+
+ bin->child = widget;
+
+ if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (container))
+ gtk_widget_queue_resize (widget);
}
static void
diff --git a/gtk/gtkbox.c b/gtk/gtkbox.c
index 58891217f..0a58ca046 100644
--- a/gtk/gtkbox.c
+++ b/gtk/gtkbox.c
@@ -160,6 +160,7 @@ gtk_box_pack_start (GtkBox *box,
g_return_if_fail (box != NULL);
g_return_if_fail (GTK_IS_BOX (box));
g_return_if_fail (child != NULL);
+ g_return_if_fail (child->parent == NULL);
child_info = g_new (GtkBoxChild, 1);
child_info->widget = child;
@@ -199,6 +200,7 @@ gtk_box_pack_end (GtkBox *box,
g_return_if_fail (box != NULL);
g_return_if_fail (GTK_IS_BOX (box));
g_return_if_fail (child != NULL);
+ g_return_if_fail (child->parent == NULL);
child_info = g_new (GtkBoxChild, 1);
child_info->widget = child;
diff --git a/gtk/gtkclist.c b/gtk/gtkclist.c
index 3ef3659de..2f4686592 100644
--- a/gtk/gtkclist.c
+++ b/gtk/gtkclist.c
@@ -2495,7 +2495,7 @@ draw_row (GtkCList * clist,
{
if (gdk_rectangle_intersect (area, &cell_rectangle, &intersect_rectangle))
gdk_draw_rectangle (clist->clist_window,
- widget->style->white_gc,
+ widget->style->base_gc[GTK_STATE_NORMAL],
TRUE,
intersect_rectangle.x,
intersect_rectangle.y,
@@ -2509,7 +2509,7 @@ draw_row (GtkCList * clist,
if (gdk_rectangle_intersect (area, &cell_rectangle, &intersect_rectangle))
gdk_draw_rectangle (clist->clist_window,
- widget->style->white_gc,
+ widget->style->base_gc[GTK_STATE_NORMAL],
TRUE,
intersect_rectangle.x,
intersect_rectangle.y,
@@ -2538,7 +2538,7 @@ draw_row (GtkCList * clist,
else
{
gdk_draw_rectangle (clist->clist_window,
- widget->style->white_gc,
+ widget->style->base_gc[GTK_STATE_NORMAL],
TRUE,
cell_rectangle.x,
cell_rectangle.y,
@@ -2551,7 +2551,7 @@ draw_row (GtkCList * clist,
cell_rectangle.y += clist->row_height + CELL_SPACING;
gdk_draw_rectangle (clist->clist_window,
- widget->style->white_gc,
+ widget->style->base_gc[GTK_STATE_NORMAL],
TRUE,
cell_rectangle.x,
cell_rectangle.y,
diff --git a/gtk/gtkcombo.c b/gtk/gtkcombo.c
index a22c654cc..7ca02840c 100644
--- a/gtk/gtkcombo.c
+++ b/gtk/gtkcombo.c
@@ -494,12 +494,15 @@ gtk_combo_button_release (GtkWidget * widget, GdkEvent * event, GtkCombo * combo
GDK_BUTTON_RELEASE_MASK |
GDK_POINTER_MOTION_MASK,
NULL, NULL, GDK_CURRENT_TIME);
-
return FALSE;
}
}
else
{
+ /* Don't remove the popwin when the user adjusts the scrollbats */
+ if (!(GTK_LIST (combo->list)->button))
+ return FALSE;
+
gtk_grab_remove (combo->popwin);
gdk_pointer_ungrab (event->button.time);
}
diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c
index 1e672724a..ec2f86954 100644
--- a/gtk/gtkcontainer.c
+++ b/gtk/gtkcontainer.c
@@ -110,10 +110,15 @@ static guint container_signals[LAST_SIGNAL] = { 0 };
static GtkWidgetClass *parent_class = NULL;
-guint
+static const gchar *vadjustment_key = "gtk-vadjustment";
+static guint vadjustment_key_id = 0;
+static const gchar *hadjustment_key = "gtk-hadjustment";
+static guint hadjustment_key_id = 0;
+
+GtkType
gtk_container_get_type ()
{
- static guint container_type = 0;
+ static GtkType container_type = 0;
if (!container_type)
{
@@ -142,7 +147,11 @@ gtk_container_class_init (GtkContainerClass *class)
object_class = (GtkObjectClass*) class;
widget_class = (GtkWidgetClass*) class;
+
parent_class = gtk_type_class (gtk_widget_get_type ());
+
+ vadjustment_key_id = gtk_object_data_force_id (vadjustment_key);
+ hadjustment_key_id = gtk_object_data_force_id (hadjustment_key);
gtk_object_add_arg_type ("GtkContainer::border_width", GTK_TYPE_LONG, GTK_ARG_READWRITE, ARG_BORDER_WIDTH);
gtk_object_add_arg_type ("GtkContainer::auto_resize", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_AUTO_RESIZE);
@@ -608,6 +617,7 @@ gtk_real_container_focus (GtkContainer *container,
GList *tmp_list;
GList *tmp_list2;
gint return_val;
+ GtkAdjustment *adjustment;
g_return_val_if_fail (container != NULL, FALSE);
g_return_val_if_fail (GTK_IS_CONTAINER (container), FALSE);
@@ -669,6 +679,25 @@ gtk_real_container_focus (GtkContainer *container,
}
}
+ /* check for h/v adjustments
+ */
+ if (container->focus_child)
+ {
+ adjustment = gtk_object_get_data_by_id (GTK_OBJECT (container), vadjustment_key_id);
+ if (adjustment)
+ gtk_adjustment_clamp_page (adjustment,
+ container->focus_child->allocation.y,
+ (container->focus_child->allocation.y +
+ container->focus_child->allocation.height));
+
+ adjustment = gtk_object_get_data_by_id (GTK_OBJECT (container), hadjustment_key_id);
+ if (adjustment)
+ gtk_adjustment_clamp_page (adjustment,
+ container->focus_child->allocation.x,
+ (container->focus_child->allocation.x +
+ container->focus_child->allocation.width));
+ }
+
return return_val;
}
@@ -1059,3 +1088,38 @@ gtk_container_hide_all (GtkWidget *widget)
gtk_container_foreach (container, (GtkCallback) gtk_widget_hide_all, NULL);
}
+void
+gtk_container_set_focus_vadjustment (GtkContainer *container,
+ GtkAdjustment *adjustment)
+{
+ g_return_if_fail (container != NULL);
+ g_return_if_fail (GTK_IS_CONTAINER (container));
+ if (adjustment)
+ g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
+
+ if (adjustment)
+ gtk_object_ref (adjustment);
+
+ gtk_object_set_data_by_id_full (GTK_OBJECT (container),
+ vadjustment_key_id,
+ adjustment,
+ (GtkDestroyNotify) gtk_object_unref);
+}
+
+void
+gtk_container_set_focus_hadjustment (GtkContainer *container,
+ GtkAdjustment *adjustment)
+{
+ g_return_if_fail (container != NULL);
+ g_return_if_fail (GTK_IS_CONTAINER (container));
+ if (adjustment)
+ g_return_if_fail (GTK_IS_ADJUSTMENT (adjustment));
+
+ if (adjustment)
+ gtk_object_ref (adjustment);
+
+ gtk_object_set_data_by_id_full (GTK_OBJECT (container),
+ hadjustment_key_id,
+ adjustment,
+ (GtkDestroyNotify) gtk_object_unref);
+}
diff --git a/gtk/gtkcontainer.h b/gtk/gtkcontainer.h
index 178c79a29..a07a8b9f1 100644
--- a/gtk/gtkcontainer.h
+++ b/gtk/gtkcontainer.h
@@ -8,7 +8,7 @@
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
@@ -23,34 +23,36 @@
#include <gdk/gdk.h>
#include <gtk/gtkenums.h>
#include <gtk/gtkwidget.h>
+#include <gtk/gtkadjustment.h>
#ifdef __cplusplus
extern "C" {
+#pragma }
#endif /* __cplusplus */
-#define GTK_CONTAINER(obj) (GTK_CHECK_CAST ((obj), gtk_container_get_type (), GtkContainer))
+#define GTK_CONTAINER(obj) (GTK_CHECK_CAST ((obj), gtk_container_get_type (), GtkContainer))
#define GTK_CONTAINER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), gtk_container_get_type (), GtkContainerClass))
-#define GTK_IS_CONTAINER(obj) (GTK_CHECK_TYPE ((obj), gtk_container_get_type ()))
+#define GTK_IS_CONTAINER(obj) (GTK_CHECK_TYPE ((obj), gtk_container_get_type ()))
-#define GTK_TYPE_CONTAINER (gtk_container_get_type ())
+#define GTK_TYPE_CONTAINER (gtk_container_get_type ())
-typedef struct _GtkContainer GtkContainer;
+typedef struct _GtkContainer GtkContainer;
typedef struct _GtkContainerClass GtkContainerClass;
struct _GtkContainer
{
GtkWidget widget;
-
+
GtkWidget *focus_child;
-
+
gint16 border_width;
guint auto_resize : 1;
guint need_resize : 1;
guint block_resize : 1;
-
-
+
+
/* The list of children that requested a resize
*/
GSList *resize_widgets;
@@ -59,52 +61,59 @@ struct _GtkContainer
struct _GtkContainerClass
{
GtkWidgetClass parent_class;
-
- void (* add) (GtkContainer *container,
- GtkWidget *widget);
- void (* remove) (GtkContainer *container,
- GtkWidget *widget);
- gint (* need_resize) (GtkContainer *container);
- void (* foreach) (GtkContainer *container,
- GtkCallback callback,
- gpointer callbabck_data);
- gint (* focus) (GtkContainer *container,
+
+ void (* add) (GtkContainer *container,
+ GtkWidget *widget);
+ void (* remove) (GtkContainer *container,
+ GtkWidget *widget);
+ gint (* need_resize) (GtkContainer *container);
+ void (* foreach) (GtkContainer *container,
+ GtkCallback callback,
+ gpointer callbabck_data);
+ gint (* focus) (GtkContainer *container,
GtkDirectionType direction);
};
-guint gtk_container_get_type (void);
-void gtk_container_border_width (GtkContainer *container,
- gint border_width);
-void gtk_container_add (GtkContainer *container,
- GtkWidget *widget);
-void gtk_container_remove (GtkContainer *container,
- GtkWidget *widget);
-void gtk_container_disable_resize (GtkContainer *container);
-void gtk_container_enable_resize (GtkContainer *container);
-void gtk_container_block_resize (GtkContainer *container);
-void gtk_container_unblock_resize (GtkContainer *container);
-gint gtk_container_need_resize (GtkContainer *container);
-void gtk_container_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data);
-void gtk_container_foreach_interp (GtkContainer *container,
+GtkType gtk_container_get_type (void);
+void gtk_container_border_width (GtkContainer *container,
+ gint border_width);
+void gtk_container_add (GtkContainer *container,
+ GtkWidget *widget);
+void gtk_container_remove (GtkContainer *container,
+ GtkWidget *widget);
+void gtk_container_disable_resize (GtkContainer *container);
+void gtk_container_enable_resize (GtkContainer *container);
+void gtk_container_block_resize (GtkContainer *container);
+void gtk_container_unblock_resize (GtkContainer *container);
+gint gtk_container_need_resize (GtkContainer *container);
+void gtk_container_foreach (GtkContainer *container,
+ GtkCallback callback,
+ gpointer callback_data);
+void gtk_container_foreach_interp (GtkContainer *container,
GtkCallbackMarshal marshal,
- gpointer callback_data,
+ gpointer callback_data,
GtkDestroyNotify notify);
-void gtk_container_foreach_full (GtkContainer *container,
- GtkCallback callback,
+void gtk_container_foreach_full (GtkContainer *container,
+ GtkCallback callback,
GtkCallbackMarshal marshal,
- gpointer callback_data,
+ gpointer callback_data,
GtkDestroyNotify notify);
-gint gtk_container_focus (GtkContainer *container,
- GtkDirectionType direction);
-GList* gtk_container_children (GtkContainer *container);
+GList* gtk_container_children (GtkContainer *container);
+void gtk_container_register_toplevel (GtkContainer *container);
+void gtk_container_unregister_toplevel (GtkContainer *container);
+gint gtk_container_focus (GtkContainer *container,
+ GtkDirectionType direction);
+void gtk_container_set_focus_vadjustment (GtkContainer *container,
+ GtkAdjustment *adjustment);
+void gtk_container_set_focus_hadjustment (GtkContainer *container,
+ GtkAdjustment *adjustment);
+
+
+
+
-void gtk_container_register_toplevel (GtkContainer *container);
-void gtk_container_unregister_toplevel (GtkContainer *container);
-
#ifdef __cplusplus
}
diff --git a/gtk/gtkfilesel.c b/gtk/gtkfilesel.c
index e1e7d4998..376ef764c 100644
--- a/gtk/gtkfilesel.c
+++ b/gtk/gtkfilesel.c
@@ -1436,7 +1436,13 @@ cmpl_last_valid_char (CompletionState* cmpl_state)
static gchar*
cmpl_completion_fullname (gchar* text, CompletionState* cmpl_state)
{
- if (text[0] == '/')
+ static char nothing[2] = "";
+
+ if (!cmpl_state_okay (cmpl_state))
+ {
+ return nothing;
+ }
+ else if (text[0] == '/')
{
strcpy (cmpl_state->updated_text, text);
}
@@ -1515,10 +1521,14 @@ cmpl_init_state (void)
if (!getcwd (getcwd_buf, MAXPATHLEN))
#endif
{
- cmpl_errno = errno;
- return NULL;
+ /* Oh joy, we can't get the current directory. Um..., we should have
+ * a root directory, right? Right? (Probably not portable to non-Unix)
+ */
+ strcpy (getcwd_buf, "/");
}
+tryagain:
+
new_state->reference_dir = NULL;
new_state->completion_dir = NULL;
new_state->active_completion_dir = NULL;
@@ -1542,7 +1552,11 @@ cmpl_init_state (void)
new_state->reference_dir = open_dir (getcwd_buf, new_state);
if (!new_state->reference_dir)
- return NULL;
+ {
+ /* Directories changing from underneath us, grumble */
+ strcpy (getcwd_buf, "/");
+ goto tryagain;
+ }
return new_state;
}
diff --git a/gtk/gtkfixed.c b/gtk/gtkfixed.c
index ace355816..e598f687a 100644
--- a/gtk/gtkfixed.c
+++ b/gtk/gtkfixed.c
@@ -437,13 +437,15 @@ gtk_fixed_remove (GtkContainer *container,
if (child->widget == widget)
{
+ gboolean was_visible = GTK_WIDGET_VISIBLE (widget);
+
gtk_widget_unparent (widget);
fixed->children = g_list_remove_link (fixed->children, children);
g_list_free (children);
g_free (child);
- if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (container))
+ if (was_visible && GTK_WIDGET_VISIBLE (container))
gtk_widget_queue_resize (GTK_WIDGET (container));
break;
diff --git a/gtk/gtklist.c b/gtk/gtklist.c
index e76ff51e4..56ba0c8e1 100644
--- a/gtk/gtklist.c
+++ b/gtk/gtklist.c
@@ -8,7 +8,7 @@
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
@@ -31,54 +31,54 @@ enum {
typedef void (*GtkListSignal) (GtkObject *object,
- gpointer arg1,
- gpointer data);
+ gpointer arg1,
+ gpointer data);
-static void gtk_list_class_init (GtkListClass *klass);
-static void gtk_list_init (GtkList *list);
-static void gtk_list_destroy (GtkObject *object);
-static void gtk_list_map (GtkWidget *widget);
-static void gtk_list_unmap (GtkWidget *widget);
-static void gtk_list_realize (GtkWidget *widget);
-static void gtk_list_draw (GtkWidget *widget,
+static void gtk_list_class_init (GtkListClass *klass);
+static void gtk_list_init (GtkList *list);
+static void gtk_list_destroy (GtkObject *object);
+static void gtk_list_map (GtkWidget *widget);
+static void gtk_list_unmap (GtkWidget *widget);
+static void gtk_list_realize (GtkWidget *widget);
+static void gtk_list_draw (GtkWidget *widget,
GdkRectangle *area);
-static gint gtk_list_expose (GtkWidget *widget,
+static gint gtk_list_expose (GtkWidget *widget,
GdkEventExpose *event);
static gint gtk_list_enter_notify (GtkWidget *widget,
GdkEventCrossing *event);
static gint gtk_list_button_press (GtkWidget *widget,
GdkEventButton *event);
-static gint gtk_list_button_release (GtkWidget *widget,
+static gint gtk_list_button_release (GtkWidget *widget,
GdkEventButton *event);
-static void gtk_list_size_request (GtkWidget *widget,
+static void gtk_list_size_request (GtkWidget *widget,
GtkRequisition *requisition);
-static void gtk_list_size_allocate (GtkWidget *widget,
+static void gtk_list_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
-static void gtk_list_add (GtkContainer *container,
- GtkWidget *widget);
-static void gtk_list_remove (GtkContainer *container,
- GtkWidget *widget);
-static void gtk_list_foreach (GtkContainer *container,
+static void gtk_list_add (GtkContainer *container,
+ GtkWidget *widget);
+static void gtk_list_remove (GtkContainer *container,
+ GtkWidget *widget);
+static void gtk_list_foreach (GtkContainer *container,
GtkCallback callback,
- gpointer callback_data);
+ gpointer callback_data);
-static void gtk_real_list_select_child (GtkList *list,
- GtkWidget *child);
-static void gtk_real_list_unselect_child (GtkList *list,
- GtkWidget *child);
+static void gtk_real_list_select_child (GtkList *list,
+ GtkWidget *child);
+static void gtk_real_list_unselect_child (GtkList *list,
+ GtkWidget *child);
-static void gtk_list_marshal_signal (GtkObject *object,
+static void gtk_list_marshal_signal (GtkObject *object,
GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
+ gpointer func_data,
+ GtkArg *args);
static GtkContainerClass *parent_class = NULL;
static guint list_signals[LAST_SIGNAL] = { 0 };
-guint
+GtkType
gtk_list_get_type ()
{
static guint list_type = 0;
@@ -93,7 +93,7 @@ gtk_list_get_type ()
(GtkClassInitFunc) gtk_list_class_init,
(GtkObjectInitFunc) gtk_list_init,
(GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
+ (GtkArgGetFunc) NULL,
};
list_type = gtk_type_unique (gtk_container_get_type (), &list_info);
@@ -117,27 +117,27 @@ gtk_list_class_init (GtkListClass *class)
list_signals[SELECTION_CHANGED] =
gtk_signal_new ("selection_changed",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkListClass, selection_changed),
- gtk_signal_default_marshaller,
+ GTK_RUN_FIRST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (GtkListClass, selection_changed),
+ gtk_signal_default_marshaller,
GTK_TYPE_NONE, 0);
list_signals[SELECT_CHILD] =
gtk_signal_new ("select_child",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkListClass, select_child),
- gtk_list_marshal_signal,
+ GTK_RUN_FIRST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (GtkListClass, select_child),
+ gtk_list_marshal_signal,
GTK_TYPE_NONE, 1,
- GTK_TYPE_WIDGET);
+ GTK_TYPE_WIDGET);
list_signals[UNSELECT_CHILD] =
gtk_signal_new ("unselect_child",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkListClass, unselect_child),
- gtk_list_marshal_signal,
+ GTK_RUN_FIRST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (GtkListClass, unselect_child),
+ gtk_list_marshal_signal,
GTK_TYPE_NONE, 1,
- GTK_TYPE_WIDGET);
+ GTK_TYPE_WIDGET);
gtk_object_class_add_signals (object_class, list_signals, LAST_SIGNAL);
@@ -219,7 +219,7 @@ gtk_list_destroy (GtkObject *object)
void
gtk_list_insert_items (GtkList *list,
GList *items,
- gint position)
+ gint position)
{
GtkWidget *widget;
GList *tmp_list;
@@ -307,7 +307,7 @@ gtk_list_append_items (GtkList *list,
void
gtk_list_prepend_items (GtkList *list,
- GList *items)
+ GList *items)
{
g_return_if_fail (list != NULL);
g_return_if_fail (GTK_IS_LIST (list));
@@ -316,8 +316,8 @@ gtk_list_prepend_items (GtkList *list,
}
static void
-gtk_list_remove_items_internal (GtkList *list,
- GList *items,
+gtk_list_remove_items_internal (GtkList *list,
+ GList *items,
gboolean no_unref)
{
GtkWidget *widget;
@@ -377,15 +377,15 @@ gtk_list_remove_items_internal (GtkList *list,
}
void
-gtk_list_remove_items (GtkList *list,
- GList *items)
+gtk_list_remove_items (GtkList *list,
+ GList *items)
{
gtk_list_remove_items_internal (list, items, FALSE);
}
void
-gtk_list_remove_items_no_unref (GtkList *list,
- GList *items)
+gtk_list_remove_items_no_unref (GtkList *list,
+ GList *items)
{
gtk_list_remove_items_internal (list, items, TRUE);
}
@@ -421,11 +421,11 @@ gtk_list_clear_items (GtkList *list,
if (start_list->prev)
start_list->prev->next = end_list;
if (end_list && end_list->prev)
- end_list->prev->next = NULL;
+ end_list->prev->next = NULL;
if (end_list)
- end_list->prev = start_list->prev;
+ end_list->prev = start_list->prev;
if (start_list == list->children)
- list->children = end_list;
+ list->children = end_list;
selection_changed = FALSE;
widget = NULL;
@@ -478,7 +478,7 @@ gtk_list_select_item (GtkList *list,
void
gtk_list_unselect_item (GtkList *list,
- gint item)
+ gint item)
{
GList *tmp_list;
@@ -491,7 +491,7 @@ gtk_list_unselect_item (GtkList *list,
}
void
-gtk_list_select_child (GtkList *list,
+gtk_list_select_child (GtkList *list,
GtkWidget *child)
{
gtk_signal_emit (GTK_OBJECT (list), list_signals[SELECT_CHILD], child);
@@ -531,7 +531,7 @@ gtk_list_child_position (GtkList *list,
}
void
-gtk_list_set_selection_mode (GtkList *list,
+gtk_list_set_selection_mode (GtkList *list,
GtkSelectionMode mode)
{
g_return_if_fail (list != NULL);
@@ -639,7 +639,7 @@ gtk_list_draw (GtkWidget *widget,
}
static gint
-gtk_list_expose (GtkWidget *widget,
+gtk_list_expose (GtkWidget *widget,
GdkEventExpose *event)
{
GtkList *list;
@@ -693,7 +693,12 @@ gtk_list_enter_notify (GtkWidget *widget,
item = item->parent;
if (item && (item->parent == widget))
- gtk_list_select_child (list, item);
+ {
+ gtk_list_select_child (list, item);
+
+ if (!GTK_WIDGET_HAS_FOCUS (item))
+ gtk_widget_grab_focus (item);
+ }
return FALSE;
}
@@ -732,7 +737,7 @@ gtk_list_button_press (GtkWidget *widget,
}
static gint
-gtk_list_button_release (GtkWidget *widget,
+gtk_list_button_release (GtkWidget *widget,
GdkEventButton *event)
{
GtkList *list;
@@ -841,7 +846,7 @@ gtk_list_size_allocate (GtkWidget *widget,
static void
gtk_list_add (GtkContainer *container,
- GtkWidget *widget)
+ GtkWidget *widget)
{
GtkList *list;
@@ -895,8 +900,8 @@ gtk_list_remove (GtkContainer *container,
static void
gtk_list_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data)
+ GtkCallback callback,
+ gpointer callback_data)
{
GtkList *list;
GtkWidget *child;
@@ -1028,7 +1033,7 @@ gtk_real_list_select_child (GtkList *list,
}
static void
-gtk_real_list_unselect_child (GtkList *list,
+gtk_real_list_unselect_child (GtkList *list,
GtkWidget *child)
{
g_return_if_fail (list != NULL);
@@ -1057,10 +1062,10 @@ gtk_real_list_unselect_child (GtkList *list,
static void
-gtk_list_marshal_signal (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args)
+gtk_list_marshal_signal (GtkObject *object,
+ GtkSignalFunc func,
+ gpointer func_data,
+ GtkArg *args)
{
GtkListSignal rfunc;
diff --git a/gtk/gtklist.h b/gtk/gtklist.h
index 8a1799b75..9f68b67a2 100644
--- a/gtk/gtklist.h
+++ b/gtk/gtklist.h
@@ -8,7 +8,7 @@
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
@@ -30,12 +30,12 @@ extern "C" {
#endif /* __cplusplus */
-#define GTK_LIST(obj) GTK_CHECK_CAST (obj, gtk_list_get_type (), GtkList)
-#define GTK_LIST_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_list_get_type (), GtkListClass)
-#define GTK_IS_LIST(obj) GTK_CHECK_TYPE (obj, gtk_list_get_type ())
+#define GTK_LIST(obj) (GTK_CHECK_CAST (obj, gtk_list_get_type (), GtkList))
+#define GTK_LIST_CLASS(klass) (GTK_CHECK_CLASS_CAST (klass, gtk_list_get_type (), GtkListClass))
+#define GTK_IS_LIST(obj) (GTK_CHECK_TYPE (obj, gtk_list_get_type ()))
-typedef struct _GtkList GtkList;
+typedef struct _GtkList GtkList;
typedef struct _GtkListClass GtkListClass;
struct _GtkList
@@ -50,49 +50,49 @@ struct _GtkList
guint16 selection_end_pos;
guint selection_mode : 2;
guint scroll_direction : 1;
- guint have_grab : 1;
- guint16 button;
+ guint have_grab : 1; /* unused */
+ guint16 button; /* read by GtkCombo */
};
struct _GtkListClass
{
GtkContainerClass parent_class;
- void (* selection_changed) (GtkList *list);
- void (* select_child) (GtkList *list,
+ void (* selection_changed) (GtkList *list);
+ void (* select_child) (GtkList *list,
GtkWidget *child);
- void (* unselect_child) (GtkList *list,
+ void (* unselect_child) (GtkList *list,
GtkWidget *child);
};
-guint gtk_list_get_type (void);
-GtkWidget* gtk_list_new (void);
-void gtk_list_insert_items (GtkList *list,
- GList *items,
- gint position);
-void gtk_list_append_items (GtkList *list,
- GList *items);
-void gtk_list_prepend_items (GtkList *list,
- GList *items);
-void gtk_list_remove_items (GtkList *list,
- GList *items);
-void gtk_list_remove_items_no_unref (GtkList *list,
- GList *items);
-void gtk_list_clear_items (GtkList *list,
- gint start,
- gint end);
-void gtk_list_select_item (GtkList *list,
- gint item);
-void gtk_list_unselect_item (GtkList *list,
- gint item);
-void gtk_list_select_child (GtkList *list,
- GtkWidget *child);
-void gtk_list_unselect_child (GtkList *list,
- GtkWidget *child);
-gint gtk_list_child_position (GtkList *list,
- GtkWidget *child);
-void gtk_list_set_selection_mode (GtkList *list,
+GtkType gtk_list_get_type (void);
+GtkWidget* gtk_list_new (void);
+void gtk_list_insert_items (GtkList *list,
+ GList *items,
+ gint position);
+void gtk_list_append_items (GtkList *list,
+ GList *items);
+void gtk_list_prepend_items (GtkList *list,
+ GList *items);
+void gtk_list_remove_items (GtkList *list,
+ GList *items);
+void gtk_list_remove_items_no_unref (GtkList *list,
+ GList *items);
+void gtk_list_clear_items (GtkList *list,
+ gint start,
+ gint end);
+void gtk_list_select_item (GtkList *list,
+ gint item);
+void gtk_list_unselect_item (GtkList *list,
+ gint item);
+void gtk_list_select_child (GtkList *list,
+ GtkWidget *child);
+void gtk_list_unselect_child (GtkList *list,
+ GtkWidget *child);
+gint gtk_list_child_position (GtkList *list,
+ GtkWidget *child);
+void gtk_list_set_selection_mode (GtkList *list,
GtkSelectionMode mode);
diff --git a/gtk/gtkobject.c b/gtk/gtkobject.c
index 1f3bf3c62..cd852d3bd 100644
--- a/gtk/gtkobject.c
+++ b/gtk/gtkobject.c
@@ -72,7 +72,8 @@ static void gtk_object_get_arg (GtkObject *object,
static void gtk_object_shutdown (GtkObject *object);
static void gtk_object_real_destroy (GtkObject *object);
static void gtk_object_finalize (GtkObject *object);
-static void gtk_object_notify_weaks (gpointer data);
+static void gtk_object_notify_weaks (GtkObject *object);
+
static void gtk_object_data_destroy (GtkObjectData *odata);
static guint* gtk_object_data_id_alloc (void);
@@ -91,7 +92,8 @@ static GHashTable *arg_info_ht = NULL;
static const gchar *user_data_key = "user_data";
static guint user_data_key_id = 0;
-
+static const gchar *weakrefs_key = "gtk-weakrefs";
+static guint weakrefs_key_id = 0;
#ifdef G_ENABLE_DEBUG
static guint obj_count = 0;
@@ -259,6 +261,8 @@ gtk_object_finalize (GtkObject *object)
{
GtkObjectData *odata, *next;
+ gtk_object_notify_weaks (object);
+
odata = object->object_data;
while (odata)
{
@@ -443,14 +447,14 @@ gtk_object_sink (GtkObject *object)
* referenced object is finalized.
*
* They are not implemented as a signal because they really are
- * special and need to be used with great care. Unlike signals, who
+ * special and need to be used with great care. Unlike signals, which
* should be able to execute any code whatsoever.
*
* A weakref callback is not allowed to retain a reference to the
- * object. In fact, the object is no longer there at all when it is
- * called.
+ * object. Object data keys may be retrieved in a weak reference
+ * callback.
*
- * A weakref callback is called atmost once.
+ * A weakref callback is called at most once.
*
*****************************************/
@@ -463,8 +467,6 @@ struct _GtkWeakRef
gpointer data;
};
-static const gchar *weakrefs_key = "gtk-weakrefs";
-
void
gtk_object_weakref (GtkObject *object,
GtkDestroyNotify notify,
@@ -476,12 +478,14 @@ gtk_object_weakref (GtkObject *object,
g_return_if_fail (notify != NULL);
g_return_if_fail (GTK_IS_OBJECT (object));
+ if (!weakrefs_key_id)
+ weakrefs_key_id = gtk_object_data_force_id (weakrefs_key);
+
weak = g_new (GtkWeakRef, 1);
- weak->next = gtk_object_get_data (object, weakrefs_key);
+ weak->next = gtk_object_get_data_by_id (object, weakrefs_key_id);
weak->notify = notify;
weak->data = data;
- gtk_object_set_data_full (object, weakrefs_key, weak,
- gtk_object_notify_weaks);
+ gtk_object_set_data_by_id (object, weakrefs_key_id, weak);
}
void
@@ -494,15 +498,17 @@ gtk_object_weakunref (GtkObject *object,
g_return_if_fail (object != NULL);
g_return_if_fail (GTK_IS_OBJECT (object));
- weaks = gtk_object_get_data (object, weakrefs_key);
+ if (!weakrefs_key_id)
+ return;
+
+ weaks = gtk_object_get_data_by_id (object, weakrefs_key_id);
for (wp = &weaks; *wp; wp = &(*wp)->next)
{
w = *wp;
if (w->notify == notify && w->data == data)
{
if (w == weaks)
- gtk_object_set_data_full (object, weakrefs_key, w->next,
- gtk_object_notify_weaks);
+ gtk_object_set_data_by_id (object, weakrefs_key_id, w->next);
else
*wp = w->next;
g_free (w);
@@ -512,18 +518,21 @@ gtk_object_weakunref (GtkObject *object,
}
static void
-gtk_object_notify_weaks (gpointer data)
+gtk_object_notify_weaks (GtkObject *object)
{
- GtkWeakRef *w1, *w2;
-
- w1 = (GtkWeakRef *)data;
-
- while (w1)
+ if (weakrefs_key_id)
{
- w1->notify (w1->data);
- w2 = w1->next;
- g_free (w1);
- w1 = w2;
+ GtkWeakRef *w1, *w2;
+
+ w1 = gtk_object_get_data_by_id (object, weakrefs_key_id);
+
+ while (w1)
+ {
+ w1->notify (w1->data);
+ w2 = w1->next;
+ g_free (w1);
+ w1 = w2;
+ }
}
}
diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c
index 40f656b38..9fbf23ef1 100644
--- a/gtk/gtkpaned.c
+++ b/gtk/gtkpaned.c
@@ -349,20 +349,22 @@ gtk_paned_remove (GtkContainer *container,
GtkWidget *widget)
{
GtkPaned *paned;
+ gboolean was_visible;
g_return_if_fail (container != NULL);
g_return_if_fail (GTK_IS_PANED (container));
g_return_if_fail (widget != NULL);
paned = GTK_PANED (container);
-
+ was_visible = GTK_WIDGET_VISIBLE (widget);
+
if (paned->child1 == widget)
{
gtk_widget_unparent (widget);
paned->child1 = NULL;
- if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (container))
+ if (was_visible && GTK_WIDGET_VISIBLE (container))
gtk_widget_queue_resize (GTK_WIDGET (container));
}
else if (paned->child2 == widget)
@@ -371,7 +373,7 @@ gtk_paned_remove (GtkContainer *container,
paned->child2 = NULL;
- if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (container))
+ if (was_visible && GTK_WIDGET_VISIBLE (container))
gtk_widget_queue_resize (GTK_WIDGET (container));
}
}
diff --git a/gtk/gtkpixmap.c b/gtk/gtkpixmap.c
index 713cd2277..014a2dbf0 100644
--- a/gtk/gtkpixmap.c
+++ b/gtk/gtkpixmap.c
@@ -104,12 +104,16 @@ gtk_pixmap_set (GtkPixmap *pixmap,
{
gint width;
gint height;
+ gint oldwidth;
+ gint oldheight;
g_return_if_fail (pixmap != NULL);
g_return_if_fail (GTK_IS_PIXMAP (pixmap));
if (pixmap->pixmap != val)
{
+ oldwidth = GTK_WIDGET (pixmap)->requisition.width;
+ oldheight = GTK_WIDGET (pixmap)->requisition.height;
if (pixmap->pixmap)
gdk_pixmap_unref (pixmap->pixmap);
pixmap->pixmap = val;
@@ -128,7 +132,13 @@ gtk_pixmap_set (GtkPixmap *pixmap,
GTK_WIDGET (pixmap)->requisition.height = 0;
}
if (GTK_WIDGET_VISIBLE (pixmap))
- gtk_widget_queue_resize (GTK_WIDGET (pixmap));
+ {
+ if ((GTK_WIDGET (pixmap)->requisition.width != oldwidth) ||
+ (GTK_WIDGET (pixmap)->requisition.height != oldheight))
+ gtk_widget_queue_resize (GTK_WIDGET (pixmap));
+ else
+ gtk_widget_queue_draw (GTK_WIDGET (pixmap));
+ }
}
if (pixmap->mask != mask)
diff --git a/gtk/gtkrc.c b/gtk/gtkrc.c
index fc05cbe4d..26bde5aad 100644
--- a/gtk/gtkrc.c
+++ b/gtk/gtkrc.c
@@ -26,6 +26,7 @@
enum {
TOKEN_INVALID = G_TOKEN_LAST,
+ TOKEN_INCLUDE,
TOKEN_ACTIVE,
TOKEN_BASE,
TOKEN_BG,
@@ -47,7 +48,8 @@ enum {
enum {
PARSE_OK,
PARSE_ERROR,
- PARSE_SYNTAX
+ PARSE_SYNTAX,
+ PARSE_DONE
};
enum {
@@ -175,30 +177,28 @@ static GScannerConfig gtk_rc_scanner_config =
static struct
{
- char *name;
- int token;
-} symbols[] =
- {
- { "ACTIVE", TOKEN_ACTIVE },
- { "base", TOKEN_BASE },
- { "bg", TOKEN_BG },
- { "bg_pixmap", TOKEN_BG_PIXMAP },
- { "fg", TOKEN_FG },
- { "font", TOKEN_FONT },
- { "fontset", TOKEN_FONTSET },
- { "INSENSITIVE", TOKEN_INSENSITIVE },
- { "NORMAL", TOKEN_NORMAL },
- { "pixmap_path", TOKEN_PIXMAP_PATH },
- { "PRELIGHT", TOKEN_PRELIGHT },
- { "SELECTED", TOKEN_SELECTED },
- { "style", TOKEN_STYLE },
- { "text", TOKEN_TEXT },
- { "widget", TOKEN_WIDGET },
- { "widget_class", TOKEN_WIDGET_CLASS },
- };
-static int nsymbols = sizeof (symbols) / sizeof (symbols[0]);
-
-static int done;
+ gchar *name;
+ gint token;
+} symbols[] = {
+ { "include", TOKEN_INCLUDE },
+ { "ACTIVE", TOKEN_ACTIVE },
+ { "base", TOKEN_BASE },
+ { "bg", TOKEN_BG },
+ { "bg_pixmap", TOKEN_BG_PIXMAP },
+ { "fg", TOKEN_FG },
+ { "font", TOKEN_FONT },
+ { "fontset", TOKEN_FONTSET },
+ { "INSENSITIVE", TOKEN_INSENSITIVE },
+ { "NORMAL", TOKEN_NORMAL },
+ { "pixmap_path", TOKEN_PIXMAP_PATH },
+ { "PRELIGHT", TOKEN_PRELIGHT },
+ { "SELECTED", TOKEN_SELECTED },
+ { "style", TOKEN_STYLE },
+ { "text", TOKEN_TEXT },
+ { "widget", TOKEN_WIDGET },
+ { "widget_class", TOKEN_WIDGET_CLASS },
+};
+static guint nsymbols = sizeof (symbols) / sizeof (symbols[0]);
static GHashTable *rc_style_ht = NULL;
static GSList *widget_sets = NULL;
@@ -341,6 +341,7 @@ gtk_rc_parse_any (const gchar *input_name,
{
GScanner *scanner;
guint i;
+ gboolean done;
scanner = g_scanner_new (&gtk_rc_scanner_config);
@@ -363,8 +364,15 @@ gtk_rc_parse_any (const gchar *input_name,
done = FALSE;
while (!done)
{
- if (gtk_rc_parse_statement (scanner) != PARSE_OK)
+ gint return_val;
+
+ return_val = gtk_rc_parse_statement (scanner);
+
+ switch (return_val)
{
+ case PARSE_OK:
+ break;
+ default:
if (scanner->next_token != G_TOKEN_NONE)
g_scanner_get_next_token (scanner);
@@ -375,8 +383,10 @@ gtk_rc_parse_any (const gchar *input_name,
g_warning ("rc file parse error: \"%s\" line %d",
input_name,
scanner->line);
-
+ /* fall through */
+ case PARSE_DONE:
done = TRUE;
+ break;
}
}
g_scanner_destroy (scanner);
@@ -569,8 +579,18 @@ gtk_rc_parse_statement (GScanner *scanner)
token = g_scanner_peek_next_token (scanner);
if (token == G_TOKEN_EOF)
+ return PARSE_DONE;
+
+ if (token == TOKEN_INCLUDE)
{
- done = TRUE;
+ g_scanner_get_next_token (scanner);
+ token = g_scanner_get_next_token (scanner);
+
+ if (token != G_TOKEN_STRING)
+ return PARSE_ERROR;
+
+ gtk_rc_parse (scanner->value.v_string);
+
return PARSE_OK;
}
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index 3d15c2d4e..979b166bd 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -371,7 +371,8 @@ gtk_scrolled_window_size_allocate (GtkWidget *widget,
GtkAllocation child_allocation;
guint previous_hvis;
guint previous_vvis;
-
+ gint count;
+
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_SCROLLED_WINDOW (widget));
g_return_if_fail (allocation != NULL);
@@ -379,12 +380,12 @@ gtk_scrolled_window_size_allocate (GtkWidget *widget,
scrolled_window = GTK_SCROLLED_WINDOW (widget);
widget->allocation = *allocation;
- gtk_scrolled_window_viewport_allocate (widget, &viewport_allocation);
-
gtk_container_disable_resize (GTK_CONTAINER (scrolled_window));
if (GTK_WIDGET_VISIBLE (scrolled_window->viewport))
{
+ count = 0;
+
do {
gtk_scrolled_window_viewport_allocate (widget, &viewport_allocation);
@@ -393,16 +394,32 @@ gtk_scrolled_window_size_allocate (GtkWidget *widget,
child_allocation.width = viewport_allocation.width;
child_allocation.height = viewport_allocation.height;
- previous_hvis = GTK_WIDGET_VISIBLE (scrolled_window->hscrollbar);
- previous_vvis = GTK_WIDGET_VISIBLE (scrolled_window->vscrollbar);
+ previous_hvis = scrolled_window->hscrollbar_visible;
+ previous_vvis = scrolled_window->vscrollbar_visible;
gtk_widget_size_allocate (scrolled_window->viewport, &child_allocation);
- } while ((previous_hvis != GTK_WIDGET_VISIBLE (scrolled_window->hscrollbar)) ||
- (previous_vvis != GTK_WIDGET_VISIBLE (scrolled_window->vscrollbar)));
+ /* If, after the first iteration, the hscrollbar and the
+ * vscrollbar flip visiblity, then we need both.
+ */
+ if ((count++) &&
+ (previous_hvis != scrolled_window->hscrollbar_visible) &&
+ (previous_vvis != scrolled_window->vscrollbar_visible))
+ {
+ scrolled_window->hscrollbar_visible = TRUE;
+ scrolled_window->vscrollbar_visible = TRUE;
+ break;
+ }
+
+ count++;
+ } while ((previous_hvis != scrolled_window->hscrollbar_visible) ||
+ (previous_vvis != scrolled_window->vscrollbar_visible));
}
- if (GTK_WIDGET_VISIBLE (scrolled_window->hscrollbar))
+ if (scrolled_window->hscrollbar_visible)
{
+ if (!GTK_WIDGET_VISIBLE (scrolled_window->hscrollbar))
+ gtk_widget_show (scrolled_window->hscrollbar);
+
child_allocation.x = viewport_allocation.x;
child_allocation.y = viewport_allocation.y + viewport_allocation.height + SCROLLBAR_SPACING (scrolled_window);
child_allocation.width = viewport_allocation.width;
@@ -412,9 +429,17 @@ gtk_scrolled_window_size_allocate (GtkWidget *widget,
gtk_widget_size_allocate (scrolled_window->hscrollbar, &child_allocation);
}
+ else
+ {
+ if (GTK_WIDGET_VISIBLE (scrolled_window->hscrollbar))
+ gtk_widget_hide (scrolled_window->hscrollbar);
+ }
- if (GTK_WIDGET_VISIBLE (scrolled_window->vscrollbar))
+ if (scrolled_window->vscrollbar_visible)
{
+ if (!GTK_WIDGET_VISIBLE (scrolled_window->vscrollbar))
+ gtk_widget_show (scrolled_window->vscrollbar);
+
child_allocation.x = viewport_allocation.x + viewport_allocation.width + SCROLLBAR_SPACING (scrolled_window);
child_allocation.y = viewport_allocation.y;
child_allocation.width = scrolled_window->vscrollbar->requisition.width;
@@ -424,6 +449,11 @@ gtk_scrolled_window_size_allocate (GtkWidget *widget,
gtk_widget_size_allocate (scrolled_window->vscrollbar, &child_allocation);
}
+ else
+ {
+ if (GTK_WIDGET_VISIBLE (scrolled_window->vscrollbar))
+ gtk_widget_hide (scrolled_window->vscrollbar);
+ }
gtk_container_enable_resize (GTK_CONTAINER (scrolled_window));
}
@@ -478,7 +508,11 @@ gtk_scrolled_window_foreach (GtkContainer *container,
scrolled_window = GTK_SCROLLED_WINDOW (container);
- (* callback) (scrolled_window->viewport, callback_data);
+ if (scrolled_window->viewport)
+ (* callback) (scrolled_window->viewport, callback_data);
+
+ (* callback) (scrolled_window->vscrollbar, callback_data);
+ (* callback) (scrolled_window->hscrollbar, callback_data);
}
static void
@@ -497,10 +531,10 @@ gtk_scrolled_window_viewport_allocate (GtkWidget *widget,
allocation->width = MAX (1, widget->allocation.width - allocation->x * 2);
allocation->height = MAX (1, widget->allocation.height - allocation->y * 2);
- if (GTK_WIDGET_VISIBLE (scrolled_window->vscrollbar))
+ if (scrolled_window->vscrollbar_visible)
allocation->width = MAX (1,
allocation->width - (scrolled_window->vscrollbar->requisition.width + SCROLLBAR_SPACING (scrolled_window)));
- if (GTK_WIDGET_VISIBLE (scrolled_window->hscrollbar))
+ if (scrolled_window->hscrollbar_visible)
allocation->height = MAX (1,
allocation->height - (scrolled_window->hscrollbar->requisition.height + SCROLLBAR_SPACING (scrolled_window)));
}
@@ -510,9 +544,6 @@ gtk_scrolled_window_adjustment_changed (GtkAdjustment *adjustment,
gpointer data)
{
GtkScrolledWindow *scrolled_win;
- GtkWidget *scrollbar;
- gint hide_scrollbar;
- gint policy;
g_return_if_fail (adjustment != NULL);
g_return_if_fail (data != NULL);
@@ -521,36 +552,23 @@ gtk_scrolled_window_adjustment_changed (GtkAdjustment *adjustment,
if (adjustment == gtk_range_get_adjustment (GTK_RANGE (scrolled_win->hscrollbar)))
{
- scrollbar = scrolled_win->hscrollbar;
- policy = scrolled_win->hscrollbar_policy;
+ if (scrolled_win->hscrollbar_policy == GTK_POLICY_AUTOMATIC)
+ {
+ scrolled_win->hscrollbar_visible =
+ ((adjustment->upper - adjustment->lower) > adjustment->page_size);
+ }
}
else if (adjustment == gtk_range_get_adjustment (GTK_RANGE (scrolled_win->vscrollbar)))
{
- scrollbar = scrolled_win->vscrollbar;
- policy = scrolled_win->vscrollbar_policy;
+ if (scrolled_win->vscrollbar_policy == GTK_POLICY_AUTOMATIC)
+ {
+ scrolled_win->vscrollbar_visible =
+ ((adjustment->upper - adjustment->lower) > adjustment->page_size);
+ }
}
else
{
g_warning ("could not determine which adjustment scrollbar received change signal for");
return;
}
-
- if (policy == GTK_POLICY_AUTOMATIC)
- {
- hide_scrollbar = FALSE;
-
- if ((adjustment->upper - adjustment->lower) <= adjustment->page_size)
- hide_scrollbar = TRUE;
-
- if (hide_scrollbar)
- {
- if (GTK_WIDGET_VISIBLE (scrollbar))
- gtk_widget_hide (scrollbar);
- }
- else
- {
- if (!GTK_WIDGET_VISIBLE (scrollbar))
- gtk_widget_show (scrollbar);
- }
- }
}
diff --git a/gtk/gtkscrolledwindow.h b/gtk/gtkscrolledwindow.h
index 360b22bc6..595163fc6 100644
--- a/gtk/gtkscrolledwindow.h
+++ b/gtk/gtkscrolledwindow.h
@@ -49,6 +49,8 @@ struct _GtkScrolledWindow
guint8 hscrollbar_policy;
guint8 vscrollbar_policy;
+ gint hscrollbar_visible : 1;
+ gint vscrollbar_visible : 1;
};
struct _GtkScrolledWindowClass
diff --git a/gtk/gtkselection.c b/gtk/gtkselection.c
index ba6148cd8..3f4dffa1a 100644
--- a/gtk/gtkselection.c
+++ b/gtk/gtkselection.c
@@ -630,12 +630,17 @@ gtk_selection_clear (GtkWidget *widget,
tmp_list = tmp_list->next;
}
- if (tmp_list == NULL || selection_info->time > event->time)
- return FALSE;
-
- current_selections = g_list_remove_link (current_selections, tmp_list);
- g_list_free (tmp_list);
- g_free (selection_info);
+ if (selection_info->time > event->time)
+ return FALSE; /* return FALSE to indicate that
+ * the selection was out of date,
+ * and this clear should be ignored */
+ else
+ if (tmp_list)
+ {
+ current_selections = g_list_remove_link (current_selections, tmp_list);
+ g_list_free (tmp_list);
+ g_free (selection_info);
+ }
return TRUE;
}
diff --git a/gtk/gtkstyle.c b/gtk/gtkstyle.c
index 971ec32fd..ed009558d 100644
--- a/gtk/gtkstyle.c
+++ b/gtk/gtkstyle.c
@@ -266,7 +266,7 @@ gtk_style_attach (GtkStyle *style,
g_return_val_if_fail (window != NULL, NULL);
colormap = gdk_window_get_colormap (window);
- gdk_window_get_geometry (window, NULL, NULL, NULL, NULL, &depth);
+ depth = gdk_window_get_visual (window)->depth;
new_style = gtk_style_find (style, colormap, depth);
diff --git a/gtk/gtktable.c b/gtk/gtktable.c
index e58466d2b..9140a6af5 100644
--- a/gtk/gtktable.c
+++ b/gtk/gtktable.c
@@ -570,12 +570,14 @@ gtk_table_remove (GtkContainer *container,
if (child->widget == widget)
{
+ gboolean was_visible = GTK_WIDGET_VISIBLE (widget);
+
gtk_widget_unparent (widget);
table->children = g_list_remove (table->children, child);
g_free (child);
- if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (container))
+ if (was_visible && GTK_WIDGET_VISIBLE (container))
gtk_widget_queue_resize (GTK_WIDGET (container));
break;
}
diff --git a/gtk/gtktree.c b/gtk/gtktree.c
index 32352a3bd..faed8e60e 100644
--- a/gtk/gtktree.c
+++ b/gtk/gtktree.c
@@ -710,7 +710,20 @@ gtk_tree_remove_items (GtkTree *tree,
g_print("+ gtk_tree_remove_items [ tree %#x items list %#x ]\n", (int)tree, (int)items);
#endif /* TREE_DEBUG */
- root_tree = GTK_TREE(GTK_TREE_ROOT_TREE(tree));
+ /* We may not yet be mapped, so we actively have to find our
+ * root tree
+ */
+ if (tree->root_tree)
+ root_tree = tree->root_tree;
+ else
+ {
+ GtkWidget *tmp = GTK_WIDGET (tree);
+ while (tmp->parent && GTK_IS_TREE (tmp->parent))
+ tmp = tmp->parent;
+
+ root_tree = GTK_TREE (tmp);
+ }
+
tmp_list = items;
selected_widgets = NULL;
sorted_list = NULL;
@@ -779,9 +792,9 @@ gtk_tree_remove_items (GtkTree *tree,
#endif /* TREE_DEBUG */
}
- /* remove this item of his real parent */
+ /* remove this item from its real parent */
#ifdef TREE_DEBUG
- g_print("* remove widget of his owner tree\n");
+ g_print("* remove widget from its owner tree\n");
#endif /* TREE_DEBUG */
real_tree->children = g_list_remove (real_tree->children, widget);
diff --git a/gtk/gtktreeitem.c b/gtk/gtktreeitem.c
index 6934a6a74..3b2cb072b 100644
--- a/gtk/gtktreeitem.c
+++ b/gtk/gtktreeitem.c
@@ -304,9 +304,6 @@ gtk_tree_item_set_subtree (GtkTreeItem *tree_item,
tree_item->subtree = subtree;
GTK_TREE(subtree)->tree_owner = GTK_WIDGET(tree_item);
- /* set root tree for selection list */
- GTK_TREE(subtree)->root_tree = GTK_TREE(GTK_WIDGET(tree_item)->parent)->root_tree;
-
/* show subtree button */
if (tree_item->pixmaps_box)
gtk_widget_show(tree_item->pixmaps_box);
@@ -994,25 +991,35 @@ gtk_tree_item_remove_subtree (GtkTreeItem* item)
g_return_if_fail (item->subtree != NULL);
if (GTK_TREE (item->subtree)->children)
- gtk_tree_remove_items (GTK_TREE (item->subtree),
- GTK_TREE (item->subtree)->children);
-
+ {
+ /* The following call will remove the children and call
+ * gtk_tree_item_remove_subtree() again. So we are done.
+ */
+ gtk_tree_remove_items (GTK_TREE (item->subtree),
+ GTK_TREE (item->subtree)->children);
+ return;
+ }
+
if (GTK_WIDGET_MAPPED (item->subtree))
gtk_widget_unmap (item->subtree);
-
+
gtk_widget_unparent (item->subtree);
if (item->pixmaps_box)
gtk_widget_hide (item->pixmaps_box);
item->subtree = NULL;
- item->expanded = FALSE;
- if (item->pixmaps_box)
+
+ if (item->expanded)
{
- gtk_container_remove (GTK_CONTAINER (item->pixmaps_box),
- item->minus_pix_widget);
- gtk_container_add (GTK_CONTAINER (item->pixmaps_box),
- item->plus_pix_widget);
+ item->expanded = FALSE;
+ if (item->pixmaps_box)
+ {
+ gtk_container_remove (GTK_CONTAINER (item->pixmaps_box),
+ item->minus_pix_widget);
+ gtk_container_add (GTK_CONTAINER (item->pixmaps_box),
+ item->plus_pix_widget);
+ }
}
}
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 0548f90a6..faf2a41a9 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -256,10 +256,10 @@ static const gchar *visual_key = "gtk-visual";
* results:
*****************************************/
-guint
+GtkType
gtk_widget_get_type ()
{
- static guint widget_type = 0;
+ static GtkType widget_type = 0;
if (!widget_type)
{
@@ -2244,27 +2244,31 @@ gtk_widget_basic (GtkWidget *widget)
void
gtk_widget_grab_focus (GtkWidget *widget)
{
- GtkWidget *window;
- GtkWidget *child;
- GtkType window_type;
-
g_return_if_fail (widget != NULL);
-
- window_type = gtk_window_get_type ();
- window = widget->parent;
- child = widget;
-
- while (window && !gtk_type_is_a (GTK_WIDGET_TYPE (window), window_type))
- {
- GTK_CONTAINER (window)->focus_child = child;
- child = window;
- window = window->parent;
- }
-
- if (window && gtk_type_is_a (GTK_WIDGET_TYPE (window), window_type))
+ g_return_if_fail (GTK_IS_WIDGET (widget));
+
+ if (GTK_WIDGET_CAN_FOCUS (widget))
{
- GTK_CONTAINER (window)->focus_child = child;
- gtk_window_set_focus (GTK_WINDOW (window), widget);
+ GtkWidget *window;
+ GtkWidget *child;
+ GtkType window_type;
+
+ window_type = gtk_window_get_type ();
+ window = widget->parent;
+ child = widget;
+
+ while (window && !gtk_type_is_a (GTK_WIDGET_TYPE (window), window_type))
+ {
+ GTK_CONTAINER (window)->focus_child = child;
+ child = window;
+ window = window->parent;
+ }
+
+ if (window && gtk_type_is_a (GTK_WIDGET_TYPE (window), window_type))
+ {
+ GTK_CONTAINER (window)->focus_child = child;
+ gtk_window_set_focus (GTK_WINDOW (window), widget);
+ }
}
}
diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h
index 2267e7d37..0ec99d519 100644
--- a/gtk/gtkwidget.h
+++ b/gtk/gtkwidget.h
@@ -355,7 +355,7 @@ struct _GtkWidgetShapeInfo
};
-guint gtk_widget_get_type (void);
+GtkType gtk_widget_get_type (void);
GtkWidget* gtk_widget_new (guint type,
...);
GtkWidget* gtk_widget_newv (guint type,
diff --git a/gtk/testgtk.c b/gtk/testgtk.c
index fc4ea5617..677ca8d11 100644
--- a/gtk/testgtk.c
+++ b/gtk/testgtk.c
@@ -51,6 +51,7 @@ typedef struct sTreeButtons {
guint nb_item_add;
GtkWidget* add_button;
GtkWidget* remove_button;
+ GtkWidget* subtree_button;
} sTreeButtons;
/* end of tree section */
@@ -1066,6 +1067,22 @@ cb_remove_item(GtkWidget*w, GtkTree* tree)
}
static void
+cb_remove_subtree(GtkWidget*w, GtkTree* tree)
+{
+ GList* selected_list;
+ GtkTreeItem *item;
+
+ selected_list = GTK_TREE_SELECTION(tree);
+
+ if (selected_list)
+ {
+ item = GTK_TREE_ITEM (selected_list->data);
+ if (item->subtree)
+ gtk_tree_item_remove_subtree (item);
+ }
+}
+
+static void
cb_tree_changed(GtkTree* tree)
{
sTreeButtons* tree_buttons;
@@ -1084,11 +1101,13 @@ cb_tree_changed(GtkTree* tree)
else
gtk_widget_set_sensitive(tree_buttons->add_button, FALSE);
gtk_widget_set_sensitive(tree_buttons->remove_button, FALSE);
+ gtk_widget_set_sensitive(tree_buttons->subtree_button, FALSE);
}
else
{
gtk_widget_set_sensitive(tree_buttons->remove_button, TRUE);
gtk_widget_set_sensitive(tree_buttons->add_button, (nb_selected == 1));
+ gtk_widget_set_sensitive(tree_buttons->subtree_button, (nb_selected == 1));
}
}
@@ -1228,6 +1247,15 @@ create_tree_sample(guint selection_mode,
gtk_widget_show(button);
tree_buttons->remove_button = button;
+ button = gtk_button_new_with_label("Remove Subtree");
+ gtk_widget_set_sensitive(button, FALSE);
+ gtk_signal_connect(GTK_OBJECT (button), "clicked",
+ (GtkSignalFunc) cb_remove_subtree,
+ (gpointer)root_tree);
+ gtk_box_pack_start(GTK_BOX(box2), button, TRUE, TRUE, 0);
+ gtk_widget_show(button);
+ tree_buttons->subtree_button = button;
+
/* create separator */
separator = gtk_hseparator_new();
gtk_box_pack_start(GTK_BOX(box1), separator, FALSE, FALSE, 0);
@@ -2080,6 +2108,31 @@ create_menus ()
* GtkScrolledWindow
*/
static void
+scrolled_windows_remove (GtkWidget *widget, GtkWidget *scrollwin)
+{
+ static GtkWidget *parent = NULL;
+ static GtkWidget *float_parent;
+
+ if (parent)
+ {
+ gtk_widget_reparent (scrollwin, parent);
+ gtk_widget_destroy (float_parent);
+ float_parent = NULL;
+ parent = NULL;
+ }
+ else
+ {
+ parent = widget->parent;
+ float_parent = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ gtk_widget_reparent (scrollwin, float_parent);
+ gtk_widget_show (float_parent);
+ }
+}
+
+/*
+ * GtkScrolledWindow
+ */
+static void
create_scrolled_windows ()
{
static GtkWidget *window;
@@ -2114,6 +2167,10 @@ create_scrolled_windows ()
gtk_table_set_row_spacings (GTK_TABLE (table), 10);
gtk_table_set_col_spacings (GTK_TABLE (table), 10);
gtk_container_add (GTK_CONTAINER (scrolled_window), table);
+ gtk_container_set_focus_hadjustment (GTK_CONTAINER (table),
+ gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW (scrolled_window)));
+ gtk_container_set_focus_vadjustment (GTK_CONTAINER (table),
+ gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (scrolled_window)));
gtk_widget_show (table);
for (i = 0; i < 20; i++)
@@ -2136,6 +2193,17 @@ create_scrolled_windows ()
button, TRUE, TRUE, 0);
gtk_widget_grab_default (button);
gtk_widget_show (button);
+
+ button = gtk_button_new_with_label ("remove");
+ gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
+ GTK_SIGNAL_FUNC(scrolled_windows_remove),
+ GTK_OBJECT (scrolled_window));
+ GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
+ gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->action_area),
+ button, TRUE, TRUE, 0);
+ gtk_widget_grab_default (button);
+ gtk_widget_show (button);
+
}
if (!GTK_WIDGET_VISIBLE (window))
@@ -2772,6 +2840,8 @@ create_list ()
gtk_list_set_selection_mode (GTK_LIST (list), GTK_SELECTION_MULTIPLE);
gtk_list_set_selection_mode (GTK_LIST (list), GTK_SELECTION_BROWSE);
gtk_container_add (GTK_CONTAINER (scrolled_win), list);
+ gtk_container_set_focus_vadjustment (GTK_CONTAINER (list),
+ gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (scrolled_win)));
gtk_widget_show (list);
for (i = 0; i < nlist_items; i++)
@@ -3909,6 +3979,28 @@ static char * book_closed_xpm[] = {
" "};
static void
+notebook_reparent (GtkWidget *widget, GtkWidget *scrollwin)
+{
+ static GtkWidget *parent = NULL;
+ static GtkWidget *float_parent;
+
+ if (parent)
+ {
+ gtk_widget_reparent (scrollwin, parent);
+ gtk_widget_destroy (float_parent);
+ float_parent = NULL;
+ parent = NULL;
+ }
+ else
+ {
+ parent = widget->parent;
+ float_parent = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ gtk_widget_show (float_parent);
+ gtk_widget_reparent (scrollwin, float_parent);
+ }
+}
+
+static void
page_switch (GtkWidget *widget, GtkNotebookPage *page, gint page_num)
{
GtkNotebookPage *oldpage;
@@ -4187,6 +4279,13 @@ create_notebook ()
GTK_SIGNAL_FUNC (rotate_notebook),
notebook);
gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
+
+ button = gtk_button_new_with_label ("reparent");
+ gtk_signal_connect (GTK_OBJECT (button), "clicked",
+ GTK_SIGNAL_FUNC (notebook_reparent),
+ notebook);
+ gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
+
}
if (!GTK_WIDGET_VISIBLE (window))
@@ -5718,6 +5817,7 @@ create_main_window ()
int i;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ gtk_window_set_policy (GTK_WINDOW (window), FALSE, FALSE, FALSE);
gtk_widget_set_name (window, "main window");
gtk_widget_set_usize (window, 200, 400);
gtk_widget_set_uposition (window, 20, 20);
@@ -5754,12 +5854,15 @@ create_main_window ()
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
+ GTK_WIDGET_UNSET_FLAGS (GTK_SCROLLED_WINDOW (scrolled_window)->vscrollbar, GTK_CAN_FOCUS);
gtk_box_pack_start (GTK_BOX (box1), scrolled_window, TRUE, TRUE, 0);
gtk_widget_show (scrolled_window);
box2 = gtk_vbox_new (FALSE, 0);
gtk_container_border_width (GTK_CONTAINER (box2), 10);
gtk_container_add (GTK_CONTAINER (scrolled_window), box2);
+ gtk_container_set_focus_vadjustment (GTK_CONTAINER (box2),
+ gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (scrolled_window)));
gtk_widget_show (box2);
for (i = 0; i < nbuttons; i++)
diff --git a/gtk/testgtkrc b/gtk/testgtkrc
index a1b376a17..1b9ff79a6 100644
--- a/gtk/testgtkrc
+++ b/gtk/testgtkrc
@@ -1,5 +1,7 @@
# pixmap_path "<dir 1>:<dir 2>:<dir 3>:..."
#
+# include "rc-file"
+#
# style <name> [= <name>]
# {
# <option>
@@ -8,6 +10,9 @@
# widget <widget_set> style <style_name>
# widget_class <widget_class_set> style <style_name>
+# testgtkrc2 introduces the green color in the button list
+include "testgtkrc2"
+
pixmap_path "."
style "default"
@@ -33,10 +38,11 @@ style "button"
# bg[PRELIGHT] = { 0, 0, 0.75 }
}
-style 'main_button' = 'button'
+# we set want buttons in the main window to be blue by default
+style 'main_buttons' = 'button'
{
font = "-adobe-helvetica-medium-r-normal--*-100-*-*-*-*-*-*"
- bg[PRELIGHT] = { 0, 0.75, 0x00 }
+ bg[PRELIGHT] = { 0, 0, 0.75 }
}
style "toggle_button" = "button"
@@ -54,6 +60,14 @@ style "text"
base[NORMAL] = { 0.0, 0.0, 0.0 }
}
+style "slider"
+{
+ fg[NORMAL] = { 1.0, 1.0, 1.0 }
+ bg[NORMAL] = { 0.0, 0.0, 1.0 }
+ bg[ACTIVE] = { 0.0 ,0.0, 0.5 }
+ bg[PRELIGHT] = { 0.75 ,0.75, 1.0 }
+}
+
style "ruler"
{
font = '-adobe-helvetica-medium-r-normal--*-80-*-*-*-*-*-*'
@@ -74,5 +88,5 @@ widget_class "*GtkButton*" style "button"
widget_class "*Ruler" style "ruler"
widget_class "*GtkText" style "text"
widget_class "*" style "default"
-widget "main window.*GtkButton*" style "main_button"
+widget "main window.*GtkButton*" style "main_buttons"
widget "*GtkCurve" style "curve"
diff --git a/gtk/testgtkrc2 b/gtk/testgtkrc2
new file mode 100644
index 000000000..f2c45de98
--- /dev/null
+++ b/gtk/testgtkrc2
@@ -0,0 +1,21 @@
+# pixmap_path "<dir 1>:<dir 2>:<dir 3>:..."
+#
+# include "rc-file"
+#
+# style <name> [= <name>]
+# {
+# <option>
+# }
+#
+# widget <widget_set> style <style_name>
+# widget_class <widget_class_set> style <style_name>
+
+# this file gets included from testgtkrc
+
+style 'button_list' = 'button'
+{
+ font = "-adobe-helvetica-medium-r-normal--*-100-*-*-*-*-*-*"
+ bg[PRELIGHT] = { 0, 0.75, 0x00 }
+}
+
+widget "main window.*GtkScrolledWindow.*GtkButton*" style "button_list"