[broadway] Wire up the delete event

This commit is contained in:
Alexander Larsson 2011-04-06 22:13:18 +02:00
parent 06fc6e007e
commit 3b1fe05e78
4 changed files with 36 additions and 2 deletions

View File

@ -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)

View File

@ -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:

View File

@ -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

View File

@ -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;