Changeset a46e56b in mainline for uspace/srv/hid/compositor
- Timestamp:
- 2018-03-22T06:49:35Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 77f0a1d
- Parents:
- 3e242d2
- git-author:
- Jakub Jermar <jakub@…> (2018-03-21 23:29:06)
- git-committer:
- Jakub Jermar <jakub@…> (2018-03-22 06:49:35)
- File:
-
- 1 edited
-
uspace/srv/hid/compositor/compositor.c (modified) (29 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/compositor/compositor.c
r3e242d2 ra46e56b 589 589 } 590 590 591 static void comp_window_get_event(window_t *win, cap_call_handle_t i id, ipc_call_t *icall)591 static void comp_window_get_event(window_t *win, cap_call_handle_t icall_handle, ipc_call_t *icall) 592 592 { 593 593 window_event_t *event = (window_event_t *) prodcons_consume(&win->queue); 594 594 595 cap_call_handle_t c allid;595 cap_call_handle_t chandle; 596 596 size_t len; 597 597 598 if (!async_data_read_receive(&c allid, &len)) {599 async_answer_0(i id, EINVAL);598 if (!async_data_read_receive(&chandle, &len)) { 599 async_answer_0(icall_handle, EINVAL); 600 600 free(event); 601 601 return; 602 602 } 603 603 604 errno_t rc = async_data_read_finalize(c allid, event, len);604 errno_t rc = async_data_read_finalize(chandle, event, len); 605 605 if (rc != EOK) { 606 async_answer_0(i id, ENOMEM);606 async_answer_0(icall_handle, ENOMEM); 607 607 free(event); 608 608 return; 609 609 } 610 610 611 async_answer_0(i id, EOK);611 async_answer_0(icall_handle, EOK); 612 612 free(event); 613 613 } 614 614 615 static void comp_window_damage(window_t *win, cap_call_handle_t i id, ipc_call_t *icall)615 static void comp_window_damage(window_t *win, cap_call_handle_t icall_handle, ipc_call_t *icall) 616 616 { 617 617 double x = IPC_GET_ARG1(*icall); … … 631 631 } 632 632 633 async_answer_0(i id, EOK);634 } 635 636 static void comp_window_grab(window_t *win, cap_call_handle_t i id, ipc_call_t *icall)633 async_answer_0(icall_handle, EOK); 634 } 635 636 static void comp_window_grab(window_t *win, cap_call_handle_t icall_handle, ipc_call_t *icall) 637 637 { 638 638 sysarg_t pos_id = IPC_GET_ARG1(*icall); … … 661 661 } 662 662 663 async_answer_0(i id, EOK);663 async_answer_0(icall_handle, EOK); 664 664 } 665 665 … … 693 693 } 694 694 695 static void comp_window_resize(window_t *win, cap_call_handle_t i id, ipc_call_t *icall)696 { 697 cap_call_handle_t c allid;695 static void comp_window_resize(window_t *win, cap_call_handle_t icall_handle, ipc_call_t *icall) 696 { 697 cap_call_handle_t chandle; 698 698 size_t size; 699 699 unsigned int flags; 700 700 701 701 /* Start sharing resized window with client. */ 702 if (!async_share_out_receive(&c allid, &size, &flags)) {703 async_answer_0(i id, EINVAL);702 if (!async_share_out_receive(&chandle, &size, &flags)) { 703 async_answer_0(icall_handle, EINVAL); 704 704 return; 705 705 } 706 706 707 707 void *new_cell_storage; 708 errno_t rc = async_share_out_finalize(c allid, &new_cell_storage);708 errno_t rc = async_share_out_finalize(chandle, &new_cell_storage); 709 709 if ((rc != EOK) || (new_cell_storage == AS_MAP_FAILED)) { 710 async_answer_0(i id, ENOMEM);710 async_answer_0(icall_handle, ENOMEM); 711 711 return; 712 712 } … … 717 717 if (!new_surface) { 718 718 as_area_destroy(new_cell_storage); 719 async_answer_0(i id, ENOMEM);719 async_answer_0(icall_handle, ENOMEM); 720 720 return; 721 721 } … … 804 804 comp_damage(x, y, width, height); 805 805 806 async_answer_0(i id, EOK);806 async_answer_0(icall_handle, EOK); 807 807 } 808 808 … … 836 836 } 837 837 838 static void comp_window_close(window_t *win, cap_call_handle_t i id, ipc_call_t *icall)838 static void comp_window_close(window_t *win, cap_call_handle_t icall_handle, ipc_call_t *icall) 839 839 { 840 840 /* Stop managing the window. */ … … 876 876 877 877 comp_damage(x, y, width, height); 878 async_answer_0(i id, EOK);879 } 880 881 static void comp_window_close_request(window_t *win, cap_call_handle_t i id, ipc_call_t *icall)878 async_answer_0(icall_handle, EOK); 879 } 880 881 static void comp_window_close_request(window_t *win, cap_call_handle_t icall_handle, ipc_call_t *icall) 882 882 { 883 883 window_event_t *event = (window_event_t *) malloc(sizeof(window_event_t)); 884 884 if (event == NULL) { 885 async_answer_0(i id, ENOMEM);885 async_answer_0(icall_handle, ENOMEM); 886 886 return; 887 887 } … … 891 891 892 892 prodcons_produce(&win->queue, &event->link); 893 async_answer_0(i id, EOK);894 } 895 896 static void client_connection(cap_call_handle_t i id, ipc_call_t *icall, void *arg)893 async_answer_0(icall_handle, EOK); 894 } 895 896 static void client_connection(cap_call_handle_t icall_handle, ipc_call_t *icall, void *arg) 897 897 { 898 898 ipc_call_t call; 899 cap_call_handle_t c allid;899 cap_call_handle_t chandle; 900 900 service_id_t service_id = (service_id_t) IPC_GET_ARG2(*icall); 901 901 902 902 /* Allocate resources for new window and register it to the location service. */ 903 903 if (service_id == winreg_id) { 904 async_answer_0(i id, EOK);905 906 c allid= async_get_call(&call);904 async_answer_0(icall_handle, EOK); 905 906 chandle = async_get_call(&call); 907 907 if (IPC_GET_IMETHOD(call) == WINDOW_REGISTER) { 908 908 fibril_mutex_lock(&window_list_mtx); … … 910 910 window_t *win = window_create(); 911 911 if (!win) { 912 async_answer_2(c allid, ENOMEM, 0, 0);912 async_answer_2(chandle, ENOMEM, 0, 0); 913 913 fibril_mutex_unlock(&window_list_mtx); 914 914 return; … … 929 929 if (loc_service_register(name_in, &win->in_dsid) != EOK) { 930 930 window_destroy(win); 931 async_answer_2(c allid, EINVAL, 0, 0);931 async_answer_2(chandle, EINVAL, 0, 0); 932 932 fibril_mutex_unlock(&window_list_mtx); 933 933 return; … … 937 937 loc_service_unregister(win->in_dsid); 938 938 window_destroy(win); 939 async_answer_2(c allid, EINVAL, 0, 0);939 async_answer_2(chandle, EINVAL, 0, 0); 940 940 fibril_mutex_unlock(&window_list_mtx); 941 941 return; … … 951 951 } 952 952 953 async_answer_2(c allid, EOK, win->in_dsid, win->out_dsid);953 async_answer_2(chandle, EOK, win->in_dsid, win->out_dsid); 954 954 fibril_mutex_unlock(&window_list_mtx); 955 955 … … 960 960 return; 961 961 } else { 962 async_answer_0(c allid, EINVAL);962 async_answer_0(chandle, EINVAL); 963 963 return; 964 964 } … … 978 978 if (win) { 979 979 atomic_inc(&win->ref_cnt); 980 async_answer_0(i id, EOK);980 async_answer_0(icall_handle, EOK); 981 981 } else { 982 async_answer_0(i id, EINVAL);982 async_answer_0(icall_handle, EINVAL); 983 983 return; 984 984 } … … 987 987 if (win->in_dsid == service_id) { 988 988 while (true) { 989 c allid= async_get_call(&call);989 chandle = async_get_call(&call); 990 990 991 991 if (!IPC_GET_IMETHOD(call)) { 992 async_answer_0(c allid, EOK);992 async_answer_0(chandle, EOK); 993 993 atomic_dec(&win->ref_cnt); 994 994 window_destroy(win); … … 998 998 switch (IPC_GET_IMETHOD(call)) { 999 999 case WINDOW_GET_EVENT: 1000 comp_window_get_event(win, c allid, &call);1000 comp_window_get_event(win, chandle, &call); 1001 1001 break; 1002 1002 default: 1003 async_answer_0(c allid, EINVAL);1003 async_answer_0(chandle, EINVAL); 1004 1004 } 1005 1005 } 1006 1006 } else if (win->out_dsid == service_id) { 1007 1007 while (true) { 1008 c allid= async_get_call(&call);1008 chandle = async_get_call(&call); 1009 1009 1010 1010 if (!IPC_GET_IMETHOD(call)) { 1011 comp_window_close(win, c allid, &call);1011 comp_window_close(win, chandle, &call); 1012 1012 atomic_dec(&win->ref_cnt); 1013 1013 window_destroy(win); … … 1017 1017 switch (IPC_GET_IMETHOD(call)) { 1018 1018 case WINDOW_DAMAGE: 1019 comp_window_damage(win, c allid, &call);1019 comp_window_damage(win, chandle, &call); 1020 1020 break; 1021 1021 case WINDOW_GRAB: 1022 comp_window_grab(win, c allid, &call);1022 comp_window_grab(win, chandle, &call); 1023 1023 break; 1024 1024 case WINDOW_RESIZE: 1025 comp_window_resize(win, c allid, &call);1025 comp_window_resize(win, chandle, &call); 1026 1026 break; 1027 1027 case WINDOW_CLOSE: … … 1030 1030 * the case when the client is killed abruptly. 1031 1031 */ 1032 async_answer_0(c allid, EOK);1032 async_answer_0(chandle, EOK); 1033 1033 break; 1034 1034 case WINDOW_CLOSE_REQUEST: 1035 comp_window_close_request(win, c allid, &call);1035 comp_window_close_request(win, chandle, &call); 1036 1036 break; 1037 1037 default: 1038 async_answer_0(c allid, EINVAL);1039 } 1040 } 1041 } 1042 } 1043 1044 static void comp_mode_change(viewport_t *vp, cap_call_handle_t i id, ipc_call_t *icall)1038 async_answer_0(chandle, EINVAL); 1039 } 1040 } 1041 } 1042 } 1043 1044 static void comp_mode_change(viewport_t *vp, cap_call_handle_t icall_handle, ipc_call_t *icall) 1045 1045 { 1046 1046 sysarg_t mode_idx = IPC_GET_ARG2(*icall); … … 1052 1052 if (rc != EOK) { 1053 1053 fibril_mutex_unlock(&viewport_list_mtx); 1054 async_answer_0(i id, EINVAL);1054 async_answer_0(icall_handle, EINVAL); 1055 1055 return; 1056 1056 } … … 1061 1061 if (!new_surface) { 1062 1062 fibril_mutex_unlock(&viewport_list_mtx); 1063 async_answer_0(i id, ENOMEM);1063 async_answer_0(icall_handle, ENOMEM); 1064 1064 return; 1065 1065 } … … 1071 1071 surface_destroy(new_surface); 1072 1072 fibril_mutex_unlock(&viewport_list_mtx); 1073 async_answer_0(i id, rc);1073 async_answer_0(icall_handle, rc); 1074 1074 return; 1075 1075 } … … 1081 1081 1082 1082 fibril_mutex_unlock(&viewport_list_mtx); 1083 async_answer_0(i id, EOK);1083 async_answer_0(icall_handle, EOK); 1084 1084 1085 1085 comp_restrict_pointers(); … … 1115 1115 fibril_mutex_unlock(&window_list_mtx); 1116 1116 1117 async_answer_0(i id, EOK);1117 async_answer_0(icall_handle, EOK); 1118 1118 1119 1119 /* All fibrils of the compositor will terminate soon. */ … … 1121 1121 #endif 1122 1122 1123 static void comp_visualizer_disconnect(viewport_t *vp, cap_call_handle_t i id, ipc_call_t *icall)1123 static void comp_visualizer_disconnect(viewport_t *vp, cap_call_handle_t icall_handle, ipc_call_t *icall) 1124 1124 { 1125 1125 /* Release viewport resources. */ … … 1131 1131 fibril_mutex_unlock(&viewport_list_mtx); 1132 1132 1133 async_answer_0(i id, EOK);1133 async_answer_0(icall_handle, EOK); 1134 1134 1135 1135 comp_restrict_pointers(); … … 1137 1137 } 1138 1138 1139 static void vsl_notifications(cap_call_handle_t i id, ipc_call_t *icall, void *arg)1139 static void vsl_notifications(cap_call_handle_t icall_handle, ipc_call_t *icall, void *arg) 1140 1140 { 1141 1141 viewport_t *vp = NULL; … … 1155 1155 while (true) { 1156 1156 ipc_call_t call; 1157 cap_call_handle_t c allid= async_get_call(&call);1157 cap_call_handle_t chandle = async_get_call(&call); 1158 1158 1159 1159 if (!IPC_GET_IMETHOD(call)) { … … 1164 1164 switch (IPC_GET_IMETHOD(call)) { 1165 1165 case VISUALIZER_MODE_CHANGE: 1166 comp_mode_change(vp, c allid, &call);1166 comp_mode_change(vp, chandle, &call); 1167 1167 break; 1168 1168 case VISUALIZER_DISCONNECT: 1169 comp_visualizer_disconnect(vp, c allid, &call);1169 comp_visualizer_disconnect(vp, chandle, &call); 1170 1170 return; 1171 1171 default: 1172 async_answer_0(c allid, EINVAL);1172 async_answer_0(chandle, EINVAL); 1173 1173 } 1174 1174 }
Note:
See TracChangeset
for help on using the changeset viewer.
