Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minimize an active window when its entry is clicked in the taskbar #234

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

MaaSTaaR
Copy link
Contributor

No description provided.

rc = wndmgt_get_window_info(entry->wndlist->wndmgt,
entry->wnd_id, &winfo);
if (rc == EOK) {
minimized = (winfo->flags & wndf_minimized) == 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that the logic is reversed w.r.t. the name of the variable: minimized will be true iff the window is not minimized

if (!minimized) {
(void) wndmgt_activate_window(entry->wndlist->wndmgt,
dev_id, entry->wnd_id);
} else {
Copy link
Contributor

@jxsvoboda jxsvoboda Jul 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now here's the big problem. If you click the button of a window that's not minimized and is not focused, instead of activating the window it will minimize it. Also note that with multiple seats, each window can have zero, one or more foci. A window should only be minimized if it is the focus of the same seat that clicked the window button. For example, you might add a WM operation to test if a particular window is focused by a particular seat (which is specified via input device ID).

(void) wndmgt_activate_window(entry->wndlist->wndmgt,
dev_id, entry->wnd_id);
} else {
(void) wndmgt_deactivate_window(entry->wndlist->wndmgt,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the operation should simply be called 'minimize', because that's what it does (this pertains to all other places too).


if (!minimized) {
(void) wndmgt_activate_window(entry->wndlist->wndmgt,
dev_id, entry->wnd_id);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The indentation is incorrect. Did you run 'make ccheck'?

@@ -47,6 +47,7 @@ extern errno_t wndmgt_get_window_info(wndmgt_t *, sysarg_t,
wndmgt_window_info_t **);
extern void wndmgt_free_window_info(wndmgt_window_info_t *);
extern errno_t wndmgt_activate_window(wndmgt_t *, sysarg_t, sysarg_t);
extern errno_t wndmgt_deactivate_window(wndmgt_t *, sysarg_t, sysarg_t);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this new operation unit tests should be added to /data/helenos/master/uspace/lib/wndmgt/test/wndmgt.c, similar to PCUT_TEST(activate_window_failure) and PCUT_TEST(activate_window_success).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants