Ignore:
Timestamp:
2014-08-12T16:49:25Z (10 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
593e023
Parents:
f6ab787
Message:

cstyle
(no change in functionality)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hid/compositor/compositor.c

    rf6ab787 rce3efa0  
    230230static void window_destroy(window_t *win)
    231231{
    232         if (win && atomic_get(&win->ref_cnt) == 0) {
     232        if ((win) && (atomic_get(&win->ref_cnt) == 0)) {
    233233                while (!list_empty(&win->queue.list)) {
    234234                        window_event_t *event = (window_event_t *) list_first(&win->queue.list);
     
    236236                        free(event);
    237237                }
    238 
    239                 if (win->surface) {
     238               
     239                if (win->surface)
    240240                        surface_destroy(win->surface);
    241                 }
     241               
    242242                free(win);
    243243        }
     
    251251        transform_invert(&win_trans);
    252252        transform_apply_affine(&win_trans, &x, &y);
    253 
    254         /* Since client coordinate origin is (0, 0), it is necessary to check
     253       
     254        /*
     255         * Since client coordinate origin is (0, 0), it is necessary to check
    255256         * coordinates to avoid underflow. Moreover, it is convenient to also
    256257         * check against provided upper limits to determine whether the converted
    257          * coordinates are within the client window.  */
    258         if (x < 0 || y < 0) {
     258         * coordinates are within the client window.
     259         */
     260        if ((x < 0) || (y < 0))
    259261                return false;
    260         } else {
    261                 (*x_out) = (sysarg_t) (x + 0.5);
    262                 (*y_out) = (sysarg_t) (y + 0.5);
    263 
    264                 if ((*x_out) >= x_lim || (*y_out) >= y_lim) {
    265                         return false;
    266                 } else {
    267                         return true;
    268                 }
    269         }
     262       
     263        (*x_out) = (sysarg_t) (x + 0.5);
     264        (*y_out) = (sysarg_t) (y + 0.5);
     265       
     266        if (((*x_out) >= x_lim) || ((*y_out) >= y_lim))
     267                return false;
     268       
     269        return true;
    270270}
    271271
     
    277277        transform_apply_affine(&win_trans, &x, &y);
    278278       
    279         /* It is assumed that compositor coordinate origin is chosen in such way,
    280          * that underflow/overflow here would be unlikely. */
     279        /*
     280         * It is assumed that compositor coordinate origin is chosen in such way,
     281         * that underflow/overflow here would be unlikely.
     282         */
    281283        (*x_out) = (sysarg_t) (x + 0.5);
    282284        (*y_out) = (sysarg_t) (y + 0.5);
     
    436438                                        transform_translate(&transform, -pos.x, -pos.y);
    437439
    438                                         source_set_transform(&source, transform);                               
     440                                        source_set_transform(&source, transform);
    439441                                        source_set_texture(&source, win->surface, false);
    440442                                        source_set_alpha(&source, PIXEL(win->opacity, 0, 0, 0));
     
    572574                    vp->sess, x_dmg_vp, y_dmg_vp, w_dmg_vp, h_dmg_vp, 0, 0);
    573575        }
    574 
     576       
    575577        fibril_mutex_unlock(&viewport_list_mtx);
    576578}
     
    588590                return;
    589591        }
     592       
    590593        int rc = async_data_read_finalize(callid, event, len);
    591594        if (rc != EOK) {
     
    594597                return;
    595598        }
     599       
    596600        async_answer_0(iid, EOK);
    597        
    598601        free(event);
    599602}
     
    606609        double height = IPC_GET_ARG4(*icall);
    607610
    608         if (width == 0 || height == 0) {
     611        if ((width == 0) || (height == 0)) {
    609612                comp_damage(0, 0, UINT32_MAX, UINT32_MAX);
    610613        } else {
     
    855858
    856859        comp_damage(x, y, width, height);
    857 
    858860        async_answer_0(iid, EOK);
    859861}
     
    861863static void comp_window_close_request(window_t *win, ipc_callid_t iid, ipc_call_t *icall)
    862864{
    863     window_event_t *event = (window_event_t *) malloc(sizeof(window_event_t));
     865        window_event_t *event = (window_event_t *) malloc(sizeof(window_event_t));
    864866        if (event == NULL) {
    865867                async_answer_0(iid, ENOMEM);
     
    10011003                                break;
    10021004                        case WINDOW_CLOSE:
    1003                                 /* Postpone the closing until the phone is hung up to cover
    1004                                  * the case when the client is killed abruptly. */
     1005                                /*
     1006                                 * Postpone the closing until the phone is hung up to cover
     1007                                 * the case when the client is killed abruptly.
     1008                                 */
    10051009                                async_answer_0(callid, EOK);
    10061010                                break;
     
    10171021static void comp_mode_change(viewport_t *vp, ipc_callid_t iid, ipc_call_t *icall)
    10181022{
    1019         int rc;
    10201023        sysarg_t mode_idx = IPC_GET_ARG2(*icall);
    10211024        fibril_mutex_lock(&viewport_list_mtx);
     
    10231026        /* Retrieve the mode that shall be set. */
    10241027        vslmode_t new_mode;
    1025         rc = visualizer_get_mode(vp->sess, &new_mode, mode_idx);
     1028        int rc = visualizer_get_mode(vp->sess, &new_mode, mode_idx);
    10261029        if (rc != EOK) {
    10271030                fibril_mutex_unlock(&viewport_list_mtx);
     
    10411044        /* Try to set the mode and share out the surface. */
    10421045        rc = visualizer_set_mode(vp->sess,
    1043                 new_mode.index, new_mode.version, surface_direct_access(new_surface));
     1046            new_mode.index, new_mode.version, surface_direct_access(new_surface));
    10441047        if (rc != EOK) {
    10451048                surface_destroy(new_surface);
     
    10751078        /* Release viewport resources. */
    10761079        fibril_mutex_lock(&viewport_list_mtx);
     1080       
    10771081        list_remove(&vp->link);
    10781082        viewport_destroy(vp);
    1079 
     1083       
    10801084        /* Terminate compositor if there are no more viewports. */
    10811085        if (list_empty(&viewport_list)) {
     
    11201124        fibril_mutex_unlock(&viewport_list_mtx);
    11211125
    1122         if (!vp) {
     1126        if (!vp)
    11231127                return;
    1124         }
    11251128
    11261129        /* Ignore parameters, the connection is already opened. */
     
    12231226        /* Try to set the mode and share out the surface. */
    12241227        rc = visualizer_set_mode(vp->sess,
    1225                 vp->mode.index, vp->mode.version, surface_direct_access(vp->surface));
     1228            vp->mode.index, vp->mode.version, surface_direct_access(vp->surface));
    12261229        if (rc != EOK) {
    12271230                printf("%s: Unable to set mode (%s)\n", NAME, str_error(rc));
     
    12331236        if (claimed)
    12341237                visualizer_yield(vp->sess);
     1238       
    12351239        if (vp->sess != NULL)
    12361240                async_hangup(vp->sess);
     1241       
    12371242        free(vp);
    12381243        free(vsl_name);
     
    21962201        /* Register compositor server. */
    21972202        async_set_client_connection(client_connection);
     2203       
    21982204        int rc = loc_server_register(NAME);
    21992205        if (rc != EOK) {
     
    22292235                return -1;
    22302236        }
    2231 
     2237       
    22322238        /* Establish input bidirectional connection. */
    22332239        rc = input_connect(input_svc);
     
    22362242                return rc;
    22372243        }
    2238 
     2244       
    22392245        rc = loc_register_cat_change_cb(category_change_cb);
    22402246        if (rc != EOK) {
     
    22432249                return rc;
    22442250        }       
    2245 
     2251       
    22462252        rc = discover_viewports();
    22472253        if (rc != EOK) {
     
    22552261                return -1;
    22562262        }
    2257 
     2263       
    22582264        comp_restrict_pointers();
    22592265        comp_damage(0, 0, UINT32_MAX, UINT32_MAX);
    2260        
    22612266       
    22622267        return EOK;
Note: See TracChangeset for help on using the changeset viewer.