Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(224)

Unified Diff: components/exo/wayland/server.cc

Issue 2065133002: exo: Implement notification surface support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@notification-wayland-protocol
Patch Set: fix compile Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/exo/notification_surface_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/exo/wayland/server.cc
diff --git a/components/exo/wayland/server.cc b/components/exo/wayland/server.cc
index 2622c6d8689bc36015a90a2ff4a5d83c581eb725..165444cc42f50af11eead08b2c9ac74d285ba056 100644
--- a/components/exo/wayland/server.cc
+++ b/components/exo/wayland/server.cc
@@ -43,6 +43,8 @@
#include "components/exo/display.h"
#include "components/exo/keyboard.h"
#include "components/exo/keyboard_delegate.h"
+#include "components/exo/notification_surface.h"
+#include "components/exo/notification_surface_manager.h"
#include "components/exo/pointer.h"
#include "components/exo/pointer_delegate.h"
#include "components/exo/shared_memory.h"
@@ -1512,6 +1514,16 @@ const struct zwp_remote_surface_v1_interface remote_surface_implementation = {
remote_surface_set_top_inset};
////////////////////////////////////////////////////////////////////////////////
+// notification_surface_interface:
+
+void notification_surface_destroy(wl_client* client, wl_resource* resource) {
+ wl_resource_destroy(resource);
+}
+
+const struct zwp_notification_surface_v1_interface
+ notification_surface_implementation = {notification_surface_destroy};
+
+////////////////////////////////////////////////////////////////////////////////
// remote_shell_interface:
// Implements remote shell interface and monitors workspace state needed
@@ -1544,6 +1556,12 @@ class WaylandRemoteShell : public ash::ShellObserver,
return display_->CreateRemoteShellSurface(surface, container);
}
+ std::unique_ptr<NotificationSurface> CreateNotificationSurface(
+ Surface* surface,
+ const std::string& notification_id) {
+ return display_->CreateNotificationSurface(surface, notification_id);
+ }
+
// Overridden from display::DisplayObserver:
void OnDisplayAdded(const display::Display& new_display) override {}
void OnDisplayRemoved(const display::Display& new_display) override {}
@@ -1719,10 +1737,40 @@ void remote_shell_get_remote_surface(wl_client* client,
std::move(shell_surface));
}
+void remote_shell_get_notification_surface(wl_client* client,
+ wl_resource* resource,
+ uint32_t id,
+ wl_resource* surface,
+ const char* notification_id) {
+ if (GetUserDataAs<Surface>(surface)->HasSurfaceDelegate()) {
+ wl_resource_post_error(resource, ZWP_REMOTE_SHELL_V1_ERROR_ROLE,
+ "surface has already been assigned a role");
+ return;
+ }
+
+ std::unique_ptr<NotificationSurface> notification_surface =
+ GetUserDataAs<WaylandRemoteShell>(resource)->CreateNotificationSurface(
+ GetUserDataAs<Surface>(surface), std::string(notification_id));
+ if (!notification_surface) {
+ wl_resource_post_error(resource,
+ ZWP_REMOTE_SHELL_V1_ERROR_INVALID_NOTIFICATION_ID,
+ "invalid notification id");
+ return;
+ }
+
+ wl_resource* notification_surface_resource =
+ wl_resource_create(client, &zwp_notification_surface_v1_interface,
+ wl_resource_get_version(resource), id);
+ SetImplementation(notification_surface_resource,
+ &notification_surface_implementation,
+ std::move(notification_surface));
+}
+
const struct zwp_remote_shell_v1_interface remote_shell_implementation = {
- remote_shell_destroy, remote_shell_get_remote_surface};
+ remote_shell_destroy, remote_shell_get_remote_surface,
+ remote_shell_get_notification_surface};
-const uint32_t remote_shell_version = 5;
+const uint32_t remote_shell_version = 6;
void bind_remote_shell(wl_client* client,
void* data,
« no previous file with comments | « components/exo/notification_surface_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698