Changeset 913add60 in mainline for uspace/srv/hid/display/wmops.c
- Timestamp:
- 2022-10-31T10:53:53Z (2 years ago)
- Branches:
- master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1b92d4b
- Parents:
- 7cc30e9
- git-author:
- Jiri Svoboda <jiri@…> (2022-10-30 10:53:48)
- git-committer:
- Jiri Svoboda <jiri@…> (2022-10-31 10:53:53)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/display/wmops.c
r7cc30e9 r913add60 40 40 #include <wndmgt_srv.h> 41 41 #include "display.h" 42 #include "wmclient.h" 42 43 43 44 static errno_t dispwm_get_window_list(void *, wndmgt_window_list_t **); … … 55 56 }; 56 57 58 /** Get window list. 59 * 60 * @param arg Argument (WM client) 61 * @param rlist Place to store pointer to new list 62 * @return EOK on success or an error code 63 */ 57 64 static errno_t dispwm_get_window_list(void *arg, wndmgt_window_list_t **rlist) 58 65 { 66 ds_wmclient_t *wmclient = (ds_wmclient_t *)arg; 59 67 wndmgt_window_list_t *list; 60 ds_display_t *disp = (ds_display_t *)arg;61 68 ds_window_t *wnd; 62 69 unsigned i; … … 68 75 return ENOMEM; 69 76 77 ds_display_lock(wmclient->display); 78 70 79 /* Count the number of windows */ 71 80 list->nwindows = 0; 72 wnd = ds_display_first_window( disp);81 wnd = ds_display_first_window(wmclient->display); 73 82 while (wnd != NULL) { 74 83 ++list->nwindows; … … 79 88 list->windows = calloc(list->nwindows, sizeof(sysarg_t)); 80 89 if (list->windows == NULL) { 90 ds_display_unlock(wmclient->display); 81 91 free(list); 82 92 return ENOMEM; … … 85 95 /* Fill in window IDs */ 86 96 i = 0; 87 wnd = ds_display_first_window( disp);97 wnd = ds_display_first_window(wmclient->display); 88 98 while (wnd != NULL) { 89 99 list->windows[i++] = wnd->id; … … 91 101 } 92 102 103 ds_display_unlock(wmclient->display); 93 104 *rlist = list; 94 105 return EOK; 95 106 } 96 107 108 /** Get window information. 109 * 110 * @param arg Argument (WM client) 111 * @param wnd_id Window ID 112 * @param rinfo Place to store pointer to new window information structure 113 * @return EOK on success or an error code 114 */ 97 115 static errno_t dispwm_get_window_info(void *arg, sysarg_t wnd_id, 98 116 wndmgt_window_info_t **rinfo) 99 117 { 100 ds_ display_t *disp = (ds_display_t *)arg;118 ds_wmclient_t *wmclient = (ds_wmclient_t *)arg; 101 119 ds_window_t *wnd; 102 120 wndmgt_window_info_t *info; … … 104 122 log_msg(LOG_DEFAULT, LVL_DEBUG, "dispwm_get_window_info()"); 105 123 106 wnd = ds_display_find_window(disp, wnd_id); 107 if (wnd == NULL) 124 ds_display_lock(wmclient->display); 125 wnd = ds_display_find_window(wmclient->display, wnd_id); 126 if (wnd == NULL) { 127 ds_display_unlock(wmclient->display); 108 128 return ENOENT; 129 } 109 130 110 131 info = calloc(1, sizeof(wndmgt_window_info_t)); 111 if (info == NULL) 132 if (info == NULL) { 133 ds_display_unlock(wmclient->display); 112 134 return ENOMEM; 135 } 113 136 114 137 info->caption = str_dup(wnd->caption); 115 138 if (info->caption == NULL) { 139 ds_display_unlock(wmclient->display); 116 140 free(info); 117 141 return ENOMEM; 118 142 } 119 143 144 ds_display_unlock(wmclient->display); 120 145 *rinfo = info; 121 146 return EOK; 122 147 } 123 148 149 /** Activate window. 150 * 151 * @param arg Argument (WM client) 152 * @param wnd_id Window ID 153 * @return EOK on success or an error code 154 */ 124 155 static errno_t dispwm_activate_window(void *arg, sysarg_t wnd_id) 125 156 { … … 130 161 } 131 162 163 /** Close window. 164 * 165 * @param arg Argument (WM client) 166 * @param wnd_id Window ID 167 * @return EOK on success or an error code 168 */ 132 169 static errno_t dispwm_close_window(void *arg, sysarg_t wnd_id) 133 170 { … … 138 175 } 139 176 177 /** Get window management event. 178 * 179 * @param arg Argument (WM client) 180 * @param ev Place to store event 181 * @return EOK on success, ENOENT if there are no events 182 */ 140 183 static errno_t dispwm_get_event(void *arg, wndmgt_ev_t *ev) 141 184 { 142 return ENOTSUP; 185 ds_wmclient_t *wmclient = (ds_wmclient_t *)arg; 186 errno_t rc; 187 188 log_msg(LOG_DEFAULT, LVL_DEBUG, "dispwm_get_event()"); 189 190 ds_display_lock(wmclient->display); 191 rc = ds_wmclient_get_event(wmclient, ev); 192 ds_display_unlock(wmclient->display); 193 return rc; 143 194 } 144 195
Note:
See TracChangeset
for help on using the changeset viewer.