rootston: cleanup for multiseat

This commit is contained in:
Tony Crisci 2017-11-08 14:53:08 -05:00
parent a00b7f1e9b
commit 992f931ae9
5 changed files with 26 additions and 53 deletions

View File

@ -4,7 +4,6 @@
#include <wlr/types/wlr_input_device.h>
#include <wlr/types/wlr_cursor.h>
#include <wlr/types/wlr_seat.h>
#include <wlr/xcursor.h>
#include "rootston/cursor.h"
#include "rootston/config.h"
#include "rootston/view.h"
@ -14,30 +13,12 @@ struct roots_input {
struct roots_config *config;
struct roots_server *server;
struct wl_list keyboards;
struct wl_list pointers;
struct wl_list touch;
struct wl_list tablet_tools;
struct wl_list seats;
struct wl_listener input_add;
struct wl_listener input_remove;
struct wl_listener cursor_motion;
struct wl_listener cursor_motion_absolute;
struct wl_listener cursor_button;
struct wl_listener cursor_axis;
struct wl_listener cursor_touch_down;
struct wl_listener cursor_touch_up;
struct wl_listener cursor_touch_motion;
struct wl_listener cursor_tool_axis;
struct wl_listener cursor_tool_tip;
struct wl_list seats;
struct wl_listener pointer_grab_begin;
struct wl_list touch_points;
struct wl_listener pointer_grab_end;
struct wl_listener request_set_cursor;
@ -47,27 +28,6 @@ struct roots_input *input_create(struct roots_server *server,
struct roots_config *config);
void input_destroy(struct roots_input *input);
void cursor_initialize(struct roots_input *input);
void cursor_load_config(struct roots_config *config,
struct wlr_cursor *cursor,
struct roots_input *input,
struct roots_desktop *desktop);
const struct roots_input_event *get_input_event(struct roots_input *input,
uint32_t serial);
void view_begin_move(struct roots_input *input, struct wlr_cursor *cursor,
struct roots_view *view);
void view_begin_resize(struct roots_input *input, struct wlr_cursor *cursor,
struct roots_view *view, uint32_t edges);
struct wlr_xcursor *get_default_xcursor(struct wlr_xcursor_theme *theme);
struct wlr_xcursor *get_move_xcursor(struct wlr_xcursor_theme *theme);
struct wlr_xcursor *get_resize_xcursor(struct wlr_xcursor_theme *theme,
uint32_t edges);
struct wlr_xcursor *get_rotate_xcursor(struct wlr_xcursor_theme *theme);
void set_view_focus(struct roots_input *input, struct roots_desktop *desktop,
struct roots_view *view);
struct roots_seat *input_seat_from_wlr_seat(struct roots_input *input,
struct wlr_seat *seat);

View File

@ -0,0 +1,15 @@
#ifndef _ROOTSTON_XCURSOR_H
#define _ROOTSTON_XCURSOR_H
#include <wlr/xcursor.h>
struct wlr_xcursor *get_default_xcursor(struct wlr_xcursor_theme *theme);
struct wlr_xcursor *get_move_xcursor(struct wlr_xcursor_theme *theme);
struct wlr_xcursor *get_resize_xcursor(struct wlr_xcursor_theme *theme,
uint32_t edges);
struct wlr_xcursor *get_rotate_xcursor(struct wlr_xcursor_theme *theme);
#endif

View File

@ -7,6 +7,7 @@
#include <dev/evdev/input-event-codes.h>
#endif
#include <wlr/util/log.h>
#include "rootston/xcursor.h"
#include "rootston/cursor.h"
struct roots_cursor *roots_cursor_create(struct roots_seat *seat) {
@ -141,13 +142,11 @@ static void roots_cursor_press_button(struct roots_cursor *cursor,
cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy);
if (state == WLR_BUTTON_PRESSED && view && roots_seat_has_meta_pressed(seat)) {
// TODO
roots_seat_focus_view(seat, view);
uint32_t edges;
switch (button) {
case BTN_LEFT:
// TODO
roots_seat_begin_move(seat, view);
break;
case BTN_RIGHT:
@ -171,7 +170,6 @@ static void roots_cursor_press_button(struct roots_cursor *cursor,
return;
}
// TODO
uint32_t serial =
wlr_seat_pointer_notify_button(seat->seat, time, button, state);
@ -182,7 +180,6 @@ static void roots_cursor_press_button(struct roots_cursor *cursor,
roots_cursor_update_position(cursor, time);
break;
case WLR_BUTTON_PRESSED:
// TODO
i = cursor->input_events_idx;
cursor->input_events[i].serial = serial;
cursor->input_events[i].cursor = cursor->cursor;

View File

@ -5,6 +5,7 @@
#include <wlr/util/log.h>
#include "rootston/xcursor.h"
#include "rootston/input.h"
#include "rootston/seat.h"
#include "rootston/keyboard.h"

View File

@ -1,14 +1,6 @@
#include <wlr/types/wlr_cursor.h>
#include "rootston/input.h"
struct wlr_xcursor *get_default_xcursor(struct wlr_xcursor_theme *theme) {
return wlr_xcursor_theme_get_cursor(theme, "left_ptr");
}
struct wlr_xcursor *get_move_xcursor(struct wlr_xcursor_theme *theme) {
return wlr_xcursor_theme_get_cursor(theme, "grabbing");
}
static const char *get_resize_xcursor_name(uint32_t edges) {
if (edges & ROOTS_CURSOR_RESIZE_EDGE_TOP) {
if (edges & ROOTS_CURSOR_RESIZE_EDGE_RIGHT) {
@ -32,6 +24,14 @@ static const char *get_resize_xcursor_name(uint32_t edges) {
return "se-resize"; // fallback
}
struct wlr_xcursor *get_default_xcursor(struct wlr_xcursor_theme *theme) {
return wlr_xcursor_theme_get_cursor(theme, "left_ptr");
}
struct wlr_xcursor *get_move_xcursor(struct wlr_xcursor_theme *theme) {
return wlr_xcursor_theme_get_cursor(theme, "grabbing");
}
struct wlr_xcursor *get_resize_xcursor(struct wlr_xcursor_theme *theme,
uint32_t edges) {
return wlr_xcursor_theme_get_cursor(theme, get_resize_xcursor_name(edges));