make wl client mouse button handler fn external
authorMike Blumenkrantz <zmike@osg.samsung.com>
Wed, 12 Aug 2015 19:04:45 +0000 (15:04 -0400)
committerMike Blumenkrantz <zmike@osg.samsung.com>
Wed, 12 Aug 2015 19:12:03 +0000 (15:12 -0400)
src/bin/e_comp_wl.c
src/bin/e_comp_wl.h

index 08dcbcb1ff1416dcf90fb05f8a55bc2cbc86452a..12c60ca249217b01863ac659a2b6e861fcffd012 100644 (file)
@@ -256,60 +256,13 @@ _e_comp_wl_evas_cb_mouse_move(void *data, Evas *evas EINA_UNUSED, Evas_Object *o
      _e_comp_wl_send_mouse_move(ec, ev->cur.canvas.x, ev->cur.canvas.y, ev->timestamp);
 }
 
-static Eina_Bool
-_e_comp_wl_evas_handle_mouse_button(E_Client *ec, uint32_t timestamp, uint32_t button_id, uint32_t state)
-{
-   Eina_List *l;
-   struct wl_client *wc;
-   uint32_t serial, btn;
-   struct wl_resource *res;
-
-   if (ec->cur_mouse_action || ec->border_menu || e_comp->wl_comp_data->drag) return EINA_FALSE;
-   if (e_object_is_del(E_OBJECT(ec))) return EINA_FALSE;
-   if (ec->ignored) return EINA_FALSE;
-
-   switch (button_id)
-     {
-      case 1:
-        btn = BTN_LEFT;
-        break;
-      case 2:
-        btn = BTN_MIDDLE;
-        break;
-      case 3:
-        btn = BTN_RIGHT;
-        break;
-      default:
-        btn = button_id;
-        break;
-     }
-
-   e_comp->wl_comp_data->ptr.button = btn;
-
-   if (!ec->comp_data->surface) return EINA_FALSE;
-
-   if (!eina_list_count(e_comp->wl_comp_data->ptr.resources))
-     return EINA_TRUE;
-
-   wc = wl_resource_get_client(ec->comp_data->surface);
-   serial = wl_display_next_serial(e_comp->wl_comp_data->wl.disp);
-
-   EINA_LIST_FOREACH(e_comp->wl_comp_data->ptr.resources, l, res)
-     {
-        if (wl_resource_get_client(res) != wc) continue;
-        if (!e_comp_wl_input_pointer_check(res)) continue;
-        wl_pointer_send_button(res, serial, timestamp, btn, state);
-     }
-   return EINA_TRUE;
-}
-
 static void
 _e_comp_wl_evas_cb_mouse_down(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event)
 {
    E_Client *ec = data;
    Evas_Event_Mouse_Down *ev = event;
 
-   _e_comp_wl_evas_handle_mouse_button(ec, ev->timestamp, ev->button,
+   e_comp_wl_evas_handle_mouse_button(ec, ev->timestamp, ev->button,
                                        WL_POINTER_BUTTON_STATE_PRESSED);
 }
 
@@ -319,7 +272,7 @@ _e_comp_wl_evas_cb_mouse_up(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj
    E_Client *ec = data;
    Evas_Event_Mouse_Up *ev = event;
 
-   _e_comp_wl_evas_handle_mouse_button(ec, ev->timestamp, ev->button,
+   e_comp_wl_evas_handle_mouse_button(ec, ev->timestamp, ev->button,
                                        WL_POINTER_BUTTON_STATE_RELEASED);
 }
 
@@ -3161,6 +3114,53 @@ e_comp_wl_key_up(Ecore_Event_Key *ev)
    return !!ec;
 }
 
+E_API Eina_Bool
+e_comp_wl_evas_handle_mouse_button(E_Client *ec, uint32_t timestamp, uint32_t button_id, uint32_t state)
+{
+   Eina_List *l;
+   struct wl_client *wc;
+   uint32_t serial, btn;
+   struct wl_resource *res;
+
+   if (ec->cur_mouse_action || ec->border_menu || e_comp->wl_comp_data->drag) return EINA_FALSE;
+   if (e_object_is_del(E_OBJECT(ec))) return EINA_FALSE;
+   if (ec->ignored) return EINA_FALSE;
+
+   switch (button_id)
+     {
+      case 1:
+        btn = BTN_LEFT;
+        break;
+      case 2:
+        btn = BTN_MIDDLE;
+        break;
+      case 3:
+        btn = BTN_RIGHT;
+        break;
+      default:
+        btn = button_id;
+        break;
+     }
+
+   e_comp->wl_comp_data->ptr.button = btn;
+
+   if (!ec->comp_data->surface) return EINA_FALSE;
+
+   if (!eina_list_count(e_comp->wl_comp_data->ptr.resources))
+     return EINA_TRUE;
+
+   wc = wl_resource_get_client(ec->comp_data->surface);
+   serial = wl_display_next_serial(e_comp->wl_comp_data->wl.disp);
+
+   EINA_LIST_FOREACH(e_comp->wl_comp_data->ptr.resources, l, res)
+     {
+        if (wl_resource_get_client(res) != wc) continue;
+        if (!e_comp_wl_input_pointer_check(res)) continue;
+        wl_pointer_send_button(res, serial, timestamp, btn, state);
+     }
+   return EINA_TRUE;
+}
+
 EINTERN void
 e_comp_wl_xwayland_client_queue(E_Client *ec)
 {
index c55d163f86564ba950fd7dbee3880e6c81852ea6..e105fa20a97c3898288475a487f1b1ecba09fc94 100644 (file)
@@ -333,6 +333,7 @@ E_API void e_comp_wl_output_remove(const char *id);
 
 EINTERN Eina_Bool e_comp_wl_key_down(Ecore_Event_Key *ev);
 EINTERN Eina_Bool e_comp_wl_key_up(Ecore_Event_Key *ev);
+E_API Eina_Bool e_comp_wl_evas_handle_mouse_button(E_Client *ec, uint32_t timestamp, uint32_t button_id, uint32_t state);
 
 # ifndef HAVE_WAYLAND_ONLY
 EINTERN void e_comp_wl_xwayland_client_queue(E_Client *ec);