Changeset 8eeffc1 in mainline


Ignore:
Timestamp:
2024-06-29T00:49:17Z (5 months ago)
Author:
Mohammed Q. Hussain <maastaar@…>
Children:
9a664b6d
Parents:
af3235d
Message:

Minimize an activated window when its name is clicked from taskbar

Location:
uspace
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/taskbar/types/wndlist.h

    raf3235d r8eeffc1  
    5959        /** Window button rectangle */
    6060        gfx_rect_t rect;
     61        /** Window maximized **/
     62        bool maximized;
    6163} wndlist_entry_t;
    6264
  • uspace/app/taskbar/wndlist.c

    raf3235d r8eeffc1  
    232232
    233233        entry->visible = false;
     234        entry->maximized = true;
    234235
    235236        ui_pbutton_set_light(entry->button, active);
     
    722723        dev_id = entry->wndlist->ev_idev_id;
    723724
    724         (void) wndmgt_activate_window(entry->wndlist->wndmgt,
    725             dev_id, entry->wnd_id);
     725        if (!entry->maximized) {
     726                (void) wndmgt_activate_window(entry->wndlist->wndmgt,
     727                dev_id, entry->wnd_id);
     728
     729                entry->maximized = true;
     730        } else {
     731                (void) wndmgt_deactivate_window(entry->wndlist->wndmgt,
     732                dev_id, entry->wnd_id);
     733
     734                entry->maximized = false;
     735        }
    726736}
    727737
  • uspace/lib/wndmgt/include/ipc/wndmgt.h

    raf3235d r8eeffc1  
    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

    raf3235d r8eeffc1  
    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

    raf3235d r8eeffc1  
    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

    raf3235d r8eeffc1  
    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

    raf3235d r8eeffc1  
    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

    raf3235d r8eeffc1  
    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.