[haiku-commits] haiku: hrev48803 - src/apps/deskbar

  • From: jscipione@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 13 Feb 2015 23:08:48 +0100 (CET)

hrev48803 adds 3 changesets to branch 'master'
old head: 794c227e83907f60a9c92891b0ccdecafa21814b
new head: a7c02e02e95d1da230576abdc431c09d481c3e60
overview: 
http://cgit.haiku-os.org/haiku/log/?qt=range&q=a7c02e02e95d+%5E794c227e8390

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

9f339a005bd0: Deskbar: Style fixes only

8afcac1bb324: Deskbar: Compare signature case-insensitive

a7c02e02e95d: Deskbar: style fixes to TeamMenuItem

                                     [ John Scipione <jscipione@xxxxxxxxx> ]

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

6 files changed, 58 insertions(+), 56 deletions(-)
src/apps/deskbar/BarApp.cpp         |  2 +-
src/apps/deskbar/BarView.cpp        |  7 ++-
src/apps/deskbar/ExpandoMenuBar.cpp | 88 ++++++++++++++++-----------------
src/apps/deskbar/TeamMenuItem.cpp   |  6 +--
src/apps/deskbar/TeamMenuItem.h     |  6 +--
src/apps/deskbar/WindowMenu.cpp     |  5 +-

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

Commit:      9f339a005bd0f5ffd8d6f49ae26cc498417e36fa
URL:         http://cgit.haiku-os.org/haiku/commit/?id=9f339a005bd0
Author:      John Scipione <jscipione@xxxxxxxxx>
Date:        Tue Jan  7 04:18:46 2014 UTC

Deskbar: Style fixes only

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

diff --git a/src/apps/deskbar/BarApp.cpp b/src/apps/deskbar/BarApp.cpp
index 01372cb..ed7369d 100644
--- a/src/apps/deskbar/BarApp.cpp
+++ b/src/apps/deskbar/BarApp.cpp
@@ -60,9 +60,9 @@ All rights reserved.
 #include "tracker_private.h"
 #include "BarView.h"
 #include "BarWindow.h"
-#include "PreferencesWindow.h"
 #include "DeskbarUtils.h"
 #include "FSUtils.h"
+#include "PreferencesWindow.h"
 #include "PublicCommands.h"
 #include "ResourceSet.h"
 #include "StatusView.h"
diff --git a/src/apps/deskbar/BarView.cpp b/src/apps/deskbar/BarView.cpp
index 483d66e..d904e35 100644
--- a/src/apps/deskbar/BarView.cpp
+++ b/src/apps/deskbar/BarView.cpp
@@ -125,6 +125,9 @@ BarViewMessageFilter::Filter(BMessage* message, BHandler** 
target)
 }
 
 
+//     #pragma mark - TBarView
+
+
 TBarView::TBarView(BRect frame, bool vertical, bool left, bool top,
        int32 state, float)
        :
@@ -865,7 +868,7 @@ TBarView::DragStart()
        uint32 buttons;
        GetMouse(&loc, &buttons);
 
-       if (fExpandoMenuBar && fExpandoMenuBar->Frame().Contains(loc)) {
+       if (fExpandoMenuBar != NULL && fExpandoMenuBar->Frame().Contains(loc)) {
                ConvertToScreen(&loc);
                BPoint expandoLocation = 
fExpandoMenuBar->ConvertFromScreen(loc);
                TTeamMenuItem* item = 
fExpandoMenuBar->TeamItemAtPoint(expandoLocation);
diff --git a/src/apps/deskbar/ExpandoMenuBar.cpp 
b/src/apps/deskbar/ExpandoMenuBar.cpp
index 232a5ac..90d7551 100644
--- a/src/apps/deskbar/ExpandoMenuBar.cpp
+++ b/src/apps/deskbar/ExpandoMenuBar.cpp
@@ -515,7 +515,7 @@ bool
 TExpandoMenuBar::InDeskbarMenu(BPoint loc) const
 {
        TBarWindow* window = dynamic_cast<TBarWindow*>(Window());
-       if (window) {
+       if (window != NULL) {
                if (TDeskbarMenu* bemenu = window->DeskbarMenu()) {
                        bool inDeskbarMenu = false;
                        if (bemenu->LockLooper()) {
@@ -629,15 +629,14 @@ TExpandoMenuBar::AddTeam(BList* team, BBitmap* icon, 
char* name,
 void
 TExpandoMenuBar::AddTeam(team_id team, const char* signature)
 {
-       int32 count = CountItems();
-       for (int32 i = 0; i < count; i++) {
+       int32 itemCount = CountItems();
+       for (int32 i = 0; i < itemCount; i++) {
                // Only add to team menu items
-               if (TTeamMenuItem* item = 
dynamic_cast<TTeamMenuItem*>(ItemAt(i))) {
-                       if (strcasecmp(item->Signature(), signature) == 0) {
-                               if 
(!(item->Teams()->HasItem((void*)(addr_t)team)))
-                                       
item->Teams()->AddItem((void*)(addr_t)team);
-                               break;
-                       }
+               TTeamMenuItem* item = dynamic_cast<TTeamMenuItem*>(ItemAt(i));
+               if (item != NULL && strcasecmp(item->Signature(), signature) == 0
+                       && !(item->Teams()->HasItem((void*)(addr_t)team))) {
+                       item->Teams()->AddItem((void*)(addr_t)team);
+                       break;
                }
        }
 }
@@ -649,36 +648,35 @@ TExpandoMenuBar::RemoveTeam(team_id team, bool partial)
        TWindowMenuItem* windowItem = NULL;
 
        for (int32 i = CountItems() - 1; i >= 0; i--) {
-               if (TTeamMenuItem* item = 
dynamic_cast<TTeamMenuItem*>(ItemAt(i))) {
-                       if (item->Teams()->HasItem((void*)(addr_t)team)) {
-                               item->Teams()->RemoveItem(team);
-                               if (partial)
-                                       return;
-
-                               BAutolock locker(sMonLocker);
-                                       // make the update thread wait
+               TTeamMenuItem* item = dynamic_cast<TTeamMenuItem*>(ItemAt(i));
+               if (item != NULL && 
item->Teams()->HasItem((void*)(addr_t)team)) {
+                       item->Teams()->RemoveItem(team);
+                       if (partial)
+                               return;
+
+                       BAutolock locker(sMonLocker);
+                               // make the update thread wait
+                       RemoveItem(i);
+                       if (item == fPreviousDragTargetItem)
+                               fPreviousDragTargetItem = NULL;
+                       if (item == fLastMousedOverItem)
+                               fLastMousedOverItem = NULL;
+                       if (item == fLastClickedItem)
+                               fLastClickedItem = NULL;
+                       delete item;
+                       while ((windowItem = dynamic_cast<TWindowMenuItem*>(
+                                       ItemAt(i))) != NULL) {
+                               // Also remove window items (if there are any)
                                RemoveItem(i);
-                               if (item == fPreviousDragTargetItem)
-                                       fPreviousDragTargetItem = NULL;
-                               if (item == fLastMousedOverItem)
+                               if (windowItem == fLastMousedOverItem)
                                        fLastMousedOverItem = NULL;
-                               if (item == fLastClickedItem)
+                               if (windowItem == fLastClickedItem)
                                        fLastClickedItem = NULL;
-                               delete item;
-                               while ((windowItem = 
dynamic_cast<TWindowMenuItem*>(
-                                               ItemAt(i))) != NULL) {
-                                       // Also remove window items (if there 
are any)
-                                       RemoveItem(i);
-                                       if (windowItem == fLastMousedOverItem)
-                                               fLastMousedOverItem = NULL;
-                                       if (windowItem == fLastClickedItem)
-                                               fLastClickedItem = NULL;
-                                       delete windowItem;
-                               }
-                               SizeWindow(-1);
-                               Window()->UpdateIfNeeded();
-                               return;
+                               delete windowItem;
                        }
+                       SizeWindow(-1);
+                       Window()->UpdateIfNeeded();
+                       return;
                }
        }
 }
@@ -882,7 +880,8 @@ TExpandoMenuBar::monitor_team_windows(void* arg)
 
                        // Perform SetTo() on all the items that still exist as 
well as add
                        // new items.
-                       bool itemModified = false, resize = false;
+                       bool itemModified = false;
+                       bool resize = false;
                        TTeamMenuItem* teamItem = NULL;
 
                        for (int32 i = 0; i < totalItems; i++) {
@@ -895,7 +894,7 @@ TExpandoMenuBar::monitor_team_windows(void* arg)
                                        for (int32 j = 0; j < teamCount; j++) {
                                                // The following code is almost 
a copy/paste from
                                                // WindowMenu.cpp
-                                               team_id theTeam = 
(addr_t)teamItem->Teams()->ItemAt(j);
+                                               team_id theTeam = 
(addr_t)teamItem->Teams()->ItemAt(j);
                                                int32 count = 0;
                                                int32* tokens = 
get_token_list(theTeam, &count);
 
@@ -909,14 +908,13 @@ TExpandoMenuBar::monitor_team_windows(void* arg)
                                                                // Check if we 
have a matching window item...
                                                                item = 
teamItem->ExpandedWindowItem(
                                                                        
wInfo->server_token);
-                                                               if (item) {
+                                                               if (item != 
NULL) {
                                                                        
item->SetTo(wInfo->name,
                                                                                
wInfo->server_token, wInfo->is_mini,
                                                                                
((1 << current_workspace())
                                                                                
        & wInfo->workspaces) != 0);
 
-                                                                       if 
(strcmp(wInfo->name,
-                                                                               
item->Label()) != 0)
+                                                                       if 
(strcmp(wInfo->name, item->Label()) != 0)
                                                                                
item->SetLabel(wInfo->name);
 
                                                                        if 
(item->ChangedState())
diff --git a/src/apps/deskbar/TeamMenuItem.h b/src/apps/deskbar/TeamMenuItem.h
index 4cbfb85..14c86b4 100644
--- a/src/apps/deskbar/TeamMenuItem.h
+++ b/src/apps/deskbar/TeamMenuItem.h
@@ -32,8 +32,8 @@ brand product names are registered trademarks or trademarks 
of their respective
 holders.
 All rights reserved.
 */
-#ifndef TEAMMENUITEM_H
-#define TEAMMENUITEM_H
+#ifndef TEAM_MENU_ITEM_H
+#define TEAM_MENU_ITEM_H
 
 
 //     Individual team/application listing
@@ -122,4 +122,4 @@ private:
 };
 
 
-#endif // TEAMMENUITEM_H
+#endif // TEAM_MENU_ITEM_H
diff --git a/src/apps/deskbar/WindowMenu.cpp b/src/apps/deskbar/WindowMenu.cpp
index d4fcad4..88960e0 100644
--- a/src/apps/deskbar/WindowMenu.cpp
+++ b/src/apps/deskbar/WindowMenu.cpp
@@ -77,7 +77,8 @@ TWindowMenu::WindowShouldBeListed(client_window_info* info)
 
 
 TWindowMenu::TWindowMenu(const BList* team, const char* signature)
-       : BMenu("Deskbar Team Menu"),
+       :
+       BMenu("Deskbar Team Menu"),
        fTeam(team),
        fApplicationSignature(signature),
        fExpanded(false),
@@ -96,7 +97,7 @@ TWindowMenu::AttachedToWindow()
 
        bool dragging = false;
        TBarView* barview =(static_cast<TBarApp*>(be_app))->BarView();
-       if (barview && barview->LockLooper()) {
+       if (barview != NULL && barview->LockLooper()) {
                // 'dragging' mode set in BarView::CacheDragData
                // invoke in MouseEnter in ExpandoMenuBar
                dragging = barview->Dragging();

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

Commit:      8afcac1bb3241ecfd5b5abc0a8b14c86fd0c7fa0
URL:         http://cgit.haiku-os.org/haiku/commit/?id=8afcac1bb324
Author:      John Scipione <jscipione@xxxxxxxxx>
Date:        Tue Jan  7 04:30:25 2014 UTC

Deskbar: Compare signature case-insensitive

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

diff --git a/src/apps/deskbar/BarView.cpp b/src/apps/deskbar/BarView.cpp
index d904e35..d8f9090 100644
--- a/src/apps/deskbar/BarView.cpp
+++ b/src/apps/deskbar/BarView.cpp
@@ -992,7 +992,7 @@ TBarView::AppCanHandleTypes(const char* signature)
                || !fCachedTypesList || fCachedTypesList->CountItems() == 0)
                return false;
 
-       if (strcmp(signature, kTrackerSignature) == 0) {
+       if (strcasecmp(signature, kTrackerSignature) == 0) {
                // tracker should support all types
                // and should pass them on to the appropriate application
                return true;
diff --git a/src/apps/deskbar/ExpandoMenuBar.cpp 
b/src/apps/deskbar/ExpandoMenuBar.cpp
index 90d7551..9e34007 100644
--- a/src/apps/deskbar/ExpandoMenuBar.cpp
+++ b/src/apps/deskbar/ExpandoMenuBar.cpp
@@ -586,17 +586,17 @@ TExpandoMenuBar::AddTeam(BList* team, BBitmap* icon, 
char* name,
        TTeamMenuItem* item = new TTeamMenuItem(team, icon, name, signature,
                itemWidth, itemHeight, fDrawLabel, fVertical);
 
-       if (settings->trackerAlwaysFirst && !strcmp(signature, 
kTrackerSignature))
+       if (settings->trackerAlwaysFirst
+               && strcasecmp(signature, kTrackerSignature) == 0) {
                AddItem(item, 0);
-       else if (settings->sortRunningApps) {
-               TTeamMenuItem* teamItem
-                       = dynamic_cast<TTeamMenuItem*>(ItemAt(0));
+       } else if (settings->sortRunningApps) {
+               TTeamMenuItem* teamItem = 
dynamic_cast<TTeamMenuItem*>(ItemAt(0));
                int32 firstApp = 0;
 
                // if Tracker should always be the first item, we need to skip 
it
                // when sorting in the current item
                if (settings->trackerAlwaysFirst && teamItem != NULL
-                       && !strcmp(teamItem->Signature(), kTrackerSignature)) {
+                       && !strcasecmp(teamItem->Signature(), 
kTrackerSignature)) {
                        firstApp++;
                }
 

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

Revision:    hrev48803
Commit:      a7c02e02e95d1da230576abdc431c09d481c3e60
URL:         http://cgit.haiku-os.org/haiku/commit/?id=a7c02e02e95d
Author:      John Scipione <jscipione@xxxxxxxxx>
Date:        Thu Feb 12 22:20:06 2015 UTC

Deskbar: style fixes to TeamMenuItem

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

diff --git a/src/apps/deskbar/TeamMenuItem.cpp 
b/src/apps/deskbar/TeamMenuItem.cpp
index 8acb8bb..6977d06 100644
--- a/src/apps/deskbar/TeamMenuItem.cpp
+++ b/src/apps/deskbar/TeamMenuItem.cpp
@@ -62,7 +62,7 @@ All rights reserved.
 const float kHPad = 8.0f;
 const float kVPad = 1.0f;
 const float kLabelOffset = 8.0f;
-const float kSwitchWidth = 12;
+const float kSwitchWidth = 12.0f;
 
 
 TTeamMenuItem::TTeamMenuItem(BList* team, BBitmap* icon, char* name, char* sig,
@@ -319,14 +319,14 @@ TTeamMenuItem::DrawContentLabel()
                float offset = penloc.x - frame.left;
                if (cachedWidth + offset > max) {
                        truncLabel = (char*)malloc(strlen(label) + 4);
-                       if (!truncLabel)
+                       if (truncLabel == NULL)
                                return;
                        TruncateLabel(max-offset, truncLabel);
                        label = truncLabel;
                }
        }
 
-       if (!label)
+       if (label == NULL)
                label = Label();
 
        bool canHandle = !fBarView->Dragging()


Other related posts:

  • » [haiku-commits] haiku: hrev48803 - src/apps/deskbar - jscipione