X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=src%2Fscrollbar-gtk.c;h=ca3d615d08339f0ad2708852bc344e67777de372;hb=506a27d9690049e121fccf1a8947ec57e62055aa;hp=ba76d435c50c1b0be75b9e3b6a626a0228e796bd;hpb=02f4d2761a98c5cb9d5b423d2361160a5d8c9ee4;p=chise%2Fxemacs-chise.git.1 diff --git a/src/scrollbar-gtk.c b/src/scrollbar-gtk.c index ba76d43..ca3d615 100644 --- a/src/scrollbar-gtk.c +++ b/src/scrollbar-gtk.c @@ -1,4 +1,4 @@ -/* scrollbar implementation -- X interface. +/* scrollbar implementation -- GTK interface. Copyright (C) 1994, 1995 Board of Trustees, University of Illinois. Copyright (C) 1994 Amdhal Corporation. Copyright (C) 1995 Sun Microsystems, Inc. @@ -57,14 +57,16 @@ gtk_inhibit_scrollbar_slider_size_change (void) static void gtk_free_scrollbar_instance (struct scrollbar_instance *instance) { - if (SCROLLBAR_GTK_WIDGET (instance)) + if (instance->scrollbar_data) { - gtk_widget_hide_all (SCROLLBAR_GTK_WIDGET (instance)); - gtk_widget_destroy (SCROLLBAR_GTK_WIDGET (instance)); - } + if (SCROLLBAR_GTK_WIDGET (instance)) + { + gtk_widget_hide_all (SCROLLBAR_GTK_WIDGET (instance)); + gtk_widget_destroy (SCROLLBAR_GTK_WIDGET (instance)); + } - if (instance->scrollbar_data) - xfree (instance->scrollbar_data); + xfree (instance->scrollbar_data); + } } /* A device method. */ @@ -98,8 +100,9 @@ gtk_create_scrollbar_instance (struct frame *f, int vertical, SCROLLBAR_GTK_VDRAG_ORIG_VALUE (instance) = -1; SCROLLBAR_GTK_LAST_VALUE (instance) = adj->value; - gtk_object_set_data (GTK_OBJECT (adj), "xemacs::gui_id", (void *) SCROLLBAR_GTK_ID (instance)); - gtk_object_set_data (GTK_OBJECT (adj), "xemacs::frame", f); + gtk_object_set_data (GTK_OBJECT (adj), GTK_DATA_GUI_IDENTIFIER, + (void *) SCROLLBAR_GTK_ID (instance)); + gtk_object_set_data (GTK_OBJECT (adj), GTK_DATA_FRAME_IDENTIFIER, f); gtk_object_set_data (GTK_OBJECT (adj), "xemacs::sb_instance", instance); sb = GTK_SCROLLBAR (vertical ? gtk_vscrollbar_new (adj) : gtk_hscrollbar_new (adj)); @@ -217,6 +220,21 @@ gtk_update_scrollbar_instance_status (struct window *w, int active, int size, gtk_widget_set_usize (wid, pos_data->scrollbar_width, pos_data->scrollbar_height); + + /* + UGLY! UGLY! UGLY! Changes to wid->allocation are queued and + not performed until the GTK event loop. However, when the + fontlock progress bar is run, the vertical scrollbar's height + is change and then changed back before events are again + processed. This means that the change back is not seen and + the scrollbar is left too short. Fix this by making the + change manually so the test above sees the change. This does + not seem to cause problems in other cases. + */ + + wid->allocation.width = pos_data->scrollbar_width; + wid->allocation.height = pos_data->scrollbar_height; + modified_p = 1; } @@ -228,6 +246,21 @@ gtk_update_scrollbar_instance_status (struct window *w, int active, int size, wid, pos_data->scrollbar_x, pos_data->scrollbar_y); + + /* + UGLY! UGLY! UGLY! Changes to wid->allocation are queued and + not performed until the GTK event loop. However, when the + fontlock progress bar is run, the horizontal scrollbar's + position is change and then changed back before events are + again processed. This means that the change back is not seen + and the scrollbar is left in the wrong position. Fix this by + making the change manually so the test above sees the change. + This does not seem to cause problems in other cases. + */ + + wid->allocation.x = pos_data->scrollbar_x; + wid->allocation.y = pos_data->scrollbar_y; + modified_p = 1; } @@ -333,7 +366,7 @@ gtk_scrollbar_loop (enum gtk_scrollbar_loop type, Lisp_Object window, } break; default: - abort (); + ABORT (); } } @@ -359,9 +392,9 @@ scrollbar_cb (GtkAdjustment *adj, gpointer user_data) { /* This function can GC */ int vertical = (int) user_data; - struct frame *f = gtk_object_get_data (GTK_OBJECT (adj), "xemacs::frame"); + struct frame *f = gtk_object_get_data (GTK_OBJECT (adj), GTK_DATA_FRAME_IDENTIFIER); struct scrollbar_instance *instance = gtk_object_get_data (GTK_OBJECT (adj), "xemacs::sb_instance"); - GUI_ID id = (GUI_ID) gtk_object_get_data (GTK_OBJECT (adj), "xemacs::gui_id"); + GUI_ID id = (GUI_ID) gtk_object_get_data (GTK_OBJECT (adj), GTK_DATA_GUI_IDENTIFIER); Lisp_Object win, frame; struct window_mirror *mirror; Lisp_Object event_type = Qnil; @@ -407,7 +440,7 @@ scrollbar_cb (GtkAdjustment *adj, gpointer user_data) event_data = Fcons (win, make_int ((int)adj->value)); break; default: - abort(); + ABORT(); } signal_special_gtk_user_event (frame, event_type, event_data); @@ -431,13 +464,13 @@ gtk_scrollbar_pointer_changed_in_window (struct window *w) void gtk_update_frame_scrollbars (struct frame *f) { - /* Consider this code to be "in_display" so that we abort() if Fsignal() + /* Consider this code to be "in_display" so that we ABORT() if Fsignal() gets called. */ in_display++; gtk_scrollbar_loop (GTK_UPDATE_FRAME_SCROLLBARS, f->root_window, f->root_mirror, 0, (GdkWindow *) NULL); in_display--; - if (in_display < 0) abort (); + if (in_display < 0) ABORT (); } #ifdef MEMORY_USAGE_STATS