Skip to content
Snippets Groups Projects
Commit 5603491b authored by Niels Möller's avatar Niels Möller
Browse files

* Types.pmod (Window->event_callbacks): Use an array of handlers

for each event-type.
(Window->GrabButton): New function.

Rev: lib/modules/Protocols.pmod/X.pmod/Types.pmod:1.12
parent 4765eea6
No related branches found
No related tags found
No related merge requests found
......@@ -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,14 +484,17 @@ 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()
{
......@@ -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();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment