| 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> |
| (...skipping 861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 872 uint32_t edges) { | 872 uint32_t edges) { |
| 873 NOTIMPLEMENTED(); | 873 NOTIMPLEMENTED(); |
| 874 } | 874 } |
| 875 | 875 |
| 876 void shell_surface_set_toplevel(wl_client* client, wl_resource* resource) { | 876 void shell_surface_set_toplevel(wl_client* client, wl_resource* resource) { |
| 877 ShellSurface* shell_surface = GetUserDataAs<ShellSurface>(resource); | 877 ShellSurface* shell_surface = GetUserDataAs<ShellSurface>(resource); |
| 878 if (shell_surface->enabled()) | 878 if (shell_surface->enabled()) |
| 879 return; | 879 return; |
| 880 | 880 |
| 881 shell_surface->SetFrame(true); | 881 shell_surface->SetFrame(true); |
| 882 shell_surface->SetRectangularShadow(true); | 882 shell_surface->SetRectangularShadowEnabled(true); |
| 883 shell_surface->SetEnabled(true); | 883 shell_surface->SetEnabled(true); |
| 884 } | 884 } |
| 885 | 885 |
| 886 void shell_surface_set_transient(wl_client* client, | 886 void shell_surface_set_transient(wl_client* client, |
| 887 wl_resource* resource, | 887 wl_resource* resource, |
| 888 wl_resource* parent_resource, | 888 wl_resource* parent_resource, |
| 889 int x, | 889 int x, |
| 890 int y, | 890 int y, |
| 891 uint32_t flags) { | 891 uint32_t flags) { |
| 892 ShellSurface* shell_surface = GetUserDataAs<ShellSurface>(resource); | 892 ShellSurface* shell_surface = GetUserDataAs<ShellSurface>(resource); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 924 } | 924 } |
| 925 | 925 |
| 926 if (flags & WL_SHELL_SURFACE_TRANSIENT_INACTIVE) { | 926 if (flags & WL_SHELL_SURFACE_TRANSIENT_INACTIVE) { |
| 927 shell_surface->SetOrigin(origin); | 927 shell_surface->SetOrigin(origin); |
| 928 shell_surface->SetContainer(ash::kShellWindowId_SystemModalContainer); | 928 shell_surface->SetContainer(ash::kShellWindowId_SystemModalContainer); |
| 929 shell_surface->SetActivatable(false); | 929 shell_surface->SetActivatable(false); |
| 930 } else { | 930 } else { |
| 931 shell_surface->SetFrame(true); | 931 shell_surface->SetFrame(true); |
| 932 shell_surface->SetParent(parent_shell_surface); | 932 shell_surface->SetParent(parent_shell_surface); |
| 933 } | 933 } |
| 934 shell_surface->SetRectangularShadow(true); | 934 shell_surface->SetRectangularShadowEnabled(true); |
| 935 shell_surface->SetEnabled(true); | 935 shell_surface->SetEnabled(true); |
| 936 } | 936 } |
| 937 | 937 |
| 938 void shell_surface_set_fullscreen(wl_client* client, | 938 void shell_surface_set_fullscreen(wl_client* client, |
| 939 wl_resource* resource, | 939 wl_resource* resource, |
| 940 uint32_t method, | 940 uint32_t method, |
| 941 uint32_t framerate, | 941 uint32_t framerate, |
| 942 wl_resource* output_resource) { | 942 wl_resource* output_resource) { |
| 943 ShellSurface* shell_surface = GetUserDataAs<ShellSurface>(resource); | 943 ShellSurface* shell_surface = GetUserDataAs<ShellSurface>(resource); |
| 944 if (shell_surface->enabled()) | 944 if (shell_surface->enabled()) |
| (...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1494 GetUserDataAs<ShellSurface>(resource)->SetGeometry( | 1494 GetUserDataAs<ShellSurface>(resource)->SetGeometry( |
| 1495 gfx::Rect(x, y, width, height)); | 1495 gfx::Rect(x, y, width, height)); |
| 1496 } | 1496 } |
| 1497 | 1497 |
| 1498 void remote_surface_set_scale(wl_client* client, | 1498 void remote_surface_set_scale(wl_client* client, |
| 1499 wl_resource* resource, | 1499 wl_resource* resource, |
| 1500 wl_fixed_t scale) { | 1500 wl_fixed_t scale) { |
| 1501 GetUserDataAs<ShellSurface>(resource)->SetScale(wl_fixed_to_double(scale)); | 1501 GetUserDataAs<ShellSurface>(resource)->SetScale(wl_fixed_to_double(scale)); |
| 1502 } | 1502 } |
| 1503 | 1503 |
| 1504 void remote_surface_set_rectangular_shadow(wl_client* client, | 1504 void remote_surface_set_rectangular_shadow_DEPRECATED(wl_client* client, |
| 1505 wl_resource* resource, | 1505 wl_resource* resource, |
| 1506 int32_t x, | 1506 int32_t x, |
| 1507 int32_t y, | 1507 int32_t y, |
| 1508 int32_t width, | 1508 int32_t width, |
| 1509 int32_t height) { | 1509 int32_t height) { |
| 1510 ShellSurface* shell_surface = GetUserDataAs<ShellSurface>(resource); | 1510 ShellSurface* shell_surface = GetUserDataAs<ShellSurface>(resource); |
| 1511 gfx::Rect content_bounds(x, y, width, height); | 1511 gfx::Rect content_bounds(x, y, width, height); |
| 1512 | 1512 shell_surface->SetRectangularShadow_DEPRECATED(content_bounds); |
| 1513 shell_surface->SetRectangularShadowContentBounds(content_bounds); | |
| 1514 shell_surface->SetRectangularShadow(!content_bounds.IsEmpty()); | |
| 1515 } | 1513 } |
| 1516 | 1514 |
| 1517 void remote_surface_set_rectangular_shadow_background_opacity( | 1515 void remote_surface_set_rectangular_shadow_background_opacity( |
| 1518 wl_client* client, | 1516 wl_client* client, |
| 1519 wl_resource* resource, | 1517 wl_resource* resource, |
| 1520 wl_fixed_t opacity) { | 1518 wl_fixed_t opacity) { |
| 1521 GetUserDataAs<ShellSurface>(resource)->SetRectangularShadowBackgroundOpacity( | 1519 GetUserDataAs<ShellSurface>(resource)->SetRectangularShadowBackgroundOpacity( |
| 1522 wl_fixed_to_double(opacity)); | 1520 wl_fixed_to_double(opacity)); |
| 1523 } | 1521 } |
| 1524 | 1522 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1573 | 1571 |
| 1574 void remote_surface_set_system_modal(wl_client* client, wl_resource* resource) { | 1572 void remote_surface_set_system_modal(wl_client* client, wl_resource* resource) { |
| 1575 GetUserDataAs<ShellSurface>(resource)->SetSystemModal(true); | 1573 GetUserDataAs<ShellSurface>(resource)->SetSystemModal(true); |
| 1576 } | 1574 } |
| 1577 | 1575 |
| 1578 void remote_surface_unset_system_modal(wl_client* client, | 1576 void remote_surface_unset_system_modal(wl_client* client, |
| 1579 wl_resource* resource) { | 1577 wl_resource* resource) { |
| 1580 GetUserDataAs<ShellSurface>(resource)->SetSystemModal(false); | 1578 GetUserDataAs<ShellSurface>(resource)->SetSystemModal(false); |
| 1581 } | 1579 } |
| 1582 | 1580 |
| 1581 void remote_surface_set_rectangular_surface_shadow(wl_client* client, |
| 1582 wl_resource* resource, |
| 1583 int32_t x, |
| 1584 int32_t y, |
| 1585 int32_t width, |
| 1586 int32_t height) { |
| 1587 ShellSurface* shell_surface = GetUserDataAs<ShellSurface>(resource); |
| 1588 gfx::Rect content_bounds(x, y, width, height); |
| 1589 shell_surface->SetRectangularSurfaceShadow(content_bounds); |
| 1590 } |
| 1591 |
| 1592 void remote_surface_ack_configure(wl_client* client, |
| 1593 wl_resource* resource, |
| 1594 uint32_t serial) { |
| 1595 NOTIMPLEMENTED(); |
| 1596 } |
| 1597 |
| 1598 void remote_surface_set_moving(wl_client* client, wl_resource* resource) { |
| 1599 NOTIMPLEMENTED(); |
| 1600 } |
| 1601 |
| 1602 void remote_surface_unset_moving(wl_client* client, wl_resource* resource) { |
| 1603 NOTIMPLEMENTED(); |
| 1604 } |
| 1605 |
| 1583 const struct zcr_remote_surface_v1_interface remote_surface_implementation = { | 1606 const struct zcr_remote_surface_v1_interface remote_surface_implementation = { |
| 1584 remote_surface_destroy, | 1607 remote_surface_destroy, |
| 1585 remote_surface_set_app_id, | 1608 remote_surface_set_app_id, |
| 1586 remote_surface_set_window_geometry, | 1609 remote_surface_set_window_geometry, |
| 1587 remote_surface_set_scale, | 1610 remote_surface_set_scale, |
| 1588 remote_surface_set_rectangular_shadow, | 1611 remote_surface_set_rectangular_shadow_DEPRECATED, |
| 1589 remote_surface_set_rectangular_shadow_background_opacity, | 1612 remote_surface_set_rectangular_shadow_background_opacity, |
| 1590 remote_surface_set_title, | 1613 remote_surface_set_title, |
| 1591 remote_surface_set_top_inset, | 1614 remote_surface_set_top_inset, |
| 1592 remote_surface_activate, | 1615 remote_surface_activate, |
| 1593 remote_surface_maximize, | 1616 remote_surface_maximize, |
| 1594 remote_surface_minimize, | 1617 remote_surface_minimize, |
| 1595 remote_surface_restore, | 1618 remote_surface_restore, |
| 1596 remote_surface_fullscreen, | 1619 remote_surface_fullscreen, |
| 1597 remote_surface_unfullscreen, | 1620 remote_surface_unfullscreen, |
| 1598 remote_surface_pin, | 1621 remote_surface_pin, |
| 1599 remote_surface_unpin, | 1622 remote_surface_unpin, |
| 1600 remote_surface_set_system_modal, | 1623 remote_surface_set_system_modal, |
| 1601 remote_surface_unset_system_modal}; | 1624 remote_surface_unset_system_modal, |
| 1625 remote_surface_set_rectangular_surface_shadow, |
| 1626 remote_surface_ack_configure, |
| 1627 remote_surface_set_moving, |
| 1628 remote_surface_unset_moving}; |
| 1602 | 1629 |
| 1603 //////////////////////////////////////////////////////////////////////////////// | 1630 //////////////////////////////////////////////////////////////////////////////// |
| 1604 // notification_surface_interface: | 1631 // notification_surface_interface: |
| 1605 | 1632 |
| 1606 void notification_surface_destroy(wl_client* client, wl_resource* resource) { | 1633 void notification_surface_destroy(wl_client* client, wl_resource* resource) { |
| 1607 wl_resource_destroy(resource); | 1634 wl_resource_destroy(resource); |
| 1608 } | 1635 } |
| 1609 | 1636 |
| 1610 const struct zcr_notification_surface_v1_interface | 1637 const struct zcr_notification_surface_v1_interface |
| 1611 notification_surface_implementation = {notification_surface_destroy}; | 1638 notification_surface_implementation = {notification_surface_destroy}; |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1878 wl_resource_get_version(resource), id); | 1905 wl_resource_get_version(resource), id); |
| 1879 SetImplementation(notification_surface_resource, | 1906 SetImplementation(notification_surface_resource, |
| 1880 ¬ification_surface_implementation, | 1907 ¬ification_surface_implementation, |
| 1881 std::move(notification_surface)); | 1908 std::move(notification_surface)); |
| 1882 } | 1909 } |
| 1883 | 1910 |
| 1884 const struct zcr_remote_shell_v1_interface remote_shell_implementation = { | 1911 const struct zcr_remote_shell_v1_interface remote_shell_implementation = { |
| 1885 remote_shell_destroy, remote_shell_get_remote_surface, | 1912 remote_shell_destroy, remote_shell_get_remote_surface, |
| 1886 remote_shell_get_notification_surface}; | 1913 remote_shell_get_notification_surface}; |
| 1887 | 1914 |
| 1888 const uint32_t remote_shell_version = 1; | 1915 const uint32_t remote_shell_version = 2; |
| 1889 | 1916 |
| 1890 void bind_remote_shell(wl_client* client, | 1917 void bind_remote_shell(wl_client* client, |
| 1891 void* data, | 1918 void* data, |
| 1892 uint32_t version, | 1919 uint32_t version, |
| 1893 uint32_t id) { | 1920 uint32_t id) { |
| 1894 wl_resource* resource = | 1921 wl_resource* resource = |
| 1895 wl_resource_create(client, &zcr_remote_shell_v1_interface, | 1922 wl_resource_create(client, &zcr_remote_shell_v1_interface, |
| 1896 std::min(version, remote_shell_version), id); | 1923 std::min(version, remote_shell_version), id); |
| 1897 | 1924 |
| 1898 SetImplementation(resource, &remote_shell_implementation, | 1925 SetImplementation(resource, &remote_shell_implementation, |
| (...skipping 1434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3333 DCHECK(event_loop); | 3360 DCHECK(event_loop); |
| 3334 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); | 3361 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); |
| 3335 } | 3362 } |
| 3336 | 3363 |
| 3337 void Server::Flush() { | 3364 void Server::Flush() { |
| 3338 wl_display_flush_clients(wl_display_.get()); | 3365 wl_display_flush_clients(wl_display_.get()); |
| 3339 } | 3366 } |
| 3340 | 3367 |
| 3341 } // namespace wayland | 3368 } // namespace wayland |
| 3342 } // namespace exo | 3369 } // namespace exo |
| OLD | NEW |