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


Ignore:
Timestamp:
2020-03-18T17:27:18Z (5 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0680854
Parents:
1a1271d
git-author:
Jiri Svoboda <jiri@…> (2020-03-18 16:57:15)
git-committer:
Jiri Svoboda <jiri@…> (2020-03-18 17:27:18)
Message:

Allow getting display dimensions

Can be used to position special windows such as panels, or to help
emulate libgui's window placement policy. To support multi-monitor
setups we would rather need to be able to query individual monitors.
But let's keep things simple for now.

File:
1 edited

Legend:

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

    r1a1271d raeb3037  
    3737#include <disp_srv.h>
    3838#include <display/event.h>
     39#include <display/info.h>
    3940#include <display/wndresize.h>
    4041#include <errno.h>
     
    268269}
    269270
     271static void display_get_info_srv(display_srv_t *srv, ipc_call_t *icall)
     272{
     273        display_info_t info;
     274        ipc_call_t call;
     275        size_t size;
     276        errno_t rc;
     277
     278        if (srv->ops->get_info == NULL) {
     279                async_answer_0(icall, ENOTSUP);
     280                return;
     281        }
     282
     283        /* Transfer information */
     284        if (!async_data_read_receive(&call, &size)) {
     285                async_answer_0(icall, EREFUSED);
     286                return;
     287        }
     288
     289        if (size != sizeof(info)) {
     290                async_answer_0(icall, EREFUSED);
     291                async_answer_0(&call, EREFUSED);
     292                return;
     293        }
     294
     295        rc = srv->ops->get_info(srv->arg, &info);
     296        if (rc != EOK) {
     297                async_answer_0(icall, rc);
     298                async_answer_0(&call, rc);
     299                return;
     300        }
     301
     302        rc = async_data_read_finalize(&call, &info, sizeof(info));
     303        if (rc != EOK) {
     304                async_answer_0(icall, rc);
     305                async_answer_0(&call, rc);
     306                return;
     307        }
     308
     309        async_answer_0(icall, EOK);
     310}
     311
    270312void display_conn(ipc_call_t *icall, display_srv_t *srv)
    271313{
     
    306348                case DISPLAY_GET_EVENT:
    307349                        display_get_event_srv(srv, &call);
     350                        break;
     351                case DISPLAY_GET_INFO:
     352                        display_get_info_srv(srv, &call);
    308353                        break;
    309354                default:
Note: See TracChangeset for help on using the changeset viewer.