static int handle_key_release(void *ignored, xcb_connection_t *conn, xcb_key_release_event_t *event) {
printf("releasing %d, state raw = %d\n", event->detail, event->state);
- /* See the documentation of xcb_key_symbols_get_keysym for this one.
- * Basically: We get either col 0 or col 1, depending on whether shift is
- * pressed. */
- int col = (event->state & XCB_MOD_MASK_SHIFT);
-
- /* If modeswitch is currently active, we need to look in group 2 or 3,
- * respectively. */
- if (modeswitch_active)
- col += 2;
-
xcb_keysym_t sym = xcb_key_press_lookup_keysym(symbols, event, event->state);
if (sym == XK_Mode_switch) {
printf("Mode switch disabled\n");
}
int main(int argc, char *argv[]) {
- char *pattern = strdup("-misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1");
+ char *pattern = sstrdup("-misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1");
int o, option_index = 0;
enum { TYPE_ERROR = 0, TYPE_WARNING = 1 } bar_type = TYPE_ERROR;
char *options_string = "b:f:m:t:vh";
- prompt = strdup("Please do not run this program.");
+ prompt = sstrdup("Please do not run this program.");
while ((o = getopt_long(argc, argv, options_string, long_options, &option_index)) != -1) {
switch (o) {
return 0;
case 'f':
FREE(pattern);
- pattern = strdup(optarg);
+ pattern = sstrdup(optarg);
break;
case 'm':
FREE(prompt);
- prompt = strdup(optarg);
+ prompt = sstrdup(optarg);
break;
case 't':
bar_type = (strcasecmp(optarg, "warning") == 0 ? TYPE_WARNING : TYPE_ERROR);
free(event);
}
+ FREE(pattern);
+
return 0;
}
return;
}
- LOG("should move window to workspace with number %d\n", which);
+ LOG("should move window to workspace %s\n", which);
/* get the workspace */
Con *output, *workspace = NULL;
child->num == parsed_num);
if (!workspace) {
- LOG("There is no workspace with number %d, creating a new one.\n", parsed_num);
+ LOG("There is no workspace with number %ld, creating a new one.\n", parsed_num);
ysuccess(true);
/* terminate the which string after the endposition of the number */
*endptr = '\0';
layout = L_SPLITV;
else if (strcmp(layout_str, "splith") == 0)
layout = L_SPLITH;
+ else {
+ ELOG("Unknown layout \"%s\", this is a mismatch between code and parser spec.\n", layout_str);
+ return;
+ }
DLOG("changing layout to %s (%d)\n", layout_str, layout);
while (fs && fs->fullscreen_mode == CF_NONE)
fs = fs->parent;
+ /* fs must be non-NULL since the workspace con doesn’t have CF_NONE and
+ * there always has to be a workspace con in the hierarchy. */
+ assert(fs != NULL);
/* The most common case is we hit the workspace level. In this
* situation, changing focus is also harmless. */
assert(fs->fullscreen_mode != CF_NONE);
confine_to, border_t border, callback_t callback, const void *extra)
{
uint32_t new_x, new_y;
- Rect old_rect;
+ Rect old_rect = { 0, 0, 0, 0 };
if (con != NULL)
memcpy(&old_rect, &(con->rect), sizeof(Rect));
#endif
ipc_client *client = extra;
- DLOG("should add subscription to extra %p, sub %.*s\n", client, len, s);
+ DLOG("should add subscription to extra %p, sub %.*s\n", client, (int)len, s);
int event = client->num_events;
client->num_events++;
command_failed = false;
yajl_status state = yajl_parse(handle, reply, length);
if (state != yajl_status_ok) {
- ELOG("Could not parse my own reply. That's weird. reply is %.*s\n", length, reply);
+ ELOG("Could not parse my own reply. That's weird. reply is %.*s\n", (int)length, reply);
} else {
if (command_failed)
start_commanderror_nagbar();
#else
static int json_string(void *ctx, const unsigned char *val, unsigned int len) {
#endif
- LOG("string: %.*s for key %s\n", len, val, last_key);
+ LOG("string: %.*s for key %s\n", (int)len, val, last_key);
if (parsing_swallows) {
/* TODO: the other swallowing keys */
if (strcasecmp(last_key, "class") == 0) {
}
optind++;
}
- LOG("Command is: %s (%d bytes)\n", payload, strlen(payload));
+ DLOG("Command is: %s (%zd bytes)\n", payload, strlen(payload));
char *socket_path = root_atom_contents("I3_SOCKET_PATH");
if (!socket_path) {
ELOG("Could not get i3 IPC socket path\n");
Output *output = NULL;
if (!(pointerreply = xcb_query_pointer_reply(conn, pointercookie, NULL))) {
ELOG("Could not query pointer position, using first screen\n");
- output = get_first_output();
} else {
DLOG("Pointer at %d, %d\n", pointerreply->root_x, pointerreply->root_y);
output = get_output_containing(pointerreply->root_x, pointerreply->root_y);