mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-05-05 06:47:12 -04:00
Merge 500aa97f3c into 4e8af666e8
This commit is contained in:
commit
220a37e851
3 changed files with 40 additions and 0 deletions
|
|
@ -266,6 +266,8 @@ typedef struct {
|
||||||
|
|
||||||
char autostart[3][256];
|
char autostart[3][256];
|
||||||
|
|
||||||
|
char *tablet_output_name;
|
||||||
|
|
||||||
ConfigTagRule *tag_rules; // 动态数组
|
ConfigTagRule *tag_rules; // 动态数组
|
||||||
int tag_rules_count; // 数量
|
int tag_rules_count; // 数量
|
||||||
|
|
||||||
|
|
@ -2007,6 +2009,11 @@ void parse_config_line(Config *config, const char *line) {
|
||||||
|
|
||||||
} else if (strncmp(key, "source", 6) == 0) {
|
} else if (strncmp(key, "source", 6) == 0) {
|
||||||
parse_config_file(config, value);
|
parse_config_file(config, value);
|
||||||
|
} else if (strcmp(key, "tablet_output_name") == 0) {
|
||||||
|
if (config->tablet_output_name) {
|
||||||
|
free(config->tablet_output_name);
|
||||||
|
}
|
||||||
|
config->tablet_output_name = strdup(value);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "Error: Unknown key: %s\n", key);
|
fprintf(stderr, "Error: Unknown key: %s\n", key);
|
||||||
}
|
}
|
||||||
|
|
@ -2294,6 +2301,11 @@ void free_config(void) {
|
||||||
config.cursor_theme = NULL;
|
config.cursor_theme = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (config.tablet_output_name) {
|
||||||
|
free(config.tablet_output_name);
|
||||||
|
config.tablet_output_name = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
// 释放 circle_layout
|
// 释放 circle_layout
|
||||||
free_circle_layout(&config);
|
free_circle_layout(&config);
|
||||||
|
|
||||||
|
|
@ -2591,6 +2603,10 @@ void set_value_default() {
|
||||||
config.shadows_position_y = shadows_position_y;
|
config.shadows_position_y = shadows_position_y;
|
||||||
config.focused_opacity = focused_opacity;
|
config.focused_opacity = focused_opacity;
|
||||||
config.unfocused_opacity = unfocused_opacity;
|
config.unfocused_opacity = unfocused_opacity;
|
||||||
|
|
||||||
|
/* Tablet */
|
||||||
|
config.tablet_output_name = NULL;
|
||||||
|
|
||||||
memcpy(config.shadowscolor, shadowscolor, sizeof(shadowscolor));
|
memcpy(config.shadowscolor, shadowscolor, sizeof(shadowscolor));
|
||||||
|
|
||||||
memcpy(config.animation_curve_move, animation_curve_move,
|
memcpy(config.animation_curve_move, animation_curve_move,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
#include <wlr/types/wlr_tablet_pad.h>
|
#include <wlr/types/wlr_tablet_pad.h>
|
||||||
#include <wlr/types/wlr_tablet_tool.h>
|
#include <wlr/types/wlr_tablet_tool.h>
|
||||||
#include <wlr/types/wlr_tablet_v2.h>
|
#include <wlr/types/wlr_tablet_v2.h>
|
||||||
|
#include <wlr/util/log.h>
|
||||||
|
|
||||||
static const int tabletmaptosurface =
|
static const int tabletmaptosurface =
|
||||||
0; /* map tablet input to surface(1) or monitor(0) */
|
0; /* map tablet input to surface(1) or monitor(0) */
|
||||||
|
|
@ -32,6 +33,7 @@ static struct wl_listener tablet_tool_destroy = {.notify = destroytablettool};
|
||||||
static struct wl_listener tablet_tool_proximity = {.notify =
|
static struct wl_listener tablet_tool_proximity = {.notify =
|
||||||
tablettoolproximity};
|
tablettoolproximity};
|
||||||
static struct wl_listener tablet_tool_tip = {.notify = tablettooltip};
|
static struct wl_listener tablet_tool_tip = {.notify = tablettooltip};
|
||||||
|
static Monitor *find_monitor_by_name(const char *output_name);
|
||||||
|
|
||||||
void createtablet(struct wlr_input_device *device) {
|
void createtablet(struct wlr_input_device *device) {
|
||||||
if (!tablet) {
|
if (!tablet) {
|
||||||
|
|
@ -47,6 +49,17 @@ void createtablet(struct wlr_input_device *device) {
|
||||||
libinput_device_config_send_events_set_mode(device_handle,
|
libinput_device_config_send_events_set_mode(device_handle,
|
||||||
send_events_mode);
|
send_events_mode);
|
||||||
wlr_cursor_attach_input_device(cursor, device);
|
wlr_cursor_attach_input_device(cursor, device);
|
||||||
|
// Map tablet to specific monitor if configured
|
||||||
|
if (config.tablet_output_name) {
|
||||||
|
Monitor *target_monitor = find_monitor_by_name(config.tablet_output_name);
|
||||||
|
if (target_monitor) {
|
||||||
|
wlr_log(WLR_INFO, "Mapping input to output for device: %s", config.tablet_output_name);
|
||||||
|
wlr_cursor_map_input_to_output(cursor, device,
|
||||||
|
target_monitor->wlr_output);
|
||||||
|
} else {
|
||||||
|
wlr_log(WLR_WARN, "No monitor found with name: %s", config.tablet_output_name);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (device == tablet->wlr_device) {
|
} else if (device == tablet->wlr_device) {
|
||||||
wlr_log(WLR_ERROR, "createtablet: duplicate device");
|
wlr_log(WLR_ERROR, "createtablet: duplicate device");
|
||||||
|
|
|
||||||
11
src/mango.c
11
src/mango.c
|
|
@ -5655,6 +5655,17 @@ static void setgeometrynotify(struct wl_listener *listener, void *data) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static Monitor *find_monitor_by_name(const char *output_name) {
|
||||||
|
if (!output_name) return NULL;
|
||||||
|
Monitor *m;
|
||||||
|
wl_list_for_each(m, &mons, link) {
|
||||||
|
if (m->wlr_output && strcmp(m->wlr_output->name, output_name) == 0) {
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
char *startup_cmd = NULL;
|
char *startup_cmd = NULL;
|
||||||
int c;
|
int c;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue