desktop_shell: Add checks for setting the same value 22/323422/1
authorSeunghun Lee <shiin.lee@samsung.com>
Fri, 25 Apr 2025 05:55:18 +0000 (14:55 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Mon, 28 Apr 2025 07:44:54 +0000 (16:44 +0900)
This adds checks to prevent unnecessary operations when attempting to
set the same value.

Change-Id: I5e5347f66cf53197569d8791325bdfc2f0e4f8e9

src/bin/server/e_desktop_shell.c

index 7566c13dc7fd4d67b90c725246fd333ddb2372f2..341a5468c907e5ba4354291230975c9f90390d05 100644 (file)
@@ -403,7 +403,16 @@ e_desktop_toplevel_minimize_request(E_Desktop_Toplevel *toplevel)
 EINTERN void
 e_desktop_toplevel_window_geometry_set(E_Desktop_Toplevel *toplevel, int x, int y, int width, int height)
 {
+   E_Client *ec = toplevel->surface.ec;
+
+   if ((ec->comp_data->shell.window.x == x) &&
+       (ec->comp_data->shell.window.y == y) &&
+       (ec->comp_data->shell.window.w == width) &&
+       (ec->comp_data->shell.window.h == height))
+     return;
+
    ELOGF("TOPLEVEL", "Set window geometry: %d,%d %dx%d", toplevel->surface.ec, x, y, width, height);
+
    EINA_RECTANGLE_SET(&toplevel->surface.ec->comp_data->shell.window, x, y, width, height);
 }
 
@@ -412,14 +421,18 @@ e_desktop_toplevel_min_size_set(E_Desktop_Toplevel *toplevel, int width, int hei
 {
    E_Client *ec = toplevel->surface.ec;
 
+   if ((ec->icccm.min_w == width) &&
+       (ec->icccm.min_h == height))
+     return;
+
    ELOGF("TOPLEVEL", "Set min size: lock_client_size(%d) size(%dx%d)",
          toplevel->surface.ec, ec->lock_client_size, width, height);
 
-   if (ec->lock_client_size)
-     return;
-
-   ec->icccm.min_w = width;
-   ec->icccm.min_h = height;
+   if (!ec->lock_client_size)
+     {
+        ec->icccm.min_w = width;
+        ec->icccm.min_h = height;
+     }
 }
 
 EINTERN void
@@ -427,14 +440,18 @@ e_desktop_toplevel_max_size_set(E_Desktop_Toplevel *toplevel, int width, int hei
 {
    E_Client *ec = toplevel->surface.ec;
 
+   if ((ec->icccm.max_w == width) &&
+       (ec->icccm.max_h == height))
+     return;
+
    ELOGF("TOPLEVEL", "Set max size: lock_client_size(%d) size(%dx%d)",
          toplevel->surface.ec, ec->lock_client_size, width, height);
 
-   if (ec->lock_client_size)
-     return;
-
-   ec->icccm.max_w = width;
-   ec->icccm.max_h = height;
+   if (!ec->lock_client_size)
+     {
+        ec->icccm.max_w = width;
+        ec->icccm.max_h = height;
+     }
 }
 
 EINTERN bool