public void Dispose() { window.RemoveFilter(FilterFunction); IntPtr xid = gdk_x11_drawable_get_xid(gdk_get_default_root_window()); IntPtr xdisplay = gdk_x11_get_default_xdisplay(); for (var i = 0; i < keycodes.Count; i++) { gdk_error_trap_push(); foreach (var mask in Combine(XModMask.Mod2, XModMask.Mod3, XModMask.Mod4, XModMask.Mod5, XModMask.Lock)) { XUngrabKey(xdisplay, keycodes[i], modifiers[i] | mask, xid); } gdk_flush(); if (gdk_error_trap_pop() != 0) { Console.Error.WriteLine("MMKeys: Could not ungrab key {0} (maybe another application has grabbed this key)", keycodes[i]); } } }