Adjusted code style slightly for SDL_ibus.c
authorRyan C. Gordon <icculus@icculus.org>
Thu, 21 Aug 2014 23:15:17 -0400
changeset 91076485aa2e421c
parent 9106 d1d0a67ca6c8
child 9108 8200b1bdcf83
Adjusted code style slightly for SDL_ibus.c
src/core/linux/SDL_ibus.c
     1.1 --- a/src/core/linux/SDL_ibus.c	Thu Aug 21 23:03:38 2014 -0400
     1.2 +++ b/src/core/linux/SDL_ibus.c	Thu Aug 21 23:15:17 2014 -0400
     1.3 @@ -54,14 +54,14 @@
     1.4      SDL_Keymod sdl_mods = SDL_GetModState();
     1.5      
     1.6      /* Not sure about MOD3, MOD4 and HYPER mappings */
     1.7 -    if(sdl_mods & KMOD_LSHIFT) ibus_mods |= IBUS_SHIFT_MASK;
     1.8 -    if(sdl_mods & KMOD_CAPS)   ibus_mods |= IBUS_LOCK_MASK;
     1.9 -    if(sdl_mods & KMOD_LCTRL)  ibus_mods |= IBUS_CONTROL_MASK;
    1.10 -    if(sdl_mods & KMOD_LALT)   ibus_mods |= IBUS_MOD1_MASK;
    1.11 -    if(sdl_mods & KMOD_NUM)    ibus_mods |= IBUS_MOD2_MASK;
    1.12 -    if(sdl_mods & KMOD_MODE)   ibus_mods |= IBUS_MOD5_MASK;
    1.13 -    if(sdl_mods & KMOD_LGUI)   ibus_mods |= IBUS_SUPER_MASK;
    1.14 -    if(sdl_mods & KMOD_RGUI)   ibus_mods |= IBUS_META_MASK;
    1.15 +    if (sdl_mods & KMOD_LSHIFT) ibus_mods |= IBUS_SHIFT_MASK;
    1.16 +    if (sdl_mods & KMOD_CAPS)   ibus_mods |= IBUS_LOCK_MASK;
    1.17 +    if (sdl_mods & KMOD_LCTRL)  ibus_mods |= IBUS_CONTROL_MASK;
    1.18 +    if (sdl_mods & KMOD_LALT)   ibus_mods |= IBUS_MOD1_MASK;
    1.19 +    if (sdl_mods & KMOD_NUM)    ibus_mods |= IBUS_MOD2_MASK;
    1.20 +    if (sdl_mods & KMOD_MODE)   ibus_mods |= IBUS_MOD5_MASK;
    1.21 +    if (sdl_mods & KMOD_LGUI)   ibus_mods |= IBUS_SUPER_MASK;
    1.22 +    if (sdl_mods & KMOD_RGUI)   ibus_mods |= IBUS_META_MASK;
    1.23  
    1.24      return ibus_mods;
    1.25  }
    1.26 @@ -73,32 +73,32 @@
    1.27      const char *text = NULL;
    1.28      DBusMessageIter sub1, sub2;
    1.29  
    1.30 -    if(dbus->message_iter_get_arg_type(iter) != DBUS_TYPE_VARIANT){
    1.31 +    if (dbus->message_iter_get_arg_type(iter) != DBUS_TYPE_VARIANT) {
    1.32          return NULL;
    1.33      }
    1.34      
    1.35      dbus->message_iter_recurse(iter, &sub1);
    1.36      
    1.37 -    if(dbus->message_iter_get_arg_type(&sub1) != DBUS_TYPE_STRUCT){
    1.38 +    if (dbus->message_iter_get_arg_type(&sub1) != DBUS_TYPE_STRUCT) {
    1.39          return NULL;
    1.40      }
    1.41      
    1.42      dbus->message_iter_recurse(&sub1, &sub2);
    1.43      
    1.44 -    if(dbus->message_iter_get_arg_type(&sub2) != DBUS_TYPE_STRING){
    1.45 +    if (dbus->message_iter_get_arg_type(&sub2) != DBUS_TYPE_STRING) {
    1.46          return NULL;
    1.47      }
    1.48      
    1.49      const char *struct_id = NULL;
    1.50      dbus->message_iter_get_basic(&sub2, &struct_id);
    1.51 -    if(!struct_id || SDL_strncmp(struct_id, "IBusText", sizeof("IBusText")) != 0){
    1.52 +    if (!struct_id || SDL_strncmp(struct_id, "IBusText", sizeof("IBusText")) != 0) {
    1.53          return NULL;
    1.54      }
    1.55      
    1.56      dbus->message_iter_next(&sub2);
    1.57      dbus->message_iter_next(&sub2);
    1.58      
    1.59 -    if(dbus->message_iter_get_arg_type(&sub2) != DBUS_TYPE_STRING){
    1.60 +    if (dbus->message_iter_get_arg_type(&sub2) != DBUS_TYPE_STRING) {
    1.61          return NULL;
    1.62      }
    1.63      
    1.64 @@ -113,8 +113,8 @@
    1.65      size_t utf8_len = 0;
    1.66      const char *p;
    1.67      
    1.68 -    for(p = str; *p; ++p){
    1.69 -        if(!((*p & 0x80) && !(*p & 0x40))){
    1.70 +    for (p = str; *p; ++p) {
    1.71 +        if (!((*p & 0x80) && !(*p & 0x40))) {
    1.72              ++utf8_len;
    1.73          }
    1.74      }
    1.75 @@ -127,16 +127,17 @@
    1.76  {
    1.77      SDL_DBusContext *dbus = (SDL_DBusContext *)user_data;
    1.78          
    1.79 -    if(dbus->message_is_signal(msg, IBUS_INPUT_INTERFACE, "CommitText")){
    1.80 +    if (dbus->message_is_signal(msg, IBUS_INPUT_INTERFACE, "CommitText")) {
    1.81          DBusMessageIter iter;
    1.82 +
    1.83          dbus->message_iter_init(msg, &iter);
    1.84          
    1.85          const char *text = IBus_GetVariantText(conn, &iter, dbus);
    1.86 -        if(text && *text){
    1.87 +        if (text && *text) {
    1.88              char buf[SDL_TEXTEDITINGEVENT_TEXT_SIZE];
    1.89              size_t text_bytes = SDL_strlen(text), i = 0;
    1.90              
    1.91 -            while(i < text_bytes){
    1.92 +            while (i < text_bytes) {
    1.93                  size_t sz = SDL_utf8strlcpy(buf, text+i, sizeof(buf));
    1.94                  SDL_SendKeyboardText(buf);
    1.95                  
    1.96 @@ -147,17 +148,17 @@
    1.97          return DBUS_HANDLER_RESULT_HANDLED;
    1.98      }
    1.99      
   1.100 -    if(dbus->message_is_signal(msg, IBUS_INPUT_INTERFACE, "UpdatePreeditText")){
   1.101 +    if (dbus->message_is_signal(msg, IBUS_INPUT_INTERFACE, "UpdatePreeditText")) {
   1.102          DBusMessageIter iter;
   1.103          dbus->message_iter_init(msg, &iter);
   1.104          const char *text = IBus_GetVariantText(conn, &iter, dbus);
   1.105          
   1.106 -        if(text && *text){
   1.107 +        if (text && *text) {
   1.108              char buf[SDL_TEXTEDITINGEVENT_TEXT_SIZE];
   1.109              size_t text_bytes = SDL_strlen(text), i = 0;
   1.110              size_t cursor = 0;
   1.111              
   1.112 -            while(i < text_bytes){
   1.113 +            while (i < text_bytes) {
   1.114                  size_t sz = SDL_utf8strlcpy(buf, text+i, sizeof(buf));
   1.115                  size_t chars = IBus_utf8_strlen(buf);
   1.116                  
   1.117 @@ -173,9 +174,9 @@
   1.118          return DBUS_HANDLER_RESULT_HANDLED;
   1.119      }
   1.120      
   1.121 -    if(dbus->message_is_signal(msg, IBUS_INPUT_INTERFACE, "HidePreeditText")){
   1.122 -    	SDL_SendEditingText("", 0, 0);
   1.123 -    	return DBUS_HANDLER_RESULT_HANDLED;
   1.124 +    if (dbus->message_is_signal(msg, IBUS_INPUT_INTERFACE, "HidePreeditText")) {
   1.125 +        SDL_SendEditingText("", 0, 0);
   1.126 +        return DBUS_HANDLER_RESULT_HANDLED;
   1.127      }
   1.128      
   1.129      return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
   1.130 @@ -185,18 +186,18 @@
   1.131  IBus_ReadAddressFromFile(const char *file_path)
   1.132  {
   1.133      FILE *addr_file = fopen(file_path, "r");
   1.134 -    if(!addr_file){
   1.135 +    if (!addr_file) {
   1.136          return NULL;
   1.137      }
   1.138  
   1.139      char addr_buf[1024];
   1.140      SDL_bool success = SDL_FALSE;
   1.141  
   1.142 -    while(fgets(addr_buf, sizeof(addr_buf), addr_file)){
   1.143 -        if(SDL_strncmp(addr_buf, "IBUS_ADDRESS=", sizeof("IBUS_ADDRESS=")-1) == 0){
   1.144 +    while (fgets(addr_buf, sizeof(addr_buf), addr_file)) {
   1.145 +        if (SDL_strncmp(addr_buf, "IBUS_ADDRESS=", sizeof("IBUS_ADDRESS=")-1) == 0) {
   1.146              size_t sz = SDL_strlen(addr_buf);
   1.147 -            if(addr_buf[sz-1] == '\n') addr_buf[sz-1] = 0;
   1.148 -            if(addr_buf[sz-2] == '\r') addr_buf[sz-2] = 0;
   1.149 +            if (addr_buf[sz-1] == '\n') addr_buf[sz-1] = 0;
   1.150 +            if (addr_buf[sz-2] == '\r') addr_buf[sz-2] = 0;
   1.151              success = SDL_TRUE;
   1.152              break;
   1.153          }
   1.154 @@ -204,7 +205,7 @@
   1.155  
   1.156      fclose(addr_file);
   1.157  
   1.158 -    if(success){
   1.159 +    if (success) {
   1.160          return SDL_strdup(addr_buf + (sizeof("IBUS_ADDRESS=") - 1));
   1.161      } else {
   1.162          return NULL;
   1.163 @@ -214,19 +215,19 @@
   1.164  static char *
   1.165  IBus_GetDBusAddressFilename(void)
   1.166  {
   1.167 -    if(ibus_addr_file){
   1.168 +    if (ibus_addr_file) {
   1.169          return SDL_strdup(ibus_addr_file);
   1.170      }
   1.171      
   1.172      SDL_DBusContext *dbus = SDL_DBus_GetContext();
   1.173      
   1.174 -    if(!dbus){
   1.175 +    if (!dbus) {
   1.176          return NULL;
   1.177      }
   1.178      
   1.179      /* Use this environment variable if it exists. */
   1.180      const char *addr = SDL_getenv("IBUS_ADDRESS");
   1.181 -    if(addr && *addr){
   1.182 +    if (addr && *addr) {
   1.183          return SDL_strdup(addr);
   1.184      }
   1.185      
   1.186 @@ -235,7 +236,7 @@
   1.187      const char *disp_env = SDL_getenv("DISPLAY");
   1.188      char *display = NULL;
   1.189      
   1.190 -    if(!disp_env || !*disp_env){
   1.191 +    if (!disp_env || !*disp_env) {
   1.192          display = SDL_strdup(":0.0");
   1.193      } else {
   1.194          display = SDL_strdup(disp_env);
   1.195 @@ -245,7 +246,7 @@
   1.196      char *disp_num   = SDL_strrchr(display, ':'), 
   1.197           *screen_num = SDL_strrchr(display, '.');
   1.198      
   1.199 -    if(!disp_num){
   1.200 +    if (!disp_num) {
   1.201          SDL_free(display);
   1.202          return NULL;
   1.203      }
   1.204 @@ -253,11 +254,11 @@
   1.205      *disp_num = 0;
   1.206      disp_num++;
   1.207      
   1.208 -    if(screen_num){
   1.209 +    if (screen_num) {
   1.210          *screen_num = 0;
   1.211      }
   1.212      
   1.213 -    if(!*host){
   1.214 +    if (!*host) {
   1.215          host = "unix";
   1.216      }
   1.217          
   1.218 @@ -265,11 +266,11 @@
   1.219      SDL_memset(config_dir, 0, sizeof(config_dir));
   1.220      
   1.221      const char *conf_env = SDL_getenv("XDG_CONFIG_HOME");
   1.222 -    if(conf_env && *conf_env){
   1.223 +    if (conf_env && *conf_env) {
   1.224          SDL_strlcpy(config_dir, conf_env, sizeof(config_dir));
   1.225      } else {
   1.226          const char *home_env = SDL_getenv("HOME");
   1.227 -        if(!home_env || !*home_env){
   1.228 +        if (!home_env || !*home_env) {
   1.229              SDL_free(display);
   1.230              return NULL;
   1.231          }
   1.232 @@ -296,15 +297,15 @@
   1.233  {
   1.234      SDL_DBusContext *dbus = SDL_DBus_GetContext();
   1.235      
   1.236 -    if(IBus_CheckConnection(dbus)){
   1.237 +    if (IBus_CheckConnection(dbus)) {
   1.238  
   1.239          DBusMessage *msg = dbus->message_new_method_call(IBUS_SERVICE,
   1.240                                                           input_ctx_path,
   1.241                                                           IBUS_INPUT_INTERFACE,
   1.242                                                           "SetCapabilities");
   1.243 -        if(msg){
   1.244 +        if (msg) {
   1.245              Uint32 caps = IBUS_CAP_FOCUS;
   1.246 -            if(!(internal_editing && *internal_editing == '1')){
   1.247 +            if (!(internal_editing && *internal_editing == '1')) {
   1.248                  caps |= IBUS_CAP_PREEDIT_TEXT;
   1.249              }
   1.250              
   1.251 @@ -313,8 +314,8 @@
   1.252                                        DBUS_TYPE_INVALID);
   1.253          }
   1.254          
   1.255 -        if(msg){
   1.256 -            if(dbus->connection_send(ibus_conn, msg, NULL)){
   1.257 +        if (msg) {
   1.258 +            if (dbus->connection_send(ibus_conn, msg, NULL)) {
   1.259                  dbus->connection_flush(ibus_conn);
   1.260              }
   1.261              dbus->message_unref(msg);
   1.262 @@ -331,13 +332,13 @@
   1.263      
   1.264      ibus_conn = dbus->connection_open_private(addr, NULL);
   1.265  
   1.266 -    if(!ibus_conn){
   1.267 +    if (!ibus_conn) {
   1.268          return SDL_FALSE;
   1.269      }
   1.270  
   1.271      dbus->connection_flush(ibus_conn);
   1.272      
   1.273 -    if(!dbus->bus_register(ibus_conn, NULL)){
   1.274 +    if (!dbus->bus_register(ibus_conn, NULL)) {
   1.275          ibus_conn = NULL;
   1.276          return SDL_FALSE;
   1.277      }
   1.278 @@ -348,22 +349,22 @@
   1.279                                                       IBUS_PATH,
   1.280                                                       IBUS_INTERFACE,
   1.281                                                       "CreateInputContext");
   1.282 -    if(msg){
   1.283 +    if (msg) {
   1.284          const char *client_name = "SDL2_Application";
   1.285          dbus->message_append_args(msg,
   1.286                                    DBUS_TYPE_STRING, &client_name,
   1.287                                    DBUS_TYPE_INVALID);
   1.288      }
   1.289      
   1.290 -    if(msg){
   1.291 +    if (msg) {
   1.292          DBusMessage *reply;
   1.293          
   1.294          reply = dbus->connection_send_with_reply_and_block(ibus_conn, msg, 1000, NULL);
   1.295 -        if(reply){
   1.296 -            if(dbus->message_get_args(reply, NULL,
   1.297 +        if (reply) {
   1.298 +            if (dbus->message_get_args(reply, NULL,
   1.299                                         DBUS_TYPE_OBJECT_PATH, &path,
   1.300 -                                       DBUS_TYPE_INVALID)){
   1.301 -                if(input_ctx_path){
   1.302 +                                       DBUS_TYPE_INVALID)) {
   1.303 +                if (input_ctx_path) {
   1.304                      SDL_free(input_ctx_path);
   1.305                  }
   1.306                  input_ctx_path = SDL_strdup(path);
   1.307 @@ -374,7 +375,7 @@
   1.308          dbus->message_unref(msg);
   1.309      }
   1.310  
   1.311 -    if(result){
   1.312 +    if (result) {
   1.313          SDL_AddHintCallback(SDL_HINT_IME_INTERNAL_EDITING, &IBus_SetCapabilities, NULL);
   1.314          
   1.315          dbus->bus_add_match(ibus_conn, "type='signal',interface='org.freedesktop.IBus.InputContext'", NULL);
   1.316 @@ -391,27 +392,27 @@
   1.317  static SDL_bool
   1.318  IBus_CheckConnection(SDL_DBusContext *dbus)
   1.319  {
   1.320 -    if(!dbus) return SDL_FALSE;
   1.321 +    if (!dbus) return SDL_FALSE;
   1.322      
   1.323 -    if(ibus_conn && dbus->connection_get_is_connected(ibus_conn)){
   1.324 +    if (ibus_conn && dbus->connection_get_is_connected(ibus_conn)) {
   1.325          return SDL_TRUE;
   1.326      }
   1.327      
   1.328 -    if(inotify_fd > 0 && inotify_wd > 0){
   1.329 +    if (inotify_fd > 0 && inotify_wd > 0) {
   1.330          char buf[1024];
   1.331          ssize_t readsize = read(inotify_fd, buf, sizeof(buf));
   1.332 -        if(readsize > 0){
   1.333 +        if (readsize > 0) {
   1.334          
   1.335              char *p;
   1.336              SDL_bool file_updated = SDL_FALSE;
   1.337              
   1.338 -            for(p = buf; p < buf + readsize; /**/){
   1.339 +            for (p = buf; p < buf + readsize; /**/) {
   1.340                  struct inotify_event *event = (struct inotify_event*) p;
   1.341 -                if(event->len > 0){
   1.342 +                if (event->len > 0) {
   1.343                      char *addr_file_no_path = SDL_strrchr(ibus_addr_file, '/');
   1.344 -                    if(!addr_file_no_path) return SDL_FALSE;
   1.345 +                    if (!addr_file_no_path) return SDL_FALSE;
   1.346                   
   1.347 -                    if(SDL_strcmp(addr_file_no_path + 1, event->name) == 0){
   1.348 +                    if (SDL_strcmp(addr_file_no_path + 1, event->name) == 0) {
   1.349                          file_updated = SDL_TRUE;
   1.350                          break;
   1.351                      }
   1.352 @@ -420,9 +421,9 @@
   1.353                  p += sizeof(struct inotify_event) + event->len;
   1.354              }
   1.355              
   1.356 -            if(file_updated){
   1.357 +            if (file_updated) {
   1.358                  char *addr = IBus_ReadAddressFromFile(ibus_addr_file);
   1.359 -                if(addr){
   1.360 +                if (addr) {
   1.361                      SDL_bool result = IBus_SetupConnection(dbus, addr);
   1.362                      SDL_free(addr);
   1.363                      return result;
   1.364 @@ -440,9 +441,9 @@
   1.365      SDL_bool result = SDL_FALSE;
   1.366      SDL_DBusContext *dbus = SDL_DBus_GetContext();
   1.367      
   1.368 -    if(dbus){
   1.369 +    if (dbus) {
   1.370          char *addr_file = IBus_GetDBusAddressFilename();
   1.371 -        if(!addr_file){
   1.372 +        if (!addr_file) {
   1.373              return SDL_FALSE;
   1.374          }
   1.375          
   1.376 @@ -450,13 +451,13 @@
   1.377          
   1.378          char *addr = IBus_ReadAddressFromFile(addr_file);
   1.379          
   1.380 -        if(inotify_fd < 0){
   1.381 +        if (inotify_fd < 0) {
   1.382              inotify_fd = inotify_init();
   1.383              fcntl(inotify_fd, F_SETFL, O_NONBLOCK);
   1.384          }
   1.385          
   1.386          char *addr_file_dir = SDL_strrchr(addr_file, '/');
   1.387 -        if(addr_file_dir){
   1.388 +        if (addr_file_dir) {
   1.389              *addr_file_dir = 0;
   1.390          }
   1.391          
   1.392 @@ -473,24 +474,24 @@
   1.393  void
   1.394  SDL_IBus_Quit(void)
   1.395  {   
   1.396 -    if(input_ctx_path){
   1.397 +    if (input_ctx_path) {
   1.398          SDL_free(input_ctx_path);
   1.399          input_ctx_path = NULL;
   1.400      }
   1.401      
   1.402 -    if(ibus_addr_file){
   1.403 +    if (ibus_addr_file) {
   1.404          SDL_free(ibus_addr_file);
   1.405          ibus_addr_file = NULL;
   1.406      }
   1.407      
   1.408      SDL_DBusContext *dbus = SDL_DBus_GetContext();
   1.409      
   1.410 -    if(dbus && ibus_conn){
   1.411 +    if (dbus && ibus_conn) {
   1.412          dbus->connection_close(ibus_conn);
   1.413          dbus->connection_unref(ibus_conn);
   1.414      }
   1.415      
   1.416 -    if(inotify_fd > 0 && inotify_wd > 0){
   1.417 +    if (inotify_fd > 0 && inotify_wd > 0) {
   1.418          inotify_rm_watch(inotify_fd, inotify_wd);
   1.419          inotify_wd = -1;
   1.420      }
   1.421 @@ -505,13 +506,13 @@
   1.422  {   
   1.423      SDL_DBusContext *dbus = SDL_DBus_GetContext();
   1.424      
   1.425 -    if(IBus_CheckConnection(dbus)){
   1.426 +    if (IBus_CheckConnection(dbus)) {
   1.427          DBusMessage *msg = dbus->message_new_method_call(IBUS_SERVICE,
   1.428                                                           input_ctx_path,
   1.429                                                           IBUS_INPUT_INTERFACE,
   1.430                                                           method);
   1.431 -        if(msg){
   1.432 -            if(dbus->connection_send(ibus_conn, msg, NULL)){
   1.433 +        if (msg) {
   1.434 +            if (dbus->connection_send(ibus_conn, msg, NULL)) {
   1.435                  dbus->connection_flush(ibus_conn);
   1.436              }
   1.437              dbus->message_unref(msg);
   1.438 @@ -538,12 +539,12 @@
   1.439      SDL_bool result = SDL_FALSE;   
   1.440      SDL_DBusContext *dbus = SDL_DBus_GetContext();
   1.441      
   1.442 -    if(IBus_CheckConnection(dbus)){
   1.443 +    if (IBus_CheckConnection(dbus)) {
   1.444          DBusMessage *msg = dbus->message_new_method_call(IBUS_SERVICE,
   1.445                                                           input_ctx_path,
   1.446                                                           IBUS_INPUT_INTERFACE,
   1.447                                                           "ProcessKeyEvent");
   1.448 -        if(msg){
   1.449 +        if (msg) {
   1.450              Uint32 mods = IBus_ModState();
   1.451              dbus->message_append_args(msg,
   1.452                                        DBUS_TYPE_UINT32, &keysym,
   1.453 @@ -552,14 +553,14 @@
   1.454                                        DBUS_TYPE_INVALID);
   1.455          }
   1.456          
   1.457 -        if(msg){
   1.458 +        if (msg) {
   1.459              DBusMessage *reply;
   1.460              
   1.461              reply = dbus->connection_send_with_reply_and_block(ibus_conn, msg, 300, NULL);
   1.462 -            if(reply){
   1.463 -                if(!dbus->message_get_args(reply, NULL,
   1.464 +            if (reply) {
   1.465 +                if (!dbus->message_get_args(reply, NULL,
   1.466                                             DBUS_TYPE_BOOLEAN, &result,
   1.467 -                                           DBUS_TYPE_INVALID)){
   1.468 +                                           DBUS_TYPE_INVALID)) {
   1.469                      result = SDL_FALSE;                         
   1.470                  }
   1.471                  dbus->message_unref(reply);
   1.472 @@ -577,35 +578,37 @@
   1.473  void
   1.474  SDL_IBus_UpdateTextRect(SDL_Rect *rect)
   1.475  {
   1.476 -    if(rect){
   1.477 +    if (rect) {
   1.478          SDL_memcpy(&ibus_cursor_rect, rect, sizeof(ibus_cursor_rect));
   1.479      }
   1.480      
   1.481      SDL_Window *focused_win = SDL_GetKeyboardFocus();
   1.482  
   1.483 -    if(!focused_win) return;
   1.484 -    
   1.485 +    if (!focused_win) {
   1.486 +        return;
   1.487 +    }
   1.488 +
   1.489      SDL_SysWMinfo info;
   1.490      SDL_VERSION(&info.version);
   1.491      
   1.492 -    if(!SDL_GetWindowWMInfo(focused_win, &info)) return;
   1.493 +    if (!SDL_GetWindowWMInfo(focused_win, &info)) {
   1.494 +        return;
   1.495 +    }
   1.496      
   1.497      int x = 0, y = 0;
   1.498      
   1.499      SDL_GetWindowPosition(focused_win, &x, &y);
   1.500     
   1.501  #if SDL_VIDEO_DRIVER_X11    
   1.502 -    if(info.subsystem == SDL_SYSWM_X11){
   1.503 -        SDL_DisplayData *displaydata =
   1.504 -            (SDL_DisplayData *) SDL_GetDisplayForWindow(focused_win)->driverdata;
   1.505 +    if (info.subsystem == SDL_SYSWM_X11) {
   1.506 +        SDL_DisplayData *displaydata = (SDL_DisplayData *) SDL_GetDisplayForWindow(focused_win)->driverdata;
   1.507              
   1.508          Display *x_disp = info.info.x11.display;
   1.509          Window x_win = info.info.x11.window;
   1.510          int x_screen = displaydata->screen;
   1.511          Window unused;
   1.512              
   1.513 -        X11_XTranslateCoordinates(x_disp, x_win, RootWindow(x_disp, x_screen),
   1.514 -            0, 0, &x, &y, &unused);
   1.515 +        X11_XTranslateCoordinates(x_disp, x_win, RootWindow(x_disp, x_screen), 0, 0, &x, &y, &unused);
   1.516      }
   1.517  #endif
   1.518  
   1.519 @@ -614,12 +617,12 @@
   1.520          
   1.521      SDL_DBusContext *dbus = SDL_DBus_GetContext();
   1.522      
   1.523 -    if(IBus_CheckConnection(dbus)){
   1.524 +    if (IBus_CheckConnection(dbus)) {
   1.525          DBusMessage *msg = dbus->message_new_method_call(IBUS_SERVICE,
   1.526                                                           input_ctx_path,
   1.527                                                           IBUS_INPUT_INTERFACE,
   1.528                                                           "SetCursorLocation");
   1.529 -        if(msg){
   1.530 +        if (msg) {
   1.531              dbus->message_append_args(msg,
   1.532                                        DBUS_TYPE_INT32, &x,
   1.533                                        DBUS_TYPE_INT32, &y,
   1.534 @@ -628,8 +631,8 @@
   1.535                                        DBUS_TYPE_INVALID);
   1.536          }
   1.537          
   1.538 -        if(msg){
   1.539 -            if(dbus->connection_send(ibus_conn, msg, NULL)){
   1.540 +        if (msg) {
   1.541 +            if (dbus->connection_send(ibus_conn, msg, NULL)) {
   1.542                  dbus->connection_flush(ibus_conn);
   1.543              }
   1.544              dbus->message_unref(msg);
   1.545 @@ -642,10 +645,10 @@
   1.546  {
   1.547      SDL_DBusContext *dbus = SDL_DBus_GetContext();
   1.548      
   1.549 -    if(IBus_CheckConnection(dbus)){
   1.550 +    if (IBus_CheckConnection(dbus)) {
   1.551          dbus->connection_read_write(ibus_conn, 0);
   1.552      
   1.553 -        while(dbus->connection_dispatch(ibus_conn) == DBUS_DISPATCH_DATA_REMAINS){
   1.554 +        while (dbus->connection_dispatch(ibus_conn) == DBUS_DISPATCH_DATA_REMAINS) {
   1.555              /* Do nothing, actual work happens in IBus_MessageFilter */
   1.556          }
   1.557      }