Merge branch 'master' into next

This commit is contained in:
Michael Stapelberg 2011-08-12 23:11:13 +02:00
commit 2f116df901
3 changed files with 18 additions and 21 deletions

View File

@ -40,7 +40,7 @@ static int outputs_null_cb(void *params_) {
} }
/* /*
* Parse a booleant-value (active) * Parse a boolean value (active)
* *
*/ */
static int outputs_boolean_cb(void *params_, bool val) { static int outputs_boolean_cb(void *params_, bool val) {

View File

@ -26,7 +26,7 @@ struct workspaces_json_params {
}; };
/* /*
* Parse a booleant-value (visible, focused, urgent) * Parse a boolean value (visible, focused, urgent)
* *
*/ */
static int workspaces_boolean_cb(void *params_, bool val) { static int workspaces_boolean_cb(void *params_, bool val) {
@ -119,7 +119,7 @@ static int workspaces_string_cb(void *params_, const unsigned char *val, unsigne
strncpy(params->workspaces_walk->name, (const char*) val, len); strncpy(params->workspaces_walk->name, (const char*) val, len);
params->workspaces_walk->name[len] = '\0'; params->workspaces_walk->name[len] = '\0';
/* Convert the name to ucs2, save it's length in glyphs and calculate it'srendered width */ /* Convert the name to ucs2, save its length in glyphs and calculate its rendered width */
int ucs2_len; int ucs2_len;
xcb_char2b_t *ucs2_name = (xcb_char2b_t*) convert_utf8_to_ucs2(params->workspaces_walk->name, &ucs2_len); xcb_char2b_t *ucs2_name = (xcb_char2b_t*) convert_utf8_to_ucs2(params->workspaces_walk->name, &ucs2_len);
params->workspaces_walk->ucs2_name = ucs2_name; params->workspaces_walk->ucs2_name = ucs2_name;

View File

@ -306,8 +306,8 @@ void init_colors(const struct xcb_color_strings_t *new_colors) {
} }
/* /*
* Handle a button-press-event (i.c. a mouse click on one of our bars). * Handle a button-press-event (i.e. a mouse click on one of our bars).
* We determine, wether the click occured on a ws-button or if the scroll- * We determine, whether the click occured on a ws-button or if the scroll-
* wheel was used and change the workspace appropriately * wheel was used and change the workspace appropriately
* *
*/ */
@ -377,13 +377,14 @@ void handle_button(xcb_button_press_event_t *event) {
break; break;
} }
char buffer[strlen(cur_ws->name) + 11]; const size_t len = strlen(cur_ws->name) + strlen("workspace \"\"") + 1;
snprintf(buffer, 50, "workspace %s", cur_ws->name); char buffer[len];
snprintf(buffer, len, "workspace \"%s\"", cur_ws->name);
i3_send_msg(I3_IPC_MESSAGE_TYPE_COMMAND, buffer); i3_send_msg(I3_IPC_MESSAGE_TYPE_COMMAND, buffer);
} }
/* /*
* This function is called immediately bevor the main loop locks. We flush xcb * This function is called immediately before the main loop locks. We flush xcb
* then (and only then) * then (and only then)
* *
*/ */
@ -394,7 +395,7 @@ void xcb_prep_cb(struct ev_loop *loop, ev_prepare *watcher, int revents) {
/* /*
* This function is called immediately after the main loop locks, so when one * This function is called immediately after the main loop locks, so when one
* of the watchers registered an event. * of the watchers registered an event.
* We check wether an X-Event arrived and handle it. * We check whether an X-Event arrived and handle it.
* *
*/ */
void xcb_chk_cb(struct ev_loop *loop, ev_check *watcher, int revents) { void xcb_chk_cb(struct ev_loop *loop, ev_check *watcher, int revents) {
@ -491,7 +492,7 @@ char *init_xcb(char *fontname) {
strlen(fontname), strlen(fontname),
fontname); fontname);
/* We need to save info about the font, because we need the fonts height and /* We need to save info about the font, because we need the font's height and
* information about the width of characters */ * information about the width of characters */
xcb_query_font_cookie_t query_font_cookie; xcb_query_font_cookie_t query_font_cookie;
query_font_cookie = xcb_query_font(xcb_connection, query_font_cookie = xcb_query_font(xcb_connection,
@ -505,11 +506,7 @@ char *init_xcb(char *fontname) {
xkb_major = XkbMajorVersion; xkb_major = XkbMajorVersion;
xkb_minor = XkbMinorVersion; xkb_minor = XkbMinorVersion;
char *dispname = getenv("DISPLAY"); xkb_dpy = XkbOpenDisplay(NULL,
if (dispname == NULL) {
dispname = ":0";
}
xkb_dpy = XkbOpenDisplay(dispname,
&xkb_event_base, &xkb_event_base,
&xkb_errbase, &xkb_errbase,
&xkb_major, &xkb_major,
@ -573,7 +570,7 @@ char *init_xcb(char *fontname) {
xcb_screen->height_in_pixels); xcb_screen->height_in_pixels);
/* The varios Watchers to communicate with xcb */ /* The various Watchers to communicate with xcb */
xcb_io = malloc(sizeof(ev_io)); xcb_io = malloc(sizeof(ev_io));
xcb_prep = malloc(sizeof(ev_prepare)); xcb_prep = malloc(sizeof(ev_prepare));
xcb_chk = malloc(sizeof(ev_check)); xcb_chk = malloc(sizeof(ev_check));
@ -586,7 +583,7 @@ char *init_xcb(char *fontname) {
ev_prepare_start(main_loop, xcb_prep); ev_prepare_start(main_loop, xcb_prep);
ev_check_start(main_loop, xcb_chk); ev_check_start(main_loop, xcb_chk);
/* Now we get the atoms and save them in a nice data-structure */ /* Now we get the atoms and save them in a nice data structure */
get_atoms(); get_atoms();
xcb_get_property_cookie_t path_cookie; xcb_get_property_cookie_t path_cookie;
@ -597,7 +594,7 @@ char *init_xcb(char *fontname) {
XCB_GET_PROPERTY_TYPE_ANY, XCB_GET_PROPERTY_TYPE_ANY,
0, PATH_MAX); 0, PATH_MAX);
/* We check, if i3 set it's socket-path */ /* We check, if i3 set its socket-path */
xcb_get_property_reply_t *path_reply = xcb_get_property_reply(xcb_connection, xcb_get_property_reply_t *path_reply = xcb_get_property_reply(xcb_connection,
path_cookie, path_cookie,
NULL); NULL);
@ -666,7 +663,7 @@ void clean_xcb() {
} }
/* /*
* Get the earlier requested atoms and save them in the prepared data-structure * Get the earlier requested atoms and save them in the prepared data structure
* *
*/ */
void get_atoms() { void get_atoms() {
@ -741,7 +738,7 @@ void realloc_sl_buffer() {
} }
/* /*
* Reconfigure all bars and create new for newly activated outputs * Reconfigure all bars and create new bars for recently activated outputs
* *
*/ */
void reconfig_windows() { void reconfig_windows() {
@ -751,7 +748,7 @@ void reconfig_windows() {
i3_output *walk; i3_output *walk;
SLIST_FOREACH(walk, outputs, slist) { SLIST_FOREACH(walk, outputs, slist) {
if (!walk->active) { if (!walk->active) {
/* If an output is not active, we destroy it's bar */ /* If an output is not active, we destroy its bar */
/* FIXME: Maybe we rather want to unmap? */ /* FIXME: Maybe we rather want to unmap? */
DLOG("Destroying window for output %s\n", walk->name); DLOG("Destroying window for output %s\n", walk->name);
destroy_window(walk); destroy_window(walk);