aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backend/drm/drm.c38
-rw-r--r--include/rootston/seat.h2
-rw-r--r--rootston/cursor.c43
-rw-r--r--rootston/keyboard.c1
-rw-r--r--rootston/rootston.ini.example4
-rw-r--r--rootston/seat.c25
-rw-r--r--rootston/xdg_shell_v6.c2
-rw-r--r--types/wlr_output_layout.c6
8 files changed, 82 insertions, 39 deletions
diff --git a/backend/drm/drm.c b/backend/drm/drm.c
index 7f51fe67..08ced783 100644
--- a/backend/drm/drm.c
+++ b/backend/drm/drm.c
@@ -14,6 +14,7 @@
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#include <wayland-server.h>
+#include <wayland-util.h>
#include <wlr/backend/interface.h>
#include <wlr/interfaces/wlr_output.h>
#include <wlr/util/log.h>
@@ -785,22 +786,11 @@ void wlr_drm_scan_connectors(struct wlr_drm_backend *drm) {
wlr_conn->old_crtc = drmModeGetCrtc(drm->fd, curr_enc->crtc_id);
}
- wlr_conn->output.phys_width = drm_conn->mmWidth;
- wlr_conn->output.phys_height = drm_conn->mmHeight;
- wlr_conn->output.subpixel = subpixel_map[drm_conn->subpixel];
snprintf(wlr_conn->output.name, sizeof(wlr_conn->output.name),
"%s-%"PRIu32,
conn_get_name(drm_conn->connector_type),
drm_conn->connector_type_id);
- wlr_drm_get_connector_props(drm->fd, wlr_conn->id, &wlr_conn->props);
-
- size_t edid_len = 0;
- uint8_t *edid = wlr_drm_get_prop_blob(drm->fd,
- wlr_conn->id, wlr_conn->props.edid, &edid_len);
- parse_edid(&wlr_conn->output, edid_len, edid);
- free(edid);
-
wl_list_insert(&drm->outputs, &wlr_conn->link);
wlr_log(L_INFO, "Found display '%s'", wlr_conn->output.name);
} else {
@@ -821,6 +811,21 @@ void wlr_drm_scan_connectors(struct wlr_drm_backend *drm) {
if (wlr_conn->state == WLR_DRM_CONN_DISCONNECTED &&
drm_conn->connection == DRM_MODE_CONNECTED) {
wlr_log(L_INFO, "'%s' connected", wlr_conn->output.name);
+
+ wlr_conn->output.phys_width = drm_conn->mmWidth;
+ wlr_conn->output.phys_height = drm_conn->mmHeight;
+ wlr_log(L_INFO, "Physical size: %"PRId32"x%"PRId32,
+ wlr_conn->output.phys_width, wlr_conn->output.phys_height);
+ wlr_conn->output.subpixel = subpixel_map[drm_conn->subpixel];
+
+ wlr_drm_get_connector_props(drm->fd, wlr_conn->id, &wlr_conn->props);
+
+ size_t edid_len = 0;
+ uint8_t *edid = wlr_drm_get_prop_blob(drm->fd,
+ wlr_conn->id, wlr_conn->props.edid, &edid_len);
+ parse_edid(&wlr_conn->output, edid_len, edid);
+ free(edid);
+
wlr_log(L_INFO, "Detected modes:");
for (int i = 0; i < drm_conn->count_modes; ++i) {
@@ -973,6 +978,17 @@ void wlr_drm_connector_cleanup(struct wlr_drm_connector *conn) {
}
}
+ struct wlr_drm_mode *mode;
+ struct wlr_drm_mode *tmp;
+ wl_list_for_each_safe(mode, tmp, &conn->output.modes, wlr_mode.link) {
+ wl_list_remove(&mode->wlr_mode.link);
+ free(mode);
+ }
+
+ memset(&conn->output.make, 0, sizeof(conn->output.make));
+ memset(&conn->output.model, 0, sizeof(conn->output.model));
+ memset(&conn->output.serial, 0, sizeof(conn->output.serial));
+
conn->crtc = NULL;
conn->possible_crtc = 0;
/* Fallthrough */
diff --git a/include/rootston/seat.h b/include/rootston/seat.h
index fa7d38df..0047522c 100644
--- a/include/rootston/seat.h
+++ b/include/rootston/seat.h
@@ -104,6 +104,8 @@ void roots_seat_begin_resize(struct roots_seat *seat, struct roots_view *view,
void roots_seat_begin_rotate(struct roots_seat *seat, struct roots_view *view);
+void roots_seat_end_compositor_grab(struct roots_seat *seat);
+
struct roots_seat_view *roots_seat_view_from_view( struct roots_seat *seat,
struct roots_view *view);
diff --git a/rootston/cursor.c b/rootston/cursor.c
index 158c4708..ab32a5de 100644
--- a/rootston/cursor.c
+++ b/rootston/cursor.c
@@ -249,38 +249,33 @@ static void roots_cursor_press_button(struct roots_cursor *cursor,
roots_seat_begin_rotate(seat, view);
break;
}
- return;
- }
+ } else {
- if (view && !surface) {
- if (cursor->pointer_view) {
- seat_view_deco_button(cursor->pointer_view, sx, sy, button, state);
+ if (view && !surface) {
+ if (cursor->pointer_view) {
+ seat_view_deco_button(cursor->pointer_view, sx, sy, button, state);
+ }
}
- }
- if (state == WLR_BUTTON_RELEASED &&
- cursor->mode != ROOTS_CURSOR_PASSTHROUGH) {
- cursor->mode = ROOTS_CURSOR_PASSTHROUGH;
- if (seat->seat->pointer_state.button_count == 0) {
- return;
+ if (state == WLR_BUTTON_RELEASED &&
+ cursor->mode != ROOTS_CURSOR_PASSTHROUGH) {
+ cursor->mode = ROOTS_CURSOR_PASSTHROUGH;
}
- }
- if (view && surface) {
- if (!is_touch) {
- wlr_seat_pointer_notify_button(seat->seat, time, button, state);
+ switch (state) {
+ case WLR_BUTTON_RELEASED:
+ if (!is_touch) {
+ roots_cursor_update_position(cursor, time);
+ }
+ break;
+ case WLR_BUTTON_PRESSED:
+ roots_seat_set_focus(seat, view);
+ break;
}
}
- switch (state) {
- case WLR_BUTTON_RELEASED:
- if (!is_touch) {
- roots_cursor_update_position(cursor, time);
- }
- break;
- case WLR_BUTTON_PRESSED:
- roots_seat_set_focus(seat, view);
- break;
+ if (!is_touch) {
+ wlr_seat_pointer_notify_button(seat->seat, time, button, state);
}
}
diff --git a/rootston/keyboard.c b/rootston/keyboard.c
index f1123599..ddf541b4 100644
--- a/rootston/keyboard.c
+++ b/rootston/keyboard.c
@@ -159,6 +159,7 @@ static bool keyboard_execute_compositor_binding(struct roots_keyboard *keyboard,
if (keysym == XKB_KEY_Escape) {
wlr_seat_pointer_end_grab(keyboard->seat->seat);
wlr_seat_keyboard_end_grab(keyboard->seat->seat);
+ roots_seat_end_compositor_grab(keyboard->seat);
}
return false;
diff --git a/rootston/rootston.ini.example b/rootston/rootston.ini.example
index 0d19b751..a6619767 100644
--- a/rootston/rootston.ini.example
+++ b/rootston/rootston.ini.example
@@ -2,7 +2,7 @@
# Disable X11 support. Enabled by default.
xwayland=false
-# Single output configuration. String after semicolon must match output's name.
+# Single output configuration. String after colon must match output's name.
[output:VGA-1]
# Set logical (layout) coordinates for this screen
x = 1920
@@ -24,7 +24,7 @@ geometry = 2500x800
# Load a custom XCursor theme
theme = default
-# Single device configuration. String after semicolon must match device's name.
+# Single device configuration. String after colon must match device's name.
[device:PixArt Dell MS116 USB Optical Mouse]
# Restrict cursor movements for this mouse to single output
map-to-output = VGA-1
diff --git a/rootston/seat.c b/rootston/seat.c
index 5b11af4a..45e42d7d 100644
--- a/rootston/seat.c
+++ b/rootston/seat.c
@@ -861,3 +861,28 @@ void roots_seat_begin_rotate(struct roots_seat *seat, struct roots_view *view) {
wlr_xcursor_manager_set_cursor_image(seat->cursor->xcursor_manager,
ROOTS_XCURSOR_ROTATE, seat->cursor->cursor);
}
+
+void roots_seat_end_compositor_grab(struct roots_seat *seat) {
+ struct roots_cursor *cursor = seat->cursor;
+ struct roots_view *view = roots_seat_get_focus(seat);
+
+ if (view == NULL) {
+ return;
+ }
+
+ switch(cursor->mode) {
+ case ROOTS_CURSOR_MOVE:
+ view_move(view, cursor->view_x, cursor->view_y);
+ break;
+ case ROOTS_CURSOR_RESIZE:
+ view_move_resize(view, cursor->view_x, cursor->view_y, cursor->view_width, cursor->view_height);
+ break;
+ case ROOTS_CURSOR_ROTATE:
+ view->rotation = cursor->view_rotation;
+ break;
+ case ROOTS_CURSOR_PASSTHROUGH:
+ break;
+ }
+
+ cursor->mode = ROOTS_CURSOR_PASSTHROUGH;
+}
diff --git a/rootston/xdg_shell_v6.c b/rootston/xdg_shell_v6.c
index b354b77b..9bd6f76a 100644
--- a/rootston/xdg_shell_v6.c
+++ b/rootston/xdg_shell_v6.c
@@ -147,7 +147,7 @@ static void move_resize(struct roots_view *view, double x, double y,
constrained_height);
if (serial > 0) {
roots_surface->pending_move_resize_configure_serial = serial;
- } else {
+ } else if (roots_surface->pending_move_resize_configure_serial == 0) {
view_update_position(view, x, y);
}
}
diff --git a/types/wlr_output_layout.c b/types/wlr_output_layout.c
index b01fb840..46b0bd2a 100644
--- a/types/wlr_output_layout.c
+++ b/types/wlr_output_layout.c
@@ -327,7 +327,11 @@ void wlr_output_layout_closest_point(struct wlr_output_layout *layout,
output_distance =
(x - output_x) * (x - output_x) + (y - output_y) * (y - output_y);
- if (output_distance < min_distance) {
+ if (!isfinite(output_distance)) {
+ output_distance = DBL_MAX;
+ }
+
+ if (output_distance <= min_distance) {
min_x = output_x;
min_y = output_y;
min_distance = output_distance;