send mouse in/out when first mouse device is connected/disconnected 64/168864/9
authorJengHyun Kang <jhyuni.kang@samsung.com>
Wed, 31 Jan 2018 15:31:35 +0000 (00:31 +0900)
committerJengHyun Kang <jhyuni.kang@samsung.com>
Fri, 9 Feb 2018 05:18:08 +0000 (14:18 +0900)
Change-Id: Ieb2a83006ae6a3e81c7c4554cb459ee84cebe42d

src/bin/e_comp_screen.c
src/bin/e_comp_wl.c
src/bin/e_comp_wl.h
src/bin/e_comp_wl_input.c

index 9345092b1b96f05f1b237e1d62971819e119b5d9..d899c2805a67c0f080505174ebe7e5a052e3e392 100644 (file)
@@ -291,6 +291,33 @@ end:
    return ECORE_CALLBACK_PASS_ON;
 }
 
+static void
+_e_comp_screen_pointer_renew(E_Input_Event_Input_Device_Del *ev)
+{
+     if ((e_comp_wl->ptr.num_devices == 0) && e_comp_wl->ptr.ec && e_comp_wl->ptr.ec->pointer_enter_sent)
+     {
+        if (e_comp_wl->input_device_manager.last_device_ptr)
+          {
+             Evas_Device *last_ptr = NULL, *dev;
+             Eina_List *list, *l;
+
+             list = (Eina_List *)evas_device_list(evas_object_evas_get(e_comp_wl->ptr.ec->frame), NULL);
+             EINA_LIST_FOREACH(list, l, dev)
+               {
+                  if ((!strncmp(evas_device_name_get(dev), e_comp_wl->input_device_manager.last_device_ptr->name, strlen(e_comp_wl->input_device_manager.last_device_ptr->name))) &&
+                      (!strncmp(evas_device_description_get(dev), e_comp_wl->input_device_manager.last_device_ptr->identifier, strlen(e_comp_wl->input_device_manager.last_device_ptr->identifier))) &&
+                      (evas_device_class_get(dev) == (Evas_Device_Class)e_comp_wl->input_device_manager.last_device_ptr->clas))
+                    {
+                       last_ptr = dev;
+                       break;
+                    }
+               }
+             if (last_ptr)
+               e_comp_wl_mouse_out_renew(e_comp_wl->ptr.ec, 0, wl_fixed_to_int(e_comp_wl->ptr.x), wl_fixed_to_int(e_comp_wl->ptr.y), NULL, NULL, NULL, ecore_time_get(), EVAS_EVENT_FLAG_NONE, last_ptr, NULL);
+          }
+     }
+}
+
 static Eina_Bool
 _e_comp_screen_cb_input_device_del(void *data, int type, void *event)
 {
@@ -307,6 +334,8 @@ _e_comp_screen_cb_input_device_del(void *data, int type, void *event)
              e_comp_wl_input_pointer_enabled_set(EINA_FALSE);
              e_pointer_object_set(comp->pointer, NULL, 0, 0);
              e_pointer_hide(e_comp->pointer);
+
+             _e_comp_screen_pointer_renew(e);
           }
      }
    if (e->caps & E_INPUT_SEAT_KEYBOARD)
index 663553b9107713e04399e3ae43c17e0a4b0242d7..04ccf6a09ee5e87765087dcca366e091e168e464 100644 (file)
@@ -1170,16 +1170,16 @@ _e_comp_wl_evas_cb_mouse_move(void *data, Evas *evas EINA_UNUSED, Evas_Object *o
           }
         else
           {
-             _e_comp_wl_device_send_event_device(ec, dev, ev->timestamp);
-             _e_comp_wl_send_mouse_move(ec, ev->cur.canvas.x, ev->cur.canvas.y, ev->timestamp);
-             e_pointer_mouse_move(e_comp->pointer, ev->cur.output.x, ev->cur.output.y);
-
              if (e_config->use_cursor_timer)
                {
                  if (e_pointer_is_hidden(e_comp->pointer))
                    _e_comp_wl_cursor_reload(ec);
                }
 
+             _e_comp_wl_device_send_event_device(ec, dev, ev->timestamp);
+             _e_comp_wl_send_mouse_move(ec, ev->cur.canvas.x, ev->cur.canvas.y, ev->timestamp);
+             e_pointer_mouse_move(e_comp->pointer, ev->cur.output.x, ev->cur.output.y);
+
              _e_comp_wl_cursor_move_timer_control(ec);
           }
      }
@@ -6033,6 +6033,60 @@ e_comp_wl_mouse_out_send(E_Client *ec, Ecore_Device *dev, uint32_t time)
    return EINA_TRUE;
 }
 
+EINTERN void
+e_comp_wl_mouse_in_renew(E_Client *ec, int buttons, int x, int y, void *data, Evas_Modifier *modifiers, Evas_Lock *locks, unsigned int timestamp, Evas_Event_Flags event_flags, Evas_Device *dev, Evas_Object *event_src)
+{
+   Evas_Event_Mouse_In ev_in;
+
+   if (!ec) return;
+   if (ec->pointer_enter_sent) return;
+
+   ev_in.buttons = buttons;
+
+   ev_in.output.x = x;
+   ev_in.output.y = y;
+   ev_in.canvas.x = x;
+   ev_in.canvas.y = y;
+
+   ev_in.data = data;
+   ev_in.modifiers = modifiers;
+   ev_in.locks = locks;
+   ev_in.timestamp = timestamp;
+   ev_in.event_flags = event_flags;
+
+   ev_in.dev = dev;
+   ev_in.event_src = event_src;
+
+   _e_comp_wl_evas_cb_mouse_in((void *)ec, NULL, NULL, &ev_in);
+}
+
+EINTERN void
+e_comp_wl_mouse_out_renew(E_Client *ec, int buttons, int x, int y, void *data, Evas_Modifier *modifiers, Evas_Lock *locks, unsigned int timestamp, Evas_Event_Flags event_flags, Evas_Device *dev, Evas_Object *event_src)
+{
+   Evas_Event_Mouse_Out ev_out;
+
+   if (!ec) return;
+   if (!ec->pointer_enter_sent) return;
+
+   ev_out.buttons = buttons;
+
+   ev_out.output.x = x;
+   ev_out.output.y = y;
+   ev_out.canvas.x = x;
+   ev_out.canvas.y = y;
+
+   ev_out.data = data;
+   ev_out.modifiers = modifiers;
+   ev_out.locks = locks;
+   ev_out.timestamp = timestamp;
+   ev_out.event_flags = event_flags;
+
+   ev_out.dev = dev;
+   ev_out.event_src = event_src;
+
+   _e_comp_wl_evas_cb_mouse_out((void *)ec, NULL, NULL, &ev_out);
+}
+
 EINTERN Eina_Bool
 e_comp_wl_cursor_hide(E_Client *ec)
 {
index 689e3fb83dc78cceed40ee0c55ac75b3db83837d..87edb52eb2817ae81d71df7730f6200d23d8ddc3 100644 (file)
@@ -571,6 +571,8 @@ EINTERN Eina_Bool e_comp_wl_mouse_move_send(E_Client *ec, int x, int y, Ecore_De
 EINTERN Eina_Bool e_comp_wl_mouse_wheel_send(E_Client *ec, int direction, int z, Ecore_Device *dev, uint32_t time);
 EINTERN Eina_Bool e_comp_wl_mouse_in_send(E_Client *ec, int x, int y, Ecore_Device *dev, uint32_t time);
 EINTERN Eina_Bool e_comp_wl_mouse_out_send(E_Client *ec, Ecore_Device *dev, uint32_t time);
+EINTERN void e_comp_wl_mouse_in_renew(E_Client *ec, int buttons, int x, int y, void *data, Evas_Modifier *modifiers, Evas_Lock *locks, unsigned int timestamp, Evas_Event_Flags event_flags, Evas_Device *dev, Evas_Object *event_src);
+EINTERN void e_comp_wl_mouse_out_renew(E_Client *ec, int buttons, int x, int y, void *data, Evas_Modifier *modifiers, Evas_Lock *locks, unsigned int timestamp, Evas_Event_Flags event_flags, Evas_Device *dev, Evas_Object *event_src);
 
 EINTERN Eina_Bool e_comp_wl_cursor_hide(E_Client *ec);
 
index 017a385d557f2d90e4c207119ee50def5d4c673e..7a6535efb86c706d001b511fd1dfff24ef782372 100644 (file)
@@ -160,6 +160,8 @@ static void
 _e_comp_wl_input_cb_pointer_get(struct wl_client *client, struct wl_resource *resource, uint32_t id)
 {
    struct wl_resource *res;
+   struct wl_client *ptr_client = NULL;
+   E_Comp_Wl_Client_Data *cdata = NULL;
 
    /* try to create pointer resource */
    res = wl_resource_create(client, &wl_pointer_interface,
@@ -177,6 +179,33 @@ _e_comp_wl_input_cb_pointer_get(struct wl_client *client, struct wl_resource *re
    wl_resource_set_implementation(res, &_e_pointer_interface,
                                   e_comp->wl_comp_data,
                                  _e_comp_wl_input_cb_pointer_unbind);
+
+   if ((e_comp_wl->ptr.num_devices == 1) && e_comp_wl->ptr.ec && !e_comp_wl->ptr.ec->pointer_enter_sent && !e_config->use_cursor_timer)
+     {
+        cdata = (E_Comp_Wl_Client_Data*)e_comp_wl->ptr.ec->comp_data;
+        if (cdata && cdata->wl_surface)
+          ptr_client = wl_resource_get_client(cdata->wl_surface);
+
+        if (ptr_client == client)
+          {
+             Evas_Device *last_ptr = NULL, *dev;
+             Eina_List *list, *l;
+
+             list = (Eina_List *)evas_device_list(evas_object_evas_get(e_comp_wl->ptr.ec->frame), NULL);
+             EINA_LIST_FOREACH(list, l, dev)
+               {
+                  if ((!strncmp(evas_device_name_get(dev), e_comp_wl->input_device_manager.last_device_ptr->name, strlen(e_comp_wl->input_device_manager.last_device_ptr->name))) &&
+                      (!strncmp(evas_device_description_get(dev), e_comp_wl->input_device_manager.last_device_ptr->identifier, strlen(e_comp_wl->input_device_manager.last_device_ptr->identifier))) &&
+                      (evas_device_class_get(dev) == (Evas_Device_Class)e_comp_wl->input_device_manager.last_device_ptr->clas))
+                    {
+                       last_ptr = dev;
+                       break;
+                    }
+               }
+             if (last_ptr)
+               e_comp_wl_mouse_in_renew(e_comp_wl->ptr.ec, 0, wl_fixed_to_int(e_comp_wl->ptr.x), wl_fixed_to_int(e_comp_wl->ptr.y), NULL, NULL, NULL, ecore_time_get(), EVAS_EVENT_FLAG_NONE, last_ptr, NULL);
+          }
+     }
 }
 
 static void