Modernizing the display loop



My current large-scale project is to get proper coordination between the
application and window system for timing.

Window Clocks
==============

My basic idea is to have a "Window Clock" object that serves as the
central point of timing coordination for each toplevel window.

 /* Get the singleton window clock for a toplevel window */
 GdkWindowClock *gdk_window_get_clock (GdkWindow *window);

The window clock object has two signals:

 ::layout
 ::draw

With corresponding methods:

 gdk_window_clock_queue_layout (GdkWindowClock *clock);
 gdk_window_clock_queue_draw   (GdkWindowClock *clock);

It also has can have any number of "clock targets" objects added to it:

 void gdk_window_clock_add    (GdkWindowClock *clock,
                               GdkClockTarget *target);
 void gdk_window_clock_remove (GdkWindowClock *clock,
                               GdkClockTarget *target);

GdkClockTarget is a simple interface:

 struct _GdkClockTargetClass {
     GTypeInterface base_iface;

     void (*update) (GdkClockTarget  target,
                     GdkWindowClock *clock);
 };

When there is at least one clock target added, the clock is "on", and
whenever it's time to draw a frame, each clock is updated.

Event compression
=================

Cross-platform issues
=====================

I spent some time looking at what windowing system capabilities we'd
want to hook this into on Windows and the Mac. It seemed like on the
Mac, you might want to hook this up to CVDisplayLink

http://developer.apple.com/library/mac/#documentation/QuartzCore/Reference/CVDisplayLinkRef/Reference/reference.html

On Windows (Vista, 7), the Desktop Window Manager APIs allow querying
for information about how the scree is being updated:


- Owen






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