mirror of
https://github.com/labwc/labwc.git
synced 2025-10-29 05:40:24 -04:00
Move keyboard functions into input/keyboard.h
This commit is contained in:
parent
5e1562fae6
commit
b359b1560c
7 changed files with 38 additions and 14 deletions
19
include/input/keyboard.h
Normal file
19
include/input/keyboard.h
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
#ifndef LABWC_KEYBOARD_H
|
||||
#define LABWC_KEYBOARD_H
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
struct seat;
|
||||
struct keyboard;
|
||||
struct wlr_keyboard;
|
||||
|
||||
void keyboard_init(struct seat *seat);
|
||||
void keyboard_finish(struct seat *seat);
|
||||
|
||||
void keyboard_setup_handlers(struct keyboard *keyboard);
|
||||
void keyboard_set_numlock(struct wlr_keyboard *keyboard);
|
||||
void keyboard_cancel_keybind_repeat(struct keyboard *keyboard);
|
||||
bool keyboard_any_modifiers_pressed(struct wlr_keyboard *keyboard);
|
||||
|
||||
#endif /* LABWC_KEYBOARD_H */
|
||||
|
|
@ -410,14 +410,6 @@ struct view *desktop_cycle_view(struct server *server, struct view *start_view,
|
|||
*/
|
||||
void desktop_focus_topmost_view(struct server *server);
|
||||
|
||||
void keyboard_cancel_keybind_repeat(struct keyboard *keyboard);
|
||||
void keyboard_key_notify(struct wl_listener *listener, void *data);
|
||||
void keyboard_modifiers_notify(struct wl_listener *listener, void *data);
|
||||
void keyboard_set_numlock(struct wlr_keyboard *keyboard);
|
||||
void keyboard_init(struct seat *seat);
|
||||
bool keyboard_any_modifiers_pressed(struct wlr_keyboard *keyboard);
|
||||
void keyboard_finish(struct seat *seat);
|
||||
|
||||
void seat_init(struct server *server);
|
||||
void seat_finish(struct server *server);
|
||||
void seat_reconfigure(struct server *server);
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
#include <wlr/interfaces/wlr_keyboard.h>
|
||||
#include "action.h"
|
||||
#include "idle.h"
|
||||
#include "input/keyboard.h"
|
||||
#include "input/key-state.h"
|
||||
#include "labwc.h"
|
||||
#include "menu/menu.h"
|
||||
|
|
@ -52,7 +53,7 @@ end_cycling(struct server *server)
|
|||
should_cancel_cycling_on_next_key_release = false;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
keyboard_modifiers_notify(struct wl_listener *listener, void *data)
|
||||
{
|
||||
struct keyboard *keyboard = wl_container_of(listener, keyboard, modifier);
|
||||
|
|
@ -476,7 +477,7 @@ keyboard_cancel_keybind_repeat(struct keyboard *keyboard)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
keyboard_key_notify(struct wl_listener *listener, void *data)
|
||||
{
|
||||
/* This event is raised when a key is pressed or released. */
|
||||
|
|
@ -550,6 +551,17 @@ keyboard_init(struct seat *seat)
|
|||
keybind_update_keycodes(seat->server);
|
||||
}
|
||||
|
||||
void
|
||||
keyboard_setup_handlers(struct keyboard *keyboard)
|
||||
{
|
||||
struct wlr_keyboard *wlr_kb = keyboard->wlr_keyboard;
|
||||
|
||||
keyboard->key.notify = keyboard_key_notify;
|
||||
wl_signal_add(&wlr_kb->events.key, &keyboard->key);
|
||||
keyboard->modifier.notify = keyboard_modifiers_notify;
|
||||
wl_signal_add(&wlr_kb->events.modifiers, &keyboard->modifier);
|
||||
}
|
||||
|
||||
void
|
||||
keyboard_finish(struct seat *seat)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
#include "input/keyboard.h"
|
||||
#include "labwc.h"
|
||||
#include "regions.h"
|
||||
#include "resize_indicator.h"
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
#include "common/graphic-helpers.h"
|
||||
#include "common/list.h"
|
||||
#include "common/mem.h"
|
||||
#include "input/keyboard.h"
|
||||
#include "labwc.h"
|
||||
#include "regions.h"
|
||||
#include "view.h"
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
#include <wlr/types/wlr_touch.h>
|
||||
#include <wlr/util/log.h>
|
||||
#include "common/mem.h"
|
||||
#include "input/keyboard.h"
|
||||
#include "input/key-state.h"
|
||||
#include "labwc.h"
|
||||
#include "view.h"
|
||||
|
|
@ -223,10 +224,7 @@ new_keyboard(struct seat *seat, struct wlr_input_device *device, bool virtual)
|
|||
wlr_keyboard_group_add_keyboard(seat->keyboard_group, kb);
|
||||
}
|
||||
|
||||
keyboard->key.notify = keyboard_key_notify;
|
||||
wl_signal_add(&kb->events.key, &keyboard->key);
|
||||
keyboard->modifier.notify = keyboard_modifiers_notify;
|
||||
wl_signal_add(&kb->events.modifiers, &keyboard->modifier);
|
||||
keyboard_setup_handlers(keyboard);
|
||||
|
||||
wlr_seat_set_keyboard(seat->seat, kb);
|
||||
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
#include "common/graphic-helpers.h"
|
||||
#include "common/list.h"
|
||||
#include "common/mem.h"
|
||||
#include "input/keyboard.h"
|
||||
#include "labwc.h"
|
||||
#include "view.h"
|
||||
#include "workspaces.h"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue