<commit_before>/*
 * vim:ts=8:expandtab
 *
 * i3 - an improved dynamic tiling window manager
 *
 * © 2009 <NAME> and contributors
 *
 * See file LICENSE for license information.
 *
 * ewmh.c: Functions to get/set certain EWMH properties easily.
 *
 */
#include <stdint.h>
#include <string.h>
#include <stdlib.h>

#include "data.h"
#include "table.h"
#include "i3.h"
#include "xcb.h"
#include "util.h"
#include "log.h"

/**
 * Creates the _NET_SUPPORTING_WM_CHECK window and update the root window
 * property.
 *
 * EWMH: The window is a direct child to the root window, with
 * _NET_WM_NAME set to the name of the window manager.
 */
void ewmh_create_supporting_window()
{
        xcb_window_t supporting_window = xcb_generate_id(global_conn);
        uint32_t supporting_values[] = { 0 };

        check_error(global_conn,
                    xcb_create_window_checked(global_conn,
                                              0,
                                              supporting_window,
                                              root,
                                              0, 0, 1, 1,
                                              0,
                                              XCB_WINDOW_CLASS_INPUT_ONLY,
                                              XCB_WINDOW_CLASS_COPY_FROM_PARENT,
                                              0, supporting_values),
                    "Could not create _NET_SUPPORTING_WM_CHECK window");

        check_error(global_conn,
                    xcb_change_property_checked(global_conn, XCB_PROP_MODE_REPLACE, root, A__NET_SUPPORTING_WM_CHECK, A_WINDOW, 32, 1, &supporting_window),
                    "Could not set the _NET_SUPPORTING_WM_CHECK property");

        check_error(global_conn,
                    xcb_change_property_checked(global_conn, XCB_PROP_MODE_REPLACE, supporting_window, A_WM_NAME, A_UTF8_STRING, 8, strlen("i3"), "i3"),
                    "Could not set the WM_NAME property on the _NET_SUPPORTING_WM_CHECK window");

        /* "i3" is ASCII, but EWMH 1.3 requires us to set the _NET_WM_NAME property. */
        check_error(global_conn,
                    xcb_change_property_checked(global_conn, XCB_PROP_MODE_REPLACE, supporting_window, A__NET_WM_NAME, A_UTF8_STRING, 8, strlen("i3"), "i3"),
                    "Could not set the _NET_WM_NAME property on the _NET_SUPPORTING_WM_CHECK window");
}<commit_msg>The WM_NAME property should be a STRING, not UTF8_STRING.<commit_after>/*
 * vim:ts=8:expandtab
 *
 * i3 - an improved dynamic tiling window manager
 *
 * © 2009 <NAME> and contributors
 *
 * See file LICENSE for license information.
 *
 * ewmh.c: Functions to get/set certain EWMH properties easily.
 *
 */
#include <stdint.h>
#include <string.h>
#include <stdlib.h>

#include "data.h"
#include "table.h"
#include "i3.h"
#include "xcb.h"
#include "util.h"
#include "log.h"

/**
 * Creates the _NET_SUPPORTING_WM_CHECK window and update the root window
 * property.
 *
 * EWMH: The window is a direct child to the root window, with
 * _NET_WM_NAME set to the name of the window manager.
 */
void ewmh_create_supporting_window()
{
        xcb_window_t supporting_window = xcb_generate_id(global_conn);
        uint32_t supporting_values[] = { 0 };

        check_error(global_conn,
                    xcb_create_window_checked(global_conn,
                                              0,
                                              supporting_window,
                                              root,
                                              0, 0, 1, 1,
                                              0,
                                              XCB_WINDOW_CLASS_INPUT_ONLY,
                                              XCB_WINDOW_CLASS_COPY_FROM_PARENT,
                                              0, supporting_values),
                    "Could not create _NET_SUPPORTING_WM_CHECK window");

        check_error(global_conn,
                    xcb_change_property_checked(global_conn, XCB_PROP_MODE_REPLACE, root, A__NET_SUPPORTING_WM_CHECK, A_WINDOW, 32, 1, &supporting_window),
                    "Could not set the _NET_SUPPORTING_WM_CHECK property");

        check_error(global_conn,
                    xcb_change_property_checked(global_conn, XCB_PROP_MODE_REPLACE, supporting_window, A_WM_NAME, XCB_ATOM_STRING, 8, strlen("i3"), "i3"),
                    "Could not set the WM_NAME property on the _NET_SUPPORTING_WM_CHECK window");

        /* "i3" is ASCII, but EWMH 1.3 requires us to set the _NET_WM_NAME property. */
        check_error(global_conn,
                    xcb_change_property_checked(global_conn, XCB_PROP_MODE_REPLACE, supporting_window, A__NET_WM_NAME, A_UTF8_STRING, 8, strlen("i3"), "i3"),
                    "Could not set the _NET_WM_NAME property on the _NET_SUPPORTING_WM_CHECK window");
}
{'fraction_non_alphanumeric': 0.07628865979381444, 'fraction_numerical': 0.012783505154639175, 'mean_word_length': 1.9152644230769231, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 32, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '282736', 'n_tokens_mistral': 1436, 'n_tokens_neox': 1359, 'n_words': 348}