<commit_before>/*
 * Copyright (c) 2014 multiple authors, see README for licence details 
 */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <X11/X.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include "dat.h"
#include "fns.h"

Client *clients;
Client *current;

void
setactive(Client *c, int on)
{
	if (c->parent == c->screen->root) {
		fprintf(stderr, "9wm: bad parent in setactive; dumping core\n");
		abort();
	}
	if (on) {
		XUngrabButton(dpy, AnyButton, AnyModifier, c->parent);
		XSetInputFocus(dpy, c->window, RevertToPointerRoot, timestamp());
		if (c->proto & Ptakefocus)
			sendcmessage(c->window, wm_protocols, wm_take_focus, 0);
		cmapfocus(c);
	} else<commit_msg>client.c: Don't crash if window parent is root window<commit_after>/*
 * Copyright (c) 2014 multiple authors, see README for licence details 
 */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <X11/X.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include "dat.h"
#include "fns.h"

Client *clients;
Client *current;

void
setactive(Client *c, int on)
{
	if (c->parent == c->screen->root) {
		return;
	}
	if (on) {
		XUngrabButton(dpy, AnyButton, AnyModifier, c->parent);
		XSetInputFocus(dpy, c->window, RevertToPointerRoot, timestamp());
		if (c->proto & Ptakefocus)
			sendcmessage(c->window, wm_protocols, wm_take_focus, 0);
		cmapfocus(c);
	} else
{'fraction_non_alphanumeric': 0.16448326055312956, 'fraction_numerical': 0.016739446870451237, 'mean_word_length': 4.7531380753138075, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6280238', 'n_tokens_mistral': 579, 'n_tokens_neox': 543, 'n_words': 133}