mirror of
https://codeberg.org/dwl/dwl.git
synced 2026-09-19 13:52:48 +00:00
Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5fd19feaff | ||
|
|
b1c101515a | ||
|
|
8ad2c920db | ||
|
|
e8bf70d639 |
@@ -153,7 +153,6 @@ given the base on which it is built. Implemented default features are:
|
||||
- Support screen lockers via ext-session-lock-v1 protocol
|
||||
- Various Wayland protocols
|
||||
- XWayland support as provided by wlroots (can be enabled in `config.mk`)
|
||||
- Zero flickering - Wayland users naturally expect that "every frame is perfect"
|
||||
- Layer shell popups (used by Waybar)
|
||||
- Damage tracking provided by scenegraph API
|
||||
|
||||
|
||||
@@ -170,3 +170,8 @@ static const Button buttons[] = {
|
||||
{ MODKEY, BTN_MIDDLE, togglefloating, {0} },
|
||||
{ MODKEY, BTN_RIGHT, moveresize, {.ui = CurResize} },
|
||||
};
|
||||
|
||||
static const Axis axes[] = {
|
||||
{ MODKEY, AxisUp, spawn, SHCMD("volume-up_EXAMPLE") },
|
||||
{ MODKEY, AxisDown, spawn, SHCMD("volume-down_EXAMPLE") },
|
||||
};
|
||||
|
||||
@@ -86,6 +86,7 @@
|
||||
enum { CurNormal, CurPressed, CurMove, CurResize }; /* cursor */
|
||||
enum { XDGShell, LayerShell, X11 }; /* client types */
|
||||
enum { LyrBg, LyrBottom, LyrTile, LyrFloat, LyrTop, LyrFS, LyrOverlay, LyrIMPopup, LyrBlock, NUM_LAYERS }; /* scene layers */
|
||||
enum { AxisUp, AxisRight, AxisDown, AxisLeft };
|
||||
|
||||
typedef union {
|
||||
int i;
|
||||
@@ -94,6 +95,13 @@ typedef union {
|
||||
const void *v;
|
||||
} Arg;
|
||||
|
||||
typedef struct {
|
||||
unsigned int mod;
|
||||
unsigned int dir;
|
||||
void (*func)(const Arg *);
|
||||
const Arg arg;
|
||||
} Axis;
|
||||
|
||||
typedef struct {
|
||||
unsigned int mod;
|
||||
unsigned int button;
|
||||
@@ -628,9 +636,26 @@ axisnotify(struct wl_listener *listener, void *data)
|
||||
/* This event is forwarded by the cursor when a pointer emits an axis event,
|
||||
* for example when you move the scroll wheel. */
|
||||
struct wlr_pointer_axis_event *event = data;
|
||||
const Axis *a;
|
||||
unsigned int adir;
|
||||
struct wlr_keyboard *keyboard;
|
||||
uint32_t mods;
|
||||
|
||||
wlr_idle_notifier_v1_notify_activity(idle_notifier, seat);
|
||||
/* TODO: allow usage of scroll wheel for mousebindings, it can be implemented
|
||||
* by checking the event's orientation and the delta of the event */
|
||||
|
||||
if (event->orientation == WL_POINTER_AXIS_VERTICAL_SCROLL)
|
||||
adir = event->delta > 0 ? AxisDown : AxisUp;
|
||||
else
|
||||
adir = event->delta > 0 ? AxisRight : AxisLeft;
|
||||
keyboard = wlr_seat_get_keyboard(seat);
|
||||
mods = keyboard ? wlr_keyboard_get_modifiers(keyboard) : 0;
|
||||
for (a = axes; a < END(axes); a++) {
|
||||
if (CLEANMASK(mods) == CLEANMASK(a->mod) && adir == a->dir && a->func) {
|
||||
a->func(&a->arg);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* Notify the client with pointer focus of the axis event. */
|
||||
wlr_seat_pointer_notify_axis(seat,
|
||||
event->time_msec, event->orientation, event->delta,
|
||||
@@ -678,10 +703,11 @@ buttonpress(struct wl_listener *listener, void *data)
|
||||
break;
|
||||
case WL_POINTER_BUTTON_STATE_RELEASED:
|
||||
/* If you released any buttons, we exit interactive move/resize mode. */
|
||||
/* TODO: should reset to the pointer focus's current setcursor */
|
||||
if (!locked && cursor_mode != CurNormal && cursor_mode != CurPressed) {
|
||||
wlr_cursor_set_xcursor(cursor, cursor_mgr, "default");
|
||||
cursor_mode = CurNormal;
|
||||
/* Update the cursor */
|
||||
wlr_seat_pointer_clear_focus(seat);
|
||||
motionnotify(0, NULL, 0, 0, 0, 0);
|
||||
/* Drop the window off on its new monitor */
|
||||
selmon = xytomon(cursor->x, cursor->y);
|
||||
setmon(grabc, selmon, 0);
|
||||
@@ -1448,7 +1474,8 @@ dirtomon(enum wlr_direction dir)
|
||||
dir, selmon->wlr_output, selmon->m.x, selmon->m.y)))
|
||||
return next->data;
|
||||
if ((next = wlr_output_layout_farthest_output(output_layout,
|
||||
dir ^ (WLR_DIRECTION_LEFT|WLR_DIRECTION_RIGHT),
|
||||
dir ^ (WLR_DIRECTION_LEFT | WLR_DIRECTION_RIGHT |
|
||||
WLR_DIRECTION_UP | WLR_DIRECTION_DOWN),
|
||||
selmon->wlr_output, selmon->m.x, selmon->m.y)))
|
||||
return next->data;
|
||||
return selmon;
|
||||
|
||||
Reference in New Issue
Block a user