diff --git a/lib/modules/Protocols.pmod/X.pmod/Types.pmod b/lib/modules/Protocols.pmod/X.pmod/Types.pmod index e70cf700dbb52165bbd4cbd50a7d2ef4d337329a..2734d0b1585abb68abfbd597d2c82645be65453a 100644 --- a/lib/modules/Protocols.pmod/X.pmod/Types.pmod +++ b/lib/modules/Protocols.pmod/X.pmod/Types.pmod @@ -234,7 +234,7 @@ class Window object visual, colortable, parent; int currentInputMask; - mapping(string:function) event_callbacks = ([ ]); + mapping(string:array(function)) event_callbacks = ([ ]); int alt_gr, num_lock, shift, control, caps_lock; int meta, alt, super, hyper; @@ -484,15 +484,18 @@ class Window void set_event_callback(string type, function f) { - event_callbacks[type] = f; + event_callbacks[type] = (event_callbacks[type] || ({ }) ) + + ({ f }); } +#if 0 function remove_event_callback(string type) { function f = event_callbacks[type]; m_delete(event_callbacks, type); } - +#endif + object SelectInput_req() { object req = Requests.ChangeWindowAttributes(); @@ -528,6 +531,24 @@ class Window return currentInputMask; } + object GrabButton_req(int button, int modifiers, array(string) types) + { + object req = Requests.GrabButton(); + req->ownerEvents = 1; + req->grabWindow = id; + req->eventMask = event_mask_to_int(types); + req->button = button; + req->modifiers = modifiers || 0x8000; + + return req; + } + + void GrabButton(int button, int modifiers, string ... types) + { + object req = GrabButton_req(button, modifiers, types); + display->send_request(req); + } + object Map_req() { object req = Requests.MapWindow();