After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 351678 - Notebooks not with PositionType.Top drawn incorrectly
Notebooks not with PositionType.Top drawn incorrectly
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: Win32
2.8.x
Other Windows
: Normal normal
: ---
Assigned To: gtk-win32 maintainers
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2006-08-16 21:02 UTC by Brad Taylor
Modified: 2006-12-09 01:16 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Gtk Notebook rendered using MS-Windows theme (273.16 KB, image/bmp)
2006-08-16 21:03 UTC, Brad Taylor
  Details
System.Windows.Forms tab control (250.41 KB, image/bmp)
2006-08-16 21:04 UTC, Brad Taylor
  Details
Partial fix (2.14 KB, patch)
2006-09-07 06:24 UTC, Brad Taylor
needs-work Details | Review
More complete patch (5.11 KB, patch)
2006-12-01 19:47 UTC, Cody Russell
needs-work Details | Review
No longer has the gtknotebook.c hack (4.57 KB, patch)
2006-12-01 20:00 UTC, Cody Russell
committed Details | Review

Description Brad Taylor 2006-08-16 21:02:24 UTC
Using the MS-Windows theme, notebooks which have PositionType.Bottom, PositionType.Left and PositionType.Right are drawn incorrectly.  Instead of using the XP theme, the tabs are drawn using a different theme and upside down (see attachment #1 [details]).  

For reference, attachment #2 [details] shows a bug in the Windows XP theme which makes fixing this bug slightly complicated -- Windows also cannot draw tabs correctly with TabAlignment.Bottom.  

A page on CodeProject (http://www.codeproject.com/tabctrl/XPTabApp.asp) describes the usual workaround, which is to draw the XP notebook tab offscreen, then flip it as desired, and paint it on the widget.
Comment 1 Brad Taylor 2006-08-16 21:03:27 UTC
Created attachment 71048 [details]
Gtk Notebook rendered using MS-Windows theme
Comment 2 Brad Taylor 2006-08-16 21:04:34 UTC
Created attachment 71049 [details]
System.Windows.Forms tab control
Comment 3 Brad Taylor 2006-09-07 06:23:43 UTC
I've done a considerable amount of poking around with this bug and was able to track the issue down to two parts:

First, and most obviously, the tab needs to be flipped when real_gap_side isn't GTK_POS_TOP.  My patch to msw_style.c does this with gdk_pixbuf_rotate_simple.

Second, gtk_notebook_draw_tab is being called twice for the active and focused tab.  The first time, the real_gap_side seems to be correct, but the second time, its always set to GTK_POS_TOP.  Obviously, this is quite problematic.  The hacky fix is to not call gtk_notebook_draw_tab when the tab gets focus, thus not repainting the tab with a gap_side of GTK_POS_TOP.

This is definitely not a complete fix as it will (possibly) break non MS-Windows engines, but I have confirmed that the fix does work on both Classic and XP style MS-Windows engine.  Also, there seem to be some lingering repainting issues that I haven't spent very long to track down.  (Whether these are due to general gdk/win32 funkiness or not is to be seen)

I'm pretty sure that someone with more MS-Windows/Win32 knowledge could take this patch and iron out all the wrinkles.
Comment 4 Brad Taylor 2006-09-07 06:24:18 UTC
Created attachment 72365 [details] [review]
Partial fix
Comment 5 Cody Russell 2006-12-01 19:45:57 UTC
This patch should fix the remaining issues, namely for GTK_POS_LEFT and GTK_POS_RIGHT.
Comment 6 Cody Russell 2006-12-01 19:47:14 UTC
Created attachment 77508 [details] [review]
More complete patch
Comment 7 Dominic Lachowicz 2006-12-01 19:52:57 UTC
Not going to commit this quite yet because of the following issue:

(2:50:00 PM) dom: bratsche: the problem is that it really isn't a "G_PLATFORM_WIN32" issue, but a "ms-windows-theme' issue iirc
(2:50:14 PM) dom: so, will this make non-ms-windows themes look bad on win32?
(2:50:27 PM) bratsche: dom: Yes. :(

(2:52:04 PM) dom: bratsche: it's appreciated. you're going down the right path. QT's windows theme does exactly the same "render to pixbuf and rotate" approach
Comment 8 Cody Russell 2006-12-01 20:00:46 UTC
Created attachment 77509 [details] [review]
No longer has the gtknotebook.c hack

Sorry, that seems not to be necessary after all.  This patch removes it.
Comment 9 Dominic Lachowicz 2006-12-02 16:35:41 UTC
Thanks Cody! I've committed this to the HEAD, 2.10, and 2.8 branches.
Comment 10 Cody Russell 2006-12-09 00:04:07 UTC
Can we mark this as RESOLVED?
Comment 11 Dominic Lachowicz 2006-12-09 01:16:06 UTC
FIXED