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 <gaming-input-unstable-v2-server-protocol.h> | 9 #include <gaming-input-unstable-v2-server-protocol.h> |
10 #include <grp.h> | 10 #include <grp.h> |
(...skipping 1905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1916 wl_fixed_to_double(opacity)); | 1916 wl_fixed_to_double(opacity)); |
1917 } | 1917 } |
1918 | 1918 |
1919 void remote_surface_set_title(wl_client* client, | 1919 void remote_surface_set_title(wl_client* client, |
1920 wl_resource* resource, | 1920 wl_resource* resource, |
1921 const char* title) { | 1921 const char* title) { |
1922 GetUserDataAs<ShellSurface>(resource)->SetTitle( | 1922 GetUserDataAs<ShellSurface>(resource)->SetTitle( |
1923 base::string16(base::UTF8ToUTF16(title))); | 1923 base::string16(base::UTF8ToUTF16(title))); |
1924 } | 1924 } |
1925 | 1925 |
| 1926 void remote_surface_set_icon_png_chunk(wl_client* client, |
| 1927 wl_resource* resource, |
| 1928 uint32_t flags, |
| 1929 wl_array* content) { |
| 1930 const char* data = static_cast<const char*>(content->data); |
| 1931 GetUserDataAs<ShellSurface>(resource)->SetIconChunk( |
| 1932 flags, std::string(data, data + content->size)); |
| 1933 } |
| 1934 |
| 1935 void remote_surface_reset_icon(wl_client* client, wl_resource* resource) { |
| 1936 GetUserDataAs<ShellSurface>(resource)->ResetIcon(); |
| 1937 } |
| 1938 |
1926 void remote_surface_set_top_inset(wl_client* client, | 1939 void remote_surface_set_top_inset(wl_client* client, |
1927 wl_resource* resource, | 1940 wl_resource* resource, |
1928 int32_t height) { | 1941 int32_t height) { |
1929 GetUserDataAs<ShellSurface>(resource)->SetTopInset(height); | 1942 GetUserDataAs<ShellSurface>(resource)->SetTopInset(height); |
1930 } | 1943 } |
1931 | 1944 |
1932 void remote_surface_activate(wl_client* client, | 1945 void remote_surface_activate(wl_client* client, |
1933 wl_resource* resource, | 1946 wl_resource* resource, |
1934 uint32_t serial) { | 1947 uint32_t serial) { |
1935 ShellSurface* shell_surface = GetUserDataAs<ShellSurface>(resource); | 1948 ShellSurface* shell_surface = GetUserDataAs<ShellSurface>(resource); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2038 remote_surface_fullscreen, | 2051 remote_surface_fullscreen, |
2039 remote_surface_unfullscreen, | 2052 remote_surface_unfullscreen, |
2040 remote_surface_pin, | 2053 remote_surface_pin, |
2041 remote_surface_unpin, | 2054 remote_surface_unpin, |
2042 remote_surface_set_system_modal, | 2055 remote_surface_set_system_modal, |
2043 remote_surface_unset_system_modal, | 2056 remote_surface_unset_system_modal, |
2044 remote_surface_set_rectangular_surface_shadow, | 2057 remote_surface_set_rectangular_surface_shadow, |
2045 remote_surface_set_systemui_visibility, | 2058 remote_surface_set_systemui_visibility, |
2046 remote_surface_set_always_on_top, | 2059 remote_surface_set_always_on_top, |
2047 remote_surface_unset_always_on_top, | 2060 remote_surface_unset_always_on_top, |
| 2061 remote_surface_set_icon_png_chunk, |
| 2062 remote_surface_reset_icon, |
2048 remote_surface_ack_configure, | 2063 remote_surface_ack_configure, |
2049 remote_surface_move}; | 2064 remote_surface_move}; |
2050 | 2065 |
2051 //////////////////////////////////////////////////////////////////////////////// | 2066 //////////////////////////////////////////////////////////////////////////////// |
2052 // notification_surface_interface: | 2067 // notification_surface_interface: |
2053 | 2068 |
2054 void notification_surface_destroy(wl_client* client, wl_resource* resource) { | 2069 void notification_surface_destroy(wl_client* client, wl_resource* resource) { |
2055 wl_resource_destroy(resource); | 2070 wl_resource_destroy(resource); |
2056 } | 2071 } |
2057 | 2072 |
(...skipping 26 matching lines...) Expand all Loading... |
2084 SendActivated(helper->GetActiveWindow(), nullptr); | 2099 SendActivated(helper->GetActiveWindow(), nullptr); |
2085 } | 2100 } |
2086 ~WaylandRemoteShell() override { | 2101 ~WaylandRemoteShell() override { |
2087 auto* helper = WMHelper::GetInstance(); | 2102 auto* helper = WMHelper::GetInstance(); |
2088 helper->RemoveMaximizeModeObserver(this); | 2103 helper->RemoveMaximizeModeObserver(this); |
2089 helper->RemoveActivationObserver(this); | 2104 helper->RemoveActivationObserver(this); |
2090 display::Screen::GetScreen()->RemoveObserver(this); | 2105 display::Screen::GetScreen()->RemoveObserver(this); |
2091 } | 2106 } |
2092 | 2107 |
2093 bool IsMultiDisplaySupported() const { | 2108 bool IsMultiDisplaySupported() const { |
2094 return wl_resource_get_version(remote_shell_resource_) >= 5; | 2109 return wl_resource_get_version(remote_shell_resource_) >= 6; |
2095 } | 2110 } |
2096 | 2111 |
2097 std::unique_ptr<ShellSurface> CreateShellSurface(Surface* surface, | 2112 std::unique_ptr<ShellSurface> CreateShellSurface(Surface* surface, |
2098 int container) { | 2113 int container) { |
2099 return display_->CreateRemoteShellSurface(surface, container); | 2114 return display_->CreateRemoteShellSurface(surface, container); |
2100 } | 2115 } |
2101 | 2116 |
2102 std::unique_ptr<NotificationSurface> CreateNotificationSurface( | 2117 std::unique_ptr<NotificationSurface> CreateNotificationSurface( |
2103 Surface* surface, | 2118 Surface* surface, |
2104 const std::string& notification_id) { | 2119 const std::string& notification_id) { |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2387 wl_resource_get_version(resource), id); | 2402 wl_resource_get_version(resource), id); |
2388 SetImplementation(notification_surface_resource, | 2403 SetImplementation(notification_surface_resource, |
2389 ¬ification_surface_implementation, | 2404 ¬ification_surface_implementation, |
2390 std::move(notification_surface)); | 2405 std::move(notification_surface)); |
2391 } | 2406 } |
2392 | 2407 |
2393 const struct zcr_remote_shell_v1_interface remote_shell_implementation = { | 2408 const struct zcr_remote_shell_v1_interface remote_shell_implementation = { |
2394 remote_shell_destroy, remote_shell_get_remote_surface, | 2409 remote_shell_destroy, remote_shell_get_remote_surface, |
2395 remote_shell_get_notification_surface}; | 2410 remote_shell_get_notification_surface}; |
2396 | 2411 |
2397 const uint32_t remote_shell_version = 5; | 2412 const uint32_t remote_shell_version = 6; |
2398 | 2413 |
2399 void bind_remote_shell(wl_client* client, | 2414 void bind_remote_shell(wl_client* client, |
2400 void* data, | 2415 void* data, |
2401 uint32_t version, | 2416 uint32_t version, |
2402 uint32_t id) { | 2417 uint32_t id) { |
2403 wl_resource* resource = | 2418 wl_resource* resource = |
2404 wl_resource_create(client, &zcr_remote_shell_v1_interface, | 2419 wl_resource_create(client, &zcr_remote_shell_v1_interface, |
2405 std::min(version, remote_shell_version), id); | 2420 std::min(version, remote_shell_version), id); |
2406 | 2421 |
2407 SetImplementation(resource, &remote_shell_implementation, | 2422 SetImplementation(resource, &remote_shell_implementation, |
(...skipping 1547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3955 DCHECK(event_loop); | 3970 DCHECK(event_loop); |
3956 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); | 3971 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); |
3957 } | 3972 } |
3958 | 3973 |
3959 void Server::Flush() { | 3974 void Server::Flush() { |
3960 wl_display_flush_clients(wl_display_.get()); | 3975 wl_display_flush_clients(wl_display_.get()); |
3961 } | 3976 } |
3962 | 3977 |
3963 } // namespace wayland | 3978 } // namespace wayland |
3964 } // namespace exo | 3979 } // namespace exo |
OLD | NEW |