0

I have a callback for the size-allocate signal on my GtkScrolledWindow. I want to scroll to the right when I am adding stuff to that window. This works fine but introduces a subtle bug when removing items from that window. I would like to only scroll the window when adding stuff. I see the signal receives a GdkRectangle but I am unsure how to use it.

Mad Rapper X
  • 311
  • 4
  • 16

1 Answers1

1

First size-allocate signal run-first, that means, If I'm not wrong, before the default handler. So you can get the GdkRectangle of the widget with gtk_widget_get_allocation, and compare it with the new one. Now GdkRectangle is a cairo_rectangle_int_t and the definition of that is:

typedef struct {
    int x, y;
    int width, height;
} cairo_rectangle_int_t;

So you can check width and heights, with the old ones.

erick2red
  • 1,312
  • 1
  • 14
  • 19