[gtk+] [broadway] Wire up the delete event



commit 3b1fe05e78c319c236060ba4e0572c2f21267b5f
Author: Alexander Larsson <alexl redhat com>
Date:   Wed Apr 6 22:13:18 2011 +0200

    [broadway] Wire up the delete event

 gdk/broadway/broadway.js           |   13 +++++++++++++
 gdk/broadway/gdkdisplay-broadway.c |    5 ++++-
 gdk/broadway/gdkdisplay-broadway.h |    6 ++++++
 gdk/broadway/gdkeventsource.c      |   12 ++++++++++++
 4 files changed, 35 insertions(+), 1 deletions(-)
---
diff --git a/gdk/broadway/broadway.js b/gdk/broadway/broadway.js
index 0ce4b11..eba484c 100644
--- a/gdk/broadway/broadway.js
+++ b/gdk/broadway/broadway.js
@@ -275,15 +275,28 @@ function updateBrowserWindowGeometry(win) {
 	    }
 	}
     }
+}
+
+function browserWindowClosed(win) {
+    var surface = win.surface;
 
+    sendInput ("W", [surface.id]);
+    for (id in surfaces) {
+	if (surfaces[id].transientToplevel != null && surfaces[id].transientToplevel == surface) {
+	    var childSurface = surfaces[id];
+	    sendInput ("W", [childSurface.id]);
+	}
+    }
 }
 
+
 function registerWindow(win)
 {
     toplevelWindows.push(win);
     win.onresize = function(ev) { updateBrowserWindowGeometry(ev.target); };
     if (!windowGeometryTimeout)
 	windowGeometryTimeout = setInterval(function () { toplevelWindows.forEach(updateBrowserWindowGeometry); }, 2000);
+    win.onunload = function(ev) { browserWindowClosed(ev.target.defaultView); };
 }
 
 function unregisterWindow(win)
diff --git a/gdk/broadway/gdkdisplay-broadway.c b/gdk/broadway/gdkdisplay-broadway.c
index 3ed9a79..c781cf5 100644
--- a/gdk/broadway/gdkdisplay-broadway.c
+++ b/gdk/broadway/gdkdisplay-broadway.c
@@ -258,7 +258,10 @@ parse_input_message (BroadwayInput *input, const char *message)
     msg.configure_notify.width = strtol (p, &p, 10);
     p++; /* Skip , */
     msg.configure_notify.height = strtol (p, &p, 10);
-    p++; /* Skip , */
+    break;
+
+  case 'W':
+    msg.delete_notify.id = strtol(p, &p, 10);
     break;
 
   default:
diff --git a/gdk/broadway/gdkdisplay-broadway.h b/gdk/broadway/gdkdisplay-broadway.h
index 3e9be85..76d6810 100644
--- a/gdk/broadway/gdkdisplay-broadway.h
+++ b/gdk/broadway/gdkdisplay-broadway.h
@@ -96,6 +96,11 @@ typedef struct {
   int height;
 } BroadwayInputConfigureNotify;
 
+typedef struct {
+  BroadwayInputBaseMsg base;
+  int id;
+} BroadwayInputDeleteNotify;
+
 typedef union {
   BroadwayInputBaseMsg base;
   BroadwayInputPointerMsg pointer;
@@ -105,6 +110,7 @@ typedef union {
   BroadwayInputKeyMsg key;
   BroadwayInputGrabReply grab_reply;
   BroadwayInputConfigureNotify configure_notify;
+  BroadwayInputDeleteNotify delete_notify;
 } BroadwayInputMsg;
 
 struct _GdkBroadwayDisplay
diff --git a/gdk/broadway/gdkeventsource.c b/gdk/broadway/gdkeventsource.c
index a6e47c9..db870ac 100644
--- a/gdk/broadway/gdkeventsource.c
+++ b/gdk/broadway/gdkeventsource.c
@@ -294,6 +294,18 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
       }
     break;
 
+  case 'W':
+    window = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->delete_notify.id));
+    if (window)
+      {
+	event = gdk_event_new (GDK_DELETE);
+	event->any.window = g_object_ref (window);
+
+	node = _gdk_event_queue_append (display, event);
+	_gdk_windowing_got_event (display, node, event, message->base.serial);
+      }
+    break;
+
   default:
     g_printerr ("Unknown input command %c\n", message->base.type);
     break;



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