[gtk+] wayland: Add support for delete event



commit c52e710dc834e42ff2fe46cd7fb2e81e25f8f4ac
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Fri Feb 7 17:16:40 2014 -0500

    wayland: Add support for delete event

 gdk/wayland/gdkwindow-wayland.c    |   19 +++++++++++++++++++
 gdk/wayland/protocol/xdg-shell.xml |   13 +++++++++++++
 2 files changed, 32 insertions(+), 0 deletions(-)
---
diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c
index b6346dd..6d80527 100644
--- a/gdk/wayland/gdkwindow-wayland.c
+++ b/gdk/wayland/gdkwindow-wayland.c
@@ -1005,6 +1005,24 @@ xdg_surface_focused_unset (void *data,
   gdk_synthesize_window_state (window, GDK_WINDOW_STATE_FOCUSED, 0);
 }
 
+static void
+xdg_surface_delete (void *data,
+                    struct xdg_surface *xdg_surface)
+{
+  GdkWindow *window = GDK_WINDOW (data);
+  GdkDisplay *display;
+  GdkEvent *event;
+
+  display = gdk_window_get_display (window);
+
+  event = gdk_event_new (GDK_DELETE);
+
+  event->any.window = window;
+  event->any.send_event = TRUE;
+
+  _gdk_wayland_display_deliver_event (display, event);
+}
+
 static const struct xdg_surface_listener xdg_surface_listener = {
   xdg_surface_ping,
   xdg_surface_configure,
@@ -1014,6 +1032,7 @@ static const struct xdg_surface_listener xdg_surface_listener = {
   xdg_surface_request_unset_maximized,
   xdg_surface_focused_set,
   xdg_surface_focused_unset,
+  xdg_surface_delete,
 };
 
 static void
diff --git a/gdk/wayland/protocol/xdg-shell.xml b/gdk/wayland/protocol/xdg-shell.xml
index 851b2ce..5c21f4e 100644
--- a/gdk/wayland/protocol/xdg-shell.xml
+++ b/gdk/wayland/protocol/xdg-shell.xml
@@ -373,6 +373,19 @@
        decorations should be updated accordingly.
       </description>
     </event>
+
+    <event name="delete">
+      <description summary="surface wants to be closed">
+        The delete event is sent by the compositor when the user
+        wants the surface to be closed. This should be equivalent to
+        the user clicking the close button in client-side decorations,
+        if your application has any...
+
+        This is only a request that the user intends to close your
+        window. The client may choose to ignore this request, or show
+        a dialog to ask the user to save their data...
+      </description>
+    </event>
   </interface>
 
   <interface name="xdg_popup" version="1">


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]