Patch 8.0.1099
Problem:    Warnings for GDK calls.
Solution:   Use other calls for GTK 3 and fix a few problems. (Kazunobu
            Kuriyama)
Files:      src/mbyte.c


*** ../vim-8.0.1098/src/mbyte.c 2017-09-09 18:45:20.414225765 +0200
--- src/mbyte.c 2017-09-13 22:09:43.689845713 +0200
***************
*** 4891,4909 ****
--- 4891,4982 ----
  im_preedit_window_open()
  {
      char *preedit_string;
+ #if !GTK_CHECK_VERSION(3,16,0)
      char buf[8];
+ #endif
      PangoAttrList *attr_list;
      PangoLayout *layout;
+ #if GTK_CHECK_VERSION(3,0,0)
+ # if !GTK_CHECK_VERSION(3,16,0)
+     GdkRGBA color;
+ # endif
+ #else
      GdkColor color;
+ #endif
      gint w, h;
  
      if (preedit_window == NULL)
      {
        preedit_window = gtk_window_new(GTK_WINDOW_POPUP);
+       gtk_window_set_transient_for(GTK_WINDOW(preedit_window),
+                                                    GTK_WINDOW(gui.mainwin));
        preedit_label = gtk_label_new("");
+       gtk_widget_set_name(preedit_label, "vim-gui-preedit-area");
        gtk_container_add(GTK_CONTAINER(preedit_window), preedit_label);
      }
  
+ #if GTK_CHECK_VERSION(3,16,0)
+     {
+       GtkStyleContext * const context
+                                 = gtk_widget_get_style_context(gui.drawarea);
+       GtkCssProvider * const provider = gtk_css_provider_new();
+       gchar              *css = NULL;
+       const char * const fontname
+                          = pango_font_description_get_family(gui.norm_font);
+       gint    fontsize
+               = pango_font_description_get_size(gui.norm_font) / PANGO_SCALE;
+       gchar   *fontsize_propval = NULL;
+ 
+       if (!pango_font_description_get_size_is_absolute(gui.norm_font))
+       {
+           /* fontsize was given in points.  Convert it into that in pixels
+            * to use with CSS. */
+           GdkScreen * const screen
+                 = gdk_window_get_screen(gtk_widget_get_window(gui.mainwin));
+           const gdouble dpi = gdk_screen_get_resolution(screen);
+           fontsize = dpi * fontsize / 72;
+       }
+       if (fontsize > 0)
+           fontsize_propval = g_strdup_printf("%dpx", fontsize);
+       else
+           fontsize_propval = g_strdup_printf("inherit");
+ 
+       css = g_strdup_printf(
+               "widget#vim-gui-preedit-area {\n"
+               "  font-family: %s,monospace;\n"
+               "  font-size: %s;\n"
+               "  color: #%.2lx%.2lx%.2lx;\n"
+               "  background-color: #%.2lx%.2lx%.2lx;\n"
+               "}\n",
+               fontname != NULL ? fontname : "inherit",
+               fontsize_propval,
+               (gui.norm_pixel >> 16) & 0xff,
+               (gui.norm_pixel >> 8) & 0xff,
+               gui.norm_pixel & 0xff,
+               (gui.back_pixel >> 16) & 0xff,
+               (gui.back_pixel >> 8) & 0xff,
+               gui.back_pixel & 0xff);
+ 
+       gtk_css_provider_load_from_data(provider, css, -1, NULL);
+       gtk_style_context_add_provider(context,
+                                    GTK_STYLE_PROVIDER(provider), G_MAXUINT);
+ 
+       g_free(css);
+       g_free(fontsize_propval);
+       g_object_unref(provider);
+     }
+ #elif GTK_CHECK_VERSION(3,0,0)
+     gtk_widget_override_font(preedit_label, gui.norm_font);
+ 
+     vim_snprintf(buf, sizeof(buf), "#%06X", gui.norm_pixel);
+     gdk_rgba_parse(&color, buf);
+     gtk_widget_override_color(preedit_label, GTK_STATE_FLAG_NORMAL, &color);
+ 
+     vim_snprintf(buf, sizeof(buf), "#%06X", gui.back_pixel);
+     gdk_rgba_parse(&color, buf);
+     gtk_widget_override_background_color(preedit_label, GTK_STATE_FLAG_NORMAL,
+                                                                     &color);
+ #else
      gtk_widget_modify_font(preedit_label, gui.norm_font);
  
      vim_snprintf(buf, sizeof(buf), "#%06X", gui.norm_pixel);
***************
*** 4913,4918 ****
--- 4986,4992 ----
      vim_snprintf(buf, sizeof(buf), "#%06X", gui.back_pixel);
      gdk_color_parse(buf, &color);
      gtk_widget_modify_bg(preedit_window, GTK_STATE_NORMAL, &color);
+ #endif
  
      gtk_im_context_get_preedit_string(xic, &preedit_string, &attr_list, NULL);
  
*** ../vim-8.0.1098/src/version.c       2017-09-12 22:59:53.812728748 +0200
--- src/version.c       2017-09-13 22:06:49.502886370 +0200
***************
*** 771,772 ****
--- 771,774 ----
  {   /* Add new patch number below this line */
+ /**/
+     1099,
  /**/

-- 
FIXME and XXX are two common keywords used to mark broken or incomplete code
not only since XXX as a sex reference would grab everybody's attention but
simply due to the fact that Vim would highlight these words.
                                        -- Hendrik Scholz

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui