diff options
author | Tim Janik <timj@gtk.org> | 1998-11-28 01:56:09 +0000 |
---|---|---|
committer | Tim Janik <timj@src.gnome.org> | 1998-11-28 01:56:09 +0000 |
commit | 58af2b56bf681998479e347f2de9daf4ff73f726 (patch) | |
tree | ff7f9cbfc99d79fe335e0f28fe92b0165be41d08 /gtk | |
parent | 36d80dc374b055205b566552ada7c4e0c45764ee (diff) | |
download | gtk+-58af2b56bf681998479e347f2de9daf4ff73f726.tar.gz |
deprecated gtk_widget_freeze_accelerators and
Sat Nov 28 00:06:49 1998 Tim Janik <timj@gtk.org>
* gtk/gtkwidget.h:
* gtk/gtkwidget.c: deprecated gtk_widget_freeze_accelerators and
gtk_widget_thaw_accelerators, we provide gtk_widget_lock_accelerators
and gtk_widget_unlock_accelerators.
* gtk/gtklayout.h:
* gtk/gtklayout.c: implemented incremental freezing facility.
* gtk/gtktext.h:
* gtk/gtktext.c: implemented incremental freezing facility.
* gtk/gtkenums.h:
* gtk/gtkaccelgroup.h: moved enum GtkAccelFlags into this place.
* gtk/gtkentry.h:
* gtk/gtkentry.c:
deprecated gtk_entry_adjust_scroll().
* random GtkType, macro and indentation fixes.
Fri Nov 27 22:50:15 1998 Tim Janik <timj@gtk.org>
* gtk/gtkclist.h:
* gtk/gtkclist.c: implemented incremental freezing facility, added
a new class member (*refresh)() which takes over the thaw
functionality. the clist FROZEN flag got removed on the way.
* gtk/gtkctree.c: adaptions to feature the clist refresh functionality
and incremental freezing.
* gtk/gtkcalendar.c: implemented incremental freezing facility.
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/gtkaccelgroup.h | 24 | ||||
-rw-r--r-- | gtk/gtkcalendar.c | 75 | ||||
-rw-r--r-- | gtk/gtkcalendar.h | 2 | ||||
-rw-r--r-- | gtk/gtkclist.c | 128 | ||||
-rw-r--r-- | gtk/gtkclist.h | 21 | ||||
-rw-r--r-- | gtk/gtkctree.c | 125 | ||||
-rw-r--r-- | gtk/gtkentry.c | 25 | ||||
-rw-r--r-- | gtk/gtkentry.h | 7 | ||||
-rw-r--r-- | gtk/gtkenums.h | 17 | ||||
-rw-r--r-- | gtk/gtkimage.c | 8 | ||||
-rw-r--r-- | gtk/gtkimage.h | 10 | ||||
-rw-r--r-- | gtk/gtkinputdialog.c | 10 | ||||
-rw-r--r-- | gtk/gtkinputdialog.h | 10 | ||||
-rw-r--r-- | gtk/gtkinvisible.c | 4 | ||||
-rw-r--r-- | gtk/gtklayout.c | 28 | ||||
-rw-r--r-- | gtk/gtklayout.h | 13 | ||||
-rw-r--r-- | gtk/gtkrc.c | 2 | ||||
-rw-r--r-- | gtk/gtkrc.h | 43 | ||||
-rw-r--r-- | gtk/gtksocket.c | 6 | ||||
-rw-r--r-- | gtk/gtktext.c | 29 | ||||
-rw-r--r-- | gtk/gtktext.h | 4 | ||||
-rw-r--r-- | gtk/gtkwidget.c | 20 | ||||
-rw-r--r-- | gtk/gtkwidget.h | 9 |
23 files changed, 309 insertions, 311 deletions
diff --git a/gtk/gtkaccelgroup.h b/gtk/gtkaccelgroup.h index e04f34619b..afa6348572 100644 --- a/gtk/gtkaccelgroup.h +++ b/gtk/gtkaccelgroup.h @@ -36,14 +36,22 @@ extern "C" { typedef struct _GtkAccelGroup GtkAccelGroup; typedef struct _GtkAccelEntry GtkAccelEntry; -/* enum GtkAccelFlags: - * - * GTK_ACCEL_VISIBLE - should the accelerator appear in - * the widget's display? - * GTK_ACCEL_SIGNAL_VISIBLE - should the signal associated - * with this accelerator be also visible? - * GTK_ACCEL_LOCKED - may the accelerator be removed again? - */ +typedef enum +{ + /* should the accelerator appear in + * the widget's display? + */ + GTK_ACCEL_VISIBLE = 1 << 0, + /* should the signal associated with + * this accelerator be also visible? + */ + GTK_ACCEL_SIGNAL_VISIBLE = 1 << 1, + /* may the accelerator be removed + * again? + */ + GTK_ACCEL_LOCKED = 1 << 2, + GTK_ACCEL_MASK = 0x07 +} GtkAccelFlags; struct _GtkAccelGroup { diff --git a/gtk/gtkcalendar.c b/gtk/gtkcalendar.c index 5b618a0e6f..078618f53d 100644 --- a/gtk/gtkcalendar.c +++ b/gtk/gtkcalendar.c @@ -216,7 +216,9 @@ struct _GtkCalendarPrivateData GdkWindow *week_win; GdkWindow *arrow_win[4]; - guint header_h, day_name_h, main_h; + guint header_h; + guint day_name_h; + guint main_h; guint arrow_state[4]; guint arrow_width; @@ -234,12 +236,13 @@ struct _GtkCalendarPrivateData guint max_label_char_descent; guint max_week_char_width; + guint freeze_count; + /* flags */ - unsigned int dirty_header:1; - unsigned int dirty_day_names:1; - unsigned int dirty_main:1; - unsigned int dirty_week:1; - unsigned int frozen; + guint dirty_header : 1; + guint dirty_day_names : 1; + guint dirty_main : 1; + guint dirty_week : 1; }; #define GTK_CALENDAR_PRIVATE_DATA(widget) (((GtkCalendarPrivateData*)(GTK_CALENDAR (widget)->private_data))) @@ -466,12 +469,13 @@ gtk_calendar_init (GtkCalendar *calendar) private_data->max_label_char_descent = 0; private_data->arrow_width = 10; + + private_data->freeze_count = 0; private_data->dirty_header = 0; private_data->dirty_day_names = 0; private_data->dirty_week = 0; private_data->dirty_main = 0; - private_data->frozen = 0; } GtkWidget* @@ -1519,7 +1523,7 @@ gtk_calendar_paint_header (GtkWidget *widget) calendar = GTK_CALENDAR (widget); private_data = GTK_CALENDAR_PRIVATE_DATA (widget); - if (private_data->frozen) + if (private_data->freeze_count) { private_data->dirty_header = 1; return; @@ -1609,7 +1613,7 @@ gtk_calendar_paint_day_names (GtkWidget *widget) * Handle freeze/thaw functionality */ - if (private_data->frozen) + if (private_data->freeze_count) { private_data->dirty_day_names = 1; return; @@ -1688,7 +1692,7 @@ gtk_calendar_paint_week_numbers (GtkWidget *widget) * Handle freeze/thaw functionality */ - if (private_data->frozen) + if (private_data->freeze_count) { private_data->dirty_week = 1; return; @@ -1811,7 +1815,7 @@ gtk_calendar_paint_day (GtkWidget *widget, * Handle freeze/thaw functionality */ - if (private_data->frozen) + if (private_data->freeze_count) { private_data->dirty_main = 1; return; @@ -1908,7 +1912,7 @@ gtk_calendar_paint_main (GtkWidget *widget) calendar = GTK_CALENDAR (widget); private_data = GTK_CALENDAR_PRIVATE_DATA (widget); - if (private_data->frozen) + if (private_data->freeze_count) { private_data->dirty_main = 1; return; @@ -2453,7 +2457,7 @@ gtk_calendar_paint_arrow (GtkWidget *widget, calendar = GTK_CALENDAR (widget); private_data = GTK_CALENDAR_PRIVATE_DATA (widget); - if (private_data->frozen) + if (private_data->freeze_count) { private_data->dirty_header = 1; return; @@ -2487,7 +2491,7 @@ gtk_calendar_freeze (GtkCalendar *calendar) g_return_if_fail (calendar != NULL); g_return_if_fail (GTK_IS_CALENDAR (calendar)); - GTK_CALENDAR_PRIVATE_DATA (calendar)->frozen++; + GTK_CALENDAR_PRIVATE_DATA (calendar)->freeze_count++; } void @@ -2499,29 +2503,26 @@ gtk_calendar_thaw (GtkCalendar *calendar) g_return_if_fail (GTK_IS_CALENDAR (calendar)); private_data = GTK_CALENDAR_PRIVATE_DATA (calendar); - - if (private_data->frozen) - { - private_data->frozen--; - if (private_data->frozen) - return; - - if (private_data->dirty_header) - if (GTK_WIDGET_DRAWABLE (calendar)) - gtk_calendar_paint_header (GTK_WIDGET (calendar)); - - if (private_data->dirty_day_names) - if (GTK_WIDGET_DRAWABLE (calendar)) - gtk_calendar_paint_day_names (GTK_WIDGET (calendar)); - - if (private_data->dirty_week) - if (GTK_WIDGET_DRAWABLE (calendar)) - gtk_calendar_paint_week_numbers (GTK_WIDGET (calendar)); - - if (private_data->dirty_main) - if (GTK_WIDGET_DRAWABLE (calendar)) - gtk_calendar_paint_main (GTK_WIDGET (calendar)); - } + + if (private_data->freeze_count) + if (!(--private_data->freeze_count)) + { + if (private_data->dirty_header) + if (GTK_WIDGET_DRAWABLE (calendar)) + gtk_calendar_paint_header (GTK_WIDGET (calendar)); + + if (private_data->dirty_day_names) + if (GTK_WIDGET_DRAWABLE (calendar)) + gtk_calendar_paint_day_names (GTK_WIDGET (calendar)); + + if (private_data->dirty_week) + if (GTK_WIDGET_DRAWABLE (calendar)) + gtk_calendar_paint_week_numbers (GTK_WIDGET (calendar)); + + if (private_data->dirty_main) + if (GTK_WIDGET_DRAWABLE (calendar)) + gtk_calendar_paint_main (GTK_WIDGET (calendar)); + } } static void diff --git a/gtk/gtkcalendar.h b/gtk/gtkcalendar.h index 15084352b5..56eb007d69 100644 --- a/gtk/gtkcalendar.h +++ b/gtk/gtkcalendar.h @@ -79,7 +79,7 @@ struct _GtkCalendar gint highlight_col; gpointer private_data; - char grow_space [32]; + gchar grow_space [32]; }; struct _GtkCalendarClass diff --git a/gtk/gtkclist.c b/gtk/gtkclist.c index c9ff6c389a..d54dc4c412 100644 --- a/gtk/gtkclist.c +++ b/gtk/gtkclist.c @@ -110,7 +110,14 @@ LIST_WIDTH (GtkCList * clist) return 0; } -#define GTK_CLIST_CLASS_FW(_widget_) GTK_CLIST_CLASS (GTK_OBJECT (_widget_)->klass) +#define GTK_CLIST_CLASS_FW(_widget_) GTK_CLIST_CLASS (((GtkObject*) (_widget_))->klass) + +/* redraw the list if it's not frozen */ +#define CLIST_UNFROZEN(clist) (((GtkCList*) (clist))->freeze_count == 0) +#define CLIST_REFRESH(clist) G_STMT_START { \ + if (CLIST_UNFROZEN (clist)) \ + GTK_CLIST_CLASS_FW (clist)->refresh ((GtkCList*) (clist)); \ +} G_STMT_END /* Signals */ @@ -324,7 +331,8 @@ static void draw_row (GtkCList *clist, GtkCListRow *clist_row); static void draw_rows (GtkCList *clist, GdkRectangle *area); - +static void clist_refresh (GtkCList *clist); + /* Size Allocation / Requisition */ static void size_allocate_title_buttons (GtkCList *clist); static void size_allocate_columns (GtkCList *clist, @@ -587,6 +595,7 @@ gtk_clist_class_init (GtkCListClass *klass) container_class->set_focus_child = gtk_clist_set_focus_child; klass->scroll_adjustments = gtk_clist_scroll_adjustments; + klass->refresh = clist_refresh; klass->select_row = real_select_row; klass->unselect_row = real_unselect_row; klass->undo_selection = real_undo_selection; @@ -875,11 +884,12 @@ gtk_clist_init (GtkCList *clist) clist->flags = 0; GTK_WIDGET_UNSET_FLAGS (clist, GTK_NO_WINDOW); - GTK_CLIST_SET_FLAG (clist, CLIST_FROZEN); clist->row_mem_chunk = NULL; clist->cell_mem_chunk = NULL; + clist->freeze_count = 0; + clist->rows = 0; clist->row_center_offset = 0; clist->row_height = 0; @@ -1191,7 +1201,7 @@ gtk_clist_freeze (GtkCList *clist) g_return_if_fail (clist != NULL); g_return_if_fail (GTK_IS_CLIST (clist)); - GTK_CLIST_SET_FLAG (clist, CLIST_FROZEN); + clist->freeze_count++; } void @@ -1200,9 +1210,11 @@ gtk_clist_thaw (GtkCList *clist) g_return_if_fail (clist != NULL); g_return_if_fail (GTK_IS_CLIST (clist)); - GTK_CLIST_UNSET_FLAG (clist, CLIST_FROZEN); - adjust_adjustments (clist, FALSE); - draw_rows (clist, NULL); + if (clist->freeze_count) + { + clist->freeze_count--; + CLIST_REFRESH (clist); + } } /* PUBLIC COLUMN FUNCTIONS @@ -1501,7 +1513,7 @@ gtk_clist_set_column_justification (GtkCList *clist, } } - if (!GTK_CLIST_FROZEN (clist)) + if (CLIST_UNFROZEN (clist)) draw_rows (clist, NULL); } @@ -1768,11 +1780,7 @@ real_resize_column (GtkCList *clist, size_allocate_columns (clist, TRUE); size_allocate_title_buttons (clist); - if (!GTK_CLIST_FROZEN (clist)) - { - adjust_adjustments (clist, FALSE); - draw_rows (clist, NULL); - } + CLIST_REFRESH (clist); } static void @@ -2069,11 +2077,7 @@ gtk_clist_set_row_height (GtkCList *clist, widget->style->font->descent - 1) / 2; } - if (!GTK_CLIST_FROZEN (clist)) - { - adjust_adjustments (clist, FALSE); - draw_rows (clist, NULL); - } + CLIST_REFRESH (clist); } void @@ -2169,7 +2173,7 @@ gtk_clist_set_text (GtkCList *clist, (clist, clist_row, column, GTK_CELL_TEXT, text, 0, NULL, NULL); /* redraw the list if it's not frozen */ - if (!GTK_CLIST_FROZEN (clist)) + if (CLIST_UNFROZEN (clist)) { if (gtk_clist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE) GTK_CLIST_CLASS_FW (clist)->draw_row (clist, NULL, row, clist_row); @@ -2230,7 +2234,7 @@ gtk_clist_set_pixmap (GtkCList *clist, (clist, clist_row, column, GTK_CELL_PIXMAP, NULL, 0, pixmap, mask); /* redraw the list if it's not frozen */ - if (!GTK_CLIST_FROZEN (clist)) + if (CLIST_UNFROZEN (clist)) { if (gtk_clist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE) GTK_CLIST_CLASS_FW (clist)->draw_row (clist, NULL, row, clist_row); @@ -2296,7 +2300,7 @@ gtk_clist_set_pixtext (GtkCList *clist, (clist, clist_row, column, GTK_CELL_PIXTEXT, text, spacing, pixmap, mask); /* redraw the list if it's not frozen */ - if (!GTK_CLIST_FROZEN (clist)) + if (CLIST_UNFROZEN (clist)) { if (gtk_clist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE) GTK_CLIST_CLASS_FW (clist)->draw_row (clist, NULL, row, clist_row); @@ -2370,8 +2374,7 @@ gtk_clist_set_shift (GtkCList *clist, column_auto_resize (clist, clist_row, column, requisition.width); - if (!GTK_CLIST_FROZEN (clist) - && (gtk_clist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE)) + if (CLIST_UNFROZEN (clist) && gtk_clist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE) GTK_CLIST_CLASS_FW (clist)->draw_row (clist, NULL, row, clist_row); } @@ -2660,7 +2663,7 @@ real_insert_row (GtkCList *clist, sync_selection (clist, row, SYNC_INSERT); /* redraw the list if it isn't frozen */ - if (!GTK_CLIST_FROZEN (clist)) + if (CLIST_UNFROZEN (clist)) { adjust_adjustments (clist, FALSE); @@ -2726,7 +2729,7 @@ real_remove_row (GtkCList *clist, row_delete (clist, clist_row); /* redraw the row if it isn't frozen */ - if (!GTK_CLIST_FROZEN (clist)) + if (CLIST_UNFROZEN (clist)) { adjust_adjustments (clist, FALSE); @@ -2785,8 +2788,7 @@ real_clear (GtkCList *clist) if (clist->vadjustment) { gtk_adjustment_set_value (clist->vadjustment, 0.0); - if (!GTK_CLIST_FROZEN (clist)) - gtk_clist_thaw (clist); + CLIST_REFRESH (clist); } else gtk_widget_queue_resize (GTK_WIDGET (clist)); @@ -2905,15 +2907,13 @@ gtk_clist_swap_rows (GtkCList *clist, list = list->next; } - if (!GTK_CLIST_FROZEN (clist)) + if (CLIST_UNFROZEN (clist)) { if (gtk_clist_row_is_visible (clist, last) != GTK_VISIBILITY_NONE) - GTK_CLIST_CLASS_FW (clist)->draw_row - (clist, NULL, last, GTK_CLIST_ROW (link2)); + GTK_CLIST_CLASS_FW (clist)->draw_row (clist, NULL, last, GTK_CLIST_ROW (link2)); if (gtk_clist_row_is_visible (clist, first) != GTK_VISIBILITY_NONE) - GTK_CLIST_CLASS_FW (clist)->draw_row - (clist, NULL, first, GTK_CLIST_ROW (link1)); + GTK_CLIST_CLASS_FW (clist)->draw_row (clist, NULL, first, GTK_CLIST_ROW (link1)); } } @@ -2973,8 +2973,7 @@ gtk_clist_set_foreground (GtkCList *clist, else clist_row->fg_set = FALSE; - if (!GTK_CLIST_FROZEN (clist) - && (gtk_clist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE)) + if (CLIST_UNFROZEN (clist) && gtk_clist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE) GTK_CLIST_CLASS_FW (clist)->draw_row (clist, NULL, row, clist_row); } @@ -3004,7 +3003,7 @@ gtk_clist_set_background (GtkCList *clist, else clist_row->bg_set = FALSE; - if (!GTK_CLIST_FROZEN (clist) + if (CLIST_UNFROZEN (clist) && (gtk_clist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE)) GTK_CLIST_CLASS_FW (clist)->draw_row (clist, NULL, row, clist_row); } @@ -3064,7 +3063,7 @@ gtk_clist_set_cell_style (GtkCList *clist, column_auto_resize (clist, clist_row, column, requisition.width); /* redraw the list if it's not frozen */ - if (!GTK_CLIST_FROZEN (clist)) + if (CLIST_UNFROZEN (clist)) { if (gtk_clist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE) GTK_CLIST_CLASS_FW (clist)->draw_row (clist, NULL, row, clist_row); @@ -3148,7 +3147,7 @@ gtk_clist_set_row_style (GtkCList *clist, g_free (old_width); /* redraw the list if it's not frozen */ - if (!GTK_CLIST_FROZEN (clist)) + if (CLIST_UNFROZEN (clist)) { if (gtk_clist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE) GTK_CLIST_CLASS_FW (clist)->draw_row (clist, NULL, row, clist_row); @@ -3375,7 +3374,7 @@ fake_toggle_row (GtkCList *clist, else clist->anchor_state = GTK_CLIST_ROW (work)->state = GTK_STATE_NORMAL; - if (!GTK_CLIST_FROZEN (clist) && + if (CLIST_UNFROZEN (clist) && gtk_clist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE) GTK_CLIST_CLASS_FW (clist)->draw_row (clist, NULL, row, GTK_CLIST_ROW (work)); @@ -3506,7 +3505,7 @@ real_select_row (GtkCList *clist, clist->selection_end = g_list_append (clist->selection_end, GINT_TO_POINTER (row))->next; - if (!GTK_CLIST_FROZEN (clist) + if (CLIST_UNFROZEN (clist) && (gtk_clist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE)) GTK_CLIST_CLASS_FW (clist)->draw_row (clist, NULL, row, clist_row); } @@ -3538,7 +3537,7 @@ real_unselect_row (GtkCList *clist, clist->selection = g_list_remove (clist->selection, GINT_TO_POINTER (row)); - if (!GTK_CLIST_FROZEN (clist) + if (CLIST_UNFROZEN (clist) && (gtk_clist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE)) GTK_CLIST_CLASS_FW (clist)->draw_row (clist, NULL, row, clist_row); } @@ -3654,7 +3653,7 @@ fake_unselect_all (GtkCList *clist, { GTK_CLIST_ROW (work)->state = GTK_STATE_SELECTED; - if (!GTK_CLIST_FROZEN (clist) && + if (CLIST_UNFROZEN (clist) && gtk_clist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE) GTK_CLIST_CLASS_FW (clist)->draw_row (clist, NULL, row, GTK_CLIST_ROW (work)); @@ -3672,7 +3671,7 @@ fake_unselect_all (GtkCList *clist, continue; GTK_CLIST_ROW (work)->state = GTK_STATE_NORMAL; - if (!GTK_CLIST_FROZEN (clist) && + if (CLIST_UNFROZEN (clist) && gtk_clist_row_is_visible (clist, i) != GTK_VISIBILITY_NONE) GTK_CLIST_CLASS_FW (clist)->draw_row (clist, NULL, i, GTK_CLIST_ROW (work)); @@ -3768,18 +3767,13 @@ resync_selection (GtkCList *clist, gint i; gint e; gint row; - gboolean thaw = FALSE; GList *list; GtkCListRow *clist_row; if (clist->anchor < 0) return; - if (!GTK_CLIST_FROZEN (clist)) - { - GTK_CLIST_SET_FLAG (clist, CLIST_FROZEN); - thaw = TRUE; - } + gtk_clist_freeze (clist); i = MIN (clist->anchor, clist->drag_pos); e = MAX (clist->anchor, clist->drag_pos); @@ -3840,8 +3834,7 @@ resync_selection (GtkCList *clist, clist->anchor = -1; clist->drag_pos = -1; - if (thaw) - GTK_CLIST_UNSET_FLAG (clist, CLIST_FROZEN); + gtk_clist_thaw (clist); } static void @@ -4117,7 +4110,7 @@ gtk_clist_destroy (GtkObject *object) clist = GTK_CLIST (object); /* freeze the list */ - GTK_CLIST_SET_FLAG (clist, CLIST_FROZEN); + clist->freeze_count++; /* get rid of all the rows */ gtk_clist_clear (clist); @@ -4371,7 +4364,8 @@ gtk_clist_unrealize (GtkWidget *widget) clist = GTK_CLIST (widget); - GTK_CLIST_SET_FLAG (clist, CLIST_FROZEN); + /* freeze the list */ + clist->freeze_count++; /* detach optional row/cell styles */ @@ -4457,7 +4451,7 @@ gtk_clist_map (GtkWidget *widget) gdk_window_show (clist->column[i].window); /* unfreeze the list */ - GTK_CLIST_UNSET_FLAG (clist, CLIST_FROZEN); + clist->freeze_count = 0; } } @@ -4491,7 +4485,7 @@ gtk_clist_unmap (GtkWidget *widget) gtk_widget_unmap (clist->column[i].button); /* freeze the list */ - GTK_CLIST_SET_FLAG (clist, CLIST_FROZEN); + clist->freeze_count++; } } @@ -5304,6 +5298,7 @@ gtk_clist_forall (GtkContainer *container, * draw_row * draw_rows * draw_xor_line + * clist_refresh */ static void get_cell_style (GtkCList *clist, @@ -5730,6 +5725,19 @@ draw_xor_line (GtkCList *clist) clist->clist_window_height + 1); } +static void +clist_refresh (GtkCList *clist) +{ + g_return_if_fail (clist != NULL); + g_return_if_fail (GTK_IS_CLIST (clist)); + + if (CLIST_UNFROZEN (clist)) + { + adjust_adjustments (clist, FALSE); + draw_rows (clist, NULL); + } +} + /* get cell from coordinates * get_selection_info * gtk_clist_get_selection_info @@ -6896,7 +6904,6 @@ real_sort_list (GtkCList *clist) GList *list; GList *work; gint i; - gboolean thaw = FALSE; g_return_if_fail (clist != NULL); g_return_if_fail (GTK_IS_CLIST (clist)); @@ -6907,6 +6914,8 @@ real_sort_list (GtkCList *clist) if (gdk_pointer_is_grabbed () && GTK_WIDGET_HAS_GRAB (clist)) return; + gtk_clist_freeze (clist); + if (clist->anchor != -1 && clist->selection_mode == GTK_SELECTION_EXTENDED) { GTK_CLIST_CLASS_FW (clist)->resync_selection (clist, NULL); @@ -6916,12 +6925,6 @@ real_sort_list (GtkCList *clist) clist->undo_unselection = NULL; } - if (!GTK_CLIST_FROZEN (clist)) - { - gtk_clist_freeze (clist); - thaw = TRUE; - } - clist->row_list = gtk_clist_mergesort (clist, clist->row_list, clist->rows); work = clist->selection; @@ -6938,8 +6941,7 @@ real_sort_list (GtkCList *clist) clist->row_list_end = list; } - if (thaw) - gtk_clist_thaw (clist); + gtk_clist_thaw (clist); } static GList * diff --git a/gtk/gtkclist.h b/gtk/gtkclist.h index d140ad111a..f62e38155d 100644 --- a/gtk/gtkclist.h +++ b/gtk/gtkclist.h @@ -36,15 +36,14 @@ extern "C" { /* clist flags */ enum { - GTK_CLIST_FROZEN = 1 << 0, - GTK_CLIST_IN_DRAG = 1 << 1, - GTK_CLIST_DRAG_SELECTION = 1 << 2, - GTK_CLIST_ROW_HEIGHT_SET = 1 << 3, - GTK_CLIST_SHOW_TITLES = 1 << 4, - GTK_CLIST_CHILD_HAS_FOCUS = 1 << 5, - GTK_CLIST_ADD_MODE = 1 << 6, - GTK_CLIST_AUTO_SORT = 1 << 7, - GTK_CLIST_AUTO_RESIZE_BLOCKED = 1 << 8 + GTK_CLIST_IN_DRAG = 1 << 0, + GTK_CLIST_DRAG_SELECTION = 1 << 1, + GTK_CLIST_ROW_HEIGHT_SET = 1 << 2, + GTK_CLIST_SHOW_TITLES = 1 << 3, + GTK_CLIST_CHILD_HAS_FOCUS = 1 << 4, + GTK_CLIST_ADD_MODE = 1 << 5, + GTK_CLIST_AUTO_SORT = 1 << 6, + GTK_CLIST_AUTO_RESIZE_BLOCKED = 1 << 7 }; /* cell types */ @@ -67,7 +66,6 @@ typedef enum #define GTK_CLIST_SET_FLAG(clist,flag) (GTK_CLIST_FLAGS (clist) |= (GTK_ ## flag)) #define GTK_CLIST_UNSET_FLAG(clist,flag) (GTK_CLIST_FLAGS (clist) &= ~(GTK_ ## flag)) -#define GTK_CLIST_FROZEN(clist) (GTK_CLIST_FLAGS (clist) & GTK_CLIST_FROZEN) #define GTK_CLIST_IN_DRAG(clist) (GTK_CLIST_FLAGS (clist) & GTK_CLIST_IN_DRAG) #define GTK_CLIST_ROW_HEIGHT_SET(clist) (GTK_CLIST_FLAGS (clist) & GTK_CLIST_ROW_HEIGHT_SET) #define GTK_CLIST_SHOW_TITLES(clist) (GTK_CLIST_FLAGS (clist) & GTK_CLIST_SHOW_TITLES) @@ -109,6 +107,8 @@ struct _GtkCList /* mem chunks */ GMemChunk *row_mem_chunk; GMemChunk *cell_mem_chunk; + + guint freeze_count; /* allocation rectangle after the conatiner_border_width * and the width of the shadow border */ @@ -192,6 +192,7 @@ struct _GtkCListClass void (*scroll_adjustments) (GtkCList *clist, GtkAdjustment *hadjustment, GtkAdjustment *vadjustment); + void (*refresh) (GtkCList *clist); void (*select_row) (GtkCList *clist, gint row, gint column, diff --git a/gtk/gtkctree.c b/gtk/gtkctree.c index 54053c2e44..6c4d9d9051 100644 --- a/gtk/gtkctree.c +++ b/gtk/gtkctree.c @@ -44,7 +44,13 @@ + (clist)->hoffset) #define COLUMN_LEFT(clist, column) ((clist)->column[(column)].area.x) -#define GTK_CLIST_CLASS_FW(_widget_) GTK_CLIST_CLASS (GTK_OBJECT (_widget_)->klass) +#define GTK_CLIST_CLASS_FW(_widget_) GTK_CLIST_CLASS (((GtkObject*) (_widget_))->klass) +#define CLIST_UNFROZEN(clist) (((GtkCList*) (clist))->freeze_count == 0) +#define CLIST_REFRESH(clist) G_STMT_START { \ + if (CLIST_UNFROZEN (clist)) \ + GTK_CLIST_CLASS_FW (clist)->refresh ((GtkCList*) (clist)); \ +} G_STMT_END + enum { ARG_0, @@ -2332,7 +2338,7 @@ tree_draw_node (GtkCTree *ctree, clist = GTK_CLIST (ctree); - if (!GTK_CLIST_FROZEN (clist) && gtk_ctree_is_viewable (ctree, node)) + if (CLIST_UNFROZEN (clist) && gtk_ctree_is_viewable (ctree, node)) { GtkCTreeNode *work; gint num = 0; @@ -2651,7 +2657,6 @@ real_tree_move (GtkCTree *ctree, { GtkCList *clist; GtkCTreeNode *work; - gboolean thaw = FALSE; gboolean visible = FALSE; g_return_if_fail (ctree != NULL); @@ -2701,11 +2706,7 @@ real_tree_move (GtkCTree *ctree, new_sibling == GTK_CTREE_ROW (node)->sibling) return; - if (!GTK_CLIST_FROZEN (clist)) - { - gtk_clist_freeze (clist); - thaw = TRUE; - } + gtk_clist_freeze (clist); work = NULL; if (gtk_ctree_is_viewable (ctree, node) || @@ -2730,8 +2731,7 @@ real_tree_move (GtkCTree *ctree, (clist, ctree->tree_column, gtk_clist_optimal_column_width (clist, ctree->tree_column)); - if (thaw) - gtk_clist_thaw (clist); + gtk_clist_thaw (clist); } static void @@ -2907,8 +2907,7 @@ real_tree_expand (GtkCTree *ctree, clist->focus_row += tmp + 1; clist->rows += tmp + 1; - if (!GTK_CLIST_FROZEN (ctree)) - gtk_clist_thaw (clist); + CLIST_REFRESH (clist); } } else if (visible && clist->column[ctree->tree_column].auto_resize) @@ -3022,8 +3021,7 @@ real_tree_collapse (GtkCTree *ctree, if (row < clist->focus_row) clist->focus_row -= tmp; clist->rows -= tmp; - if (!GTK_CLIST_FROZEN (ctree)) - gtk_clist_thaw (clist); + CLIST_REFRESH (clist); } } else if (visible && clist->column[ctree->tree_column].auto_resize && @@ -3732,7 +3730,6 @@ real_select_all (GtkCList *clist) { GtkCTree *ctree; GtkCTreeNode *node; - gboolean thaw = FALSE; g_return_if_fail (clist != NULL); g_return_if_fail (GTK_IS_CTREE (clist)); @@ -3747,11 +3744,7 @@ real_select_all (GtkCList *clist) case GTK_SELECTION_EXTENDED: - if (!GTK_CLIST_FROZEN (clist)) - { - gtk_clist_freeze (clist); - thaw = TRUE; - } + gtk_clist_freeze (clist); g_list_free (clist->undo_selection); g_list_free (clist->undo_unselection); @@ -3767,8 +3760,7 @@ real_select_all (GtkCList *clist) node = GTK_CTREE_NODE_NEXT (node)) gtk_ctree_pre_recursive (ctree, node, select_row_recursive, NULL); - if (thaw) - gtk_clist_thaw (clist); + gtk_clist_thaw (clist); break; case GTK_SELECTION_MULTIPLE: @@ -4027,8 +4019,7 @@ gtk_ctree_insert_node (GtkCTree *ctree, column_auto_resize (clist, &(new_row->row), i, 0); } - if (!GTK_CLIST_FROZEN (clist)) - gtk_clist_thaw (clist); + CLIST_REFRESH (clist); return node; } @@ -4046,7 +4037,6 @@ gtk_ctree_insert_gnode (GtkCTree *ctree, GtkCTreeNode *child = NULL; GtkCTreeNode *new_child; GList *list; - gboolean thaw; GNode *work; guint depth = 1; @@ -4066,9 +4056,7 @@ gtk_ctree_insert_gnode (GtkCTree *ctree, list->data = row_new (ctree); cnode = GTK_CTREE_NODE (list); - thaw = !GTK_CLIST_FROZEN (clist); - if (thaw) - gtk_clist_freeze (clist); + gtk_clist_freeze (clist); set_node_info (ctree, cnode, "", 0, NULL, NULL, NULL, NULL, TRUE, FALSE); @@ -4100,8 +4088,7 @@ gtk_ctree_insert_gnode (GtkCTree *ctree, child = new_child; } - if (thaw) - gtk_clist_thaw (clist); + gtk_clist_thaw (clist); return cnode; } @@ -4174,18 +4161,13 @@ gtk_ctree_remove_node (GtkCTree *ctree, GtkCTreeNode *node) { GtkCList *clist; - gboolean thaw = FALSE; g_return_if_fail (ctree != NULL); g_return_if_fail (GTK_IS_CTREE (ctree)); clist = GTK_CLIST (ctree); - if (!GTK_CLIST_FROZEN (clist)) - { - gtk_clist_freeze (clist); - thaw = TRUE; - } + gtk_clist_freeze (clist); if (node) { @@ -4205,8 +4187,7 @@ gtk_ctree_remove_node (GtkCTree *ctree, else gtk_clist_clear (clist); - if (thaw) - gtk_clist_thaw (clist); + gtk_clist_thaw (clist); } static void @@ -4687,8 +4668,7 @@ gtk_ctree_expand_recursive (GtkCTree *ctree, if (node && GTK_CTREE_ROW (node)->is_leaf) return; - if (((node && gtk_ctree_is_viewable (ctree, node)) || !node) && - !GTK_CLIST_FROZEN (clist)) + if (CLIST_UNFROZEN (clist) && (!node || gtk_ctree_is_viewable (ctree, node))) { gtk_clist_freeze (clist); thaw = TRUE; @@ -4716,8 +4696,7 @@ gtk_ctree_expand_to_depth (GtkCTree *ctree, if (node && GTK_CTREE_ROW (node)->is_leaf) return; - if (((node && gtk_ctree_is_viewable (ctree, node)) || !node) && - !GTK_CLIST_FROZEN (clist)) + if (CLIST_UNFROZEN (clist) && (!node || gtk_ctree_is_viewable (ctree, node))) { gtk_clist_freeze (clist); thaw = TRUE; @@ -4760,8 +4739,7 @@ gtk_ctree_collapse_recursive (GtkCTree *ctree, clist = GTK_CLIST (ctree); - if (((node && gtk_ctree_is_viewable (ctree, node)) || !node) && - !GTK_CLIST_FROZEN (clist)) + if (CLIST_UNFROZEN (clist) && (!node || gtk_ctree_is_viewable (ctree, node))) { gtk_clist_freeze (clist); thaw = TRUE; @@ -4796,8 +4774,7 @@ gtk_ctree_collapse_to_depth (GtkCTree *ctree, clist = GTK_CLIST (ctree); - if (((node && gtk_ctree_is_viewable (ctree, node)) || !node) && - !GTK_CLIST_FROZEN (clist)) + if (CLIST_UNFROZEN (clist) && (!node || gtk_ctree_is_viewable (ctree, node))) { gtk_clist_freeze (clist); thaw = TRUE; @@ -4846,8 +4823,7 @@ gtk_ctree_toggle_expansion_recursive (GtkCTree *ctree, clist = GTK_CLIST (ctree); - if (((node && gtk_ctree_is_viewable (ctree, node)) || !node) && - !GTK_CLIST_FROZEN (clist)) + if (CLIST_UNFROZEN (clist) && (!node || gtk_ctree_is_viewable (ctree, node))) { gtk_clist_freeze (clist); thaw = TRUE; @@ -4918,8 +4894,7 @@ gtk_ctree_real_select_recursive (GtkCTree *ctree, (!state && clist->selection_mode == GTK_SELECTION_BROWSE)) return; - if (((node && gtk_ctree_is_viewable (ctree, node)) || !node) && - !GTK_CLIST_FROZEN (clist)) + if (CLIST_UNFROZEN (clist) && (!node || gtk_ctree_is_viewable (ctree, node))) { gtk_clist_freeze (clist); thaw = TRUE; @@ -5606,8 +5581,8 @@ gtk_ctree_set_indent (GtkCTree *ctree, gtk_clist_set_column_width (clist, ctree->tree_column, gtk_clist_optimal_column_width (clist, ctree->tree_column)); - else if (!GTK_CLIST_FROZEN (ctree)) - gtk_clist_thaw (GTK_CLIST (ctree)); + else + CLIST_REFRESH (ctree); } void @@ -5634,8 +5609,8 @@ gtk_ctree_set_spacing (GtkCTree *ctree, gtk_clist_set_column_width (clist, ctree->tree_column, clist->column[ctree->tree_column].width + spacing - old_spacing); - else if (!GTK_CLIST_FROZEN (ctree)) - gtk_clist_thaw (GTK_CLIST (ctree)); + else + CLIST_REFRESH (ctree); } void @@ -5662,7 +5637,7 @@ gtk_ctree_set_show_stub (GtkCTree *ctree, clist = GTK_CLIST (ctree); ctree->show_stub = show_stub; - if (!GTK_CLIST_FROZEN (clist) && clist->rows && + if (CLIST_UNFROZEN (clist) && clist->rows && gtk_clist_row_is_visible (clist, 0) != GTK_VISIBILITY_NONE) GTK_CLIST_CLASS_FW (clist)->draw_row (clist, NULL, 0, GTK_CLIST_ROW (clist->row_list)); @@ -5748,8 +5723,7 @@ gtk_ctree_set_line_style (GtkCTree *ctree, default: return; } - if (!GTK_CLIST_FROZEN (ctree)) - gtk_clist_thaw (GTK_CLIST (ctree)); + CLIST_REFRESH (ctree); } } @@ -5806,8 +5780,8 @@ gtk_ctree_set_expander_style (GtkCTree *ctree, gtk_clist_set_column_width (clist, ctree->tree_column, new_width); } - if (!GTK_CLIST_FROZEN (ctree) && GTK_WIDGET_DRAWABLE (clist)) - gtk_clist_thaw (GTK_CLIST (ctree)); + if (GTK_WIDGET_DRAWABLE (clist)) + CLIST_REFRESH (clist); } @@ -5869,18 +5843,13 @@ gtk_ctree_sort_recursive (GtkCTree *ctree, { GtkCList *clist; GtkCTreeNode *focus_node = NULL; - gboolean thaw = FALSE; g_return_if_fail (ctree != NULL); g_return_if_fail (GTK_IS_CTREE (ctree)); clist = GTK_CLIST (ctree); - if (!GTK_CLIST_FROZEN (clist)) - { - gtk_clist_freeze (clist); - thaw = TRUE; - } + gtk_clist_freeze (clist); if (clist->selection_mode == GTK_SELECTION_EXTENDED) { @@ -5908,8 +5877,7 @@ gtk_ctree_sort_recursive (GtkCTree *ctree, clist->undo_anchor = clist->focus_row; } - if (thaw) - gtk_clist_thaw (clist); + gtk_clist_thaw (clist); } static void @@ -5924,18 +5892,13 @@ gtk_ctree_sort_node (GtkCTree *ctree, { GtkCList *clist; GtkCTreeNode *focus_node = NULL; - gboolean thaw = FALSE; g_return_if_fail (ctree != NULL); g_return_if_fail (GTK_IS_CTREE (ctree)); clist = GTK_CLIST (ctree); - if (!GTK_CLIST_FROZEN (clist)) - { - gtk_clist_freeze (clist); - thaw = TRUE; - } + gtk_clist_freeze (clist); if (clist->selection_mode == GTK_SELECTION_EXTENDED) { @@ -5960,8 +5923,7 @@ gtk_ctree_sort_node (GtkCTree *ctree, clist->undo_anchor = clist->focus_row; } - if (thaw) - gtk_clist_thaw (clist); + gtk_clist_thaw (clist); } /************************************************************************/ @@ -5980,7 +5942,7 @@ fake_unselect_all (GtkCList *clist, { GTK_CTREE_ROW (focus_node)->row.state = GTK_STATE_SELECTED; - if (!GTK_CLIST_FROZEN (clist) && + if (CLIST_UNFROZEN (clist) && gtk_clist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE) GTK_CLIST_CLASS_FW (clist)->draw_row (clist, NULL, row, GTK_CLIST_ROW (focus_node)); @@ -6018,7 +5980,6 @@ resync_selection (GtkCList *clist, GdkEvent *event) gint i; gint e; gint row; - gboolean thaw = FALSE; gboolean unselect; g_return_if_fail (clist != NULL); @@ -6029,11 +5990,7 @@ resync_selection (GtkCList *clist, GdkEvent *event) ctree = GTK_CTREE (clist); - if (!GTK_CLIST_FROZEN (clist)) - { - GTK_CLIST_SET_FLAG (clist, CLIST_FROZEN); - thaw = TRUE; - } + clist->freeze_count++; i = MIN (clist->anchor, clist->drag_pos); e = MAX (clist->anchor, clist->drag_pos); @@ -6098,8 +6055,8 @@ resync_selection (GtkCList *clist, GdkEvent *event) clist->anchor = -1; clist->drag_pos = -1; - if (thaw) - GTK_CLIST_UNSET_FLAG (clist, CLIST_FROZEN); + if (!CLIST_UNFROZEN (clist)) + clist->freeze_count--; } static void diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index 663485be55..847fb30378 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -88,7 +88,7 @@ static void gtk_entry_queue_draw (GtkEntry *entry); static gint gtk_entry_timer (gpointer data); static gint gtk_entry_position (GtkEntry *entry, gint x); -/* static void gtk_entry_adjust_scroll (GtkEntry *entry); */ +static void entry_adjust_scroll (GtkEntry *entry); static void gtk_entry_grow_text (GtkEntry *entry); static void gtk_entry_insert_text (GtkEditable *editable, const gchar *new_text, @@ -276,7 +276,7 @@ gtk_entry_class_init (GtkEntryClass *class) editable_class->insert_text = gtk_entry_insert_text; editable_class->delete_text = gtk_entry_delete_text; - editable_class->changed = (void (*)(GtkEditable *)) gtk_entry_adjust_scroll; + editable_class->changed = (void (*)(GtkEditable *)) entry_adjust_scroll; editable_class->move_cursor = gtk_entry_move_cursor; editable_class->move_word = gtk_entry_move_word; @@ -445,7 +445,7 @@ gtk_entry_set_position (GtkEntry *entry, GTK_EDITABLE(entry)->current_pos = entry->text_length; else GTK_EDITABLE(entry)->current_pos = position; - gtk_entry_adjust_scroll (entry); + entry_adjust_scroll (entry); } static void @@ -762,7 +762,7 @@ gtk_entry_size_allocate (GtkWidget *widget, widget->requisition.height - widget->style->klass->ythickness * 2); /* And make sure the cursor is on screen */ - gtk_entry_adjust_scroll (entry); + entry_adjust_scroll (entry); #ifdef USE_XIM if (editable->ic && (gdk_ic_get_style (editable->ic) & GDK_IM_PREEDIT_POSITION)) @@ -965,7 +965,7 @@ gtk_entry_motion_notify (GtkWidget *widget, GTK_EDITABLE(entry)->selection_end_pos = gtk_entry_position (entry, x + entry->scroll_offset); GTK_EDITABLE(entry)->current_pos = GTK_EDITABLE(entry)->selection_end_pos; - gtk_entry_adjust_scroll (entry); + entry_adjust_scroll (entry); gtk_entry_queue_draw (entry); return FALSE; @@ -1159,7 +1159,7 @@ gtk_entry_key_press (GtkWidget *widget, editable->selection_start_pos != editable->selection_end_pos, event->time); - gtk_entry_adjust_scroll (entry); + entry_adjust_scroll (entry); gtk_entry_queue_draw (entry); } @@ -1520,6 +1520,17 @@ gtk_entry_position (GtkEntry *entry, void gtk_entry_adjust_scroll (GtkEntry *entry) { + g_return_if_fail (entry != NULL); + g_return_if_fail (GTK_IS_ENTRY (entry)); + + g_message ("gtk_entry_adjust_scroll() is deprecated"); + + entry_adjust_scroll (entry); +} + +static void +entry_adjust_scroll (GtkEntry *entry) +{ gint xoffset, max_offset; gint text_area_width; @@ -2317,7 +2328,7 @@ gtk_entry_style_set (GtkWidget *widget, scroll_char = gtk_entry_find_position (entry, entry->scroll_offset); gtk_entry_recompute_offsets (GTK_ENTRY (widget)); entry->scroll_offset = entry->char_offset[scroll_char]; - gtk_entry_adjust_scroll (entry); + entry_adjust_scroll (entry); gdk_window_set_background (widget->window, &widget->style->base[GTK_WIDGET_STATE (widget)]); gdk_window_set_background (entry->text_area, &widget->style->base[GTK_WIDGET_STATE (widget)]); diff --git a/gtk/gtkentry.h b/gtk/gtkentry.h index a82619d7cc..a487c5e56b 100644 --- a/gtk/gtkentry.h +++ b/gtk/gtkentry.h @@ -92,12 +92,13 @@ void gtk_entry_set_visibility (GtkEntry *entry, gboolean visible); void gtk_entry_set_editable (GtkEntry *entry, gboolean editable); -/* DO NOT USE THIS FUNCTION. The only reason why it is public - * is that there were bugs in GtkEntry. IT WILL DISAPPEAR. */ -void gtk_entry_adjust_scroll (GtkEntry *entry); /* text is truncated if needed */ void gtk_entry_set_max_length (GtkEntry *entry, guint16 max); +/* deprecated function. The only reason why it is public + * is that there were bugs in GtkEntry. IT WILL DISAPPEAR. + */ +void gtk_entry_adjust_scroll (GtkEntry *entry); #ifdef __cplusplus } diff --git a/gtk/gtkenums.h b/gtk/gtkenums.h index c914fc4199..d03eddd12b 100644 --- a/gtk/gtkenums.h +++ b/gtk/gtkenums.h @@ -23,23 +23,6 @@ extern "C" { #endif /* __cplusplus */ -typedef enum -{ - /* should the accelerator appear in - * the widget's display? - */ - GTK_ACCEL_VISIBLE = 1 << 0, - /* should the signal associated with - * this accelerator be also visible? - */ - GTK_ACCEL_SIGNAL_VISIBLE = 1 << 1, - /* may the accelerator be removed - * again? - */ - GTK_ACCEL_LOCKED = 1 << 2, - GTK_ACCEL_MASK = 0x07 -} GtkAccelFlags; - /* Arrow types */ typedef enum { diff --git a/gtk/gtkimage.c b/gtk/gtkimage.c index 3f2cb73e62..9b26aafb2f 100644 --- a/gtk/gtkimage.c +++ b/gtk/gtkimage.c @@ -26,10 +26,10 @@ static gint gtk_image_expose (GtkWidget *widget, GdkEventExpose *event); -guint +GtkType gtk_image_get_type (void) { - static guint image_type = 0; + static GtkType image_type = 0; if (!image_type) { @@ -45,7 +45,7 @@ gtk_image_get_type (void) (GtkClassInitFunc) NULL, }; - image_type = gtk_type_unique (gtk_misc_get_type (), &image_info); + image_type = gtk_type_unique (GTK_TYPE_MISC, &image_info); } return image_type; @@ -78,7 +78,7 @@ gtk_image_new (GdkImage *val, g_return_val_if_fail (val != NULL, NULL); - image = gtk_type_new (gtk_image_get_type ()); + image = gtk_type_new (GTK_TYPE_IMAGE); gtk_image_set (image, val, mask); diff --git a/gtk/gtkimage.h b/gtk/gtkimage.h index bd3184d3c6..70f36548ee 100644 --- a/gtk/gtkimage.h +++ b/gtk/gtkimage.h @@ -29,9 +29,11 @@ extern "C" { #endif /* __cplusplus */ -#define GTK_IMAGE(obj) GTK_CHECK_CAST (obj, gtk_image_get_type (), GtkImage) -#define GTK_IMAGE_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_image_get_type (), GtkImageClass) -#define GTK_IS_IMAGE(obj) GTK_CHECK_TYPE (obj, gtk_image_get_type ()) +#define GTK_TYPE_IMAGE (gtk_image_get_type ()) +#define GTK_IMAGE(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_IMAGE, GtkImage)) +#define GTK_IMAGE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_IMAGE, GtkImageClass)) +#define GTK_IS_IMAGE(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_IMAGE)) +#define GTK_IS_IMAGE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_IMAGE)) typedef struct _GtkImage GtkImage; @@ -51,7 +53,7 @@ struct _GtkImageClass }; -guint gtk_image_get_type (void); +GtkType gtk_image_get_type (void); GtkWidget* gtk_image_new (GdkImage *val, GdkBitmap *mask); void gtk_image_set (GtkImage *image, diff --git a/gtk/gtkinputdialog.c b/gtk/gtkinputdialog.c index d219668fce..66bc8e5a99 100644 --- a/gtk/gtkinputdialog.c +++ b/gtk/gtkinputdialog.c @@ -107,10 +107,10 @@ gtk_input_dialog_get_device_info(guint32 deviceid) return NULL; } -guint +GtkType gtk_input_dialog_get_type (void) { - static guint input_dialog_type = 0; + static GtkType input_dialog_type = 0; if (!input_dialog_type) { @@ -126,7 +126,7 @@ gtk_input_dialog_get_type (void) (GtkClassInitFunc) NULL, }; - input_dialog_type = gtk_type_unique (gtk_dialog_get_type (), + input_dialog_type = gtk_type_unique (GTK_TYPE_DIALOG, &input_dialog_info); } @@ -140,7 +140,7 @@ gtk_input_dialog_class_init (GtkInputDialogClass *klass) object_class = (GtkObjectClass*) klass; - parent_class = gtk_type_class (gtk_dialog_get_type ()); + parent_class = gtk_type_class (GTK_TYPE_DIALOG); input_dialog_signals[ENABLE_DEVICE] = gtk_signal_new ("enable_device", @@ -358,7 +358,7 @@ gtk_input_dialog_new (void) { GtkInputDialog *inputd; - inputd = gtk_type_new (gtk_input_dialog_get_type ()); + inputd = gtk_type_new (GTK_TYPE_INPUT_DIALOG); return GTK_WIDGET (inputd); } diff --git a/gtk/gtkinputdialog.h b/gtk/gtkinputdialog.h index e49c39ba49..178d29f744 100644 --- a/gtk/gtkinputdialog.h +++ b/gtk/gtkinputdialog.h @@ -29,9 +29,11 @@ extern "C" { #endif /* __cplusplus */ -#define GTK_INPUT_DIALOG(obj) GTK_CHECK_CAST (obj, gtk_input_dialog_get_type (), GtkInputDialog) -#define GTK_INPUT_DIALOG_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_input_dialog_get_type (), GtkInputDialogClass) -#define GTK_IS_INPUT_DIALOG(obj) GTK_CHECK_TYPE (obj, gtk_input_dialog_get_type ()) +#define GTK_TYPE_INPUT_DIALOG (gtk_input_dialog_get_type ()) +#define GTK_INPUT_DIALOG(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_INPUT_DIALOG, GtkInputDialog)) +#define GTK_INPUT_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_INPUT_DIALOG, GtkInputDialogClass)) +#define GTK_IS_INPUT_DIALOG(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_INPUT_DIALOG)) +#define GTK_IS_INPUT_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_INPUT_DIALOG)) typedef struct _GtkInputDialog GtkInputDialog; @@ -66,7 +68,7 @@ struct _GtkInputDialogClass }; -guint gtk_input_dialog_get_type (void); +GtkType gtk_input_dialog_get_type (void); GtkWidget* gtk_input_dialog_new (void); diff --git a/gtk/gtkinvisible.c b/gtk/gtkinvisible.c index b9c3e181f9..8233184e75 100644 --- a/gtk/gtkinvisible.c +++ b/gtk/gtkinvisible.c @@ -45,7 +45,7 @@ gtk_invisible_get_type (void) (GtkClassInitFunc) NULL, }; - invisible_type = gtk_type_unique (gtk_widget_get_type (), &invisible_info); + invisible_type = gtk_type_unique (GTK_TYPE_WIDGET, &invisible_info); } return invisible_type; @@ -75,7 +75,7 @@ gtk_invisible_init (GtkInvisible *invisible) GtkWidget* gtk_invisible_new (void) { - return GTK_WIDGET ( gtk_type_new (gtk_invisible_get_type ())); + return GTK_WIDGET (gtk_type_new (GTK_TYPE_INVISIBLE)); } static void diff --git a/gtk/gtklayout.c b/gtk/gtklayout.c index 784cf73f0b..2ca7a12e5c 100644 --- a/gtk/gtklayout.c +++ b/gtk/gtklayout.c @@ -88,7 +88,7 @@ gtk_layout_new (GtkAdjustment *hadjustment, { GtkLayout *layout; - layout = gtk_type_new (gtk_layout_get_type()); + layout = gtk_type_new (GTK_TYPE_LAYOUT); gtk_layout_set_adjustments (layout, hadjustment, vadjustment); @@ -279,7 +279,7 @@ gtk_layout_freeze (GtkLayout *layout) g_return_if_fail (layout != NULL); g_return_if_fail (GTK_IS_LAYOUT (layout)); - layout->frozen = TRUE; + layout->freeze_count++; } void @@ -288,20 +288,20 @@ gtk_layout_thaw (GtkLayout *layout) g_return_if_fail (layout != NULL); g_return_if_fail (GTK_IS_LAYOUT (layout)); - if (!layout->frozen) - return; - - layout->frozen = FALSE; - gtk_layout_position_children (layout); - gtk_widget_draw (GTK_WIDGET (layout), NULL); + if (layout->freeze_count) + if (!(--layout->freeze_count)) + { + gtk_layout_position_children (layout); + gtk_widget_draw (GTK_WIDGET (layout), NULL); + } } /* Basic Object handling procedures */ -guint +GtkType gtk_layout_get_type (void) { - static guint layout_type = 0; + static GtkType layout_type = 0; if (!layout_type) { @@ -316,7 +316,7 @@ gtk_layout_get_type (void) (GtkArgGetFunc) NULL, }; - layout_type = gtk_type_unique (gtk_container_get_type (), &layout_info); + layout_type = gtk_type_unique (GTK_TYPE_CONTAINER, &layout_info); } return layout_type; @@ -333,7 +333,7 @@ gtk_layout_class_init (GtkLayoutClass *class) widget_class = (GtkWidgetClass*) class; container_class = (GtkContainerClass*) class; - parent_class = gtk_type_class (gtk_container_get_type ()); + parent_class = gtk_type_class (GTK_TYPE_CONTAINER); widget_class->realize = gtk_layout_realize; widget_class->unrealize = gtk_layout_unrealize; @@ -376,6 +376,8 @@ gtk_layout_init (GtkLayout *layout) layout->scroll_x = 0; layout->scroll_y = 0; layout->visibility = GDK_VISIBILITY_PARTIAL; + + layout->freeze_count = 0; } /* Widget methods @@ -907,7 +909,7 @@ gtk_layout_adjustment_changed (GtkAdjustment *adjustment, layout->xoffset = (gint)layout->hadjustment->value; layout->yoffset = (gint)layout->vadjustment->value; - if (layout->frozen) + if (layout->freeze_count) return; if (!GTK_WIDGET_MAPPED (layout)) diff --git a/gtk/gtklayout.h b/gtk/gtklayout.h index 0b8198fb1b..9ec2812fa3 100644 --- a/gtk/gtklayout.h +++ b/gtk/gtklayout.h @@ -32,9 +32,11 @@ extern "C" { #endif /* __cplusplus */ -#define GTK_LAYOUT(obj) GTK_CHECK_CAST (obj, gtk_layout_get_type (), GtkLayout) -#define GTK_LAYOUT_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_layout_get_type (), GtkLayoutClass) -#define GTK_IS_LAYOUT(obj) GTK_CHECK_TYPE (obj, gtk_layout_get_type ()) +#define GTK_TYPE_LAYOUT (gtk_layout_get_type ()) +#define GTK_LAYOUT(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_LAYOUT, GtkLayout)) +#define GTK_LAYOUT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_LAYOUT, GtkLayoutClass)) +#define GTK_IS_LAYOUT(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_LAYOUT)) +#define GTK_IS_LAYOUT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_LAYOUT)) typedef struct _GtkLayout GtkLayout; typedef struct _GtkLayoutClass GtkLayoutClass; @@ -69,7 +71,7 @@ struct _GtkLayout { gint scroll_x; gint scroll_y; - guint frozen : 1; + guint freeze_count; }; struct _GtkLayoutClass { @@ -80,10 +82,9 @@ struct _GtkLayoutClass { GtkAdjustment *vadjustment); }; +GtkType gtk_layout_get_type (void); GtkWidget* gtk_layout_new (GtkAdjustment *hadjustment, GtkAdjustment *vadjustment); - -guint gtk_layout_get_type (void); void gtk_layout_put (GtkLayout *layout, GtkWidget *widget, gint x, diff --git a/gtk/gtkrc.c b/gtk/gtkrc.c index 23f2f2b39b..3e10e45a79 100644 --- a/gtk/gtkrc.c +++ b/gtk/gtkrc.c @@ -1391,7 +1391,7 @@ gtk_rc_find_pixmap_in_path (GScanner *scanner, } gchar* -gtk_rc_find_module_in_path (GScanner *scanner, +gtk_rc_find_module_in_path (GScanner *scanner, const gchar *module_file) { gint i; diff --git a/gtk/gtkrc.h b/gtk/gtkrc.h index 53e3188b57..93d2c13cae 100644 --- a/gtk/gtkrc.h +++ b/gtk/gtkrc.h @@ -27,6 +27,7 @@ extern "C" { #endif /* __cplusplus */ + typedef enum { GTK_RC_FG = 1 << 0, GTK_RC_BG = 1 << 1, @@ -36,10 +37,10 @@ typedef enum { struct _GtkRcStyle { - char *name; - char *font_name; - char *fontset_name; - char *bg_pixmap_name[5]; + gchar *name; + gchar *font_name; + gchar *fontset_name; + gchar *bg_pixmap_name[5]; GtkRcFlags color_flags[5]; GdkColor fg[5]; @@ -66,29 +67,29 @@ void gtk_rc_add_widget_class_style (GtkRcStyle *rc_style, void gtk_rc_add_class_style (GtkRcStyle *rc_style, const gchar *pattern); -GtkRcStyle *gtk_rc_style_new (void); +GtkRcStyle* gtk_rc_style_new (void); void gtk_rc_style_ref (GtkRcStyle *rc_style); void gtk_rc_style_unref (GtkRcStyle *rc_style); /* Tell gtkrc to use a custom routine to load images specified in rc files instead of * the default xpm-only loader */ -typedef GdkPixmap * (*GtkImageLoader) (GdkWindow *window, - GdkColormap *colormap, - GdkBitmap **mask, - GdkColor *transparent_color, - const gchar *filename); -void gtk_rc_set_image_loader(GtkImageLoader loader); - -GdkPixmap *gtk_rc_load_image (GdkColormap *colormap, - GdkColor *transparent_color, - const gchar *filename); -gchar *gtk_rc_find_pixmap_in_path (GScanner *scanner, - const gchar *pixmap_file); -gchar *gtk_rc_find_module_in_path (GScanner *scanner, - const gchar *module_file); -gchar *gtk_rc_get_theme_dir(void); -gchar *gtk_rc_get_module_dir(void); +typedef GdkPixmap* (*GtkImageLoader) (GdkWindow *window, + GdkColormap *colormap, + GdkBitmap **mask, + GdkColor *transparent_color, + const gchar *filename); +void gtk_rc_set_image_loader (GtkImageLoader loader); + +GdkPixmap* gtk_rc_load_image (GdkColormap *colormap, + GdkColor *transparent_color, + const gchar *filename); +gchar* gtk_rc_find_pixmap_in_path (GScanner *scanner, + const gchar *pixmap_file); +gchar* gtk_rc_find_module_in_path (GScanner *scanner, + const gchar *module_file); +gchar* gtk_rc_get_theme_dir (void); +gchar* gtk_rc_get_module_dir (void); /* private functions/definitions */ typedef enum { diff --git a/gtk/gtksocket.c b/gtk/gtksocket.c index dcf905c59f..c8d8e2bca3 100644 --- a/gtk/gtksocket.c +++ b/gtk/gtksocket.c @@ -143,7 +143,11 @@ gtk_socket_steal (GtkSocket *socket, guint32 id) if (socket->plug_window && socket->plug_window->user_data) { - GtkWidget *child_widget = GTK_WIDGET (socket->plug_window->user_data); + /* + GtkWidget *child_widget; + + child_widget = GTK_WIDGET (socket->plug_window->user_data); + */ g_warning("Stealing from same app not yet implemented"); diff --git a/gtk/gtktext.c b/gtk/gtktext.c index 132f9266a9..0603485e04 100644 --- a/gtk/gtktext.c +++ b/gtk/gtktext.c @@ -676,6 +676,8 @@ gtk_text_init (GtkText *text) text->text = g_new (guchar, INITIAL_BUFFER_SIZE); text->text_len = INITIAL_BUFFER_SIZE; + + text->freeze_count = 0; if (!params_mem_chunk) params_mem_chunk = g_mem_chunk_new ("LineParams", @@ -887,7 +889,7 @@ gtk_text_freeze (GtkText *text) g_return_if_fail (text != NULL); g_return_if_fail (GTK_IS_TEXT (text)); - text->freeze = TRUE; + text->freeze_count++; } void @@ -896,13 +898,12 @@ gtk_text_thaw (GtkText *text) g_return_if_fail (text != NULL); g_return_if_fail (GTK_IS_TEXT (text)); - text->freeze = FALSE; - - if (GTK_WIDGET_REALIZED (text)) - { - recompute_geometry (text); - gtk_widget_queue_draw (GTK_WIDGET (text)); - } + if (text->freeze_count) + if (!(--text->freeze_count) && GTK_WIDGET_REALIZED (text)) + { + recompute_geometry (text); + gtk_widget_queue_draw (GTK_WIDGET (text)); + } } void @@ -932,13 +933,13 @@ gtk_text_insert (GtkText *text, if (length == 0) return; - if (!text->freeze && (length > FREEZE_LENGTH)) + if (!text->freeze_count && (length > FREEZE_LENGTH)) { gtk_text_freeze (text); frozen = TRUE; } - if (!text->freeze && (text->line_start_cache != NULL)) + if (!text->freeze_count && (text->line_start_cache != NULL)) { find_line_containing_point (text, text->point.index, TRUE); old_height = total_line_height (text, text->current_line, 1); @@ -970,7 +971,7 @@ gtk_text_insert (GtkText *text, advance_mark_n (&text->point, length); - if (!text->freeze && (text->line_start_cache != NULL)) + if (!text->freeze_count && text->line_start_cache != NULL) insert_expose (text, old_height, length, new_line_count); if (frozen) @@ -1006,13 +1007,13 @@ gtk_text_forward_delete (GtkText *text, if (text->point.index + nchars > TEXT_LENGTH (text) || nchars <= 0) return FALSE; - if (!text->freeze && (nchars > FREEZE_LENGTH)) + if (!text->freeze_count && nchars > FREEZE_LENGTH) { gtk_text_freeze (text); frozen = TRUE; } - if (!text->freeze && (text->line_start_cache != NULL)) + if (!text->freeze_count && text->line_start_cache != NULL) { /* We need to undraw the cursor here, since we may later * delete the cursor's property @@ -1054,7 +1055,7 @@ gtk_text_forward_delete (GtkText *text, delete_text_property (text, nchars); - if (!text->freeze && (text->line_start_cache != NULL)) + if (!text->freeze_count && (text->line_start_cache != NULL)) { delete_expose (text, nchars, old_lines, old_height); draw_cursor (text, FALSE); diff --git a/gtk/gtktext.h b/gtk/gtktext.h index 8284682dd4..5b576fc981 100644 --- a/gtk/gtktext.h +++ b/gtk/gtktext.h @@ -101,10 +101,10 @@ struct _GtkText /* True iff this buffer is wrapping lines, otherwise it is using a * horizontal scrollbar. */ guint line_wrap : 1; - /* Frozen, don't do updates. @@@ fixme */ - guint freeze : 1; guint word_wrap : 1; + /* Frozen, don't do updates. @@@ fixme */ + guint freeze_count; /* TEXT PROPERTIES */ /* A doubly-linked-list containing TextProperty objects. */ diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 426e0ead0c..5dfd184418 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -2319,7 +2319,7 @@ gtk_widget_stop_remove_accelerator (GtkWidget *widget) } void -gtk_widget_freeze_accelerators (GtkWidget *widget) +gtk_widget_lock_accelerators (GtkWidget *widget) { g_return_if_fail (widget != NULL); g_return_if_fail (GTK_IS_WIDGET (widget)); @@ -2342,7 +2342,7 @@ gtk_widget_freeze_accelerators (GtkWidget *widget) } void -gtk_widget_thaw_accelerators (GtkWidget *widget) +gtk_widget_unlock_accelerators (GtkWidget *widget) { g_return_if_fail (widget != NULL); g_return_if_fail (GTK_IS_WIDGET (widget)); @@ -2363,6 +2363,22 @@ gtk_widget_thaw_accelerators (GtkWidget *widget) } void +gtk_widget_thaw_accelerators (GtkWidget *widget) +{ + g_message ("gtk_widget_thaw_accelerators() is deprecated"); + + gtk_widget_unlock_accelerators (widget); +} + +void +gtk_widget_freeze_accelerators (GtkWidget *widget) +{ + g_message ("gtk_widget_freeze_accelerators() is deprecated"); + + gtk_widget_lock_accelerators (widget); +} + +void gtk_widget_add_accelerator (GtkWidget *widget, const gchar *accel_signal, GtkAccelGroup *accel_group, diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h index fb5ed8839c..98d340cf2d 100644 --- a/gtk/gtkwidget.h +++ b/gtk/gtkwidget.h @@ -466,8 +466,8 @@ guint gtk_widget_accelerator_signal (GtkWidget *widget, GtkAccelGroup *accel_group, guint accel_key, guint accel_mods); -void gtk_widget_freeze_accelerators (GtkWidget *widget); -void gtk_widget_thaw_accelerators (GtkWidget *widget); +void gtk_widget_lock_accelerators (GtkWidget *widget); +void gtk_widget_unlock_accelerators (GtkWidget *widget); gint gtk_widget_event (GtkWidget *widget, GdkEvent *event); @@ -595,6 +595,11 @@ void gtk_widget_class_path (GtkWidget *widget, #endif /* GTK_TRACE_OBJECTS && __GNUC__ */ +/* deprecated */ +void gtk_widget_freeze_accelerators (GtkWidget *widget); +void gtk_widget_thaw_accelerators (GtkWidget *widget); + + #ifdef __cplusplus } #endif /* __cplusplus */ |