Changeset 3731d31 in mainline for uspace/srv/hid/compositor/compositor.c
- Timestamp:
- 2013-09-12T14:52:58Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b11f6fb
- Parents:
- 6e75f2d (diff), f9f45e7 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/compositor/compositor.c
r6e75f2d r3731d31 143 143 static LIST_INITIALIZE(viewport_list); 144 144 145 static FIBRIL_MUTEX_INITIALIZE(discovery_mtx); 146 145 147 /** Input server proxy */ 146 148 static input_t *input; … … 2114 2116 } 2115 2117 2118 static int discover_viewports(void) 2119 { 2120 /* Create viewports and connect them to visualizers. */ 2121 category_id_t cat_id; 2122 int rc = loc_category_get_id("visualizer", &cat_id, IPC_FLAG_BLOCKING); 2123 if (rc != EOK) { 2124 printf("%s: Failed to get visualizer category.\n", NAME); 2125 return -1; 2126 } 2127 2128 service_id_t *svcs; 2129 size_t svcs_cnt = 0; 2130 rc = loc_category_get_svcs(cat_id, &svcs, &svcs_cnt); 2131 if (rc != EOK || svcs_cnt == 0) { 2132 printf("%s: Failed to get visualizer category services.\n", NAME); 2133 return -1; 2134 } 2135 2136 fibril_mutex_lock(&viewport_list_mtx); 2137 for (size_t i = 0; i < svcs_cnt; ++i) { 2138 bool exists = false; 2139 list_foreach(viewport_list, link, viewport_t, vp) { 2140 if (vp->dsid == svcs[i]) { 2141 exists = true; 2142 break; 2143 } 2144 } 2145 2146 if (exists) 2147 continue; 2148 2149 char *svc_name; 2150 rc = loc_service_get_name(svcs[i], &svc_name); 2151 if (rc == EOK) { 2152 viewport_t *vp = viewport_create(svc_name); 2153 if (vp != NULL) { 2154 list_append(&vp->link, &viewport_list); 2155 } 2156 } 2157 } 2158 fibril_mutex_unlock(&viewport_list_mtx); 2159 2160 /* TODO damage only newly added viewports */ 2161 comp_damage(0, 0, UINT32_MAX, UINT32_MAX); 2162 return EOK; 2163 } 2164 2165 static void category_change_cb(void) 2166 { 2167 fibril_mutex_lock(&discovery_mtx); 2168 discover_viewports(); 2169 fibril_mutex_unlock(&discovery_mtx); 2170 } 2171 2116 2172 static int compositor_srv_init(char *input_svc, char *name) 2117 2173 { … … 2165 2221 } 2166 2222 2167 /* Create viewports and connect them to visualizers. */ 2168 category_id_t cat_id; 2169 rc = loc_category_get_id("visualizer", &cat_id, IPC_FLAG_BLOCKING); 2223 rc = loc_register_cat_change_cb(category_change_cb); 2170 2224 if (rc != EOK) { 2171 printf("%s: Failed to get visualizer category.\n", NAME);2225 printf("%s: Failed to register category change callback\n", NAME); 2172 2226 input_disconnect(); 2173 return -1; 2174 } 2175 2176 service_id_t *svcs; 2177 size_t svcs_cnt = 0; 2178 rc = loc_category_get_svcs(cat_id, &svcs, &svcs_cnt); 2179 if (rc != EOK || svcs_cnt == 0) { 2180 printf("%s: Failed to get visualizer category services.\n", NAME); 2227 return rc; 2228 } 2229 2230 rc = discover_viewports(); 2231 if (rc != EOK) { 2181 2232 input_disconnect(); 2182 return -1; 2183 } 2184 2185 for (size_t i = 0; i < svcs_cnt; ++i) { 2186 char *svc_name; 2187 rc = loc_service_get_name(svcs[i], &svc_name); 2188 if (rc == EOK) { 2189 viewport_t *vp = viewport_create(svc_name); 2190 if (vp != NULL) { 2191 list_append(&vp->link, &viewport_list); 2192 } 2193 } 2233 return rc; 2194 2234 } 2195 2235 … … 2203 2243 comp_damage(0, 0, UINT32_MAX, UINT32_MAX); 2204 2244 2245 2205 2246 return EOK; 2206 2247 }
Note:
See TracChangeset
for help on using the changeset viewer.