Changeset a6492460 in mainline for uspace/app/taskbar


Ignore:
Timestamp:
2022-11-09T16:17:59Z (3 years 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/app/taskbar
Files:
4 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
Note: See TracChangeset for help on using the changeset viewer.