diff --git a/lib/x11/ext/apple-wm.js b/lib/x11/ext/apple-wm.js index 364f5e2..6e6db66 100644 --- a/lib/x11/ext/apple-wm.js +++ b/lib/x11/ext/apple-wm.js @@ -182,8 +182,19 @@ exports.requireExt = function(display, callback) X.pack_stream.flush(); } -// https://developer.apple.com/library/mac/documentation/Carbon/Reference/Process_Manager/Reference/reference.html#//apple_ref/doc/c_ref/ProcessSerialNumber + // shortcut is single-byte ASCII (optional, 0=no shortcut) + // items example: [ 'item1', 'some item', ['C', 'item with C shortcut'] ] + ext.SetWindowMenu = function(items) + { + var reqlen = 8; + var extlength = 0; + items.forEach(function(i) { + + }); + } + // https://developer.apple.com + // /library/mac/documentation/Carbon/Reference/Process_Manager/Reference/reference.html#//apple_ref/doc/c_ref/ProcessSerialNumber ext.SendPSN = function(hi, lo) { X.seq_num++; @@ -207,5 +218,53 @@ exports.requireExt = function(display, callback) callback(ext); }); */ + + ext.events = { + AppleWMControllerNotify: 0, + AppleWMActivationNotify: 1, + AppleWMPasteboardNotify: 2, + } + + ext.EventKind = { + Controller: { + MinimizeWindow: 0, + ZoomWindow: 1, + CloseWindow: 2, + BringAllToFront: 3, + WideWindow: 4, + HideAll: 5, + ShowAll: 6, + WindowMenuItem: 9, + WindowMenuNotify: 10, + NextWindow: 11, + PreviousWindow: 12 + }, + Activation: { + IsActive: 0, + IsInactive:1, + ReloadPreferences: 2 + }, + Pasteboard: { + CopyToPasteboard: 0 + } + }; + + X.eventParsers[ext.firstEvent + ext.events.AppleWMControllerNotify] = + X.eventParsers[ext.firstEvent + ext.events.AppleWMActivationNotify] = + X.eventParsers[ext.firstEvent + ext.events.AppleWMPasteboardNotify] = function(type, seq, extra, code, raw) + { + var event = {}; + switch(type) { + case ext.firstEvent + ext.events.AppleWMControllerNotify: event.name = 'AppleWMControllerNotify'; break; + case ext.firstEvent + ext.events.AppleWMActivationNotify: event.name = 'AppleWMActivationNotify'; break; + case ext.firstEvent + ext.events.AppleWMPasteboardNotify: event.name = 'AppleWMPasteboardNotify'; break; + } + event.type = code; + event.time = extra; + event.arg = raw.unpack('xxL')[0]; + return event; + }; + + }); }