GNOME Bugzilla – Bug 351678
Notebooks not with PositionType.Top drawn incorrectly
Last modified: 2006-12-09 01:16:06 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.
Created attachment 71048 [details] Gtk Notebook rendered using MS-Windows theme
Created attachment 71049 [details] System.Windows.Forms tab control
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.
Created attachment 72365 [details] [review] Partial fix
This patch should fix the remaining issues, namely for GTK_POS_LEFT and GTK_POS_RIGHT.
Created attachment 77508 [details] [review] More complete patch
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
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.
Thanks Cody! I've committed this to the HEAD, 2.10, and 2.8 branches.
Can we mark this as RESOLVED?
FIXED