- if (myfixed->visibility == GDK_VISIBILITY_UNOBSCURED)
- {
- GdkEventExpose event;
-
- event.type = GDK_EXPOSE;
- event.send_event = TRUE;
- event.window = myfixed->bin_window;
- event.count = 0;
-
- event.area.x = x;
- event.area.y = y;
- event.area.width = width;
- event.area.height = height;
-
- gdk_window_ref (event.window);
- gtk_widget_event (GTK_WIDGET (myfixed), (GdkEvent *)&event);
- gdk_window_unref (event.window);
- }
-}
-
-/* This function is used to find events to process while scrolling
- */
-
-static Bool
-gtk_myfixed_expose_predicate (Display *display,
- XEvent *xevent,
- XPointer arg)
-{
- if ((xevent->type == Expose) ||
- ((xevent->xany.window == *(Window *)arg) &&
- (xevent->type == ConfigureNotify)))
- return True;
- else
- return False;
-}
-
-/* This is the main routine to do the scrolling. Scrolling is
- * done by "Guffaw" scrolling, as in the Mozilla XFE, with
- * a few modifications.
- *
- * The main improvement is that we keep track of whether we
- * are obscured or not. If not, we ignore the generated expose
- * events and instead do the exposes ourself, without having
- * to wait for a roundtrip to the server. This also provides
- * a limited form of expose-event compression, since we do
- * the affected area as one big chunk.
- */
-
-void
-gtk_myfixed_scroll (GtkMyFixed *myfixed, gint dx, gint dy)
-{
- GtkWidget *widget;
- XEvent xevent;
-
- gint x,y,w,h,border;
-
- widget = GTK_WIDGET (myfixed);
-
- myfixed->xoffset += dx;
- myfixed->yoffset += dy;
-
- if (!GTK_WIDGET_MAPPED (myfixed))
- {
- gtk_myfixed_position_children (myfixed);
- return;
- }
-
- gtk_myfixed_adjust_allocations (myfixed, -dx, -dy);
-
- if (myfixed->shadow_type == GTK_MYSHADOW_NONE)
- border = 0;
- else
- if (myfixed->shadow_type == GTK_MYSHADOW_THIN)
- border = 1;
- else
- border = 2;
-
- x = 0;
- y = 0;
- w = widget->allocation.width - 2*border;
- h = widget->allocation.height - 2*border;
-
- if (dx > 0)
- {
- if (gravity_works)
- {
- gdk_window_resize (myfixed->bin_window,
- w + dx,
- h);
- gdk_window_move (myfixed->bin_window, x-dx, y);
- gdk_window_move_resize (myfixed->bin_window, x, y, w, h );
- }
- else
- {
- /* FIXME */
- }
-
- gtk_myfixed_expose_area (myfixed,
- MAX ((gint)w - dx, 0),
- 0,
- MIN (dx, w),
- h);
- }
- else if (dx < 0)
- {
- if (gravity_works)
- {
- gdk_window_move_resize (myfixed->bin_window,
- x + dx,
- y,
- w - dx,
- h);
- gdk_window_move (myfixed->bin_window, x, y);
- gdk_window_resize (myfixed->bin_window, w, h );
- }
- else
- {
- /* FIXME */
- }
-
- gtk_myfixed_expose_area (myfixed,
- 0,
- 0,
- MIN (-dx, w),
- h);
- }