#include "console.h"
#include "error.h"
#include "qmp-commands.h"
+#include "tizen/src/debug_ch.h"
+
+MULTI_DEBUG_CHANNEL(tizen, input);
static QEMUPutKBDEvent *qemu_put_kbd_event;
static void *qemu_put_kbd_event_opaque;
if (QTAILQ_EMPTY(&mouse_handlers)) {
return;
}
-
+#if defined (CONFIG_MARU)
+ QTAILQ_FOREACH(entry, &mouse_handlers, node) {
+ /* if mouse event is wheelup ,wheeldown or move
+ then go to ps2 mouse event(index == 0) */
+ if((buttons_state > 3 && entry->index == 0)) {
+ INFO("input device: %s, event: %d\n", entry->qemu_put_mouse_event_name, buttons_state);
+ buttons_state = 0;
+ mouse_event = entry->qemu_put_mouse_event;
+ mouse_event_opaque = entry->qemu_put_mouse_event_opaque;
+ break;
+ }
+ }
+ /* other events(mouse up, down and drag), go to touch screen */
+ if(!entry) {
+ entry = QTAILQ_FIRST(&mouse_handlers);
+ mouse_event = entry->qemu_put_mouse_event;
+ mouse_event_opaque = entry->qemu_put_mouse_event_opaque;
+ INFO("input device: %s, event: %d\n", entry->qemu_put_mouse_event_name, buttons_state);
+ }
+#else
entry = QTAILQ_FIRST(&mouse_handlers);
mouse_event = entry->qemu_put_mouse_event;
mouse_event_opaque = entry->qemu_put_mouse_event_opaque;
-
+#endif
if (mouse_event) {
if (entry->qemu_put_mouse_event_absolute) {
width = 0x7fff;
MOUSE_DOWN = 1,
MOUSE_UP = 2,
MOUSE_DRAG = 3,
+ MOUSE_WHEELUP = 4,
+ MOUSE_WHEELDOWN = 5,
};
/* keep it consistent with emulator-skin definition */
import org.eclipse.swt.events.MouseMoveListener;
import org.eclipse.swt.events.MouseTrackAdapter;
import org.eclipse.swt.events.MouseTrackListener;
+import org.eclipse.swt.events.MouseWheelListener;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.events.SelectionAdapter;
//private DragDetectListener canvasDragDetectListener;
private MouseMoveListener canvasMouseMoveListener;
private MouseListener canvasMouseListener;
+ private MouseWheelListener canvasMouseWheelListener;
private KeyListener canvasKeyListener;
private MenuDetectListener canvasMenuDetectListener;
};
canvas.addMouseListener( canvasMouseListener );
+ canvasMouseWheelListener = new MouseWheelListener() {
+
+ @Override
+ public void mouseScrolled(MouseEvent e) {
+ int[] geometry = SkinUtil.convertMouseGeometry( e.x, e.y, currentLcdWidth, currentLcdHeight,
+ currentScale, currentAngle );
+ logger.info( "mousewheel in LCD" + " x:" + geometry[0] + " y:" + geometry[1] + " value:" + e.count);
+ int eventType;
+
+ if(e.count < 0)
+ eventType = MouseEventType.WHEELDOWN.value();
+ else
+ eventType = MouseEventType.WHEELUP.value();
+
+ MouseEventData mouseEventData = new MouseEventData( MouseButtonType.WHEEL.value(), eventType,
+ e.x, e.y, geometry[0], geometry[1], e.count );
+ communicator.sendToQEMU( SendCommand.SEND_MOUSE_EVENT, mouseEventData );
+ }
+ };
+
+ canvas.addMouseWheelListener( canvasMouseWheelListener );
+
+
canvasKeyListener = new KeyListener() {
if ( null != canvasMenuDetectListener ) {
lcdCanvas.removeMenuDetectListener( canvasMenuDetectListener );
}
+ if ( null != canvasMouseWheelListener ) {
+ lcdCanvas.removeMouseWheelListener( canvasMouseWheelListener );
+ }
}
public enum MouseEventType {
DOWN( (short)1 ),
UP( (short)2 ),
- DRAG( (short)3 );
+ DRAG( (short)3 ),
+ WHEELUP( (short)4 ),
+ WHEELDOWN( (short)5 );
private short value;
MouseEventType( short value ) {
#define TIMEOUT_FOR_SHUTDOWN 10 // seconds
static int requested_shutdown_qemu_gracefully = 0;
+static int guest_x, guest_y = 0;
static void* run_timed_shutdown_thread(void* args);
static void send_to_emuld(const char* request_type, int request_size, const char* send_buf, int buf_size);
#endif
/* single touch */
- if (MOUSE_DOWN == event_type || MOUSE_DRAG == event_type) {
- kbd_mouse_event(x, y, z, 1);
- } else if (MOUSE_UP == event_type) {
- kbd_mouse_event(x, y, z, 0);
- } else {
- ERR("undefined mouse event type:%d\n", event_type);
+ switch(event_type) {
+ case MOUSE_DOWN:
+ case MOUSE_DRAG:
+ guest_x = x;
+ guest_y = y;
+ kbd_mouse_event(x, y, z, 1);
+ TRACE("mouse_event event_type:%d, origin:(%d, %d), x:%d, y:%d, z:%d\n\n",
+ event_type, origin_x, origin_y, x, y, z);
+ break;
+ case MOUSE_UP:
+ guest_x = x;
+ guest_y = y;
+ kbd_mouse_event(x, y, z, 0);
+ TRACE("mouse_event event_type:%d, origin:(%d, %d), x:%d, y:%d, z:%d\n\n",
+ event_type, origin_x, origin_y, x, y, z);
+ break;
+ case MOUSE_WHEELUP:
+ case MOUSE_WHEELDOWN:
+ x -= guest_x;
+ y -= guest_y;
+ guest_x += x;
+ guest_y += y;
+ kbd_mouse_event(x, y, -z, event_type);
+ TRACE("mouse_event event_type:%d, origin:(%d, %d), x:%d, y:%d, z:%d\n\n",
+ event_type, origin_x, origin_y, x, y, z);
+ break;
+ default:
+ ERR("undefined mouse event type passed:%d\n", event_type);
+ break;
}
-
+
#if 0
#ifdef CONFIG_WIN32
Sleep(1);