]> git.sur5r.net Git - i3/i3/commitdiff
Merge branch 'master' into next
authorMichael Stapelberg <michael@stapelberg.de>
Fri, 12 Aug 2011 21:11:13 +0000 (23:11 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Fri, 12 Aug 2011 21:11:13 +0000 (23:11 +0200)
i3bar/src/outputs.c
i3bar/src/workspaces.c
i3bar/src/xcb.c

index 8cfdaa98eb18abe876d3bab39652a1209abdd3aa..9daf328d0454463ff482e7bb94eccfdad08de694 100644 (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) {
index db81267379261846303d8f70b5693e2286f7e375..eeb9ca349f459d47a7b0ad9c5eacfa39a5b4c831 100644 (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) {
@@ -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);
             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;
             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;
index b8ab5ed2e3b9af28d77a29a93a17aac88d167322..28ef3ea236e55a4cf94637acf601b04486e49b78 100644 (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).
- * We determine, wether the click occured on a ws-button or if the scroll-
+ * Handle a button-press-event (i.e. a mouse click on one of our bars).
+ * We determine, whether the click occured on a ws-button or if the scroll-
  * wheel was used and change the workspace appropriately
  *
  */
@@ -377,13 +377,14 @@ void handle_button(xcb_button_press_event_t *event) {
             break;
     }
 
-    char buffer[strlen(cur_ws->name) + 11];
-    snprintf(buffer, 50, "workspace %s", cur_ws->name);
+    const size_t len = strlen(cur_ws->name) + strlen("workspace \"\"") + 1;
+    char buffer[len];
+    snprintf(buffer, len, "workspace \"%s\"", cur_ws->name);
     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)
  *
  */
@@ -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
  * 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) {
@@ -491,7 +492,7 @@ char *init_xcb(char *fontname) {
                                              strlen(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 */
     xcb_query_font_cookie_t query_font_cookie;
     query_font_cookie = xcb_query_font(xcb_connection,
@@ -505,11 +506,7 @@ char *init_xcb(char *fontname) {
         xkb_major = XkbMajorVersion;
         xkb_minor = XkbMinorVersion;
 
-        char *dispname = getenv("DISPLAY");
-        if (dispname == NULL) {
-            dispname = ":0";
-        }
-        xkb_dpy = XkbOpenDisplay(dispname,
+        xkb_dpy = XkbOpenDisplay(NULL,
                                  &xkb_event_base,
                                  &xkb_errbase,
                                  &xkb_major,
@@ -573,7 +570,7 @@ char *init_xcb(char *fontname) {
                                                                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_prep = malloc(sizeof(ev_prepare));
     xcb_chk = malloc(sizeof(ev_check));
@@ -586,7 +583,7 @@ char *init_xcb(char *fontname) {
     ev_prepare_start(main_loop, xcb_prep);
     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();
 
     xcb_get_property_cookie_t path_cookie;
@@ -597,7 +594,7 @@ char *init_xcb(char *fontname) {
                                    XCB_GET_PROPERTY_TYPE_ANY,
                                    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,
                                                                   path_cookie,
                                                                   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() {
@@ -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() {
@@ -751,7 +748,7 @@ void reconfig_windows() {
     i3_output *walk;
     SLIST_FOREACH(walk, outputs, slist) {
         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? */
             DLOG("Destroying window for output %s\n", walk->name);
             destroy_window(walk);