Uint8 *target_pixel_a = (Uint8 *)surface->pixels + ((int)(cy + r - dy)) * surface->pitch + x * bpp;
Uint8 *target_pixel_b = (Uint8 *)surface->pixels + ((int)(cy - r + dy)) * surface->pitch + x * bpp;
- for (; x <= cx + dx; x++)
+ for ( ; x <= cx + dx; x++)
{
*(Uint32 *)target_pixel_a = pixel;
*(Uint32 *)target_pixel_b = pixel;
for (i = 0; i < mts->finger_cnt_max; i++) {
finger = get_finger_point_from_slot(i);
//finger->id = 0;
- finger->x = finger->y = -1;
+ finger->origin_x = finger->origin_y = finger->x = finger->y = -1;
}
mts->finger_point_size = DEFAULT_FINGER_POINT_SIZE; //temp
return get_emul_multi_touch_state()->multitouch_enable;
}
-static int _add_finger_point(int x, int y)
+static int _add_finger_point(int origin_x, int origin_y, int x, int y)
{
MultiTouchState *mts = get_emul_multi_touch_state();
mts->finger_cnt += 1;
mts->finger_slot[mts->finger_cnt - 1].id = mts->finger_cnt;
+ mts->finger_slot[mts->finger_cnt - 1].origin_x = origin_x;
+ mts->finger_slot[mts->finger_cnt - 1].origin_y = origin_y;
mts->finger_slot[mts->finger_cnt - 1].x = x;
mts->finger_slot[mts->finger_cnt - 1].y = y;
INFO("%d finger touching\n", mts->finger_cnt);
for (i = mts->finger_cnt - 1; i >= 0; i--) {
finger = get_finger_point_from_slot(i);
+
if (finger != NULL) {
if (x >= (finger->x - finger_point_size_half) &&
x < (finger->x + finger_point_size_half) &&
static int _grab_finger_id = 0;
#define QEMU_MOUSE_PRESSED 1
#define QEMU_MOUSE_RELEASEED 0
-void maru_finger_processing(int x, int y, int touch_type)
+void maru_finger_processing(int touch_type, int origin_x, int origin_y, int x, int y)
{
MultiTouchState *mts = get_emul_multi_touch_state();
FingerPoint *finger = NULL;
if (_grab_finger_id > 0) {
finger = get_finger_point_from_slot(_grab_finger_id - 1);
if (finger != NULL) {
+ finger->origin_x = origin_x;
+ finger->origin_y = origin_y;
finger->x = x;
finger->y = y;
if (finger->id != 0) {
if (mts->finger_cnt == 0)
{ //first finger touch input
- if (_add_finger_point(x, y) == -1) {
+ if (_add_finger_point(origin_x, origin_y, x, y) == -1) {
return;
}
kbd_mouse_event(x, y, 0, QEMU_MOUSE_PRESSED);
kbd_mouse_event(finger->x, finger->y, mts->finger_cnt_max - 1, 0);
#endif
+ finger->origin_x = origin_x;
+ finger->origin_y = origin_y;
finger->x = x;
finger->y = y;
if (finger->id != 0) {
}
else //one more finger
{
- _add_finger_point(x, y) ;
+ _add_finger_point(origin_x, origin_y, x, y) ;
kbd_mouse_event(x, y, mts->finger_cnt - 1, QEMU_MOUSE_PRESSED);
}
}
finger->id = 0;
- finger->x = finger->y = -1;
+ finger->origin_x = finger->origin_y = finger->x = finger->y = -1;
}
_grab_finger_id = 0;
typedef struct FingerPoint {
int id;
+ int origin_x;
+ int origin_y;
int x;
int y;
} FingerPoint;
int get_multi_touch_enable(void);
FingerPoint *get_finger_point_from_slot(int index);
FingerPoint *get_finger_point_search(int x, int y);
-void maru_finger_processing(int x, int y, int touch_type);
+void maru_finger_processing(int touch_type, int origin_x, int origin_y, int x, int y);
void clear_finger_slot(void);
void cleanup_multi_touch_state(void);
for (i = 0; i < mts->finger_cnt; i++) {
finger = get_finger_point_from_slot(i);
if (finger != NULL && finger->id != 0) {
- rect.x = (finger->x * get_emul_win_scale()) - finger_point_size_half;
- rect.y = (finger->y * get_emul_win_scale()) - finger_point_size_half;
+ rect.x = finger->origin_x - finger_point_size_half;
+ rect.y = finger->origin_y - finger_point_size_half;
rect.w = rect.h = mts->finger_point_size;
SDL_BlitSurface((SDL_Surface *)mts->finger_point_surface, NULL, surface_screen, &rect);
int[] geometry = SkinUtil.convertMouseGeometry( e.x, e.y, currentLcdWidth, currentLcdHeight,
currentScale, currentAngle );
- MouseEventData mouseEventData = new MouseEventData( eventType, geometry[0], geometry[1], 0 );
+ MouseEventData mouseEventData = new MouseEventData( eventType,
+ e.x, e.y, geometry[0], geometry[1], 0 );
communicator.sendToQEMU( SendCommand.SEND_MOUSE_EVENT, mouseEventData );
}
}
currentScale, currentAngle );
logger.info( "mouseUp in LCD" + " x:" + geometry[0] + " y:" + geometry[1] );
- MouseEventData mouseEventData = new MouseEventData( MouseEventType.UP.value(), geometry[0],
- geometry[1], 0 );
+ MouseEventData mouseEventData = new MouseEventData( MouseEventType.UP.value(),
+ e.x, e.y, geometry[0], geometry[1], 0 );
communicator.sendToQEMU( SendCommand.SEND_MOUSE_EVENT, mouseEventData );
if ( true == EmulatorSkin.this.isDragStartedInLCD ) {
EmulatorSkin.this.isDragStartedInLCD = false;
currentScale, currentAngle );
logger.info( "mouseDown in LCD" + " x:" + geometry[0] + " y:" + geometry[1] );
- MouseEventData mouseEventData = new MouseEventData( MouseEventType.DOWN.value(), geometry[0],
- geometry[1], 0 );
+ MouseEventData mouseEventData = new MouseEventData( MouseEventType.DOWN.value(),
+ e.x, e.y, geometry[0], geometry[1], 0 );
communicator.sendToQEMU( SendCommand.SEND_MOUSE_EVENT, mouseEventData );
if ( false == EmulatorSkin.this.isDragStartedInLCD ) {
EmulatorSkin.this.isDragStartedInLCD = true;
public class MouseEventData extends AbstractSendData {
int eventType;
+ int originX;
+ int originY;
int x;
int y;
int z;
- public MouseEventData(int eventType, int x, int y, int z) {
+ public MouseEventData(int eventType, int originX, int originY, int x, int y, int z) {
this.eventType = eventType;
+ this.originX = originX;
+ this.originY = originY;
this.x = x;
this.y = y;
this.z = z;
@Override
protected void write() throws IOException {
writeInt(eventType);
+ writeInt(originX);
+ writeInt(originY);
writeInt(x);
writeInt(y);
writeInt(z);
StringBuilder builder = new StringBuilder();
builder.append("MouseEventData [eventType=");
builder.append(eventType);
- builder.append(", x=");
+ builder.append(", originX=");
+ builder.append(originX);
+ builder.append(", originY=");
+ builder.append(originY);
+ builder.append(", transposeX=");
builder.append(x);
- builder.append(", y=");
+ builder.append(", transposeY=");
builder.append(y);
- builder.append(", z=");
+ builder.append(", id=");
builder.append(z);
builder.append("]");
return builder.toString();
maruskin_sdl_init(handle_id, lcd_size_width, lcd_size_height);
}
-void do_mouse_event( int event_type, int x, int y, int z )
+void do_mouse_event( int event_type, int origin_x, int origin_y, int x, int y, int z )
{
if( brightness_off ) {
TRACE( "reject mouse touch in lcd off : %d, x:%d, y:%d, z:%d\n", event_type, x, y, z );
return;
}
- TRACE( "mouse_event event_type:%d, x:%d, y:%d, z:%d\n", event_type, x, y, z );
+ TRACE( "mouse_event event_type:%d, origin:(%d, %d), x:%d, y:%d, z:%d\n", event_type, origin_x, origin_y, x, y, z );
if (get_emul_multi_touch_state()->multitouch_enable == 1) {
- maru_finger_processing(x, y, event_type);
+ maru_finger_processing(event_type, origin_x, origin_y, x, y);
}
else if ( MOUSE_DOWN == event_type || MOUSE_DRAG == event_type) { //single touch
kbd_mouse_event(x, y, z, 1);
void start_display(uint64 handle_id, int lcd_size_width, int lcd_size_height, double scale_factor, short rotation_type);
-void do_mouse_event( int event_type, int x, int y, int z );
+void do_mouse_event( int event_type, int origin_x, int origin_y, int x, int y, int z );
void do_key_event( int event_type, int keycode, int key_location );
/* keep it consistent with emulator-skin definition */
int event_type = 0;
+ int origin_x = 0;
+ int origin_y = 0;
int x = 0;
int y = 0;
int z = 0;
char* p = recvbuf;
memcpy( &event_type, p, sizeof( event_type ) );
p += sizeof( event_type );
+ memcpy( &origin_x, p, sizeof( origin_x ) );
+ p += sizeof( origin_x );
+ memcpy( &origin_y, p, sizeof( origin_y ) );
+ p += sizeof( origin_y );
memcpy( &x, p, sizeof( x ) );
p += sizeof( x );
memcpy( &y, p, sizeof( y ) );
memcpy( &z, p, sizeof( z ) );
event_type = ntohl( event_type );
+ origin_x = ntohl( origin_x );
+ origin_y = ntohl( origin_y );
x = ntohl( x );
y = ntohl( y );
z = ntohl( z );
- do_mouse_event( event_type, x, y, z );
+ do_mouse_event( event_type, origin_x, origin_y, x, y, z );
break;
}
case RECV_KEY_EVENT: {