http://bugs.winehq.org/show_bug.cgi?id=12693
Summary: statusbar doubletab problem Product: Wine Version: 0.9.60 Platform: PC OS/Version: Linux Status: UNCONFIRMED Severity: minor Priority: P2 Component: comctl32 AssignedTo: wine-bugs@winehq.org ReportedBy: tarasov.igor@gmail.com
I've put this to comctl32 only because bug disappears when I use native comctl32.dll.
So, here is the bug:
reference: http://polosatus.ru/wine/status_reference.png bug: http://polosatus.ru/wine/status_bug.png
This is statusbar, and two squares are as I suppose control characters that make some kind of offset, or changes text positioning.
When using native library xrender logs that it prints the following:
\01fa\020d\0212\0219\021a\0003\0215\0208\0003\0015\0013\0003\01e8\0217\0218\020d\0213\0224\0003\0015\0013\0013\001b\0003\020b\0011
But when using built in, it adds two more charactes at the end: \0000\0000.
Aha! Found it! Added more capture to windebug, and have caught the following:
trace:text:DrawTextExW L"\0422\0435\043a\0441\0442 \043d\0430 21 \0410\043f\0440\0435\043b\044c 2008 \0433.\t\t", -1, [(4,3)-(749,17)] 00000824
So, here is the character: double tab. In windows, this would lead to aligning following text to right I suppose.
The bug is reproduceable even with controlspy.
Initially, I though that problem might be with fonts, but I've installed native windows fonts, but still it was there.
What logs you might need?
P.S: It has nothing to do with locales, since english version of this software produces the same bug.
http://bugs.winehq.org/show_bug.cgi?id=12693
Igor Tarasov tarasov.igor@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Severity|minor |trivial
http://bugs.winehq.org/show_bug.cgi?id=12693
nille newilkman@yahoo.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever Confirmed|0 |1
--- Comment #1 from nille newilkman@yahoo.com 2008-04-21 05:19:53 --- *** This bug has been confirmed by popular vote. ***
http://bugs.winehq.org/show_bug.cgi?id=12693
--- Comment #2 from Lei Zhang thestig@google.com 2008-04-21 16:25:56 --- What are the steps to reproducing this with controlspy? Are you using controlspy 2.0?
http://bugs.winehq.org/show_bug.cgi?id=12693
--- Comment #3 from Igor Tarasov tarasov.igor@gmail.com 2008-04-21 16:54:48 --- I use control spy 1.0.
1. Launch status bar.exe 2. Select SB_SETTEXT message 3. Copy this text (within quotes) "a z" 4. Replace "string" (leaving quotes) with the text from clipboard 5. Click Send.
When running native comctl32.dll you'll see that a and z are at the left and right corners of status bar correspondingly. When running builtin comctl32.dll you'll see only two squares at the place of this doubletab.
I don't have control spy 2.0, installing it right now.
http://bugs.winehq.org/show_bug.cgi?id=12693
--- Comment #4 from Igor Tarasov tarasov.igor@gmail.com 2008-04-21 16:59:10 --- Awww.... Bugzilla converted tabs to spaces... At the step 3 do the following: open your favourite text editor, typin a<tab><tab>z, then copy this.
This is all required because \t does not work in controlspy, and tab key switches focus away from the text input.
http://bugs.winehq.org/show_bug.cgi?id=12693
--- Comment #5 from Igor Tarasov tarasov.igor@gmail.com 2008-04-21 19:26:00 --- No success in installing controlspy 2, wintricks did not help also (.net installation failed). I hope controlspy 1 would be enough?
http://bugs.winehq.org/show_bug.cgi?id=12693
Lei Zhang thestig@google.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download
--- Comment #6 from Lei Zhang thestig@google.com 2008-04-21 23:19:20 --- Ya, that's fine. Confirming.
http://bugs.winehq.org/show_bug.cgi?id=12693
Dripple dripple2@laposte.net changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |dripple2@laposte.net
http://bugs.winehq.org/show_bug.cgi?id=12693
--- Comment #7 from Igor Tarasov tarasov.igor@gmail.com 2008-05-09 16:06:58 --- MSDN says the following:
By default, text is left-aligned within the specified part of a status bar. You can embed tab characters (\ t) in the text to center or right-align it. Text to the right of a single tab character is centered, and text to the right of a second tab character is right-aligned.
http://msdn.microsoft.com/en-us/library/bb760728(VS.85).aspx
http://bugs.winehq.org/show_bug.cgi?id=12693
--- Comment #8 from Igor Tarasov tarasov.igor@gmail.com 2008-05-09 17:55:48 --- Finally, I've found where the bug is:
It is in DrawStatusTextW, here:
if (*text == '\t') { text++; align = DT_CENTER; if (*text == '\t') { text++; align = DT_RIGHT; } }
http://source.winehq.org/source/dlls/comctl32/commctrl.c#L538
As you see, it only checks if the first character is \t or the first two of them are. Test it with control spy and you'll see, that if you put tab or double tab at the beginning of the string it will align text, but it won't if the tab occurs further in string. However, there are no such restrictions in specification (see above).
As a test cases these should work this way:
L\tC\tR > |L C R| L\t\tR > |L R| \tC\tR > | C R|
My knowledge of C is very limited, and currently I am not sure if I am able to fix this (or rather that my fix would work well and won't spoil anything).
http://bugs.winehq.org/show_bug.cgi?id=12693
--- Comment #9 from Igor Tarasov tarasov.igor@gmail.com 2008-05-11 10:31:48 --- Created an attachment (id=12931) --> (http://bugs.winehq.org/attachment.cgi?id=12931) Patch that fixes this bug (hopefully)
Umm... Since no one responded, I've written a patch. Just take a note that this is the first thing I have EVER written in C. So, I suppose someone could check if it is suitable.
Generally, it makes what it should: checks if there are tabs in the string and reacts on eachm tab appearence (however, it skips all text that goes after second tab since this behavior is not specified).
The patch works in all software I've tried it, I've played with various values and combinations of tabs in ControlSpy, and have not found any bugs.
The only doubtful place in this code is this:
r.left += 3;
I think that this should be done only once, however, I am not very sure about this, since I have absolutely no idea about the purpose of this line.
So, maybe someone could assist me in trying to improve wine? ;)
http://bugs.winehq.org/show_bug.cgi?id=12693
--- Comment #10 from Igor Tarasov tarasov.igor@gmail.com 2008-05-11 10:38:13 --- (In reply to comment #9)
however, it skips all text that goes after second tab since this behavior is not specified
Err... I meant that it stops searching for tabs after the second one and just prints out remaining part right-aligned.
http://bugs.winehq.org/show_bug.cgi?id=12693
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch
http://bugs.winehq.org/show_bug.cgi?id=12693
Igor Tarasov tarasov.igor@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #12931|0 |1 is obsolete| |
--- Comment #11 from Igor Tarasov tarasov.igor@gmail.com 2008-05-12 07:47:24 --- Created an attachment (id=12969) --> (http://bugs.winehq.org/attachment.cgi?id=12969) Improved patch version
I have just checked it out side-by-side with native comctl32.dll version and have found two differences in realization:
1. Native version won't print anything starting from the third tab character. That's what was fixed with this patch.
2. Native version makes center alignment a bit different: it takes full statusbar part width, instead of text rectangle. You may notice this difference when, for example, statusbar has an icon. I think that r.left is supposed to be decreased a bit, but I was not able to find how to find that exact value.
http://bugs.winehq.org/show_bug.cgi?id=12693
--- Comment #12 from Igor Tarasov tarasov.igor@gmail.com 2008-05-13 20:01:22 --- Sent patch to wine-patches@winehq.org.
http://bugs.winehq.org/show_bug.cgi?id=12693
Dmitry Timoshkov dmitry@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED
--- Comment #13 from Dmitry Timoshkov dmitry@codeweavers.com 2008-05-14 07:06:59 --- The patch has been committed.
http://bugs.winehq.org/show_bug.cgi?id=12693
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #14 from Alexandre Julliard julliard@winehq.org 2008-05-23 10:38:09 --- Closing bugs fixed in 1.0-rc2.