Refactored PointerController to extract the surface management code to a new component called a SpriteController so that it can be used to move finger tracking spots around the screen as well. The SpriteController is designed to fully decouple the client from any latency introduced by surface transactions and drawing. All sprite updates are performed asynchronously on the Looper using a copy of the sprite state. Added a stub SpotController implementation for touch pad UX. It will be implemented in a subsequent patch. Fixed a little bug in pointer orientation changes when entering DISPLAY_ORIENTATION_90 the x offset was clobbered. Change-Id: Ib25d162d577c9b354cb74d5d761c3c9f9f438d42
72 lines
1.7 KiB
C++
72 lines
1.7 KiB
C++
/*
|
|
* Copyright (C) 2011 The Android Open Source Project
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
#ifndef _UI_SPOT_CONTROLLER_H
|
|
#define _UI_SPOT_CONTROLLER_H
|
|
|
|
#include "SpriteController.h"
|
|
|
|
#include <utils/RefBase.h>
|
|
#include <utils/Looper.h>
|
|
|
|
#include <SkBitmap.h>
|
|
|
|
namespace android {
|
|
|
|
/*
|
|
* Interface for displaying spots on screen that visually represent the positions
|
|
* of fingers on a touch pad.
|
|
*
|
|
* The spot controller is responsible for providing synchronization and for tracking
|
|
* display orientation changes if needed.
|
|
*/
|
|
class SpotControllerInterface : public virtual RefBase {
|
|
protected:
|
|
SpotControllerInterface() { }
|
|
virtual ~SpotControllerInterface() { }
|
|
|
|
public:
|
|
|
|
};
|
|
|
|
|
|
/*
|
|
* Sprite-based spot controller implementation.
|
|
*/
|
|
class SpotController : public SpotControllerInterface, public MessageHandler {
|
|
protected:
|
|
virtual ~SpotController();
|
|
|
|
public:
|
|
SpotController(const sp<Looper>& looper, const sp<SpriteController>& spriteController);
|
|
|
|
private:
|
|
mutable Mutex mLock;
|
|
|
|
sp<Looper> mLooper;
|
|
sp<SpriteController> mSpriteController;
|
|
sp<WeakMessageHandler> mHandler;
|
|
|
|
struct Locked {
|
|
} mLocked;
|
|
|
|
void handleMessage(const Message& message);
|
|
};
|
|
|
|
} // namespace android
|
|
|
|
#endif // _UI_SPOT_CONTROLLER_H
|