Event handling and multihead



Another thing that I think probably needs a bit of structural work in
the multihead branch is event handling. In particular, I think the event
queues should be per-display.

Reasons for this:

 * It's the Xlib model, so probably will be more amenable to people 
   adopting existing code.

 * Performance - various operations come down to "search the event queue
   for an event affecting window X" - if we have separate event queues
   this becomes more efficient.

 * Code organization. Doing it this way will help us really separate
   out displays and get rid of global variables. Right now, there 
   is some bridging code to deal with the mismatch between a single
   event queue and multiple Xlib event queues.

 * Memory management (related to code organization) - when we support
   closing down displays.

The question then becomes what to do with the functions that operate
on the global event queue. My suggestions are:

gboolean  gdk_events_pending	 	(void);

 Return TRUE if there are events pending on any display.

GdkEvent* gdk_event_get			(void);
GdkEvent* gdk_event_peek                (void);

 Return events from one of the displays with undefined prioritization
 between displays. This is not good for "fairness", but nobody uses
 these functions much anyways.

GdkEvent* gdk_event_get_graphics_expose (GdkWindow 	*window);

 Look in the event queue for the display of @window.

void      gdk_event_put	 		(GdkEvent  	*event);

 Put it in the event queue for event->any.window. If event->any.window
 is NULL (probably never happens in real code), put it on the
 event queue for the default display and require people to use
 gdk_display_put_event() to be multihead safe.

I would then add gdk_display_* equivalents to these functions to operate
on the event queues of particular displays. (Probably. I'd consider
many of these functions a bit obsolete and to be avoided in general
in favour of just running the GLib event loop.)

Regards,
                                        Owen




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]