From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Francis Litterio Newsgroups: gmane.emacs.devel,gmane.emacs.windows Subject: Re: Improved patch to fix frame positioning bug on Windows Date: Thu, 13 Jan 2005 12:59:04 -0500 Message-ID: References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1105639912 15031 80.91.229.6 (13 Jan 2005 18:11:52 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 13 Jan 2005 18:11:52 +0000 (UTC) Cc: help-emacs-windows@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jan 13 19:11:36 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1Cp9RX-0003g2-00 for ; Thu, 13 Jan 2005 19:11:35 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Cp9dC-0006Y9-7E for ged-emacs-devel@m.gmane.org; Thu, 13 Jan 2005 13:23:38 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Cp9be-0005fO-RV for emacs-devel@gnu.org; Thu, 13 Jan 2005 13:22:03 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Cp9bZ-0005d0-Th for emacs-devel@gnu.org; Thu, 13 Jan 2005 13:21:58 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Cp9bZ-0005Z1-43 for emacs-devel@gnu.org; Thu, 13 Jan 2005 13:21:57 -0500 Original-Received: from [80.91.229.2] (helo=main.gmane.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1Cp9IF-0006Pq-2O for emacs-devel@gnu.org; Thu, 13 Jan 2005 13:02:00 -0500 Original-Received: from list by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 1Cp9IE-0007Wo-00 for ; Thu, 13 Jan 2005 19:01:58 +0100 Original-Received: from brick.estc.com ([209.27.151.2]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 13 Jan 2005 19:01:58 +0100 Original-Received: from franl by brick.estc.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 13 Jan 2005 19:01:58 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-To: emacs-devel@gnu.org Original-Lines: 91 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: brick.estc.com X-Draft-From: ("nntp+news.gmane.org:gmane.emacs.devel" 32199) Gcc: nnfolder:sent-usenet X-Random-Quote: Martyrdom is the only way in which a man can become famous without ability. -- George Bernard Shaw User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/21.3.50 (windows-nt) Cancel-Lock: sha1:uYzIEA3WW/OaCGGvX2Das3qTqAI= X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:32200 gmane.emacs.windows:2514 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:32200 Francis Litterio wrote: > - real_w = min (real_w, s->gc->clip_rectangle.right > + real_w = min (real_w, s->gc->clip_rectangle.r ght Ugh. How did _that_ get in there? Here's a correct version of the patch. Sorry for the confusion. -- Francis Litterio franl world . std . com --- src/ChangeLog 10 Jan 2005 08:29:50 -0500 1.4147 +++ src/ChangeLog 13 Jan 2005 12:39:35 -0500 @@ -1,3 +1,10 @@ +2005-01-13 Francis Litterio + + * w32term.c (x_calc_absolute_position): Changed function + x_calc_absolute_position() to account for the Windows-drawn + borders around a frame when converting a negative 'top or 'left + parameter into the equivalent positive value. + 2005-01-10 Kim F. Storm * dispextern.h (merge_faces): Rename from merge_into_realized_face. --- src/w32term.c 03 Jan 2005 17:52:51 -0500 1.221 +++ src/w32term.c 13 Jan 2005 12:55:19 -0500 @@ -5376,17 +5376,58 @@ { int flags = f->size_hint_flags; - /* Treat negative positions as relative to the leftmost bottommost + /* left_right_borders_width holds the sum of the widths of the frame's left + and right borders (in pixels) drawn by Windows. */ + + unsigned int left_right_borders_width = 8; /* A sensible default value. */ + + /* top_bottom_borders_height holds the sum of the heights of the frame's top and + bottom borders (in pixels) drawn by Windows. */ + + unsigned int top_bottom_borders_height = 32; /* A sensible default value. */ + + /* Now obtain the actual values of the above two variables. If we fail to + obtain the actual values, we will use the defaults assigned above. We compute + the border width (height) by subtracting the width (height) of the frame's + client area from the width (height) of the frame's entire window. + */ + + WINDOWPLACEMENT wp = { 0 }; + + BOOL status = GetWindowPlacement (FRAME_W32_WINDOW (f), &wp); + + if (status != FALSE) + { + RECT client_rect = { 0 }; + + status = GetClientRect (FRAME_W32_WINDOW (f), &client_rect); + + if (status != FALSE) + { + left_right_borders_width = + (wp.rcNormalPosition.right - wp.rcNormalPosition.left) - + (client_rect.right - client_rect.left); + + top_bottom_borders_height = + (wp.rcNormalPosition.bottom - wp.rcNormalPosition.top) - + (client_rect.bottom - client_rect.top); + } + } + + /* Treat negative positions as relative to the rightmost bottommost position that fits on the screen. */ if (flags & XNegative) f->left_pos = (FRAME_W32_DISPLAY_INFO (f)->width - FRAME_PIXEL_WIDTH (f) - + f->left_pos); + + f->left_pos + - (left_right_borders_width - 1)); if (flags & YNegative) f->top_pos = (FRAME_W32_DISPLAY_INFO (f)->height - FRAME_PIXEL_HEIGHT (f) - + f->top_pos); + + f->top_pos + - (top_bottom_borders_height - 1)); + /* The left_pos and top_pos are now relative to the top and left screen edges, so the flags should correspond. */