[PATCH 2/2] Define global handler on display creation
twied
twied at gmx.net
Thu Feb 3 10:34:43 PST 2011
Hi,
> I think I'd rather move the wl_display_iterate()
> that dispatches those events to wl_display_run() instead and keep
> display_set_global_handler() around as it is now. Do you that's
> possible?
Won't work IMO:
display_create(...) {
...
wl_display_connect(...)
...
wl_display_iterate(...)
...
init_drm(...)
...
}
So we need at least the DRM object during display creation.
Proposal #1:
Dirty Hack(tm) to advertise the DRM object anyway.
Proposal #2:
Original patch with global_handler passed to display_create.
Proposal #3:
Divide interface "display" in "display" and "global", add a "please tell me
about all global objects" request that can be sent multiple times:
diff --git a/protocol/wayland.xml b/protocol/wayland.xml
index a9f96b6..25a709e 100644
--- a/protocol/wayland.xml
+++ b/protocol/wayland.xml
@@ -3,7 +3,7 @@
<!-- The core global object. This is a special singleton object.
It is used for internal wayland protocol features. -->
- <interface name="display" version="1">
+ <interface name="global" version="1">
<!-- sync is an just an echo, which will reply with a sync event.
Since requests are handled in-order, this can be used as a
barrier to ensure all previous requests have ben handled.
@@ -13,14 +13,6 @@
<arg name="key" type="uint"/>
</request>
- <!-- Request notification when the next frame is displayed.
- Useful for throttling redrawing operations, and driving
- animations. The notification will only be posted for one
- frame unless requested again. -->
- <request name="frame">
- <arg name="key" type="uint"/>
- </request>
-
<!-- A request addressed a non-existent object id. This is
tyipcally a fatal error. -->
<event name="invalid_object">
@@ -49,6 +41,9 @@
<arg name="version" type="uint"/>
</event>
+ <!-- Request the announcement of all global objects. -->
+ <request name="announce" />
+
<!-- Internal, deprecated, and will be changed. This is an object
IDs range that is used by the client to allocate object IDs
in "new_id" type arguments. The server sends range
@@ -58,7 +53,28 @@
<arg name="base" type="uint"/>
</event>
- <!-- A reply to the frame or sync request. The key is the one
+ <!-- A reply to the sync request. The key is the one
+ used in the request. time is in millisecond units -->
+ <event name="key">
+ <arg name="key" type="uint"/>
+ <arg name="time" type="uint"/>
+ </event>
+ </interface>
+
+ </interface>
+
+ <!-- A Display. This object is a global. Use this object to sync
+ to frame flips -->
+ <interface name="display" version="2">
+ <!-- Request notification when the next frame is displayed.
+ Useful for throttling redrawing operations, and driving
+ animations. The notification will only be posted for one
+ frame unless requested again. -->
+ <request name="frame">
+ <arg name="key" type="uint"/>
+ </request>
+
+ <!-- A reply to the frame request. The key is the one
used in the request. time is in millisecond units, and
denotes the time when the frame was posted on the
display. time can be used to estimaate frame rate, determine
... or something in the like.
This way we can have one announce request on display creation and one in
display_run, when the client's global_handler is set.
Cheers,
Tim
More information about the wayland-devel
mailing list