Exemplo n.º 1
0
void EventSenderProxy::keyDown(WKStringRef keyRef, WKEventModifiers wkModifiers, unsigned location)
{
    const RefPtr<KeyEventInfo> keyEventInfo = (location == DOMKeyLocationNumpad) ? keyPadName(keyRef) : keyName(keyRef);
    if (!keyEventInfo)
        return;

    const char* keyName = keyEventInfo->keyName.data();
    const char* keyString = keyEventInfo->keyString.data();

    // Enforce 'Shift' modifier for caps.
    if ((strlen(keyName) == 1) && (keyName[0] >= 'A' && keyName[0] <= 'Z'))
        wkModifiers |= kWKEventModifiersShiftKey;

    Evas* evas = evas_object_evas_get(m_testController->mainWebView()->platformView());

    int eventIndex = 0;
    // Mimic the emacs ctrl-o binding by inserting a paragraph
    // separator and then putting the cursor back to its original
    // position. Allows us to pass emacs-ctrl-o.html
    if ((wkModifiers & kWKEventModifiersControlKey) && !strcmp(keyName, "o")) {
        setEvasModifiers(evas, 0);
        evas_event_feed_key_down(evas, "Return", "Return", "\r", 0, eventIndex++, 0);
        evas_event_feed_key_up(evas, "Return", "Return", "\r", 0, eventIndex++, 0);
        wkModifiers = 0;
        keyName = "Left";
        keyString = 0;
    }

    setEvasModifiers(evas, wkModifiers);
    evas_event_feed_key_down(evas, keyName, keyName, keyString, 0, eventIndex++, 0);
    evas_event_feed_key_up(evas, keyName, keyName, keyString, 0, eventIndex++, 0);
    setEvasModifiers(evas, 0);
}
Exemplo n.º 2
0
void PlatformWebView::simulateSpacebarKeyPress()
{
    Evas* evas = evas_object_evas_get(m_view);
    evas_object_focus_set(m_view, true);
    evas_event_feed_key_down(evas, "space", "space", " ", 0, 0, 0);
    evas_event_feed_key_up(evas, "space", "space", " ", 0, 1, 0);
}
Exemplo n.º 3
0
static Eina_Bool
_ecore_event_evas_key(Ecore_Event_Key *e, Ecore_Event_Press press)
{
   Ecore_Input_Window *lookup;

   lookup = _ecore_event_window_match(e->event_window);
   if (!lookup) return ECORE_CALLBACK_RENEW;
   ecore_event_evas_modifier_lock_update(lookup->evas, e->modifiers);
   if (press == ECORE_DOWN)
     evas_event_feed_key_down(lookup->evas, e->keyname, e->key, e->string, e->compose, e->timestamp, NULL);
   else
     evas_event_feed_key_up(lookup->evas, e->keyname, e->key, e->string, e->compose, e->timestamp, NULL);
   return ECORE_CALLBACK_RENEW;
}
Exemplo n.º 4
0
static Eina_Bool
event_key_down(void *data, int type, void *event)
{
    Ecore_Event_Key *e;
    e = event;
    /*
       HACK !
       If e->window is the same than enna winid, don't manage this event
       ecore_evas_x will do this for us.
       But if e->window is different than enna winid event are sent to
       libplayer subwindow and we must broadcast this event to Evas
    */
    if (e->window != enna->ee_winid)
    {
        enna_log(ENNA_MSG_EVENT, NULL,
                 "Ecore_Event_Key_Down %s", e->keyname);
        evas_event_feed_key_down(enna->evas, e->keyname, e->key,
                                 e->compose, NULL, e->timestamp, NULL);
    }

    return 1;
}
Exemplo n.º 5
0
void
engine_gl_sdl_loop(void)
{
   SDL_Event event;

   while(SDL_PollEvent(&event))
     {
        switch(event.type)
          {
          case SDL_MOUSEMOTION:
             evas_event_feed_mouse_move(evas, event.motion.x, event.motion.y, 0, NULL);
             break;
          case SDL_MOUSEBUTTONDOWN:
             evas_event_feed_mouse_move(evas, event.button.x, event.button.y, 0, NULL);
             evas_event_feed_mouse_down(evas, event.button.state, EVAS_BUTTON_NONE, 0, NULL);
             break;
          case SDL_MOUSEBUTTONUP:
             evas_event_feed_mouse_move(evas, event.button.x, event.button.y, 0, NULL);
             evas_event_feed_mouse_up(evas, event.button.state, EVAS_BUTTON_NONE, 0, NULL);
             break;
          case SDL_VIDEORESIZE:
             evas_output_viewport_set(evas, 0, 0,
                                      event.resize.w, event.resize.w);
             evas_output_size_set(evas, event.resize.w, event.resize.w);
             evas_output_size_get(evas, &win_w, &win_h);
             break;
          case SDL_VIDEOEXPOSE:
             evas_output_size_get(evas, &win_w, &win_h);
             evas_damage_rectangle_add(evas, 0, 0, win_w, win_h);
             break;
          case SDL_KEYDOWN:
             switch (event.key.keysym.sym)
               {
               case SDLK_LSHIFT:
               case SDLK_RSHIFT:
                  evas_key_modifier_on(evas, "Shift");
                  break;
               case SDLK_RCTRL:
               case SDLK_LCTRL:
                  evas_key_modifier_on(evas, "Control");
                  break;
               case SDLK_MENU:
               case SDLK_RALT:
               case SDLK_LALT:
                  evas_key_modifier_on(evas, "Alt");
                  break;
               case SDLK_LSUPER:
               case SDLK_RSUPER:
                  evas_key_modifier_on(evas, "Super");
                  break;
               case SDLK_CAPSLOCK:
                  if (evas_key_lock_is_set(evas_key_lock_get(evas), "Caps_Lock"))
                    evas_key_lock_off(evas, "Caps_Lock");
                  else
                    evas_key_lock_on(evas, "Caps_Lock");
                  break;
               case SDLK_NUMLOCK:
                  if (evas_key_lock_is_set(evas_key_lock_get(evas), "Num_Lock"))
                    evas_key_lock_off(evas, "Num_Lock");
                  else
                    evas_key_lock_on(evas, "Num_Lock");
                  break;
               case SDLK_SCROLLOCK:
                  if (evas_key_lock_is_set(evas_key_lock_get(evas), "Scroll_Lock"))
                    evas_key_lock_off(evas, "Scroll_Lock");
                  else
                    evas_key_lock_on(evas, "Scroll_Lock");
                  break;
               case SDLK_s:
               case SDLK_ESCAPE:
                  evas_event_feed_key_down(evas, "Escape", "Escape", NULL, NULL, 0, NULL);
                  break;
               case SDLK_KP_ENTER:
               case SDLK_RETURN:
                  evas_event_feed_key_down(evas, "Return", "Return", NULL, NULL, 0, NULL);
                  break;
               case SDLK_LEFT: evas_event_feed_key_down(evas, "Left", "Left", NULL, NULL, 0, NULL); break;
               case SDLK_RIGHT: evas_event_feed_key_down(evas, "Right", "Right", NULL, NULL, 0, NULL); break;
               case SDLK_q:
                  if (evas_key_lock_is_set(evas_key_lock_get(evas), "Caps_Lock"))
                    evas_event_feed_key_down(evas, "Q", "Q", NULL, NULL, 0, NULL);
                  else
                    evas_event_feed_key_down(evas, "q", "q", NULL, NULL, 0, NULL);
                  break;
	       default:
		  break;
               }
             break;
          case SDL_KEYUP:
             switch (event.key.keysym.sym)
               {
               case SDLK_LSHIFT:
               case SDLK_RSHIFT:
                  evas_key_modifier_off(evas, "Shift");
                  break;
               case SDLK_RCTRL:
               case SDLK_LCTRL:
                  evas_key_modifier_off(evas, "Control");
                  break;
               case SDLK_MENU:
               case SDLK_RALT:
               case SDLK_LALT:
                  evas_key_modifier_off(evas, "Alt");
                  break;
               case SDLK_LSUPER:
               case SDLK_RSUPER:
                  evas_key_modifier_off(evas, "Super");
                  break;
               case SDLK_ESCAPE: evas_event_feed_key_up(evas, "Escape", "Escape", NULL, NULL, 0, NULL); break;
               case SDLK_RETURN: evas_event_feed_key_up(evas, "Return", "Return", NULL, NULL, 0, NULL); break;
               case SDLK_LEFT: evas_event_feed_key_up(evas, "Left", "Left", NULL, NULL, 0, NULL); break;
               case SDLK_RIGHT: evas_event_feed_key_up(evas, "Right", "Right", NULL, NULL, 0, NULL); break;
               case SDLK_q:
                  if (evas_key_lock_is_set(evas_key_lock_get(evas), "Caps_Lock"))
                    evas_event_feed_key_up(evas, "Q", "Q", NULL, NULL, 0, NULL);
                  else
                    evas_event_feed_key_up(evas, "q", "q", NULL, NULL, 0, NULL);
                  break;
	       default:
		  break;
               }
             break;
          case SDL_QUIT:
          case SDL_SYSWMEVENT:
          case SDL_USEREVENT:
          case SDL_ACTIVEEVENT:
          case SDL_JOYAXISMOTION:
          case SDL_JOYBALLMOTION:
          case SDL_JOYHATMOTION:
          case SDL_JOYBUTTONDOWN:
          case SDL_JOYBUTTONUP:
          default:
             break;
          }
     }
}
Exemplo n.º 6
0
void
engine_software_16_x11_loop(void)
{
   XEvent ev;
   KeySym ks;
   char *kstr;

   again:
   if (!XCheckMaskEvent(disp,
			ExposureMask |
			StructureNotifyMask |
			KeyPressMask |
			KeyReleaseMask |
			ButtonPressMask |
			ButtonReleaseMask |
			PointerMotionMask |
			EnterWindowMask |
			LeaveWindowMask, &ev))
     return;
   switch (ev.type)
     {
      case ButtonPress:
	evas_event_feed_mouse_move(evas, ev.xbutton.x, ev.xbutton.y, 0, NULL);
	evas_event_feed_mouse_down(evas, ev.xbutton.button, EVAS_BUTTON_NONE, 0, NULL);
	break;
      case ButtonRelease:
	evas_event_feed_mouse_move(evas, ev.xbutton.x, ev.xbutton.y, 0, NULL);
	evas_event_feed_mouse_up(evas, ev.xbutton.button, EVAS_BUTTON_NONE, 0, NULL);
	break;
      case MotionNotify:
	evas_event_feed_mouse_move(evas, ev.xmotion.x, ev.xmotion.y, 0, NULL);
	break;
      case Expose:
        first_expose = 1;
	evas_damage_rectangle_add(evas,
				  ev.xexpose.x,
				  ev.xexpose.y,
				  ev.xexpose.width,
				  ev.xexpose.height);
	break;
      case ConfigureNotify:
        evas_output_viewport_set(evas, 0, 0,
                                 ev.xconfigure.width,
                                 ev.xconfigure.height);
	evas_output_size_set(evas,
			     ev.xconfigure.width,
			     ev.xconfigure.height);
        win_w = ev.xconfigure.width;
        win_h = ev.xconfigure.height;
	break;
      case EnterNotify:
	evas_event_feed_mouse_in(evas, 0, NULL);
	break;
      case LeaveNotify:
	evas_event_feed_mouse_out(evas, 0, NULL);
	break;
      case KeyPress:
	ks = XKeycodeToKeysym(ev.xkey.display, ev.xkey.keycode, 0);
	kstr = XKeysymToString(ks);
	if (kstr)
	  {
	     if ((!strcmp(kstr, "Shift_L")) ||
		 (!strcmp(kstr, "Shift_R")))
	       evas_key_modifier_on(evas, "Shift");
	     if ((!strcmp(kstr, "Control_L")) ||
		 (!strcmp(kstr, "Control_R")))
	       evas_key_modifier_on(evas, "Control");
	     if ((!strcmp(kstr, "Alt_L")) ||
		 (!strcmp(kstr, "Alt_R")))
	       evas_key_modifier_on(evas, "Alt");
	     if ((!strcmp(kstr, "Super_L")) ||
		 (!strcmp(kstr, "Super_R")))
	       evas_key_modifier_on(evas, "Super");
	     if (!strcmp(kstr, "Caps_Lock"))
	       {
		  if (evas_key_lock_is_set(evas_key_lock_get(evas), "Caps_Lock"))
		    evas_key_lock_off(evas, "Caps_Lock");
		  else
		    evas_key_lock_on(evas, "Caps_Lock");
	       }
	     if (!strcmp(kstr, "Num_Lock"))
	       {
		  if (evas_key_lock_is_set(evas_key_lock_get(evas), "Num_Lock"))
		    evas_key_lock_off(evas, "Num_Lock");
		  else
		    evas_key_lock_on(evas, "Num_Lock");
	       }
	     if (!strcmp(kstr, "Scroll_Lock"))
	       {
		  if (evas_key_lock_is_set(evas_key_lock_get(evas), "Scroll_Lock"))
		    evas_key_lock_off(evas, "Scroll_Lock");
		  else
		    evas_key_lock_on(evas, "Scroll_Lock");
	       }
	     if (kstr) evas_event_feed_key_down(evas, kstr, kstr, NULL, NULL, 0, NULL);
	  }
	break;
      case KeyRelease:
	ks = XKeycodeToKeysym(ev.xkey.display, ev.xkey.keycode, 0);
	kstr = XKeysymToString(ks);
	if (kstr)
	  {
	     if ((!strcmp(kstr, "Shift_L")) ||
		 (!strcmp(kstr, "Shift_R")))
	       evas_key_modifier_off(evas, "Shift");
	     if ((!strcmp(kstr, "Control_L")) ||
		 (!strcmp(kstr, "Control_R")))
	       evas_key_modifier_off(evas, "Control");
	     if ((!strcmp(kstr, "Alt_L")) ||
		 (!strcmp(kstr, "Alt_R")))
	       evas_key_modifier_off(evas, "Alt");
	     if ((!strcmp(kstr, "Super_L")) ||
		 (!strcmp(kstr, "Super_R")))
	       evas_key_modifier_off(evas, "Super");
	     evas_event_feed_key_up(evas, kstr, kstr, NULL, NULL, 0, NULL);
	  }
	break;
      default:
	break;
     }
   goto again;
}
Exemplo n.º 7
0
static void
engine_directfb_event_window(const DFBWindowEvent *ev)
{
   DBG("===> Window Event (type=%#10x, window=%d) <===\n",
       ev->type, ev->window_id);

   if (ev->type & DWET_POSITION)
     {
	DBG("\tDWET_POSITION %d, %d\n", ev->x, ev->y);
     }

   if (ev->type & DWET_SIZE)
     {
	DBG("\tDWET_SIZE %dx%d\n", ev->w, ev->h);
        evas_output_viewport_set(evas, 0, 0,
                                 ev->w, ev->h);
        evas_output_size_set(evas, ev->w, ev->h);
        win_w = ev->w;
        win_h = ev->h;
     }

   if (ev->type & DWET_CLOSE)
     {
	DBG("\tDWET_CLOSE\n");
	engine_directfb_quit();
     }

   if (ev->type & DWET_DESTROYED)
     {
	DBG("\tDWET_DESTROYED\n");
	engine_directfb_quit();
     }

   if (ev->type & DWET_GOTFOCUS)
     {
	DBG("\tDWET_GOTFOCUS\n");
     }

   if (ev->type & DWET_LOSTFOCUS)
     {
	DBG("\tDWET_LOSTFOCUS\n");
     }

   if (ev->type & DWET_KEYDOWN)
     {
	const char *k;

	k = key_string(ev->key_symbol);
	DBG("\tDWET_KEYDOWN key_symbol=%s\n", k);

	if (k)
	  evas_event_feed_key_down(evas, k, k, NULL, NULL, 0, NULL);
     }

   if (ev->type & DWET_KEYUP)
     {
	const char *k;

	k = key_string(ev->key_symbol);
	DBG("\tDWET_KEYUP key_symbol=%s\n", k);

	if (k)
	  evas_event_feed_key_up(evas, k, k, NULL, NULL, 0, NULL);
     }

   if (ev->type & DWET_BUTTONDOWN)
     {
	DBG("\tDWET_BUTTONDOWN pos=(%d, %d) cur_pos=(%d, %d) "
	    "button=%#x buttons=%#x\n",
	    ev->x, ev->y, ev->cx, ev->cy, ev->button, ev->buttons);
	evas_event_feed_mouse_move(evas, ev->cx, ev->cy, 0, NULL);
	evas_event_feed_mouse_down(evas, ev->button, EVAS_BUTTON_NONE, 0, NULL);
     }

   if (ev->type & DWET_BUTTONUP)
     {
	DBG("\tDWET_BUTTONUP pos=(%d, %d) cur_pos=(%d, %d) "
	    "button=%#x buttons=%#x\n",
	    ev->x, ev->y, ev->cx, ev->cy, ev->button, ev->buttons);
	evas_event_feed_mouse_move(evas, ev->cx, ev->cy, 0, NULL);
	evas_event_feed_mouse_up(evas, ev->button, EVAS_BUTTON_NONE, 0, NULL);
     }

   if (ev->type & DWET_MOTION)
     {
	DBG("\tDWET_MOTION pos=(%d, %d) cur_pos=(%d, %d) buttons=%#x\n",
	    ev->x, ev->y, ev->cx, ev->cy, ev->buttons);
	/* Mouse Motion Compression [tm] */
	_layer->GetCursorPosition( _layer, (int*)&ev->x, (int*)&ev->y );

	evas_event_feed_mouse_move(evas, ev->x, ev->y, 0, NULL);
     }

   if (ev->type & DWET_LEAVE)
     {
	DBG("\tDWET_LEAVE pos=(%d, %d) cur_pos=(%d, %d)\n",
	    ev->x, ev->y, ev->cx, ev->cy);
	evas_event_feed_mouse_out(evas, 0, NULL);
     }

   if (ev->type & DWET_ENTER)
     {
	DBG("\tDWET_ENTER pos=(%d, %d) cur_pos=(%d, %d)\n",
	    ev->x, ev->y, ev->cx, ev->cy);
	evas_event_feed_mouse_in(evas, 0, NULL);
     }

   if (ev->type & DWET_WHEEL)
     {
	DBG("\tDWET_WHEEL step=%d\n", ev->step);
     }


   DBG("\n");
}
Exemplo n.º 8
0
static LRESULT CALLBACK
MainWndProc(HWND   hwnd,
            UINT   uMsg,
            WPARAM wParam,
            LPARAM lParam)
{
   switch (uMsg)
     {
     case WM_CREATE:
       return 0;
     case WM_DESTROY:
       PostQuitMessage(0);
       return 0;
     case WM_CLOSE:
       PostQuitMessage(0);
       return 0;
     case WM_WINDOWPOSCHANGED: {
       PAINTSTRUCT ps;
       HDC hdc;

       hdc = BeginPaint (window, &ps);
       evas_damage_rectangle_add(evas,
                                 ps.rcPaint.left, ps.rcPaint.top,
                                 ps.rcPaint.right - ps.rcPaint.left,
                                 ps.rcPaint.bottom - ps.rcPaint.top);
       EndPaint(window, &ps);
       return 0;
     }
     case WM_SIZING:
       {
          PRECT rect = (PRECT)lParam;

          evas_output_viewport_set(evas, 0, 0,
                                   rect->right - rect->left,
                                   rect->bottom - rect->top);
          evas_output_size_set(evas,
                               rect->right - rect->left,
                               rect->bottom - rect->top);
          win_w = rect->right - rect->left;
          win_h = rect->bottom - rect->top;
          return 0;
       }
     case WM_RBUTTONDOWN:
       evas_event_feed_mouse_move(evas, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0, NULL);
       evas_event_feed_mouse_down(evas, 3, EVAS_BUTTON_NONE, 0, NULL);
       return 0;
     case WM_LBUTTONDOWN:
       evas_event_feed_mouse_move(evas, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0, NULL);
       evas_event_feed_mouse_down(evas, 1, EVAS_BUTTON_NONE, 0, NULL);
       return 0;
     case WM_LBUTTONUP:
       evas_event_feed_mouse_move(evas, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0, NULL);
       evas_event_feed_mouse_up(evas, 1, EVAS_BUTTON_NONE, 0, NULL);
       return 0;
     case WM_RBUTTONUP:
       evas_event_feed_mouse_move(evas, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0, NULL);
       evas_event_feed_mouse_up(evas, 3, EVAS_BUTTON_NONE, 0, NULL);
       return 0;
     case WM_MOUSEMOVE:
       if (!evas_pointer_inside_get(evas)) evas_event_feed_mouse_in(evas, 0, NULL);
       evas_event_feed_mouse_move(evas, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam), 0, NULL);
       return 0;
     case WM_MOUSELEAVE:
       evas_event_feed_mouse_out(evas, 0, NULL);
       return 0;
       /* FIXME : can't find an event when the mouse is entering */
     case WM_KEYDOWN:
     case WM_SYSKEYDOWN: {
        int key;

        key = LOWORD(wParam);

        if ((key == VK_SHIFT) ||
            (key == VK_LSHIFT) ||
            (key == VK_RSHIFT))
          evas_key_modifier_on(evas, "Shift");
        if ((key == VK_CONTROL) ||
            (key == VK_LCONTROL) ||
            (key == VK_RCONTROL))
          evas_key_modifier_on(evas, "Control");
        if ((key == VK_MENU) ||
            (key == VK_LMENU) ||
            (key == VK_RMENU))
          evas_key_modifier_on(evas, "Alt");
        if ((key == VK_LWIN) ||
            (key == VK_RWIN))
          evas_key_modifier_on(evas, "Super");

        if (key == VK_CAPITAL)
          {
             if (evas_key_lock_is_set(evas_key_lock_get(evas), "Caps_Lock"))
               evas_key_lock_off(evas, "Caps_Lock");
             else
               evas_key_lock_on(evas, "Caps_Lock");
          }
        if (key == VK_NUMLOCK)
          {
             if (evas_key_lock_is_set(evas_key_lock_get(evas), "Num_Lock"))
               evas_key_lock_off(evas, "Num_Lock");
             else
               evas_key_lock_on(evas, "Num_Lock");
          }
        if (key == VK_SCROLL)
          {
             if (evas_key_lock_is_set(evas_key_lock_get(evas), "Scroll_Lock"))
               evas_key_lock_off(evas, "Scroll_Lock");
             else
               evas_key_lock_on(evas, "Scroll_Lock");
          }
        if (key == VK_ESCAPE)
          evas_event_feed_key_down(evas, "Escape", "Escape", NULL, NULL, 0, NULL);
        if (key == VK_RETURN)
          evas_event_feed_key_down(evas, "Return", "Return", NULL, NULL, 0, NULL);
        if (key == VK_LEFT)
          evas_event_feed_key_down(evas, "Left", "Left", NULL, NULL, 0, NULL);
        if (key == VK_RIGHT)
          evas_event_feed_key_down(evas, "Right", "Right", NULL, NULL, 0, NULL);
        if (key == 81)
          evas_event_feed_key_down(evas, "Q", "Q", NULL, NULL, 0, NULL);
        if (key == 113)
          evas_event_feed_key_down(evas, "q", "q", NULL, NULL, 0, NULL);
        return 0;
     }
     case WM_KEYUP:
     case WM_SYSKEYUP: {
        int key;

        key = LOWORD(wParam);

        if ((key == VK_SHIFT) ||
            (key == VK_LSHIFT) ||
            (key == VK_RSHIFT))
          evas_key_modifier_off(evas, "Shift");
        if ((key == VK_CONTROL) ||
            (key == VK_LCONTROL) ||
            (key == VK_RCONTROL))
          evas_key_modifier_off(evas, "Control");
        if ((key == VK_MENU) ||
            (key == VK_LMENU) ||
            (key == VK_RMENU))
          evas_key_modifier_off(evas, "Alt");
        if ((key == VK_LWIN) ||
            (key == VK_RWIN))
          evas_key_modifier_off(evas, "Super");
        if (key == VK_ESCAPE)
          evas_event_feed_key_up(evas, "Escape", "Escape", NULL, NULL, 0, NULL);
        if (key == VK_RETURN)
          evas_event_feed_key_up(evas, "Return", "Return", NULL, NULL, 0, NULL);
        if (key == VK_LEFT)
          evas_event_feed_key_up(evas, "Left", "Left", NULL, NULL, 0, NULL);
        if (key == VK_RIGHT)
          evas_event_feed_key_up(evas, "Right", "Right", NULL, NULL, 0, NULL);
        if (key == 81)
          evas_event_feed_key_up(evas, "Q", "Q", NULL, NULL, 0, NULL);
        if (key == 113)
          evas_event_feed_key_up(evas, "q", "q", NULL, NULL, 0, NULL);
        return 0;
     }
     default:
       return DefWindowProc(hwnd, uMsg, wParam, lParam);
     }
}
Exemplo n.º 9
0
static Eina_Bool
tsuite_feed_event(void *data)
{
   static Ecore_Timer *tmr = NULL;
   Timer_Data *td = data;
   time_t evt_time;
   if (!td)
     return ECORE_CALLBACK_CANCEL;

   Variant_st *v = eina_list_data_get(td->current_event);
   switch(tsuite_event_mapping_type_get(v->t.type))
     {
      case TSUITE_EVENT_MOUSE_IN:
           {
              mouse_in_mouse_out *t = v->data;
              evt_time = t->timestamp;
#ifdef DEBUG_TSUITE
              printf("%s evas_event_feed_mouse_in timestamp=<%u> t->n_evas=<%d>\n", __func__, t->timestamp, t->n_evas);
#endif
              evas_event_feed_mouse_in(eina_list_nth(evas_list, t->n_evas),
                       time(NULL), NULL);
              break;
           }
      case TSUITE_EVENT_MOUSE_OUT:
           {
              mouse_in_mouse_out *t = v->data;
              evt_time = t->timestamp;
#ifdef DEBUG_TSUITE
              printf("%s evas_event_feed_mouse_out timestamp=<%u> t->n_evas=<%d>\n", __func__, t->timestamp,t->n_evas);
#endif
              evas_event_feed_mouse_out(eina_list_nth(evas_list, t->n_evas),
                    time(NULL), NULL);
              break;
           }
      case TSUITE_EVENT_MOUSE_DOWN:
           {
              mouse_down_mouse_up *t = v->data;
              evt_time = t->timestamp;
#ifdef DEBUG_TSUITE
              printf("%s evas_event_feed_mouse_down timestamp=<%u> t->n_evas=<%d>\n", __func__, t->timestamp, t->n_evas);
#endif
              evas_event_feed_mouse_down(eina_list_nth(evas_list, t->n_evas),
                    t->b, t->flags, time(NULL),
                    NULL);

              break;
           }
      case TSUITE_EVENT_MOUSE_UP:
           {
              mouse_down_mouse_up *t = v->data;
              evt_time = t->timestamp;
#ifdef DEBUG_TSUITE
              printf("%s evas_event_feed_mouse_up timestamp=<%u> t->n_evas=<%d>\n", __func__, t->timestamp,t->n_evas);
#endif
              evas_event_feed_mouse_up(eina_list_nth(evas_list, t->n_evas),
                    t->b, t->flags, time(NULL),
                    NULL);

              break;
           }
      case TSUITE_EVENT_MOUSE_MOVE:
           {
              mouse_move *t = v->data;
              evt_time = t->timestamp;
#ifdef DEBUG_TSUITE
              printf("%s evas_event_feed_mouse_move (x,y)=(%d,%d) timestamp=<%u> t->n_evas=<%d>\n", __func__, t->x, t->y, t->timestamp,t->n_evas);
#endif
              evas_event_feed_mouse_move(eina_list_nth(evas_list, t->n_evas),
                    t->x, t->y, time(NULL), NULL);
              break;
           }
      case TSUITE_EVENT_MOUSE_WHEEL:
           {
              mouse_wheel *t = v->data;
              evt_time = t->timestamp;
#ifdef DEBUG_TSUITE
              printf("%s evas_event_feed_mouse_wheel timestamp=<%u> t->n_evas=<%d>\n", __func__, t->timestamp, t->n_evas);
#endif
              evas_event_feed_mouse_wheel(eina_list_nth(evas_list, t->n_evas),
                    t->direction, t->z,
                    time(NULL), NULL);

              break;
           }
      case TSUITE_EVENT_MULTI_DOWN:
           {
              multi_event *t = v->data;
              evt_time = t->timestamp;
#ifdef DEBUG_TSUITE
              printf("%s evas_event_feed_multi_down timestamp=<%u>, t->n_evas=<%d>\n", __func__, t->timestamp,t->n_evas);
#endif
              evas_event_feed_multi_down(eina_list_nth(evas_list, t->n_evas),
                    t->d, t->x, t->y, t->rad,
                    t->radx, t->rady, t->pres, t->ang, t->fx, t->fy,
                    t->flags, time(NULL), NULL);

              break;
           }
      case TSUITE_EVENT_MULTI_UP:
           {
              multi_event *t = v->data;
              evt_time = t->timestamp;
#ifdef DEBUG_TSUITE
              printf("%s evas_event_feed_multi_up timestamp=<%u> t->n_evas=<%d>\n", __func__, t->timestamp,t->n_evas);
#endif
              evas_event_feed_multi_up(eina_list_nth(evas_list, t->n_evas),
                    t->d, t->x, t->y, t->rad,
                    t->radx, t->rady, t->pres, t->ang, t->fx, t->fy,
                    t->flags, time(NULL), NULL);

              break;
           }
      case TSUITE_EVENT_MULTI_MOVE:
           {
              multi_move *t = v->data;
              evt_time = t->timestamp;
#ifdef DEBUG_TSUITE
              printf("%s evas_event_feed_multi_move timestamp=<%u> t->n_evas=<%d>\n", __func__, t->timestamp, t->n_evas);
#endif
              evas_event_feed_multi_move(eina_list_nth(evas_list, t->n_evas),
                    t->d, t->x, t->y, t->rad,
                    t->radx, t->rady, t->pres, t->ang, t->fx, t->fy,
                    time(NULL), NULL);

              break;
           }
      case TSUITE_EVENT_KEY_DOWN:
           {
              key_down_key_up *t = v->data;
              evt_time = t->timestamp;
#ifdef DEBUG_TSUITE
              printf("%s evas_event_feed_key_down timestamp=<%u> t->n_evas=<%d>\n", __func__, t->timestamp, t->n_evas);
#endif
              evas_event_feed_key_down(eina_list_nth(evas_list, t->n_evas),
                    t->keyname, t->key, t->string,
                    t->compose, time(NULL), NULL);

              break;
           }
      case TSUITE_EVENT_KEY_UP:
           {
              key_down_key_up *t = v->data;
              evt_time = t->timestamp;
#ifdef DEBUG_TSUITE
              printf("%s evas_event_feed_key_up timestamp=<%u> t->n_evas=<%d>\n", __func__, t->timestamp, t->n_evas);
#endif
              evas_event_feed_key_up(eina_list_nth(evas_list, t->n_evas),
                    t->keyname, t->key, t->string,
                    t->compose, time(NULL), NULL);

              break;
           }
      case TSUITE_EVENT_TAKE_SHOT:
           {
              take_screenshot *t = v->data;
              evt_time = t->timestamp;
#ifdef DEBUG_TSUITE
              printf("%s take shot  timestamp=<%u> t->n_evas=<%d>\n", __func__, t->timestamp, t->n_evas);
#endif
              tsuite_shot_do(NULL,
                    eina_list_nth(evas_list, t->n_evas)); /* Serial name based on test-name */
              break;
           }
      default: /* All non-input events are not handeled */
         evt_time = td->recent_event_time;
         break;
     }

   double timer_time;
   td->current_event = eina_list_next(td->current_event);

   if (!td->current_event)
     {  /* Finished reading all events */
        elm_exit();
        return ECORE_CALLBACK_CANCEL;
     }

   td->recent_event_time = evt_time;

   unsigned int current_event_time = evt_time_get(evt_time, eina_list_data_get(td->current_event));

   if (current_event_time < td->recent_event_time) /* Could happen with refeed event */
     current_event_time = td->recent_event_time;

#ifdef DEBUG_TSUITE
   printf("%s td->recent_event_time=<%u> current_event_time=<%u>\n", __func__, td->recent_event_time, current_event_time);
#endif
   timer_time = (current_event_time - td->recent_event_time) / 1000.0;

   if (!td->recent_event_time)
     timer_time = 0.0;

#ifdef DEBUG_TSUITE
   printf("%s timer_time=<%f>\n", __func__, timer_time);
#endif
   tmr = ecore_timer_add(timer_time, tsuite_feed_event, td);

   return ECORE_CALLBACK_CANCEL;
}