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

Change workspace with mouse wheel #752

Merged
merged 3 commits into from
Jul 16, 2016
Merged

Conversation

deklov
Copy link
Contributor

@deklov deklov commented Jul 14, 2016

No description provided.

static void mouse_scroll_notify(struct window *window, enum scroll_direction direction) {
sway_log(L_DEBUG, "Mouse wheel scrolled %s", direction == SCROLL_UP ? "up" : "down");

const char *workspace_name = direction == SCROLL_UP ? "prev" : "next";
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure what the correct behavior is here: prev vs. prev_on_output.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Btw. One annoying thing with prev/next is that when changing to a workspace on a different output the mouse pointer follows.

Copy link
Contributor

Choose a reason for hiding this comment

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

The correct behavior is prev_on_output.

@deklov
Copy link
Contributor Author

deklov commented Jul 14, 2016

This is more of a RFC pull request.

@Hummer12007
Copy link
Contributor

@deklov there's horizontal scrolling too (axis == 0 -> vertical, 1 -> horizontal)

uint32_t time, uint32_t axis, wl_fixed_t value) {
struct window *window = data;

if (!sway_assert(!axis, "Only support horizontal axis")) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Assertions are to detect things that should never happen. Horizontal scrolling doesn't qualify.

@ddevault
Copy link
Contributor

LGTM

if (!sway_assert(false, "Only support horizontal axis")) {
return;
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Hummer12007 something like this?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, but why should you add a default clause? The axis enum in libinput/wayland has only two directions.

Copy link
Contributor

@ddevault ddevault Jul 15, 2016

Choose a reason for hiding this comment

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

I don't have a strong preference for or against a default here, but the assert message needs to be updated.

@ddevault ddevault merged commit e66f813 into swaywm:master Jul 16, 2016
@ddevault
Copy link
Contributor

Thanks!

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.

3 participants