summaryrefslogtreecommitdiff
path: root/src/lib/ecore_wl2/ecore_wl2_input.c
diff options
context:
space:
mode:
authorChris Michael <cp.michael@samsung.com>2017-07-10 13:10:01 -0400
committerChris Michael <cp.michael@samsung.com>2017-07-10 13:10:01 -0400
commit1e694114d8bf121a0c13f30e72298454550ae622 (patch)
tree0b4b694de505758e4b1df2e20a121cd97094b182 /src/lib/ecore_wl2/ecore_wl2_input.c
parent0c6aae1516f7133316cfeb89c6e5964630cb3249 (diff)
ecore-wl2: Formatting fixes
NB: No functional changes Signed-off-by: Chris Michael <cp.michael@samsung.com>
Diffstat (limited to 'src/lib/ecore_wl2/ecore_wl2_input.c')
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_input.c87
1 files changed, 56 insertions, 31 deletions
diff --git a/src/lib/ecore_wl2/ecore_wl2_input.c b/src/lib/ecore_wl2/ecore_wl2_input.c
index 985aa71ec8..43d09ccc2e 100644
--- a/src/lib/ecore_wl2/ecore_wl2_input.c
+++ b/src/lib/ecore_wl2/ecore_wl2_input.c
@@ -842,6 +842,7 @@ static void
842_keyboard_cb_keymap(void *data, struct wl_keyboard *keyboard EINA_UNUSED, unsigned int format, int fd, unsigned int size) 842_keyboard_cb_keymap(void *data, struct wl_keyboard *keyboard EINA_UNUSED, unsigned int format, int fd, unsigned int size)
843{ 843{
844 Ecore_Wl2_Input *input; 844 Ecore_Wl2_Input *input;
845 Ecore_Wl2_Event_Seat_Keymap_Changed *ev;
845 char *map = NULL; 846 char *map = NULL;
846 const char *locale; 847 const char *locale;
847 848
@@ -898,24 +899,33 @@ _keyboard_cb_keymap(void *data, struct wl_keyboard *keyboard EINA_UNUSED, unsign
898 if (!(locale = getenv("LC_CTYPE"))) 899 if (!(locale = getenv("LC_CTYPE")))
899 if (!(locale = getenv("LANG"))) 900 if (!(locale = getenv("LANG")))
900 locale = "C"; 901 locale = "C";
901 if (input->xkb.compose_table) xkb_compose_table_unref(input->xkb.compose_table); 902
902 input->xkb.compose_table = xkb_compose_table_new_from_locale(input->display->xkb_context, 903 if (input->xkb.compose_table)
903 locale, XKB_COMPOSE_COMPILE_NO_FLAGS); 904 xkb_compose_table_unref(input->xkb.compose_table);
904 if (input->xkb.compose_state) xkb_compose_state_unref(input->xkb.compose_state); 905
906 input->xkb.compose_table =
907 xkb_compose_table_new_from_locale(input->display->xkb_context,
908 locale, XKB_COMPOSE_COMPILE_NO_FLAGS);
909 if (input->xkb.compose_state)
910 xkb_compose_state_unref(input->xkb.compose_state);
905 input->xkb.compose_state = NULL; 911 input->xkb.compose_state = NULL;
912
906 if (input->xkb.compose_table) 913 if (input->xkb.compose_table)
907 input->xkb.compose_state = xkb_compose_state_new(input->xkb.compose_table, XKB_COMPOSE_STATE_NO_FLAGS); 914 {
915 input->xkb.compose_state =
916 xkb_compose_state_new(input->xkb.compose_table,
917 XKB_COMPOSE_STATE_NO_FLAGS);
918 }
908 919
909 { 920 ev = malloc(sizeof(Ecore_Wl2_Event_Seat_Keymap_Changed));
910 Ecore_Wl2_Event_Seat_Keymap_Changed *ev = malloc(sizeof(Ecore_Wl2_Event_Seat_Keymap_Changed)); 921 if (ev)
911 if (ev) 922 {
912 { 923 ev->id = input->id;
913 ev->id = input->id; 924 ev->display = input->display;
914 ev->display = input->display; 925 input->display->refs++;
915 input->display->refs++; 926 ecore_event_add(ECORE_WL2_EVENT_SEAT_KEYMAP_CHANGED, ev,
916 ecore_event_add(ECORE_WL2_EVENT_SEAT_KEYMAP_CHANGED, ev, _display_event_free, ev->display); 927 _display_event_free, ev->display);
917 } 928 }
918 }
919 929
920 input->xkb.control_mask = 930 input->xkb.control_mask =
921 1 << xkb_map_mod_get_index(input->xkb.keymap, XKB_MOD_NAME_CTRL); 931 1 << xkb_map_mod_get_index(input->xkb.keymap, XKB_MOD_NAME_CTRL);
@@ -1001,7 +1011,11 @@ _keyboard_cb_repeat(void *data)
1001 window = input->focus.keyboard; 1011 window = input->focus.keyboard;
1002 if (!window) goto out; 1012 if (!window) goto out;
1003 1013
1004 _ecore_wl2_input_key_send(input, input->focus.keyboard, input->repeat.sym, input->repeat.sym_name, input->repeat.key + 8, WL_KEYBOARD_KEY_STATE_PRESSED, input->repeat.time); 1014 _ecore_wl2_input_key_send(input, input->focus.keyboard,
1015 input->repeat.sym, input->repeat.sym_name,
1016 input->repeat.key + 8,
1017 WL_KEYBOARD_KEY_STATE_PRESSED,
1018 input->repeat.time);
1005 1019
1006 if (!input->repeat.repeating) 1020 if (!input->repeat.repeating)
1007 { 1021 {
@@ -1026,7 +1040,8 @@ process_key_press(xkb_keysym_t sym, Ecore_Wl2_Input *input)
1026 return sym; 1040 return sym;
1027 if (sym == XKB_KEY_NoSymbol) 1041 if (sym == XKB_KEY_NoSymbol)
1028 return sym; 1042 return sym;
1029 if (xkb_compose_state_feed(input->xkb.compose_state, sym) != XKB_COMPOSE_FEED_ACCEPTED) 1043 if (xkb_compose_state_feed(input->xkb.compose_state, sym) !=
1044 XKB_COMPOSE_FEED_ACCEPTED)
1030 return sym; 1045 return sym;
1031 1046
1032 switch (xkb_compose_state_get_status(input->xkb.compose_state)) 1047 switch (xkb_compose_state_get_status(input->xkb.compose_state))
@@ -1070,7 +1085,8 @@ _keyboard_cb_key(void *data, struct wl_keyboard *keyboard EINA_UNUSED, unsigned
1070 sym = process_key_press(sym, input); 1085 sym = process_key_press(sym, input);
1071 sym_name = xkb_state_key_get_one_sym(input->xkb.maskless_state, code); 1086 sym_name = xkb_state_key_get_one_sym(input->xkb.maskless_state, code);
1072 1087
1073 _ecore_wl2_input_key_send(input, window, sym, sym_name, code, state, timestamp); 1088 _ecore_wl2_input_key_send(input, window, sym, sym_name, code,
1089 state, timestamp);
1074 1090
1075 if (!xkb_keymap_key_repeats(input->xkb.keymap, code)) return; 1091 if (!xkb_keymap_key_repeats(input->xkb.keymap, code)) return;
1076 1092
@@ -1170,7 +1186,8 @@ _keyboard_cb_repeat_setup(void *data, struct wl_keyboard *keyboard EINA_UNUSED,
1170 ev->id = input->id; 1186 ev->id = input->id;
1171 ev->display = input->display; 1187 ev->display = input->display;
1172 ev->display->refs++; 1188 ev->display->refs++;
1173 ecore_event_add(ECORE_WL2_EVENT_SEAT_KEYBOARD_REPEAT_CHANGED, ev, _display_event_free, ev->display); 1189 ecore_event_add(ECORE_WL2_EVENT_SEAT_KEYBOARD_REPEAT_CHANGED, ev,
1190 _display_event_free, ev->display);
1174 } 1191 }
1175} 1192}
1176 1193
@@ -1417,7 +1434,8 @@ _seat_cb_capabilities(void *data, struct wl_seat *seat, enum wl_seat_capability
1417 ev->display = input->display; 1434 ev->display = input->display;
1418 ev->display->refs++; 1435 ev->display->refs++;
1419 1436
1420 ecore_event_add(ECORE_WL2_EVENT_SEAT_CAPABILITIES_CHANGED, ev, _display_event_free, ev->display); 1437 ecore_event_add(ECORE_WL2_EVENT_SEAT_CAPABILITIES_CHANGED, ev,
1438 _display_event_free, ev->display);
1421} 1439}
1422 1440
1423static void 1441static void
@@ -1528,8 +1546,8 @@ _ecore_wl2_cb_device_event(void *data, int type, void *event)
1528 { 1546 {
1529 devices = calloc(1, sizeof(Ecore_Wl2_Input_Devices)); 1547 devices = calloc(1, sizeof(Ecore_Wl2_Input_Devices));
1530 EINA_SAFETY_ON_NULL_RETURN_VAL(devices, ECORE_CALLBACK_PASS_ON); 1548 EINA_SAFETY_ON_NULL_RETURN_VAL(devices, ECORE_CALLBACK_PASS_ON);
1531 input->devices_list = eina_list_append(input->devices_list, 1549 input->devices_list =
1532 devices); 1550 eina_list_append(input->devices_list, devices);
1533 devices->window_id = ev->window_id; 1551 devices->window_id = ev->window_id;
1534 } 1552 }
1535 1553
@@ -1550,23 +1568,26 @@ _ecore_wl2_cb_device_event(void *data, int type, void *event)
1550 1568
1551 if (ev->type == ECORE_WL2_DEVICE_TYPE_SEAT) 1569 if (ev->type == ECORE_WL2_DEVICE_TYPE_SEAT)
1552 { 1570 {
1553 input->devices_list = eina_list_remove(input->devices_list, 1571 input->devices_list =
1554 devices); 1572 eina_list_remove(input->devices_list, devices);
1555 _ecore_wl2_devices_free(devices); 1573 _ecore_wl2_devices_free(devices);
1556 return ECORE_CALLBACK_PASS_ON; 1574 return ECORE_CALLBACK_PASS_ON;
1557 } 1575 }
1558 1576
1559 if ((ev->type == ECORE_WL2_DEVICE_TYPE_POINTER) && (devices->pointer_dev == ev->dev)) 1577 if ((ev->type == ECORE_WL2_DEVICE_TYPE_POINTER) &&
1578 (devices->pointer_dev == ev->dev))
1560 { 1579 {
1561 efl_unref(devices->pointer_dev); 1580 efl_unref(devices->pointer_dev);
1562 devices->pointer_dev = NULL; 1581 devices->pointer_dev = NULL;
1563 } 1582 }
1564 else if ((ev->type == ECORE_WL2_DEVICE_TYPE_KEYBOARD) && (devices->keyboard_dev == ev->dev)) 1583 else if ((ev->type == ECORE_WL2_DEVICE_TYPE_KEYBOARD) &&
1584 (devices->keyboard_dev == ev->dev))
1565 { 1585 {
1566 efl_unref(devices->keyboard_dev); 1586 efl_unref(devices->keyboard_dev);
1567 devices->keyboard_dev = NULL; 1587 devices->keyboard_dev = NULL;
1568 } 1588 }
1569 else if ((ev->type == ECORE_WL2_DEVICE_TYPE_TOUCH) && (devices->touch_dev == ev->dev)) 1589 else if ((ev->type == ECORE_WL2_DEVICE_TYPE_TOUCH) &&
1590 (devices->touch_dev == ev->dev))
1570 { 1591 {
1571 efl_unref(devices->touch_dev); 1592 efl_unref(devices->touch_dev);
1572 devices->touch_dev = NULL; 1593 devices->touch_dev = NULL;
@@ -1666,8 +1687,10 @@ _ecore_wl2_input_del(Ecore_Wl2_Input *input)
1666 wl_array_release(&input->data.drag.types); 1687 wl_array_release(&input->data.drag.types);
1667 } 1688 }
1668 1689
1669 if (input->data.selection.source) wl_data_source_destroy(input->data.selection.source); 1690 if (input->data.selection.source)
1670 if (input->data.drag.source) wl_data_source_destroy(input->data.drag.source); 1691 wl_data_source_destroy(input->data.selection.source);
1692 if (input->data.drag.source)
1693 wl_data_source_destroy(input->data.drag.source);
1671 if (input->drag) _ecore_wl2_offer_unref(input->drag); 1694 if (input->drag) _ecore_wl2_offer_unref(input->drag);
1672 if (input->selection) _ecore_wl2_offer_unref(input->selection); 1695 if (input->selection) _ecore_wl2_offer_unref(input->selection);
1673 if (input->data.device) wl_data_device_destroy(input->data.device); 1696 if (input->data.device) wl_data_device_destroy(input->data.device);
@@ -1675,8 +1698,10 @@ _ecore_wl2_input_del(Ecore_Wl2_Input *input)
1675 if (input->xkb.state) xkb_state_unref(input->xkb.state); 1698 if (input->xkb.state) xkb_state_unref(input->xkb.state);
1676 if (input->xkb.maskless_state) xkb_state_unref(input->xkb.maskless_state); 1699 if (input->xkb.maskless_state) xkb_state_unref(input->xkb.maskless_state);
1677 if (input->xkb.keymap) xkb_map_unref(input->xkb.keymap); 1700 if (input->xkb.keymap) xkb_map_unref(input->xkb.keymap);
1678 if (input->xkb.compose_table) xkb_compose_table_unref(input->xkb.compose_table); 1701 if (input->xkb.compose_table)
1679 if (input->xkb.compose_state) xkb_compose_state_unref(input->xkb.compose_state); 1702 xkb_compose_table_unref(input->xkb.compose_table);
1703 if (input->xkb.compose_state)
1704 xkb_compose_state_unref(input->xkb.compose_state);
1680 1705
1681 if (input->wl.seat) wl_seat_destroy(input->wl.seat); 1706 if (input->wl.seat) wl_seat_destroy(input->wl.seat);
1682 1707