commit
56bbc528d7
|
@ -77,8 +77,8 @@ static int reply_boolean_cb(void *params, int val) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int reply_string_cb(void *params, const unsigned char *val, size_t len) {
|
static int reply_string_cb(void *params, const unsigned char *val, size_t len) {
|
||||||
char *str = scalloc(len + 1, 1);
|
char *str = sstrndup((const char *)val, len);
|
||||||
strncpy(str, (const char *)val, len);
|
|
||||||
if (strcmp(last_key, "error") == 0)
|
if (strcmp(last_key, "error") == 0)
|
||||||
last_reply.error = str;
|
last_reply.error = str;
|
||||||
else if (strcmp(last_key, "input") == 0)
|
else if (strcmp(last_key, "input") == 0)
|
||||||
|
@ -108,8 +108,7 @@ static int reply_end_map_cb(void *params) {
|
||||||
|
|
||||||
static int reply_map_key_cb(void *params, const unsigned char *keyVal, size_t keyLen) {
|
static int reply_map_key_cb(void *params, const unsigned char *keyVal, size_t keyLen) {
|
||||||
free(last_key);
|
free(last_key);
|
||||||
last_key = scalloc(keyLen + 1, 1);
|
last_key = sstrndup((const char *)keyVal, keyLen);
|
||||||
strncpy(last_key, (const char *)keyVal, keyLen);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,8 +127,7 @@ static yajl_callbacks reply_callbacks = {
|
||||||
static char *config_last_key = NULL;
|
static char *config_last_key = NULL;
|
||||||
|
|
||||||
static int config_string_cb(void *params, const unsigned char *val, size_t len) {
|
static int config_string_cb(void *params, const unsigned char *val, size_t len) {
|
||||||
char *str = scalloc(len + 1, 1);
|
char *str = sstrndup((const char *)val, len);
|
||||||
strncpy(str, (const char *)val, len);
|
|
||||||
if (strcmp(config_last_key, "config") == 0) {
|
if (strcmp(config_last_key, "config") == 0) {
|
||||||
fprintf(stdout, "%s", str);
|
fprintf(stdout, "%s", str);
|
||||||
}
|
}
|
||||||
|
@ -146,8 +144,7 @@ static int config_end_map_cb(void *params) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_map_key_cb(void *params, const unsigned char *keyVal, size_t keyLen) {
|
static int config_map_key_cb(void *params, const unsigned char *keyVal, size_t keyLen) {
|
||||||
config_last_key = scalloc(keyLen + 1, 1);
|
config_last_key = sstrndup((const char *)keyVal, keyLen);
|
||||||
strncpy(config_last_key, (const char *)keyVal, keyLen);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -539,7 +539,6 @@ bool con_is_internal(Con *con) {
|
||||||
*/
|
*/
|
||||||
bool con_is_floating(Con *con) {
|
bool con_is_floating(Con *con) {
|
||||||
assert(con != NULL);
|
assert(con != NULL);
|
||||||
DLOG("checking if con %p is floating\n", con);
|
|
||||||
return (con->floating >= FLOATING_AUTO_ON);
|
return (con->floating >= FLOATING_AUTO_ON);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -215,12 +215,11 @@ void ipc_shutdown(shutdown_reason_t reason) {
|
||||||
IPC_HANDLER(run_command) {
|
IPC_HANDLER(run_command) {
|
||||||
/* To get a properly terminated buffer, we copy
|
/* To get a properly terminated buffer, we copy
|
||||||
* message_size bytes out of the buffer */
|
* message_size bytes out of the buffer */
|
||||||
char *command = scalloc(message_size + 1, 1);
|
char *command = sstrndup((const char *)message, message_size);
|
||||||
strncpy(command, (const char *)message, message_size);
|
|
||||||
LOG("IPC: received: *%s*\n", command);
|
LOG("IPC: received: *%s*\n", command);
|
||||||
yajl_gen gen = yajl_gen_alloc(NULL);
|
yajl_gen gen = yajl_gen_alloc(NULL);
|
||||||
|
|
||||||
CommandResult *result = parse_command((const char *)command, gen);
|
CommandResult *result = parse_command(command, gen);
|
||||||
free(command);
|
free(command);
|
||||||
|
|
||||||
if (result->needs_tree_render)
|
if (result->needs_tree_render)
|
||||||
|
|
|
@ -80,6 +80,8 @@ void restore_geometry(void) {
|
||||||
*/
|
*/
|
||||||
void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cookie,
|
void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cookie,
|
||||||
bool needs_to_be_mapped) {
|
bool needs_to_be_mapped) {
|
||||||
|
DLOG("window 0x%08x\n", window);
|
||||||
|
|
||||||
xcb_drawable_t d = {window};
|
xcb_drawable_t d = {window};
|
||||||
xcb_get_geometry_cookie_t geomc;
|
xcb_get_geometry_cookie_t geomc;
|
||||||
xcb_get_geometry_reply_t *geom;
|
xcb_get_geometry_reply_t *geom;
|
||||||
|
@ -163,8 +165,6 @@ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cooki
|
||||||
wm_user_time_cookie = GET_PROPERTY(A__NET_WM_USER_TIME, UINT32_MAX);
|
wm_user_time_cookie = GET_PROPERTY(A__NET_WM_USER_TIME, UINT32_MAX);
|
||||||
wm_desktop_cookie = GET_PROPERTY(A__NET_WM_DESKTOP, UINT32_MAX);
|
wm_desktop_cookie = GET_PROPERTY(A__NET_WM_DESKTOP, UINT32_MAX);
|
||||||
|
|
||||||
DLOG("Managing window 0x%08x\n", window);
|
|
||||||
|
|
||||||
i3Window *cwindow = scalloc(1, sizeof(i3Window));
|
i3Window *cwindow = scalloc(1, sizeof(i3Window));
|
||||||
cwindow->id = window;
|
cwindow->id = window;
|
||||||
cwindow->depth = get_visual_depth(attr->visual);
|
cwindow->depth = get_visual_depth(attr->visual);
|
||||||
|
|
40
src/window.c
40
src/window.c
|
@ -51,14 +51,10 @@ void window_update_class(i3Window *win, xcb_get_property_reply_t *prop, bool bef
|
||||||
LOG("WM_CLASS changed to %s (instance), %s (class)\n",
|
LOG("WM_CLASS changed to %s (instance), %s (class)\n",
|
||||||
win->class_instance, win->class_class);
|
win->class_instance, win->class_class);
|
||||||
|
|
||||||
if (before_mgmt) {
|
|
||||||
free(prop);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
run_assignments(win);
|
|
||||||
|
|
||||||
free(prop);
|
free(prop);
|
||||||
|
if (!before_mgmt) {
|
||||||
|
run_assignments(win);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -92,14 +88,10 @@ void window_update_name(i3Window *win, xcb_get_property_reply_t *prop, bool befo
|
||||||
|
|
||||||
win->uses_net_wm_name = true;
|
win->uses_net_wm_name = true;
|
||||||
|
|
||||||
if (before_mgmt) {
|
|
||||||
free(prop);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
run_assignments(win);
|
|
||||||
|
|
||||||
free(prop);
|
free(prop);
|
||||||
|
if (!before_mgmt) {
|
||||||
|
run_assignments(win);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -141,14 +133,10 @@ void window_update_name_legacy(i3Window *win, xcb_get_property_reply_t *prop, bo
|
||||||
|
|
||||||
win->name_x_changed = true;
|
win->name_x_changed = true;
|
||||||
|
|
||||||
if (before_mgmt) {
|
|
||||||
free(prop);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
run_assignments(win);
|
|
||||||
|
|
||||||
free(prop);
|
free(prop);
|
||||||
|
if (!before_mgmt) {
|
||||||
|
run_assignments(win);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -244,14 +232,10 @@ void window_update_role(i3Window *win, xcb_get_property_reply_t *prop, bool befo
|
||||||
win->role = new_role;
|
win->role = new_role;
|
||||||
LOG("WM_WINDOW_ROLE changed to \"%s\"\n", win->role);
|
LOG("WM_WINDOW_ROLE changed to \"%s\"\n", win->role);
|
||||||
|
|
||||||
if (before_mgmt) {
|
|
||||||
free(prop);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
run_assignments(win);
|
|
||||||
|
|
||||||
free(prop);
|
free(prop);
|
||||||
|
if (!before_mgmt) {
|
||||||
|
run_assignments(win);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue