X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=src%2Fgtk-xemacs.c;h=e5c3c426af279bbd7e6027ef3a8dda76ed09af81;hb=1532bc4f9d544bee853b875b78703699bee95fdc;hp=15d15c0c7edc477d41594d8b5d262a2a1cacc3b0;hpb=7ee7b9fd0c91842f267cf6e412286d647f68e32a;p=chise%2Fxemacs-chise.git.1 diff --git a/src/gtk-xemacs.c b/src/gtk-xemacs.c index 15d15c0..e5c3c42 100644 --- a/src/gtk-xemacs.c +++ b/src/gtk-xemacs.c @@ -248,14 +248,58 @@ gtk_xemacs_size_request (GtkWidget *widget, GtkRequisition *requisition) } } +/* Assign a size and position to the child widgets. This differs from the + super class method in that for all widgets except the scrollbars the size + and position are not caclulated here. This is because these widgets have + this function performed for them by the redisplay code (see + gtk_map_subwindow()). If the superclass method is called then the widgets + can change size and position as the two pieces of code move the widgets at + random. +*/ static void gtk_xemacs_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { GtkXEmacs *x = GTK_XEMACS (widget); + GtkFixed *fixed = GTK_FIXED (widget); struct frame *f = GTK_XEMACS_FRAME (x); int columns, rows; - - parent_class->size_allocate(widget, allocation); + GList *children; + guint16 border_width; + + widget->allocation = *allocation; + if (GTK_WIDGET_REALIZED (widget)) + gdk_window_move_resize (widget->window, + allocation->x, + allocation->y, + allocation->width, + allocation->height); + + border_width = GTK_CONTAINER (fixed)->border_width; + + children = fixed->children; + while (children) + { + GtkFixedChild* child = children->data; + children = children->next; + + /* + Scrollbars are the only widget that is managed by GTK. See + comments in gtk_create_scrollbar_instance(). + */ + if (GTK_WIDGET_VISIBLE (child->widget) && + gtk_type_is_a(GTK_OBJECT_TYPE(child->widget), GTK_TYPE_SCROLLBAR)) + { + GtkAllocation child_allocation; + GtkRequisition child_requisition; + + gtk_widget_get_child_requisition (child->widget, &child_requisition); + child_allocation.x = child->x + border_width; + child_allocation.y = child->y + border_width; + child_allocation.width = child_requisition.width; + child_allocation.height = child_requisition.height; + gtk_widget_size_allocate (child->widget, &child_allocation); + } + } if (f) { @@ -275,7 +319,9 @@ gtk_xemacs_paint (GtkWidget *widget, GdkRectangle *area) { GtkXEmacs *x = GTK_XEMACS (widget); struct frame *f = GTK_XEMACS_FRAME (x); - gtk_redraw_exposed_area (f, area->x, area->y, area->width, area->height); + + if (GTK_WIDGET_DRAWABLE (widget)) + gtk_redraw_exposed_area (f, area->x, area->y, area->width, area->height); } static void @@ -291,30 +337,33 @@ gtk_xemacs_draw (GtkWidget *widget, GdkRectangle *area) gtk_fixed_paint() directly, which clears the background window, which causes A LOT of flashing. */ - gtk_xemacs_paint (widget, area); + if (GTK_WIDGET_DRAWABLE (widget)) + { + gtk_xemacs_paint (widget, area); - children = fixed->children; + children = fixed->children; - while (children) - { - child = children->data; - children = children->next; - /* #### This is what causes the scrollbar flickering! - Evidently the scrollbars pretty much take care of drawing - themselves in most cases. Then we come along and tell them - to redraw again! - - But if we just leave it out, then they do not get drawn - correctly the first time! - - Scrollbar flickering has been greatly helped by the - optimizations in scrollbar-gtk.c / - gtk_update_scrollbar_instance_status (), so this is not that - big a deal anymore. - */ - if (gtk_widget_intersect (child->widget, area, &child_area)) + while (children) { - gtk_widget_draw (child->widget, &child_area); + child = children->data; + children = children->next; + /* #### This is what causes the scrollbar flickering! + Evidently the scrollbars pretty much take care of drawing + themselves in most cases. Then we come along and tell them + to redraw again! + + But if we just leave it out, then they do not get drawn + correctly the first time! + + Scrollbar flickering has been greatly helped by the + optimizations in scrollbar-gtk.c / + gtk_update_scrollbar_instance_status (), so this is not that + big a deal anymore. + */ + if (gtk_widget_intersect (child->widget, area, &child_area)) + { + gtk_widget_draw (child->widget, &child_area); + } } } } @@ -326,14 +375,19 @@ gtk_xemacs_expose (GtkWidget *widget, GdkEventExpose *event) struct frame *f = GTK_XEMACS_FRAME (x); GdkRectangle *a = &event->area; - /* This takes care of drawing the scrollbars, etc */ - parent_class->expose_event (widget, event); + if (GTK_WIDGET_DRAWABLE (widget)) + { + /* This takes care of drawing the scrollbars, etc */ + parent_class->expose_event (widget, event); + + /* Now draw the actual frame data */ + if (!check_for_ignored_expose (f, a->x, a->y, a->width, a->height) && + !find_matching_subwindow (f, a->x, a->y, a->width, a->height)) + gtk_redraw_exposed_area (f, a->x, a->y, a->width, a->height); + return (TRUE); + } - /* Now draw the actual frame data */ - if (!check_for_ignored_expose (f, a->x, a->y, a->width, a->height) && - !find_matching_subwindow (f, a->x, a->y, a->width, a->height)) - gtk_redraw_exposed_area (f, a->x, a->y, a->width, a->height); - return (TRUE); + return FALSE; } Lisp_Object