http://bugs.winehq.org/show_bug.cgi?id=26747
Summary: SIV Window Resize and AdjustWindowRect() off-by-one issue Product: Wine Version: 1.3.17 Platform: x86 URL: http://rh-software.com/ OS/Version: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: user32 AssignedTo: wine-bugs@winehq.org ReportedBy: ray@pobox.co.uk
While trying to work-a-round the lack of WM_EXITSIZEMOVE (http://bugs.winehq.org/show_bug.cgi?id=26736) I found what seems to be an off-by-one error within AdjustWindowRect(). Testing on real Windows then the code worked fine, but to get it to work on Wine 1.3.17-243 I needed to adjust things as in the code below. The svb->style is 0x00C40000 ( WS_CAPTION | WS_THICKFRAME ). The issue is the same for both window managers.
ar->top = 0; ar->left = 0; ar->bottom = 0; ar->right = 0;
if( AdjustWindowRect( ar, svb->style, FALSE ) ) { if( mode & MODE_WINE ) { dr->top -= ar->top + 1; // Client Area positions dr->left -= ar->left + 1; // dr->bottom -= ar->bottom + 1; // dr->right -= ar->right + 1; // } else { dr->top -= ar->top; // Client Area positions dr->left -= ar->left; // dr->bottom -= ar->bottom; // dr->right -= ar->right; // }
http://bugs.winehq.org/show_bug.cgi?id=26747
Dmitry Timoshkov dmitry@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Component|user32 |-unknown Resolution| |INVALID
--- Comment #1 from Dmitry Timoshkov dmitry@codeweavers.com 2011-04-13 07:20:11 CDT --- The following test application
#include <windows.h> #include <stdio.h>
int main(void) { RECT rc;
rc.left = 0; rc.top = 0; rc.right = 100; rc.bottom = 100; AdjustWindowRect(&rc, WS_CAPTION | WS_THICKFRAME, FALSE); printf("0,0-100,100 => %ld,%ld-%ld,%ld\n", rc.left, rc.top, rc.right, rc.bottom); printf("SM_CXFRAME %d, SM_CYFRAME %d\n", GetSystemMetrics(SM_CXFRAME), GetSystemMetrics(SM_CYFRAME));
return 0; }
prints under XP:
0,0-100,100 => -4,-36-104,104 SM_CXFRAME 4, SM_CYFRAME 4
under Wine:
0,0-100,100 => -4,-23-104,104 SM_CXFRAME 4, SM_CYFRAME 4
which is perfectly valid, caption size is different but it's expected.
http://bugs.winehq.org/show_bug.cgi?id=26747
Dmitry Timoshkov dmitry@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #2 from Dmitry Timoshkov dmitry@codeweavers.com 2011-04-13 07:20:23 CDT --- Closing invalid.
http://bugs.winehq.org/show_bug.cgi?id=26747
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|CLOSED |UNCONFIRMED Resolution|INVALID |
--- Comment #3 from Alexandre Julliard julliard@winehq.org 2011-04-13 08:14:59 CDT --- The point was that it doesn't match the dimensions of the window.
http://bugs.winehq.org/show_bug.cgi?id=26747
Dmitry Timoshkov dmitry@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|SIV Window Resize and |SIV Window Resize |AdjustWindowRect() |off-by-one issue |off-by-one issue |
--- Comment #4 from Dmitry Timoshkov dmitry@codeweavers.com 2011-04-14 00:52:03 CDT --- Then it's not a AdjustWindowRect() related problem. The reporter may need to create a better way to reproduce it.
http://bugs.winehq.org/show_bug.cgi?id=26747
--- Comment #5 from ray@pobox.co.uk 2011-04-14 02:42:26 CDT --- Created an attachment (id=34096) --> (http://bugs.winehq.org/attachment.cgi?id=34096) Image generated by SIV [Copy] operation
This image was generated by pressing the SIV [Copy] button.
http://bugs.winehq.org/show_bug.cgi?id=26747
--- Comment #6 from ray@pobox.co.uk 2011-04-14 02:44:25 CDT --- Created an attachment (id=34098) --> (http://bugs.winehq.org/attachment.cgi?id=34098) Image generated by Wine Screenshot
This image was generated using Applications->Accessories->Take Screenshot
http://bugs.winehq.org/show_bug.cgi?id=26747
--- Comment #7 from Dmitry Timoshkov dmitry@codeweavers.com 2011-04-14 02:48:00 CDT --- As a developer of the application you may try to remove all Wine hacks first, and try to create a real sample/test application showing the problem.
http://bugs.winehq.org/show_bug.cgi?id=26747
--- Comment #8 from ray@pobox.co.uk 2011-04-14 03:04:39 CDT --- (In reply to comment #3)
The point was that it doesn't match the dimensions of the window.
Thank you for correcting the bug status and also thank you for the test program. I have been trying to think of a simple way to show this issue, thus far I have come up with the following.
I have uploaded two screen images, the one generated by SIV which is all offset by one pixel relative to the Wine Screenshot. The actual code that SIV uses to copy the window to the clipboard is below.
As it's only off-by-one pixel it's quite hard to see, but the SIV-Copy image is all offset to the right by one pixel.
I released SIV 4.18 today which can be used to reproduce the screen images.
Is this enough to progress the issue?
The SIV-Copy image is also missing the border which I expect is a side effect of using the Linux window manager. I am wondering if there is a known work-a-round.
if( ( GetWindowRect( whl, wr ) ) && ( GetClientRect( whl, cr ) ) ) /* window size */ { LONG xsiz; LONG ysiz;
UpdateWindow( whl );
hdcw = GetDC( whl ); hdcb = CreateCompatibleDC( hdcw );
if( hbit = CreateCompatibleBitmap( hdcw, /* create bitmap */ xsiz = wr->right - wr->left, ysiz = wr->bottom - wr->top ) ) { SelectObject( hdcb, hbit );
AdjustWindowRect( cr, style, FALSE ); // border information
BitBlt( hdcb, /* dest'n DC */ 0, /* dest'n X pos */ 0, /* dest'n Y pos */ xsiz, /* dest'n Width */ ysiz, /* dest'n Height */ hdcw, /* source DC */ cr->left, /* source X pos */ cr->top, /* source Y pos */ SRCCOPY ); /* operation mode */
SetClipboardData( CF_BITMAP, hbit ); /* set the data */ }
DeleteDC( hdcb ); ReleaseDC( whl, hdcw ); }
http://bugs.winehq.org/show_bug.cgi?id=26747
Dmitry Timoshkov dmitry@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Severity|normal |trivial
http://bugs.winehq.org/show_bug.cgi?id=26747
--- Comment #9 from ray@pobox.co.uk 2011-04-14 03:28:22 CDT --- Created an attachment (id=34102) --> (http://bugs.winehq.org/attachment.cgi?id=34102) Screen Shot showing the effect of the off-by-one
This screen shot was taken after doing several height changes. Every time the height is changed the buttons move Left and Up by one pixel. This was generated by the test version which is the next attachment.
http://bugs.winehq.org/show_bug.cgi?id=26747
--- Comment #10 from ray@pobox.co.uk 2011-04-14 03:36:26 CDT --- Created an attachment (id=34103) --> (http://bugs.winehq.org/attachment.cgi?id=34103) Test version of SIV
This is build of SIV had the Wine work-a-round removed. It would be placed in the same directory as the files from the SIV 4.18 release. To reproduce the effect do Menu->Tools->Lines->Set NN Lines and then change the window height several times.
If there is no menu then either use winecfg to stop window manager doing the decoration or Right/Click on the SIV panel/Tray Icon.
http://bugs.winehq.org/show_bug.cgi?id=26747
ray@pobox.co.uk changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |ray@pobox.co.uk
http://bugs.winehq.org/show_bug.cgi?id=26747
ray@rh-software.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Severity|trivial |minor
http://bugs.winehq.org/show_bug.cgi?id=26747
--- Comment #11 from ray@rh-software.com 2011-04-16 17:59:28 CDT --- Because the effect is cumulative this is not trivial. To begin with it is, but it soon is a problem.
http://bugs.winehq.org/show_bug.cgi?id=26747
--- Comment #12 from Austin English austinenglish@gmail.com 2013-11-13 16:48:53 CST --- This is your friendly reminder that there has been no bug activity for 2 years. Is this still an issue in current (1.7.6 or newer) wine? If so, please attach the terminal output in 1.7.6 (see http://wiki.winehq.org/FAQ#get_log).
https://bugs.winehq.org/show_bug.cgi?id=26747
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |ABANDONED
--- Comment #13 from Austin English austinenglish@gmail.com --- Abandoned.
https://bugs.winehq.org/show_bug.cgi?id=26747
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #14 from Austin English austinenglish@gmail.com --- Closing.