[ooo-build-commit] Branch 'ooo-build-3-1-1' - patches/dev300
Tor Lillqvist
tml at kemper.freedesktop.org
Tue Aug 18 05:23:48 PDT 2009
patches/dev300/apply | 7 +
patches/dev300/vcl-gtk-menubar-text-color.diff | 150 +++++++++++++++++++++++++
2 files changed, 157 insertions(+)
New commits:
commit 16495567422191caed85953ae16bdacdbf5046e8
Author: Tor Lillqvist <tml at iki.fi>
Date: Tue Aug 18 15:03:29 2009 +0300
Improve menubar theming support
* patches/dev300/vcl-gtk-menubar-text-color.diff: New patch.
Add a MenuBarTextColor property with setters and getters to the
style classes. Set that when sniffing the GTK+ theme. Use it when
drawing the menu bar text. (bnc#527356, i#103999)
Make menu separators look better in GTK+ themes like Sonar where
they should look darker than the dark, but not too dark, menu
background. (bnc#526004)
* patches/dev300/apply: Add above new patch to LinuxOnly.
diff --git a/patches/dev300/apply b/patches/dev300/apply
index fea5214..188f1b7 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -1337,6 +1337,13 @@ system-python-ure-bootstrap.diff, deb#501028, i#90701
pyuno-ooodir.diff, i#90701
system-python-uno-path.diff, i#97629
+# Fix two problems with some GTK+ themes:
+# - menu separators that should be almost black on a dark menu
+# background aren't,
+# - when menubar and men use opposite bg/fg colours, the menubar test
+# is invisible
+vcl-gtk-menubar-text-color.diff, n#526004, n#527356, i#103999, tml
+
[ DejaVuFonts ]
# Following the changed names of DejaVu fonts
diff --git a/patches/dev300/vcl-gtk-menubar-text-color.diff b/patches/dev300/vcl-gtk-menubar-text-color.diff
new file mode 100644
index 0000000..63f9342
--- /dev/null
+++ b/patches/dev300/vcl-gtk-menubar-text-color.diff
@@ -0,0 +1,150 @@
+--- vcl/inc/vcl/settings.hxx
++++ vcl/inc/vcl/settings.hxx
+@@ -375,6 +375,7 @@
+ Color maMenuHighlightColor;
+ Color maMenuHighlightTextColor;
+ Color maMenuTextColor;
++ Color maMenuBarTextColor;
+ Color maMonoColor;
+ Color maRadioCheckTextColor;
+ Color maShadowColor;
+@@ -685,6 +685,10 @@
+ { CopyData(); mpData->maMenuTextColor = rColor; }
+ const Color& GetMenuTextColor() const
+ { return mpData->maMenuTextColor; }
++ void SetMenuBarTextColor( const Color& rColor )
++ { CopyData(); mpData->maMenuBarTextColor = rColor; }
++ const Color& GetMenuBarTextColor() const
++ { return mpData->maMenuBarTextColor; }
+ void SetMenuHighlightColor( const Color& rColor )
+ { CopyData(); mpData->maMenuHighlightColor = rColor; }
+ const Color& GetMenuHighlightColor() const
+--- vcl/source/app/settings.cxx
++++ vcl/source/app/settings.cxx
+@@ -478,6 +478,7 @@
+ maMenuHighlightColor( rData.maMenuHighlightColor ),
+ maMenuHighlightTextColor( rData.maMenuHighlightTextColor ),
+ maMenuTextColor( rData.maMenuTextColor ),
++ maMenuBarTextColor( rData.maMenuBarTextColor ),
+ maMonoColor( rData.maMonoColor ),
+ maRadioCheckTextColor( rData.maRadioCheckTextColor ),
+ maShadowColor( rData.maShadowColor ),
+@@ -597,6 +597,7 @@
+ maMenuBarColor = Color( COL_LIGHTGRAY );
+ maMenuBorderColor = Color( COL_LIGHTGRAY );
+ maMenuTextColor = Color( COL_BLACK );
++ maMenuBarTextColor = Color( COL_BLACK );
+ maMenuHighlightColor = Color( COL_BLUE );
+ maMenuHighlightTextColor = Color( COL_WHITE );
+ maHighlightColor = Color( COL_BLUE );
+@@ -1037,6 +1037,7 @@
+ (mpData->maMenuBarColor == rSet.mpData->maMenuBarColor) &&
+ (mpData->maMenuBorderColor == rSet.mpData->maMenuBorderColor) &&
+ (mpData->maMenuTextColor == rSet.mpData->maMenuTextColor) &&
++ (mpData->maMenuBarTextColor == rSet.mpData->maMenuBarTextColor) &&
+ (mpData->maMenuHighlightColor == rSet.mpData->maMenuHighlightColor) &&
+ (mpData->maMenuHighlightTextColor == rSet.mpData->maMenuHighlightTextColor) &&
+ (mpData->maHighlightColor == rSet.mpData->maHighlightColor) &&
+--- vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
++++ vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
+@@ -3291,11 +3291,37 @@
+ aStyleSet.SetMenuBarColor( aBackColor );
+ aBackColor = getColor( pMenuStyle->bg[GTK_STATE_NORMAL] );
+ aTextColor = getColor( pMenuTextStyle->fg[GTK_STATE_NORMAL] );
+- if( aBackColor == aTextColor )
+- aTextColor = (aBackColor.GetLuminance() < 128) ? Color( COL_WHITE ) : Color( COL_BLACK );
+ aStyleSet.SetMenuColor( aBackColor );
+ aStyleSet.SetMenuTextColor( aTextColor );
++
++ aTextColor = getColor( pMenubarStyle->fg[GTK_STATE_NORMAL] );
++ aStyleSet.SetMenuBarTextColor( aTextColor );
++
++#if OSL_DEBUG_LEVEL > 1
++ std::fprintf( stderr, "==\n" );
++ std::fprintf( stderr, "MenuColor = %x (%d)\n", aStyleSet.GetMenuColor().GetColor(), aStyleSet.GetMenuColor().GetLuminance() );
++ std::fprintf( stderr, "MenuTextColor = %x (%d)\n", aStyleSet.GetMenuTextColor().GetColor(), aStyleSet.GetMenuTextColor().GetLuminance() );
++ std::fprintf( stderr, "MenuBarColor = %x (%d)\n", aStyleSet.GetMenuBarColor().GetColor(), aStyleSet.GetMenuBarColor().GetLuminance() );
++ std::fprintf( stderr, "MenuBarTextColor = %x (%d)\n", aStyleSet.GetMenuBarTextColor().GetColor(), aStyleSet.GetMenuBarTextColor().GetLuminance() );
++ std::fprintf( stderr, "LightColor = %x (%d)\n", aStyleSet.GetLightColor().GetColor(), aStyleSet.GetLightColor().GetLuminance() );
++ std::fprintf( stderr, "ShadowColor = %x (%d)\n", aStyleSet.GetShadowColor().GetColor(), aStyleSet.GetShadowColor().GetLuminance() );
++#endif
++
++ // Awful hack for menu separators in the Sonar and similar themes.
++ // If the menu color is not too dark, and the menu text color is lighter,
++ // make the "light" color lighter than the menu color and the "shadow"
++ // color darker than it.
++ if ( aStyleSet.GetMenuColor().GetLuminance() >= 32 &&
++ aStyleSet.GetMenuColor().GetLuminance() <= aStyleSet.GetMenuTextColor().GetLuminance() )
++ {
++ Color temp = aStyleSet.GetMenuColor();
++ temp.IncreaseLuminance( 8 );
++ aStyleSet.SetLightColor( temp );
++ temp = aStyleSet.GetMenuColor();
++ temp.DecreaseLuminance( 16 );
++ aStyleSet.SetShadowColor( temp );
++ }
+
+ aHighlightColor = getColor( pMenuItemStyle->bg[ GTK_STATE_SELECTED ] );
+ aHighlightTextColor = getColor( pMenuTextStyle->fg[ GTK_STATE_PRELIGHT ] );
+ if( aHighlightColor == aHighlightTextColor )
+--- vcl/unx/kde/salnativewidgets-kde.cxx
++++ vcl/unx/kde/salnativewidgets-kde.cxx
+@@ -1996,6 +1996,7 @@
+ }
+
+ aStyleSettings.SetMenuTextColor( aMenuFore );
++ aStyleSettings.SetMenuBarTextColor( aMenuFore );
+ aStyleSettings.SetMenuColor( aMenuBack );
+ aStyleSettings.SetMenuBarColor( aMenuBack );
+
+--- vcl/aqua/source/window/salframe.cxx
++++ vcl/aqua/source/window/salframe.cxx
+@@ -1165,6 +1165,7 @@
+ Color aMenuTextColor( getColor( [NSColor textColor],
+ aStyleSettings.GetMenuTextColor(), mpWindow ) );
+ aStyleSettings.SetMenuTextColor( aMenuTextColor );
++ aStyleSettings.SetMenuBarTextColor( aMenuTextColor );
+
+ aStyleSettings.SetCursorBlinkTime( 500 );
+
+--- vcl/win/source/window/salframe.cxx
++++ vcl/win/source/window/salframe.cxx
+@@ -2940,6 +2940,7 @@
+ aStyleSettings.SetUseFlatBorders( FALSE );
+ aStyleSettings.SetUseFlatMenues( FALSE );
+ aStyleSettings.SetMenuTextColor( ImplWinColorToSal( GetSysColor( COLOR_MENUTEXT ) ) );
++ aStyleSettings.SetMenuBarTextColor( ImplWinColorToSal( GetSysColor( COLOR_MENUTEXT ) ) );
+ aStyleSettings.SetActiveColor( ImplWinColorToSal( GetSysColor( COLOR_ACTIVECAPTION ) ) );
+ aStyleSettings.SetActiveTextColor( ImplWinColorToSal( GetSysColor( COLOR_CAPTIONTEXT ) ) );
+ aStyleSettings.SetDeactiveColor( ImplWinColorToSal( GetSysColor( COLOR_INACTIVECAPTION ) ) );
+--- vcl/source/window/menu.cxx
++++ vcl/source/window/menu.cxx
+@@ -2684,8 +2684,15 @@
+ // }
+ }
+
+ if ( pThisItemOnly && bHighlighted )
++ {
++ // This restores the normal menu or menu bar text
++ // color for when it is no longer highlighted.
+- pWin->SetTextColor( rSettings.GetMenuTextColor() );
++ if ( bIsMenuBar )
++ pWin->SetTextColor( rSettings.GetMenuBarTextColor() );
++ else
++ pWin->SetTextColor( rSettings.GetMenuTextColor() );
++ }
+ }
+ if( bLayout )
+ {
+@@ -3742,7 +3742,10 @@
+ pWin->SetBackground( Wallpaper( rStyleSettings.GetMenuColor() ) );
+ }
+
+- pWin->SetTextColor( rStyleSettings.GetMenuTextColor() );
++ if ( bMenuBar )
++ pWin->SetTextColor( rStyleSettings.GetMenuBarTextColor() );
++ else
++ pWin->SetTextColor( rStyleSettings.GetMenuTextColor() );
+ pWin->SetTextFillColor();
+ pWin->SetLineColor();
+ }
More information about the ooo-build-commit
mailing list