Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


Hi,

Here are some patchs to fix this bug:
https://bugs.freedesktop.org/show_bug.cgi?id=36613

It was due to a cast between sal_Bool and sal_uInt16.

I attached different patchs, sorry, at first I wanted to separate the
tab thing and the rest of the patch, and then, I made a third patch to
fix the headers. I can merge them in a single one if you want.

There is still some issues, the button is a bit too light when it is
pressed (but there are the same problem without the patch).

Under MPL/GPL v3+. Module libs-gui (vcl).

Lucas Baudin
From 93f15a2691c6fc6b7588461c5a843bdcacaa8b36 Mon Sep 17 00:00:00 2001
From: Lucas Baudin <xapantu@gmail.com>
Date: Thu, 19 May 2011 21:37:14 +0200
Subject: [PATCH] Fix headers for the toolbox

---
 vcl/inc/vcl/toolbox.hxx       |    2 +-
 vcl/source/window/toolbox.cxx |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/vcl/inc/vcl/toolbox.hxx b/vcl/inc/vcl/toolbox.hxx
index 2daf42a..7065982 100644
--- a/vcl/inc/vcl/toolbox.hxx
+++ b/vcl/inc/vcl/toolbox.hxx
@@ -261,7 +261,7 @@ private:
     SAL_DLLPRIVATE void            ImplDrawSpin( sal_Bool bUpperIn, sal_Bool bLowerIn );
     SAL_DLLPRIVATE void            ImplDrawNext( sal_Bool bIn );
     SAL_DLLPRIVATE void            ImplDrawSeparator( sal_uInt16 nPos, Rectangle rRect );
-    SAL_DLLPRIVATE void            ImplDrawItem( sal_uInt16 nPos, sal_Bool bHighlight = sal_False, 
sal_Bool bPaint = sal_False, sal_Bool bLayout = sal_False );
+    SAL_DLLPRIVATE void            ImplDrawItem( sal_uInt16 nPos, sal_uInt16 bHighlight = 
sal_False, sal_Bool bPaint = sal_False, sal_Bool bLayout = sal_False );
     using Window::ImplInvalidate;
     SAL_DLLPRIVATE void            ImplInvalidate( sal_Bool bNewCalc = sal_False, sal_Bool 
bFullPaint = sal_False );
     SAL_DLLPRIVATE void            ImplUpdateItem( sal_uInt16 nIndex = 0xFFFF );
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index fc737c2..c9d92b5 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -3476,7 +3476,7 @@ static void ImplDrawButton( ToolBox* pThis, const Rectangle &rRect, 
sal_uInt16 h
         pThis->DrawSelectionBackground( rRect, bIsWindow ? 3 : highlight, bChecked, sal_True, 
bIsWindow, 2, NULL, NULL );
 }
 
-void ToolBox::ImplDrawItem( sal_uInt16 nPos, sal_Bool bHighlight, sal_Bool bPaint, sal_Bool 
bLayout )
+void ToolBox::ImplDrawItem( sal_uInt16 nPos, sal_uInt16 bHighlight, sal_Bool bPaint, sal_Bool 
bLayout )
 {
     DBG_CHKTHIS( Window, ImplDbgCheckWindow );
 
-- 
1.7.4.1

From 56222580c66d9b9edd12c2a4e23110f9d1277364 Mon Sep 17 00:00:00 2001
From: Lucas Baudin <xapantu@gmail.com>
Date: Thu, 19 May 2011 21:26:51 +0200
Subject: [PATCH] Fix a bug about presssed button state

---
 vcl/source/window/toolbox.cxx |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index 5e1e3a4..fc737c2 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -3494,7 +3494,8 @@ void ToolBox::ImplDrawItem( sal_uInt16 nPos, sal_Bool bHighlight, sal_Bool 
bPain
     MetricVector* pVector = bLayout ? &mpData->m_pLayoutData->m_aUnicodeBoundRects : NULL;
     String* pDisplayText = bLayout ? &mpData->m_pLayoutData->m_aDisplayText : NULL;
     
-    bHighlight = bHighlight && pItem->mbEnabled;
+    if(!pItem->mbEnabled)
+        bHighlight = 0;
 
     // Falls Rechteck ausserhalb des sichbaren Bereichs liegt
     if ( pItem->maRect.IsEmpty() )
-- 
1.7.4.1

From 5899374c3f1abf8741a22155944deee5383c59f9 Mon Sep 17 00:00:00 2001
From: Lucas Baudin <xapantu@gmail.com>
Date: Thu, 19 May 2011 21:22:28 +0200
Subject: [PATCH] Put tabs instead of space in toolbox.cxx

---
 vcl/source/window/toolbox.cxx |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index 0897047..5e1e3a4 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -569,7 +569,7 @@ void ToolBox::ImplDrawTransparentBackground( ToolBox* pThis, const Region &rRegi
 {
     // just invalidate to trigger paint of the parent
 
-    const bool         bOldPaintLock = pThis->mpData->mbIsPaintLocked;
+    const bool        bOldPaintLock = pThis->mpData->mbIsPaintLocked;
     pThis->mpData->mbIsPaintLocked = true;
 
     // send an invalidate to the first opaque parent and invalidate the whole hierarchy from there 
(noclipchildren)
@@ -1574,7 +1574,7 @@ void ToolBox::ImplInit( Window* pParent, WinBits nStyle )
     ImplGetWindowImpl()->mbToolBox         = sal_True;
     mpBtnDev          = NULL;
     mpFloatSizeAry    = NULL;
-    mpData                             = new ImplToolBoxPrivateData;
+    mpData                = new ImplToolBoxPrivateData;
     mpFloatWin        = NULL;
     mnDX              = 0;
     mnDY              = 0;
@@ -1593,7 +1593,7 @@ void ToolBox::ImplInit( Window* pParent, WinBits nStyle )
     mnCurItemId       = 0;
     mnDownItemId      = 0;
     mnCurPos          = TOOLBOX_ITEM_NOTFOUND;
-    mnFocusPos        = TOOLBOX_ITEM_NOTFOUND; // current position during keyboard access
+    mnFocusPos        = TOOLBOX_ITEM_NOTFOUND;    // current position during keyboard access
     mnLines           = 1;
     mnCurLine         = 1;
     mnCurLines        = 1;
@@ -1618,7 +1618,7 @@ void ToolBox::ImplInit( Window* pParent, WinBits nStyle )
     mbCustomizeMode   = sal_False;
     mbDragging        = sal_False;
     mbMenuStrings     = sal_False;
-    mbIsShift            = sal_False;
+    mbIsShift          = sal_False;
     mbIsKeyEvent = sal_False;
     mbChangingHighlight = sal_False;
     meButtonType      = BUTTON_SYMBOL;
@@ -1626,7 +1626,7 @@ void ToolBox::ImplInit( Window* pParent, WinBits nStyle )
     meLastStyle       = POINTER_ARROW;
     mnWinStyle        = nStyle;
     mnLastFocusItemId          = 0;
-    mnKeyModifier        = 0;
+    mnKeyModifier      = 0;
     mnActivateCount   = 0;
 
     maTimer.SetTimeout( 50 );
@@ -3462,7 +3462,7 @@ static void ImplDrawButton( ToolBox* pThis, const Rectangle &rRect, 
sal_uInt16 h
         ControlState        nState = 0;
 
         if ( highlight == 1 )   nState |= CTRL_STATE_PRESSED;
-        if ( highlight == 2 )  nState |= CTRL_STATE_ROLLOVER;
+        if ( highlight == 2 )     nState |= CTRL_STATE_ROLLOVER;
         if ( bEnabled )         nState |= CTRL_STATE_ENABLED;
 
         aControlValue.setTristateVal( bChecked ? BUTTONVALUE_ON : BUTTONVALUE_OFF );
@@ -5759,7 +5759,7 @@ void ToolBox::KeyInput( const KeyEvent& rKEvt )
         case KEY_UP:
         {
             // Ctrl-Cursor activates next toolbox, indicated by a blue arrow pointing to the 
left/up
-            if( aKeyCode.GetModifier() )       // allow only pure cursor keys
+            if( aKeyCode.GetModifier() )    // allow only pure cursor keys
                 break;
             if( !IsHorizontal() )
                 ImplChangeHighlightUpDn( sal_True );
@@ -5769,7 +5769,7 @@ void ToolBox::KeyInput( const KeyEvent& rKEvt )
         break;
         case KEY_LEFT:
         {
-            if( aKeyCode.GetModifier() )       // allow only pure cursor keys
+            if( aKeyCode.GetModifier() )    // allow only pure cursor keys
                 break;
             if( IsHorizontal() )
                 ImplChangeHighlightUpDn( sal_True );
@@ -5779,7 +5779,7 @@ void ToolBox::KeyInput( const KeyEvent& rKEvt )
         break;
         case KEY_DOWN:
         {
-            if( aKeyCode.GetModifier() )       // allow only pure cursor keys
+            if( aKeyCode.GetModifier() )    // allow only pure cursor keys
                 break;
             if( !IsHorizontal() )
                 ImplChangeHighlightUpDn( sal_False );
@@ -5789,7 +5789,7 @@ void ToolBox::KeyInput( const KeyEvent& rKEvt )
         break;
         case KEY_RIGHT:
         {
-            if( aKeyCode.GetModifier() )       // allow only pure cursor keys
+            if( aKeyCode.GetModifier() )    // allow only pure cursor keys
                 break;
             if( IsHorizontal() )
                 ImplChangeHighlightUpDn( sal_False );
-- 
1.7.4.1


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.