[haiku-commits] haiku: hrev53778 - src/apps/deskcalc docs/user/interface

  • From: Adrien Destugues <pulkomandy@xxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sun, 26 Jan 2020 05:24:22 -0500 (EST)

hrev53778 adds 2 changesets to branch 'master'
old head: 190d0372b3f4620f91b6d34e09a42819f8dc44ee
new head: edb3467aca7e356b7a50a6508ae574d89c2c98f3
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=edb3467aca7e+%5E190d0372b3f4

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

f8969c78e533: DeskCalc: use an autolock to simplify clipboard handling.

edb3467aca7e: BView::DrawBitmap: document "options" parameter

                             [ Adrien Destugues <pulkomandy@xxxxxxxxxxxxx> ]

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

2 files changed, 13 insertions(+), 7 deletions(-)
docs/user/interface/View.dox   |  2 +-
src/apps/deskcalc/CalcView.cpp | 18 ++++++++++++------

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

Commit:      f8969c78e533f608ddc3192e05fb9e4258451cc6
URL:         https://git.haiku-os.org/haiku/commit/?id=f8969c78e533
Author:      Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Date:        Sun Jan 26 10:23:41 2020 UTC

DeskCalc: use an autolock to simplify clipboard handling.

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

diff --git a/src/apps/deskcalc/CalcView.cpp b/src/apps/deskcalc/CalcView.cpp
index a845ccf100..e376d524ba 100644
--- a/src/apps/deskcalc/CalcView.cpp
+++ b/src/apps/deskcalc/CalcView.cpp
@@ -23,6 +23,7 @@
 #include <Alert.h>
 #include <Application.h>
 #include <AppFileInfo.h>
+#include <AutoLocker.h>
 #include <Beep.h>
 #include <Bitmap.h>
 #include <Catalog.h>
@@ -174,6 +175,9 @@ struct CalcView::CalcKey {
 };
 
 
+typedef AutoLocker<BClipboard> ClipboardLocker;
+
+
 CalcView*
 CalcView::Instantiate(BMessage* archive)
 {
@@ -344,14 +348,16 @@ CalcView::MessageReceived(BMessage* message)
 
                        // handle paste
                        case B_PASTE:
+                       {
                                // access system clipboard
-                               if (be_clipboard->Lock()) {
+                               ClipboardLocker locker(be_clipboard);
+                               if (locker.Lock()) {
                                        BMessage* clipper = 
be_clipboard->Data();
-                                       //clipper->PrintToStream();
-                                       Paste(clipper);
-                                       be_clipboard->Unlock();
+                                       if (clipper)
+                                               Paste(clipper);
                                }
                                break;
+                       }
 
                        // (replicant) about box requested
                        case B_ABOUT_REQUESTED:
@@ -802,7 +808,8 @@ void
 CalcView::Copy()
 {
        // access system clipboard
-       if (!be_clipboard->Lock())
+       ClipboardLocker locker(be_clipboard);
+       if (!locker.Lock())
                return;
        if (be_clipboard->Clear() != B_OK)
                return;
@@ -818,7 +825,6 @@ CalcView::Copy()
                clipper->what = B_MIME_DATA;
                be_clipboard->Commit();
        }
-       be_clipboard->Unlock();
 }
 
 

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

Revision:    hrev53778
Commit:      edb3467aca7e356b7a50a6508ae574d89c2c98f3
URL:         https://git.haiku-os.org/haiku/commit/?id=edb3467aca7e
Author:      Adrien Destugues <pulkomandy@xxxxxxxxxxxxx>
Date:        Sun Jan 26 10:24:04 2020 UTC

BView::DrawBitmap: document "options" parameter

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

diff --git a/docs/user/interface/View.dox b/docs/user/interface/View.dox
index beee4008db..12f8a29ba8 100644
--- a/docs/user/interface/View.dox
+++ b/docs/user/interface/View.dox
@@ -2764,7 +2764,7 @@ SetViewColor(Parent()->ViewColor());
               coordinate system.
        \param viewRect The area in the view's coordinate system to draw the
               bitmap in.
-       \param options ??
+       \param options combination of \a bitmap_drawing_options flags
 
        \since Haiku R1
 */


Other related posts: