GtkEv uses two GdkWindows; the larger one, GtkEv's
widget->window, has a gray background and is
used to render text describing each event. The smaller
one is a child of the primary window, and is the window
the widget reports events for.
Here are the class and instance structs for GtkEv:
typedef struct _GtkEv GtkEv;
typedef struct _GtkEvClass GtkEvClass;
struct _GtkEv
{
GtkWidget widget;
GdkWindow* event_window;
GdkRectangle event_window_rect;
GdkRectangle description_rect;
GList* buffer;
GList* buffer_end;
gint buffer_size;
};
struct _GtkEvClass
{
GtkWidgetClass parent_class;
};
|
As you can see, GtkEv has no
class functions or signals of its own. Each instance
stores a pointer to the small event window in event_window. Two rectangles
cache the area covered by the event window, and the area
covered by the event description text. The widget's
allocation is divided between these two areas. Finally,
GtkEv stores a list of string
vectors describing events; it caches the end of the list
and the length of the list. As events are received, text
describing them is pushed on to the front of the buffer.
When the list becomes too long to fit on the screen, GtkEv removes an event from the
back of the buffer each time it adds a new event to the
front, keeping the buffer size constant.