Changeset 78376a43 in mainline


Ignore:
Timestamp:
2024-10-06T15:08:29Z (6 weeks ago)
Author:
GitHub <noreply@…>
Parents:
c7ecd290 (diff), 9a664b6d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Mohammed Q. Hussain <maastaar@…> (2024-10-06 15:08:29)
git-committer:
GitHub <noreply@…> (2024-10-06 15:08:29)
Message:

Merge 9a664b6dd10624fd8da3c9a74ecc75ab40ba4863 into c7ecd290f693e7f9f29a2d321c3981c90695a028

Location:
uspace
Files:
7 edited

Legend:

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

    rc7ecd290 r78376a43  
    717717{
    718718        wndlist_entry_t *entry = (wndlist_entry_t *)arg;
     719        wndmgt_window_info_t *winfo = NULL;
    719720        sysarg_t dev_id;
     721        errno_t rc;
     722        bool minimized = false;
    720723
    721724        /* ID of device that clicked the button */
    722725        dev_id = entry->wndlist->ev_idev_id;
    723726
    724         (void) wndmgt_activate_window(entry->wndlist->wndmgt,
    725             dev_id, entry->wnd_id);
     727        rc = wndmgt_get_window_info(entry->wndlist->wndmgt,
     728            entry->wnd_id, &winfo);
     729        if (rc == EOK) {
     730                minimized = (winfo->flags & wndf_minimized) == 0;
     731        }
     732
     733        if (!minimized) {
     734                (void) wndmgt_activate_window(entry->wndlist->wndmgt,
     735                dev_id, entry->wnd_id);
     736        } else {
     737                (void) wndmgt_deactivate_window(entry->wndlist->wndmgt,
     738                dev_id, entry->wnd_id);
     739        }
    726740}
    727741
  • uspace/lib/wndmgt/include/ipc/wndmgt.h

    rc7ecd290 r78376a43  
    4343        WNDMGT_GET_WINDOW_INFO,
    4444        WNDMGT_ACTIVATE_WINDOW,
     45        WNDMGT_DEACTIVATE_WINDOW,
    4546        WNDMGT_CLOSE_WINDOW,
    4647        WNDMGT_GET_EVENT,
  • uspace/lib/wndmgt/include/wndmgt.h

    rc7ecd290 r78376a43  
    4848extern void wndmgt_free_window_info(wndmgt_window_info_t *);
    4949extern errno_t wndmgt_activate_window(wndmgt_t *, sysarg_t, sysarg_t);
     50extern errno_t wndmgt_deactivate_window(wndmgt_t *, sysarg_t, sysarg_t);
    5051extern errno_t wndmgt_close_window(wndmgt_t *, sysarg_t);
    5152
  • uspace/lib/wndmgt/include/wndmgt_srv.h

    rc7ecd290 r78376a43  
    5353        errno_t (*get_window_info)(void *, sysarg_t, wndmgt_window_info_t **);
    5454        errno_t (*activate_window)(void *, sysarg_t, sysarg_t);
     55        errno_t (*deactivate_window)(void *, sysarg_t, sysarg_t);
    5556        errno_t (*close_window)(void *, sysarg_t);
    5657        errno_t (*get_event)(void *, wndmgt_ev_t *);
  • uspace/lib/wndmgt/src/wndmgt.c

    rc7ecd290 r78376a43  
    308308}
    309309
     310/** Deactivate (minimize) window.
     311 *
     312 * @param wndmgt Window management session
     313 * @param dev_id ID of input device belonging to seat whose
     314 *               focus is to be switched
     315 * @param wnd_id Window ID
     316 * @return EOK on success or an error code
     317 */
     318errno_t wndmgt_deactivate_window(wndmgt_t *wndmgt, sysarg_t dev_id,
     319    sysarg_t wnd_id)
     320{
     321        async_exch_t *exch;
     322        errno_t rc;
     323
     324        exch = async_exchange_begin(wndmgt->sess);
     325        rc = async_req_2_0(exch, WNDMGT_DEACTIVATE_WINDOW, dev_id,
     326            wnd_id);
     327
     328        async_exchange_end(exch);
     329        return rc;
     330}
     331
    310332/** Close window.
    311333 *
  • uspace/lib/wndmgt/src/wndmgt_srv.c

    rc7ecd290 r78376a43  
    222222}
    223223
     224static void wndmgt_deactivate_window_srv(wndmgt_srv_t *srv, ipc_call_t *icall)
     225{
     226        sysarg_t dev_id;
     227        sysarg_t wnd_id;
     228        errno_t rc;
     229
     230        dev_id = ipc_get_arg1(icall);
     231        wnd_id = ipc_get_arg2(icall);
     232
     233        if (srv->ops->deactivate_window == NULL) {
     234                async_answer_0(icall, ENOTSUP);
     235                return;
     236        }
     237
     238        rc = srv->ops->deactivate_window(srv->arg, dev_id, wnd_id);
     239        async_answer_0(icall, rc);
     240}
     241
    224242static void wndmgt_close_window_srv(wndmgt_srv_t *srv, ipc_call_t *icall)
    225243{
     
    308326                case WNDMGT_ACTIVATE_WINDOW:
    309327                        wndmgt_activate_window_srv(srv, &call);
     328                        break;
     329                case WNDMGT_DEACTIVATE_WINDOW:
     330                        wndmgt_deactivate_window_srv(srv, &call);
    310331                        break;
    311332                case WNDMGT_CLOSE_WINDOW:
  • uspace/srv/hid/display/wmops.c

    rc7ecd290 r78376a43  
    4747static errno_t dispwm_get_window_info(void *, sysarg_t, wndmgt_window_info_t **);
    4848static errno_t dispwm_activate_window(void *, sysarg_t, sysarg_t);
     49static errno_t dispwm_deactivate_window(void *, sysarg_t, sysarg_t);
    4950static errno_t dispwm_close_window(void *, sysarg_t);
    5051static errno_t dispwm_get_event(void *, wndmgt_ev_t *);
     
    5455        .get_window_info = dispwm_get_window_info,
    5556        .activate_window = dispwm_activate_window,
     57        .deactivate_window = dispwm_deactivate_window,
    5658        .close_window = dispwm_close_window,
    5759        .get_event = dispwm_get_event,
     
    189191}
    190192
     193/** Deactivate (minimize) window.
     194 *
     195 * @param arg Argument (WM client)
     196 * @param dev_id Input device ID
     197 * @param wnd_id Window ID
     198 * @return EOK on success or an error code
     199 */
     200static errno_t dispwm_deactivate_window(void *arg, sysarg_t dev_id,
     201    sysarg_t wnd_id)
     202{
     203        ds_wmclient_t *wmclient = (ds_wmclient_t *)arg;
     204        ds_window_t *wnd;
     205
     206        log_msg(LOG_DEFAULT, LVL_DEBUG, "dispwm_deactivate_window()");
     207
     208        ds_display_lock(wmclient->display);
     209        wnd = ds_display_find_window(wmclient->display, wnd_id);
     210        if (wnd == NULL) {
     211                ds_display_unlock(wmclient->display);
     212                return ENOENT;
     213        }
     214
     215        ds_window_minimize(wnd);
     216
     217        ds_display_unlock(wmclient->display);
     218        return EOK;
     219}
     220
    191221/** Close window.
    192222 *
Note: See TracChangeset for help on using the changeset viewer.