void mapnotify(XEvent* event) { Client* c; if ((c = get_client_from_window(event->xmap.window))) { // reset focus. so a new window gets the focus if it shall have the input focus frame_focus_recursive(g_cur_frame); // also update the window title - just to be sure client_update_title(c); } }
int load_command(int argc, char** argv, GString* output) { // usage: load TAG LAYOUT HSTag* tag = NULL; if (argc < 2) { return HERBST_NEED_MORE_ARGS; } char* layout_string = argv[1]; if (argc >= 3) { tag = find_tag(argv[1]); layout_string = argv[2]; if (!tag) { g_string_append_printf(output, "%s: Tag \"%s\" not found\n", argv[0], argv[1]); return HERBST_INVALID_ARGUMENT; } } else { // use current tag HSMonitor* m = get_current_monitor(); tag = m->tag; } assert(tag != NULL); char* rest = load_frame_tree(tag->frame, layout_string, output); if (output->len > 0) { g_string_prepend(output, "load: "); } tag_set_flags_dirty(); // we probably changed some window positions // arrange monitor HSMonitor* m = find_monitor_with_tag(tag); if (m) { frame_show_recursive(tag->frame); if (get_current_monitor() == m) { frame_focus_recursive(tag->frame); } monitor_apply_layout(m); } else { frame_hide_recursive(tag->frame); } if (!rest) { g_string_append_printf(output, "%s: Error while parsing!\n", argv[0]); return HERBST_INVALID_ARGUMENT; } if (rest[0] != '\0') { // if string was not parsed completely g_string_append_printf(output, "%s: Layout description was too long\n", argv[0]); g_string_append_printf(output, "%s: \"%s\" has not been parsed\n", argv[0], rest); return HERBST_INVALID_ARGUMENT; } return 0; }