diff options
| author | Kim F. Storm | 2006-07-18 23:04:12 +0000 |
|---|---|---|
| committer | Kim F. Storm | 2006-07-18 23:04:12 +0000 |
| commit | 83676aa2e399363120942ef5ea19f8af6b75e8e8 (patch) | |
| tree | aa14ccd94746bd0dfdf5e3b02963bd9b54243cce /src | |
| parent | eeeda6f14d4182d349c185208f3fb3c089f9d67d (diff) | |
| download | emacs-83676aa2e399363120942ef5ea19f8af6b75e8e8.tar.gz emacs-83676aa2e399363120942ef5ea19f8af6b75e8e8.zip | |
(x_calc_absolute_position): Fix frame positioning
with negative X/Y coordinates.
From Francis Litterio <franl@world.std.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/w32term.c | 44 |
1 files changed, 38 insertions, 6 deletions
diff --git a/src/w32term.c b/src/w32term.c index 29fe961946d..294059aa77b 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -5312,20 +5312,52 @@ x_calc_absolute_position (f) | |||
| 5312 | { | 5312 | { |
| 5313 | int flags = f->size_hint_flags; | 5313 | int flags = f->size_hint_flags; |
| 5314 | 5314 | ||
| 5315 | /* Treat negative positions as relative to the leftmost bottommost | 5315 | /* The sum of the widths of the frame's left and right borders, and |
| 5316 | the sum of the heights of the frame's top and bottom borders (in | ||
| 5317 | pixels) drawn by Windows. */ | ||
| 5318 | unsigned int left_right_borders_width, top_bottom_borders_height; | ||
| 5319 | |||
| 5320 | /* Try to get the actual values of these two variables. We compute | ||
| 5321 | the border width (height) by subtracting the width (height) of | ||
| 5322 | the frame's client area from the width (height) of the frame's | ||
| 5323 | entire window. */ | ||
| 5324 | WINDOWPLACEMENT wp = { 0 }; | ||
| 5325 | RECT client_rect = { 0 }; | ||
| 5326 | |||
| 5327 | if (GetWindowPlacement (FRAME_W32_WINDOW (f), &wp) | ||
| 5328 | && GetClientRect (FRAME_W32_WINDOW (f), &client_rect)) | ||
| 5329 | { | ||
| 5330 | left_right_borders_width = | ||
| 5331 | (wp.rcNormalPosition.right - wp.rcNormalPosition.left) - | ||
| 5332 | (client_rect.right - client_rect.left); | ||
| 5333 | |||
| 5334 | top_bottom_borders_height = | ||
| 5335 | (wp.rcNormalPosition.bottom - wp.rcNormalPosition.top) - | ||
| 5336 | (client_rect.bottom - client_rect.top); | ||
| 5337 | } | ||
| 5338 | else | ||
| 5339 | { | ||
| 5340 | /* Use sensible default values. */ | ||
| 5341 | left_right_borders_width = 8; | ||
| 5342 | top_bottom_borders_height = 32; | ||
| 5343 | } | ||
| 5344 | |||
| 5345 | /* Treat negative positions as relative to the rightmost bottommost | ||
| 5316 | position that fits on the screen. */ | 5346 | position that fits on the screen. */ |
| 5317 | if (flags & XNegative) | 5347 | if (flags & XNegative) |
| 5318 | f->left_pos = (FRAME_W32_DISPLAY_INFO (f)->width | 5348 | f->left_pos = (FRAME_W32_DISPLAY_INFO (f)->width |
| 5319 | - FRAME_PIXEL_WIDTH (f) | 5349 | - FRAME_PIXEL_WIDTH (f) |
| 5320 | + f->left_pos); | 5350 | + f->left_pos |
| 5351 | - (left_right_borders_width - 1)); | ||
| 5321 | 5352 | ||
| 5322 | if (flags & YNegative) | 5353 | if (flags & YNegative) |
| 5323 | f->top_pos = (FRAME_W32_DISPLAY_INFO (f)->height | 5354 | f->top_pos = (FRAME_W32_DISPLAY_INFO (f)->height |
| 5324 | - FRAME_PIXEL_HEIGHT (f) | 5355 | - FRAME_PIXEL_HEIGHT (f) |
| 5325 | + f->top_pos); | 5356 | + f->top_pos |
| 5326 | /* The left_pos and top_pos | 5357 | - (top_bottom_borders_height - 1)); |
| 5327 | are now relative to the top and left screen edges, | 5358 | |
| 5328 | so the flags should correspond. */ | 5359 | /* The left_pos and top_pos are now relative to the top and left |
| 5360 | screen edges, so the flags should correspond. */ | ||
| 5329 | f->size_hint_flags &= ~ (XNegative | YNegative); | 5361 | f->size_hint_flags &= ~ (XNegative | YNegative); |
| 5330 | } | 5362 | } |
| 5331 | 5363 | ||