| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/exo/wayland/server.h" | 5 #include "components/exo/wayland/server.h" |
| 6 | 6 |
| 7 #include <grp.h> | 7 #include <grp.h> |
| 8 #include <linux/input.h> | 8 #include <linux/input.h> |
| 9 #include <stddef.h> | 9 #include <stddef.h> |
| 10 #include <stdint.h> | 10 #include <stdint.h> |
| 11 #include <viewporter-server-protocol.h> | 11 #include <viewporter-server-protocol.h> |
| 12 #include <wayland-server-core.h> | 12 #include <wayland-server-core.h> |
| 13 #include <wayland-server-protocol-core.h> | 13 #include <wayland-server-protocol-core.h> |
| 14 | 14 |
| 15 // Note: core wayland headers need to be included before protocol headers. | 15 // Note: core wayland headers need to be included before protocol headers. |
| 16 #include <alpha-compositing-unstable-v1-server-protocol.h> // NOLINT | 16 #include <alpha-compositing-unstable-v1-server-protocol.h> // NOLINT |
| 17 #include <gaming-input-unstable-v1-server-protocol.h> // NOLINT | 17 #include <gaming-input-unstable-v1-server-protocol.h> // NOLINT |
| 18 #include <remote-shell-unstable-v1-server-protocol.h> // NOLINT | 18 #include <remote-shell-unstable-v1-server-protocol.h> // NOLINT |
| 19 #include <secure-output-unstable-v1-server-protocol.h> // NOLINT | 19 #include <secure-output-unstable-v1-server-protocol.h> // NOLINT |
| 20 #include <stylus-unstable-v1-server-protocol.h> // NOLINT | 20 #include <stylus-unstable-v1-server-protocol.h> // NOLINT |
| 21 #include <vsync-feedback-unstable-v1-server-protocol.h> // NOLINT |
| 21 #include <xdg-shell-unstable-v5-server-protocol.h> // NOLINT | 22 #include <xdg-shell-unstable-v5-server-protocol.h> // NOLINT |
| 22 #include <vsync-feedback-unstable-v1-server-protocol.h> // NOLINT | 23 #include <xdg-shell-unstable-v6-server-protocol.h> // NOLINT |
| 23 | 24 |
| 24 #include <algorithm> | 25 #include <algorithm> |
| 25 #include <cstdlib> | 26 #include <cstdlib> |
| 26 #include <iterator> | 27 #include <iterator> |
| 27 #include <string> | 28 #include <string> |
| 28 #include <utility> | 29 #include <utility> |
| 29 | 30 |
| 30 #include "ash/common/shell_observer.h" | 31 #include "ash/common/shell_observer.h" |
| 31 #include "ash/common/shell_window_ids.h" | 32 #include "ash/common/shell_window_ids.h" |
| 32 #include "ash/shell.h" | 33 #include "ash/shell.h" |
| (...skipping 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1116 | 1117 |
| 1117 void bind_output(wl_client* client, void* data, uint32_t version, uint32_t id) { | 1118 void bind_output(wl_client* client, void* data, uint32_t version, uint32_t id) { |
| 1118 wl_resource* resource = wl_resource_create( | 1119 wl_resource* resource = wl_resource_create( |
| 1119 client, &wl_output_interface, std::min(version, output_version), id); | 1120 client, &wl_output_interface, std::min(version, output_version), id); |
| 1120 | 1121 |
| 1121 SetImplementation(resource, nullptr, | 1122 SetImplementation(resource, nullptr, |
| 1122 base::MakeUnique<WaylandPrimaryDisplayObserver>(resource)); | 1123 base::MakeUnique<WaylandPrimaryDisplayObserver>(resource)); |
| 1123 } | 1124 } |
| 1124 | 1125 |
| 1125 //////////////////////////////////////////////////////////////////////////////// | 1126 //////////////////////////////////////////////////////////////////////////////// |
| 1127 // xdg_positioner_interface: |
| 1128 |
| 1129 void xdg_positioner_v6_destroy(wl_client* client, wl_resource* resource) { |
| 1130 wl_resource_destroy(resource); |
| 1131 } |
| 1132 |
| 1133 void xdg_positioner_v6_set_size(wl_client* client, |
| 1134 wl_resource* resource, |
| 1135 int32_t width, |
| 1136 int32_t height) { |
| 1137 NOTIMPLEMENTED(); |
| 1138 } |
| 1139 |
| 1140 void xdg_positioner_v6_set_anchor_rect(wl_client* client, |
| 1141 wl_resource* resource, |
| 1142 int32_t x, |
| 1143 int32_t y, |
| 1144 int32_t width, |
| 1145 int32_t height) { |
| 1146 NOTIMPLEMENTED(); |
| 1147 } |
| 1148 |
| 1149 void xdg_positioner_v6_set_anchor(wl_client* client, |
| 1150 wl_resource* resource, |
| 1151 uint32_t anchor) { |
| 1152 NOTIMPLEMENTED(); |
| 1153 } |
| 1154 |
| 1155 void xdg_positioner_v6_set_gravity(wl_client* client, |
| 1156 wl_resource* resource, |
| 1157 uint32_t gravity) { |
| 1158 NOTIMPLEMENTED(); |
| 1159 } |
| 1160 |
| 1161 void xdg_positioner_v6_set_constraint_adjustment( |
| 1162 wl_client* client, |
| 1163 wl_resource* resource, |
| 1164 uint32_t constraint_adjustment) { |
| 1165 NOTIMPLEMENTED(); |
| 1166 } |
| 1167 |
| 1168 void xdg_positioner_v6_set_offset(wl_client* client, |
| 1169 wl_resource* resource, |
| 1170 int32_t x, |
| 1171 int32_t y) { |
| 1172 NOTIMPLEMENTED(); |
| 1173 } |
| 1174 |
| 1175 const struct zxdg_positioner_v6_interface xdg_positioner_v6_implementation = { |
| 1176 xdg_positioner_v6_destroy, |
| 1177 xdg_positioner_v6_set_size, |
| 1178 xdg_positioner_v6_set_anchor_rect, |
| 1179 xdg_positioner_v6_set_anchor, |
| 1180 xdg_positioner_v6_set_gravity, |
| 1181 xdg_positioner_v6_set_constraint_adjustment, |
| 1182 xdg_positioner_v6_set_offset}; |
| 1183 |
| 1184 //////////////////////////////////////////////////////////////////////////////// |
| 1185 // xdg_toplevel_interface: |
| 1186 |
| 1187 int XdgToplevelV6ResizeComponent(uint32_t edges) { |
| 1188 switch (edges) { |
| 1189 case ZXDG_TOPLEVEL_V6_RESIZE_EDGE_TOP: |
| 1190 return HTTOP; |
| 1191 case ZXDG_TOPLEVEL_V6_RESIZE_EDGE_BOTTOM: |
| 1192 return HTBOTTOM; |
| 1193 case ZXDG_TOPLEVEL_V6_RESIZE_EDGE_LEFT: |
| 1194 return HTLEFT; |
| 1195 case ZXDG_TOPLEVEL_V6_RESIZE_EDGE_TOP_LEFT: |
| 1196 return HTTOPLEFT; |
| 1197 case ZXDG_TOPLEVEL_V6_RESIZE_EDGE_BOTTOM_LEFT: |
| 1198 return HTBOTTOMLEFT; |
| 1199 case ZXDG_TOPLEVEL_V6_RESIZE_EDGE_RIGHT: |
| 1200 return HTRIGHT; |
| 1201 case ZXDG_TOPLEVEL_V6_RESIZE_EDGE_TOP_RIGHT: |
| 1202 return HTTOPRIGHT; |
| 1203 case ZXDG_TOPLEVEL_V6_RESIZE_EDGE_BOTTOM_RIGHT: |
| 1204 return HTBOTTOMRIGHT; |
| 1205 default: |
| 1206 return HTBOTTOMRIGHT; |
| 1207 } |
| 1208 } |
| 1209 |
| 1210 void xdg_toplevel_v6_destroy(wl_client* client, wl_resource* resource) { |
| 1211 wl_resource_destroy(resource); |
| 1212 } |
| 1213 |
| 1214 void xdg_toplevel_v6_set_parent(wl_client* client, |
| 1215 wl_resource* resource, |
| 1216 wl_resource* parent) { |
| 1217 if (!parent) { |
| 1218 GetUserDataAs<ShellSurface>(resource)->SetParent(nullptr); |
| 1219 return; |
| 1220 } |
| 1221 |
| 1222 // This is a noop if parent has not been mapped. |
| 1223 ShellSurface* shell_surface = GetUserDataAs<ShellSurface>(parent); |
| 1224 if (shell_surface->GetWidget()) |
| 1225 GetUserDataAs<ShellSurface>(resource)->SetParent(shell_surface); |
| 1226 } |
| 1227 |
| 1228 void xdg_toplevel_v6_set_title(wl_client* client, |
| 1229 wl_resource* resource, |
| 1230 const char* title) { |
| 1231 GetUserDataAs<ShellSurface>(resource)->SetTitle( |
| 1232 base::string16(base::UTF8ToUTF16(title))); |
| 1233 } |
| 1234 |
| 1235 void xdg_toplevel_v6_set_add_id(wl_client* client, |
| 1236 wl_resource* resource, |
| 1237 const char* app_id) { |
| 1238 GetUserDataAs<ShellSurface>(resource)->SetApplicationId(app_id); |
| 1239 } |
| 1240 |
| 1241 void xdg_toplevel_v6_show_window_menu(wl_client* client, |
| 1242 wl_resource* resource, |
| 1243 wl_resource* seat, |
| 1244 uint32_t serial, |
| 1245 int32_t x, |
| 1246 int32_t y) { |
| 1247 NOTIMPLEMENTED(); |
| 1248 } |
| 1249 |
| 1250 void xdg_toplevel_v6_move(wl_client* client, |
| 1251 wl_resource* resource, |
| 1252 wl_resource* seat, |
| 1253 uint32_t serial) { |
| 1254 GetUserDataAs<ShellSurface>(resource)->Move(); |
| 1255 } |
| 1256 |
| 1257 void xdg_toplevel_v6_resize(wl_client* client, |
| 1258 wl_resource* resource, |
| 1259 wl_resource* seat, |
| 1260 uint32_t serial, |
| 1261 uint32_t edges) { |
| 1262 int component = XdgToplevelV6ResizeComponent(edges); |
| 1263 if (component != HTNOWHERE) |
| 1264 GetUserDataAs<ShellSurface>(resource)->Resize(component); |
| 1265 } |
| 1266 |
| 1267 void xdg_toplevel_v6_set_max_size(wl_client* client, |
| 1268 wl_resource* resource, |
| 1269 int32_t width, |
| 1270 int32_t height) { |
| 1271 NOTIMPLEMENTED(); |
| 1272 } |
| 1273 |
| 1274 void xdg_toplevel_v6_set_min_size(wl_client* client, |
| 1275 wl_resource* resource, |
| 1276 int32_t width, |
| 1277 int32_t height) { |
| 1278 NOTIMPLEMENTED(); |
| 1279 } |
| 1280 |
| 1281 void xdg_toplevel_v6_set_maximized(wl_client* client, wl_resource* resource) { |
| 1282 GetUserDataAs<ShellSurface>(resource)->Maximize(); |
| 1283 } |
| 1284 |
| 1285 void xdg_toplevel_v6_unset_maximized(wl_client* client, wl_resource* resource) { |
| 1286 GetUserDataAs<ShellSurface>(resource)->Restore(); |
| 1287 } |
| 1288 |
| 1289 void xdg_toplevel_v6_set_fullscreen(wl_client* client, |
| 1290 wl_resource* resource, |
| 1291 wl_resource* output) { |
| 1292 GetUserDataAs<ShellSurface>(resource)->SetFullscreen(true); |
| 1293 } |
| 1294 |
| 1295 void xdg_toplevel_v6_unset_fullscreen(wl_client* client, |
| 1296 wl_resource* resource) { |
| 1297 GetUserDataAs<ShellSurface>(resource)->SetFullscreen(false); |
| 1298 } |
| 1299 |
| 1300 void xdg_toplevel_v6_set_minimized(wl_client* client, wl_resource* resource) { |
| 1301 GetUserDataAs<ShellSurface>(resource)->Minimize(); |
| 1302 } |
| 1303 |
| 1304 const struct zxdg_toplevel_v6_interface xdg_toplevel_v6_implementation = { |
| 1305 xdg_toplevel_v6_destroy, xdg_toplevel_v6_set_parent, |
| 1306 xdg_toplevel_v6_set_title, xdg_toplevel_v6_set_add_id, |
| 1307 xdg_toplevel_v6_show_window_menu, xdg_toplevel_v6_move, |
| 1308 xdg_toplevel_v6_resize, xdg_toplevel_v6_set_max_size, |
| 1309 xdg_toplevel_v6_set_min_size, xdg_toplevel_v6_set_maximized, |
| 1310 xdg_toplevel_v6_unset_maximized, xdg_toplevel_v6_set_fullscreen, |
| 1311 xdg_toplevel_v6_unset_fullscreen, xdg_toplevel_v6_set_minimized}; |
| 1312 |
| 1313 //////////////////////////////////////////////////////////////////////////////// |
| 1314 // xdg_popup_interface: |
| 1315 |
| 1316 void xdg_popup_v5_destroy(wl_client* client, wl_resource* resource) { |
| 1317 wl_resource_destroy(resource); |
| 1318 } |
| 1319 |
| 1320 const struct xdg_popup_interface xdg_popup_v5_implementation = { |
| 1321 xdg_popup_v5_destroy}; |
| 1322 |
| 1323 void xdg_popup_v6_destroy(wl_client* client, wl_resource* resource) { |
| 1324 wl_resource_destroy(resource); |
| 1325 } |
| 1326 |
| 1327 void xdg_popup_v6_grab(wl_client* client, |
| 1328 wl_resource* resource, |
| 1329 wl_resource* seat, |
| 1330 uint32_t serial) { |
| 1331 NOTIMPLEMENTED(); |
| 1332 } |
| 1333 |
| 1334 const struct zxdg_popup_v6_interface xdg_popup_v6_implementation = { |
| 1335 xdg_popup_v6_destroy, xdg_popup_v6_grab}; |
| 1336 |
| 1337 //////////////////////////////////////////////////////////////////////////////// |
| 1126 // xdg_surface_interface: | 1338 // xdg_surface_interface: |
| 1127 | 1339 |
| 1128 int XdgResizeComponent(uint32_t edges) { | 1340 int XdgSurfaceV5ResizeComponent(uint32_t edges) { |
| 1129 switch (edges) { | 1341 switch (edges) { |
| 1130 case XDG_SURFACE_RESIZE_EDGE_TOP: | 1342 case XDG_SURFACE_RESIZE_EDGE_TOP: |
| 1131 return HTTOP; | 1343 return HTTOP; |
| 1132 case XDG_SURFACE_RESIZE_EDGE_BOTTOM: | 1344 case XDG_SURFACE_RESIZE_EDGE_BOTTOM: |
| 1133 return HTBOTTOM; | 1345 return HTBOTTOM; |
| 1134 case XDG_SURFACE_RESIZE_EDGE_LEFT: | 1346 case XDG_SURFACE_RESIZE_EDGE_LEFT: |
| 1135 return HTLEFT; | 1347 return HTLEFT; |
| 1136 case XDG_SURFACE_RESIZE_EDGE_TOP_LEFT: | 1348 case XDG_SURFACE_RESIZE_EDGE_TOP_LEFT: |
| 1137 return HTTOPLEFT; | 1349 return HTTOPLEFT; |
| 1138 case XDG_SURFACE_RESIZE_EDGE_BOTTOM_LEFT: | 1350 case XDG_SURFACE_RESIZE_EDGE_BOTTOM_LEFT: |
| 1139 return HTBOTTOMLEFT; | 1351 return HTBOTTOMLEFT; |
| 1140 case XDG_SURFACE_RESIZE_EDGE_RIGHT: | 1352 case XDG_SURFACE_RESIZE_EDGE_RIGHT: |
| 1141 return HTRIGHT; | 1353 return HTRIGHT; |
| 1142 case XDG_SURFACE_RESIZE_EDGE_TOP_RIGHT: | 1354 case XDG_SURFACE_RESIZE_EDGE_TOP_RIGHT: |
| 1143 return HTTOPRIGHT; | 1355 return HTTOPRIGHT; |
| 1144 case XDG_SURFACE_RESIZE_EDGE_BOTTOM_RIGHT: | 1356 case XDG_SURFACE_RESIZE_EDGE_BOTTOM_RIGHT: |
| 1145 return HTBOTTOMRIGHT; | 1357 return HTBOTTOMRIGHT; |
| 1146 default: | 1358 default: |
| 1147 return HTBOTTOMRIGHT; | 1359 return HTBOTTOMRIGHT; |
| 1148 } | 1360 } |
| 1149 } | 1361 } |
| 1150 | 1362 |
| 1151 void xdg_surface_destroy(wl_client* client, wl_resource* resource) { | 1363 void xdg_surface_v5_destroy(wl_client* client, wl_resource* resource) { |
| 1152 wl_resource_destroy(resource); | 1364 wl_resource_destroy(resource); |
| 1153 } | 1365 } |
| 1154 | 1366 |
| 1155 void xdg_surface_set_parent(wl_client* client, | 1367 void xdg_surface_v5_set_parent(wl_client* client, |
| 1156 wl_resource* resource, | 1368 wl_resource* resource, |
| 1157 wl_resource* parent) { | 1369 wl_resource* parent) { |
| 1158 if (!parent) { | 1370 if (!parent) { |
| 1159 GetUserDataAs<ShellSurface>(resource)->SetParent(nullptr); | 1371 GetUserDataAs<ShellSurface>(resource)->SetParent(nullptr); |
| 1160 return; | 1372 return; |
| 1161 } | 1373 } |
| 1162 | 1374 |
| 1163 // This is a noop if parent has not been mapped. | 1375 // This is a noop if parent has not been mapped. |
| 1164 ShellSurface* shell_surface = GetUserDataAs<ShellSurface>(parent); | 1376 ShellSurface* shell_surface = GetUserDataAs<ShellSurface>(parent); |
| 1165 if (shell_surface->GetWidget()) | 1377 if (shell_surface->GetWidget()) |
| 1166 GetUserDataAs<ShellSurface>(resource)->SetParent(shell_surface); | 1378 GetUserDataAs<ShellSurface>(resource)->SetParent(shell_surface); |
| 1167 } | 1379 } |
| 1168 | 1380 |
| 1169 void xdg_surface_set_title(wl_client* client, | 1381 void xdg_surface_v5_set_title(wl_client* client, |
| 1170 wl_resource* resource, | 1382 wl_resource* resource, |
| 1171 const char* title) { | 1383 const char* title) { |
| 1172 GetUserDataAs<ShellSurface>(resource) | 1384 GetUserDataAs<ShellSurface>(resource) |
| 1173 ->SetTitle(base::string16(base::UTF8ToUTF16(title))); | 1385 ->SetTitle(base::string16(base::UTF8ToUTF16(title))); |
| 1174 } | 1386 } |
| 1175 | 1387 |
| 1176 void xdg_surface_set_add_id(wl_client* client, | 1388 void xdg_surface_v5_set_add_id(wl_client* client, |
| 1177 wl_resource* resource, | 1389 wl_resource* resource, |
| 1178 const char* app_id) { | 1390 const char* app_id) { |
| 1179 GetUserDataAs<ShellSurface>(resource)->SetApplicationId(app_id); | 1391 GetUserDataAs<ShellSurface>(resource)->SetApplicationId(app_id); |
| 1180 } | 1392 } |
| 1181 | 1393 |
| 1182 void xdg_surface_show_window_menu(wl_client* client, | 1394 void xdg_surface_v5_show_window_menu(wl_client* client, |
| 1183 wl_resource* resource, | 1395 wl_resource* resource, |
| 1184 wl_resource* seat, | 1396 wl_resource* seat, |
| 1185 uint32_t serial, | 1397 uint32_t serial, |
| 1186 int32_t x, | 1398 int32_t x, |
| 1187 int32_t y) { | 1399 int32_t y) { |
| 1188 NOTIMPLEMENTED(); | 1400 NOTIMPLEMENTED(); |
| 1189 } | 1401 } |
| 1190 | 1402 |
| 1191 void xdg_surface_move(wl_client* client, | 1403 void xdg_surface_v5_move(wl_client* client, |
| 1192 wl_resource* resource, | 1404 wl_resource* resource, |
| 1193 wl_resource* seat, | 1405 wl_resource* seat, |
| 1194 uint32_t serial) { | 1406 uint32_t serial) { |
| 1195 GetUserDataAs<ShellSurface>(resource)->Move(); | 1407 GetUserDataAs<ShellSurface>(resource)->Move(); |
| 1196 } | 1408 } |
| 1197 | 1409 |
| 1198 void xdg_surface_resize(wl_client* client, | 1410 void xdg_surface_v5_resize(wl_client* client, |
| 1199 wl_resource* resource, | 1411 wl_resource* resource, |
| 1200 wl_resource* seat, | 1412 wl_resource* seat, |
| 1201 uint32_t serial, | 1413 uint32_t serial, |
| 1202 uint32_t edges) { | 1414 uint32_t edges) { |
| 1203 int component = XdgResizeComponent(edges); | 1415 int component = XdgSurfaceV5ResizeComponent(edges); |
| 1204 if (component != HTNOWHERE) | 1416 if (component != HTNOWHERE) |
| 1205 GetUserDataAs<ShellSurface>(resource)->Resize(component); | 1417 GetUserDataAs<ShellSurface>(resource)->Resize(component); |
| 1206 } | 1418 } |
| 1207 | 1419 |
| 1208 void xdg_surface_ack_configure(wl_client* client, | 1420 void xdg_surface_v5_ack_configure(wl_client* client, |
| 1209 wl_resource* resource, | 1421 wl_resource* resource, |
| 1210 uint32_t serial) { | 1422 uint32_t serial) { |
| 1211 GetUserDataAs<ShellSurface>(resource)->AcknowledgeConfigure(serial); | 1423 GetUserDataAs<ShellSurface>(resource)->AcknowledgeConfigure(serial); |
| 1212 } | 1424 } |
| 1213 | 1425 |
| 1214 void xdg_surface_set_window_geometry(wl_client* client, | 1426 void xdg_surface_v5_set_window_geometry(wl_client* client, |
| 1215 wl_resource* resource, | 1427 wl_resource* resource, |
| 1216 int32_t x, | 1428 int32_t x, |
| 1217 int32_t y, | 1429 int32_t y, |
| 1218 int32_t width, | 1430 int32_t width, |
| 1219 int32_t height) { | 1431 int32_t height) { |
| 1220 GetUserDataAs<ShellSurface>(resource) | 1432 GetUserDataAs<ShellSurface>(resource) |
| 1221 ->SetGeometry(gfx::Rect(x, y, width, height)); | 1433 ->SetGeometry(gfx::Rect(x, y, width, height)); |
| 1222 } | 1434 } |
| 1223 | 1435 |
| 1224 void xdg_surface_set_maximized(wl_client* client, wl_resource* resource) { | 1436 void xdg_surface_v5_set_maximized(wl_client* client, wl_resource* resource) { |
| 1225 GetUserDataAs<ShellSurface>(resource)->Maximize(); | 1437 GetUserDataAs<ShellSurface>(resource)->Maximize(); |
| 1226 } | 1438 } |
| 1227 | 1439 |
| 1228 void xdg_surface_unset_maximized(wl_client* client, wl_resource* resource) { | 1440 void xdg_surface_v5_unset_maximized(wl_client* client, wl_resource* resource) { |
| 1229 GetUserDataAs<ShellSurface>(resource)->Restore(); | 1441 GetUserDataAs<ShellSurface>(resource)->Restore(); |
| 1230 } | 1442 } |
| 1231 | 1443 |
| 1232 void xdg_surface_set_fullscreen(wl_client* client, | 1444 void xdg_surface_v5_set_fullscreen(wl_client* client, |
| 1233 wl_resource* resource, | 1445 wl_resource* resource, |
| 1234 wl_resource* output) { | 1446 wl_resource* output) { |
| 1235 GetUserDataAs<ShellSurface>(resource)->SetFullscreen(true); | 1447 GetUserDataAs<ShellSurface>(resource)->SetFullscreen(true); |
| 1236 } | 1448 } |
| 1237 | 1449 |
| 1238 void xdg_surface_unset_fullscreen(wl_client* client, wl_resource* resource) { | 1450 void xdg_surface_v5_unset_fullscreen(wl_client* client, wl_resource* resource) { |
| 1239 GetUserDataAs<ShellSurface>(resource)->SetFullscreen(false); | 1451 GetUserDataAs<ShellSurface>(resource)->SetFullscreen(false); |
| 1240 } | 1452 } |
| 1241 | 1453 |
| 1242 void xdg_surface_set_minimized(wl_client* client, wl_resource* resource) { | 1454 void xdg_surface_v5_set_minimized(wl_client* client, wl_resource* resource) { |
| 1243 GetUserDataAs<ShellSurface>(resource)->Minimize(); | 1455 GetUserDataAs<ShellSurface>(resource)->Minimize(); |
| 1244 } | 1456 } |
| 1245 | 1457 |
| 1246 const struct xdg_surface_interface xdg_surface_implementation = { | 1458 const struct xdg_surface_interface xdg_surface_v5_implementation = { |
| 1247 xdg_surface_destroy, | 1459 xdg_surface_v5_destroy, |
| 1248 xdg_surface_set_parent, | 1460 xdg_surface_v5_set_parent, |
| 1249 xdg_surface_set_title, | 1461 xdg_surface_v5_set_title, |
| 1250 xdg_surface_set_add_id, | 1462 xdg_surface_v5_set_add_id, |
| 1251 xdg_surface_show_window_menu, | 1463 xdg_surface_v5_show_window_menu, |
| 1252 xdg_surface_move, | 1464 xdg_surface_v5_move, |
| 1253 xdg_surface_resize, | 1465 xdg_surface_v5_resize, |
| 1254 xdg_surface_ack_configure, | 1466 xdg_surface_v5_ack_configure, |
| 1255 xdg_surface_set_window_geometry, | 1467 xdg_surface_v5_set_window_geometry, |
| 1256 xdg_surface_set_maximized, | 1468 xdg_surface_v5_set_maximized, |
| 1257 xdg_surface_unset_maximized, | 1469 xdg_surface_v5_unset_maximized, |
| 1258 xdg_surface_set_fullscreen, | 1470 xdg_surface_v5_set_fullscreen, |
| 1259 xdg_surface_unset_fullscreen, | 1471 xdg_surface_v5_unset_fullscreen, |
| 1260 xdg_surface_set_minimized}; | 1472 xdg_surface_v5_set_minimized}; |
| 1261 | 1473 |
| 1262 //////////////////////////////////////////////////////////////////////////////// | 1474 void xdg_surface_v6_destroy(wl_client* client, wl_resource* resource) { |
| 1263 // xdg_popup_interface: | |
| 1264 | |
| 1265 void xdg_popup_destroy(wl_client* client, wl_resource* resource) { | |
| 1266 wl_resource_destroy(resource); | 1475 wl_resource_destroy(resource); |
| 1267 } | 1476 } |
| 1268 | 1477 |
| 1269 const struct xdg_popup_interface xdg_popup_implementation = {xdg_popup_destroy}; | 1478 void HandleXdgToplevelV6CloseCallback(wl_resource* resource) { |
| 1479 zxdg_toplevel_v6_send_close(resource); |
| 1480 wl_client_flush(wl_resource_get_client(resource)); |
| 1481 } |
| 1482 |
| 1483 void AddXdgToplevelV6State(wl_array* states, zxdg_toplevel_v6_state state) { |
| 1484 zxdg_toplevel_v6_state* value = static_cast<zxdg_toplevel_v6_state*>( |
| 1485 wl_array_add(states, sizeof(zxdg_toplevel_v6_state))); |
| 1486 DCHECK(value); |
| 1487 *value = state; |
| 1488 } |
| 1489 |
| 1490 uint32_t HandleXdgToplevelV6ConfigureCallback( |
| 1491 wl_resource* resource, |
| 1492 wl_resource* surface_resource, |
| 1493 const gfx::Size& size, |
| 1494 ash::wm::WindowStateType state_type, |
| 1495 bool resizing, |
| 1496 bool activated) { |
| 1497 wl_array states; |
| 1498 wl_array_init(&states); |
| 1499 if (state_type == ash::wm::WINDOW_STATE_TYPE_MAXIMIZED) |
| 1500 AddXdgToplevelV6State(&states, ZXDG_TOPLEVEL_V6_STATE_MAXIMIZED); |
| 1501 if (state_type == ash::wm::WINDOW_STATE_TYPE_FULLSCREEN) |
| 1502 AddXdgToplevelV6State(&states, ZXDG_TOPLEVEL_V6_STATE_FULLSCREEN); |
| 1503 if (resizing) |
| 1504 AddXdgToplevelV6State(&states, ZXDG_TOPLEVEL_V6_STATE_RESIZING); |
| 1505 if (activated) |
| 1506 AddXdgToplevelV6State(&states, ZXDG_TOPLEVEL_V6_STATE_ACTIVATED); |
| 1507 zxdg_toplevel_v6_send_configure(resource, size.width(), size.height(), |
| 1508 &states); |
| 1509 uint32_t serial = wl_display_next_serial( |
| 1510 wl_client_get_display(wl_resource_get_client(surface_resource))); |
| 1511 zxdg_surface_v6_send_configure(surface_resource, serial); |
| 1512 wl_client_flush(wl_resource_get_client(resource)); |
| 1513 wl_array_release(&states); |
| 1514 return serial; |
| 1515 } |
| 1516 |
| 1517 void xdg_surface_v6_get_toplevel(wl_client* client, |
| 1518 wl_resource* resource, |
| 1519 uint32_t id) { |
| 1520 ShellSurface* shell_surface = GetUserDataAs<ShellSurface>(resource); |
| 1521 if (shell_surface->enabled()) { |
| 1522 wl_resource_post_error(resource, ZXDG_SURFACE_V6_ERROR_ALREADY_CONSTRUCTED, |
| 1523 "surface has already been constructed"); |
| 1524 return; |
| 1525 } |
| 1526 |
| 1527 shell_surface->SetEnabled(true); |
| 1528 |
| 1529 wl_resource* xdg_toplevel_resource = |
| 1530 wl_resource_create(client, &zxdg_toplevel_v6_interface, 1, id); |
| 1531 |
| 1532 shell_surface->set_close_callback( |
| 1533 base::Bind(&HandleXdgToplevelV6CloseCallback, |
| 1534 base::Unretained(xdg_toplevel_resource))); |
| 1535 |
| 1536 shell_surface->set_configure_callback(base::Bind( |
| 1537 &HandleXdgToplevelV6ConfigureCallback, |
| 1538 base::Unretained(xdg_toplevel_resource), base::Unretained(resource))); |
| 1539 |
| 1540 wl_resource_set_implementation(xdg_toplevel_resource, |
| 1541 &xdg_toplevel_v6_implementation, shell_surface, |
| 1542 nullptr); |
| 1543 } |
| 1544 |
| 1545 void HandleXdgPopupV6CloseCallback(wl_resource* resource) { |
| 1546 zxdg_popup_v6_send_popup_done(resource); |
| 1547 wl_client_flush(wl_resource_get_client(resource)); |
| 1548 } |
| 1549 |
| 1550 void xdg_surface_v6_get_popup(wl_client* client, |
| 1551 wl_resource* resource, |
| 1552 uint32_t id, |
| 1553 wl_resource* parent, |
| 1554 wl_resource* positioner) { |
| 1555 ShellSurface* shell_surface = GetUserDataAs<ShellSurface>(resource); |
| 1556 if (shell_surface->enabled()) { |
| 1557 wl_resource_post_error(resource, ZXDG_SURFACE_V6_ERROR_ALREADY_CONSTRUCTED, |
| 1558 "surface has already been constructed"); |
| 1559 return; |
| 1560 } |
| 1561 |
| 1562 shell_surface->SetEnabled(true); |
| 1563 |
| 1564 wl_resource* xdg_popup_resource = |
| 1565 wl_resource_create(client, &zxdg_popup_v6_interface, 1, id); |
| 1566 |
| 1567 shell_surface->set_close_callback(base::Bind( |
| 1568 &HandleXdgPopupV6CloseCallback, base::Unretained(xdg_popup_resource))); |
| 1569 |
| 1570 wl_resource_set_implementation( |
| 1571 xdg_popup_resource, &xdg_popup_v6_implementation, shell_surface, nullptr); |
| 1572 } |
| 1573 |
| 1574 void xdg_surface_v6_set_window_geometry(wl_client* client, |
| 1575 wl_resource* resource, |
| 1576 int32_t x, |
| 1577 int32_t y, |
| 1578 int32_t width, |
| 1579 int32_t height) { |
| 1580 GetUserDataAs<ShellSurface>(resource)->SetGeometry( |
| 1581 gfx::Rect(x, y, width, height)); |
| 1582 } |
| 1583 |
| 1584 void xdg_surface_v6_ack_configure(wl_client* client, |
| 1585 wl_resource* resource, |
| 1586 uint32_t serial) { |
| 1587 GetUserDataAs<ShellSurface>(resource)->AcknowledgeConfigure(serial); |
| 1588 } |
| 1589 |
| 1590 const struct zxdg_surface_v6_interface xdg_surface_v6_implementation = { |
| 1591 xdg_surface_v6_destroy, xdg_surface_v6_get_toplevel, |
| 1592 xdg_surface_v6_get_popup, xdg_surface_v6_set_window_geometry, |
| 1593 xdg_surface_v6_ack_configure}; |
| 1270 | 1594 |
| 1271 //////////////////////////////////////////////////////////////////////////////// | 1595 //////////////////////////////////////////////////////////////////////////////// |
| 1272 // xdg_shell_interface: | 1596 // xdg_shell_interface: |
| 1273 | 1597 |
| 1274 void xdg_shell_destroy(wl_client* client, wl_resource* resource) { | 1598 void xdg_shell_v5_destroy(wl_client* client, wl_resource* resource) { |
| 1275 // Nothing to do here. | 1599 // Nothing to do here. |
| 1276 } | 1600 } |
| 1277 | 1601 |
| 1278 // Currently implemented version of the unstable xdg-shell interface. | 1602 // Currently implemented version of the unstable xdg-shell interface. |
| 1279 #define XDG_SHELL_VERSION 5 | 1603 #define XDG_SHELL_VERSION 5 |
| 1280 static_assert(XDG_SHELL_VERSION == XDG_SHELL_VERSION_CURRENT, | 1604 static_assert(XDG_SHELL_VERSION == XDG_SHELL_VERSION_CURRENT, |
| 1281 "Interface version doesn't match implementation version"); | 1605 "Interface version doesn't match implementation version"); |
| 1282 | 1606 |
| 1283 void xdg_shell_use_unstable_version(wl_client* client, | 1607 void xdg_shell_v5_use_unstable_version(wl_client* client, |
| 1284 wl_resource* resource, | 1608 wl_resource* resource, |
| 1285 int32_t version) { | 1609 int32_t version) { |
| 1286 if (version > XDG_SHELL_VERSION) { | 1610 if (version > XDG_SHELL_VERSION) { |
| 1287 wl_resource_post_error(resource, 1, | 1611 wl_resource_post_error(resource, 1, |
| 1288 "xdg-shell version not implemented yet."); | 1612 "xdg-shell version not implemented yet."); |
| 1289 } | 1613 } |
| 1290 } | 1614 } |
| 1291 | 1615 |
| 1292 void HandleXdgSurfaceCloseCallback(wl_resource* resource) { | 1616 void HandleXdgSurfaceV5CloseCallback(wl_resource* resource) { |
| 1293 xdg_surface_send_close(resource); | 1617 xdg_surface_send_close(resource); |
| 1294 wl_client_flush(wl_resource_get_client(resource)); | 1618 wl_client_flush(wl_resource_get_client(resource)); |
| 1295 } | 1619 } |
| 1296 | 1620 |
| 1297 void AddXdgSurfaceState(wl_array* states, xdg_surface_state state) { | 1621 void AddXdgSurfaceV5State(wl_array* states, xdg_surface_state state) { |
| 1298 xdg_surface_state* value = static_cast<xdg_surface_state*>( | 1622 xdg_surface_state* value = static_cast<xdg_surface_state*>( |
| 1299 wl_array_add(states, sizeof(xdg_surface_state))); | 1623 wl_array_add(states, sizeof(xdg_surface_state))); |
| 1300 DCHECK(value); | 1624 DCHECK(value); |
| 1301 *value = state; | 1625 *value = state; |
| 1302 } | 1626 } |
| 1303 | 1627 |
| 1304 uint32_t HandleXdgSurfaceConfigureCallback(wl_resource* resource, | 1628 uint32_t HandleXdgSurfaceV5ConfigureCallback( |
| 1305 const gfx::Size& size, | 1629 wl_resource* resource, |
| 1306 ash::wm::WindowStateType state_type, | 1630 const gfx::Size& size, |
| 1307 bool resizing, | 1631 ash::wm::WindowStateType state_type, |
| 1308 bool activated) { | 1632 bool resizing, |
| 1633 bool activated) { |
| 1309 wl_array states; | 1634 wl_array states; |
| 1310 wl_array_init(&states); | 1635 wl_array_init(&states); |
| 1311 if (state_type == ash::wm::WINDOW_STATE_TYPE_MAXIMIZED) | 1636 if (state_type == ash::wm::WINDOW_STATE_TYPE_MAXIMIZED) |
| 1312 AddXdgSurfaceState(&states, XDG_SURFACE_STATE_MAXIMIZED); | 1637 AddXdgSurfaceV5State(&states, XDG_SURFACE_STATE_MAXIMIZED); |
| 1313 if (state_type == ash::wm::WINDOW_STATE_TYPE_FULLSCREEN) | 1638 if (state_type == ash::wm::WINDOW_STATE_TYPE_FULLSCREEN) |
| 1314 AddXdgSurfaceState(&states, XDG_SURFACE_STATE_FULLSCREEN); | 1639 AddXdgSurfaceV5State(&states, XDG_SURFACE_STATE_FULLSCREEN); |
| 1315 if (resizing) | 1640 if (resizing) |
| 1316 AddXdgSurfaceState(&states, XDG_SURFACE_STATE_RESIZING); | 1641 AddXdgSurfaceV5State(&states, XDG_SURFACE_STATE_RESIZING); |
| 1317 if (activated) | 1642 if (activated) |
| 1318 AddXdgSurfaceState(&states, XDG_SURFACE_STATE_ACTIVATED); | 1643 AddXdgSurfaceV5State(&states, XDG_SURFACE_STATE_ACTIVATED); |
| 1319 uint32_t serial = wl_display_next_serial( | 1644 uint32_t serial = wl_display_next_serial( |
| 1320 wl_client_get_display(wl_resource_get_client(resource))); | 1645 wl_client_get_display(wl_resource_get_client(resource))); |
| 1321 xdg_surface_send_configure(resource, size.width(), size.height(), &states, | 1646 xdg_surface_send_configure(resource, size.width(), size.height(), &states, |
| 1322 serial); | 1647 serial); |
| 1323 wl_client_flush(wl_resource_get_client(resource)); | 1648 wl_client_flush(wl_resource_get_client(resource)); |
| 1324 wl_array_release(&states); | 1649 wl_array_release(&states); |
| 1325 return serial; | 1650 return serial; |
| 1326 } | 1651 } |
| 1327 | 1652 |
| 1328 void xdg_shell_get_xdg_surface(wl_client* client, | 1653 void xdg_shell_v5_get_xdg_surface(wl_client* client, |
| 1329 wl_resource* resource, | 1654 wl_resource* resource, |
| 1330 uint32_t id, | 1655 uint32_t id, |
| 1331 wl_resource* surface) { | 1656 wl_resource* surface) { |
| 1332 std::unique_ptr<ShellSurface> shell_surface = | 1657 std::unique_ptr<ShellSurface> shell_surface = |
| 1333 GetUserDataAs<Display>(resource)->CreateShellSurface( | 1658 GetUserDataAs<Display>(resource)->CreateShellSurface( |
| 1334 GetUserDataAs<Surface>(surface)); | 1659 GetUserDataAs<Surface>(surface)); |
| 1335 if (!shell_surface) { | 1660 if (!shell_surface) { |
| 1336 wl_resource_post_error(resource, XDG_SHELL_ERROR_ROLE, | 1661 wl_resource_post_error(resource, XDG_SHELL_ERROR_ROLE, |
| 1337 "surface has already been assigned a role"); | 1662 "surface has already been assigned a role"); |
| 1338 return; | 1663 return; |
| 1339 } | 1664 } |
| 1340 | 1665 |
| 1341 wl_resource* xdg_surface_resource = | 1666 wl_resource* xdg_surface_resource = |
| 1342 wl_resource_create(client, &xdg_surface_interface, 1, id); | 1667 wl_resource_create(client, &xdg_surface_interface, 1, id); |
| 1343 | 1668 |
| 1344 shell_surface->set_close_callback(base::Bind( | 1669 shell_surface->set_close_callback( |
| 1345 &HandleXdgSurfaceCloseCallback, base::Unretained(xdg_surface_resource))); | 1670 base::Bind(&HandleXdgSurfaceV5CloseCallback, |
| 1671 base::Unretained(xdg_surface_resource))); |
| 1346 | 1672 |
| 1347 shell_surface->set_configure_callback( | 1673 shell_surface->set_configure_callback( |
| 1348 base::Bind(&HandleXdgSurfaceConfigureCallback, | 1674 base::Bind(&HandleXdgSurfaceV5ConfigureCallback, |
| 1349 base::Unretained(xdg_surface_resource))); | 1675 base::Unretained(xdg_surface_resource))); |
| 1350 | 1676 |
| 1351 SetImplementation(xdg_surface_resource, &xdg_surface_implementation, | 1677 SetImplementation(xdg_surface_resource, &xdg_surface_v5_implementation, |
| 1352 std::move(shell_surface)); | 1678 std::move(shell_surface)); |
| 1353 } | 1679 } |
| 1354 | 1680 |
| 1355 void HandleXdgPopupCloseCallback(wl_resource* resource) { | 1681 void HandleXdgPopupV5CloseCallback(wl_resource* resource) { |
| 1356 xdg_popup_send_popup_done(resource); | 1682 xdg_popup_send_popup_done(resource); |
| 1357 wl_client_flush(wl_resource_get_client(resource)); | 1683 wl_client_flush(wl_resource_get_client(resource)); |
| 1358 } | 1684 } |
| 1359 | 1685 |
| 1360 void xdg_shell_get_xdg_popup(wl_client* client, | 1686 void xdg_shell_v5_get_xdg_popup(wl_client* client, |
| 1361 wl_resource* resource, | 1687 wl_resource* resource, |
| 1362 uint32_t id, | 1688 uint32_t id, |
| 1363 wl_resource* surface, | 1689 wl_resource* surface, |
| 1364 wl_resource* parent, | 1690 wl_resource* parent, |
| 1365 wl_resource* seat, | 1691 wl_resource* seat, |
| 1366 uint32_t serial, | 1692 uint32_t serial, |
| 1367 int32_t x, | 1693 int32_t x, |
| 1368 int32_t y) { | 1694 int32_t y) { |
| 1369 // Parent widget can be found by locating the closest ancestor with a widget. | 1695 // Parent widget can be found by locating the closest ancestor with a widget. |
| 1370 views::Widget* parent_widget = nullptr; | 1696 views::Widget* parent_widget = nullptr; |
| 1371 aura::Window* parent_window = GetUserDataAs<Surface>(parent)->window(); | 1697 aura::Window* parent_window = GetUserDataAs<Surface>(parent)->window(); |
| 1372 while (parent_window) { | 1698 while (parent_window) { |
| 1373 parent_widget = views::Widget::GetWidgetForNativeWindow(parent_window); | 1699 parent_widget = views::Widget::GetWidgetForNativeWindow(parent_window); |
| 1374 if (parent_widget) | 1700 if (parent_widget) |
| 1375 break; | 1701 break; |
| 1376 parent_window = parent_window->parent(); | 1702 parent_window = parent_window->parent(); |
| 1377 } | 1703 } |
| 1378 | 1704 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1398 if (!shell_surface) { | 1724 if (!shell_surface) { |
| 1399 wl_resource_post_error(resource, XDG_SHELL_ERROR_ROLE, | 1725 wl_resource_post_error(resource, XDG_SHELL_ERROR_ROLE, |
| 1400 "surface has already been assigned a role"); | 1726 "surface has already been assigned a role"); |
| 1401 return; | 1727 return; |
| 1402 } | 1728 } |
| 1403 | 1729 |
| 1404 wl_resource* xdg_popup_resource = | 1730 wl_resource* xdg_popup_resource = |
| 1405 wl_resource_create(client, &xdg_popup_interface, 1, id); | 1731 wl_resource_create(client, &xdg_popup_interface, 1, id); |
| 1406 | 1732 |
| 1407 shell_surface->set_close_callback(base::Bind( | 1733 shell_surface->set_close_callback(base::Bind( |
| 1408 &HandleXdgPopupCloseCallback, base::Unretained(xdg_popup_resource))); | 1734 &HandleXdgPopupV5CloseCallback, base::Unretained(xdg_popup_resource))); |
| 1409 | 1735 |
| 1410 SetImplementation(xdg_popup_resource, &xdg_popup_implementation, | 1736 SetImplementation(xdg_popup_resource, &xdg_popup_v5_implementation, |
| 1411 std::move(shell_surface)); | 1737 std::move(shell_surface)); |
| 1412 } | 1738 } |
| 1413 | 1739 |
| 1414 void xdg_shell_pong(wl_client* client, wl_resource* resource, uint32_t serial) { | 1740 void xdg_shell_v5_pong(wl_client* client, |
| 1741 wl_resource* resource, |
| 1742 uint32_t serial) { |
| 1415 NOTIMPLEMENTED(); | 1743 NOTIMPLEMENTED(); |
| 1416 } | 1744 } |
| 1417 | 1745 |
| 1418 const struct xdg_shell_interface xdg_shell_implementation = { | 1746 const struct xdg_shell_interface xdg_shell_v5_implementation = { |
| 1419 xdg_shell_destroy, xdg_shell_use_unstable_version, | 1747 xdg_shell_v5_destroy, xdg_shell_v5_use_unstable_version, |
| 1420 xdg_shell_get_xdg_surface, xdg_shell_get_xdg_popup, xdg_shell_pong}; | 1748 xdg_shell_v5_get_xdg_surface, xdg_shell_v5_get_xdg_popup, |
| 1749 xdg_shell_v5_pong}; |
| 1421 | 1750 |
| 1422 void bind_xdg_shell(wl_client* client, | 1751 void bind_xdg_shell_v5(wl_client* client, |
| 1423 void* data, | 1752 void* data, |
| 1424 uint32_t version, | 1753 uint32_t version, |
| 1425 uint32_t id) { | 1754 uint32_t id) { |
| 1426 wl_resource* resource = | 1755 wl_resource* resource = |
| 1427 wl_resource_create(client, &xdg_shell_interface, 1, id); | 1756 wl_resource_create(client, &xdg_shell_interface, 1, id); |
| 1428 | 1757 |
| 1429 wl_resource_set_implementation(resource, &xdg_shell_implementation, data, | 1758 wl_resource_set_implementation(resource, &xdg_shell_v5_implementation, data, |
| 1430 nullptr); | 1759 nullptr); |
| 1431 } | 1760 } |
| 1432 | 1761 |
| 1762 void xdg_shell_v6_destroy(wl_client* client, wl_resource* resource) { |
| 1763 // Nothing to do here. |
| 1764 } |
| 1765 |
| 1766 void xdg_shell_v6_create_positioner(wl_client* client, |
| 1767 wl_resource* resource, |
| 1768 uint32_t id) { |
| 1769 wl_resource* xdg_positioner_resource = |
| 1770 wl_resource_create(client, &zxdg_positioner_v6_interface, 1, id); |
| 1771 |
| 1772 wl_resource_set_implementation(xdg_positioner_resource, |
| 1773 &xdg_positioner_v6_implementation, nullptr, |
| 1774 nullptr); |
| 1775 } |
| 1776 |
| 1777 void xdg_shell_v6_get_xdg_surface(wl_client* client, |
| 1778 wl_resource* resource, |
| 1779 uint32_t id, |
| 1780 wl_resource* surface) { |
| 1781 std::unique_ptr<ShellSurface> shell_surface = |
| 1782 GetUserDataAs<Display>(resource)->CreateShellSurface( |
| 1783 GetUserDataAs<Surface>(surface)); |
| 1784 if (!shell_surface) { |
| 1785 wl_resource_post_error(resource, ZXDG_SHELL_V6_ERROR_ROLE, |
| 1786 "surface has already been assigned a role"); |
| 1787 return; |
| 1788 } |
| 1789 |
| 1790 // Xdg shell v6 surfaces are initially disabled and needs to be explicitly |
| 1791 // mapped before they are enabled and can become visible. |
| 1792 shell_surface->SetEnabled(false); |
| 1793 |
| 1794 wl_resource* xdg_surface_resource = |
| 1795 wl_resource_create(client, &zxdg_surface_v6_interface, 1, id); |
| 1796 |
| 1797 SetImplementation(xdg_surface_resource, &xdg_surface_v6_implementation, |
| 1798 std::move(shell_surface)); |
| 1799 } |
| 1800 |
| 1801 void xdg_shell_v6_pong(wl_client* client, |
| 1802 wl_resource* resource, |
| 1803 uint32_t serial) { |
| 1804 NOTIMPLEMENTED(); |
| 1805 } |
| 1806 |
| 1807 const struct zxdg_shell_v6_interface xdg_shell_v6_implementation = { |
| 1808 xdg_shell_v6_destroy, xdg_shell_v6_create_positioner, |
| 1809 xdg_shell_v6_get_xdg_surface, xdg_shell_v6_pong}; |
| 1810 |
| 1811 void bind_xdg_shell_v6(wl_client* client, |
| 1812 void* data, |
| 1813 uint32_t version, |
| 1814 uint32_t id) { |
| 1815 wl_resource* resource = |
| 1816 wl_resource_create(client, &zxdg_shell_v6_interface, 1, id); |
| 1817 |
| 1818 wl_resource_set_implementation(resource, &xdg_shell_v6_implementation, data, |
| 1819 nullptr); |
| 1820 } |
| 1821 |
| 1433 //////////////////////////////////////////////////////////////////////////////// | 1822 //////////////////////////////////////////////////////////////////////////////// |
| 1434 // remote_surface_interface: | 1823 // remote_surface_interface: |
| 1435 | 1824 |
| 1436 void remote_surface_destroy(wl_client* client, wl_resource* resource) { | 1825 void remote_surface_destroy(wl_client* client, wl_resource* resource) { |
| 1437 wl_resource_destroy(resource); | 1826 wl_resource_destroy(resource); |
| 1438 } | 1827 } |
| 1439 | 1828 |
| 1440 void remote_surface_set_app_id(wl_client* client, | 1829 void remote_surface_set_app_id(wl_client* client, |
| 1441 wl_resource* resource, | 1830 wl_resource* resource, |
| 1442 const char* app_id) { | 1831 const char* app_id) { |
| (...skipping 1539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2982 wl_global_create(wl_display_.get(), &zwp_linux_dmabuf_v1_interface, 1, | 3371 wl_global_create(wl_display_.get(), &zwp_linux_dmabuf_v1_interface, 1, |
| 2983 display_, bind_linux_dmabuf); | 3372 display_, bind_linux_dmabuf); |
| 2984 #endif | 3373 #endif |
| 2985 wl_global_create(wl_display_.get(), &wl_subcompositor_interface, 1, display_, | 3374 wl_global_create(wl_display_.get(), &wl_subcompositor_interface, 1, display_, |
| 2986 bind_subcompositor); | 3375 bind_subcompositor); |
| 2987 wl_global_create(wl_display_.get(), &wl_shell_interface, 1, display_, | 3376 wl_global_create(wl_display_.get(), &wl_shell_interface, 1, display_, |
| 2988 bind_shell); | 3377 bind_shell); |
| 2989 wl_global_create(wl_display_.get(), &wl_output_interface, output_version, | 3378 wl_global_create(wl_display_.get(), &wl_output_interface, output_version, |
| 2990 display_, bind_output); | 3379 display_, bind_output); |
| 2991 wl_global_create(wl_display_.get(), &xdg_shell_interface, 1, display_, | 3380 wl_global_create(wl_display_.get(), &xdg_shell_interface, 1, display_, |
| 2992 bind_xdg_shell); | 3381 bind_xdg_shell_v5); |
| 3382 wl_global_create(wl_display_.get(), &zxdg_shell_v6_interface, 1, display_, |
| 3383 bind_xdg_shell_v6); |
| 2993 wl_global_create(wl_display_.get(), &zcr_vsync_feedback_v1_interface, 1, | 3384 wl_global_create(wl_display_.get(), &zcr_vsync_feedback_v1_interface, 1, |
| 2994 display_, bind_vsync_feedback); | 3385 display_, bind_vsync_feedback); |
| 2995 wl_global_create(wl_display_.get(), &wl_data_device_manager_interface, 1, | 3386 wl_global_create(wl_display_.get(), &wl_data_device_manager_interface, 1, |
| 2996 display_, bind_data_device_manager); | 3387 display_, bind_data_device_manager); |
| 2997 wl_global_create(wl_display_.get(), &wl_seat_interface, seat_version, | 3388 wl_global_create(wl_display_.get(), &wl_seat_interface, seat_version, |
| 2998 display_, bind_seat); | 3389 display_, bind_seat); |
| 2999 wl_global_create(wl_display_.get(), &wp_viewporter_interface, 1, display_, | 3390 wl_global_create(wl_display_.get(), &wp_viewporter_interface, 1, display_, |
| 3000 bind_viewporter); | 3391 bind_viewporter); |
| 3001 wl_global_create(wl_display_.get(), &zcr_secure_output_v1_interface, 1, | 3392 wl_global_create(wl_display_.get(), &zcr_secure_output_v1_interface, 1, |
| 3002 display_, bind_secure_output); | 3393 display_, bind_secure_output); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3072 DCHECK(event_loop); | 3463 DCHECK(event_loop); |
| 3073 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); | 3464 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); |
| 3074 } | 3465 } |
| 3075 | 3466 |
| 3076 void Server::Flush() { | 3467 void Server::Flush() { |
| 3077 wl_display_flush_clients(wl_display_.get()); | 3468 wl_display_flush_clients(wl_display_.get()); |
| 3078 } | 3469 } |
| 3079 | 3470 |
| 3080 } // namespace wayland | 3471 } // namespace wayland |
| 3081 } // namespace exo | 3472 } // namespace exo |
| OLD | NEW |