aboutsummaryrefslogtreecommitdiff
path: root/rootston
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2017-12-14 11:20:38 +0100
committeremersion <contact@emersion.fr>2017-12-14 11:20:38 +0100
commit6ef021976384163cf9fde90d635a2e22479d107a (patch)
tree2c426fa4ce6b30b29bed1fb567ffc74a7d60009f /rootston
parent4da404818957d37fba4c0d6346a5f2f8a8e6db38 (diff)
parenta9fb071d49b244b72846b384a9e2ef2d9b03a05f (diff)
Merge branch 'master' into xwm-selection
Diffstat (limited to 'rootston')
-rw-r--r--rootston/config.c8
-rw-r--r--rootston/cursor.c3
-rw-r--r--rootston/desktop.c6
-rw-r--r--rootston/keyboard.c13
-rw-r--r--rootston/output.c18
-rw-r--r--rootston/seat.c19
6 files changed, 47 insertions, 20 deletions
diff --git a/rootston/config.c b/rootston/config.c
index 59adf13c..db77506f 100644
--- a/rootston/config.c
+++ b/rootston/config.c
@@ -176,6 +176,9 @@ static void config_handle_cursor(struct roots_config *config,
} else if (strcmp(name, "theme") == 0) {
free(cc->theme);
cc->theme = strdup(value);
+ } else if (strcmp(name, "default-image") == 0) {
+ free(cc->default_image);
+ cc->default_image = strdup(value);
} else {
wlr_log(L_ERROR, "got unknown cursor config: %s", name);
}
@@ -213,6 +216,10 @@ static void config_handle_keyboard(struct roots_config *config,
kc->variant = strdup(value);
} else if (strcmp(name, "options") == 0) {
kc->options = strdup(value);
+ } else if (strcmp(name, "repeat-rate") == 0) {
+ kc->repeat_rate = strtol(value, NULL, 10);
+ } else if (strcmp(name, "repeat-delay") == 0) {
+ kc->repeat_delay = strtol(value, NULL, 10);
} else {
wlr_log(L_ERROR, "got unknown keyboard config: %s", name);
}
@@ -450,6 +457,7 @@ void roots_config_destroy(struct roots_config *config) {
free(cc->mapped_output);
free(cc->mapped_box);
free(cc->theme);
+ free(cc->default_image);
free(cc);
}
diff --git a/rootston/cursor.c b/rootston/cursor.c
index d38e40a1..95e8ce2a 100644
--- a/rootston/cursor.c
+++ b/rootston/cursor.c
@@ -22,6 +22,7 @@ struct roots_cursor *roots_cursor_create(struct roots_seat *seat) {
free(cursor);
return NULL;
}
+ cursor->default_xcursor = ROOTS_XCURSOR_DEFAULT;
return cursor;
}
@@ -48,7 +49,7 @@ static void roots_cursor_update_position(struct roots_cursor *cursor,
}
if (set_compositor_cursor) {
wlr_xcursor_manager_set_cursor_image(cursor->xcursor_manager,
- ROOTS_XCURSOR_DEFAULT, cursor->cursor);
+ cursor->default_xcursor, cursor->cursor);
cursor->cursor_client = NULL;
}
if (view) {
diff --git a/rootston/desktop.c b/rootston/desktop.c
index 244f7c94..ef459e69 100644
--- a/rootston/desktop.c
+++ b/rootston/desktop.c
@@ -408,10 +408,14 @@ struct roots_desktop *desktop_create(struct roots_server *server,
desktop->config = config;
const char *cursor_theme = NULL;
+ const char *cursor_default = ROOTS_XCURSOR_DEFAULT;
struct roots_cursor_config *cc =
roots_config_get_cursor(config, ROOTS_CONFIG_DEFAULT_SEAT_NAME);
if (cc != NULL) {
cursor_theme = cc->theme;
+ if (cc->default_image != NULL) {
+ cursor_default = cc->default_image;
+ }
}
desktop->xcursor_manager = wlr_xcursor_manager_create(cursor_theme,
@@ -449,7 +453,7 @@ struct roots_desktop *desktop_create(struct roots_server *server,
wlr_log(L_ERROR, "Cannot load XWayland XCursor theme");
}
struct wlr_xcursor *xcursor = wlr_xcursor_manager_get_xcursor(
- desktop->xcursor_manager, ROOTS_XCURSOR_DEFAULT, 1);
+ desktop->xcursor_manager, cursor_default, 1);
if (xcursor != NULL) {
struct wlr_xcursor_image *image = xcursor->images[0];
wlr_xwayland_set_cursor(desktop->xwayland, image->buffer,
diff --git a/rootston/keyboard.c b/rootston/keyboard.c
index 85033613..4aaf2d48 100644
--- a/rootston/keyboard.c
+++ b/rootston/keyboard.c
@@ -306,6 +306,12 @@ static void keyboard_config_merge(struct roots_keyboard_config *config,
if (config->name == NULL) {
config->name = fallback->name;
}
+ if (config->repeat_rate <= 0) {
+ config->repeat_rate = fallback->repeat_rate;
+ }
+ if (config->repeat_delay <= 0) {
+ config->repeat_delay = fallback->repeat_delay;
+ }
}
struct roots_keyboard *roots_keyboard_create(struct wlr_input_device *device,
@@ -337,8 +343,7 @@ struct roots_keyboard *roots_keyboard_create(struct wlr_input_device *device,
keyboard_config_merge(config, &env_config);
keyboard->config = config;
- struct xkb_rule_names rules;
- memset(&rules, 0, sizeof(rules));
+ struct xkb_rule_names rules = { 0 };
rules.rules = config->rules;
rules.model = config->model;
rules.layout = config->layout;
@@ -353,6 +358,10 @@ struct roots_keyboard *roots_keyboard_create(struct wlr_input_device *device,
&rules, XKB_KEYMAP_COMPILE_NO_FLAGS));
xkb_context_unref(context);
+ int repeat_rate = (config->repeat_rate > 0) ? config->repeat_rate : 25;
+ int repeat_delay = (config->repeat_delay > 0) ? config->repeat_delay : 600;
+ wlr_keyboard_set_repeat_info(device->keyboard, repeat_rate, repeat_delay);
+
return keyboard;
}
diff --git a/rootston/output.c b/rootston/output.c
index aace1991..560e5eeb 100644
--- a/rootston/output.c
+++ b/rootston/output.c
@@ -6,7 +6,6 @@
#include <wlr/types/wlr_output_layout.h>
#include <wlr/types/wlr_compositor.h>
#include <wlr/types/wlr_wl_shell.h>
-#include <wlr/types/wlr_xcursor_manager.h>
#include <wlr/types/wlr_xdg_shell_v6.h>
#include <wlr/render/matrix.h>
#include <wlr/util/log.h>
@@ -264,8 +263,15 @@ static void output_frame_notify(struct wl_listener *listener, void *data) {
static void set_mode(struct wlr_output *output,
struct roots_output_config *oc) {
- struct wlr_output_mode *mode, *best = NULL;
int mhz = (int)(oc->mode.refresh_rate * 1000);
+
+ if (wl_list_empty(&output->modes)) {
+ // Output has no mode, try setting a custom one
+ wlr_output_set_custom_mode(output, oc->mode.width, oc->mode.height, mhz);
+ return;
+ }
+
+ struct wlr_output_mode *mode, *best = NULL;
wl_list_for_each(mode, &output->modes, link) {
if (mode->width == oc->mode.width && mode->height == oc->mode.height) {
if (mode->refresh == mhz) {
@@ -315,7 +321,7 @@ void output_add_notify(struct wl_listener *listener, void *data) {
set_mode(wlr_output, output_config);
}
wlr_output_set_scale(wlr_output, output_config->scale);
- wlr_output_transform(wlr_output, output_config->transform);
+ wlr_output_set_transform(wlr_output, output_config->transform);
wlr_output_layout_add(desktop->layout, wlr_output, output_config->x,
output_config->y);
} else {
@@ -324,12 +330,6 @@ void output_add_notify(struct wl_listener *listener, void *data) {
struct roots_seat *seat;
wl_list_for_each(seat, &input->seats, link) {
- if (wlr_xcursor_manager_load(seat->cursor->xcursor_manager,
- wlr_output->scale)) {
- wlr_log(L_ERROR, "Cannot load xcursor theme for output '%s' "
- "with scale %d", wlr_output->name, wlr_output->scale);
- }
-
roots_seat_configure_cursor(seat);
roots_seat_configure_xcursor(seat);
}
diff --git a/rootston/seat.c b/rootston/seat.c
index 1fa09ad6..8a581157 100644
--- a/rootston/seat.c
+++ b/rootston/seat.c
@@ -442,14 +442,19 @@ void roots_seat_configure_xcursor(struct roots_seat *seat) {
roots_config_get_cursor(seat->input->config, seat->seat->name);
if (cc != NULL) {
cursor_theme = cc->theme;
+ if (cc->default_image != NULL) {
+ seat->cursor->default_xcursor = cc->default_image;
+ }
}
- seat->cursor->xcursor_manager =
- wlr_xcursor_manager_create(cursor_theme, ROOTS_XCURSOR_SIZE);
- if (seat->cursor->xcursor_manager == NULL) {
- wlr_log(L_ERROR, "Cannot create XCursor manager for theme %s",
- cursor_theme);
- return;
+ if (!seat->cursor->xcursor_manager) {
+ seat->cursor->xcursor_manager =
+ wlr_xcursor_manager_create(cursor_theme, ROOTS_XCURSOR_SIZE);
+ if (seat->cursor->xcursor_manager == NULL) {
+ wlr_log(L_ERROR, "Cannot create XCursor manager for theme %s",
+ cursor_theme);
+ return;
+ }
}
struct roots_output *output;
@@ -463,7 +468,7 @@ void roots_seat_configure_xcursor(struct roots_seat *seat) {
}
wlr_xcursor_manager_set_cursor_image(seat->cursor->xcursor_manager,
- ROOTS_XCURSOR_DEFAULT, seat->cursor->cursor);
+ seat->cursor->default_xcursor, seat->cursor->cursor);
wlr_cursor_warp(seat->cursor->cursor, NULL, seat->cursor->cursor->x,
seat->cursor->cursor->y);
}