]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0625: GTK4: Link error when Wayland is disabled v9.2.0625
authorChristian Brabandt <cb@256bit.org>
Sat, 13 Jun 2026 14:41:35 +0000 (14:41 +0000)
committerChristian Brabandt <cb@256bit.org>
Sat, 13 Jun 2026 14:41:35 +0000 (14:41 +0000)
Problem:  GTK4: Link error when Wayland is disabled
          (chdiza)
Solution: Adjust ifdefs for clip_convert_data()

fixes: #20488

Signed-off-by: Christian Brabandt <cb@256bit.org>
src/clipboard.c
src/proto/clipboard.pro
src/version.c

index 243625047dca3e4929200b3a059214d149c95753..5ac185cb53a10205f5d89d7927cb8b57dcb50fae 100644 (file)
@@ -2574,72 +2574,6 @@ clip_reset_wayland(void)
     return OK;
 }
 
-/*
- * If "vim" is TRUE, then get the motion type. If "vimenc" is TRUE, then get the
- * motion type and also convert "*buf". "buf" and "len_store" will be updated to
- * reflect the actual contents, but should be set beforehand with the initial
- * contents. Returns OK on success and FAIL on failure.
- */
-    int
-clip_convert_data(
-       char_u  **buf,
-       long    *len_store,
-       int     *motion,
-       bool    vim,
-       bool    vimenc,
-       char_u  **tofree)
-{
-    char_u  *final = *buf;
-    char_u  *enc;
-    long    len = *len_store;
-
-    if (vim && len >= 2)
-    {
-       *motion = *final++;
-       len--;
-    }
-    else if (vimenc && len >= 3)
-    {
-       vimconv_T   conv;
-       int         convlen;
-
-       // First byte is motion type
-       *motion = *final++;
-       len--;
-
-       // Get encoding of selection
-       enc = final;
-
-       // Skip the encoding type including null terminator in final text
-       final = memchr(final, NUL, len);
-       if (final == NULL)
-           return FAIL;
-       final++; // Skip NUL
-
-       // Subtract pointers to get length of encoding;
-       len -= final - enc;
-
-       conv.vc_type = CONV_NONE;
-       convert_setup(&conv, enc, p_enc);
-       if (conv.vc_type != CONV_NONE)
-       {
-          char_u *tmp;
-
-          convlen = len;
-          tmp = string_convert(&conv, final, &convlen);
-          len = convlen;
-          if (tmp != NULL)
-          {
-               final = tmp;
-               *tofree = final;
-          }
-          convert_setup(&conv, NULL, NULL);
-       }
-    }
-    *buf = final;
-    *len_store = len;
-    return OK;
-}
 
 /*
  * Read data from a file descriptor and write it to the given clipboard.
@@ -3790,3 +3724,72 @@ dec_clip_provider(void)
 }
 
 #endif // FEAT_CLIPBOARD_PROVIDER
+
+#if defined(FEAT_WAYLAND_CLIPBOARD) || (defined(FEAT_GUI_GTK) && defined(USE_GTK4))
+/*
+ * If "vim" is TRUE, then get the motion type. If "vimenc" is TRUE, then get the
+ * motion type and also convert "*buf". "buf" and "len_store" will be updated to
+ * reflect the actual contents, but should be set beforehand with the initial
+ * contents. Returns OK on success and FAIL on failure.
+ */
+    int
+clip_convert_data(
+       char_u  **buf,
+       long    *len_store,
+       int     *motion,
+       bool    vim,
+       bool    vimenc,
+       char_u  **tofree)
+{
+    char_u  *final = *buf;
+    char_u  *enc;
+    long    len = *len_store;
+
+    if (vim && len >= 2)
+    {
+       *motion = *final++;
+       len--;
+    }
+    else if (vimenc && len >= 3)
+    {
+       vimconv_T   conv;
+       int         convlen;
+
+       // First byte is motion type
+       *motion = *final++;
+       len--;
+
+       // Get encoding of selection
+       enc = final;
+
+       // Skip the encoding type including null terminator in final text
+       final = memchr(final, NUL, len);
+       if (final == NULL)
+           return FAIL;
+       final++; // Skip NUL
+
+       // Subtract pointers to get length of encoding;
+       len -= final - enc;
+
+       conv.vc_type = CONV_NONE;
+       convert_setup(&conv, enc, p_enc);
+       if (conv.vc_type != CONV_NONE)
+       {
+          char_u *tmp;
+
+          convlen = len;
+          tmp = string_convert(&conv, final, &convlen);
+          len = convlen;
+          if (tmp != NULL)
+          {
+               final = tmp;
+               *tofree = final;
+          }
+          convert_setup(&conv, NULL, NULL);
+       }
+    }
+    *buf = final;
+    *len_store = len;
+    return OK;
+}
+#endif
index 25633ca39469575b9b22b24de61800da8ee5a4be..46dc72edeb5800df1a4e3053fccb5d4c73961815 100644 (file)
@@ -37,7 +37,6 @@ void may_set_selection(void);
 int clip_init_wayland(void);
 void clip_uninit_wayland(void);
 int clip_reset_wayland(void);
-int clip_convert_data(char_u **buf, long *len_store, int *motion, bool vim, bool vimenc, char_u **tofree);
 char *choose_clipmethod(void);
 void ex_clipreset(exarg_T *eap);
 void adjust_clip_reg(int *rp);
@@ -46,4 +45,5 @@ void call_clip_provider_request(int reg);
 void call_clip_provider_set(int reg);
 void inc_clip_provider(void);
 void dec_clip_provider(void);
+int clip_convert_data(char_u **buf, long *len_store, int *motion, bool vim, bool vimenc, char_u **tofree);
 /* vim: set ft=c : */
index 28606e3d3e665ab1222e70f91800c8967caf54cd..6e78357c41b3df8882e5e820a52a48efff5394cf 100644 (file)
@@ -754,6 +754,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    625,
 /**/
     624,
 /**/