From 5fd3bc6d2ceb0ab7ac53e16653e1c50fdec54cee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Sat, 3 Nov 2018 17:50:37 +0000 Subject: [PATCH] BDeskbar: Moved constants to shared header * Instead of duplicating them in different files. --- headers/private/interface/DeskbarPrivate.h | 39 ++++++++++++++++++++++ src/apps/deskbar/BarApp.cpp | 4 ++- src/apps/deskbar/BarApp.h | 19 ----------- src/apps/deskbar/BarWindow.cpp | 4 ++- src/kits/interface/Deskbar.cpp | 32 ++++-------------- 5 files changed, 52 insertions(+), 46 deletions(-) create mode 100644 headers/private/interface/DeskbarPrivate.h diff --git a/headers/private/interface/DeskbarPrivate.h b/headers/private/interface/DeskbarPrivate.h new file mode 100644 index 0000000000..9289e6b6ba --- /dev/null +++ b/headers/private/interface/DeskbarPrivate.h @@ -0,0 +1,39 @@ +/* + * Copyright 2001-2018 Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Jérôme Duval + * Axel Dörfler + * Jeremy Rand, jrand@magma.ca + * John Scipione, jscipione@gmail.com + */ +#ifndef _DESKBAR_PRIVATE_H +#define _DESKBAR_PRIVATE_H + + +#ifndef kDeskbarSignature +# define kDeskbarSignature "application/x-vnd.Be-TSKB" +#endif + + +static const uint32 kMsgIsAlwaysOnTop = 'gtop'; +static const uint32 kMsgAlwaysOnTop = 'stop'; +static const uint32 kMsgIsAutoRaise = 'grse'; +static const uint32 kMsgAutoRaise = 'srse'; +static const uint32 kMsgIsAutoHide = 'ghid'; +static const uint32 kMsgAutoHide = 'shid'; + +static const uint32 kMsgAddView = 'icon'; +static const uint32 kMsgAddAddOn = 'adon'; +static const uint32 kMsgHasItem = 'exst'; +static const uint32 kMsgGetItemInfo = 'info'; +static const uint32 kMsgCountItems = 'cwnt'; +static const uint32 kMsgRemoveItem = 'remv'; +static const uint32 kMsgLocation = 'gloc'; +static const uint32 kMsgIsExpanded = 'gexp'; +static const uint32 kMsgSetLocation = 'sloc'; +static const uint32 kMsgExpand = 'sexp'; + + +#endif /* _DESKBAR_PRIVATE_H */ diff --git a/src/apps/deskbar/BarApp.cpp b/src/apps/deskbar/BarApp.cpp index 6f64a98e4a..386cfd64c5 100644 --- a/src/apps/deskbar/BarApp.cpp +++ b/src/apps/deskbar/BarApp.cpp @@ -54,7 +54,10 @@ All rights reserved. #include #include #include + +#include #include +#include "tracker_private.h" #include "BarView.h" #include "BarWindow.h" @@ -67,7 +70,6 @@ All rights reserved. #include "Utilities.h" #include "icons.h" -#include "tracker_private.h" BLocker TBarApp::sSubscriberLock; diff --git a/src/apps/deskbar/BarApp.h b/src/apps/deskbar/BarApp.h index 71d10a9482..d85763848d 100644 --- a/src/apps/deskbar/BarApp.h +++ b/src/apps/deskbar/BarApp.h @@ -79,25 +79,6 @@ const uint32 kUpdatePreferences = 'Pref'; // realign replicants message constant const uint32 kRealignReplicants = 'Algn'; -// BDeskbar message constants -static const uint32 kMsgIsAlwaysOnTop = 'gtop'; -static const uint32 kMsgAlwaysOnTop = 'stop'; -static const uint32 kMsgIsAutoRaise = 'grse'; -static const uint32 kMsgAutoRaise = 'srse'; -static const uint32 kMsgIsAutoHide = 'ghid'; -static const uint32 kMsgAutoHide = 'shid'; - -static const uint32 kMsgAddView = 'icon'; -static const uint32 kMsgAddAddOn = 'adon'; -static const uint32 kMsgHasItem = 'exst'; -static const uint32 kMsgGetItemInfo = 'info'; -static const uint32 kMsgCountItems = 'cwnt'; -static const uint32 kMsgRemoveItem = 'remv'; -static const uint32 kMsgLocation = 'gloc'; -static const uint32 kMsgIsExpanded = 'gexp'; -static const uint32 kMsgSetLocation = 'sloc'; -static const uint32 kMsgExpand = 'sexp'; - /* --------------------------------------------- */ class BBitmap; diff --git a/src/apps/deskbar/BarWindow.cpp b/src/apps/deskbar/BarWindow.cpp index cfae6e0891..c59f138c9a 100644 --- a/src/apps/deskbar/BarWindow.cpp +++ b/src/apps/deskbar/BarWindow.cpp @@ -52,6 +52,9 @@ All rights reserved. #include #include +#include +#include + #include "BarApp.h" #include "BarMenuBar.h" #include "BarView.h" @@ -60,7 +63,6 @@ All rights reserved. #include "ExpandoMenuBar.h" #include "StatusView.h" -#include "tracker_private.h" #undef B_TRANSLATION_CONTEXT #define B_TRANSLATION_CONTEXT "MainWindow" diff --git a/src/kits/interface/Deskbar.cpp b/src/kits/interface/Deskbar.cpp index 0d1bc062d1..1964e0a8a8 100644 --- a/src/kits/interface/Deskbar.cpp +++ b/src/kits/interface/Deskbar.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2017 Haiku, Inc. All Rights Reserved. + * Copyright 2001-2018 Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. * * Authors: @@ -11,6 +11,9 @@ #include + +#include + #include #include #include @@ -18,10 +21,10 @@ #include #include -#include +#include -// ToDo: in case the BDeskbar methods are called from a Deskbar add-on, +// TODO: in case the BDeskbar methods are called from a Deskbar add-on, // they will currently deadlock most of the time (only those that do // not need a reply will work). // That should be fixed in the Deskbar itself, even if the Be API found @@ -31,27 +34,6 @@ // should work with all versions of Tracker available for Haiku. -static const char* kDeskbarSignature = "application/x-vnd.Be-TSKB"; - -static const uint32 kMsgIsAlwaysOnTop = 'gtop'; -static const uint32 kMsgAlwaysOnTop = 'stop'; -static const uint32 kMsgIsAutoRaise = 'grse'; -static const uint32 kMsgAutoRaise = 'srse'; -static const uint32 kMsgIsAutoHide = 'ghid'; -static const uint32 kMsgAutoHide = 'shid'; - -static const uint32 kMsgAddView = 'icon'; -static const uint32 kMsgAddAddOn = 'adon'; -static const uint32 kMsgHasItem = 'exst'; -static const uint32 kMsgGetItemInfo = 'info'; -static const uint32 kMsgCountItems = 'cwnt'; -static const uint32 kMsgRemoveItem = 'remv'; -static const uint32 kMsgLocation = 'gloc'; -static const uint32 kMsgIsExpanded = 'gexp'; -static const uint32 kMsgSetLocation = 'sloc'; -static const uint32 kMsgExpand = 'sexp'; - - status_t get_deskbar_frame(BRect* frame) { @@ -328,7 +310,7 @@ BDeskbar::HasItem(const char* name) const uint32 BDeskbar::CountItems() const { - BMessage request(kMsgCountItems); + BMessage request(kMsgCountItems); BMessage reply; if (fMessenger->SendMessage(&request, &reply) == B_OK)