[gimp] Bug 792266 - Increase maximum size of x11 cursor during export.



commit 0484ce83afbc6fca1554e4d133469737e27e47bf
Author: Jehan <jehan girinstud io>
Date:   Sun Jan 7 14:41:44 2018 +0100

    Bug 792266 - Increase maximum size of x11 cursor during export.
    
    We were basing our max export size on a macro value defined in
    libXCursor code: MAX_BITMAP_CURSOR_SIZE. This macro is still defined in
    libXCursor and still has the same value (64), yet it is unsure how far
    or even where this is enforced since it seems we can get at least 96px
    cursors in GNOME/X11.
    
    As a consequence, this commit:
    - still warns when cursor size is over this value, with more explicit
      text, yet does not change the cursor size anymore! So it is now
      possible to export bigger cursors, but you still get a warning.
    - only changes the cursor size for the existing more-than-8-digits test
      and I add a warning when it does so (we should never modify an image
      silently!).
    - adds the size 96 as not triggering the warning about GNOME Settings
      since it definitely looks like this size is valid there (according to
      my own empirical tests). Also since 96 is higher than the libXCursor
      current MAX macro value, this really raises the question to where this
      max is enforced and whether we should not just drop the first warning.
    
    Note that it breaks a bit the string freeze since I modify one string
    and adds one. Sorry for this!

 plug-ins/common/file-xmc.c |   28 ++++++++++++++++++++++------
 1 files changed, 22 insertions(+), 6 deletions(-)
---
diff --git a/plug-ins/common/file-xmc.c b/plug-ins/common/file-xmc.c
index 1dc30ae..41bedb1 100644
--- a/plug-ins/common/file-xmc.c
+++ b/plug-ins/common/file-xmc.c
@@ -88,8 +88,14 @@
 
 /* The maximum dimension of Xcursor which is fully supported in any
  * environments. This is defined on line 59 of xcursorint.h in
- * libXcursor source code. Make sure this is about dimensions(width
+ * libXcursor source code. Make sure this is about dimensions (width
  * and height) not about nominal size despite of it's name.
+ *
+ * As of 2018, this macro still exists in libXCursor codebase, but I am
+ * unsure how far this restriction is enforced since this is a very low
+ * max dimension for today's displays. Therefore our code will not
+ * enforce this value anymore, but only warn about possible
+ * incompatibilities when using higher values.
  */
 #define MAX_BITMAP_CURSOR_SIZE  64
 
@@ -1757,8 +1763,9 @@ save_image (const gchar *filename,
   if (dimension_warn)
     {
       g_message (_("Your cursor was successfully exported but it contains one or "
-                   "more frames whose width or height is more than %ipx.\n"
-                   "It will clutter the screen in some environments."),
+                   "more frames whose width or height is more than %ipx, "
+                   "a historical max dimension value in X11.\n"
+                   "It may be unsupported by some environments."),
                    MAX_BITMAP_CURSOR_SIZE);
     }
   if (size_warn)
@@ -2114,9 +2121,17 @@ set_size_and_delay (const gchar *framename,
           if (!size) /* substitute it only for the first time */
             {
               if (strlen (digits) > 8) /* too large number should be clamped */
-                size = MAX_BITMAP_CURSOR_SIZE;
+                {
+                  g_message (_("Your cursor was successfully exported but it contains one or "
+                               "more frames whose size is over 8 digits.\n"
+                               "We clamped it to %dpx. You should check the exported cursor."),
+                             MAX_BITMAP_CURSOR_SIZE);
+                  size = MAX_BITMAP_CURSOR_SIZE;
+                }
               else
-                size = MIN (MAX_BITMAP_CURSOR_SIZE, atoi (digits));
+                {
+                  size = atoi (digits);
+                }
             }
         }
       else /* suffix is "ms" */
@@ -2146,7 +2161,8 @@ set_size_and_delay (const gchar *framename,
     }
   else if (! *size_warnp &&
            size != 12 && size != 16 && size != 24 && size != 32 &&
-           size != 36 && size != 40 && size != 48 && size != 64)
+           size != 36 && size != 40 && size != 48 && size != 64 &&
+           size != 96)
     { /* if the size is different from these values, we warn about it after
          successfully saving because gnome-appearance-properties only support
          them. */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]