mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-02-18 22:05:28 -05:00
opt: sync keymap to xwayland after xwayland ready
This commit is contained in:
parent
acf8363714
commit
faf2e1e9da
2 changed files with 15 additions and 6 deletions
|
|
@ -907,9 +907,7 @@ int32_t switch_keyboard_layout(const Arg *arg) {
|
|||
uint32_t latched = keyboard->modifiers.latched;
|
||||
uint32_t locked = keyboard->modifiers.locked;
|
||||
|
||||
wlr_keyboard_set_keymap(keyboard, keyboard->keymap);
|
||||
wlr_keyboard_notify_modifiers(keyboard, depressed, latched, locked, next);
|
||||
keyboard->modifiers.group = 0;
|
||||
|
||||
// 7. 更新 seat
|
||||
wlr_seat_set_keyboard(seat, keyboard);
|
||||
|
|
@ -923,10 +921,7 @@ int32_t switch_keyboard_layout(const Arg *arg) {
|
|||
|
||||
struct wlr_keyboard *tkb = (struct wlr_keyboard *)id->device_data;
|
||||
|
||||
wlr_keyboard_set_keymap(tkb, keyboard->keymap);
|
||||
wlr_keyboard_notify_modifiers(tkb, depressed, latched, locked, next);
|
||||
tkb->modifiers.group = 0;
|
||||
|
||||
// 7. 更新 seat
|
||||
wlr_seat_set_keyboard(seat, tkb);
|
||||
wlr_seat_keyboard_notify_modifiers(seat, &tkb->modifiers);
|
||||
|
|
|
|||
16
src/mango.c
16
src/mango.c
|
|
@ -730,6 +730,7 @@ static void set_rect_size(struct wlr_scene_rect *rect, int32_t width,
|
|||
static Client *center_tiled_select(Monitor *m);
|
||||
static void handlecursoractivity(void);
|
||||
static int32_t hidecursor(void *data);
|
||||
static int32_t synckeymap(void *data);
|
||||
static bool check_hit_no_border(Client *c);
|
||||
static void reset_keyboard_layout(void);
|
||||
static void client_update_oldmonname_record(Client *c, Monitor *m);
|
||||
|
|
@ -876,6 +877,7 @@ struct dvec2 *baked_points_opafadein;
|
|||
struct dvec2 *baked_points_opafadeout;
|
||||
|
||||
static struct wl_event_source *hide_source;
|
||||
static struct wl_event_source *sync_keymap;
|
||||
static bool cursor_hidden = false;
|
||||
static bool tag_combo = false;
|
||||
static const char *cli_config_path = NULL;
|
||||
|
|
@ -5327,7 +5329,8 @@ void setup(void) {
|
|||
&request_set_cursor_shape);
|
||||
hide_source = wl_event_loop_add_timer(wl_display_get_event_loop(dpy),
|
||||
hidecursor, cursor);
|
||||
|
||||
sync_keymap = wl_event_loop_add_timer(wl_display_get_event_loop(dpy),
|
||||
synckeymap, NULL);
|
||||
/*
|
||||
* Configures a seat, which is a single "seat" at which a user sits and
|
||||
* operates the computer. This conceptually includes up to one keyboard,
|
||||
|
|
@ -5556,6 +5559,13 @@ int32_t hidecursor(void *data) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
int32_t synckeymap(void *data) {
|
||||
reset_keyboard_layout();
|
||||
// we only need to sync keymap once
|
||||
wl_event_source_timer_update(sync_keymap, 0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
void unlocksession(struct wl_listener *listener, void *data) {
|
||||
SessionLock *lock = wl_container_of(listener, lock, unlock);
|
||||
destroylock(lock, 1);
|
||||
|
|
@ -6147,6 +6157,10 @@ void xwaylandready(struct wl_listener *listener, void *data) {
|
|||
xwayland, xcursor->images[0]->buffer, xcursor->images[0]->width * 4,
|
||||
xcursor->images[0]->width, xcursor->images[0]->height,
|
||||
xcursor->images[0]->hotspot_x, xcursor->images[0]->hotspot_y);
|
||||
/* xwayland can't auto sync the keymap, so we do it manually
|
||||
and we need to wait the xwayland completely inited
|
||||
*/
|
||||
wl_event_source_timer_update(sync_keymap, 500);
|
||||
}
|
||||
|
||||
static void setgeometrynotify(struct wl_listener *listener, void *data) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue