| 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 <alpha-compositing-unstable-v1-server-protocol.h> | 7 #include <alpha-compositing-unstable-v1-server-protocol.h> |
| 8 #include <gaming-input-unstable-v1-server-protocol.h> | 8 #include <gaming-input-unstable-v1-server-protocol.h> |
| 9 #include <grp.h> | 9 #include <grp.h> |
| 10 #include <keyboard-configuration-unstable-v1-server-protocol.h> | 10 #include <keyboard-configuration-unstable-v1-server-protocol.h> |
| 11 #include <linux/input.h> | 11 #include <linux/input.h> |
| 12 #include <presentation-time-server-protocol.h> | 12 #include <presentation-time-server-protocol.h> |
| 13 #include <remote-shell-unstable-v1-server-protocol.h> | 13 #include <remote-shell-unstable-v1-server-protocol.h> |
| 14 #include <secure-output-unstable-v1-server-protocol.h> | 14 #include <secure-output-unstable-v1-server-protocol.h> |
| 15 #include <stddef.h> | 15 #include <stddef.h> |
| 16 #include <stdint.h> | 16 #include <stdint.h> |
| 17 #include <stylus-unstable-v1-server-protocol.h> | 17 #include <stylus-unstable-v1-server-protocol.h> |
| 18 #include <stylus-unstable-v2-server-protocol.h> | 18 #include <stylus-unstable-v2-server-protocol.h> |
| 19 #include <viewporter-server-protocol.h> | 19 #include <viewporter-server-protocol.h> |
| 20 #include <vsync-feedback-unstable-v1-server-protocol.h> | 20 #include <vsync-feedback-unstable-v1-server-protocol.h> |
| 21 #include <wayland-server-core.h> | 21 #include <wayland-server-core.h> |
| 22 #include <wayland-server-protocol-core.h> | 22 #include <wayland-server-protocol-core.h> |
| 23 #include <xdg-shell-unstable-v5-server-protocol.h> | 23 #include <xdg-shell-unstable-v5-server-protocol.h> |
| 24 #include <xdg-shell-unstable-v6-server-protocol.h> |
| 24 | 25 |
| 25 #include <algorithm> | 26 #include <algorithm> |
| 26 #include <cstdlib> | 27 #include <cstdlib> |
| 27 #include <iterator> | 28 #include <iterator> |
| 28 #include <string> | 29 #include <string> |
| 29 #include <utility> | 30 #include <utility> |
| 30 | 31 |
| 31 #include "ash/common/shell_observer.h" | 32 #include "ash/common/shell_observer.h" |
| 32 #include "ash/public/cpp/shell_window_ids.h" | 33 #include "ash/public/cpp/shell_window_ids.h" |
| 33 #include "ash/shell.h" | 34 #include "ash/shell.h" |
| (...skipping 1124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1158 | 1159 |
| 1159 void bind_output(wl_client* client, void* data, uint32_t version, uint32_t id) { | 1160 void bind_output(wl_client* client, void* data, uint32_t version, uint32_t id) { |
| 1160 wl_resource* resource = wl_resource_create( | 1161 wl_resource* resource = wl_resource_create( |
| 1161 client, &wl_output_interface, std::min(version, output_version), id); | 1162 client, &wl_output_interface, std::min(version, output_version), id); |
| 1162 | 1163 |
| 1163 SetImplementation(resource, nullptr, | 1164 SetImplementation(resource, nullptr, |
| 1164 base::MakeUnique<WaylandPrimaryDisplayObserver>(resource)); | 1165 base::MakeUnique<WaylandPrimaryDisplayObserver>(resource)); |
| 1165 } | 1166 } |
| 1166 | 1167 |
| 1167 //////////////////////////////////////////////////////////////////////////////// | 1168 //////////////////////////////////////////////////////////////////////////////// |
| 1169 // xdg_positioner_interface: |
| 1170 |
| 1171 void xdg_positioner_v6_destroy(wl_client* client, wl_resource* resource) { |
| 1172 wl_resource_destroy(resource); |
| 1173 } |
| 1174 |
| 1175 void xdg_positioner_v6_set_size(wl_client* client, |
| 1176 wl_resource* resource, |
| 1177 int32_t width, |
| 1178 int32_t height) { |
| 1179 NOTIMPLEMENTED(); |
| 1180 } |
| 1181 |
| 1182 void xdg_positioner_v6_set_anchor_rect(wl_client* client, |
| 1183 wl_resource* resource, |
| 1184 int32_t x, |
| 1185 int32_t y, |
| 1186 int32_t width, |
| 1187 int32_t height) { |
| 1188 NOTIMPLEMENTED(); |
| 1189 } |
| 1190 |
| 1191 void xdg_positioner_v6_set_anchor(wl_client* client, |
| 1192 wl_resource* resource, |
| 1193 uint32_t anchor) { |
| 1194 NOTIMPLEMENTED(); |
| 1195 } |
| 1196 |
| 1197 void xdg_positioner_v6_set_gravity(wl_client* client, |
| 1198 wl_resource* resource, |
| 1199 uint32_t gravity) { |
| 1200 NOTIMPLEMENTED(); |
| 1201 } |
| 1202 |
| 1203 void xdg_positioner_v6_set_constraint_adjustment( |
| 1204 wl_client* client, |
| 1205 wl_resource* resource, |
| 1206 uint32_t constraint_adjustment) { |
| 1207 NOTIMPLEMENTED(); |
| 1208 } |
| 1209 |
| 1210 void xdg_positioner_v6_set_offset(wl_client* client, |
| 1211 wl_resource* resource, |
| 1212 int32_t x, |
| 1213 int32_t y) { |
| 1214 NOTIMPLEMENTED(); |
| 1215 } |
| 1216 |
| 1217 const struct zxdg_positioner_v6_interface xdg_positioner_v6_implementation = { |
| 1218 xdg_positioner_v6_destroy, |
| 1219 xdg_positioner_v6_set_size, |
| 1220 xdg_positioner_v6_set_anchor_rect, |
| 1221 xdg_positioner_v6_set_anchor, |
| 1222 xdg_positioner_v6_set_gravity, |
| 1223 xdg_positioner_v6_set_constraint_adjustment, |
| 1224 xdg_positioner_v6_set_offset}; |
| 1225 |
| 1226 //////////////////////////////////////////////////////////////////////////////// |
| 1227 // xdg_toplevel_interface: |
| 1228 |
| 1229 int XdgToplevelV6ResizeComponent(uint32_t edges) { |
| 1230 switch (edges) { |
| 1231 case ZXDG_TOPLEVEL_V6_RESIZE_EDGE_TOP: |
| 1232 return HTTOP; |
| 1233 case ZXDG_TOPLEVEL_V6_RESIZE_EDGE_BOTTOM: |
| 1234 return HTBOTTOM; |
| 1235 case ZXDG_TOPLEVEL_V6_RESIZE_EDGE_LEFT: |
| 1236 return HTLEFT; |
| 1237 case ZXDG_TOPLEVEL_V6_RESIZE_EDGE_TOP_LEFT: |
| 1238 return HTTOPLEFT; |
| 1239 case ZXDG_TOPLEVEL_V6_RESIZE_EDGE_BOTTOM_LEFT: |
| 1240 return HTBOTTOMLEFT; |
| 1241 case ZXDG_TOPLEVEL_V6_RESIZE_EDGE_RIGHT: |
| 1242 return HTRIGHT; |
| 1243 case ZXDG_TOPLEVEL_V6_RESIZE_EDGE_TOP_RIGHT: |
| 1244 return HTTOPRIGHT; |
| 1245 case ZXDG_TOPLEVEL_V6_RESIZE_EDGE_BOTTOM_RIGHT: |
| 1246 return HTBOTTOMRIGHT; |
| 1247 default: |
| 1248 return HTBOTTOMRIGHT; |
| 1249 } |
| 1250 } |
| 1251 |
| 1252 void xdg_toplevel_v6_destroy(wl_client* client, wl_resource* resource) { |
| 1253 wl_resource_destroy(resource); |
| 1254 } |
| 1255 |
| 1256 void xdg_toplevel_v6_set_parent(wl_client* client, |
| 1257 wl_resource* resource, |
| 1258 wl_resource* parent) { |
| 1259 if (!parent) { |
| 1260 GetUserDataAs<ShellSurface>(resource)->SetParent(nullptr); |
| 1261 return; |
| 1262 } |
| 1263 |
| 1264 // This is a noop if parent has not been mapped. |
| 1265 ShellSurface* shell_surface = GetUserDataAs<ShellSurface>(parent); |
| 1266 if (shell_surface->GetWidget()) |
| 1267 GetUserDataAs<ShellSurface>(resource)->SetParent(shell_surface); |
| 1268 } |
| 1269 |
| 1270 void xdg_toplevel_v6_set_title(wl_client* client, |
| 1271 wl_resource* resource, |
| 1272 const char* title) { |
| 1273 GetUserDataAs<ShellSurface>(resource)->SetTitle( |
| 1274 base::string16(base::UTF8ToUTF16(title))); |
| 1275 } |
| 1276 |
| 1277 void xdg_toplevel_v6_set_add_id(wl_client* client, |
| 1278 wl_resource* resource, |
| 1279 const char* app_id) { |
| 1280 GetUserDataAs<ShellSurface>(resource)->SetApplicationId(app_id); |
| 1281 } |
| 1282 |
| 1283 void xdg_toplevel_v6_show_window_menu(wl_client* client, |
| 1284 wl_resource* resource, |
| 1285 wl_resource* seat, |
| 1286 uint32_t serial, |
| 1287 int32_t x, |
| 1288 int32_t y) { |
| 1289 NOTIMPLEMENTED(); |
| 1290 } |
| 1291 |
| 1292 void xdg_toplevel_v6_move(wl_client* client, |
| 1293 wl_resource* resource, |
| 1294 wl_resource* seat, |
| 1295 uint32_t serial) { |
| 1296 GetUserDataAs<ShellSurface>(resource)->Move(); |
| 1297 } |
| 1298 |
| 1299 void xdg_toplevel_v6_resize(wl_client* client, |
| 1300 wl_resource* resource, |
| 1301 wl_resource* seat, |
| 1302 uint32_t serial, |
| 1303 uint32_t edges) { |
| 1304 int component = XdgToplevelV6ResizeComponent(edges); |
| 1305 if (component != HTNOWHERE) |
| 1306 GetUserDataAs<ShellSurface>(resource)->Resize(component); |
| 1307 } |
| 1308 |
| 1309 void xdg_toplevel_v6_set_max_size(wl_client* client, |
| 1310 wl_resource* resource, |
| 1311 int32_t width, |
| 1312 int32_t height) { |
| 1313 NOTIMPLEMENTED(); |
| 1314 } |
| 1315 |
| 1316 void xdg_toplevel_v6_set_min_size(wl_client* client, |
| 1317 wl_resource* resource, |
| 1318 int32_t width, |
| 1319 int32_t height) { |
| 1320 NOTIMPLEMENTED(); |
| 1321 } |
| 1322 |
| 1323 void xdg_toplevel_v6_set_maximized(wl_client* client, wl_resource* resource) { |
| 1324 GetUserDataAs<ShellSurface>(resource)->Maximize(); |
| 1325 } |
| 1326 |
| 1327 void xdg_toplevel_v6_unset_maximized(wl_client* client, wl_resource* resource) { |
| 1328 GetUserDataAs<ShellSurface>(resource)->Restore(); |
| 1329 } |
| 1330 |
| 1331 void xdg_toplevel_v6_set_fullscreen(wl_client* client, |
| 1332 wl_resource* resource, |
| 1333 wl_resource* output) { |
| 1334 GetUserDataAs<ShellSurface>(resource)->SetFullscreen(true); |
| 1335 } |
| 1336 |
| 1337 void xdg_toplevel_v6_unset_fullscreen(wl_client* client, |
| 1338 wl_resource* resource) { |
| 1339 GetUserDataAs<ShellSurface>(resource)->SetFullscreen(false); |
| 1340 } |
| 1341 |
| 1342 void xdg_toplevel_v6_set_minimized(wl_client* client, wl_resource* resource) { |
| 1343 GetUserDataAs<ShellSurface>(resource)->Minimize(); |
| 1344 } |
| 1345 |
| 1346 const struct zxdg_toplevel_v6_interface xdg_toplevel_v6_implementation = { |
| 1347 xdg_toplevel_v6_destroy, xdg_toplevel_v6_set_parent, |
| 1348 xdg_toplevel_v6_set_title, xdg_toplevel_v6_set_add_id, |
| 1349 xdg_toplevel_v6_show_window_menu, xdg_toplevel_v6_move, |
| 1350 xdg_toplevel_v6_resize, xdg_toplevel_v6_set_max_size, |
| 1351 xdg_toplevel_v6_set_min_size, xdg_toplevel_v6_set_maximized, |
| 1352 xdg_toplevel_v6_unset_maximized, xdg_toplevel_v6_set_fullscreen, |
| 1353 xdg_toplevel_v6_unset_fullscreen, xdg_toplevel_v6_set_minimized}; |
| 1354 |
| 1355 //////////////////////////////////////////////////////////////////////////////// |
| 1356 // xdg_popup_interface: |
| 1357 |
| 1358 void xdg_popup_v5_destroy(wl_client* client, wl_resource* resource) { |
| 1359 wl_resource_destroy(resource); |
| 1360 } |
| 1361 |
| 1362 const struct xdg_popup_interface xdg_popup_v5_implementation = { |
| 1363 xdg_popup_v5_destroy}; |
| 1364 |
| 1365 void xdg_popup_v6_destroy(wl_client* client, wl_resource* resource) { |
| 1366 wl_resource_destroy(resource); |
| 1367 } |
| 1368 |
| 1369 void xdg_popup_v6_grab(wl_client* client, |
| 1370 wl_resource* resource, |
| 1371 wl_resource* seat, |
| 1372 uint32_t serial) { |
| 1373 NOTIMPLEMENTED(); |
| 1374 } |
| 1375 |
| 1376 const struct zxdg_popup_v6_interface xdg_popup_v6_implementation = { |
| 1377 xdg_popup_v6_destroy, xdg_popup_v6_grab}; |
| 1378 |
| 1379 //////////////////////////////////////////////////////////////////////////////// |
| 1168 // xdg_surface_interface: | 1380 // xdg_surface_interface: |
| 1169 | 1381 |
| 1170 int XdgResizeComponent(uint32_t edges) { | 1382 int XdgSurfaceV5ResizeComponent(uint32_t edges) { |
| 1171 switch (edges) { | 1383 switch (edges) { |
| 1172 case XDG_SURFACE_RESIZE_EDGE_TOP: | 1384 case XDG_SURFACE_RESIZE_EDGE_TOP: |
| 1173 return HTTOP; | 1385 return HTTOP; |
| 1174 case XDG_SURFACE_RESIZE_EDGE_BOTTOM: | 1386 case XDG_SURFACE_RESIZE_EDGE_BOTTOM: |
| 1175 return HTBOTTOM; | 1387 return HTBOTTOM; |
| 1176 case XDG_SURFACE_RESIZE_EDGE_LEFT: | 1388 case XDG_SURFACE_RESIZE_EDGE_LEFT: |
| 1177 return HTLEFT; | 1389 return HTLEFT; |
| 1178 case XDG_SURFACE_RESIZE_EDGE_TOP_LEFT: | 1390 case XDG_SURFACE_RESIZE_EDGE_TOP_LEFT: |
| 1179 return HTTOPLEFT; | 1391 return HTTOPLEFT; |
| 1180 case XDG_SURFACE_RESIZE_EDGE_BOTTOM_LEFT: | 1392 case XDG_SURFACE_RESIZE_EDGE_BOTTOM_LEFT: |
| 1181 return HTBOTTOMLEFT; | 1393 return HTBOTTOMLEFT; |
| 1182 case XDG_SURFACE_RESIZE_EDGE_RIGHT: | 1394 case XDG_SURFACE_RESIZE_EDGE_RIGHT: |
| 1183 return HTRIGHT; | 1395 return HTRIGHT; |
| 1184 case XDG_SURFACE_RESIZE_EDGE_TOP_RIGHT: | 1396 case XDG_SURFACE_RESIZE_EDGE_TOP_RIGHT: |
| 1185 return HTTOPRIGHT; | 1397 return HTTOPRIGHT; |
| 1186 case XDG_SURFACE_RESIZE_EDGE_BOTTOM_RIGHT: | 1398 case XDG_SURFACE_RESIZE_EDGE_BOTTOM_RIGHT: |
| 1187 return HTBOTTOMRIGHT; | 1399 return HTBOTTOMRIGHT; |
| 1188 default: | 1400 default: |
| 1189 return HTBOTTOMRIGHT; | 1401 return HTBOTTOMRIGHT; |
| 1190 } | 1402 } |
| 1191 } | 1403 } |
| 1192 | 1404 |
| 1193 void xdg_surface_destroy(wl_client* client, wl_resource* resource) { | 1405 void xdg_surface_v5_destroy(wl_client* client, wl_resource* resource) { |
| 1194 wl_resource_destroy(resource); | 1406 wl_resource_destroy(resource); |
| 1195 } | 1407 } |
| 1196 | 1408 |
| 1197 void xdg_surface_set_parent(wl_client* client, | 1409 void xdg_surface_v5_set_parent(wl_client* client, |
| 1198 wl_resource* resource, | 1410 wl_resource* resource, |
| 1199 wl_resource* parent) { | 1411 wl_resource* parent) { |
| 1200 if (!parent) { | 1412 if (!parent) { |
| 1201 GetUserDataAs<ShellSurface>(resource)->SetParent(nullptr); | 1413 GetUserDataAs<ShellSurface>(resource)->SetParent(nullptr); |
| 1202 return; | 1414 return; |
| 1203 } | 1415 } |
| 1204 | 1416 |
| 1205 // This is a noop if parent has not been mapped. | 1417 // This is a noop if parent has not been mapped. |
| 1206 ShellSurface* shell_surface = GetUserDataAs<ShellSurface>(parent); | 1418 ShellSurface* shell_surface = GetUserDataAs<ShellSurface>(parent); |
| 1207 if (shell_surface->GetWidget()) | 1419 if (shell_surface->GetWidget()) |
| 1208 GetUserDataAs<ShellSurface>(resource)->SetParent(shell_surface); | 1420 GetUserDataAs<ShellSurface>(resource)->SetParent(shell_surface); |
| 1209 } | 1421 } |
| 1210 | 1422 |
| 1211 void xdg_surface_set_title(wl_client* client, | 1423 void xdg_surface_v5_set_title(wl_client* client, |
| 1212 wl_resource* resource, | 1424 wl_resource* resource, |
| 1213 const char* title) { | 1425 const char* title) { |
| 1214 GetUserDataAs<ShellSurface>(resource) | 1426 GetUserDataAs<ShellSurface>(resource) |
| 1215 ->SetTitle(base::string16(base::UTF8ToUTF16(title))); | 1427 ->SetTitle(base::string16(base::UTF8ToUTF16(title))); |
| 1216 } | 1428 } |
| 1217 | 1429 |
| 1218 void xdg_surface_set_add_id(wl_client* client, | 1430 void xdg_surface_v5_set_add_id(wl_client* client, |
| 1219 wl_resource* resource, | 1431 wl_resource* resource, |
| 1220 const char* app_id) { | 1432 const char* app_id) { |
| 1221 GetUserDataAs<ShellSurface>(resource)->SetApplicationId(app_id); | 1433 GetUserDataAs<ShellSurface>(resource)->SetApplicationId(app_id); |
| 1222 } | 1434 } |
| 1223 | 1435 |
| 1224 void xdg_surface_show_window_menu(wl_client* client, | 1436 void xdg_surface_v5_show_window_menu(wl_client* client, |
| 1225 wl_resource* resource, | 1437 wl_resource* resource, |
| 1226 wl_resource* seat, | 1438 wl_resource* seat, |
| 1227 uint32_t serial, | 1439 uint32_t serial, |
| 1228 int32_t x, | 1440 int32_t x, |
| 1229 int32_t y) { | 1441 int32_t y) { |
| 1230 NOTIMPLEMENTED(); | 1442 NOTIMPLEMENTED(); |
| 1231 } | 1443 } |
| 1232 | 1444 |
| 1233 void xdg_surface_move(wl_client* client, | 1445 void xdg_surface_v5_move(wl_client* client, |
| 1234 wl_resource* resource, | 1446 wl_resource* resource, |
| 1235 wl_resource* seat, | 1447 wl_resource* seat, |
| 1236 uint32_t serial) { | 1448 uint32_t serial) { |
| 1237 GetUserDataAs<ShellSurface>(resource)->Move(); | 1449 GetUserDataAs<ShellSurface>(resource)->Move(); |
| 1238 } | 1450 } |
| 1239 | 1451 |
| 1240 void xdg_surface_resize(wl_client* client, | 1452 void xdg_surface_v5_resize(wl_client* client, |
| 1241 wl_resource* resource, | 1453 wl_resource* resource, |
| 1242 wl_resource* seat, | 1454 wl_resource* seat, |
| 1243 uint32_t serial, | 1455 uint32_t serial, |
| 1244 uint32_t edges) { | 1456 uint32_t edges) { |
| 1245 int component = XdgResizeComponent(edges); | 1457 int component = XdgSurfaceV5ResizeComponent(edges); |
| 1246 if (component != HTNOWHERE) | 1458 if (component != HTNOWHERE) |
| 1247 GetUserDataAs<ShellSurface>(resource)->Resize(component); | 1459 GetUserDataAs<ShellSurface>(resource)->Resize(component); |
| 1248 } | 1460 } |
| 1249 | 1461 |
| 1250 void xdg_surface_ack_configure(wl_client* client, | 1462 void xdg_surface_v5_ack_configure(wl_client* client, |
| 1251 wl_resource* resource, | 1463 wl_resource* resource, |
| 1252 uint32_t serial) { | 1464 uint32_t serial) { |
| 1253 GetUserDataAs<ShellSurface>(resource)->AcknowledgeConfigure(serial); | 1465 GetUserDataAs<ShellSurface>(resource)->AcknowledgeConfigure(serial); |
| 1254 } | 1466 } |
| 1255 | 1467 |
| 1256 void xdg_surface_set_window_geometry(wl_client* client, | 1468 void xdg_surface_v5_set_window_geometry(wl_client* client, |
| 1257 wl_resource* resource, | 1469 wl_resource* resource, |
| 1258 int32_t x, | 1470 int32_t x, |
| 1259 int32_t y, | 1471 int32_t y, |
| 1260 int32_t width, | 1472 int32_t width, |
| 1261 int32_t height) { | 1473 int32_t height) { |
| 1262 GetUserDataAs<ShellSurface>(resource) | 1474 GetUserDataAs<ShellSurface>(resource) |
| 1263 ->SetGeometry(gfx::Rect(x, y, width, height)); | 1475 ->SetGeometry(gfx::Rect(x, y, width, height)); |
| 1264 } | 1476 } |
| 1265 | 1477 |
| 1266 void xdg_surface_set_maximized(wl_client* client, wl_resource* resource) { | 1478 void xdg_surface_v5_set_maximized(wl_client* client, wl_resource* resource) { |
| 1267 GetUserDataAs<ShellSurface>(resource)->Maximize(); | 1479 GetUserDataAs<ShellSurface>(resource)->Maximize(); |
| 1268 } | 1480 } |
| 1269 | 1481 |
| 1270 void xdg_surface_unset_maximized(wl_client* client, wl_resource* resource) { | 1482 void xdg_surface_v5_unset_maximized(wl_client* client, wl_resource* resource) { |
| 1271 GetUserDataAs<ShellSurface>(resource)->Restore(); | 1483 GetUserDataAs<ShellSurface>(resource)->Restore(); |
| 1272 } | 1484 } |
| 1273 | 1485 |
| 1274 void xdg_surface_set_fullscreen(wl_client* client, | 1486 void xdg_surface_v5_set_fullscreen(wl_client* client, |
| 1275 wl_resource* resource, | 1487 wl_resource* resource, |
| 1276 wl_resource* output) { | 1488 wl_resource* output) { |
| 1277 GetUserDataAs<ShellSurface>(resource)->SetFullscreen(true); | 1489 GetUserDataAs<ShellSurface>(resource)->SetFullscreen(true); |
| 1278 } | 1490 } |
| 1279 | 1491 |
| 1280 void xdg_surface_unset_fullscreen(wl_client* client, wl_resource* resource) { | 1492 void xdg_surface_v5_unset_fullscreen(wl_client* client, wl_resource* resource) { |
| 1281 GetUserDataAs<ShellSurface>(resource)->SetFullscreen(false); | 1493 GetUserDataAs<ShellSurface>(resource)->SetFullscreen(false); |
| 1282 } | 1494 } |
| 1283 | 1495 |
| 1284 void xdg_surface_set_minimized(wl_client* client, wl_resource* resource) { | 1496 void xdg_surface_v5_set_minimized(wl_client* client, wl_resource* resource) { |
| 1285 GetUserDataAs<ShellSurface>(resource)->Minimize(); | 1497 GetUserDataAs<ShellSurface>(resource)->Minimize(); |
| 1286 } | 1498 } |
| 1287 | 1499 |
| 1288 const struct xdg_surface_interface xdg_surface_implementation = { | 1500 const struct xdg_surface_interface xdg_surface_v5_implementation = { |
| 1289 xdg_surface_destroy, | 1501 xdg_surface_v5_destroy, |
| 1290 xdg_surface_set_parent, | 1502 xdg_surface_v5_set_parent, |
| 1291 xdg_surface_set_title, | 1503 xdg_surface_v5_set_title, |
| 1292 xdg_surface_set_add_id, | 1504 xdg_surface_v5_set_add_id, |
| 1293 xdg_surface_show_window_menu, | 1505 xdg_surface_v5_show_window_menu, |
| 1294 xdg_surface_move, | 1506 xdg_surface_v5_move, |
| 1295 xdg_surface_resize, | 1507 xdg_surface_v5_resize, |
| 1296 xdg_surface_ack_configure, | 1508 xdg_surface_v5_ack_configure, |
| 1297 xdg_surface_set_window_geometry, | 1509 xdg_surface_v5_set_window_geometry, |
| 1298 xdg_surface_set_maximized, | 1510 xdg_surface_v5_set_maximized, |
| 1299 xdg_surface_unset_maximized, | 1511 xdg_surface_v5_unset_maximized, |
| 1300 xdg_surface_set_fullscreen, | 1512 xdg_surface_v5_set_fullscreen, |
| 1301 xdg_surface_unset_fullscreen, | 1513 xdg_surface_v5_unset_fullscreen, |
| 1302 xdg_surface_set_minimized}; | 1514 xdg_surface_v5_set_minimized}; |
| 1303 | 1515 |
| 1304 //////////////////////////////////////////////////////////////////////////////// | 1516 void xdg_surface_v6_destroy(wl_client* client, wl_resource* resource) { |
| 1305 // xdg_popup_interface: | |
| 1306 | |
| 1307 void xdg_popup_destroy(wl_client* client, wl_resource* resource) { | |
| 1308 wl_resource_destroy(resource); | 1517 wl_resource_destroy(resource); |
| 1309 } | 1518 } |
| 1310 | 1519 |
| 1311 const struct xdg_popup_interface xdg_popup_implementation = {xdg_popup_destroy}; | 1520 void HandleXdgToplevelV6CloseCallback(wl_resource* resource) { |
| 1521 zxdg_toplevel_v6_send_close(resource); |
| 1522 wl_client_flush(wl_resource_get_client(resource)); |
| 1523 } |
| 1524 |
| 1525 void AddXdgToplevelV6State(wl_array* states, zxdg_toplevel_v6_state state) { |
| 1526 zxdg_toplevel_v6_state* value = static_cast<zxdg_toplevel_v6_state*>( |
| 1527 wl_array_add(states, sizeof(zxdg_toplevel_v6_state))); |
| 1528 DCHECK(value); |
| 1529 *value = state; |
| 1530 } |
| 1531 |
| 1532 uint32_t HandleXdgToplevelV6ConfigureCallback( |
| 1533 wl_resource* resource, |
| 1534 wl_resource* surface_resource, |
| 1535 const gfx::Size& size, |
| 1536 ash::wm::WindowStateType state_type, |
| 1537 bool resizing, |
| 1538 bool activated) { |
| 1539 wl_array states; |
| 1540 wl_array_init(&states); |
| 1541 if (state_type == ash::wm::WINDOW_STATE_TYPE_MAXIMIZED) |
| 1542 AddXdgToplevelV6State(&states, ZXDG_TOPLEVEL_V6_STATE_MAXIMIZED); |
| 1543 if (state_type == ash::wm::WINDOW_STATE_TYPE_FULLSCREEN) |
| 1544 AddXdgToplevelV6State(&states, ZXDG_TOPLEVEL_V6_STATE_FULLSCREEN); |
| 1545 if (resizing) |
| 1546 AddXdgToplevelV6State(&states, ZXDG_TOPLEVEL_V6_STATE_RESIZING); |
| 1547 if (activated) |
| 1548 AddXdgToplevelV6State(&states, ZXDG_TOPLEVEL_V6_STATE_ACTIVATED); |
| 1549 zxdg_toplevel_v6_send_configure(resource, size.width(), size.height(), |
| 1550 &states); |
| 1551 uint32_t serial = wl_display_next_serial( |
| 1552 wl_client_get_display(wl_resource_get_client(surface_resource))); |
| 1553 zxdg_surface_v6_send_configure(surface_resource, serial); |
| 1554 wl_client_flush(wl_resource_get_client(resource)); |
| 1555 wl_array_release(&states); |
| 1556 return serial; |
| 1557 } |
| 1558 |
| 1559 void xdg_surface_v6_get_toplevel(wl_client* client, |
| 1560 wl_resource* resource, |
| 1561 uint32_t id) { |
| 1562 ShellSurface* shell_surface = GetUserDataAs<ShellSurface>(resource); |
| 1563 if (shell_surface->enabled()) { |
| 1564 wl_resource_post_error(resource, ZXDG_SURFACE_V6_ERROR_ALREADY_CONSTRUCTED, |
| 1565 "surface has already been constructed"); |
| 1566 return; |
| 1567 } |
| 1568 |
| 1569 shell_surface->SetEnabled(true); |
| 1570 |
| 1571 wl_resource* xdg_toplevel_resource = |
| 1572 wl_resource_create(client, &zxdg_toplevel_v6_interface, 1, id); |
| 1573 |
| 1574 shell_surface->set_close_callback( |
| 1575 base::Bind(&HandleXdgToplevelV6CloseCallback, |
| 1576 base::Unretained(xdg_toplevel_resource))); |
| 1577 |
| 1578 shell_surface->set_configure_callback(base::Bind( |
| 1579 &HandleXdgToplevelV6ConfigureCallback, |
| 1580 base::Unretained(xdg_toplevel_resource), base::Unretained(resource))); |
| 1581 |
| 1582 wl_resource_set_implementation(xdg_toplevel_resource, |
| 1583 &xdg_toplevel_v6_implementation, shell_surface, |
| 1584 nullptr); |
| 1585 } |
| 1586 |
| 1587 void HandleXdgPopupV6CloseCallback(wl_resource* resource) { |
| 1588 zxdg_popup_v6_send_popup_done(resource); |
| 1589 wl_client_flush(wl_resource_get_client(resource)); |
| 1590 } |
| 1591 |
| 1592 void xdg_surface_v6_get_popup(wl_client* client, |
| 1593 wl_resource* resource, |
| 1594 uint32_t id, |
| 1595 wl_resource* parent, |
| 1596 wl_resource* positioner) { |
| 1597 ShellSurface* shell_surface = GetUserDataAs<ShellSurface>(resource); |
| 1598 if (shell_surface->enabled()) { |
| 1599 wl_resource_post_error(resource, ZXDG_SURFACE_V6_ERROR_ALREADY_CONSTRUCTED, |
| 1600 "surface has already been constructed"); |
| 1601 return; |
| 1602 } |
| 1603 |
| 1604 shell_surface->SetEnabled(true); |
| 1605 |
| 1606 wl_resource* xdg_popup_resource = |
| 1607 wl_resource_create(client, &zxdg_popup_v6_interface, 1, id); |
| 1608 |
| 1609 shell_surface->set_close_callback(base::Bind( |
| 1610 &HandleXdgPopupV6CloseCallback, base::Unretained(xdg_popup_resource))); |
| 1611 |
| 1612 wl_resource_set_implementation( |
| 1613 xdg_popup_resource, &xdg_popup_v6_implementation, shell_surface, nullptr); |
| 1614 } |
| 1615 |
| 1616 void xdg_surface_v6_set_window_geometry(wl_client* client, |
| 1617 wl_resource* resource, |
| 1618 int32_t x, |
| 1619 int32_t y, |
| 1620 int32_t width, |
| 1621 int32_t height) { |
| 1622 GetUserDataAs<ShellSurface>(resource)->SetGeometry( |
| 1623 gfx::Rect(x, y, width, height)); |
| 1624 } |
| 1625 |
| 1626 void xdg_surface_v6_ack_configure(wl_client* client, |
| 1627 wl_resource* resource, |
| 1628 uint32_t serial) { |
| 1629 GetUserDataAs<ShellSurface>(resource)->AcknowledgeConfigure(serial); |
| 1630 } |
| 1631 |
| 1632 const struct zxdg_surface_v6_interface xdg_surface_v6_implementation = { |
| 1633 xdg_surface_v6_destroy, xdg_surface_v6_get_toplevel, |
| 1634 xdg_surface_v6_get_popup, xdg_surface_v6_set_window_geometry, |
| 1635 xdg_surface_v6_ack_configure}; |
| 1312 | 1636 |
| 1313 //////////////////////////////////////////////////////////////////////////////// | 1637 //////////////////////////////////////////////////////////////////////////////// |
| 1314 // xdg_shell_interface: | 1638 // xdg_shell_interface: |
| 1315 | 1639 |
| 1316 void xdg_shell_destroy(wl_client* client, wl_resource* resource) { | 1640 void xdg_shell_v5_destroy(wl_client* client, wl_resource* resource) { |
| 1317 // Nothing to do here. | 1641 // Nothing to do here. |
| 1318 } | 1642 } |
| 1319 | 1643 |
| 1320 // Currently implemented version of the unstable xdg-shell interface. | 1644 // Currently implemented version of the unstable xdg-shell interface. |
| 1321 #define XDG_SHELL_VERSION 5 | 1645 #define XDG_SHELL_VERSION 5 |
| 1322 static_assert(XDG_SHELL_VERSION == XDG_SHELL_VERSION_CURRENT, | 1646 static_assert(XDG_SHELL_VERSION == XDG_SHELL_VERSION_CURRENT, |
| 1323 "Interface version doesn't match implementation version"); | 1647 "Interface version doesn't match implementation version"); |
| 1324 | 1648 |
| 1325 void xdg_shell_use_unstable_version(wl_client* client, | 1649 void xdg_shell_v5_use_unstable_version(wl_client* client, |
| 1326 wl_resource* resource, | 1650 wl_resource* resource, |
| 1327 int32_t version) { | 1651 int32_t version) { |
| 1328 if (version > XDG_SHELL_VERSION) { | 1652 if (version > XDG_SHELL_VERSION) { |
| 1329 wl_resource_post_error(resource, 1, | 1653 wl_resource_post_error(resource, 1, |
| 1330 "xdg-shell version not implemented yet."); | 1654 "xdg-shell version not implemented yet."); |
| 1331 } | 1655 } |
| 1332 } | 1656 } |
| 1333 | 1657 |
| 1334 void HandleXdgSurfaceCloseCallback(wl_resource* resource) { | 1658 void HandleXdgSurfaceV5CloseCallback(wl_resource* resource) { |
| 1335 xdg_surface_send_close(resource); | 1659 xdg_surface_send_close(resource); |
| 1336 wl_client_flush(wl_resource_get_client(resource)); | 1660 wl_client_flush(wl_resource_get_client(resource)); |
| 1337 } | 1661 } |
| 1338 | 1662 |
| 1339 void AddXdgSurfaceState(wl_array* states, xdg_surface_state state) { | 1663 void AddXdgSurfaceV5State(wl_array* states, xdg_surface_state state) { |
| 1340 xdg_surface_state* value = static_cast<xdg_surface_state*>( | 1664 xdg_surface_state* value = static_cast<xdg_surface_state*>( |
| 1341 wl_array_add(states, sizeof(xdg_surface_state))); | 1665 wl_array_add(states, sizeof(xdg_surface_state))); |
| 1342 DCHECK(value); | 1666 DCHECK(value); |
| 1343 *value = state; | 1667 *value = state; |
| 1344 } | 1668 } |
| 1345 | 1669 |
| 1346 uint32_t HandleXdgSurfaceConfigureCallback(wl_resource* resource, | 1670 uint32_t HandleXdgSurfaceV5ConfigureCallback( |
| 1347 const gfx::Size& size, | 1671 wl_resource* resource, |
| 1348 ash::wm::WindowStateType state_type, | 1672 const gfx::Size& size, |
| 1349 bool resizing, | 1673 ash::wm::WindowStateType state_type, |
| 1350 bool activated) { | 1674 bool resizing, |
| 1675 bool activated) { |
| 1351 wl_array states; | 1676 wl_array states; |
| 1352 wl_array_init(&states); | 1677 wl_array_init(&states); |
| 1353 if (state_type == ash::wm::WINDOW_STATE_TYPE_MAXIMIZED) | 1678 if (state_type == ash::wm::WINDOW_STATE_TYPE_MAXIMIZED) |
| 1354 AddXdgSurfaceState(&states, XDG_SURFACE_STATE_MAXIMIZED); | 1679 AddXdgSurfaceV5State(&states, XDG_SURFACE_STATE_MAXIMIZED); |
| 1355 if (state_type == ash::wm::WINDOW_STATE_TYPE_FULLSCREEN) | 1680 if (state_type == ash::wm::WINDOW_STATE_TYPE_FULLSCREEN) |
| 1356 AddXdgSurfaceState(&states, XDG_SURFACE_STATE_FULLSCREEN); | 1681 AddXdgSurfaceV5State(&states, XDG_SURFACE_STATE_FULLSCREEN); |
| 1357 if (resizing) | 1682 if (resizing) |
| 1358 AddXdgSurfaceState(&states, XDG_SURFACE_STATE_RESIZING); | 1683 AddXdgSurfaceV5State(&states, XDG_SURFACE_STATE_RESIZING); |
| 1359 if (activated) | 1684 if (activated) |
| 1360 AddXdgSurfaceState(&states, XDG_SURFACE_STATE_ACTIVATED); | 1685 AddXdgSurfaceV5State(&states, XDG_SURFACE_STATE_ACTIVATED); |
| 1361 uint32_t serial = wl_display_next_serial( | 1686 uint32_t serial = wl_display_next_serial( |
| 1362 wl_client_get_display(wl_resource_get_client(resource))); | 1687 wl_client_get_display(wl_resource_get_client(resource))); |
| 1363 xdg_surface_send_configure(resource, size.width(), size.height(), &states, | 1688 xdg_surface_send_configure(resource, size.width(), size.height(), &states, |
| 1364 serial); | 1689 serial); |
| 1365 wl_client_flush(wl_resource_get_client(resource)); | 1690 wl_client_flush(wl_resource_get_client(resource)); |
| 1366 wl_array_release(&states); | 1691 wl_array_release(&states); |
| 1367 return serial; | 1692 return serial; |
| 1368 } | 1693 } |
| 1369 | 1694 |
| 1370 void xdg_shell_get_xdg_surface(wl_client* client, | 1695 void xdg_shell_v5_get_xdg_surface(wl_client* client, |
| 1371 wl_resource* resource, | 1696 wl_resource* resource, |
| 1372 uint32_t id, | 1697 uint32_t id, |
| 1373 wl_resource* surface) { | 1698 wl_resource* surface) { |
| 1374 std::unique_ptr<ShellSurface> shell_surface = | 1699 std::unique_ptr<ShellSurface> shell_surface = |
| 1375 GetUserDataAs<Display>(resource)->CreateShellSurface( | 1700 GetUserDataAs<Display>(resource)->CreateShellSurface( |
| 1376 GetUserDataAs<Surface>(surface)); | 1701 GetUserDataAs<Surface>(surface)); |
| 1377 if (!shell_surface) { | 1702 if (!shell_surface) { |
| 1378 wl_resource_post_error(resource, XDG_SHELL_ERROR_ROLE, | 1703 wl_resource_post_error(resource, XDG_SHELL_ERROR_ROLE, |
| 1379 "surface has already been assigned a role"); | 1704 "surface has already been assigned a role"); |
| 1380 return; | 1705 return; |
| 1381 } | 1706 } |
| 1382 | 1707 |
| 1383 wl_resource* xdg_surface_resource = | 1708 wl_resource* xdg_surface_resource = |
| 1384 wl_resource_create(client, &xdg_surface_interface, 1, id); | 1709 wl_resource_create(client, &xdg_surface_interface, 1, id); |
| 1385 | 1710 |
| 1386 shell_surface->set_close_callback(base::Bind( | 1711 shell_surface->set_close_callback( |
| 1387 &HandleXdgSurfaceCloseCallback, base::Unretained(xdg_surface_resource))); | 1712 base::Bind(&HandleXdgSurfaceV5CloseCallback, |
| 1713 base::Unretained(xdg_surface_resource))); |
| 1388 | 1714 |
| 1389 shell_surface->set_configure_callback( | 1715 shell_surface->set_configure_callback( |
| 1390 base::Bind(&HandleXdgSurfaceConfigureCallback, | 1716 base::Bind(&HandleXdgSurfaceV5ConfigureCallback, |
| 1391 base::Unretained(xdg_surface_resource))); | 1717 base::Unretained(xdg_surface_resource))); |
| 1392 | 1718 |
| 1393 SetImplementation(xdg_surface_resource, &xdg_surface_implementation, | 1719 SetImplementation(xdg_surface_resource, &xdg_surface_v5_implementation, |
| 1394 std::move(shell_surface)); | 1720 std::move(shell_surface)); |
| 1395 } | 1721 } |
| 1396 | 1722 |
| 1397 void HandleXdgPopupCloseCallback(wl_resource* resource) { | 1723 void HandleXdgPopupV5CloseCallback(wl_resource* resource) { |
| 1398 xdg_popup_send_popup_done(resource); | 1724 xdg_popup_send_popup_done(resource); |
| 1399 wl_client_flush(wl_resource_get_client(resource)); | 1725 wl_client_flush(wl_resource_get_client(resource)); |
| 1400 } | 1726 } |
| 1401 | 1727 |
| 1402 void xdg_shell_get_xdg_popup(wl_client* client, | 1728 void xdg_shell_v5_get_xdg_popup(wl_client* client, |
| 1403 wl_resource* resource, | 1729 wl_resource* resource, |
| 1404 uint32_t id, | 1730 uint32_t id, |
| 1405 wl_resource* surface, | 1731 wl_resource* surface, |
| 1406 wl_resource* parent, | 1732 wl_resource* parent, |
| 1407 wl_resource* seat, | 1733 wl_resource* seat, |
| 1408 uint32_t serial, | 1734 uint32_t serial, |
| 1409 int32_t x, | 1735 int32_t x, |
| 1410 int32_t y) { | 1736 int32_t y) { |
| 1411 // Parent widget can be found by locating the closest ancestor with a widget. | 1737 // Parent widget can be found by locating the closest ancestor with a widget. |
| 1412 views::Widget* parent_widget = nullptr; | 1738 views::Widget* parent_widget = nullptr; |
| 1413 aura::Window* parent_window = GetUserDataAs<Surface>(parent)->window(); | 1739 aura::Window* parent_window = GetUserDataAs<Surface>(parent)->window(); |
| 1414 while (parent_window) { | 1740 while (parent_window) { |
| 1415 parent_widget = views::Widget::GetWidgetForNativeWindow(parent_window); | 1741 parent_widget = views::Widget::GetWidgetForNativeWindow(parent_window); |
| 1416 if (parent_widget) | 1742 if (parent_widget) |
| 1417 break; | 1743 break; |
| 1418 parent_window = parent_window->parent(); | 1744 parent_window = parent_window->parent(); |
| 1419 } | 1745 } |
| 1420 | 1746 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1440 if (!shell_surface) { | 1766 if (!shell_surface) { |
| 1441 wl_resource_post_error(resource, XDG_SHELL_ERROR_ROLE, | 1767 wl_resource_post_error(resource, XDG_SHELL_ERROR_ROLE, |
| 1442 "surface has already been assigned a role"); | 1768 "surface has already been assigned a role"); |
| 1443 return; | 1769 return; |
| 1444 } | 1770 } |
| 1445 | 1771 |
| 1446 wl_resource* xdg_popup_resource = | 1772 wl_resource* xdg_popup_resource = |
| 1447 wl_resource_create(client, &xdg_popup_interface, 1, id); | 1773 wl_resource_create(client, &xdg_popup_interface, 1, id); |
| 1448 | 1774 |
| 1449 shell_surface->set_close_callback(base::Bind( | 1775 shell_surface->set_close_callback(base::Bind( |
| 1450 &HandleXdgPopupCloseCallback, base::Unretained(xdg_popup_resource))); | 1776 &HandleXdgPopupV5CloseCallback, base::Unretained(xdg_popup_resource))); |
| 1451 | 1777 |
| 1452 SetImplementation(xdg_popup_resource, &xdg_popup_implementation, | 1778 SetImplementation(xdg_popup_resource, &xdg_popup_v5_implementation, |
| 1453 std::move(shell_surface)); | 1779 std::move(shell_surface)); |
| 1454 } | 1780 } |
| 1455 | 1781 |
| 1456 void xdg_shell_pong(wl_client* client, wl_resource* resource, uint32_t serial) { | 1782 void xdg_shell_v5_pong(wl_client* client, |
| 1783 wl_resource* resource, |
| 1784 uint32_t serial) { |
| 1457 NOTIMPLEMENTED(); | 1785 NOTIMPLEMENTED(); |
| 1458 } | 1786 } |
| 1459 | 1787 |
| 1460 const struct xdg_shell_interface xdg_shell_implementation = { | 1788 const struct xdg_shell_interface xdg_shell_v5_implementation = { |
| 1461 xdg_shell_destroy, xdg_shell_use_unstable_version, | 1789 xdg_shell_v5_destroy, xdg_shell_v5_use_unstable_version, |
| 1462 xdg_shell_get_xdg_surface, xdg_shell_get_xdg_popup, xdg_shell_pong}; | 1790 xdg_shell_v5_get_xdg_surface, xdg_shell_v5_get_xdg_popup, |
| 1791 xdg_shell_v5_pong}; |
| 1463 | 1792 |
| 1464 void bind_xdg_shell(wl_client* client, | 1793 void bind_xdg_shell_v5(wl_client* client, |
| 1465 void* data, | 1794 void* data, |
| 1466 uint32_t version, | 1795 uint32_t version, |
| 1467 uint32_t id) { | 1796 uint32_t id) { |
| 1468 wl_resource* resource = | 1797 wl_resource* resource = |
| 1469 wl_resource_create(client, &xdg_shell_interface, 1, id); | 1798 wl_resource_create(client, &xdg_shell_interface, 1, id); |
| 1470 | 1799 |
| 1471 wl_resource_set_implementation(resource, &xdg_shell_implementation, data, | 1800 wl_resource_set_implementation(resource, &xdg_shell_v5_implementation, data, |
| 1472 nullptr); | 1801 nullptr); |
| 1473 } | 1802 } |
| 1474 | 1803 |
| 1804 void xdg_shell_v6_destroy(wl_client* client, wl_resource* resource) { |
| 1805 // Nothing to do here. |
| 1806 } |
| 1807 |
| 1808 void xdg_shell_v6_create_positioner(wl_client* client, |
| 1809 wl_resource* resource, |
| 1810 uint32_t id) { |
| 1811 wl_resource* xdg_positioner_resource = |
| 1812 wl_resource_create(client, &zxdg_positioner_v6_interface, 1, id); |
| 1813 |
| 1814 wl_resource_set_implementation(xdg_positioner_resource, |
| 1815 &xdg_positioner_v6_implementation, nullptr, |
| 1816 nullptr); |
| 1817 } |
| 1818 |
| 1819 void xdg_shell_v6_get_xdg_surface(wl_client* client, |
| 1820 wl_resource* resource, |
| 1821 uint32_t id, |
| 1822 wl_resource* surface) { |
| 1823 std::unique_ptr<ShellSurface> shell_surface = |
| 1824 GetUserDataAs<Display>(resource)->CreateShellSurface( |
| 1825 GetUserDataAs<Surface>(surface)); |
| 1826 if (!shell_surface) { |
| 1827 wl_resource_post_error(resource, ZXDG_SHELL_V6_ERROR_ROLE, |
| 1828 "surface has already been assigned a role"); |
| 1829 return; |
| 1830 } |
| 1831 |
| 1832 // Xdg shell v6 surfaces are initially disabled and needs to be explicitly |
| 1833 // mapped before they are enabled and can become visible. |
| 1834 shell_surface->SetEnabled(false); |
| 1835 |
| 1836 wl_resource* xdg_surface_resource = |
| 1837 wl_resource_create(client, &zxdg_surface_v6_interface, 1, id); |
| 1838 |
| 1839 SetImplementation(xdg_surface_resource, &xdg_surface_v6_implementation, |
| 1840 std::move(shell_surface)); |
| 1841 } |
| 1842 |
| 1843 void xdg_shell_v6_pong(wl_client* client, |
| 1844 wl_resource* resource, |
| 1845 uint32_t serial) { |
| 1846 NOTIMPLEMENTED(); |
| 1847 } |
| 1848 |
| 1849 const struct zxdg_shell_v6_interface xdg_shell_v6_implementation = { |
| 1850 xdg_shell_v6_destroy, xdg_shell_v6_create_positioner, |
| 1851 xdg_shell_v6_get_xdg_surface, xdg_shell_v6_pong}; |
| 1852 |
| 1853 void bind_xdg_shell_v6(wl_client* client, |
| 1854 void* data, |
| 1855 uint32_t version, |
| 1856 uint32_t id) { |
| 1857 wl_resource* resource = |
| 1858 wl_resource_create(client, &zxdg_shell_v6_interface, 1, id); |
| 1859 |
| 1860 wl_resource_set_implementation(resource, &xdg_shell_v6_implementation, data, |
| 1861 nullptr); |
| 1862 } |
| 1863 |
| 1475 //////////////////////////////////////////////////////////////////////////////// | 1864 //////////////////////////////////////////////////////////////////////////////// |
| 1476 // remote_surface_interface: | 1865 // remote_surface_interface: |
| 1477 | 1866 |
| 1478 void remote_surface_destroy(wl_client* client, wl_resource* resource) { | 1867 void remote_surface_destroy(wl_client* client, wl_resource* resource) { |
| 1479 wl_resource_destroy(resource); | 1868 wl_resource_destroy(resource); |
| 1480 } | 1869 } |
| 1481 | 1870 |
| 1482 void remote_surface_set_app_id(wl_client* client, | 1871 void remote_surface_set_app_id(wl_client* client, |
| 1483 wl_resource* resource, | 1872 wl_resource* resource, |
| 1484 const char* app_id) { | 1873 const char* app_id) { |
| (...skipping 1752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3237 wl_global_create(wl_display_.get(), &zwp_linux_dmabuf_v1_interface, 1, | 3626 wl_global_create(wl_display_.get(), &zwp_linux_dmabuf_v1_interface, 1, |
| 3238 display_, bind_linux_dmabuf); | 3627 display_, bind_linux_dmabuf); |
| 3239 #endif | 3628 #endif |
| 3240 wl_global_create(wl_display_.get(), &wl_subcompositor_interface, 1, display_, | 3629 wl_global_create(wl_display_.get(), &wl_subcompositor_interface, 1, display_, |
| 3241 bind_subcompositor); | 3630 bind_subcompositor); |
| 3242 wl_global_create(wl_display_.get(), &wl_shell_interface, 1, display_, | 3631 wl_global_create(wl_display_.get(), &wl_shell_interface, 1, display_, |
| 3243 bind_shell); | 3632 bind_shell); |
| 3244 wl_global_create(wl_display_.get(), &wl_output_interface, output_version, | 3633 wl_global_create(wl_display_.get(), &wl_output_interface, output_version, |
| 3245 display_, bind_output); | 3634 display_, bind_output); |
| 3246 wl_global_create(wl_display_.get(), &xdg_shell_interface, 1, display_, | 3635 wl_global_create(wl_display_.get(), &xdg_shell_interface, 1, display_, |
| 3247 bind_xdg_shell); | 3636 bind_xdg_shell_v5); |
| 3637 wl_global_create(wl_display_.get(), &zxdg_shell_v6_interface, 1, display_, |
| 3638 bind_xdg_shell_v6); |
| 3248 wl_global_create(wl_display_.get(), &zcr_vsync_feedback_v1_interface, 1, | 3639 wl_global_create(wl_display_.get(), &zcr_vsync_feedback_v1_interface, 1, |
| 3249 display_, bind_vsync_feedback); | 3640 display_, bind_vsync_feedback); |
| 3250 wl_global_create(wl_display_.get(), &wl_data_device_manager_interface, 1, | 3641 wl_global_create(wl_display_.get(), &wl_data_device_manager_interface, 1, |
| 3251 display_, bind_data_device_manager); | 3642 display_, bind_data_device_manager); |
| 3252 wl_global_create(wl_display_.get(), &wl_seat_interface, seat_version, | 3643 wl_global_create(wl_display_.get(), &wl_seat_interface, seat_version, |
| 3253 display_, bind_seat); | 3644 display_, bind_seat); |
| 3254 wl_global_create(wl_display_.get(), &wp_viewporter_interface, 1, display_, | 3645 wl_global_create(wl_display_.get(), &wp_viewporter_interface, 1, display_, |
| 3255 bind_viewporter); | 3646 bind_viewporter); |
| 3256 wl_global_create(wl_display_.get(), &wp_presentation_interface, 1, display_, | 3647 wl_global_create(wl_display_.get(), &wp_presentation_interface, 1, display_, |
| 3257 bind_presentation); | 3648 bind_presentation); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3333 DCHECK(event_loop); | 3724 DCHECK(event_loop); |
| 3334 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); | 3725 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); |
| 3335 } | 3726 } |
| 3336 | 3727 |
| 3337 void Server::Flush() { | 3728 void Server::Flush() { |
| 3338 wl_display_flush_clients(wl_display_.get()); | 3729 wl_display_flush_clients(wl_display_.get()); |
| 3339 } | 3730 } |
| 3340 | 3731 |
| 3341 } // namespace wayland | 3732 } // namespace wayland |
| 3342 } // namespace exo | 3733 } // namespace exo |
| OLD | NEW |