mirror of
https://github.com/DreamMaoMao/maomaowm.git
synced 2026-03-24 09:06:31 -04:00
opt: optimzie code struct
This commit is contained in:
parent
6bee141749
commit
dd5b9cf360
2 changed files with 19 additions and 24 deletions
|
|
@ -3440,6 +3440,20 @@ void reapply_monitor_rules(void) {
|
||||||
updatemons(NULL, NULL);
|
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) {
|
void reapply_cursor_style(void) {
|
||||||
if (hide_cursor_source) {
|
if (hide_cursor_source) {
|
||||||
wl_event_source_timer_update(hide_cursor_source, 0);
|
wl_event_source_timer_update(hide_cursor_source, 0);
|
||||||
|
|
@ -3456,19 +3470,11 @@ void reapply_cursor_style(void) {
|
||||||
cursor_mgr = NULL;
|
cursor_mgr = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set_xcursor_env();
|
||||||
|
|
||||||
cursor_mgr =
|
cursor_mgr =
|
||||||
wlr_xcursor_manager_create(config.cursor_theme, config.cursor_size);
|
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;
|
Monitor *m = NULL;
|
||||||
wl_list_for_each(m, &mons, link) {
|
wl_list_for_each(m, &mons, link) {
|
||||||
wlr_xcursor_manager_load(cursor_mgr, m->wlr_output->scale);
|
wlr_xcursor_manager_load(cursor_mgr, m->wlr_output->scale);
|
||||||
|
|
|
||||||
17
src/mango.c
17
src/mango.c
|
|
@ -5664,22 +5664,11 @@ void setup(void) {
|
||||||
* cursor images are available at all scale factors on the screen
|
* cursor images are available at all scale factors on the screen
|
||||||
* (necessary for HiDPI support). Scaled cursors will be loaded with
|
* (necessary for HiDPI support). Scaled cursors will be loaded with
|
||||||
* each output. */
|
* each output. */
|
||||||
// cursor_mgr = wlr_xcursor_manager_create(cursor_theme, 24);
|
|
||||||
|
set_xcursor_env();
|
||||||
|
|
||||||
cursor_mgr =
|
cursor_mgr =
|
||||||
wlr_xcursor_manager_create(config.cursor_theme, config.cursor_size);
|
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
|
* wlr_cursor *only* displays an image on screen. It does not move
|
||||||
* around when the pointer moves. However, we can attach input devices
|
* around when the pointer moves. However, we can attach input devices
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue