+ /* Wheel buttons don't draw because they are an instant click, so it
+ is a waste of resources to go drawing it. */
+ if (!(e->xbutton.button == 4 || e->xbutton.button == 5)) {
+ con = frame_context(client, e->xbutton.window);
+ con = mouse_button_frame_context(con, e->xbutton.button);
+ switch (con) {
+ case OB_FRAME_CONTEXT_MAXIMIZE:
+ client->frame->max_press = (e->type == ButtonPress);
+ framerender_frame(client->frame);
+ break;
+ case OB_FRAME_CONTEXT_CLOSE:
+ client->frame->close_press = (e->type == ButtonPress);
+ framerender_frame(client->frame);
+ break;
+ case OB_FRAME_CONTEXT_ICONIFY:
+ client->frame->iconify_press = (e->type == ButtonPress);
+ framerender_frame(client->frame);
+ break;
+ case OB_FRAME_CONTEXT_ALLDESKTOPS:
+ client->frame->desk_press = (e->type == ButtonPress);
+ framerender_frame(client->frame);
+ break;
+ case OB_FRAME_CONTEXT_SHADE:
+ client->frame->shade_press = (e->type == ButtonPress);
+ framerender_frame(client->frame);
+ break;
+ default:
+ /* nothing changes with clicks for any other contexts */
+ break;
+ }
+ }
+ break;
+ case FocusIn:
+#ifdef DEBUG_FOCUS
+ ob_debug("FocusIn on client for %lx (client %lx) mode %d detail %d\n",
+ e->xfocus.window, client->window,
+ e->xfocus.mode, e->xfocus.detail);
+#endif
+ if (client != focus_client) {
+ focus_set_client(client);
+ frame_adjust_focus(client->frame, TRUE);
+ client_calc_layer(client);
+ }
+ break;
+ case FocusOut:
+#ifdef DEBUG_FOCUS
+ ob_debug("FocusOut on client for %lx (client %lx) mode %d detail %d\n",
+ e->xfocus.window, client->window,
+ e->xfocus.mode, e->xfocus.detail);
+#endif
+ focus_hilite = NULL;
+ frame_adjust_focus(client->frame, FALSE);
+ client_calc_layer(client);
+ break;
+ case LeaveNotify:
+ con = frame_context(client, e->xcrossing.window);
+ switch (con) {
+ case OB_FRAME_CONTEXT_MAXIMIZE:
+ client->frame->max_hover = FALSE;
+ frame_adjust_state(client->frame);
+ break;
+ case OB_FRAME_CONTEXT_ALLDESKTOPS:
+ client->frame->desk_hover = FALSE;
+ frame_adjust_state(client->frame);
+ break;
+ case OB_FRAME_CONTEXT_SHADE:
+ client->frame->shade_hover = FALSE;
+ frame_adjust_state(client->frame);