static EWL_CALLBACK_DEFN(fg_mouse_out) { Ewler_Widget *ewler_w = user_data; Ewl_Embed *embed; if( !(ewler_w->mouse.state & EWLER_WIDGET_MOUSE_DOWN) ) ewler_w->mouse.state = 0; embed = ewl_embed_widget_find(w); evas_event_feed_mouse_out(embed->evas, 0, NULL); }
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; }
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"); }
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); } }
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; }