[cairo] Porting GTK+ to use Cairo

Bill Spitzak spitzak at d2.com
Tue May 11 13:08:01 PDT 2004


On Tuesday 11 May 2004 10:00 am, Jost Boekemeier wrote:
>
> * Not cairo related, but what do you think is the best way to route
> events to the widgets and to associate a cursor with each widget?  I
> think I need a "event grid" on the server-side, i.e. a grid composed of
> input-only windows.  Or are there cheaper structures available on the
> server side that provide such a functionality? But maybe this "event
> grid" is nonsense, see below.
>
> * gtk related: Why do most gtk widgets ask for pointer motion events?  I
> can understand why someone wants button[x] motion events but why does
> the menu or menuitem for example want motion events when no button is
> pressed?  I think the only reason is that X has no "pointer moved less
> than delta pixels, send tooltip event" so one has to implement this on
> the client-side.  Or are there other reasons?
>
> If we want the x/y position for most of the widgets anyway, we don't
> need an "event grid", we can just select pointer motion events for the
> top-level window to track the pointer -- setting the cursor for the
> current position would require a message back to the server, but that's
> it.

It is certainly been my experience that it is *MUCH* cheaper to just watch 
the mouse move around than to communicate (and update) the location of every 
widget to the server. In addition, you can make the mouse respond exactly the 
way you want, and not have to put up with bugs and mistakes in the windowing 
system, and there are no synchronization bugs. Portability is much easier 
this way. For these reasons GTK, Qt, and FLTK all use server windows only for 
the outermost framed window, no information about internal widgets are sent 
to the server. This is unlike Motif and Xt and most older toolkits.

Just set the cursor for the entire window as you detect the mouse crossing 
the widget boundaries. This is provably more efficient then sending a cursor 
for every widget.

Most arguments for sending the widgets to the server assumme a server that 
also does all the drawing and the majority of the event handling for widgets. 
If this is not true then sending any information about the widgets can only 
increase communication overhead.

-- 
                   ,~,~,~,~ ~ ~ ~ ~
     /\_       _|_========___         Bill Spitzak
 ~~~/\/\\~~~~~~\____________/~~~~~~~~ spitzak at d2.com




More information about the cairo mailing list