[haiku-commits] haiku: hrev45802 - in src: apps/debugger/user_interface/gui/team_window kits/interface

  • From: anevilyak@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 29 Jun 2013 17:56:28 +0200 (CEST)

hrev45802 adds 3 changesets to branch 'master'
old head: 6a453d274eed793c988213336381d27001ad0e7e
new head: 16e486eb4dd2d39b9a3eb65171106fd17d7e3fc0
overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=16e486e+%5E6a453d2

----------------------------------------------------------------------------

97a8395: Reduce drawing flicker in SourceView.
  
  Instead of relying on the app_server to handle the background color, do so
  ourselves. This allows somewhat more granular control, and helps reduce
  flicker on drawing when single stepping.

fcf72bc: Reduce flicker in StackTrace display when single stepping.
  
  When asked to clear the current stack trace, delay actually doing so
  by .25 seconds. If the stack trace is set to a new one in the meantime,
  the operation is aborted so we don't reset the trace twice.
  
  Thanks Ingo for the suggestion.

16e486e: BTabView: minor optimization.
  
  Short circuit if asked to select the same index that's currently visible, to
  avoid unnecessary invalidation/flicker.
  
  Should fix last part of #9841.

                                      [ Rene Gollent <anevilyak@xxxxxxxxx> ]

----------------------------------------------------------------------------

4 files changed, 87 insertions(+), 19 deletions(-)
.../gui/team_window/SourceView.cpp               | 17 +++--
.../gui/team_window/StackTraceView.cpp           | 75 +++++++++++++++++---
.../gui/team_window/StackTraceView.h             |  6 ++
src/kits/interface/TabView.cpp                   |  8 ++-

############################################################################

Commit:      97a83952a141b23800267ad942b2cd04a7933b04
URL:         http://cgit.haiku-os.org/haiku/commit/?id=97a8395
Author:      Rene Gollent <anevilyak@xxxxxxxxx>
Date:        Sat Jun 29 15:45:57 2013 UTC

Reduce drawing flicker in SourceView.

Instead of relying on the app_server to handle the background color, do so
ourselves. This allows somewhat more granular control, and helps reduce
flicker on drawing when single stepping.

----------------------------------------------------------------------------

diff --git a/src/apps/debugger/user_interface/gui/team_window/SourceView.cpp 
b/src/apps/debugger/user_interface/gui/team_window/SourceView.cpp
index 3e3a4f9..958edb3 100644
--- a/src/apps/debugger/user_interface/gui/team_window/SourceView.cpp
+++ b/src/apps/debugger/user_interface/gui/team_window/SourceView.cpp
@@ -1045,7 +1045,7 @@ SourceView::TextView::TextView(SourceView* sourceView, 
MarkerManager* manager,
        fScrollRunner(NULL),
        fMarkerManager(manager)
 {
-       SetViewColor(ui_color(B_DOCUMENT_BACKGROUND_COLOR));
+       SetViewColor(B_TRANSPARENT_COLOR);
        fTextColor = ui_color(B_DOCUMENT_TEXT_COLOR);
        SetFlags(Flags() | B_NAVIGABLE);
 }
@@ -1085,8 +1085,11 @@ SourceView::TextView::MaxSize()
 void
 SourceView::TextView::Draw(BRect updateRect)
 {
-       if (fSourceCode == NULL)
+       if (fSourceCode == NULL) {
+               SetLowColor(ui_color(B_DOCUMENT_BACKGROUND_COLOR));
+               FillRect(updateRect, B_SOLID_LOW);
                return;
+       }
 
        // get the lines intersecting with the update rect
        int32 minLine, maxLine;
@@ -1101,11 +1104,13 @@ SourceView::TextView::Draw(BRect updateRect)
        SourceView::MarkerManager::InstructionPointerMarker* ipMarker;
        int32 markerIndex = 0;
        for (int32 i = minLine; i <= maxLine; i++) {
-               SetLowColor(ViewColor());
+               SetLowColor(ui_color(B_DOCUMENT_BACKGROUND_COLOR));
                float y = i * fFontInfo->lineHeight;
                BString lineString;
                _FormatLine(fSourceCode->LineAt(i), lineString);
 
+               FillRect(BRect(0.0, y, kLeftTextMargin, y + 
fFontInfo->lineHeight),
+                       B_SOLID_LOW);
                for (int32 j = markerIndex; j < markers.CountItems(); j++) {
                        marker = markers.ItemAt(j);
                         if (marker->Line() < (uint32)i) {
@@ -1123,13 +1128,13 @@ SourceView::TextView::Draw(BRect updateRect)
 
                                } else
                                        SetLowColor(255, 255, 0, 255);
-                               FillRect(BRect(kLeftTextMargin, y, 
Bounds().right,
-                                       y + fFontInfo->lineHeight), 
B_SOLID_LOW);
                                break;
                         } else
                                break;
                }
 
+               FillRect(BRect(kLeftTextMargin, y, Bounds().right,
+                       y + fFontInfo->lineHeight), B_SOLID_LOW);
                DrawString(lineString,
                        BPoint(kLeftTextMargin, y + 
fFontInfo->fontHeight.ascent));
        }
@@ -2053,13 +2058,13 @@ SourceView::SetStackTrace(StackTrace* stackTrace, 
Thread* activeThread)
 
        fMarkerManager->SetStackTrace(fStackTrace);
        fMarkerView->SetStackTrace(fStackTrace);
-       fTextView->Invalidate();
 }
 
 
 void
 SourceView::SetStackFrame(StackFrame* stackFrame)
 {
+       TRACE_GUI("SourceView::SetStackFrame(%p)\n", stackFrame);
        if (stackFrame == fStackFrame)
                return;
 

############################################################################

Commit:      fcf72bc4b4ceedb7bcacd25942ce273213969718
URL:         http://cgit.haiku-os.org/haiku/commit/?id=fcf72bc
Author:      Rene Gollent <anevilyak@xxxxxxxxx>
Date:        Sat Jun 29 15:47:46 2013 UTC

Reduce flicker in StackTrace display when single stepping.

When asked to clear the current stack trace, delay actually doing so
by .25 seconds. If the stack trace is set to a new one in the meantime,
the operation is aborted so we don't reset the trace twice.

Thanks Ingo for the suggestion.

----------------------------------------------------------------------------

diff --git 
a/src/apps/debugger/user_interface/gui/team_window/StackTraceView.cpp 
b/src/apps/debugger/user_interface/gui/team_window/StackTraceView.cpp
index c36ac9b..5850f87 100644
--- a/src/apps/debugger/user_interface/gui/team_window/StackTraceView.cpp
+++ b/src/apps/debugger/user_interface/gui/team_window/StackTraceView.cpp
@@ -1,6 +1,6 @@
 /*
  * Copyright 2009-2012, Ingo Weinhold, ingo_weinhold@xxxxxx.
- * Copyright 2011, Rene Gollent, rene@xxxxxxxxxxx.
+ * Copyright 2011-2013, Rene Gollent, rene@xxxxxxxxxxx.
  * Distributed under the terms of the MIT License.
  */
 
@@ -12,6 +12,8 @@
 #include <new>
 
 #include <ControlLook.h>
+#include <MessageRunner.h>
+#include <Window.h>
 
 #include "table/TableColumns.h"
 
@@ -23,6 +25,11 @@
 #include "UiUtils.h"
 
 
+enum {
+       MSG_CLEAR_STACK_TRACE   = 'clst'
+};
+
+
 // #pragma mark - FramesTableModel
 
 
@@ -107,6 +114,7 @@ StackTraceView::StackTraceView(Listener* listener)
        fStackTrace(NULL),
        fFramesTable(NULL),
        fFramesTableModel(NULL),
+       fTraceUpdateRunner(NULL),
        fListener(listener)
 {
        SetName("Stack Trace");
@@ -149,16 +157,23 @@ StackTraceView::SetStackTrace(StackTrace* stackTrace)
 {
        if (stackTrace == fStackTrace)
                return;
-
-       if (fStackTrace != NULL)
-               fStackTrace->ReleaseReference();
-
-       fStackTrace = stackTrace;
-
-       if (fStackTrace != NULL)
-               fStackTrace->AcquireReference();
-
-       fFramesTableModel->SetStackTrace(fStackTrace);
+       else if (stackTrace == NULL) {
+               if (fTraceUpdateRunner == NULL) {
+                       BMessage message(MSG_CLEAR_STACK_TRACE);
+                       message.AddPointer("currentTrace", fStackTrace);
+                       fTraceUpdateRunner = new(std::nothrow) 
BMessageRunner(this,
+                               message, 250000, 1);
+                       if (fTraceUpdateRunner != NULL
+                               && fTraceUpdateRunner->InitCheck() != B_OK) {
+                               delete fTraceUpdateRunner;
+                               fTraceUpdateRunner = NULL;
+                       }
+               }
+       } else {
+               delete fTraceUpdateRunner;
+               fTraceUpdateRunner = NULL;
+               _SetStackTrace(stackTrace);
+       }
 }
 
 
@@ -205,6 +220,29 @@ StackTraceView::SaveSettings(BMessage& settings)
 
 
 void
+StackTraceView::MessageReceived(BMessage* message)
+{
+       switch (message->what) {
+               case MSG_CLEAR_STACK_TRACE:
+               {
+                       StackTrace* currentStackTrace;
+                       if (message->FindPointer("currentTrace",
+                                       
reinterpret_cast<void**>(&currentStackTrace))
+                                       == B_OK && currentStackTrace == 
fStackTrace) {
+                               _SetStackTrace(NULL);
+                       }
+                       break;
+               }
+               default:
+               {
+                       BGroupView::MessageReceived(message);
+                       break;
+               }
+       }
+}
+
+
+void
 StackTraceView::TableSelectionChanged(Table* table)
 {
        if (fListener == NULL)
@@ -243,6 +281,21 @@ StackTraceView::_Init()
 }
 
 
+void
+StackTraceView::_SetStackTrace(StackTrace* stackTrace)
+{
+       if (fStackTrace != NULL)
+               fStackTrace->ReleaseReference();
+
+       fStackTrace = stackTrace;
+
+       if (fStackTrace != NULL)
+               fStackTrace->AcquireReference();
+
+       fFramesTableModel->SetStackTrace(fStackTrace);
+}
+
+
 // #pragma mark - Listener
 
 
diff --git a/src/apps/debugger/user_interface/gui/team_window/StackTraceView.h 
b/src/apps/debugger/user_interface/gui/team_window/StackTraceView.h
index 5ce2fbe..87e8a28 100644
--- a/src/apps/debugger/user_interface/gui/team_window/StackTraceView.h
+++ b/src/apps/debugger/user_interface/gui/team_window/StackTraceView.h
@@ -11,6 +11,7 @@
 #include "Team.h"
 
 
+class BMessageRunner;
 class StackFrame;
 
 
@@ -33,6 +34,8 @@ public:
                        void                            LoadSettings(const 
BMessage& settings);
                        status_t                        SaveSettings(BMessage& 
settings);
 
+       virtual void                            MessageReceived(BMessage* 
message);
+
 private:
                        class FramesTableModel;
 
@@ -42,10 +45,13 @@ private:
 
                        void                            _Init();
 
+                       void                            
_SetStackTrace(StackTrace* stackTrace);
+
 private:
                        StackTrace*                     fStackTrace;
                        Table*                          fFramesTable;
                        FramesTableModel*       fFramesTableModel;
+                       BMessageRunner*         fTraceUpdateRunner;
                        Listener*                       fListener;
 };
 

############################################################################

Revision:    hrev45802
Commit:      16e486eb4dd2d39b9a3eb65171106fd17d7e3fc0
URL:         http://cgit.haiku-os.org/haiku/commit/?id=16e486e
Author:      Rene Gollent <anevilyak@xxxxxxxxx>
Date:        Sat Jun 29 15:54:42 2013 UTC

Ticket:      https://dev.haiku-os.org/ticket/9841

BTabView: minor optimization.

Short circuit if asked to select the same index that's currently visible, to
avoid unnecessary invalidation/flicker.

Should fix last part of #9841.

----------------------------------------------------------------------------

diff --git a/src/kits/interface/TabView.cpp b/src/kits/interface/TabView.cpp
index 1b06aa0..d7a08f34 100644
--- a/src/kits/interface/TabView.cpp
+++ b/src/kits/interface/TabView.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright 2001-2009, Haiku, Inc. All rights reserved.
+ * Copyright 2001-2013, Haiku, Inc. All rights reserved.
  * Distributed under the terms of the MIT License.
  *
  * Authors:
@@ -7,6 +7,7 @@
  *             Jérôme Duval (korli@xxxxxxxxxxxxxxxx)
  *             Stephan Aßmus <superstippi@xxxxxx>
  *             Artur Wyszynski
+ *             Rene Gollent (rene@xxxxxxxxxxx)
  */
 
 
@@ -746,6 +747,9 @@ BTabView::Pulse()
 void
 BTabView::Select(int32 index)
 {
+       if (index == Selection())
+               return;
+
        if (index < 0 || index >= CountTabs())
                index = Selection();
 
@@ -1351,7 +1355,7 @@ BTabView::_InitObject(bool layouted, button_width width)
        fTabList = new BList;
 
        fTabWidthSetting = width;
-       fSelection = 0;
+       fSelection = -1;
        fFocus = -1;
        fTabOffset = 0.0f;
        fBorderStyle = B_FANCY_BORDER;


Other related posts: