<commit_before>#include <X11/Xlib.h>
#include <X11/Xatom.h>

#include <Imlib2.h>
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
	Display *dpy = XOpenDisplay(NULL);
	int screen = DefaultScreen(dpy);
	Window root = RootWindow(dpy, screen);
	Visual *vis = DefaultVisual(dpy, screen);

	int screenDepth = DefaultDepth(dpy, screen);
	int screenWidth = DisplayWidth(dpy, screen);
	int screenHeight = DisplayHeight(dpy, screen);

	unsigned int offsetX = 0;
	unsigned int offsetY = 0;

	unsigned int i;
	for(i = 1; i < argc; i++) {
		int c = argv[i][1];

		switch(c) {
			case 'x':
				if(++i < argc)
					offsetX = -atoi(argv[i]);
				break;

			case 'y':
				if(++i < argc)
					offsetY = -atoi(argv[i]);
				break;
		}
	}

	Imlib_Image image = imlib_load_image(argv[argc - 1]);
	if(image)
	{
		Pixmap bg = XCreatePixmap(dpy, root, screenWidth, screenHeight, screenDepth);

		imlib_context_set_image(image);
		imlib_context_set_display(dpy);
		imlib_context_set_visual(vis);
		imlib_context_set_drawable(bg);

		imlib_render_image_on_drawable(offsetX, offsetY);

		// Ripped out of xsetroot.
		Atom atomRoot = XInternAtom(dpy, "_XROOTPMAP_ID", False);
		XChangeProperty(
			dpy, root, atomRoot,
			XA_PIXMAP, 32, PropModeReplace,
			(unsigned char *) &bg, 1
		);

		XKillClient(dpy, AllTemporary);
		XSetCloseDownMode(dpy, RetainPermanent);
		XClearWindow(dpy, root);
		XFlush(dpy);
		XSync(dpy, False);

		imlib_free_image();
	}

	return 0;
}<commit_msg>Set the X window background as well.<commit_after>#include <X11/Xlib.h>
#include <X11/Xatom.h>

#include <Imlib2.h>
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
	Display *dpy = XOpenDisplay(NULL);
	int screen = DefaultScreen(dpy);
	Window root = RootWindow(dpy, screen);
	Visual *vis = DefaultVisual(dpy, screen);

	int screenDepth = DefaultDepth(dpy, screen);
	int screenWidth = DisplayWidth(dpy, screen);
	int screenHeight = DisplayHeight(dpy, screen);

	unsigned int offsetX = 0;
	unsigned int offsetY = 0;

	unsigned int i;
	for(i = 1; i < argc; i++) {
		int c = argv[i][1];

		switch(c) {
			case 'x':
				if(++i < argc)
					offsetX = -atoi(argv[i]);
				break;

			case 'y':
				if(++i < argc)
					offsetY = -atoi(argv[i]);
				break;
		}
	}

	Imlib_Image image = imlib_load_image(argv[argc - 1]);
	if(image)
	{
		Pixmap bg = XCreatePixmap(dpy, root, screenWidth, screenHeight, screenDepth);

		imlib_context_set_image(image);
		imlib_context_set_display(dpy);
		imlib_context_set_visual(vis);
		imlib_context_set_drawable(bg);

		imlib_render_image_on_drawable(offsetX, offsetY);

		// Ripped out of xsetroot.
		Atom atomRoot = XInternAtom(dpy, "_XROOTPMAP_ID", False);
		XChangeProperty(
			dpy, root, atomRoot,
			XA_PIXMAP, 32, PropModeReplace,
			(unsigned char *) &bg, 1
		);

		XKillClient(dpy, AllTemporary);
		XSetCloseDownMode(dpy, RetainPermanent);

		XSetWindowBackgroundPixmap(dpy, root, bg);
		XClearWindow(dpy, root);

		XFlush(dpy);
		XSync(dpy, False);

		imlib_free_image();
	}

	return 0;
}
{'fraction_non_alphanumeric': 0.13955026455026456, 'fraction_numerical': 0.009259259259259259, 'mean_word_length': 4.297723292469352, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 13, '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': '26740', 'n_tokens_mistral': 1345, 'n_tokens_neox': 1179, 'n_words': 259}