[haiku-commits] Re: r38557 - haiku/trunk/src/apps/glteapot

  • From: "Stephan Assmus" <superstippi@xxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 07 Sep 2010 10:06:13 +0200

Hi,

> Author: phoudoin
> Date: 2010-09-07 09:51:26 +0200 (Tue, 07 Sep 2010)
> New Revision: 38557
> Changeset: http://dev.haiku-os.org/changeset/38557
> 
> Modified:
>    haiku/trunk/src/apps/glteapot/ObjectView.cpp
>    haiku/trunk/src/apps/glteapot/ObjectView.h
> Log:
> Change cursor to hint user an object can be dragged...

[...]
> @@ -165,6 +166,9 @@
>       quittingSem = create_sem(1, "quitting sem");
>       drawEvent = create_sem(0, "draw event");
>  
> +     fGrabbingCursor = new BCursor(B_CURSOR_ID_GRABBING);
> +     fGrabCursor = new BCursor(B_CURSOR_ID_GRAB);
> +
>       char findDir[PATH_MAX];
>       find_directory(B_SYSTEM_DATA_DIRECTORY, -1, true, findDir, PATH_MAX);
>       sprintf(teapotPath, "%s/%s", findDir, teapotData);
> @@ -178,6 +182,8 @@
>  {
>       delete_sem(quittingSem);
>       delete_sem(drawEvent);
> +     delete fGrabCursor;
> +     delete fGrabbingCursor;
>  }

[...]
> +
> +             SetViewCursor(fGrabCursor);

Note that the form:

                BCursor grabCursor(B_CURSOR_ID_GRAB)
                SetViewCursor(&grabCursor);

is very efficient and means a lot less changes and necessary book-keeping in 
the code. Only when using a custom cursor shape, is it more efficient to keep 
the BCursor instance around.

Best regards,
-Stephan

Other related posts: