mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-03-14 05:34:21 -04:00
opt: optimzie code struct
This commit is contained in:
parent
23af3c5595
commit
32c36ba485
2 changed files with 19 additions and 24 deletions
|
|
@ -3604,6 +3604,20 @@ void reapply_monitor_rules(void) {
|
|||
updatemons(NULL, NULL);
|
||||
}
|
||||
|
||||
void set_xcursor_env() {
|
||||
if (config.cursor_size > 0) {
|
||||
char size_str[16];
|
||||
snprintf(size_str, sizeof(size_str), "%d", config.cursor_size);
|
||||
setenv("XCURSOR_SIZE", size_str, 1);
|
||||
} else {
|
||||
setenv("XCURSOR_SIZE", "24", 1);
|
||||
}
|
||||
|
||||
if (config.cursor_theme) {
|
||||
setenv("XCURSOR_THEME", config.cursor_theme, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void reapply_cursor_style(void) {
|
||||
if (hide_cursor_source) {
|
||||
wl_event_source_timer_update(hide_cursor_source, 0);
|
||||
|
|
@ -3620,19 +3634,11 @@ void reapply_cursor_style(void) {
|
|||
cursor_mgr = NULL;
|
||||
}
|
||||
|
||||
set_xcursor_env();
|
||||
|
||||
cursor_mgr =
|
||||
wlr_xcursor_manager_create(config.cursor_theme, config.cursor_size);
|
||||
|
||||
if (config.cursor_size > 0) {
|
||||
char size_str[16];
|
||||
snprintf(size_str, sizeof(size_str), "%d", config.cursor_size);
|
||||
setenv("XCURSOR_SIZE", size_str, 1);
|
||||
}
|
||||
|
||||
if (config.cursor_theme) {
|
||||
setenv("XCURSOR_THEME", config.cursor_theme, 1);
|
||||
}
|
||||
|
||||
Monitor *m = NULL;
|
||||
wl_list_for_each(m, &mons, link) {
|
||||
wlr_xcursor_manager_load(cursor_mgr, m->wlr_output->scale);
|
||||
|
|
|
|||
17
src/mango.c
17
src/mango.c
|
|
@ -5653,22 +5653,11 @@ void setup(void) {
|
|||
* cursor images are available at all scale factors on the screen
|
||||
* (necessary for HiDPI support). Scaled cursors will be loaded with
|
||||
* each output. */
|
||||
// cursor_mgr = wlr_xcursor_manager_create(cursor_theme, 24);
|
||||
|
||||
set_xcursor_env();
|
||||
|
||||
cursor_mgr =
|
||||
wlr_xcursor_manager_create(config.cursor_theme, config.cursor_size);
|
||||
|
||||
if (config.cursor_size > 0) {
|
||||
char size_str[16];
|
||||
snprintf(size_str, sizeof(size_str), "%d", config.cursor_size);
|
||||
setenv("XCURSOR_SIZE", size_str, 1);
|
||||
} else {
|
||||
setenv("XCURSOR_SIZE", "24", 1);
|
||||
}
|
||||
|
||||
if (config.cursor_theme) {
|
||||
setenv("XCURSOR_THEME", config.cursor_theme, 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* wlr_cursor *only* displays an image on screen. It does not move
|
||||
* around when the pointer moves. However, we can attach input devices
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue