| 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 <linux/input.h> | 7 #include <linux/input.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 #include <wayland-server-core.h> | 10 #include <wayland-server-core.h> |
| (...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 631 | 631 |
| 632 void shell_surface_resize(wl_client* client, | 632 void shell_surface_resize(wl_client* client, |
| 633 wl_resource* resource, | 633 wl_resource* resource, |
| 634 wl_resource* seat_resource, | 634 wl_resource* seat_resource, |
| 635 uint32_t serial, | 635 uint32_t serial, |
| 636 uint32_t edges) { | 636 uint32_t edges) { |
| 637 NOTIMPLEMENTED(); | 637 NOTIMPLEMENTED(); |
| 638 } | 638 } |
| 639 | 639 |
| 640 void shell_surface_set_toplevel(wl_client* client, wl_resource* resource) { | 640 void shell_surface_set_toplevel(wl_client* client, wl_resource* resource) { |
| 641 GetUserDataAs<ShellSurface>(resource)->Init(); | 641 GetUserDataAs<ShellSurface>(resource)->SetEnabled(true); |
| 642 } | 642 } |
| 643 | 643 |
| 644 void shell_surface_set_transient(wl_client* client, | 644 void shell_surface_set_transient(wl_client* client, |
| 645 wl_resource* resource, | 645 wl_resource* resource, |
| 646 wl_resource* parent_resource, | 646 wl_resource* parent_resource, |
| 647 int x, | 647 int x, |
| 648 int y, | 648 int y, |
| 649 uint32_t flags) { | 649 uint32_t flags) { |
| 650 NOTIMPLEMENTED(); | 650 NOTIMPLEMENTED(); |
| 651 } | 651 } |
| 652 | 652 |
| 653 void shell_surface_set_fullscreen(wl_client* client, | 653 void shell_surface_set_fullscreen(wl_client* client, |
| 654 wl_resource* resource, | 654 wl_resource* resource, |
| 655 uint32_t method, | 655 uint32_t method, |
| 656 uint32_t framerate, | 656 uint32_t framerate, |
| 657 wl_resource* output_resource) { | 657 wl_resource* output_resource) { |
| 658 GetUserDataAs<ShellSurface>(resource)->Init(); | 658 GetUserDataAs<ShellSurface>(resource)->SetEnabled(true); |
| 659 GetUserDataAs<ShellSurface>(resource)->SetFullscreen(true); | 659 GetUserDataAs<ShellSurface>(resource)->SetFullscreen(true); |
| 660 } | 660 } |
| 661 | 661 |
| 662 void shell_surface_set_popup(wl_client* client, | 662 void shell_surface_set_popup(wl_client* client, |
| 663 wl_resource* resource, | 663 wl_resource* resource, |
| 664 wl_resource* seat_resource, | 664 wl_resource* seat_resource, |
| 665 uint32_t serial, | 665 uint32_t serial, |
| 666 wl_resource* parent_resource, | 666 wl_resource* parent_resource, |
| 667 int32_t x, | 667 int32_t x, |
| 668 int32_t y, | 668 int32_t y, |
| 669 uint32_t flags) { | 669 uint32_t flags) { |
| 670 NOTIMPLEMENTED(); | 670 NOTIMPLEMENTED(); |
| 671 } | 671 } |
| 672 | 672 |
| 673 void shell_surface_set_maximized(wl_client* client, | 673 void shell_surface_set_maximized(wl_client* client, |
| 674 wl_resource* resource, | 674 wl_resource* resource, |
| 675 wl_resource* output_resource) { | 675 wl_resource* output_resource) { |
| 676 GetUserDataAs<ShellSurface>(resource)->Init(); | 676 GetUserDataAs<ShellSurface>(resource)->SetEnabled(true); |
| 677 GetUserDataAs<ShellSurface>(resource)->Maximize(); | 677 GetUserDataAs<ShellSurface>(resource)->Maximize(); |
| 678 } | 678 } |
| 679 | 679 |
| 680 void shell_surface_set_title(wl_client* client, | 680 void shell_surface_set_title(wl_client* client, |
| 681 wl_resource* resource, | 681 wl_resource* resource, |
| 682 const char* title) { | 682 const char* title) { |
| 683 GetUserDataAs<ShellSurface>(resource) | 683 GetUserDataAs<ShellSurface>(resource) |
| 684 ->SetTitle(base::string16(base::UTF8ToUTF16(title))); | 684 ->SetTitle(base::string16(base::UTF8ToUTF16(title))); |
| 685 } | 685 } |
| 686 | 686 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 return; | 718 return; |
| 719 } | 719 } |
| 720 | 720 |
| 721 wl_resource* shell_surface_resource = | 721 wl_resource* shell_surface_resource = |
| 722 wl_resource_create(client, &wl_shell_surface_interface, 1, id); | 722 wl_resource_create(client, &wl_shell_surface_interface, 1, id); |
| 723 if (!shell_surface_resource) { | 723 if (!shell_surface_resource) { |
| 724 wl_resource_post_no_memory(resource); | 724 wl_resource_post_no_memory(resource); |
| 725 return; | 725 return; |
| 726 } | 726 } |
| 727 | 727 |
| 728 // Shell surfaces are initially disabled and needs to be explicitly mapped |
| 729 // before they are enabled and can become visible. |
| 730 shell_surface->SetEnabled(false); |
| 731 |
| 728 shell_surface->set_surface_destroyed_callback(base::Bind( | 732 shell_surface->set_surface_destroyed_callback(base::Bind( |
| 729 &wl_resource_destroy, base::Unretained(shell_surface_resource))); | 733 &wl_resource_destroy, base::Unretained(shell_surface_resource))); |
| 730 | 734 |
| 731 shell_surface->set_configure_callback( | 735 shell_surface->set_configure_callback( |
| 732 base::Bind(&HandleShellSurfaceConfigureCallback, | 736 base::Bind(&HandleShellSurfaceConfigureCallback, |
| 733 base::Unretained(shell_surface_resource))); | 737 base::Unretained(shell_surface_resource))); |
| 734 | 738 |
| 735 SetImplementation(shell_surface_resource, &shell_surface_implementation, | 739 SetImplementation(shell_surface_resource, &shell_surface_implementation, |
| 736 std::move(shell_surface)); | 740 std::move(shell_surface)); |
| 737 } | 741 } |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 945 return; | 949 return; |
| 946 } | 950 } |
| 947 | 951 |
| 948 wl_resource* xdg_surface_resource = | 952 wl_resource* xdg_surface_resource = |
| 949 wl_resource_create(client, &xdg_surface_interface, 1, id); | 953 wl_resource_create(client, &xdg_surface_interface, 1, id); |
| 950 if (!xdg_surface_resource) { | 954 if (!xdg_surface_resource) { |
| 951 wl_resource_post_no_memory(resource); | 955 wl_resource_post_no_memory(resource); |
| 952 return; | 956 return; |
| 953 } | 957 } |
| 954 | 958 |
| 955 // An XdgSurface is a toplevel shell surface. | |
| 956 shell_surface->Init(); | |
| 957 | |
| 958 shell_surface->set_close_callback(base::Bind( | 959 shell_surface->set_close_callback(base::Bind( |
| 959 &xdg_surface_send_close, base::Unretained(xdg_surface_resource))); | 960 &xdg_surface_send_close, base::Unretained(xdg_surface_resource))); |
| 960 | 961 |
| 961 shell_surface->set_configure_callback( | 962 shell_surface->set_configure_callback( |
| 962 base::Bind(&HandleXdgSurfaceConfigureCallback, | 963 base::Bind(&HandleXdgSurfaceConfigureCallback, |
| 963 base::Unretained(xdg_surface_resource))); | 964 base::Unretained(xdg_surface_resource))); |
| 964 | 965 |
| 965 SetImplementation(xdg_surface_resource, &xdg_surface_implementation, | 966 SetImplementation(xdg_surface_resource, &xdg_surface_implementation, |
| 966 std::move(shell_surface)); | 967 std::move(shell_surface)); |
| 967 } | 968 } |
| (...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1539 DCHECK(event_loop); | 1540 DCHECK(event_loop); |
| 1540 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); | 1541 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); |
| 1541 } | 1542 } |
| 1542 | 1543 |
| 1543 void Server::Flush() { | 1544 void Server::Flush() { |
| 1544 wl_display_flush_clients(wl_display_.get()); | 1545 wl_display_flush_clients(wl_display_.get()); |
| 1545 } | 1546 } |
| 1546 | 1547 |
| 1547 } // namespace wayland | 1548 } // namespace wayland |
| 1548 } // namespace exo | 1549 } // namespace exo |
| OLD | NEW |