*
*/
int handle_motion_notify(void *ignored, xcb_connection_t *conn, xcb_motion_notify_event_t *event) {
- LOG("pointer motion notify, getting screen at %d x %d\n", event->root_x, event->root_y);
+ /* Skip events where the pointer was over a child window, we are only
+ * interested in events on the root window. */
+ if (event->child != 0)
+ return 1;
check_crossing_screen_boundary(event->root_x, event->root_y);
*
*/
int handle_mapping_notify(void *ignored, xcb_connection_t *conn, xcb_mapping_notify_event_t *event) {
- LOG("\n\nmapping notify\n\n");
-
if (event->request != XCB_MAPPING_KEYBOARD &&
event->request != XCB_MAPPING_MODIFIER)
return 0;
+ LOG("Received mapping_notify for keyboard or modifier mapping, re-grabbing keys\n");
xcb_refresh_keyboard_mapping(keysyms, event);
xcb_get_numlock_mask(conn);
ungrab_all_keys(conn);
- LOG("Re-grabbing...\n");
grab_all_keys(conn);
- LOG("Done\n");
return 0;
}
}
int handle_button_press(void *ignored, xcb_connection_t *conn, xcb_button_press_event_t *event) {
- LOG("button press!\n");
- LOG("state = %d\n", event->state);
+ LOG("Button %d pressed\n", event->state);
/* This was either a focus for a client’s parent (= titlebar)… */
Client *client = table_get(&by_child, event->event);
bool border_click = false;
*
*/
int handle_configure_request(void *prophs, xcb_connection_t *conn, xcb_configure_request_event_t *event) {
- LOG("configure-request, serial %d\n", event->sequence);
- LOG("event->window = %08x\n", event->window);
- LOG("application wants to be at %dx%d with %dx%d\n", event->x, event->y, event->width, event->height);
+ LOG("window 0x%08x wants to be at %dx%d with %dx%d\n",
+ event->window, event->x, event->y, event->width, event->height);
Client *client = table_get(&by_child, event->window);
if (client == NULL) {
- LOG("This client is not mapped, so we don't care and just tell the client that he will get its size\n");
uint32_t mask = 0;
uint32_t values[7];
int c = 0;
int handle_configure_event(void *prophs, xcb_connection_t *conn, xcb_configure_notify_event_t *event) {
xcb_window_t root = xcb_setup_roots_iterator(xcb_get_setup(conn)).data->root;
- LOG("handle_configure_event for window %08x\n", event->window);
- LOG("event->type = %d, \n", event->response_type);
LOG("event->x = %d, ->y = %d, ->width = %d, ->height = %d\n", event->x, event->y, event->width, event->height);
/* We ignore this sequence twice because events for child and frame should be ignored */
break;
}
- if (workspace_empty) {
- LOG("setting ws to NULL for workspace %d (%p)\n", client->workspace->num,
- client->workspace);
+ if (workspace_empty)
client->workspace->screen = NULL;
- }
FREE(client->window_class);
FREE(client->name);
*/
int handle_windowname_change(void *data, xcb_connection_t *conn, uint8_t state,
xcb_window_t window, xcb_atom_t atom, xcb_get_property_reply_t *prop) {
- LOG("window's name changed.\n");
if (prop == NULL || xcb_get_property_value_length(prop) == 0) {
LOG("_NET_WM_NAME not specified, not changing\n");
return 1;
asprintf(&new_name, "%.*s", xcb_get_property_value_length(prop), (char*)xcb_get_property_value(prop));
/* Convert it to UCS-2 here for not having to convert it later every time we want to pass it to X */
char *ucs2_name = convert_utf8_to_ucs2(new_name, &new_len);
- LOG("Name should change to \"%s\"\n", new_name);
+ LOG("_NET_WM_NAME changed to \"%s\"\n", new_name);
free(new_name);
/* Check if they are the same and don’t update if so.
if ((new_len == client->name_len) &&
(client->name != NULL) &&
(memcmp(client->name, ucs2_name, new_len * 2) == 0)) {
- LOG("Name did not change, not updating\n");
free(ucs2_name);
return 1;
}
*/
int handle_windowname_change_legacy(void *data, xcb_connection_t *conn, uint8_t state,
xcb_window_t window, xcb_atom_t atom, xcb_get_property_reply_t *prop) {
- LOG("window's name changed (legacy).\n");
if (prop == NULL || xcb_get_property_value_length(prop) == 0) {
LOG("prop == NULL\n");
return 1;
if (client == NULL)
return 1;
- if (client->uses_net_wm_name) {
- LOG("This client is capable of _NET_WM_NAME, ignoring legacy name\n");
+ /* Client capable of _NET_WM_NAME, ignore legacy name changes */
+ if (client->uses_net_wm_name)
return 1;
- }
/* Save the old pointer to make the update atomic */
char *new_name;
return 1;
}
/* Convert it to UCS-2 here for not having to convert it later every time we want to pass it to X */
- LOG("Name should change to \"%s\"\n", new_name);
+ LOG("WM_NAME changed to \"%s\"\n", new_name);
/* Check if they are the same and don’t update if so. */
if (client->name != NULL &&
strlen(new_name) == strlen(client->name) &&
strcmp(client->name, new_name) == 0) {
- LOG("Name did not change, not updating\n");
free(new_name);
return 1;
}
- LOG("Using legacy window title. Note that in order to get Unicode window titles in i3,"
+ LOG("Using legacy window title. Note that in order to get Unicode window titles in i3, "
"the application has to set _NET_WM_NAME which is in UTF-8 encoding.\n");
char *old_name = client->name;
*/
int handle_windowclass_change(void *data, xcb_connection_t *conn, uint8_t state,
xcb_window_t window, xcb_atom_t atom, xcb_get_property_reply_t *prop) {
- LOG("window class changed\n");
if (prop == NULL || xcb_get_property_value_length(prop) == 0) {
LOG("prop == NULL\n");
return 1;
return 1;
}
- LOG("changed to %s\n", new_class);
+ LOG("WM_CLASS changed to %s\n", new_class);
char *old_class = client->window_class;
client->window_class = new_class;
FREE(old_class);
return 1;
}
- LOG("got client %s\n", client->name);
- if (client->dock) {
- LOG("this is a dock\n");
+ if (client->dock)
return 1;
- }
if (client->container == NULL || client->container->mode != MODE_STACK)
decorate_window(conn, client, client->frame, client->titlegc, 0);
*
*/
int handle_client_message(void *data, xcb_connection_t *conn, xcb_client_message_event_t *event) {
- LOG("client_message\n");
-
if (event->type == atoms[_NET_WM_STATE]) {
if (event->format != 32 || event->data.data32[1] != atoms[_NET_WM_STATE_FULLSCREEN])
return 0;
- LOG("fullscreen\n");
-
Client *client = table_get(&by_child, event->window);
if (client == NULL)
return 0;
return 1;
}
xcb_size_hints_t size_hints;
- LOG("client is %08x / child %08x\n", client->frame, client->child);
+
+ client_log(client);
/* If the hints were already in this event, use them, if not, request them */
if (reply != NULL)
return 1;
}
- LOG("window is %08x / %s\n", client->child, client->name);
-
int base_width = 0, base_height = 0;
/* base_width/height are the desired size of the window.
*/
int handle_transient_for(void *data, xcb_connection_t *conn, uint8_t state, xcb_window_t window,
xcb_atom_t name, xcb_get_property_reply_t *reply) {
- LOG("Transient hint!\n");
Client *client = table_get(&by_child, window);
if (client == NULL) {
LOG("No such client\n");
xcb_window_t transient_for;
if (reply != NULL) {
- if (!xcb_get_wm_transient_for_from_reply(&transient_for, reply)) {
- LOG("Not transient for any window\n");
+ if (!xcb_get_wm_transient_for_from_reply(&transient_for, reply))
return 1;
- }
} else {
if (!xcb_get_wm_transient_for_reply(conn, xcb_get_wm_transient_for_unchecked(conn, window),
- &transient_for, NULL)) {
- LOG("Not transient for any window\n");
+ &transient_for, NULL))
return 1;
- }
}
if (client->floating == FLOATING_AUTO_OFF) {
*/
int handle_clientleader_change(void *data, xcb_connection_t *conn, uint8_t state, xcb_window_t window,
xcb_atom_t name, xcb_get_property_reply_t *prop) {
- LOG("client leader changed\n");
if (prop == NULL) {
prop = xcb_get_property_reply(conn, xcb_get_property_unchecked(conn,
false, window, WM_CLIENT_LEADER, WINDOW, 0, 32), NULL);
if (leader == NULL)
return 1;
- LOG("changed to %08x\n", *leader);
+ LOG("Client leader changed to %08x\n", *leader);
client->leader = *leader;