| 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> |
| (...skipping 1501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1512 GetUserDataAs<ShellSurface>(resource)->SetFullscreen(true); | 1512 GetUserDataAs<ShellSurface>(resource)->SetFullscreen(true); |
| 1513 } | 1513 } |
| 1514 | 1514 |
| 1515 void remote_surface_unfullscreen(wl_client* client, wl_resource* resource) { | 1515 void remote_surface_unfullscreen(wl_client* client, wl_resource* resource) { |
| 1516 GetUserDataAs<ShellSurface>(resource)->SetFullscreen(false); | 1516 GetUserDataAs<ShellSurface>(resource)->SetFullscreen(false); |
| 1517 } | 1517 } |
| 1518 | 1518 |
| 1519 void remote_surface_pin(wl_client* client, | 1519 void remote_surface_pin(wl_client* client, |
| 1520 wl_resource* resource, | 1520 wl_resource* resource, |
| 1521 int32_t trusted) { | 1521 int32_t trusted) { |
| 1522 GetUserDataAs<ShellSurface>(resource)->SetPinned(true); | 1522 GetUserDataAs<ShellSurface>(resource)->SetPinned(true, trusted); |
| 1523 } | 1523 } |
| 1524 | 1524 |
| 1525 void remote_surface_unpin(wl_client* client, wl_resource* resource) { | 1525 void remote_surface_unpin(wl_client* client, wl_resource* resource) { |
| 1526 GetUserDataAs<ShellSurface>(resource)->SetPinned(false); | 1526 GetUserDataAs<ShellSurface>(resource)->SetPinned(false, /* trusted */ false); |
| 1527 } | 1527 } |
| 1528 | 1528 |
| 1529 void remote_surface_set_system_modal(wl_client* client, wl_resource* resource) { | 1529 void remote_surface_set_system_modal(wl_client* client, wl_resource* resource) { |
| 1530 GetUserDataAs<ShellSurface>(resource)->SetSystemModal(true); | 1530 GetUserDataAs<ShellSurface>(resource)->SetSystemModal(true); |
| 1531 } | 1531 } |
| 1532 | 1532 |
| 1533 void remote_surface_unset_system_modal(wl_client* client, | 1533 void remote_surface_unset_system_modal(wl_client* client, |
| 1534 wl_resource* resource) { | 1534 wl_resource* resource) { |
| 1535 GetUserDataAs<ShellSurface>(resource)->SetSystemModal(false); | 1535 GetUserDataAs<ShellSurface>(resource)->SetSystemModal(false); |
| 1536 } | 1536 } |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1596 wl_resource* resource) { | 1596 wl_resource* resource) { |
| 1597 GetUserDataAs<ShellSurface>(resource)->Minimize(); | 1597 GetUserDataAs<ShellSurface>(resource)->Minimize(); |
| 1598 } | 1598 } |
| 1599 | 1599 |
| 1600 void remote_surface_restore_DEPRECATED(wl_client* client, | 1600 void remote_surface_restore_DEPRECATED(wl_client* client, |
| 1601 wl_resource* resource) { | 1601 wl_resource* resource) { |
| 1602 GetUserDataAs<ShellSurface>(resource)->Restore(); | 1602 GetUserDataAs<ShellSurface>(resource)->Restore(); |
| 1603 } | 1603 } |
| 1604 | 1604 |
| 1605 void remote_surface_pin_DEPRECATED(wl_client* client, wl_resource* resource) { | 1605 void remote_surface_pin_DEPRECATED(wl_client* client, wl_resource* resource) { |
| 1606 GetUserDataAs<ShellSurface>(resource)->SetPinned(true); | 1606 GetUserDataAs<ShellSurface>(resource)->SetPinned(true, /* trusted */ false); |
| 1607 } | 1607 } |
| 1608 | 1608 |
| 1609 void remote_surface_unpin_DEPRECATED(wl_client* client, wl_resource* resource) { | 1609 void remote_surface_unpin_DEPRECATED(wl_client* client, wl_resource* resource) { |
| 1610 GetUserDataAs<ShellSurface>(resource)->SetPinned(false); | 1610 GetUserDataAs<ShellSurface>(resource)->SetPinned(false, /* trusted */ false); |
| 1611 } | 1611 } |
| 1612 | 1612 |
| 1613 void remote_surface_unfullscreen_DEPRECATED(wl_client* client, | 1613 void remote_surface_unfullscreen_DEPRECATED(wl_client* client, |
| 1614 wl_resource* resource) { | 1614 wl_resource* resource) { |
| 1615 GetUserDataAs<ShellSurface>(resource)->SetFullscreen(false); | 1615 GetUserDataAs<ShellSurface>(resource)->SetFullscreen(false); |
| 1616 } | 1616 } |
| 1617 | 1617 |
| 1618 void remote_surface_set_rectangular_shadow_DEPRECATED(wl_client* client, | 1618 void remote_surface_set_rectangular_shadow_DEPRECATED(wl_client* client, |
| 1619 wl_resource* resource, | 1619 wl_resource* resource, |
| 1620 int32_t x, | 1620 int32_t x, |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1655 GetUserDataAs<ShellSurface>(resource)->SetRectangularShadowBackgroundOpacity( | 1655 GetUserDataAs<ShellSurface>(resource)->SetRectangularShadowBackgroundOpacity( |
| 1656 wl_fixed_to_double(opacity)); | 1656 wl_fixed_to_double(opacity)); |
| 1657 } | 1657 } |
| 1658 | 1658 |
| 1659 void remote_surface_activate_DEPRECATED(wl_client* client, | 1659 void remote_surface_activate_DEPRECATED(wl_client* client, |
| 1660 wl_resource* resource, | 1660 wl_resource* resource, |
| 1661 uint32_t serial) { | 1661 uint32_t serial) { |
| 1662 GetUserDataAs<ShellSurface>(resource)->Activate(); | 1662 GetUserDataAs<ShellSurface>(resource)->Activate(); |
| 1663 } | 1663 } |
| 1664 | 1664 |
| 1665 void remote_surface_pin_with_trusted_flag_DEPRECATED(wl_client* client, |
| 1666 wl_resource* resource, |
| 1667 int32_t trusted) { |
| 1668 GetUserDataAs<ShellSurface>(resource)->SetPinned(true, trusted); |
| 1669 } |
| 1670 |
| 1665 const struct zwp_remote_surface_v1_interface | 1671 const struct zwp_remote_surface_v1_interface |
| 1666 remote_surface_implementation_DEPRECATED = { | 1672 remote_surface_implementation_DEPRECATED = { |
| 1667 remote_surface_destroy_DEPRECATED, | 1673 remote_surface_destroy_DEPRECATED, |
| 1668 remote_surface_set_app_id_DEPRECATED, | 1674 remote_surface_set_app_id_DEPRECATED, |
| 1669 remote_surface_set_window_geometry_DEPRECATED, | 1675 remote_surface_set_window_geometry_DEPRECATED, |
| 1670 remote_surface_set_scale_DEPRECATED, | 1676 remote_surface_set_scale_DEPRECATED, |
| 1671 remote_surface_fullscreen_DEPRECATED, | 1677 remote_surface_fullscreen_DEPRECATED, |
| 1672 remote_surface_maximize_DEPRECATED, | 1678 remote_surface_maximize_DEPRECATED, |
| 1673 remote_surface_minimize_DEPRECATED, | 1679 remote_surface_minimize_DEPRECATED, |
| 1674 remote_surface_restore_DEPRECATED, | 1680 remote_surface_restore_DEPRECATED, |
| 1675 remote_surface_pin_DEPRECATED, | 1681 remote_surface_pin_DEPRECATED, |
| 1676 remote_surface_unpin_DEPRECATED, | 1682 remote_surface_unpin_DEPRECATED, |
| 1677 remote_surface_unfullscreen_DEPRECATED, | 1683 remote_surface_unfullscreen_DEPRECATED, |
| 1678 remote_surface_set_rectangular_shadow_DEPRECATED, | 1684 remote_surface_set_rectangular_shadow_DEPRECATED, |
| 1679 remote_surface_set_title_DEPRECATED, | 1685 remote_surface_set_title_DEPRECATED, |
| 1680 remote_surface_set_top_inset_DEPRECATED, | 1686 remote_surface_set_top_inset_DEPRECATED, |
| 1681 remote_surface_set_system_modal_DEPRECATED, | 1687 remote_surface_set_system_modal_DEPRECATED, |
| 1682 remote_surface_unset_system_modal_DEPRECATED, | 1688 remote_surface_unset_system_modal_DEPRECATED, |
| 1683 remote_surface_set_rectangular_shadow_background_opacity_DEPRECATED, | 1689 remote_surface_set_rectangular_shadow_background_opacity_DEPRECATED, |
| 1684 remote_surface_activate_DEPRECATED}; | 1690 remote_surface_activate_DEPRECATED, |
| 1691 remote_surface_pin_with_trusted_flag_DEPRECATED}; |
| 1685 | 1692 |
| 1686 //////////////////////////////////////////////////////////////////////////////// | 1693 //////////////////////////////////////////////////////////////////////////////// |
| 1687 // notification_surface_interface: | 1694 // notification_surface_interface: |
| 1688 | 1695 |
| 1689 void notification_surface_destroy(wl_client* client, wl_resource* resource) { | 1696 void notification_surface_destroy(wl_client* client, wl_resource* resource) { |
| 1690 wl_resource_destroy(resource); | 1697 wl_resource_destroy(resource); |
| 1691 } | 1698 } |
| 1692 | 1699 |
| 1693 const struct zcr_notification_surface_v1_interface | 1700 const struct zcr_notification_surface_v1_interface |
| 1694 notification_surface_implementation = {notification_surface_destroy}; | 1701 notification_surface_implementation = {notification_surface_destroy}; |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1897 break; | 1904 break; |
| 1898 case ash::wm::WINDOW_STATE_TYPE_MAXIMIZED: | 1905 case ash::wm::WINDOW_STATE_TYPE_MAXIMIZED: |
| 1899 state_type = ZCR_REMOTE_SHELL_V1_STATE_TYPE_MAXIMIZED; | 1906 state_type = ZCR_REMOTE_SHELL_V1_STATE_TYPE_MAXIMIZED; |
| 1900 break; | 1907 break; |
| 1901 case ash::wm::WINDOW_STATE_TYPE_FULLSCREEN: | 1908 case ash::wm::WINDOW_STATE_TYPE_FULLSCREEN: |
| 1902 state_type = ZCR_REMOTE_SHELL_V1_STATE_TYPE_FULLSCREEN; | 1909 state_type = ZCR_REMOTE_SHELL_V1_STATE_TYPE_FULLSCREEN; |
| 1903 break; | 1910 break; |
| 1904 case ash::wm::WINDOW_STATE_TYPE_PINNED: | 1911 case ash::wm::WINDOW_STATE_TYPE_PINNED: |
| 1905 state_type = ZCR_REMOTE_SHELL_V1_STATE_TYPE_PINNED; | 1912 state_type = ZCR_REMOTE_SHELL_V1_STATE_TYPE_PINNED; |
| 1906 break; | 1913 break; |
| 1914 case ash::wm::WINDOW_STATE_TYPE_TRUSTED_PINNED: |
| 1915 state_type = ZWP_REMOTE_SHELL_V1_STATE_TYPE_TRUSTED_PINNED; |
| 1916 break; |
| 1907 default: | 1917 default: |
| 1908 break; | 1918 break; |
| 1909 } | 1919 } |
| 1910 | 1920 |
| 1911 zcr_remote_surface_v1_send_state_type_changed(resource, state_type); | 1921 zcr_remote_surface_v1_send_state_type_changed(resource, state_type); |
| 1912 wl_client_flush(wl_resource_get_client(resource)); | 1922 wl_client_flush(wl_resource_get_client(resource)); |
| 1913 } | 1923 } |
| 1914 | 1924 |
| 1915 void remote_shell_get_remote_surface(wl_client* client, | 1925 void remote_shell_get_remote_surface(wl_client* client, |
| 1916 wl_resource* resource, | 1926 wl_resource* resource, |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2214 zwp_remote_surface_v1_send_unset_minimized(resource); | 2224 zwp_remote_surface_v1_send_unset_minimized(resource); |
| 2215 break; | 2225 break; |
| 2216 case ash::wm::WINDOW_STATE_TYPE_MAXIMIZED: | 2226 case ash::wm::WINDOW_STATE_TYPE_MAXIMIZED: |
| 2217 if (wl_resource_get_version(resource) >= 2) | 2227 if (wl_resource_get_version(resource) >= 2) |
| 2218 zwp_remote_surface_v1_send_unset_maximized(resource); | 2228 zwp_remote_surface_v1_send_unset_maximized(resource); |
| 2219 break; | 2229 break; |
| 2220 case ash::wm::WINDOW_STATE_TYPE_FULLSCREEN: | 2230 case ash::wm::WINDOW_STATE_TYPE_FULLSCREEN: |
| 2221 zwp_remote_surface_v1_send_unset_fullscreen(resource); | 2231 zwp_remote_surface_v1_send_unset_fullscreen(resource); |
| 2222 break; | 2232 break; |
| 2223 case ash::wm::WINDOW_STATE_TYPE_PINNED: | 2233 case ash::wm::WINDOW_STATE_TYPE_PINNED: |
| 2234 case ash::wm::WINDOW_STATE_TYPE_TRUSTED_PINNED: |
| 2224 if (wl_resource_get_version(resource) >= 3) | 2235 if (wl_resource_get_version(resource) >= 3) |
| 2225 zwp_remote_surface_v1_send_unset_pinned(resource); | 2236 zwp_remote_surface_v1_send_unset_pinned(resource); |
| 2226 break; | 2237 break; |
| 2227 default: | 2238 default: |
| 2228 break; | 2239 break; |
| 2229 } | 2240 } |
| 2230 | 2241 |
| 2231 uint32_t state_type = ZWP_REMOTE_SHELL_V1_STATE_TYPE_NORMAL; | 2242 uint32_t state_type = ZWP_REMOTE_SHELL_V1_STATE_TYPE_NORMAL; |
| 2232 switch (new_state_type) { | 2243 switch (new_state_type) { |
| 2233 case ash::wm::WINDOW_STATE_TYPE_MINIMIZED: | 2244 case ash::wm::WINDOW_STATE_TYPE_MINIMIZED: |
| 2234 state_type = ZWP_REMOTE_SHELL_V1_STATE_TYPE_MINIMIZED; | 2245 state_type = ZWP_REMOTE_SHELL_V1_STATE_TYPE_MINIMIZED; |
| 2235 if (wl_resource_get_version(resource) >= 2) | 2246 if (wl_resource_get_version(resource) >= 2) |
| 2236 zwp_remote_surface_v1_send_set_minimized(resource); | 2247 zwp_remote_surface_v1_send_set_minimized(resource); |
| 2237 break; | 2248 break; |
| 2238 case ash::wm::WINDOW_STATE_TYPE_MAXIMIZED: | 2249 case ash::wm::WINDOW_STATE_TYPE_MAXIMIZED: |
| 2239 state_type = ZWP_REMOTE_SHELL_V1_STATE_TYPE_MAXIMIZED; | 2250 state_type = ZWP_REMOTE_SHELL_V1_STATE_TYPE_MAXIMIZED; |
| 2240 if (wl_resource_get_version(resource) >= 2) | 2251 if (wl_resource_get_version(resource) >= 2) |
| 2241 zwp_remote_surface_v1_send_set_maximized(resource); | 2252 zwp_remote_surface_v1_send_set_maximized(resource); |
| 2242 break; | 2253 break; |
| 2243 case ash::wm::WINDOW_STATE_TYPE_FULLSCREEN: | 2254 case ash::wm::WINDOW_STATE_TYPE_FULLSCREEN: |
| 2244 state_type = ZWP_REMOTE_SHELL_V1_STATE_TYPE_FULLSCREEN; | 2255 state_type = ZWP_REMOTE_SHELL_V1_STATE_TYPE_FULLSCREEN; |
| 2245 zwp_remote_surface_v1_send_set_fullscreen(resource); | 2256 zwp_remote_surface_v1_send_set_fullscreen(resource); |
| 2246 break; | 2257 break; |
| 2247 case ash::wm::WINDOW_STATE_TYPE_PINNED: | 2258 case ash::wm::WINDOW_STATE_TYPE_PINNED: |
| 2248 state_type = ZWP_REMOTE_SHELL_V1_STATE_TYPE_PINNED; | 2259 state_type = ZWP_REMOTE_SHELL_V1_STATE_TYPE_PINNED; |
| 2249 if (wl_resource_get_version(resource) >= 3) | 2260 if (wl_resource_get_version(resource) >= 3) |
| 2250 zwp_remote_surface_v1_send_set_pinned(resource); | 2261 zwp_remote_surface_v1_send_set_pinned(resource); |
| 2251 break; | 2262 break; |
| 2263 case ash::wm::WINDOW_STATE_TYPE_TRUSTED_PINNED: |
| 2264 state_type = ZWP_REMOTE_SHELL_V1_STATE_TYPE_TRUSTED_PINNED; |
| 2265 if (wl_resource_get_version(resource) >= 3) |
| 2266 zwp_remote_surface_v1_send_set_pinned(resource); |
| 2267 break; |
| 2252 default: | 2268 default: |
| 2253 break; | 2269 break; |
| 2254 } | 2270 } |
| 2255 | 2271 |
| 2256 if (wl_resource_get_version(resource) >= 7) | 2272 if (wl_resource_get_version(resource) >= 7) |
| 2257 zwp_remote_surface_v1_send_state_type_changed(resource, state_type); | 2273 zwp_remote_surface_v1_send_state_type_changed(resource, state_type); |
| 2258 | 2274 |
| 2259 wl_client_flush(wl_resource_get_client(resource)); | 2275 wl_client_flush(wl_resource_get_client(resource)); |
| 2260 } | 2276 } |
| 2261 | 2277 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2319 ¬ification_surface_implementation_DEPRECATED, | 2335 ¬ification_surface_implementation_DEPRECATED, |
| 2320 std::move(notification_surface)); | 2336 std::move(notification_surface)); |
| 2321 } | 2337 } |
| 2322 | 2338 |
| 2323 const struct zwp_remote_shell_v1_interface | 2339 const struct zwp_remote_shell_v1_interface |
| 2324 remote_shell_implementation_DEPRECATED = { | 2340 remote_shell_implementation_DEPRECATED = { |
| 2325 remote_shell_destroy_DEPRECATED, | 2341 remote_shell_destroy_DEPRECATED, |
| 2326 remote_shell_get_remote_surface_DEPRECATED, | 2342 remote_shell_get_remote_surface_DEPRECATED, |
| 2327 remote_shell_get_notification_surface_DEPRECATED}; | 2343 remote_shell_get_notification_surface_DEPRECATED}; |
| 2328 | 2344 |
| 2329 const uint32_t remote_shell_version_DEPRECATED = 10; | 2345 const uint32_t remote_shell_version_DEPRECATED = 11; |
| 2330 | 2346 |
| 2331 void bind_remote_shell_DEPRECATED(wl_client* client, | 2347 void bind_remote_shell_DEPRECATED(wl_client* client, |
| 2332 void* data, | 2348 void* data, |
| 2333 uint32_t version, | 2349 uint32_t version, |
| 2334 uint32_t id) { | 2350 uint32_t id) { |
| 2335 wl_resource* resource = wl_resource_create( | 2351 wl_resource* resource = wl_resource_create( |
| 2336 client, &zwp_remote_shell_v1_interface, | 2352 client, &zwp_remote_shell_v1_interface, |
| 2337 std::min(version, remote_shell_version_DEPRECATED), id); | 2353 std::min(version, remote_shell_version_DEPRECATED), id); |
| 2338 | 2354 |
| 2339 SetImplementation(resource, &remote_shell_implementation_DEPRECATED, | 2355 SetImplementation(resource, &remote_shell_implementation_DEPRECATED, |
| (...skipping 1634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3974 DCHECK(event_loop); | 3990 DCHECK(event_loop); |
| 3975 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); | 3991 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); |
| 3976 } | 3992 } |
| 3977 | 3993 |
| 3978 void Server::Flush() { | 3994 void Server::Flush() { |
| 3979 wl_display_flush_clients(wl_display_.get()); | 3995 wl_display_flush_clients(wl_display_.get()); |
| 3980 } | 3996 } |
| 3981 | 3997 |
| 3982 } // namespace wayland | 3998 } // namespace wayland |
| 3983 } // namespace exo | 3999 } // namespace exo |
| OLD | NEW |