e_comp_wl_input: clip the cursor hint position to inside of the window 07/312407/2
authorduna.oh <duna.oh@samsung.com>
Wed, 5 Jun 2024 12:10:02 +0000 (21:10 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Mon, 10 Jun 2024 06:49:58 +0000 (06:49 +0000)
The cursor hint position should be bound to (0,0 ~ width - 1,height - 1).
Refer to the commit: 11f283d31560c5142ea489f582cd95ab87b85480

Change-Id: Ic0b2312b20b045cf1ed9b5d56c752da16211d79a

src/bin/e_comp_wl_input.c

index 593b275..ceba325 100644 (file)
@@ -813,8 +813,17 @@ _e_comp_wl_input_cb_pointer_constraints_surface_committed(struct wl_listener *li
      {
         constraint->is_hint_pending = EINA_FALSE;
 
-        new_x = ec->client.x + wl_fixed_to_int(constraint->hint_x_pending);
-        new_y = ec->client.y + wl_fixed_to_int(constraint->hint_y_pending);
+        new_x = wl_fixed_to_int(constraint->hint_x_pending);
+        new_y = wl_fixed_to_int(constraint->hint_y_pending);
+
+        if (new_x < 0) new_x = 0;
+        if ((ec->w != 0) && (new_x > ec->w - 1)) new_x = ec->w - 1;
+
+        if (new_y < 0) new_y = 0;
+        if ((ec->h != 0) && (new_y > ec->h - 1)) new_y = ec->h - 1;
+
+        new_x = ec->client.x + new_x;
+        new_y = ec->client.y + new_y;
 
         if (e_client_transform_core_enable_get(ec))
           {