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