[haiku-commits] haiku: hrev52488 - src/apps/deskbar headers/private/interface src/kits/interface

  • From: axeld@xxxxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 3 Nov 2018 15:04:09 -0400 (EDT)

hrev52488 adds 2 changesets to branch 'master'
old head: ed08b22decaf1f7748dc69b859271f5213065955
new head: 1fab55172651541a524cd333197054ea3db177f3
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=1fab55172651+%5Eed08b22decaf

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

5fd3bc6d2ceb: BDeskbar: Moved constants to shared header
  
  * Instead of duplicating them in different files.

1fab55172651: Deskbar: Center window icons in WindowMenuItem
  
  * They had a fixed top offset which looked bad with larger font sizes.
  * The icons should be replaced with vector icons, though, and properly
    resized.

                                   [ Axel Dörfler <axeld@xxxxxxxxxxxxxxxx> ]

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

6 files changed, 58 insertions(+), 48 deletions(-)
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/apps/deskbar/WindowMenuItem.cpp        |  8 ++++--
src/kits/interface/Deskbar.cpp             | 32 +++++----------------

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

Commit:      5fd3bc6d2ceb0ab7ac53e16653e1c50fdec54cee
URL:         https://git.haiku-os.org/haiku/commit/?id=5fd3bc6d2ceb
Author:      Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
Date:        Sat Nov  3 17:50:37 2018 UTC

BDeskbar: Moved constants to shared header

* Instead of duplicating them in different files.

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

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@xxxxxxxx
+ *             John Scipione, jscipione@xxxxxxxxx
+ */
+#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 <Messenger.h>
 #include <Path.h>
 #include <Roster.h>
+
+#include <DeskbarPrivate.h>
 #include <RosterPrivate.h>
+#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 <MessagePrivate.h>
 #include <Screen.h>
 
+#include <DeskbarPrivate.h>
+#include <tracker_private.h>
+
 #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 <Deskbar.h>
+
+#include <string.h>
+
 #include <Messenger.h>
 #include <Message.h>
 #include <View.h>
@@ -18,10 +21,10 @@
 #include <InterfaceDefs.h>
 #include <Node.h>
 
-#include <string.h>
+#include <DeskbarPrivate.h>
 
 
-// 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)

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

Revision:    hrev52488
Commit:      1fab55172651541a524cd333197054ea3db177f3
URL:         https://git.haiku-os.org/haiku/commit/?id=1fab55172651
Author:      Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
Date:        Sat Nov  3 19:58:19 2018 UTC

Deskbar: Center window icons in WindowMenuItem

* They had a fixed top offset which looked bad with larger font sizes.
* The icons should be replaced with vector icons, though, and properly
  resized.

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

diff --git a/src/apps/deskbar/WindowMenuItem.cpp 
b/src/apps/deskbar/WindowMenuItem.cpp
index f9d70bfbdc..f7a5aeb4c3 100644
--- a/src/apps/deskbar/WindowMenuItem.cpp
+++ b/src/apps/deskbar/WindowMenuItem.cpp
@@ -157,7 +157,7 @@ void
 TWindowMenuItem::DrawContent()
 {
        BMenu* menu = Menu();
-       BPoint contentLocation = ContentLocation() + BPoint(kHPad, kVPad);
+       BPoint contentLocation = ContentLocation() + BPoint(kHPad, 0);
 
        if (fID >= 0) {
                menu->SetDrawingMode(B_OP_OVER);
@@ -166,6 +166,10 @@ TWindowMenuItem::DrawContent()
                if (width > 16)
                        contentLocation.x -= 8;
 
+               float height;
+               GetContentSize(NULL, &height);
+               contentLocation.y += (height - fBitmap->Bounds().Height()) / 2;
+
                menu->MovePenTo(contentLocation);
                menu->DrawBitmapAsync(fBitmap);
 
@@ -174,7 +178,7 @@ TWindowMenuItem::DrawContent()
 
                contentLocation.x += kIconRect.Width() + kLabelOffset;
        }
-       contentLocation.y += fLabelAscent;
+       contentLocation.y = ContentLocation().y + kVPad + fLabelAscent;
 
        menu->SetDrawingMode(B_OP_COPY);
        menu->MovePenTo(contentLocation);


Other related posts:

  • » [haiku-commits] haiku: hrev52488 - src/apps/deskbar headers/private/interface src/kits/interface - axeld