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) < (
size_t)xcb_get_property_value_length(prop))
39 LOG(
"WM_CLASS changed to %s (instance), %s (class)\n",
58 if (prop == NULL || xcb_get_property_value_length(prop) == 0) {
59 DLOG(
"_NET_WM_NAME not specified, not changing\n");
66 xcb_get_property_value_length(prop));
90 if (prop == NULL || xcb_get_property_value_length(prop) == 0) {
91 DLOG(
"WM_NAME not set (_NET_WM_NAME is what you want anyways).\n");
104 xcb_get_property_value_length(prop));
107 LOG(
"Using legacy window title. Note that in order to get Unicode window "
108 "titles in i3, the application has to set _NET_WM_NAME (UTF-8)\n");
127 if (prop == NULL || xcb_get_property_value_length(prop) == 0) {
128 DLOG(
"CLIENT_LEADER not set.\n");
133 xcb_window_t *leader = xcb_get_property_value(prop);
134 if (leader == NULL) {
139 DLOG(
"Client leader changed to %08x\n", *leader);
151 if (prop == NULL || xcb_get_property_value_length(prop) == 0) {
152 DLOG(
"TRANSIENT_FOR not set.\n");
157 xcb_window_t transient_for;
163 DLOG(
"Transient for changed to %08x\n", transient_for);
175 if (prop == NULL || xcb_get_property_value_length(prop) == 0) {
176 DLOG(
"_NET_WM_STRUT_PARTIAL not set.\n");
182 if (!(strut = xcb_get_property_value(prop))) {
187 DLOG(
"Reserved pixels changed to: left = %d, right = %d, top = %d, bottom = %d\n",
188 strut[0], strut[1], strut[2], strut[3]);
200 if (prop == NULL || xcb_get_property_value_length(prop) == 0) {
201 DLOG(
"WM_WINDOW_ROLE not set.\n");
207 if (asprintf(&new_role,
"%.*s", xcb_get_property_value_length(prop),
208 (
char *)xcb_get_property_value(prop)) == -1) {
209 perror(
"asprintf()");
210 DLOG(
"Could not get WM_WINDOW_ROLE\n");
215 win->
role = new_role;
216 LOG(
"WM_WINDOW_ROLE changed to \"%s\"\n", win->
role);
233 if (urgency_hint != NULL)
234 *urgency_hint =
false;
236 if (prop == NULL || xcb_get_property_value_length(prop) == 0) {
237 DLOG(
"WM_HINTS not set.\n");
245 DLOG(
"Could not get WM_HINTS\n");
251 LOG(
"WM_HINTS.input changed to \"%d\"\n", hints.input);
253 if (urgency_hint != NULL)
278 #define MWM_HINTS_DECORATIONS (1 << 1)
279 #define MWM_DECOR_ALL (1 << 0)
280 #define MWM_DECOR_BORDER (1 << 1)
281 #define MWM_DECOR_TITLE (1 << 3)
283 if (motif_border_style != NULL)
286 if (prop == NULL || xcb_get_property_value_length(prop) == 0) {
296 uint64_t *motif_hints = (uint64_t *)xcb_get_property_value(prop);
309 #undef MWM_HINTS_DECORATIONS
311 #undef MWM_DECOR_BORDER
312 #undef MWM_DECOR_TITLE
const char * i3string_as_utf8(i3String *str)
Returns the UTF-8 encoded version of the i3String.
char * sstrdup(const char *str)
Safe-wrapper around strdup which exits if malloc returns NULL (meaning that there is no more memory a...
bool uses_net_wm_name
Whether the application used _NET_WM_NAME.
void window_update_transient_for(i3Window *win, xcb_get_property_reply_t *prop)
Updates the TRANSIENT_FOR (logical parent window).
#define xcb_icccm_wm_hints_get_urgency
struct reservedpx reserved
Pixels the window reserves.
void window_update_leader(i3Window *win, xcb_get_property_reply_t *prop)
Updates the CLIENT_LEADER (logical parent window).
bool name_x_changed
Flag to force re-rendering the decoration upon changes.
A 'Window' is a type which contains an xcb_window_t and all the related information (hints like _NET_...
xcb_window_t transient_for
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)
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.
#define xcb_icccm_get_wm_transient_for_from_reply
void run_assignments(i3Window *window)
Checks the list of assignments for the given window and runs all matching ones (unless they have alre...
Stores the reserved pixels on each screen edge read from a _NET_WM_STRUT_PARTIAL. ...
#define xcb_icccm_wm_hints_t
void window_update_motif_hints(i3Window *win, xcb_get_property_reply_t *prop, border_style_t *motif_border_style)
Updates the MOTIF_WM_HINTS.
void i3string_free(i3String *str)
Free an i3String.
char * role
The WM_WINDOW_ROLE of this window (for example, the pidgin buddy window sets "buddy list")...
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. ...
void window_update_hints(i3Window *win, xcb_get_property_reply_t *prop, bool *urgency_hint)
Updates the WM_HINTS (we only care about the input focus handling part).
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.
#define MWM_HINTS_DECORATIONS
#define xcb_icccm_get_wm_hints_from_reply
i3String * name
The name of the window.
bool doesnt_accept_focus
Whether this window accepts focus.
void window_update_role(i3Window *win, xcb_get_property_reply_t *prop, bool before_mgmt)
Updates the WM_WINDOW_ROLE.
xcb_window_t leader
Holds the xcb_window_t (just an ID) for the leader window (logical parent for toolwindows and similar...