Changeset a6492460 in mainline


Ignore:
Timestamp:
2022-11-09T16:17:59Z (18 months ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
88d828e
Parents:
54593f3
Message:

Pass ID of device that clicked the window button to activate window

To ensure the correct seat's focus is switched.

Location:
uspace
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/taskbar/taskbar.c

    r54593f3 ra6492460  
    3434
    3535#include <gfx/coord.h>
     36#include <io/pos_event.h>
    3637#include <stdio.h>
    3738#include <stdlib.h>
     
    4748#include "wndlist.h"
    4849
    49 static void wnd_close(ui_window_t *, void *);
     50static void taskbar_wnd_close(ui_window_t *, void *);
     51static void taskbar_wnd_pos(ui_window_t *, void *, pos_event_t *);
    5052
    5153static ui_window_cb_t window_cb = {
    52         .close = wnd_close
     54        .close = taskbar_wnd_close,
     55        .pos = taskbar_wnd_pos
    5356};
    5457
     
    5861 * @param arg Argument (taskbar)
    5962 */
    60 static void wnd_close(ui_window_t *window, void *arg)
     63static void taskbar_wnd_close(ui_window_t *window, void *arg)
    6164{
    6265        taskbar_t *taskbar = (taskbar_t *) arg;
    6366
    6467        ui_quit(taskbar->ui);
     68}
     69
     70/** Window received position event.
     71 *
     72 * @param window Window
     73 * @param arg Argument (taskbar)
     74 * @param event Position event
     75 */
     76static void taskbar_wnd_pos(ui_window_t *window, void *arg, pos_event_t *event)
     77{
     78        taskbar_t *taskbar = (taskbar_t *) arg;
     79
     80        /* Remember ID of device that sent the last event */
     81        taskbar->wndlist->ev_pos_id = event->pos_id;
     82
     83        ui_window_def_pos(window, event);
    6584}
    6685
     
    130149        }
    131150
    132         ui_window_set_cb(taskbar->window, &window_cb, (void *) &taskbar);
     151        ui_window_set_cb(taskbar->window, &window_cb, (void *)taskbar);
    133152        ui_res = ui_window_get_res(taskbar->window);
    134153
  • uspace/app/taskbar/types/taskbar.h

    r54593f3 ra6492460  
    3737#define TYPES_TASKBAR_H
    3838
     39#include <types/common.h>
    3940#include <ui/fixed.h>
    4041#include <ui/label.h>
  • uspace/app/taskbar/types/wndlist.h

    r54593f3 ra6492460  
    7575        /** Window management service */
    7676        wndmgt_t *wndmgt;
     77
     78        /** Position ID of last position event */
     79        sysarg_t ev_pos_id;
    7780} wndlist_t;
    7881
  • uspace/app/taskbar/wndlist.c

    r54593f3 ra6492460  
    448448 *
    449449 * @param pbutton Push button
    450  * @param arg Argument (wdnlist_entry_t *)
     450 * @param arg Argument (wndlist_entry_t *)
    451451 */
    452452static void wndlist_button_clicked(ui_pbutton_t *pbutton, void *arg)
    453453{
    454454        wndlist_entry_t *entry = (wndlist_entry_t *)arg;
    455         sysarg_t seat_id;
    456 
    457         seat_id = 0; // TODO Multi-seat
     455        sysarg_t dev_id;
     456
     457        /* ID of device that clicked the button */
     458        dev_id = entry->wndlist->ev_pos_id;
    458459
    459460        (void) wndmgt_activate_window(entry->wndlist->wndmgt,
    460             seat_id, entry->wnd_id);
     461            dev_id, entry->wnd_id);
    461462}
    462463
  • uspace/lib/wndmgt/src/wndmgt.c

    r54593f3 ra6492460  
    287287 *
    288288 * @param wndmgt Window management session
    289  * @param seat_id Seat ID
     289 * @param dev_id ID of input device belonging to seat whose
     290 *               focus is to be switched
    290291 * @param wnd_id Window ID
    291292 * @return EOK on success or an error code
    292293 */
    293 errno_t wndmgt_activate_window(wndmgt_t *wndmgt, sysarg_t seat_id,
     294errno_t wndmgt_activate_window(wndmgt_t *wndmgt, sysarg_t dev_id,
    294295    sysarg_t wnd_id)
    295296{
     
    298299
    299300        exch = async_exchange_begin(wndmgt->sess);
    300         rc = async_req_2_0(exch, WNDMGT_ACTIVATE_WINDOW, seat_id,
     301        rc = async_req_2_0(exch, WNDMGT_ACTIVATE_WINDOW, dev_id,
    301302            wnd_id);
    302303
  • uspace/lib/wndmgt/src/wndmgt_srv.c

    r54593f3 ra6492460  
    204204static void wndmgt_activate_window_srv(wndmgt_srv_t *srv, ipc_call_t *icall)
    205205{
    206         sysarg_t seat_id;
     206        sysarg_t dev_id;
    207207        sysarg_t wnd_id;
    208208        errno_t rc;
    209209
    210         seat_id = ipc_get_arg1(icall);
     210        dev_id = ipc_get_arg1(icall);
    211211        wnd_id = ipc_get_arg2(icall);
    212212
     
    216216        }
    217217
    218         rc = srv->ops->activate_window(srv->arg, seat_id, wnd_id);
     218        rc = srv->ops->activate_window(srv->arg, dev_id, wnd_id);
    219219        async_answer_0(icall, rc);
    220220}
  • uspace/srv/hid/display/wmops.c

    r54593f3 ra6492460  
    151151 *
    152152 * @param arg Argument (WM client)
    153  * @param seat_id Seat ID
     153 * @param dev_id Input device ID
    154154 * @param wnd_id Window ID
    155155 * @return EOK on success or an error code
    156156 */
    157 static errno_t dispwm_activate_window(void *arg, sysarg_t seat_id,
     157static errno_t dispwm_activate_window(void *arg, sysarg_t dev_id,
    158158    sysarg_t wnd_id)
    159159{
     
    172172
    173173        // TODO Multi-seat
    174         (void) seat_id;
     174        (void) dev_id;
    175175        seat = ds_display_first_seat(wnd->display);
    176176
Note: See TracChangeset for help on using the changeset viewer.