wayland-drm: Use new generic error event
authorKristian Høgsberg <krh@bitplanet.net>
Wed, 11 May 2011 19:28:19 +0000 (15:28 -0400)
committerKristian Høgsberg <krh@bitplanet.net>
Thu, 19 May 2011 16:07:00 +0000 (12:07 -0400)
src/egl/wayland/wayland-drm/protocol/wayland-drm.xml
src/egl/wayland/wayland-drm/wayland-drm.c

index cd5d191227aa9dda77d29bba02b2eb3114120790..0331f124e800a9f430fb6f8108055e39867261ec 100644 (file)
@@ -3,6 +3,12 @@
   <!-- drm support. This object is created by the server and published
        using the display's global event. -->
   <interface name="wl_drm" version="1">
+    <enum name="error">
+      <entry name="authenticate_fail" value="0"/>
+      <entry name="invalid_visual" value="1"/>
+      <entry name="invalid_name" value="2"/>
+    </enum>
+
     <!-- Call this request with the magic received from drmGetMagic().
          It will be passed on to the drmAuthMagic() or
          DRIAuthConnection() call.  This authentication must be
index 03a756bf0a366d85b7b560774c8dac6ded642ff9..d68f9c7bac3b435dd45b3877608297383b44b690 100644 (file)
@@ -101,12 +101,9 @@ drm_create_buffer(struct wl_client *client, struct wl_drm *drm,
        buffer->buffer.visual = visual;
 
        if (visual->object.interface != &wl_visual_interface) {
-               /* FIXME: Define a real exception event instead of
-                * abusing this one */
-               wl_client_post_event(client,
-                                    (struct wl_object *) drm->display,
-                                    WL_DISPLAY_INVALID_OBJECT, 0);
-               fprintf(stderr, "invalid visual in create_buffer\n");
+               wl_client_post_error(client, &drm->object,
+                                    WL_DRM_ERROR_INVALID_VISUAL,
+                                    "invalid visual");
                return;
        }
 
@@ -116,12 +113,9 @@ drm_create_buffer(struct wl_client *client, struct wl_drm *drm,
                                                 stride, visual);
 
        if (buffer->driver_buffer == NULL) {
-               /* FIXME: Define a real exception event instead of
-                * abusing this one */
-               wl_client_post_event(client,
-                                    (struct wl_object *) drm->display,
-                                    WL_DISPLAY_INVALID_OBJECT, 0);
-               fprintf(stderr, "failed to create image for name %d\n", name);
+               wl_client_post_error(client, &drm->object,
+                                    WL_DRM_ERROR_INVALID_NAME,
+                                    "invalid name");
                return;
        }
 
@@ -140,9 +134,9 @@ drm_authenticate(struct wl_client *client,
                 struct wl_drm *drm, uint32_t id)
 {
        if (drm->callbacks->authenticate(drm->user_data, id) < 0)
-               wl_client_post_event(client,
-                                    (struct wl_object *) drm->display,
-                                    WL_DISPLAY_INVALID_OBJECT, 0);
+               wl_client_post_error(client, &drm->object,
+                                    WL_DRM_ERROR_AUTHENTICATE_FAIL,
+                                    "authenicate failed");
        else
                wl_client_post_event(client, &drm->object,
                                     WL_DRM_AUTHENTICATED);
@@ -154,7 +148,8 @@ const static struct wl_drm_interface drm_interface = {
 };
 
 static void
-post_drm_device(struct wl_client *client, struct wl_object *global)
+post_drm_device(struct wl_client *client, 
+               struct wl_object *global, uint32_t version)
 {
        struct wl_drm *drm = (struct wl_drm *) global;