int i;
MultiTouchState *mts = get_emul_multi_touch_state();
FingerPoint *finger = NULL;
- int finger_region = (mts->finger_point_size / 2) +
+ int finger_area = (mts->finger_point_size / 2) +
2 + (int)((1 - get_emul_win_scale()) * 4);
for (i = mts->finger_cnt - 1; i >= 0; i--) {
finger = get_finger_point_from_slot(i);
if (finger != NULL) {
- if (x >= (finger->x - finger_region) &&
- x < (finger->x + finger_region) &&
- y >= (finger->y - finger_region) &&
- y < (finger->y + finger_region)) {
+ if (x >= (finger->x - finger_area) &&
+ x < (finger->x + finger_area) &&
+ y >= (finger->y - finger_area) &&
+ y < (finger->y + finger_area)) {
return finger;
}
}
if (mts->finger_cnt == 0)
{ /* first finger touch input */
- INFO("multi-touch mode 1 processing");
+ INFO("multi-touch mode 1 processing\n");
if (add_finger_point(origin_x, origin_y, x, y) == -1) {
return;
/* bounds checking */
const int current_screen_w = get_emul_resolution_width();
const int current_screen_h = get_emul_resolution_height();
- int temp_finger_x, temp_finger_y;
for (i = 0; i < get_emul_multi_touch_state()->finger_cnt; i++) {
finger = get_finger_point_from_slot(i);
- if (finger == NULL) {
- continue;
- }
-
- temp_finger_x = finger->x + distance_x;
- temp_finger_y = finger->y + distance_y;
-
- if (temp_finger_x >= current_screen_w || temp_finger_x < 0
- || temp_finger_y >= current_screen_h || temp_finger_y < 0) {
- TRACE("id %d finger is out of bounds : (%d, %d)\n",
- i + 1, temp_finger_x, temp_finger_y);
- return;
+ if (finger != NULL) {
+ if (finger->x + distance_x >= current_screen_w ||
+ finger->x + distance_x < 0 ||
+ finger->y + distance_y >= current_screen_h ||
+ finger->y + distance_y < 0) {
+ TRACE("id %d finger is out of bounds : (%d, %d)\n",
+ i + 1, finger->x + distance_x, finger->y + distance_y);
+ /* do nothing */
+ return;
+ }
}
}
/* move */
for (i = 0; i < get_emul_multi_touch_state()->finger_cnt; i++) {
finger = get_finger_point_from_slot(i);
- if (finger == NULL) {
- continue;
- }
-
- finger->origin_x += origin_distance_x;
- finger->origin_y += origin_distance_y;
- finger->x += distance_x;
- finger->y += distance_y;
-
- if (finger->id != 0) {
- virtio_touchscreen_event(finger->x, finger->y,
- i, QEMU_MOUSE_PRESSED);
- TRACE("id %d finger multi-touch dragging : (%d, %d)\n",
- i + 1, finger->x, finger->y);
- }
+ if (finger != NULL) {
+ finger->origin_x += origin_distance_x;
+ finger->origin_y += origin_distance_y;
+ finger->x += distance_x;
+ finger->y += distance_y;
+
+ if (finger->id != 0) {
+ virtio_touchscreen_event(finger->x, finger->y,
+ i, QEMU_MOUSE_PRESSED);
+ TRACE("id %d finger multi-touch dragging : (%d, %d)\n",
+ i + 1, finger->x, finger->y);
+ }
#ifdef CONFIG_WIN32
- Sleep(1);
+ Sleep(1);
#else
- usleep(1000);
+ usleep(1000);
#endif
-
+ }
}
}
if (mts->finger_cnt == 0)
{ /* first finger touch input */
- INFO("multi-touch mode 2 processing");
+ INFO("multi-touch mode 2 processing\n");
if (add_finger_point(origin_x, origin_y, x, y) == -1) {
return;
(co_finger->y - distance_y) < 0) {
TRACE("id %d finger is out of bounds (%d, %d)\n",
co_finger->id, co_finger->x - distance_x, co_finger->y - distance_y);
+ /* do nothing */
return;
}
if (mts->finger_cnt == 0)
{ /* first finger touch input */
- INFO("multi-touch mode 3 processing");
+ INFO("multi-touch mode 3 processing\n");
if (add_finger_point(origin_x, origin_y, x, y) == -1) {
return;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.PaletteData;
+import org.eclipse.swt.graphics.Region;
import org.eclipse.swt.widgets.Display;
import org.tizen.emulator.skin.comm.ICommunicator.MouseButtonType;
import org.tizen.emulator.skin.comm.ICommunicator.MouseEventType;
private Logger logger =
SkinLogger.getSkinLogger(EmulatorFingers.class).getLogger();
+ private EmulatorShmSkin skin;
+ protected SocketCommunicator communicator;
+ private EmulatorSkinState currentState;
+
private int multiTouchEnable;
private int maxTouchPoint;
protected int fingerCnt;
protected int fingerPointSizeHalf;
protected Image fingerPointImage;
- protected SocketCommunicator communicator;
- private EmulatorSkinState currentState;
-
/**
* Constructor
*/
- EmulatorFingers(int maximum, EmulatorSkinState currentState,
- SocketCommunicator communicator, PaletteData palette) {
- this.currentState = currentState;
- this.communicator = communicator;
+ EmulatorFingers(EmulatorShmSkin skin, PaletteData palette, int maximum) {
+ this.skin = skin;
+ this.currentState = skin.currentState;
+ this.communicator = skin.communicator;
initMultiTouchState(maximum, palette);
}
public FingerPoint getFingerPointSearch(int x, int y) {
FingerPoint finger = null;
- int fingerRegion = fingerPointSize + 2;
- //logger.info("x: "+x+ "y: "+ y + " fingerRegion: " + fingerRegion);
+ int fingerArea = (fingerPointSize / 2) +
+ 2 + ((100 - skin.currentState.getCurrentScale()) * 4 / 100);
for (int i = fingerCnt - 1; i >= 0; i--) {
finger = getFingerPointFromSlot(i);
if (finger != null) {
- if (x >= (finger.x - fingerRegion) &&
- x < (finger.x + fingerRegion) &&
- y >= (finger.y - fingerRegion) &&
- y < (finger.y + fingerRegion)) {
+ if (x >= (finger.x - fingerArea) &&
+ x < (finger.x + fingerArea) &&
+ y >= (finger.y - fingerArea) &&
+ y < (finger.y + fingerArea)) {
return finger;
}
}
int i = 0;
/* bounds checking */
- final int currrntScreenW = currentState.getCurrentResolutionWidth();
- final int currrntScreenH = currentState.getCurrentResolutionHeight();
- int tempFingerX = 0, tempFingerY = 0;
-
- for (i = 0; i < fingerCnt; i++) {
- finger = getFingerPointFromSlot(i);
- if (finger != null) {
- tempFingerX = finger.x + distanceX;
- tempFingerY = finger.y + distanceY;
-
- if (tempFingerX >= currrntScreenW || tempFingerX < 0 ||
- tempFingerY >= currrntScreenH || tempFingerY < 0) {
- logger.info("id " + (i + 1) + " finger is out of bounds : ("
- + tempFingerX + ", " + tempFingerY + ")");
-
- return;
+ Region maskRegion = skin.getDisplayCanvas().getRegion();
+ if (maskRegion == null) {
+ final int currrntScreenW = currentState.getCurrentResolutionWidth();
+ final int currrntScreenH = currentState.getCurrentResolutionHeight();
+
+ for (i = 0; i < fingerCnt; i++) {
+ finger = getFingerPointFromSlot(i);
+ if (finger != null) {
+ if (finger.x + distanceX >= currrntScreenW ||
+ finger.x + distanceX < 0 ||
+ finger.y + distanceY >= currrntScreenH ||
+ finger.y + distanceY < 0) {
+ logger.info("id " + (i + 1) + " finger is out of bounds : (" +
+ (finger.x + distanceX) + ", " +
+ (finger.y + distanceY) + ")");
+ /* do nothing */
+ return;
+ }
+ }
+ }
+ } else {
+ for (i = 0; i < fingerCnt; i++) {
+ finger = getFingerPointFromSlot(i);
+ if (finger != null) {
+ if (maskRegion.contains(finger.x + distanceX,
+ finger.y + distanceY) == false) {
+ logger.info("id " + (i + 1) + " finger is out of bounds : (" +
+ (finger.x + distanceX) + ", " +
+ (finger.y + distanceY) + ")");
+ /* do nothing */
+ return;
+ }
}
}
}
(grabFingerID == 2) ? 0 : 1);
if (coFinger != null) {
/* bounds checking */
- final int currrntScreenW = currentState.getCurrentResolutionWidth();
- final int currrntScreenH = currentState.getCurrentResolutionHeight();
-
- if (coFinger.x - distanceX >= currrntScreenW ||
- coFinger.x - distanceX < 0 ||
- coFinger.y - distanceY >= currrntScreenH ||
- coFinger.y - distanceY < 0) {
- logger.info("id " + coFinger.id + " finger is out of bounds : ("
- + (coFinger.x - distanceX) + ", " + (coFinger.y - distanceY) + ")");
- return;
+ Region maskRegion = skin.getDisplayCanvas().getRegion();
+ if (maskRegion == null) {
+ final int currrntScreenW = currentState.getCurrentResolutionWidth();
+ final int currrntScreenH = currentState.getCurrentResolutionHeight();
+
+ if (coFinger.x - distanceX >= currrntScreenW ||
+ coFinger.x - distanceX < 0 ||
+ coFinger.y - distanceY >= currrntScreenH ||
+ coFinger.y - distanceY < 0) {
+ logger.info("id " + coFinger.id + " finger is out of bounds : (" +
+ (coFinger.x - distanceX) + ", " +
+ (coFinger.y - distanceY) + ")");
+ /* do nothing */
+ return;
+ }
+ } else {
+ if (maskRegion.contains(coFinger.x - distanceX,
+ coFinger.y - distanceY) == false) {
+ logger.info("id " + coFinger.id + " finger is out of bounds : (" +
+ (coFinger.x - distanceX) + ", " +
+ (coFinger.y - distanceY) + ")");
+ /* do nothing */
+ return;
+ }
}
/* move */