[haiku-commits] haiku: hrev51138 - in src: kits/tracker add-ons/kernel/network/ppp/modem

  • From: waddlesplash@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 29 Apr 2017 21:24:39 +0200 (CEST)

hrev51138 adds 4 changesets to branch 'master'
old head: 8d47f50dc0b60f26a62675b965fa9553d42fa55e
new head: 2d8adbdd85635241b755fd3cc950f2cbb175a9da
overview: 
http://cgit.haiku-os.org/haiku/log/?qt=range&q=2d8adbdd8563+%5E8d47f50dc0b6

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

0d3051a20b3a: modem: Fix logic errors and some style issues.
  
  Thanks Axel for the review!

                              [ Augustin Cavalier <waddlesplash@xxxxxxxxx> ]

56f9e8b75990: Tracker: If a BTextView is focused, do not force-forward 
clipboard events to it.
  
  In its original state this code just forwarded all clipboard messages to the
  focused view, which sometimes was a BTextView or the like which knows nothing
  about Tracker's custom clipboard events, and thus would wind up in an infinite
  loop.
  
  Now, the messages are left to be handled by the focused view if a BTextView
  is selected (e.g. in a file panel, or in Tracker's navigator), but otherwise
  forwarded directly to the BPoseView.
  
  Fixes #12721.

                              [ Augustin Cavalier <waddlesplash@xxxxxxxxx> ]

a8ae893bc3a0: Tracker: Fix B_UNDO/B_REDO forwarding to a focused BTextView.

                              [ Augustin Cavalier <waddlesplash@xxxxxxxxx> ]

2d8adbdd8563: Tracker: Fix Shift+click multi-selection not being disabled.
  
  Using BFilePanel with multi-selection turned off does not prevent
  multi-selection by SHIFT-click. Traced the bug to
  BPoseView::AddRemoveSelectionRange(), and the safest fix is to not
  touching the boolean extendSelection but to just add the test for
  fMultipleSelection to the if block that handles B_SHIFT_KEY.
  
  Fixes #13462.
  
  Signed-off-by: Augustin Cavalier <waddlesplash@xxxxxxxxx>

                                  [ Owen <owenca@xxxxxxxxxxxxxxxxxxxxxxxx> ]

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

4 files changed, 45 insertions(+), 19 deletions(-)
.../kernel/network/ppp/modem/ModemDevice.cpp     | 11 +++--
src/add-ons/kernel/network/ppp/modem/modem.cpp   |  5 ++-
src/kits/tracker/ContainerWindow.cpp             | 46 +++++++++++++++-----
src/kits/tracker/PoseView.cpp                    |  2 +-

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

Commit:      0d3051a20b3a2d450c1d98644070dba463cede6e
URL:         http://cgit.haiku-os.org/haiku/commit/?id=0d3051a20b3a
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Sat Apr 29 18:08:18 2017 UTC

modem: Fix logic errors and some style issues.

Thanks Axel for the review!

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

diff --git a/src/add-ons/kernel/network/ppp/modem/ModemDevice.cpp 
b/src/add-ons/kernel/network/ppp/modem/ModemDevice.cpp
index b3ccb54..5df31d9 100644
--- a/src/add-ons/kernel/network/ppp/modem/ModemDevice.cpp
+++ b/src/add-ons/kernel/network/ppp/modem/ModemDevice.cpp
@@ -430,9 +430,10 @@ ModemDevice::Send(net_buffer *packet, uint16 
protocolNumber)
                data[1] = UI;
        }
 
-       int32 position = 0, length = packet->size;
+       int32 position = 0, length = packet->size,
+               offset = (fACFC->LocalState() != ACFC_ACCEPTED) ? 2 : 0;
        uint8* data;
-       if (gBufferModule->direct_access(packet, 0, length + 2, (void**)&data) 
!= B_OK) {
+       if (gBufferModule->direct_access(packet, offset, length, (void**)&data) 
!= B_OK) {
                ERROR("ModemDevice: Failed to access buffer!\n");
                return B_ERROR;
        }
@@ -492,12 +493,10 @@ ModemDevice::DataReceived(uint8 *buffer, uint32 length)
                buffer += 2;
 
        net_buffer* packet = gBufferModule->create(length - 2);
-       uint8* data;
-       if (gBufferModule->direct_access(packet, 0, length, (void**)&data) != 
B_OK) {
-               ERROR("ModemDevice: Failed to access buffer!\n");
+       if (gBufferModule->write(packet, 0, buffer, length - 2) != B_OK) {
+               ERROR("ModemDevice: Failed to write into packet!\n");
                return B_ERROR;
        }
-       memcpy(data, buffer, length - 2);
 
        return Receive(packet);
 }
diff --git a/src/add-ons/kernel/network/ppp/modem/modem.cpp 
b/src/add-ons/kernel/network/ppp/modem/modem.cpp
index c4007b3..55466c8 100644
--- a/src/add-ons/kernel/network/ppp/modem/modem.cpp
+++ b/src/add-ons/kernel/network/ppp/modem/modem.cpp
@@ -61,10 +61,11 @@ std_ops(int32 op, ...)
 {
        switch (op) {
                case B_MODULE_INIT:
-                       if (get_module(NET_STACK_MODULE_NAME, (module_info**) 
&gStackModule) != B_OK)
+                       if (get_module(NET_STACK_MODULE_NAME,
+                                       (module_info**)&gStackModule) != B_OK)
                                return B_ERROR;
                        if (get_module(NET_BUFFER_MODULE_NAME,
-                               (module_info **)&gBufferModule) != B_OK) {
+                                       (module_info **)&gBufferModule) != 
B_OK) {
                                put_module(NET_STACK_MODULE_NAME);
                                return B_ERROR;
                        }

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

Commit:      56f9e8b759907982428c4898a136c9a01d2fb608
URL:         http://cgit.haiku-os.org/haiku/commit/?id=56f9e8b75990
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Sat Apr 29 18:20:21 2017 UTC

Ticket:      https://dev.haiku-os.org/ticket/12721

Tracker: If a BTextView is focused, do not force-forward clipboard events to it.

In its original state this code just forwarded all clipboard messages to the
focused view, which sometimes was a BTextView or the like which knows nothing
about Tracker's custom clipboard events, and thus would wind up in an infinite
loop.

Now, the messages are left to be handled by the focused view if a BTextView
is selected (e.g. in a file panel, or in Tracker's navigator), but otherwise
forwarded directly to the BPoseView.

Fixes #12721.

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

diff --git a/src/kits/tracker/ContainerWindow.cpp 
b/src/kits/tracker/ContainerWindow.cpp
index 119e7a9..cafc808 100644
--- a/src/kits/tracker/ContainerWindow.cpp
+++ b/src/kits/tracker/ContainerWindow.cpp
@@ -1378,9 +1378,23 @@ BContainerWindow::MessageReceived(BMessage* message)
                case kPasteLinksFromClipboard:
                {
                        BView* view = CurrentFocus();
-                       if (view->LockLooper()) {
-                               view->MessageReceived(message);
-                               view->UnlockLooper();
+                       if (dynamic_cast<BTextView*>(view) == NULL) {
+                               // The selected item is not a BTextView, so 
forward the
+                               // message to the PoseView.
+                               if (fPoseView != NULL)
+                                       fPoseView->MessageReceived(message);
+                       } else {
+                               // Since we catch the generic clipboard 
shortcuts in a way that
+                               // means the BTextView will never get them, we 
must
+                               // manually forward them ourselves.
+                               //
+                               // However, we have to take care to not forward 
the custom
+                               // clipboard messages, else we would wind up in 
infinite
+                               // recursion.
+                               if (message->what == B_CUT || message->what == 
B_COPY
+                                               || message->what == B_PASTE) {
+                                       view->MessageReceived(message);
+                               }
                        }
                        break;
                }

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

Commit:      a8ae893bc3a0bc2fedf8ef564c3bdf88739b9ad1
URL:         http://cgit.haiku-os.org/haiku/commit/?id=a8ae893bc3a0
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Sat Apr 29 19:09:05 2017 UTC

Tracker: Fix B_UNDO/B_REDO forwarding to a focused BTextView.

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

diff --git a/src/kits/tracker/ContainerWindow.cpp 
b/src/kits/tracker/ContainerWindow.cpp
index cafc808..11c8d48 100644
--- a/src/kits/tracker/ContainerWindow.cpp
+++ b/src/kits/tracker/ContainerWindow.cpp
@@ -1399,6 +1399,26 @@ BContainerWindow::MessageReceived(BMessage* message)
                        break;
                }
 
+               case B_UNDO: {
+                       BView* view = CurrentFocus();
+                       if (dynamic_cast<BTextView*>(view) == NULL) {
+                               FSUndo();
+                       } else {
+                               view->MessageReceived(message);
+                       }
+                       break;
+               }
+
+               case B_REDO: {
+                       BView* view = CurrentFocus();
+                       if (dynamic_cast<BTextView*>(view) == NULL) {
+                               FSRedo();
+                       } else {
+                               view->MessageReceived(message);
+                       }
+                       break;
+               }
+
                case kNewFolder:
                        PostMessage(message, PoseView());
                        break;
@@ -1690,14 +1710,6 @@ BContainerWindow::MessageReceived(BMessage* message)
                        UpdateTitle();
                        break;
 
-               case B_UNDO:
-                       FSUndo();
-                       break;
-
-               case B_REDO:
-                       FSRedo();
-                       break;
-
                default:
                        _inherited::MessageReceived(message);
                        break;

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

Revision:    hrev51138
Commit:      2d8adbdd85635241b755fd3cc950f2cbb175a9da
URL:         http://cgit.haiku-os.org/haiku/commit/?id=2d8adbdd8563
Author:      Owen <owenca@xxxxxxxxxxxxxxxxxxxxxxxx>
Date:        Sat Apr 29 10:31:55 2017 UTC
Committer:   Augustin Cavalier <waddlesplash@xxxxxxxxx>
Commit-Date: Sat Apr 29 19:21:38 2017 UTC

Ticket:      https://dev.haiku-os.org/ticket/13462

Tracker: Fix Shift+click multi-selection not being disabled.

Using BFilePanel with multi-selection turned off does not prevent
multi-selection by SHIFT-click. Traced the bug to
BPoseView::AddRemoveSelectionRange(), and the safest fix is to not
touching the boolean extendSelection but to just add the test for
fMultipleSelection to the if block that handles B_SHIFT_KEY.

Fixes #13462.

Signed-off-by: Augustin Cavalier <waddlesplash@xxxxxxxxx>

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

diff --git a/src/kits/tracker/PoseView.cpp b/src/kits/tracker/PoseView.cpp
index 1aaf16c..77d13fe 100644
--- a/src/kits/tracker/PoseView.cpp
+++ b/src/kits/tracker/PoseView.cpp
@@ -7939,7 +7939,7 @@ BPoseView::AddRemoveSelectionRange(BPoint where, bool 
extendSelection,
        if (pose == fSelectionPivotPose && !extendSelection)
                return;
 
-       if ((modifiers() & B_SHIFT_KEY) != 0 && fSelectionPivotPose) {
+       if (fMultipleSelection && (modifiers() & B_SHIFT_KEY) != 0 && 
fSelectionPivotPose) {
                // multi pose extend/shrink current selection
                bool select = !pose->IsSelected() || !extendSelection;
                        // This weird bit of logic causes the selection to 
always


Other related posts: