]> git.pld-linux.org Git - packages/vim.git/blob - 7.3.393
- new
[packages/vim.git] / 7.3.393
1 To: vim_dev@googlegroups.com
2 Subject: Patch 7.3.393
3 Fcc: outbox
4 From: Bram Moolenaar <Bram@moolenaar.net>
5 Mime-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8 ------------
9
10 Patch 7.3.393
11 Problem:    Win32: When resizing Vim it is always moved to the primary monitor
12             if the secondary monitor is on the left.
13 Solution:   Use the nearest monitor. (Yukihiro Nakadaira)
14 Files:      src/gui_w32.c
15
16
17 *** ../vim-7.3.392/src/gui_w32.c        2011-12-15 21:51:32.000000000 +0100
18 --- src/gui_w32.c       2012-01-04 20:25:58.000000000 +0100
19 ***************
20 *** 1661,1669 ****
21   {
22       RECT      workarea_rect;
23       int               win_width, win_height;
24 -     int               win_xpos, win_ypos;
25       WINDOWPLACEMENT wndpl;
26 -     int               workarea_left;
27   
28       /* Try to keep window completely on screen. */
29       /* Get position of the screen work area.  This is the part that is not
30 --- 1661,1667 ----
31 ***************
32 *** 1685,1693 ****
33         GetWindowPlacement(s_hwnd, &wndpl);
34       }
35   
36 -     win_xpos = wndpl.rcNormalPosition.left;
37 -     win_ypos = wndpl.rcNormalPosition.top;
38
39       /* compute the size of the outside of the window */
40       win_width = width + GetSystemMetrics(SM_CXFRAME) * 2;
41       win_height = height + GetSystemMetrics(SM_CYFRAME) * 2
42 --- 1683,1688 ----
43 ***************
44 *** 1697,1732 ****
45   #endif
46                         ;
47   
48 !     /* There is an inconsistency when using two monitors and Vim is on the
49 !      * second (right) one: win_xpos will be the offset from the workarea of
50 !      * the left monitor.  While with one monitor it's the offset from the
51 !      * workarea (including a possible taskbar on the left).  Detect the second
52 !      * monitor by checking for the left offset to be quite big. */
53 !     if (workarea_rect.left > 300)
54 !       workarea_left = 0;
55 !     else
56 !       workarea_left = workarea_rect.left;
57   
58 !     /* If the window is going off the screen, move it on to the screen.
59 !      * win_xpos and win_ypos are relative to the workarea. */
60       if ((direction & RESIZE_HOR)
61 !           && workarea_left + win_xpos + win_width > workarea_rect.right)
62 !       win_xpos = workarea_rect.right - win_width - workarea_left;
63   
64 !     if ((direction & RESIZE_HOR) && win_xpos < 0)
65 !       win_xpos = 0;
66   
67       if ((direction & RESIZE_VERT)
68 !         && workarea_rect.top + win_ypos + win_height > workarea_rect.bottom)
69 !       win_ypos = workarea_rect.bottom - win_height - workarea_rect.top;
70   
71 !     if ((direction & RESIZE_VERT) && win_ypos < 0)
72 !       win_ypos = 0;
73
74 !     wndpl.rcNormalPosition.left = win_xpos;
75 !     wndpl.rcNormalPosition.right = win_xpos + win_width;
76 !     wndpl.rcNormalPosition.top = win_ypos;
77 !     wndpl.rcNormalPosition.bottom = win_ypos + win_height;
78   
79       /* set window position - we should use SetWindowPlacement rather than
80        * SetWindowPos as the MSDN docs say the coord systems returned by
81 --- 1692,1723 ----
82   #endif
83                         ;
84   
85 !     /* The following should take care of keeping Vim on the same monitor, no
86 !      * matter if the secondary monitor is left or right of the primary
87 !      * monitor. */
88 !     wndpl.rcNormalPosition.right = wndpl.rcNormalPosition.left + win_width;
89 !     wndpl.rcNormalPosition.bottom = wndpl.rcNormalPosition.top + win_height;
90   
91 !     /* If the window is going off the screen, move it on to the screen. */
92       if ((direction & RESIZE_HOR)
93 !           && wndpl.rcNormalPosition.right > workarea_rect.right)
94 !       OffsetRect(&wndpl.rcNormalPosition,
95 !               workarea_rect.right - wndpl.rcNormalPosition.right, 0);
96   
97 !     if ((direction & RESIZE_HOR)
98 !           && wndpl.rcNormalPosition.left < workarea_rect.left)
99 !       OffsetRect(&wndpl.rcNormalPosition,
100 !               workarea_rect.left - wndpl.rcNormalPosition.left, 0);
101   
102       if ((direction & RESIZE_VERT)
103 !           && wndpl.rcNormalPosition.bottom > workarea_rect.bottom)
104 !       OffsetRect(&wndpl.rcNormalPosition,
105 !               0, workarea_rect.bottom - wndpl.rcNormalPosition.bottom);
106   
107 !     if ((direction & RESIZE_VERT)
108 !           && wndpl.rcNormalPosition.top < workarea_rect.top)
109 !       OffsetRect(&wndpl.rcNormalPosition,
110 !               0, workarea_rect.top - wndpl.rcNormalPosition.top);
111   
112       /* set window position - we should use SetWindowPlacement rather than
113        * SetWindowPos as the MSDN docs say the coord systems returned by
114 *** ../vim-7.3.392/src/version.c        2012-01-04 19:34:32.000000000 +0100
115 --- src/version.c       2012-01-04 20:28:57.000000000 +0100
116 ***************
117 *** 716,717 ****
118 --- 716,719 ----
119   {   /* Add new patch number below this line */
120 + /**/
121 +     393,
122   /**/
123
124 -- 
125 I wonder, do vegetarians eat fruit bats?
126
127  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
128 ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
129 \\\  an exciting new programming language -- http://www.Zimbu.org        ///
130  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
This page took 0.044288 seconds and 3 git commands to generate.