diff options
Diffstat (limited to 'src/w32term.c')
| -rw-r--r-- | src/w32term.c | 63 |
1 files changed, 57 insertions, 6 deletions
diff --git a/src/w32term.c b/src/w32term.c index 712bdae5fc3..c37805cb6ca 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -5086,6 +5086,51 @@ w32_read_socket (struct terminal *terminal, | |||
| 5086 | } | 5086 | } |
| 5087 | 5087 | ||
| 5088 | case WM_WINDOWPOSCHANGED: | 5088 | case WM_WINDOWPOSCHANGED: |
| 5089 | f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | ||
| 5090 | |||
| 5091 | if (f) | ||
| 5092 | { | ||
| 5093 | RECT rect; | ||
| 5094 | int /* rows, columns, */ width, height, text_width, text_height; | ||
| 5095 | |||
| 5096 | if (GetClientRect (msg.msg.hwnd, &rect) | ||
| 5097 | /* GetClientRect evidently returns (0, 0, 0, 0) if | ||
| 5098 | called on a minimized frame. Such "dimensions" | ||
| 5099 | aren't useful anyway. */ | ||
| 5100 | && !(rect.bottom == 0 | ||
| 5101 | && rect.top == 0 | ||
| 5102 | && rect.left == 0 | ||
| 5103 | && rect.right == 0)) | ||
| 5104 | { | ||
| 5105 | height = rect.bottom - rect.top; | ||
| 5106 | width = rect.right - rect.left; | ||
| 5107 | text_width = FRAME_PIXEL_TO_TEXT_WIDTH (f, width); | ||
| 5108 | text_height = FRAME_PIXEL_TO_TEXT_HEIGHT (f, height); | ||
| 5109 | /* rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, height); */ | ||
| 5110 | /* columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, width); */ | ||
| 5111 | |||
| 5112 | /* TODO: Clip size to the screen dimensions. */ | ||
| 5113 | |||
| 5114 | /* Even if the number of character rows and columns | ||
| 5115 | has not changed, the font size may have changed, | ||
| 5116 | so we need to check the pixel dimensions as well. */ | ||
| 5117 | |||
| 5118 | if (width != FRAME_PIXEL_WIDTH (f) | ||
| 5119 | || height != FRAME_PIXEL_HEIGHT (f) | ||
| 5120 | || text_width != FRAME_TEXT_WIDTH (f) | ||
| 5121 | || text_height != FRAME_TEXT_HEIGHT (f)) | ||
| 5122 | { | ||
| 5123 | change_frame_size (f, text_width, text_height, 0, 1, 0, 1); | ||
| 5124 | SET_FRAME_GARBAGED (f); | ||
| 5125 | cancel_mouse_face (f); | ||
| 5126 | f->win_gravity = NorthWestGravity; | ||
| 5127 | } | ||
| 5128 | } | ||
| 5129 | } | ||
| 5130 | |||
| 5131 | check_visibility = 1; | ||
| 5132 | break; | ||
| 5133 | |||
| 5089 | case WM_ACTIVATE: | 5134 | case WM_ACTIVATE: |
| 5090 | case WM_ACTIVATEAPP: | 5135 | case WM_ACTIVATEAPP: |
| 5091 | f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | 5136 | f = x_window_to_frame (dpyinfo, msg.msg.hwnd); |
| @@ -6052,7 +6097,7 @@ x_calc_absolute_position (struct frame *f) | |||
| 6052 | int display_top = 0; | 6097 | int display_top = 0; |
| 6053 | struct frame *p = FRAME_PARENT_FRAME (f); | 6098 | struct frame *p = FRAME_PARENT_FRAME (f); |
| 6054 | 6099 | ||
| 6055 | if (flags & (XNegative | YNegative)) | 6100 | if (!p && flags & (XNegative | YNegative)) |
| 6056 | { | 6101 | { |
| 6057 | Lisp_Object list; | 6102 | Lisp_Object list; |
| 6058 | 6103 | ||
| @@ -6078,20 +6123,26 @@ x_calc_absolute_position (struct frame *f) | |||
| 6078 | } | 6123 | } |
| 6079 | 6124 | ||
| 6080 | /* Treat negative positions as relative to the rightmost bottommost | 6125 | /* Treat negative positions as relative to the rightmost bottommost |
| 6081 | position that fits on the screen. */ | 6126 | position that fits on the screen or parent frame. |
| 6127 | |||
| 6128 | I see no need for subtracting 1 from the border widths - is there | ||
| 6129 | any on the remaining platforms? Here these subtractions did put | ||
| 6130 | the last pixel line/column of a frame off-display when, for | ||
| 6131 | example, a (set-frame-parameter nil 'left '(- 0)) specification was | ||
| 6132 | used - martin 20017-05-05. */ | ||
| 6082 | if (flags & XNegative) | 6133 | if (flags & XNegative) |
| 6083 | { | 6134 | { |
| 6084 | if (p) | 6135 | if (p) |
| 6085 | f->left_pos = (FRAME_PIXEL_WIDTH (p) | 6136 | f->left_pos = (FRAME_PIXEL_WIDTH (p) |
| 6086 | - FRAME_PIXEL_WIDTH (f) | 6137 | - FRAME_PIXEL_WIDTH (f) |
| 6087 | + f->left_pos | 6138 | + f->left_pos |
| 6088 | - (left_right_borders_width - 1)); | 6139 | - left_right_borders_width); |
| 6089 | else | 6140 | else |
| 6090 | f->left_pos = (x_display_pixel_width (FRAME_DISPLAY_INFO (f)) | 6141 | f->left_pos = (x_display_pixel_width (FRAME_DISPLAY_INFO (f)) |
| 6091 | + display_left | 6142 | + display_left |
| 6092 | - FRAME_PIXEL_WIDTH (f) | 6143 | - FRAME_PIXEL_WIDTH (f) |
| 6093 | + f->left_pos | 6144 | + f->left_pos |
| 6094 | - (left_right_borders_width - 1)); | 6145 | - left_right_borders_width); |
| 6095 | } | 6146 | } |
| 6096 | 6147 | ||
| 6097 | if (flags & YNegative) | 6148 | if (flags & YNegative) |
| @@ -6100,13 +6151,13 @@ x_calc_absolute_position (struct frame *f) | |||
| 6100 | f->top_pos = (FRAME_PIXEL_HEIGHT (p) | 6151 | f->top_pos = (FRAME_PIXEL_HEIGHT (p) |
| 6101 | - FRAME_PIXEL_HEIGHT (f) | 6152 | - FRAME_PIXEL_HEIGHT (f) |
| 6102 | + f->top_pos | 6153 | + f->top_pos |
| 6103 | - (top_bottom_borders_height - 1)); | 6154 | - top_bottom_borders_height); |
| 6104 | else | 6155 | else |
| 6105 | f->top_pos = (x_display_pixel_height (FRAME_DISPLAY_INFO (f)) | 6156 | f->top_pos = (x_display_pixel_height (FRAME_DISPLAY_INFO (f)) |
| 6106 | + display_top | 6157 | + display_top |
| 6107 | - FRAME_PIXEL_HEIGHT (f) | 6158 | - FRAME_PIXEL_HEIGHT (f) |
| 6108 | + f->top_pos | 6159 | + f->top_pos |
| 6109 | - (top_bottom_borders_height - 1)); | 6160 | - top_bottom_borders_height); |
| 6110 | } | 6161 | } |
| 6111 | 6162 | ||
| 6112 | /* The left_pos and top_pos are now relative to the top and left | 6163 | /* The left_pos and top_pos are now relative to the top and left |