#include <float.h>
#include <sys/time.h>
#include <xcb/randr.h>
-#include <X11/XKBlib.h>
#define SN_API_NOT_YET_FROZEN 1
#include <libsn/sn-monitor.h>
ungrab_all_keys(conn);
translate_keysyms();
- grab_all_keys(conn, false);
+ grab_all_keys(conn);
return;
}
uint32_t rnd = event->data.data32[1];
DLOG("[i3 sync protocol] Sending random value %d back to X11 window 0x%08x\n", rnd, window);
- void *reply = scalloc(32);
+ void *reply = scalloc(32, 1);
xcb_client_message_event_t *ev = reply;
ev->response_type = XCB_CLIENT_MESSAGE;
*
*/
void handle_event(int type, xcb_generic_event_t *event) {
- DLOG("event type %d, xkb_base %d\n", type, xkb_base);
+ if (type != XCB_MOTION_NOTIFY)
+ DLOG("event type %d, xkb_base %d\n", type, xkb_base);
+
if (randr_base > -1 &&
type == randr_base + XCB_RANDR_SCREEN_CHANGE_NOTIFY) {
handle_screen_change(event);
keysyms = xcb_key_symbols_alloc(conn);
ungrab_all_keys(conn);
translate_keysyms();
- grab_all_keys(conn, false);
+ grab_all_keys(conn);
+ if (((xcb_xkb_new_keyboard_notify_event_t *)event)->changed & XCB_XKB_NKN_DETAIL_KEYCODES)
+ (void)load_keymap();
} else if (state->xkbType == XCB_XKB_MAP_NOTIFY) {
if (event_is_ignored(event->sequence, type)) {
DLOG("Ignoring map notify event for sequence %d.\n", state->sequence);
keysyms = xcb_key_symbols_alloc(conn);
ungrab_all_keys(conn);
translate_keysyms();
- grab_all_keys(conn, false);
+ grab_all_keys(conn);
+ (void)load_keymap();
}
} else if (state->xkbType == XCB_XKB_STATE_NOTIFY) {
DLOG("xkb state group = %d\n", state->group);
-
- /* See The XKB Extension: Library Specification, section 14.1 */
- /* We check if the current group (each group contains
- * two levels) has been changed. Mode_switch activates
- * group XCB_XKB_GROUP_2 */
if (xkb_current_group == state->group)
return;
xkb_current_group = state->group;
- if (state->group == XCB_XKB_GROUP_1) {
- DLOG("Mode_switch disabled\n");
- ungrab_all_keys(conn);
- grab_all_keys(conn, false);
- } else {
- DLOG("Mode_switch enabled\n");
- grab_all_keys(conn, true);
- }
+ ungrab_all_keys(conn);
+ grab_all_keys(conn);
}
return;