mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2024-11-22 07:02:28 +00:00
Add super+click to move windows around without xdg
Though it still doesn't work for non-XDG windows because we need to build common window state managemnet within the reference compositor.
This commit is contained in:
parent
800a1ec679
commit
21f5b92973
@ -78,6 +78,7 @@ struct sample_state {
|
|||||||
struct wl_listener keyboard_bound;
|
struct wl_listener keyboard_bound;
|
||||||
struct wlr_xwayland *xwayland;
|
struct wlr_xwayland *xwayland;
|
||||||
struct wlr_gamma_control_manager *gamma_control_manager;
|
struct wlr_gamma_control_manager *gamma_control_manager;
|
||||||
|
bool mod_down;
|
||||||
int keymap_fd;
|
int keymap_fd;
|
||||||
size_t keymap_size;
|
size_t keymap_size;
|
||||||
uint32_t serial;
|
uint32_t serial;
|
||||||
@ -368,6 +369,10 @@ static void handle_keyboard_key(struct keyboard_state *keyboard,
|
|||||||
wl_keyboard_send_key(seat_handle->keyboard, ++sample->serial, 0,
|
wl_keyboard_send_key(seat_handle->keyboard, ++sample->serial, 0,
|
||||||
keycode, key_state);
|
keycode, key_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sym == XKB_KEY_Super_L || sym == XKB_KEY_Super_R) {
|
||||||
|
sample->mod_down = key_state == WLR_KEY_PRESSED;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_keyboard_bound(struct wl_listener *listener, void *data) {
|
static void handle_keyboard_bound(struct wl_listener *listener, void *data) {
|
||||||
@ -492,6 +497,13 @@ static void handle_cursor_button(struct wl_listener *listener, void *data) {
|
|||||||
sample->input_cache_idx = (i + 1)
|
sample->input_cache_idx = (i + 1)
|
||||||
% (sizeof(sample->input_cache) / sizeof(sample->input_cache[0]));
|
% (sizeof(sample->input_cache) / sizeof(sample->input_cache[0]));
|
||||||
example_set_focused_surface(sample, surface);
|
example_set_focused_surface(sample, surface);
|
||||||
|
if (sample->mod_down && event->button == BTN_LEFT) {
|
||||||
|
struct example_xdg_surface_v6 *esurface = surface->data;
|
||||||
|
sample->motion_context.surface = esurface;
|
||||||
|
sample->motion_context.off_x = sample->cursor->x - esurface->position.lx;
|
||||||
|
sample->motion_context.off_y = sample->cursor->y - esurface->position.ly;
|
||||||
|
wlr_seat_pointer_clear_focus(sample->wl_seat);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -521,7 +533,7 @@ static void handle_tool_tip(struct wl_listener *listener, void *data) {
|
|||||||
example_set_focused_surface(sample, surface);
|
example_set_focused_surface(sample, surface);
|
||||||
|
|
||||||
wlr_seat_pointer_send_button(sample->wl_seat, (uint32_t)event->time_usec,
|
wlr_seat_pointer_send_button(sample->wl_seat, (uint32_t)event->time_usec,
|
||||||
BTN_MOUSE, event->state);
|
BTN_LEFT, event->state);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_input_add(struct compositor_state *state,
|
static void handle_input_add(struct compositor_state *state,
|
||||||
|
Loading…
Reference in New Issue
Block a user