Changeset a2e104e in mainline for uspace/lib/display/src/disp_srv.c


Ignore:
Timestamp:
2020-03-05T11:23:41Z (5 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1e4a937
Parents:
338d0935
git-author:
Jiri Svoboda <jiri@…> (2020-03-04 19:23:29)
git-committer:
Jiri Svoboda <jiri@…> (2020-03-05 11:23:41)
Message:

Move windows by dragging decoration

Or dragging anywhere with button 2. Need to add Ctrl/Alt/Shift state
to pos_event_t and change the latter to Alt-drag/Shift-drag.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/display/src/disp_srv.c

    r338d0935 ra2e104e  
    100100        wnd_id = ipc_get_arg1(icall);
    101101
    102         if (srv->ops->window_create == NULL) {
     102        if (srv->ops->window_destroy == NULL) {
    103103                async_answer_0(icall, ENOTSUP);
    104104                return;
     
    106106
    107107        rc = srv->ops->window_destroy(srv->arg, wnd_id);
     108        async_answer_0(icall, rc);
     109}
     110
     111static void display_window_move_req_srv(display_srv_t *srv, ipc_call_t *icall)
     112{
     113        sysarg_t wnd_id;
     114        ipc_call_t call;
     115        gfx_coord2_t pos;
     116        size_t size;
     117        errno_t rc;
     118
     119        wnd_id = ipc_get_arg1(icall);
     120
     121        if (!async_data_write_receive(&call, &size)) {
     122                async_answer_0(&call, EREFUSED);
     123                async_answer_0(icall, EREFUSED);
     124                return;
     125        }
     126
     127        if (size != sizeof(gfx_coord2_t)) {
     128                async_answer_0(&call, EINVAL);
     129                async_answer_0(icall, EINVAL);
     130                return;
     131        }
     132
     133        rc = async_data_write_finalize(&call, &pos, size);
     134        if (rc != EOK) {
     135                async_answer_0(&call, rc);
     136                async_answer_0(icall, rc);
     137                return;
     138        }
     139
     140        if (srv->ops->window_move_req == NULL) {
     141                async_answer_0(icall, ENOTSUP);
     142                return;
     143        }
     144
     145        rc = srv->ops->window_move_req(srv->arg, wnd_id, &pos);
    108146        async_answer_0(icall, rc);
    109147}
     
    215253                case DISPLAY_WINDOW_DESTROY:
    216254                        display_window_destroy_srv(srv, &call);
     255                        break;
     256                case DISPLAY_WINDOW_MOVE_REQ:
     257                        display_window_move_req_srv(srv, &call);
    217258                        break;
    218259                case DISPLAY_WINDOW_RESIZE:
Note: See TracChangeset for help on using the changeset viewer.