Changeset 6baab83 in mainline for uspace/srv/hid/display/dsops.c


Ignore:
Timestamp:
2021-05-27T17:00:30Z (3 years ago)
Author:
Jiri Svoboda <jiri@…>
Children:
b4b4dafe
Parents:
f2416ec3
Message:

Set menu popup position based on parent window position

Added a method for getting the position of a display window.
This is then combined with the menu bar entry rectangle (which is
relative to the parent window) to compute a screen-relative
rectangle close to which the popup should be placed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hid/display/dsops.c

    rf2416ec3 r6baab83  
    4848static errno_t disp_window_move_req(void *, sysarg_t, gfx_coord2_t *);
    4949static errno_t disp_window_move(void *, sysarg_t, gfx_coord2_t *);
     50static errno_t disp_window_get_pos(void *, sysarg_t, gfx_coord2_t *);
    5051static errno_t disp_window_resize_req(void *, sysarg_t,
    5152    display_wnd_rsztype_t, gfx_coord2_t *);
     
    6162        .window_move_req = disp_window_move_req,
    6263        .window_move = disp_window_move,
     64        .window_get_pos = disp_window_get_pos,
    6365        .window_resize_req = disp_window_resize_req,
    6466        .window_resize = disp_window_resize,
     
    162164}
    163165
     166static errno_t disp_window_get_pos(void *arg, sysarg_t wnd_id,
     167    gfx_coord2_t *pos)
     168{
     169        ds_client_t *client = (ds_client_t *) arg;
     170        ds_window_t *wnd;
     171
     172        ds_display_lock(client->display);
     173
     174        wnd = ds_client_find_window(client, wnd_id);
     175        if (wnd == NULL) {
     176                ds_display_unlock(client->display);
     177                return ENOENT;
     178        }
     179
     180        log_msg(LOG_DEFAULT, LVL_DEBUG, "disp_window_get_pos()");
     181        ds_window_get_pos(wnd, pos);
     182        ds_display_unlock(client->display);
     183        return EOK;
     184}
     185
    164186static errno_t disp_window_resize_req(void *arg, sysarg_t wnd_id,
    165187    display_wnd_rsztype_t rsztype, gfx_coord2_t *pos)
Note: See TracChangeset for help on using the changeset viewer.