E Comp Module: (Wayland Client Support): Add support for ping of
authorChristopher Michael <cpmichael1@comcast.net>
Tue, 24 Apr 2012 17:15:05 +0000 (17:15 +0000)
committerChristopher Michael <cpmichael1@comcast.net>
Tue, 24 Apr 2012 17:15:05 +0000 (17:15 +0000)
surfaces (from newest wayland git). Fix up wl_resource_destroy calls
to match newest wayland. Fix destroy_listeners for newest wayland. Use
wl_signal_add for destroy signals. Fix calls to wl_input_device_
functions that do not take a timestamp anymore.

SVN revision: 70445

src/modules/comp/e_mod_comp_wl_comp.c
src/modules/comp/e_mod_comp_wl_input.c
src/modules/comp/e_mod_comp_wl_region.c
src/modules/comp/e_mod_comp_wl_shell.c
src/modules/comp/e_mod_comp_wl_surface.c

index f3afa71..0b14619 100644 (file)
@@ -191,7 +191,7 @@ e_mod_comp_wl_comp_get(void)
 }
 
 void 
-e_mod_comp_wl_comp_repick(struct wl_input_device *device, uint32_t timestamp)
+e_mod_comp_wl_comp_repick(struct wl_input_device *device, uint32_t timestamp __UNUSED__)
 {
    Wayland_Surface *ws, *focus;
 
@@ -204,7 +204,7 @@ e_mod_comp_wl_comp_repick(struct wl_input_device *device, uint32_t timestamp)
         const struct wl_pointer_grab_interface *interface;
 
         interface = device->pointer_grab->interface;
-        interface->focus(device->pointer_grab, timestamp, &ws->surface, 
+        interface->focus(device->pointer_grab, &ws->surface, 
                          device->current_x, device->current_y);
         device->current = &ws->surface;
      }
@@ -403,7 +403,7 @@ _e_mod_comp_wl_cb_focus_in(void *data __UNUSED__, int type __UNUSED__, void *eve
           {
              timestamp = e_mod_comp_wl_time_get();
              wl_input_device_set_keyboard_focus(&input->input_device, 
-                                                &ws->surface, timestamp);
+                                                &ws->surface);
              wl_data_device_set_keyboard_focus(&input->input_device);
              break;
           }
@@ -424,7 +424,7 @@ _e_mod_comp_wl_cb_focus_out(void *data __UNUSED__, int type __UNUSED__, void *ev
    ev = event;
    input = e_mod_comp_wl_input_get();
    timestamp = e_mod_comp_wl_time_get();
-   wl_input_device_set_keyboard_focus(&input->input_device, NULL, timestamp);
+   wl_input_device_set_keyboard_focus(&input->input_device, NULL);
    wl_data_device_set_keyboard_focus(&input->input_device);
 
    return ECORE_CALLBACK_PASS_ON;
index 42393da..f3669f2 100644 (file)
@@ -8,7 +8,7 @@
 /* local function prototypes */
 static void _e_mod_comp_wl_input_bind(struct wl_client *client, void *data, uint32_t version __UNUSED__, uint32_t id);
 static void _e_mod_comp_wl_input_unbind(struct wl_resource *resource);
-static void _e_mod_comp_wl_input_attach(struct wl_client *client, struct wl_resource *resource, uint32_t timestamp, struct wl_resource *buffer_resource __UNUSED__, int32_t x, int32_t y);
+static void _e_mod_comp_wl_input_attach(struct wl_client *client, struct wl_resource *resource, uint32_t serial, struct wl_resource *buffer_resource __UNUSED__, int32_t x, int32_t y);
 
 /* wayland interfaces */
 static const struct wl_input_device_interface _wl_input_interface = 
@@ -90,14 +90,14 @@ _e_mod_comp_wl_input_unbind(struct wl_resource *resource)
 }
 
 static void 
-_e_mod_comp_wl_input_attach(struct wl_client *client, struct wl_resource *resource, uint32_t timestamp, struct wl_resource *buffer_resource __UNUSED__, int32_t x, int32_t y)
+_e_mod_comp_wl_input_attach(struct wl_client *client, struct wl_resource *resource, uint32_t serial, struct wl_resource *buffer_resource __UNUSED__, int32_t x, int32_t y)
 {
    Wayland_Input *wi;
 
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
 
    wi = resource->data;
-   if (timestamp < wi->input_device.pointer_focus_time) return;
+   if (serial < wi->input_device.pointer_focus_serial) return;
    if (!wi->input_device.pointer_focus) return;
    if (wi->input_device.pointer_focus->resource.client != client) return;
    wi->hotspot_x = x;
index d6204cd..f53bbe4 100644 (file)
@@ -9,7 +9,7 @@
 void 
 e_mod_comp_wl_region_destroy(struct wl_client *client __UNUSED__, struct wl_resource *resource)
 {
-   wl_resource_destroy(resource, e_mod_comp_wl_time_get());
+   wl_resource_destroy(resource);
 }
 
 void 
index f770ff8..c33a0ea 100644 (file)
@@ -19,6 +19,7 @@ static void _e_mod_comp_wl_shell_destroy(Wayland_Shell *base);
 static void _e_mod_comp_wl_shell_activate(Wayland_Shell *base, Wayland_Surface *surface, uint32_t timestamp);
 
 static void _e_mod_comp_wl_shell_shell_surface_get(struct wl_client *client, struct wl_resource *resource, uint32_t id, struct wl_resource *surface_resource);
+static void _e_mod_comp_wl_shell_surface_pong(struct wl_client *client __UNUSED__, struct wl_resource *resource, unsigned int serial);
 static void _e_mod_comp_wl_shell_surface_move(struct wl_client *client __UNUSED__, struct wl_resource *resource, struct wl_resource *input_resource, uint32_t timestamp);
 static void _e_mod_comp_wl_shell_surface_resize(struct wl_client *client __UNUSED__, struct wl_resource *resource, struct wl_resource *input_resource, uint32_t timestamp, uint32_t edges);
 static void _e_mod_comp_wl_shell_surface_set_toplevel(struct wl_client *client __UNUSED__, struct wl_resource *resource);
@@ -27,7 +28,7 @@ static void _e_mod_comp_wl_shell_surface_set_fullscreen(struct wl_client *client
 static void _e_mod_comp_wl_shell_surface_set_popup(struct wl_client *client __UNUSED__, struct wl_resource *resource, struct wl_resource *input_resource  __UNUSED__, uint32_t timestamp  __UNUSED__, struct wl_resource *parent_resource, int32_t x, int32_t y, uint32_t flags  __UNUSED__);
 static void _e_mod_comp_wl_shell_surface_set_maximized(struct wl_client *client, struct wl_resource *resource, struct wl_resource *output_resource __UNUSED__);
 
-static void _e_mod_comp_wl_shell_surface_destroy_handle(struct wl_listener *listener, struct wl_resource *resource __UNUSED__, uint32_t timestamp);
+static void _e_mod_comp_wl_shell_surface_destroy_handle(struct wl_listener *listener, void *data __UNUSED__);
 static Wayland_Shell_Surface *_e_mod_comp_wl_shell_get_shell_surface(Wayland_Surface *ws);
 static void _e_mod_comp_wl_shell_surface_destroy(struct wl_resource *resource);
 
@@ -38,6 +39,7 @@ static const struct wl_shell_interface _wl_shell_interface =
 };
 static const struct wl_shell_surface_interface _wl_shell_surface_interface = 
 {
+   _e_mod_comp_wl_shell_surface_pong,
    _e_mod_comp_wl_shell_surface_move,
    _e_mod_comp_wl_shell_surface_resize,
    _e_mod_comp_wl_shell_surface_set_toplevel,
@@ -274,10 +276,10 @@ _e_mod_comp_wl_shell_shell_surface_get(struct wl_client *client, struct wl_resou
    wss->resource.data = wss;
 
    wss->surface = ws;
-   wss->surface_destroy_listener.func = 
+   wss->surface_destroy_listener.notify = 
      _e_mod_comp_wl_shell_surface_destroy_handle;
-   wl_list_insert(ws->surface.resource.destroy_listener_list.prev
-                  &wss->surface_destroy_listener.link);
+   wl_signal_add(&ws->surface.resource.destroy_signal
+                  &wss->surface_destroy_listener);
 
    wl_list_init(&wss->link);
 
@@ -286,6 +288,17 @@ _e_mod_comp_wl_shell_shell_surface_get(struct wl_client *client, struct wl_resou
 }
 
 static void 
+_e_mod_comp_wl_shell_surface_pong(struct wl_client *client __UNUSED__, struct wl_resource *resource, unsigned int serial)
+{
+   Wayland_Shell_Surface *wss;
+
+   LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+   wss = resource->data;
+   /* TODO: handle ping timer */
+}
+
+static void 
 _e_mod_comp_wl_shell_surface_move(struct wl_client *client __UNUSED__, struct wl_resource *resource, struct wl_resource *input_resource, uint32_t timestamp)
 {
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
@@ -389,7 +402,7 @@ _e_mod_comp_wl_shell_surface_set_maximized(struct wl_client *client __UNUSED__,
 }
 
 static void 
-_e_mod_comp_wl_shell_surface_destroy_handle(struct wl_listener *listener, struct wl_resource *resource __UNUSED__, uint32_t timestamp)
+_e_mod_comp_wl_shell_surface_destroy_handle(struct wl_listener *listener, void *data __UNUSED__)
 {
    Wayland_Shell_Surface *wss;
 
@@ -397,24 +410,22 @@ _e_mod_comp_wl_shell_surface_destroy_handle(struct wl_listener *listener, struct
 
    wss = container_of(listener, Wayland_Shell_Surface, surface_destroy_listener);
    wss->surface = NULL;
-   wl_resource_destroy(&wss->resource, timestamp);
+   wl_resource_destroy(&wss->resource);
 }
 
 static Wayland_Shell_Surface *
 _e_mod_comp_wl_shell_get_shell_surface(Wayland_Surface *ws)
 {
-   struct wl_list *list;
    struct wl_listener *listener;
 
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
 
-   list = &ws->surface.resource.destroy_listener_list;
-   wl_list_for_each(listener, list, link)
-     {
-        if (listener->func == _e_mod_comp_wl_shell_surface_destroy_handle)
-          return container_of(listener, Wayland_Shell_Surface, 
-                              surface_destroy_listener);
-     }
+   listener = 
+     wl_signal_get(&ws->surface.resource.destroy_signal, 
+                   _e_mod_comp_wl_shell_surface_destroy_handle);
+   if (listener)
+     return container_of(listener, Wayland_Shell_Surface, 
+                         surface_destroy_listener);
    return NULL;
 }
 
index d3ce954..a59459d 100644 (file)
@@ -11,7 +11,7 @@
 #endif
 
 /* local function prototypes */
-static void _e_mod_comp_wl_surface_buffer_destroy_handle(struct wl_listener *listener, struct wl_resource *resource __UNUSED__, uint32_t timestamp __UNUSED__);
+static void _e_mod_comp_wl_surface_buffer_destroy_handle(struct wl_listener *listener, void *data __UNUSED__);
 static void _e_mod_comp_wl_surface_raise(Wayland_Surface *ws);
 static void _e_mod_comp_wl_surface_damage_rectangle(Wayland_Surface *ws, int32_t x, int32_t y, int32_t width, int32_t height);
 static void _e_mod_comp_wl_surface_frame_destroy_callback(struct wl_resource *resource);
@@ -51,7 +51,7 @@ e_mod_comp_wl_surface_create(int32_t x, int32_t y, int32_t w, int32_t h)
 
    wl_list_init(&ws->frame_callbacks);
 
-   ws->buffer_destroy_listener.func = 
+   ws->buffer_destroy_listener.notify = 
      _e_mod_comp_wl_surface_buffer_destroy_handle;
 
    /* ws->transform = NULL; */
@@ -64,7 +64,7 @@ e_mod_comp_wl_surface_destroy(struct wl_client *client __UNUSED__, struct wl_res
 {
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
 
-   wl_resource_destroy(resource, e_mod_comp_wl_time_get());
+   wl_resource_destroy(resource);
 }
 
 void 
@@ -90,8 +90,8 @@ e_mod_comp_wl_surface_attach(struct wl_client *client __UNUSED__, struct wl_reso
 
    buffer->busy_count++;
    ws->buffer = buffer;
-   wl_list_insert(ws->buffer->resource.destroy_listener_list.prev, 
-                  &ws->buffer_destroy_listener.link);
+   wl_signal_add(&ws->buffer->resource.destroy_signal,
+                  &ws->buffer_destroy_listener);
 
    if (!ws->visual)
      shell->shell.map(&shell->shell, ws, buffer->width, buffer->height);
@@ -263,7 +263,7 @@ e_mod_comp_wl_surface_configure(Wayland_Surface *ws, int32_t x, int32_t y, int32
 }
 
 void 
-e_mod_comp_wl_surface_activate(Wayland_Surface *ws, Wayland_Input *wi, uint32_t timestamp)
+e_mod_comp_wl_surface_activate(Wayland_Surface *ws, Wayland_Input *wi, uint32_t timestamp __UNUSED__)
 {
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
 
@@ -274,7 +274,7 @@ e_mod_comp_wl_surface_activate(Wayland_Surface *ws, Wayland_Input *wi, uint32_t
      }
 
    _e_mod_comp_wl_surface_raise(ws);
-   wl_input_device_set_keyboard_focus(&wi->input_device, &ws->surface, timestamp);
+   wl_input_device_set_keyboard_focus(&wi->input_device, &ws->surface);
    wl_data_device_set_keyboard_focus(&wi->input_device);
 }
 
@@ -288,7 +288,7 @@ e_mod_comp_wl_surface_damage_surface(Wayland_Surface *ws)
 
 /* local functions */
 static void 
-_e_mod_comp_wl_surface_buffer_destroy_handle(struct wl_listener *listener, struct wl_resource *resource __UNUSED__, uint32_t timestamp __UNUSED__)
+_e_mod_comp_wl_surface_buffer_destroy_handle(struct wl_listener *listener, void *data __UNUSED__)
 {
    Wayland_Surface *ws;