feat: add windowrule option scroller_proportion_single
This commit is contained in:
@@ -90,6 +90,7 @@ typedef struct {
|
|||||||
int noblur;
|
int noblur;
|
||||||
float focused_opacity;
|
float focused_opacity;
|
||||||
float unfocused_opacity;
|
float unfocused_opacity;
|
||||||
|
float scroller_proportion_single;
|
||||||
uint32_t passmod;
|
uint32_t passmod;
|
||||||
xkb_keysym_t keysym;
|
xkb_keysym_t keysym;
|
||||||
KeyBinding globalkeybinding;
|
KeyBinding globalkeybinding;
|
||||||
@@ -1679,6 +1680,7 @@ void parse_option(Config *config, char *key, char *value) {
|
|||||||
// float rule value, relay to a client property
|
// float rule value, relay to a client property
|
||||||
rule->focused_opacity = 0;
|
rule->focused_opacity = 0;
|
||||||
rule->unfocused_opacity = 0;
|
rule->unfocused_opacity = 0;
|
||||||
|
rule->scroller_proportion_single = 0.0f;
|
||||||
rule->scroller_proportion = 0;
|
rule->scroller_proportion = 0;
|
||||||
|
|
||||||
// special rule value,not directly set to client property
|
// special rule value,not directly set to client property
|
||||||
@@ -1750,6 +1752,8 @@ void parse_option(Config *config, char *key, char *value) {
|
|||||||
rule->isunglobal = atoi(val);
|
rule->isunglobal = atoi(val);
|
||||||
} else if (strcmp(key, "isglobal") == 0) {
|
} else if (strcmp(key, "isglobal") == 0) {
|
||||||
rule->isglobal = atoi(val);
|
rule->isglobal = atoi(val);
|
||||||
|
} else if (strcmp(key, "scroller_proportion_single") == 0) {
|
||||||
|
rule->scroller_proportion_single = atof(val);
|
||||||
} else if (strcmp(key, "unfocused_opacity") == 0) {
|
} else if (strcmp(key, "unfocused_opacity") == 0) {
|
||||||
rule->unfocused_opacity = atof(val);
|
rule->unfocused_opacity = atof(val);
|
||||||
} else if (strcmp(key, "focused_opacity") == 0) {
|
} else if (strcmp(key, "focused_opacity") == 0) {
|
||||||
|
|||||||
@@ -192,6 +192,7 @@ void deck(Monitor *m) {
|
|||||||
// 滚动布局
|
// 滚动布局
|
||||||
void scroller(Monitor *m) {
|
void scroller(Monitor *m) {
|
||||||
unsigned int i, n, j;
|
unsigned int i, n, j;
|
||||||
|
float single_proportion = 1.0;
|
||||||
|
|
||||||
Client *c = NULL, *root_client = NULL;
|
Client *c = NULL, *root_client = NULL;
|
||||||
Client **tempClients = NULL; // 初始化为 NULL
|
Client **tempClients = NULL; // 初始化为 NULL
|
||||||
@@ -233,9 +234,13 @@ void scroller(Monitor *m) {
|
|||||||
|
|
||||||
if (n == 1 && !scroller_ignore_proportion_single) {
|
if (n == 1 && !scroller_ignore_proportion_single) {
|
||||||
c = tempClients[0];
|
c = tempClients[0];
|
||||||
|
|
||||||
|
single_proportion = c->scroller_proportion_single > 0.0f
|
||||||
|
? c->scroller_proportion_single
|
||||||
|
: scroller_default_proportion_single;
|
||||||
|
|
||||||
target_geom.height = m->w.height - 2 * cur_gappov;
|
target_geom.height = m->w.height - 2 * cur_gappov;
|
||||||
target_geom.width =
|
target_geom.width = (m->w.width - 2 * cur_gappoh) * single_proportion;
|
||||||
(m->w.width - 2 * cur_gappoh) * scroller_default_proportion_single;
|
|
||||||
target_geom.x = m->w.x + (m->w.width - target_geom.width) / 2;
|
target_geom.x = m->w.x + (m->w.width - target_geom.width) / 2;
|
||||||
target_geom.y = m->w.y + (m->w.height - target_geom.height) / 2;
|
target_geom.y = m->w.y + (m->w.height - target_geom.height) / 2;
|
||||||
resize(c, target_geom, 0);
|
resize(c, target_geom, 0);
|
||||||
|
|||||||
@@ -157,6 +157,8 @@ void vertical_deck(Monitor *m) {
|
|||||||
|
|
||||||
void vertical_scroller(Monitor *m) {
|
void vertical_scroller(Monitor *m) {
|
||||||
unsigned int i, n, j;
|
unsigned int i, n, j;
|
||||||
|
float single_proportion = 1.0;
|
||||||
|
|
||||||
Client *c = NULL, *root_client = NULL;
|
Client *c = NULL, *root_client = NULL;
|
||||||
Client **tempClients = NULL;
|
Client **tempClients = NULL;
|
||||||
struct wlr_box target_geom;
|
struct wlr_box target_geom;
|
||||||
@@ -194,9 +196,13 @@ void vertical_scroller(Monitor *m) {
|
|||||||
|
|
||||||
if (n == 1 && !scroller_ignore_proportion_single) {
|
if (n == 1 && !scroller_ignore_proportion_single) {
|
||||||
c = tempClients[0];
|
c = tempClients[0];
|
||||||
|
|
||||||
|
single_proportion = c->scroller_proportion_single > 0.0f
|
||||||
|
? c->scroller_proportion_single
|
||||||
|
: scroller_default_proportion_single;
|
||||||
|
|
||||||
target_geom.width = m->w.width - 2 * cur_gappoh;
|
target_geom.width = m->w.width - 2 * cur_gappoh;
|
||||||
target_geom.height =
|
target_geom.height = (m->w.height - 2 * cur_gappov) * single_proportion;
|
||||||
(m->w.height - 2 * cur_gappov) * scroller_default_proportion_single;
|
|
||||||
target_geom.x = m->w.x + (m->w.width - target_geom.width) / 2;
|
target_geom.x = m->w.x + (m->w.width - target_geom.width) / 2;
|
||||||
target_geom.y = m->w.y + (m->w.height - target_geom.height) / 2;
|
target_geom.y = m->w.y + (m->w.height - target_geom.height) / 2;
|
||||||
resize(c, target_geom, 0);
|
resize(c, target_geom, 0);
|
||||||
|
|||||||
@@ -376,6 +376,7 @@ struct Client {
|
|||||||
int tearing_hint;
|
int tearing_hint;
|
||||||
int force_tearing;
|
int force_tearing;
|
||||||
int allow_shortcuts_inhibit;
|
int allow_shortcuts_inhibit;
|
||||||
|
float scroller_proportion_single;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@@ -1173,6 +1174,7 @@ static void apply_rule_properties(Client *c, const ConfigWinRule *r) {
|
|||||||
APPLY_INT_PROP(c, r, allow_shortcuts_inhibit);
|
APPLY_INT_PROP(c, r, allow_shortcuts_inhibit);
|
||||||
|
|
||||||
APPLY_FLOAT_PROP(c, r, scroller_proportion);
|
APPLY_FLOAT_PROP(c, r, scroller_proportion);
|
||||||
|
APPLY_FLOAT_PROP(c, r, scroller_proportion_single);
|
||||||
APPLY_FLOAT_PROP(c, r, focused_opacity);
|
APPLY_FLOAT_PROP(c, r, focused_opacity);
|
||||||
APPLY_FLOAT_PROP(c, r, unfocused_opacity);
|
APPLY_FLOAT_PROP(c, r, unfocused_opacity);
|
||||||
|
|
||||||
@@ -3623,6 +3625,7 @@ void init_client_properties(Client *c) {
|
|||||||
c->force_maximize = 0;
|
c->force_maximize = 0;
|
||||||
c->force_tearing = 0;
|
c->force_tearing = 0;
|
||||||
c->allow_shortcuts_inhibit = SHORTCUTS_INHIBIT_ENABLE;
|
c->allow_shortcuts_inhibit = SHORTCUTS_INHIBIT_ENABLE;
|
||||||
|
c->scroller_proportion_single = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
void // old fix to 0.5
|
void // old fix to 0.5
|
||||||
|
|||||||
Reference in New Issue
Block a user