From c3e04d86ec5a4cd6eb6f62e89e63381f9a70d1fc Mon Sep 17 00:00:00 2001 From: Stefan Jeske Date: Tue, 5 May 1998 15:00:12 +0000 Subject: [PATCH] New function to wrap XSetDashes; modified gtkctree.c to use it. * gdk/gdkgc.c gdk/gdk.h gtk/gtkctree.c (gdk_gc_set_dashes): New function to wrap XSetDashes; modified gtkctree.c to use it. --- ChangeLog | 5 +++++ ChangeLog.pre-2-0 | 5 +++++ ChangeLog.pre-2-10 | 5 +++++ ChangeLog.pre-2-2 | 5 +++++ ChangeLog.pre-2-4 | 5 +++++ ChangeLog.pre-2-6 | 5 +++++ ChangeLog.pre-2-8 | 5 +++++ gdk/gdk.h | 4 ++++ gdk/gdkgc.c | 16 ++++++++++++++++ gtk/gtkctree.c | 13 +++---------- gtk/testgtk.c | 5 ++++- tests/testgtk.c | 5 ++++- 12 files changed, 66 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 07680e0621..4a4016d76a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +1998-05-05 Stefan Jeske + + * gdk/gdkgc.c gdk/gdk.h gtk/gtkctree.c (gdk_gc_set_dashes): + New function to wrap XSetDashes; modified gtkctree.c to use it. + 1998-05-04 Federico Mena Quintero * configure.in: Added $x_libs in the other_libraries field in the diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 07680e0621..4a4016d76a 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,8 @@ +1998-05-05 Stefan Jeske + + * gdk/gdkgc.c gdk/gdk.h gtk/gtkctree.c (gdk_gc_set_dashes): + New function to wrap XSetDashes; modified gtkctree.c to use it. + 1998-05-04 Federico Mena Quintero * configure.in: Added $x_libs in the other_libraries field in the diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 07680e0621..4a4016d76a 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,8 @@ +1998-05-05 Stefan Jeske + + * gdk/gdkgc.c gdk/gdk.h gtk/gtkctree.c (gdk_gc_set_dashes): + New function to wrap XSetDashes; modified gtkctree.c to use it. + 1998-05-04 Federico Mena Quintero * configure.in: Added $x_libs in the other_libraries field in the diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 07680e0621..4a4016d76a 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,8 @@ +1998-05-05 Stefan Jeske + + * gdk/gdkgc.c gdk/gdk.h gtk/gtkctree.c (gdk_gc_set_dashes): + New function to wrap XSetDashes; modified gtkctree.c to use it. + 1998-05-04 Federico Mena Quintero * configure.in: Added $x_libs in the other_libraries field in the diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 07680e0621..4a4016d76a 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,8 @@ +1998-05-05 Stefan Jeske + + * gdk/gdkgc.c gdk/gdk.h gtk/gtkctree.c (gdk_gc_set_dashes): + New function to wrap XSetDashes; modified gtkctree.c to use it. + 1998-05-04 Federico Mena Quintero * configure.in: Added $x_libs in the other_libraries field in the diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 07680e0621..4a4016d76a 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,8 @@ +1998-05-05 Stefan Jeske + + * gdk/gdkgc.c gdk/gdk.h gtk/gtkctree.c (gdk_gc_set_dashes): + New function to wrap XSetDashes; modified gtkctree.c to use it. + 1998-05-04 Federico Mena Quintero * configure.in: Added $x_libs in the other_libraries field in the diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 07680e0621..4a4016d76a 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,8 @@ +1998-05-05 Stefan Jeske + + * gdk/gdkgc.c gdk/gdk.h gtk/gtkctree.c (gdk_gc_set_dashes): + New function to wrap XSetDashes; modified gtkctree.c to use it. + 1998-05-04 Federico Mena Quintero * configure.in: Added $x_libs in the other_libraries field in the diff --git a/gdk/gdk.h b/gdk/gdk.h index 6d453c069e..9be074e392 100644 --- a/gdk/gdk.h +++ b/gdk/gdk.h @@ -360,6 +360,10 @@ void gdk_gc_set_line_attributes (GdkGC *gc, GdkLineStyle line_style, GdkCapStyle cap_style, GdkJoinStyle join_style); +void gdk_gc_set_dashes (GdkGC *gc, + gint dash_offset, + gchar dash_list[], + gint n); void gdk_gc_copy (GdkGC *dst_gc, GdkGC *src_gc); diff --git a/gdk/gdkgc.c b/gdk/gdkgc.c index 8ffce9e478..e405c0eaf4 100644 --- a/gdk/gdkgc.c +++ b/gdk/gdkgc.c @@ -702,6 +702,22 @@ gdk_gc_set_line_attributes (GdkGC *gc, xline_style, xcap_style, xjoin_style); } +void +gdk_gc_set_dashes (GdkGC *gc, + gint dash_offset, + gchar dash_list[], + gint n) +{ + GdkGCPrivate *private; + + g_return_if_fail (gc != NULL); + g_return_if_fail (dash_list != NULL); + + private = (GdkGCPrivate*) gc; + + XSetDashes (private->xdisplay, private->xgc, dash_offset, dash_list, n); +} + void gdk_gc_copy (GdkGC *dst_gc, GdkGC *src_gc) { diff --git a/gtk/gtkctree.c b/gtk/gtkctree.c index 07307cf5d8..c6013f11db 100644 --- a/gtk/gtkctree.c +++ b/gtk/gtkctree.c @@ -398,7 +398,6 @@ gtk_ctree_realize (GtkWidget *widget) { GtkCTree *ctree; GdkGCValues values; - GdkGCPrivate *private; ctree = GTK_CTREE (widget); @@ -419,8 +418,7 @@ gtk_ctree_realize (GtkWidget *widget) { gdk_gc_set_line_attributes (ctree->lines_gc, 1, GDK_LINE_ON_OFF_DASH, None, None); - private = (GdkGCPrivate *) ctree->lines_gc; - XSetDashes (private->xdisplay, private->xgc, 0, "\1\1", 2); + gdk_gc_set_dashes (ctree->lines_gc, 0, "\1\1", 2); } if (ctree->reorderable) @@ -801,7 +799,6 @@ create_xor_gc (GtkCTree *ctree) { GtkCList *clist; GdkGCValues values; - GdkGCPrivate *private; clist = GTK_CLIST (ctree); @@ -814,8 +811,7 @@ create_xor_gc (GtkCTree *ctree) GDK_GC_SUBWINDOW); gdk_gc_set_line_attributes (ctree->xor_gc, 1, GDK_LINE_ON_OFF_DASH, None, None); - private = (GdkGCPrivate*) ctree->xor_gc; - XSetDashes (private->xdisplay, private->xgc, 0, "\2\2", 2); + gdk_gc_set_dashes (ctree->xor_gc, 0, "\2\2", 2); } static void @@ -3675,8 +3671,6 @@ void gtk_ctree_set_line_style (GtkCTree *ctree, GtkCTreeLineStyle line_style) { - GdkGCPrivate *private; - g_return_if_fail (ctree != NULL); g_return_if_fail (GTK_IS_CTREE (ctree)); @@ -3698,8 +3692,7 @@ gtk_ctree_set_line_style (GtkCTree *ctree, if (GTK_WIDGET_REALIZED (ctree)) gdk_gc_set_line_attributes (ctree->lines_gc, 1, GDK_LINE_ON_OFF_DASH, None, None); - private = (GdkGCPrivate *) ctree->lines_gc; - XSetDashes (private->xdisplay, private->xgc, 0, "\1\1", 2); + gdk_gc_set_dashes (ctree->lines_gc, 0, "\1\1", 2); break; case GTK_CTREE_LINES_NONE: break; diff --git a/gtk/testgtk.c b/gtk/testgtk.c index 28802eb2f1..b895ada678 100644 --- a/gtk/testgtk.c +++ b/gtk/testgtk.c @@ -5029,25 +5029,28 @@ create_notebook (void) GTK_SIGNAL_FUNC (gtk_notebook_next_page), GTK_OBJECT (notebook)); gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0); + GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); button = gtk_button_new_with_label ("prev"); gtk_signal_connect_object (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (gtk_notebook_prev_page), GTK_OBJECT (notebook)); gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0); + GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); button = gtk_button_new_with_label ("rotate"); gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (rotate_notebook), notebook); gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0); + GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); 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); - + GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); } if (!GTK_WIDGET_VISIBLE (window)) diff --git a/tests/testgtk.c b/tests/testgtk.c index 28802eb2f1..b895ada678 100644 --- a/tests/testgtk.c +++ b/tests/testgtk.c @@ -5029,25 +5029,28 @@ create_notebook (void) GTK_SIGNAL_FUNC (gtk_notebook_next_page), GTK_OBJECT (notebook)); gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0); + GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); button = gtk_button_new_with_label ("prev"); gtk_signal_connect_object (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (gtk_notebook_prev_page), GTK_OBJECT (notebook)); gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0); + GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); button = gtk_button_new_with_label ("rotate"); gtk_signal_connect (GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC (rotate_notebook), notebook); gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0); + GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); 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); - + GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); } if (!GTK_WIDGET_VISIBLE (window))