parent
5dbabe5909
commit
0cc4549fa0
@ -0,0 +1,258 @@
|
|||||||
|
From 2efa35a812a6f1e35e4959a357f50feff7e598f5 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
|
||||||
|
Date: Tue, 6 Nov 2012 23:21:06 +0000
|
||||||
|
Subject: [PATCH] Resolves: fdo#56198 collect scrollbar click preference
|
||||||
|
settings
|
||||||
|
|
||||||
|
for gtk and merge with aqua equivalent so as to alternate "jump to here"
|
||||||
|
behavior for primary button vs primary means scroll by single page. Secondary
|
||||||
|
button takes the alternative behaviour
|
||||||
|
|
||||||
|
Change-Id: I0a96f3131f41ec87052da39cbe96bfd895ca53f6
|
||||||
|
---
|
||||||
|
vcl/aqua/source/window/salframe.cxx | 6 +++---
|
||||||
|
vcl/inc/svdata.hxx | 1 -
|
||||||
|
vcl/inc/vcl/settings.hxx | 17 ++++++++++++-----
|
||||||
|
vcl/source/app/settings.cxx | 15 +++++++++------
|
||||||
|
vcl/source/control/scrbar.cxx | 24 ++++++++++++++++--------
|
||||||
|
vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx | 10 +++++++---
|
||||||
|
vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx | 10 +++++++---
|
||||||
|
7 files changed, 54 insertions(+), 29 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/vcl/aqua/source/window/salframe.cxx b/vcl/aqua/source/window/salframe.cxx
|
||||||
|
index 924210d..cf7c048 100644
|
||||||
|
--- a/vcl/aqua/source/window/salframe.cxx
|
||||||
|
+++ b/vcl/aqua/source/window/salframe.cxx
|
||||||
|
@@ -1146,7 +1146,7 @@ rtl::OUString AquaSalFrame::GetKeyName( sal_uInt16 nKeyCode )
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------
|
||||||
|
|
||||||
|
-static void getAppleScrollBarVariant(void)
|
||||||
|
+static void getAppleScrollBarVariant(StyleSettings &rSettings)
|
||||||
|
{
|
||||||
|
bool bIsScrollbarDoubleMax = true; // default is DoubleMax
|
||||||
|
|
||||||
|
@@ -1183,7 +1183,7 @@ static void getAppleScrollBarVariant(void)
|
||||||
|
if( jumpStr )
|
||||||
|
{
|
||||||
|
if( CFGetTypeID( jumpStr ) == CFBooleanGetTypeID() )
|
||||||
|
- ImplGetSVData()->maNWFData.mbScrollbarJumpPage = (jumpStr == kCFBooleanTrue);
|
||||||
|
+ rSettings.SetPrimaryButtonWarpsSlider(jumpStr == kCFBooleanTrue);
|
||||||
|
CFRelease( jumpStr );
|
||||||
|
}
|
||||||
|
CFRelease( jumpScroll );
|
||||||
|
@@ -1324,7 +1324,7 @@ void AquaSalFrame::UpdateSettings( AllSettings& rSettings )
|
||||||
|
// no mnemonics on aqua
|
||||||
|
aStyleSettings.SetOptions( aStyleSettings.GetOptions() | STYLE_OPTION_NOMNEMONICS );
|
||||||
|
|
||||||
|
- getAppleScrollBarVariant();
|
||||||
|
+ getAppleScrollBarVariant(aStyleSettings);
|
||||||
|
|
||||||
|
// set scrollbar size
|
||||||
|
aStyleSettings.SetScrollBarSize( static_cast<long int>([NSScroller scrollerWidth]) );
|
||||||
|
diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx
|
||||||
|
index af547e9..974a67f 100644
|
||||||
|
--- a/vcl/inc/svdata.hxx
|
||||||
|
+++ b/vcl/inc/svdata.hxx
|
||||||
|
@@ -294,7 +294,6 @@ struct ImplSVNWFData
|
||||||
|
bool mbCheckBoxNeedsErase:1; // set true for platforms that should draw the
|
||||||
|
// window background before drawing the native
|
||||||
|
// checkbox
|
||||||
|
- bool mbScrollbarJumpPage:1; // true for "jump to here" behavior
|
||||||
|
bool mbCanDrawWidgetAnySize:1; // set to true currently on gtk
|
||||||
|
};
|
||||||
|
|
||||||
|
diff --git a/vcl/inc/vcl/settings.hxx b/vcl/inc/vcl/settings.hxx
|
||||||
|
index 9a0a856..1052b49 100644
|
||||||
|
--- a/vcl/inc/vcl/settings.hxx
|
||||||
|
+++ b/vcl/inc/vcl/settings.hxx
|
||||||
|
@@ -348,7 +348,10 @@ private:
|
||||||
|
sal_uLong mnPreferredSymbolsStyle;
|
||||||
|
sal_uInt16 mnSkipDisabledInMenus;
|
||||||
|
sal_Bool mbHideDisabledMenuItems;
|
||||||
|
- sal_Bool mnAcceleratorsInContextMenus;
|
||||||
|
+ sal_Bool mbAcceleratorsInContextMenus;
|
||||||
|
+ //mbPrimaryButtonWarpsSlider == true for "jump to here" behavior for primary button, otherwise
|
||||||
|
+ //primary means scroll by single page. Secondary button takes the alternative behaviour
|
||||||
|
+ sal_Bool mbPrimaryButtonWarpsSlider;
|
||||||
|
Wallpaper maWorkspaceGradient;
|
||||||
|
DialogStyle maDialogStyle;
|
||||||
|
FrameStyle maFrameStyle;
|
||||||
|
@@ -649,10 +652,14 @@ public:
|
||||||
|
{ CopyData(); mpData->mbHideDisabledMenuItems = bHideDisabledMenuItems; }
|
||||||
|
sal_Bool GetHideDisabledMenuItems() const
|
||||||
|
{ return mpData->mbHideDisabledMenuItems; }
|
||||||
|
- void SetAcceleratorsInContextMenus( sal_Bool bAcceleratorsInContextMenus )
|
||||||
|
- { CopyData(); mpData->mnAcceleratorsInContextMenus = bAcceleratorsInContextMenus; }
|
||||||
|
- sal_Bool GetAcceleratorsInContextMenus() const
|
||||||
|
- { return mpData->mnAcceleratorsInContextMenus; }
|
||||||
|
+ void SetAcceleratorsInContextMenus( sal_Bool bAcceleratorsInContextMenus )
|
||||||
|
+ { CopyData(); mpData->mbAcceleratorsInContextMenus = bAcceleratorsInContextMenus; }
|
||||||
|
+ sal_Bool GetAcceleratorsInContextMenus() const
|
||||||
|
+ { return mpData->mbAcceleratorsInContextMenus; }
|
||||||
|
+ void SetPrimaryButtonWarpsSlider( sal_Bool bPrimaryButtonWarpsSlider )
|
||||||
|
+ { CopyData(); mpData->mbPrimaryButtonWarpsSlider = bPrimaryButtonWarpsSlider; }
|
||||||
|
+ sal_Bool GetPrimaryButtonWarpsSlider() const
|
||||||
|
+ { return mpData->mbPrimaryButtonWarpsSlider; }
|
||||||
|
|
||||||
|
void SetCairoFontOptions( const void *pOptions )
|
||||||
|
{ CopyData(); mpData->mpFontOptions = pOptions; }
|
||||||
|
diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx
|
||||||
|
index 273e118..a2acdad 100644
|
||||||
|
--- a/vcl/source/app/settings.cxx
|
||||||
|
+++ b/vcl/source/app/settings.cxx
|
||||||
|
@@ -337,11 +337,12 @@ ImplStyleData::ImplStyleData( const ImplStyleData& rData ) :
|
||||||
|
mnUseImagesInMenus = rData.mnUseImagesInMenus;
|
||||||
|
mbPreferredUseImagesInMenus = rData.mbPreferredUseImagesInMenus;
|
||||||
|
mnSkipDisabledInMenus = rData.mnSkipDisabledInMenus;
|
||||||
|
- mbHideDisabledMenuItems = rData.mbHideDisabledMenuItems;
|
||||||
|
- mnAcceleratorsInContextMenus = rData.mnAcceleratorsInContextMenus;
|
||||||
|
+ mbHideDisabledMenuItems = rData.mbHideDisabledMenuItems;
|
||||||
|
+ mbAcceleratorsInContextMenus = rData.mbAcceleratorsInContextMenus;
|
||||||
|
+ mbPrimaryButtonWarpsSlider = rData.mbPrimaryButtonWarpsSlider;
|
||||||
|
mnToolbarIconSize = rData.mnToolbarIconSize;
|
||||||
|
mnSymbolsStyle = rData.mnSymbolsStyle;
|
||||||
|
- mnPreferredSymbolsStyle = rData.mnPreferredSymbolsStyle;
|
||||||
|
+ mnPreferredSymbolsStyle = rData.mnPreferredSymbolsStyle;
|
||||||
|
mpFontOptions = rData.mpFontOptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -425,10 +426,11 @@ void ImplStyleData::SetStandardStyles()
|
||||||
|
mnUseSystemUIFonts = 1;
|
||||||
|
mnUseFlatBorders = 0;
|
||||||
|
mnUseFlatMenues = 0;
|
||||||
|
- mbPreferredUseImagesInMenus = sal_True;
|
||||||
|
+ mbPreferredUseImagesInMenus = sal_True;
|
||||||
|
mnSkipDisabledInMenus = (sal_uInt16)sal_False;
|
||||||
|
mbHideDisabledMenuItems = sal_False;
|
||||||
|
- mnAcceleratorsInContextMenus = sal_True;
|
||||||
|
+ mbAcceleratorsInContextMenus = sal_True;
|
||||||
|
+ mbPrimaryButtonWarpsSlider = sal_False;
|
||||||
|
|
||||||
|
Gradient aGrad( GradientStyle_LINEAR, DEFAULT_WORKSPACE_GRADIENT_START_COLOR, DEFAULT_WORKSPACE_GRADIENT_END_COLOR );
|
||||||
|
maWorkspaceGradient = Wallpaper( aGrad );
|
||||||
|
@@ -852,7 +854,8 @@ sal_Bool StyleSettings::operator ==( const StyleSettings& rSet ) const
|
||||||
|
(mpData->mbPreferredUseImagesInMenus == rSet.mpData->mbPreferredUseImagesInMenus) &&
|
||||||
|
(mpData->mnSkipDisabledInMenus == rSet.mpData->mnSkipDisabledInMenus) &&
|
||||||
|
(mpData->mbHideDisabledMenuItems == rSet.mpData->mbHideDisabledMenuItems) &&
|
||||||
|
- (mpData->mnAcceleratorsInContextMenus == rSet.mpData->mnAcceleratorsInContextMenus) &&
|
||||||
|
+ (mpData->mbAcceleratorsInContextMenus == rSet.mpData->mbAcceleratorsInContextMenus)&&
|
||||||
|
+ (mpData->mbPrimaryButtonWarpsSlider == rSet.mpData->mbPrimaryButtonWarpsSlider) &&
|
||||||
|
(mpData->maFontColor == rSet.mpData->maFontColor ))
|
||||||
|
return sal_True;
|
||||||
|
else
|
||||||
|
diff --git a/vcl/source/control/scrbar.cxx b/vcl/source/control/scrbar.cxx
|
||||||
|
index dad66f6..9e90362 100644
|
||||||
|
--- a/vcl/source/control/scrbar.cxx
|
||||||
|
+++ b/vcl/source/control/scrbar.cxx
|
||||||
|
@@ -946,7 +946,12 @@ void ScrollBar::ImplDragThumb( const Point& rMousePos )
|
||||||
|
|
||||||
|
void ScrollBar::MouseButtonDown( const MouseEvent& rMEvt )
|
||||||
|
{
|
||||||
|
- if ( rMEvt.IsLeft() || rMEvt.IsMiddle() )
|
||||||
|
+ bool bPrimaryWarps = GetSettings().GetStyleSettings().GetPrimaryButtonWarpsSlider();
|
||||||
|
+ bool bWarp = bPrimaryWarps ? rMEvt.IsLeft() : rMEvt.IsMiddle();
|
||||||
|
+ bool bPrimaryWarping = bWarp && rMEvt.IsLeft();
|
||||||
|
+ bool bPage = bPrimaryWarps ? rMEvt.IsRight() : rMEvt.IsLeft();
|
||||||
|
+
|
||||||
|
+ if (rMEvt.IsLeft() || rMEvt.IsMiddle() || rMEvt.IsRight())
|
||||||
|
{
|
||||||
|
const Point& rMousePos = rMEvt.GetPosPixel();
|
||||||
|
sal_uInt16 nTrackFlags = 0;
|
||||||
|
@@ -962,7 +967,7 @@ void ScrollBar::MouseButtonDown( const MouseEvent& rMEvt )
|
||||||
|
bIsInside:
|
||||||
|
maBtn1Rect.IsInside( rMousePos ) )
|
||||||
|
{
|
||||||
|
- if ( !(mnStateFlags & SCRBAR_STATE_BTN1_DISABLE) )
|
||||||
|
+ if (rMEvt.IsLeft() && !(mnStateFlags & SCRBAR_STATE_BTN1_DISABLE) )
|
||||||
|
{
|
||||||
|
nTrackFlags = STARTTRACK_BUTTONREPEAT;
|
||||||
|
meScrollType = SCROLL_LINEUP;
|
||||||
|
@@ -974,7 +979,7 @@ void ScrollBar::MouseButtonDown( const MouseEvent& rMEvt )
|
||||||
|
bIsInside:
|
||||||
|
maBtn2Rect.IsInside( rMousePos ) )
|
||||||
|
{
|
||||||
|
- if ( !(mnStateFlags & SCRBAR_STATE_BTN2_DISABLE) )
|
||||||
|
+ if (rMEvt.IsLeft() && !(mnStateFlags & SCRBAR_STATE_BTN2_DISABLE) )
|
||||||
|
{
|
||||||
|
nTrackFlags = STARTTRACK_BUTTONREPEAT;
|
||||||
|
meScrollType = SCROLL_LINEDOWN;
|
||||||
|
@@ -986,7 +991,10 @@ void ScrollBar::MouseButtonDown( const MouseEvent& rMEvt )
|
||||||
|
bool bThumbHit = HitTestNativeControl( CTRL_SCROLLBAR, bHorizontal? PART_THUMB_HORZ : PART_THUMB_VERT,
|
||||||
|
maThumbRect, rMousePos, bIsInside )
|
||||||
|
? bIsInside : maThumbRect.IsInside( rMousePos );
|
||||||
|
- bool bDragHandling = rMEvt.IsMiddle() || bThumbHit || ImplGetSVData()->maNWFData.mbScrollbarJumpPage;
|
||||||
|
+
|
||||||
|
+ bool bThumbAction = bWarp || bPage;
|
||||||
|
+
|
||||||
|
+ bool bDragHandling = bWarp || (bThumbHit && bThumbAction);
|
||||||
|
if( bDragHandling )
|
||||||
|
{
|
||||||
|
if( mpData )
|
||||||
|
@@ -1003,7 +1011,7 @@ void ScrollBar::MouseButtonDown( const MouseEvent& rMEvt )
|
||||||
|
mnDragDraw = SCRBAR_DRAW_THUMB;
|
||||||
|
|
||||||
|
// calculate mouse offset
|
||||||
|
- if( rMEvt.IsMiddle() || (ImplGetSVData()->maNWFData.mbScrollbarJumpPage && !bThumbHit) )
|
||||||
|
+ if (bWarp && (!bThumbHit || !bPrimaryWarping))
|
||||||
|
{
|
||||||
|
bDragToMouse = sal_True;
|
||||||
|
if ( GetStyle() & WB_HORZ )
|
||||||
|
@@ -1023,9 +1031,9 @@ void ScrollBar::MouseButtonDown( const MouseEvent& rMEvt )
|
||||||
|
ImplDraw( mnDragDraw, this );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
- else if( HitTestNativeControl( CTRL_SCROLLBAR, bHorizontal? PART_TRACK_HORZ_AREA : PART_TRACK_VERT_AREA,
|
||||||
|
- aControlRegion, rMousePos, bIsInside )?
|
||||||
|
- bIsInside : sal_True )
|
||||||
|
+ else if(bPage && (HitTestNativeControl( CTRL_SCROLLBAR, bHorizontal? PART_TRACK_HORZ_AREA : PART_TRACK_VERT_AREA,
|
||||||
|
+ aControlRegion, rMousePos, bIsInside ) ?
|
||||||
|
+ bIsInside : sal_True) )
|
||||||
|
{
|
||||||
|
nTrackFlags = STARTTRACK_BUTTONREPEAT;
|
||||||
|
|
||||||
|
diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
|
||||||
|
index 65df181..1451476 100644
|
||||||
|
--- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
|
||||||
|
+++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
|
||||||
|
@@ -3987,9 +3987,13 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
|
||||||
|
aMouseSettings.SetMenuDelay( iMenuPopupDelay );
|
||||||
|
rSettings.SetMouseSettings( aMouseSettings );
|
||||||
|
|
||||||
|
- gboolean showmenuicons = true;
|
||||||
|
- g_object_get( pSettings, "gtk-menu-images", &showmenuicons, (char *)NULL );
|
||||||
|
- aStyleSet.SetPreferredUseImagesInMenus( showmenuicons );
|
||||||
|
+ gboolean showmenuicons = true, primarybuttonwarps = false;
|
||||||
|
+ g_object_get( pSettings,
|
||||||
|
+ "gtk-menu-images", &showmenuicons,
|
||||||
|
+ "gtk-primary-button-warps-slider", &primarybuttonwarps,
|
||||||
|
+ (char *)NULL );
|
||||||
|
+ aStyleSet.SetPreferredUseImagesInMenus(showmenuicons);
|
||||||
|
+ aStyleSet.SetPrimaryButtonWarpsSlider(primarybuttonwarps);
|
||||||
|
|
||||||
|
// set scrollbar settings
|
||||||
|
gint slider_width = 14;
|
||||||
|
diff --git a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
|
||||||
|
index 0774699f..1037d9d 100644
|
||||||
|
--- a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
|
||||||
|
+++ b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
|
||||||
|
@@ -1376,9 +1376,13 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
|
||||||
|
aMouseSettings.SetMenuDelay( iMenuPopupDelay );
|
||||||
|
rSettings.SetMouseSettings( aMouseSettings );
|
||||||
|
|
||||||
|
- gboolean showmenuicons = true;
|
||||||
|
- g_object_get( pSettings, "gtk-menu-images", &showmenuicons, (char *)NULL );
|
||||||
|
- aStyleSet.SetPreferredUseImagesInMenus( showmenuicons );
|
||||||
|
+ gboolean showmenuicons = true, primarybuttonwarps = false;
|
||||||
|
+ g_object_get( pSettings,
|
||||||
|
+ "gtk-menu-images", &showmenuicons,
|
||||||
|
+ "gtk-primary-button-warps-slider", &primarybuttonwarps,
|
||||||
|
+ (char *)NULL );
|
||||||
|
+ aStyleSet.SetPreferredUseImagesInMenus(showmenuicons);
|
||||||
|
+ aStyleSet.SetPrimaryButtonWarpsSlider(primarybuttonwarps);
|
||||||
|
|
||||||
|
// set scrollbar settings
|
||||||
|
gint slider_width = 14;
|
||||||
|
--
|
||||||
|
1.7.11.7
|
||||||
|
|
Loading…
Reference in new issue