summaryrefslogtreecommitdiff
path: root/legacy
diff options
context:
space:
mode:
authorSebastian Dransfeld <sd@tango.flipp.net>2012-10-06 15:58:27 +0000
committerSebastian Dransfeld <sd@tango.flipp.net>2012-10-06 15:58:27 +0000
commitb111a5046ec4d50b169df56b0f6e635272b29fbf (patch)
tree22e638cc03c234715a78718b954d609df5ce57b1 /legacy
parent7fe3d3599446108bc36a0ab6ec563a267db02733 (diff)
ecore_wayland: Make modifiers correctly at once
SVN revision: 77546
Diffstat (limited to 'legacy')
-rw-r--r--legacy/ecore/src/lib/ecore_wayland/ecore_wl_input.c41
1 files changed, 11 insertions, 30 deletions
diff --git a/legacy/ecore/src/lib/ecore_wayland/ecore_wl_input.c b/legacy/ecore/src/lib/ecore_wayland/ecore_wl_input.c
index 80e0b45..bbe2d15 100644
--- a/legacy/ecore/src/lib/ecore_wayland/ecore_wl_input.c
+++ b/legacy/ecore/src/lib/ecore_wayland/ecore_wl_input.c
@@ -35,9 +35,7 @@
35# define BTN_BACK 0x116 35# define BTN_BACK 0x116
36#endif 36#endif
37 37
38#define MOD_SHIFT_MASK 0x01 38#include <Ecore_Input.h>
39#define MOD_ALT_MASK 0x02
40#define MOD_CONTROL_MASK 0x04
41 39
42Ecore_Wl_Dnd *glb_dnd = NULL; 40Ecore_Wl_Dnd *glb_dnd = NULL;
43 41
@@ -77,8 +75,6 @@ static void _ecore_wl_input_mouse_down_send(Ecore_Wl_Input *input, Ecore_Wl_Wind
77static void _ecore_wl_input_mouse_up_send(Ecore_Wl_Input *input, Ecore_Wl_Window *win, unsigned int timestamp); 75static void _ecore_wl_input_mouse_up_send(Ecore_Wl_Input *input, Ecore_Wl_Window *win, unsigned int timestamp);
78static void _ecore_wl_input_mouse_wheel_send(Ecore_Wl_Input *input, unsigned int axis, int value, unsigned int timestamp); 76static void _ecore_wl_input_mouse_wheel_send(Ecore_Wl_Input *input, unsigned int axis, int value, unsigned int timestamp);
79 77
80static unsigned int _ecore_wl_event_modifiers(unsigned int state);
81
82/* static int _ecore_wl_input_keysym_to_string(unsigned int symbol, char *buffer, int len); */ 78/* static int _ecore_wl_input_keysym_to_string(unsigned int symbol, char *buffer, int len); */
83 79
84/* wayland interfaces */ 80/* wayland interfaces */
@@ -547,11 +543,11 @@ _ecore_wl_input_cb_keyboard_key(void *data, struct wl_keyboard *keyboard __UNUSE
547 543
548 /* The Ecore_Event_Modifiers don't quite match the X mask bits */ 544 /* The Ecore_Event_Modifiers don't quite match the X mask bits */
549 if (mask & input->xkb.control_mask) 545 if (mask & input->xkb.control_mask)
550 input->modifiers |= MOD_CONTROL_MASK; 546 input->modifiers |= ECORE_EVENT_MODIFIER_CTRL;
551 if (mask & input->xkb.alt_mask) 547 if (mask & input->xkb.alt_mask)
552 input->modifiers |= MOD_ALT_MASK; 548 input->modifiers |= ECORE_EVENT_MODIFIER_ALT;
553 if (mask & input->xkb.shift_mask) 549 if (mask & input->xkb.shift_mask)
554 input->modifiers |= MOD_SHIFT_MASK; 550 input->modifiers |= ECORE_EVENT_MODIFIER_SHIFT;
555 551
556 num = xkb_key_get_syms(input->xkb.state, code, &syms); 552 num = xkb_key_get_syms(input->xkb.state, code, &syms);
557 if (num == 1) sym = syms[0]; 553 if (num == 1) sym = syms[0];
@@ -597,7 +593,7 @@ _ecore_wl_input_cb_keyboard_key(void *data, struct wl_keyboard *keyboard __UNUSE
597 e->window = win->id; 593 e->window = win->id;
598 e->event_window = win->id; 594 e->event_window = win->id;
599 e->timestamp = timestamp; 595 e->timestamp = timestamp;
600 e->modifiers = _ecore_wl_event_modifiers(input->modifiers); 596 e->modifiers = input->modifiers;
601 597
602 if (state) 598 if (state)
603 ecore_event_add(ECORE_EVENT_KEY_DOWN, e, NULL, NULL); 599 ecore_event_add(ECORE_EVENT_KEY_DOWN, e, NULL, NULL);
@@ -975,7 +971,7 @@ _ecore_wl_input_mouse_move_send(Ecore_Wl_Input *input, Ecore_Wl_Window *win, uns
975 ev->y = input->sy; 971 ev->y = input->sy;
976 /* ev->root.x = input->sx; */ 972 /* ev->root.x = input->sx; */
977 /* ev->root.y = input->sy; */ 973 /* ev->root.y = input->sy; */
978 ev->modifiers = _ecore_wl_event_modifiers(input->modifiers); 974 ev->modifiers = input->modifiers;
979 ev->multi.device = 0; 975 ev->multi.device = 0;
980 ev->multi.radius = 1; 976 ev->multi.radius = 1;
981 ev->multi.radius_x = 1; 977 ev->multi.radius_x = 1;
@@ -1007,7 +1003,7 @@ _ecore_wl_input_mouse_in_send(Ecore_Wl_Input *input, Ecore_Wl_Window *win, unsig
1007 ev->y = input->sy; 1003 ev->y = input->sy;
1008 /* ev->root.x = input->sx; */ 1004 /* ev->root.x = input->sx; */
1009 /* ev->root.y = input->sy; */ 1005 /* ev->root.y = input->sy; */
1010 ev->modifiers = _ecore_wl_event_modifiers(input->modifiers); 1006 ev->modifiers = input->modifiers;
1011 ev->timestamp = timestamp; 1007 ev->timestamp = timestamp;
1012 1008
1013 if (win) 1009 if (win)
@@ -1032,7 +1028,7 @@ _ecore_wl_input_mouse_out_send(Ecore_Wl_Input *input, Ecore_Wl_Window *win, unsi
1032 ev->y = input->sy; 1028 ev->y = input->sy;
1033 /* ev->root.x = input->sx; */ 1029 /* ev->root.x = input->sx; */
1034 /* ev->root.y = input->sy; */ 1030 /* ev->root.y = input->sy; */
1035 ev->modifiers = _ecore_wl_event_modifiers(input->modifiers); 1031 ev->modifiers = input->modifiers;
1036 ev->timestamp = timestamp; 1032 ev->timestamp = timestamp;
1037 1033
1038 if (win) 1034 if (win)
@@ -1093,7 +1089,7 @@ _ecore_wl_input_mouse_down_send(Ecore_Wl_Input *input, Ecore_Wl_Window *win, uns
1093 ev->y = input->sy; 1089 ev->y = input->sy;
1094 /* ev->root.x = input->sx; */ 1090 /* ev->root.x = input->sx; */
1095 /* ev->root.y = input->sy; */ 1091 /* ev->root.y = input->sy; */
1096 ev->modifiers = _ecore_wl_event_modifiers(input->modifiers); 1092 ev->modifiers = input->modifiers;
1097 1093
1098 /* FIXME: Need to get these from wayland somehow */ 1094 /* FIXME: Need to get these from wayland somehow */
1099 ev->double_click = 0; 1095 ev->double_click = 0;
@@ -1140,7 +1136,7 @@ _ecore_wl_input_mouse_up_send(Ecore_Wl_Input *input, Ecore_Wl_Window *win, unsig
1140 ev->y = input->sy; 1136 ev->y = input->sy;
1141 /* ev->root.x = input->sx; */ 1137 /* ev->root.x = input->sx; */
1142 /* ev->root.y = input->sy; */ 1138 /* ev->root.y = input->sy; */
1143 ev->modifiers = _ecore_wl_event_modifiers(input->modifiers); 1139 ev->modifiers = input->modifiers;
1144 1140
1145 /* FIXME: Need to get these from wayland somehow */ 1141 /* FIXME: Need to get these from wayland somehow */
1146 ev->double_click = 0; 1142 ev->double_click = 0;
@@ -1174,7 +1170,7 @@ _ecore_wl_input_mouse_wheel_send(Ecore_Wl_Input *input, unsigned int axis, int v
1174 if (!(ev = malloc(sizeof(Ecore_Event_Mouse_Wheel)))) return; 1170 if (!(ev = malloc(sizeof(Ecore_Event_Mouse_Wheel)))) return;
1175 1171
1176 ev->timestamp = timestamp; 1172 ev->timestamp = timestamp;
1177 ev->modifiers = _ecore_wl_event_modifiers(input->modifiers); 1173 ev->modifiers = input->modifiers;
1178 ev->x = input->sx; 1174 ev->x = input->sx;
1179 ev->y = input->sy; 1175 ev->y = input->sy;
1180 /* ev->root.x = input->sx; */ 1176 /* ev->root.x = input->sx; */
@@ -1205,21 +1201,6 @@ _ecore_wl_input_mouse_wheel_send(Ecore_Wl_Input *input, unsigned int axis, int v
1205 ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, ev, NULL, NULL); 1201 ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, ev, NULL, NULL);
1206} 1202}
1207 1203
1208static unsigned int
1209_ecore_wl_event_modifiers(unsigned int state)
1210{
1211 unsigned int modifiers = 0;
1212
1213 if (state & MOD_SHIFT_MASK)
1214 modifiers |= ECORE_EVENT_MODIFIER_SHIFT;
1215
1216 if (state & MOD_CONTROL_MASK)
1217 modifiers |= ECORE_EVENT_MODIFIER_CTRL;
1218
1219 if (state & MOD_ALT_MASK)
1220 modifiers |= ECORE_EVENT_MODIFIER_ALT;
1221}
1222
1223void 1204void
1224_ecore_wl_input_set_selection(Ecore_Wl_Input *input, struct wl_data_source *source) 1205_ecore_wl_input_set_selection(Ecore_Wl_Input *input, struct wl_data_source *source)
1225{ 1206{