2 コミット 42946432a2 ... f425afb2e8

作者 SHA1 メッセージ 日付
  Lucas Sköldqvist f425afb2e8 Exit when connection to X cannot be established 5 年 前
  Lucas Sköldqvist 9b6a24cc97 Rename Center to Centre 5 年 前
1 ファイル変更9 行追加2 行削除
  1. 9 2
      fittsen.c

+ 9 - 2
fittsen.c

@@ -244,7 +244,7 @@ get_section(const char *section)
 {
     if (strcmp(section, "TopLeft") == 0)
         return 0;
-    else if (strcmp(section, "TopCenter") == 0 || strcmp(section, "TopCentre") == 0)
+    else if (strcmp(section, "TopCentre") == 0)
         return 1;
     else if (strcmp(section, "TopRight") == 0)
         return 2;
@@ -252,7 +252,7 @@ get_section(const char *section)
         return 3;
     else if (strcmp(section, "BottomRight") == 0)
         return 4;
-    else if (strcmp(section, "BottomCenter") == 0 || strcmp(section, "BottomCentre") == 0)
+    else if (strcmp(section, "BottomCentre") == 0)
         return 5;
     else if (strcmp(section, "BottomLeft") == 0)
         return 6;
@@ -340,6 +340,12 @@ int
 main(int argc, char *argv[])
 {
     xcb_connection_t *conn = xcb_connect(NULL, NULL);
+
+    if (xcb_connection_has_error(conn) > 0) {
+        fprintf(stderr, "Cannot connect to X\n");
+        return 1;
+    }
+
     xcb_screen_t *screen = xcb_setup_roots_iterator(xcb_get_setup(conn)).data;
 
     init_options(screen->width_in_pixels, screen->height_in_pixels);
@@ -350,6 +356,7 @@ main(int argc, char *argv[])
 
     server_create_windows(conn, screen);
     server_event_loop(conn);
+
     xcb_disconnect(conn);
 
     return 0;