2 #define I3__FILE__ "window.c"
20 if (prop == NULL || xcb_get_property_value_length(prop) == 0) {
21 DLOG(
"WM_CLASS not set.\n");
29 char *new_class = xcb_get_property_value(prop);
35 if ((strlen(new_class) + 1) < xcb_get_property_value_length(prop))
38 LOG(
"WM_CLASS changed to %s (instance), %s (class)\n",
57 if (prop == NULL || xcb_get_property_value_length(prop) == 0) {
58 DLOG(
"_NET_WM_NAME not specified, not changing\n");
65 xcb_get_property_value_length(prop));
89 if (prop == NULL || xcb_get_property_value_length(prop) == 0) {
90 DLOG(
"WM_NAME not set (_NET_WM_NAME is what you want anyways).\n");
103 xcb_get_property_value_length(prop));
106 LOG(
"Using legacy window title. Note that in order to get Unicode window "
107 "titles in i3, the application has to set _NET_WM_NAME (UTF-8)\n");
126 if (prop == NULL || xcb_get_property_value_length(prop) == 0) {
127 DLOG(
"CLIENT_LEADER not set.\n");
132 xcb_window_t *leader = xcb_get_property_value(prop);
133 if (leader == NULL) {
138 DLOG(
"Client leader changed to %08x\n", *leader);
150 if (prop == NULL || xcb_get_property_value_length(prop) == 0) {
151 DLOG(
"TRANSIENT_FOR not set.\n");
156 xcb_window_t transient_for;
162 DLOG(
"Transient for changed to %08x\n", transient_for);
174 if (prop == NULL || xcb_get_property_value_length(prop) == 0) {
175 DLOG(
"_NET_WM_STRUT_PARTIAL not set.\n");
181 if (!(strut = xcb_get_property_value(prop))) {
186 DLOG(
"Reserved pixels changed to: left = %d, right = %d, top = %d, bottom = %d\n",
187 strut[0], strut[1], strut[2], strut[3]);
199 if (prop == NULL || xcb_get_property_value_length(prop) == 0) {
200 DLOG(
"WM_WINDOW_ROLE not set.\n");
206 if (asprintf(&new_role,
"%.*s", xcb_get_property_value_length(prop),
207 (
char*)xcb_get_property_value(prop)) == -1) {
208 perror(
"asprintf()");
209 DLOG(
"Could not get WM_WINDOW_ROLE\n");
214 win->
role = new_role;
215 LOG(
"WM_WINDOW_ROLE changed to \"%s\"\n", win->
role);
232 if (prop == NULL || xcb_get_property_value_length(prop) == 0) {
233 DLOG(
"WM_HINTS not set.\n");
241 DLOG(
"Could not get WM_HINTS\n");
247 LOG(
"WM_HINTS.input changed to \"%d\"\n", hints.input);
#define xcb_icccm_get_wm_transient_for_from_reply
void window_update_leader(i3Window *win, xcb_get_property_reply_t *prop)
Updates the CLIENT_LEADER (logical parent window).
char * role
The WM_WINDOW_ROLE of this window (for example, the pidgin buddy window sets "buddy list")...
void window_update_strut_partial(i3Window *win, xcb_get_property_reply_t *prop)
Updates the _NET_WM_STRUT_PARTIAL (reserved pixels at the screen edges)
bool name_x_changed
Flag to force re-rendering the decoration upon changes.
i3String * name
The name of the window.
char * sstrdup(const char *str)
Safe-wrapper around strdup which exits if malloc returns NULL (meaning that there is no more memory a...
#define xcb_icccm_get_wm_hints_from_reply
const char * i3string_as_utf8(i3String *str)
Returns the UTF-8 encoded version of the i3String.
void window_update_role(i3Window *win, xcb_get_property_reply_t *prop, bool before_mgmt)
Updates the WM_WINDOW_ROLE.
bool doesnt_accept_focus
Whether this window accepts focus.
A 'Window' is a type which contains an xcb_window_t and all the related information (hints like _NET_...
bool uses_net_wm_name
Whether the application used _NET_WM_NAME.
#define xcb_icccm_wm_hints_t
Stores the reserved pixels on each screen edge read from a _NET_WM_STRUT_PARTIAL. ...
xcb_window_t leader
Holds the xcb_window_t (just an ID) for the leader window (logical parent for toolwindows and similar...
void window_update_name(i3Window *win, xcb_get_property_reply_t *prop, bool before_mgmt)
Updates the name by using _NET_WM_NAME (encoded in UTF-8) for the given window.
void window_update_hints(i3Window *win, xcb_get_property_reply_t *prop)
Updates the WM_HINTS (we only care about the input focus handling part).
void window_update_transient_for(i3Window *win, xcb_get_property_reply_t *prop)
Updates the TRANSIENT_FOR (logical parent window).
void window_update_name_legacy(i3Window *win, xcb_get_property_reply_t *prop, bool before_mgmt)
Updates the name by using WM_NAME (encoded in COMPOUND_TEXT).
i3String * i3string_from_utf8_with_length(const char *from_utf8, size_t num_bytes)
Build an i3String from an UTF-8 encoded string with fixed length.
struct reservedpx reserved
Pixels the window reserves.
void i3string_free(i3String *str)
Free an i3String.
void window_update_class(i3Window *win, xcb_get_property_reply_t *prop, bool before_mgmt)
Updates the WM_CLASS (consisting of the class and instance) for the given window. ...
xcb_window_t transient_for
void run_assignments(i3Window *window)
Checks the list of assignments for the given window and runs all matching ones (unless they have alre...