hrev51135 adds 2 changesets to branch 'master'
old head: ec39b684433885a9163cbe184935747bc192a706
new head: 41b0595487b62e018d90026bf22b39706e0de4ee
overview:
http://cgit.haiku-os.org/haiku/log/?qt=range&q=41b0595487b6+%5Eec39b6844338
----------------------------------------------------------------------------
3582d4fe855a: Minor style cleanup.
[ Axel Dörfler <axeld@xxxxxxxxxxxxxxxx> ]
41b0595487b6: Tracker: Fixed shift extension after keyboard selection.
fixes the bug that caused multi-selection by SHIFT-cliking to fail if an
item in the file panel was selected by a key (ticket #13460).
If the user tries to select a single item by pressing a key (Left/Right,
Up/Down, etc.), the BPoseView::KeyDown() function will call the
BPoseView::SelectPose() function, which must set fSelectionPivotPose to
the selected item (or pose) because this item might be the starting (or
pivot) pose of the next multi-selection by SHIFT-click.
Signed-off-by: Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
[ Owen <owenca@xxxxxxxxxxxxxxxxxxxxxxxx> ]
----------------------------------------------------------------------------
3 files changed, 76 insertions(+), 64 deletions(-)
headers/private/kernel/fs/KPath.h | 103 ++++++++++++++++++----------------
src/kits/tracker/PoseView.cpp | 3 +
src/system/kernel/fs/KPath.cpp | 34 +++++------
############################################################################
Commit: 3582d4fe855a70c8ec1433275d4f1ab7916cda2f
URL: http://cgit.haiku-os.org/haiku/commit/?id=3582d4fe855a
Author: Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
Date: Sat Apr 29 12:37:56 2017 UTC
Minor style cleanup.
----------------------------------------------------------------------------
diff --git a/headers/private/kernel/fs/KPath.h
b/headers/private/kernel/fs/KPath.h
index e917cb3..30b2dc6 100644
--- a/headers/private/kernel/fs/KPath.h
+++ b/headers/private/kernel/fs/KPath.h
@@ -13,59 +13,66 @@ namespace BPrivate {
namespace DiskDevice {
class KPath {
- public:
- KPath(size_t bufferSize = B_PATH_NAME_LENGTH);
- KPath(const char* path, bool normalize = false,
- size_t bufferSize = B_PATH_NAME_LENGTH);
- KPath(const KPath& other);
- ~KPath();
-
- status_t SetTo(const char *path, bool normalize = false,
- size_t bufferSize = B_PATH_NAME_LENGTH,
- bool traverseLeafLink = false);
- void Adopt(KPath& other);
-
- status_t InitCheck() const;
-
- status_t SetPath(const char *path, bool normalize = false,
- bool traverseLeafLink = false);
- const char *Path() const;
- size_t Length() const { return fPathLength; }
-
- size_t BufferSize() const { return fBufferSize; }
- char *LockBuffer();
- void UnlockBuffer();
- char* DetachBuffer();
-
- const char *Leaf() const;
- status_t ReplaceLeaf(const char *newLeaf);
- bool RemoveLeaf();
- // returns false, if nothing could be removed anymore
-
- status_t Append(const char *toAppend, bool isComponent = true);
-
- status_t Normalize(bool traverseLeafLink);
-
- KPath& operator=(const KPath& other);
- KPath& operator=(const char* path);
-
- bool operator==(const KPath& other) const;
- bool operator==(const char* path) const;
- bool operator!=(const KPath& other) const;
- bool operator!=(const char* path) const;
-
- private:
- void _ChopTrailingSlashes();
-
- char* fBuffer;
- size_t fBufferSize;
- size_t fPathLength;
- bool fLocked;
+public:
+ KPath(size_t
bufferSize = B_PATH_NAME_LENGTH);
+ KPath(const
char* path, bool normalize = false,
+ size_t
bufferSize = B_PATH_NAME_LENGTH);
+ KPath(const
KPath& other);
+ ~KPath();
+
+ status_t SetTo(const char* path,
bool normalize = false,
+ size_t
bufferSize = B_PATH_NAME_LENGTH,
+ bool
traverseLeafLink = false);
+ void Adopt(KPath& other);
+
+ status_t InitCheck() const;
+
+ status_t SetPath(const char*
path,
+ bool
normalize = false,
+ bool
traverseLeafLink = false);
+ const char* Path() const;
+ size_t Length() const
+ {
return fPathLength; }
+
+ size_t BufferSize() const
+ {
return fBufferSize; }
+ char* LockBuffer();
+ void UnlockBuffer();
+ char* DetachBuffer();
+
+ const char* Leaf() const;
+ status_t ReplaceLeaf(const char*
newLeaf);
+ bool RemoveLeaf();
+ // returns false, if nothing could be removed
anymore
+
+ status_t Append(const char*
toAppend,
+ bool
isComponent = true);
+
+ status_t Normalize(bool
traverseLeafLink);
+
+ KPath& operator=(const KPath&
other);
+ KPath& operator=(const char*
path);
+
+ bool operator==(const KPath&
other) const;
+ bool operator==(const char*
path) const;
+ bool operator!=(const KPath&
other) const;
+ bool operator!=(const char*
path) const;
+
+private:
+ void _ChopTrailingSlashes();
+
+ char* fBuffer;
+ size_t fBufferSize;
+ size_t fPathLength;
+ bool fLocked;
};
+
} // namespace DiskDevice
} // namespace BPrivate
+
using BPrivate::DiskDevice::KPath;
+
#endif /* _K_PATH_H */
diff --git a/src/system/kernel/fs/KPath.cpp b/src/system/kernel/fs/KPath.cpp
index 2de6ae2..e59c96c 100644
--- a/src/system/kernel/fs/KPath.cpp
+++ b/src/system/kernel/fs/KPath.cpp
@@ -3,7 +3,9 @@
* Distributed under the terms of the MIT License.
*/
-/** A simple class wrapping a path. Has a fixed-sized buffer. */
+
+/*! A simple class wrapping a path. Has a fixed-sized buffer. */
+
#include <fs/KPath.h>
@@ -66,7 +68,7 @@ KPath::SetTo(const char* path, bool normalize, size_t
bufferSize,
bufferSize = B_PATH_NAME_LENGTH;
// free the previous buffer, if the buffer size differs
- if (fBuffer && fBufferSize != bufferSize) {
+ if (fBuffer != NULL && fBufferSize != bufferSize) {
free(fBuffer);
fBuffer = NULL;
fBufferSize = 0;
@@ -75,14 +77,14 @@ KPath::SetTo(const char* path, bool normalize, size_t
bufferSize,
fLocked = false;
// allocate buffer
- if (!fBuffer)
+ if (fBuffer == NULL)
fBuffer = (char*)malloc(bufferSize);
- if (!fBuffer)
+ if (fBuffer == NULL)
return B_NO_MEMORY;
- if (fBuffer) {
- fBufferSize = bufferSize;
- fBuffer[0] = '\0';
- }
+
+ fBufferSize = bufferSize;
+ fBuffer[0] = '\0';
+
return SetPath(path, normalize, traverseLeafLink);
}
@@ -196,7 +198,7 @@ KPath::DetachBuffer()
const char*
KPath::Leaf() const
{
- if (!fBuffer)
+ if (fBuffer == NULL)
return NULL;
// only "/" has trailing slashes -- then we have to return the complete
@@ -215,7 +217,7 @@ status_t
KPath::ReplaceLeaf(const char* newLeaf)
{
const char* leaf = Leaf();
- if (!leaf)
+ if (leaf == NULL)
return B_NO_INIT;
int32 leafIndex = leaf - fBuffer;
@@ -227,7 +229,7 @@ KPath::ReplaceLeaf(const char* newLeaf)
}
// if a leaf was given, append it
- if (newLeaf)
+ if (newLeaf != NULL)
return Append(newLeaf);
return B_OK;
}
@@ -238,7 +240,7 @@ KPath::RemoveLeaf()
{
// get the leaf -- bail out, if not initialized or only the "/" is left
const char* leaf = Leaf();
- if (!leaf || leaf == fBuffer)
+ if (leaf == NULL || leaf == fBuffer)
return false;
// chop off the leaf
@@ -330,9 +332,9 @@ KPath::operator==(const KPath& other) const
if (!fBuffer)
return !other.fBuffer;
- return (other.fBuffer
+ return other.fBuffer
&& fPathLength == other.fPathLength
- && strcmp(fBuffer, other.fBuffer) == 0);
+ && strcmp(fBuffer, other.fBuffer) == 0;
}
@@ -342,7 +344,7 @@ KPath::operator==(const char* path) const
if (!fBuffer)
return (!path);
- return path && !strcmp(fBuffer, path);
+ return path && strcmp(fBuffer, path) == 0;
}
@@ -363,7 +365,7 @@ KPath::operator!=(const char* path) const
void
KPath::_ChopTrailingSlashes()
{
- if (fBuffer) {
+ if (fBuffer != NULL) {
while (fPathLength > 1 && fBuffer[fPathLength - 1] == '/')
fBuffer[--fPathLength] = '\0';
}
############################################################################
Revision: hrev51135
Commit: 41b0595487b62e018d90026bf22b39706e0de4ee
URL: http://cgit.haiku-os.org/haiku/commit/?id=41b0595487b6
Author: Owen <owenca@xxxxxxxxxxxxxxxxxxxxxxxx>
Date: Fri Apr 28 22:23:44 2017 UTC
Committer: Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
Commit-Date: Sat Apr 29 16:43:55 2017 UTC
Ticket: https://dev.haiku-os.org/ticket/13460
Tracker: Fixed shift extension after keyboard selection.
fixes the bug that caused multi-selection by SHIFT-cliking to fail if an
item in the file panel was selected by a key (ticket #13460).
If the user tries to select a single item by pressing a key (Left/Right,
Up/Down, etc.), the BPoseView::KeyDown() function will call the
BPoseView::SelectPose() function, which must set fSelectionPivotPose to
the selected item (or pose) because this item might be the starting (or
pivot) pose of the next multi-selection by SHIFT-click.
Signed-off-by: Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
----------------------------------------------------------------------------
diff --git a/src/kits/tracker/PoseView.cpp b/src/kits/tracker/PoseView.cpp
index 5c06174..1aaf16c 100644
--- a/src/kits/tracker/PoseView.cpp
+++ b/src/kits/tracker/PoseView.cpp
@@ -4069,6 +4069,9 @@ BPoseView::SelectPose(BPose* pose, int32 index, bool
scrollIntoView)
ClearSelection();
AddPoseToSelection(pose, index, scrollIntoView);
+
+ if (pose != NULL)
+ fSelectionPivotPose = pose;
}