Patch 8.0.1084
Problem:    GTK build has compiler warnings. (Christian Brabandt)
Solution:   Get screen size with a different function. (Ken Takata, Yasuhiro
            Matsumoto)
Files:      src/mbyte.c, src/gui_gtk_x11.c, src/proto/gui_gtk_x11.pro,
            src/gui_beval.c


*** ../vim-8.0.1083/src/mbyte.c 2017-09-05 22:20:42.624382868 +0200
--- src/mbyte.c 2017-09-09 18:40:32.928136185 +0200
***************
*** 4871,4878 ****
      if (preedit_window == NULL)
        return;
  
!     sw = gdk_screen_get_width(gtk_widget_get_screen(preedit_window));
!     sh = gdk_screen_get_height(gtk_widget_get_screen(preedit_window));
  #if GTK_CHECK_VERSION(3,0,0)
      gdk_window_get_origin(gtk_widget_get_window(gui.drawarea), &x, &y);
  #else
--- 4871,4877 ----
      if (preedit_window == NULL)
        return;
  
!     gui_gtk_get_screen_size_of_win(preedit_window, &sw, &sh);
  #if GTK_CHECK_VERSION(3,0,0)
      gdk_window_get_origin(gtk_widget_get_window(gui.drawarea), &x, &y);
  #else
*** ../vim-8.0.1083/src/gui_gtk_x11.c   2017-09-02 18:33:52.449554495 +0200
--- src/gui_gtk_x11.c   2017-09-09 18:36:59.113559497 +0200
***************
*** 4941,4946 ****
--- 4941,4969 ----
      gui_mch_update();
  }
  
+     void
+ gui_gtk_get_screen_size_of_win(GtkWidget *win, int *width, int *height)
+ {
+ #if GTK_CHECK_VERSION(3,22,0)
+     GdkDisplay *dpy = gtk_widget_get_display(win);
+     GdkWindow *win = gtk_widget_get_window(win);
+     GdkMonitor *monitor = gdk_display_get_monitor_at_window(dpy, win);
+     GdkRectangle geometry;
+ 
+     gdk_monitor_get_geometry(monitor, &geometry);
+     *width = geometry.width;
+     *height = geometry.height;
+ #else
+     GdkScreen* screen;
+ 
+     if (win != NULL && gtk_widget_has_screen(win))
+       screen = gtk_widget_get_screen(win);
+     else
+       screen = gdk_screen_get_default();
+     *width = gdk_screen_get_width(screen);
+     *height = gdk_screen_get_height(screen);
+ #endif
+ }
  
  /*
   * The screen size is used to make sure the initial window doesn't get bigger
***************
*** 4950,4979 ****
      void
  gui_mch_get_screen_dimensions(int *screen_w, int *screen_h)
  {
! #if GTK_CHECK_VERSION(3,22,2)
!     GdkRectangle rect;
!     GdkMonitor * const mon = gdk_display_get_monitor_at_window(
!           gtk_widget_get_display(gui.mainwin),
!           gtk_widget_get_window(gui.mainwin));
!     gdk_monitor_get_geometry(mon, &rect);
  
-     *screen_w = rect.width;
      /* Subtract 'guiheadroom' from the height to allow some room for the
       * window manager (task list and window title bar). */
!     *screen_h = rect.height - p_ghr;
! #else
!     GdkScreen* screen;
! 
!     if (gui.mainwin != NULL && gtk_widget_has_screen(gui.mainwin))
!       screen = gtk_widget_get_screen(gui.mainwin);
!     else
!       screen = gdk_screen_get_default();
! 
!     *screen_w = gdk_screen_get_width(screen);
!     /* Subtract 'guiheadroom' from the height to allow some room for the
!      * window manager (task list and window title bar). */
!     *screen_h = gdk_screen_get_height(screen) - p_ghr;
! #endif
  
      /*
       * FIXME: dirty trick: Because the gui_get_base_height() doesn't include
--- 4973,4983 ----
      void
  gui_mch_get_screen_dimensions(int *screen_w, int *screen_h)
  {
!     gui_gtk_get_screen_size_of_win(gui.mainwin, screen_w, screen_h);
  
      /* Subtract 'guiheadroom' from the height to allow some room for the
       * window manager (task list and window title bar). */
!     *screen_h -= p_ghr;
  
      /*
       * FIXME: dirty trick: Because the gui_get_base_height() doesn't include
*** ../vim-8.0.1083/src/proto/gui_gtk_x11.pro   2017-07-23 16:45:05.669761183 
+0200
--- src/proto/gui_gtk_x11.pro   2017-09-09 18:40:29.664157884 +0200
***************
*** 25,30 ****
--- 25,31 ----
  void gui_mch_unmaximize(void);
  void gui_mch_newfont(void);
  void gui_mch_set_shellsize(int width, int height, int min_width, int 
min_height, int base_width, int base_height, int direction);
+ void gui_gtk_get_screen_size_of_win(GtkWidget *win, int *width, int *height);
  void gui_mch_get_screen_dimensions(int *screen_w, int *screen_h);
  void gui_mch_settitle(char_u *title, char_u *icon);
  void gui_mch_enable_menu(int showit);
*** ../vim-8.0.1083/src/gui_beval.c     2017-06-05 15:07:04.944381581 +0200
--- src/gui_beval.c     2017-09-09 18:40:41.348080207 +0200
***************
*** 1177,1199 ****
        int             x_offset = EVAL_OFFSET_X;
        int             y_offset = EVAL_OFFSET_Y;
        PangoLayout     *layout;
- # if GTK_CHECK_VERSION(3,22,2)
-       GdkRectangle rect;
-       GdkMonitor * const mon = gdk_display_get_monitor_at_window(
-               gtk_widget_get_display(beval->balloonShell),
-               gtk_widget_get_window(beval->balloonShell));
-       gdk_monitor_get_geometry(mon, &rect);
  
!       screen_w = rect.width;
!       screen_h = rect.height;
! # else
        GdkScreen       *screen;
  
        screen = gtk_widget_get_screen(beval->target);
        gtk_window_set_screen(GTK_WINDOW(beval->balloonShell), screen);
-       screen_w = gdk_screen_get_width(screen);
-       screen_h = gdk_screen_get_height(screen);
  # endif
  # if !GTK_CHECK_VERSION(3,0,0)
        gtk_widget_ensure_style(beval->balloonShell);
        gtk_widget_ensure_style(beval->balloonLabel);
--- 1177,1191 ----
        int             x_offset = EVAL_OFFSET_X;
        int             y_offset = EVAL_OFFSET_Y;
        PangoLayout     *layout;
  
! # if !GTK_CHECK_VERSION(3,22,2)
        GdkScreen       *screen;
  
        screen = gtk_widget_get_screen(beval->target);
        gtk_window_set_screen(GTK_WINDOW(beval->balloonShell), screen);
  # endif
+       gui_gtk_get_screen_size_of_win(beval->balloonShell,
+                                                        &screen_w, &screen_h);
  # if !GTK_CHECK_VERSION(3,0,0)
        gtk_widget_ensure_style(beval->balloonShell);
        gtk_widget_ensure_style(beval->balloonLabel);
*** ../vim-8.0.1083/src/version.c       2017-09-09 18:16:19.865806605 +0200
--- src/version.c       2017-09-09 18:23:01.851107669 +0200
***************
*** 771,772 ****
--- 771,774 ----
  {   /* Add new patch number below this line */
+ /**/
+     1084,
  /**/

-- 
The primary purpose of the DATA statement is to give names to constants;
instead of referring to pi as 3.141592653589793 at every appearance, the
variable PI can be given that value with a DATA statement and used instead
of the longer form of the constant.  This also simplifies modifying the
program, should the value of pi change.
        -- FORTRAN manual for Xerox Computers

 /// Bram Moolenaar -- b...@moolenaar.net -- 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 vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui