Changeset 3a6d44b7 in mainline for uspace/srv/hid/display/wmops.c


Ignore:
Timestamp:
2022-11-07T17:42:51Z (16 months ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
60ebe63
Parents:
f1f433d
Message:

Activate window by pushing window button on taskbar

Note that with multiple seats, one would need to know which seat pushed
the button and set the appropriate focus.

File:
1 edited

Legend:

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

    rf1f433d r3a6d44b7  
    4040#include <wndmgt_srv.h>
    4141#include "display.h"
     42#include "seat.h"
    4243#include "wmclient.h"
    4344
    4445static errno_t dispwm_get_window_list(void *, wndmgt_window_list_t **);
    4546static errno_t dispwm_get_window_info(void *, sysarg_t, wndmgt_window_info_t **);
    46 static errno_t dispwm_activate_window(void *, sysarg_t);
     47static errno_t dispwm_activate_window(void *, sysarg_t, sysarg_t);
    4748static errno_t dispwm_close_window(void *, sysarg_t);
    4849static errno_t dispwm_get_event(void *, wndmgt_ev_t *);
     
    150151 *
    151152 * @param arg Argument (WM client)
     153 * @param seat_id Seat ID
    152154 * @param wnd_id Window ID
    153155 * @return EOK on success or an error code
    154156 */
    155 static errno_t dispwm_activate_window(void *arg, sysarg_t wnd_id)
    156 {
     157static errno_t dispwm_activate_window(void *arg, sysarg_t seat_id,
     158    sysarg_t wnd_id)
     159{
     160        ds_wmclient_t *wmclient = (ds_wmclient_t *)arg;
     161        ds_window_t *wnd;
     162        ds_seat_t *seat;
     163
    157164        log_msg(LOG_DEFAULT, LVL_DEBUG, "dispwm_activate_window()");
    158         (void)arg;
    159         (void)wnd_id;
     165
     166        ds_display_lock(wmclient->display);
     167        wnd = ds_display_find_window(wmclient->display, wnd_id);
     168        if (wnd == NULL) {
     169                ds_display_unlock(wmclient->display);
     170                return ENOENT;
     171        }
     172
     173        // TODO Multi-seat
     174        (void) seat_id;
     175        seat = ds_display_first_seat(wnd->display);
     176
     177        /* Switch focus */
     178        ds_seat_set_focus(seat, wnd);
     179
     180        ds_display_unlock(wmclient->display);
    160181        return EOK;
    161182}
Note: See TracChangeset for help on using the changeset viewer.