Merge remote-tracking branch 'upstream/master' into master

This commit is contained in:
TheAvidDev 2020-09-14 22:39:42 -04:00
commit 0d87ea0d67
8 changed files with 26 additions and 4 deletions

View file

@ -11,6 +11,7 @@ struct swaynag_type {
// Colors
uint32_t button_text;
uint32_t button_background;
uint32_t details_background;
uint32_t background;
uint32_t text;
uint32_t border;

View file

@ -299,6 +299,7 @@ void cursor_unhide(struct sway_cursor *cursor) {
cursor_set_image(cursor, image, cursor->image_client);
}
cursor_rebase(cursor);
wl_event_source_timer_update(cursor->hide_source, cursor_get_timeout(cursor));
}
static void pointer_motion(struct sway_cursor *cursor, uint32_t time_msec,
@ -377,7 +378,6 @@ void dispatch_cursor_button(struct sway_cursor *cursor,
static void handle_pointer_button(struct wl_listener *listener, void *data) {
struct sway_cursor *cursor = wl_container_of(listener, cursor, button);
struct wlr_event_pointer_button *event = data;
cursor_handle_activity(cursor, event->device);
if (event->state == WLR_BUTTON_PRESSED) {
cursor->pressed_button_count++;
@ -389,6 +389,7 @@ static void handle_pointer_button(struct wl_listener *listener, void *data) {
}
}
cursor_handle_activity(cursor, event->device);
dispatch_cursor_button(cursor, event->device,
event->time_msec, event->button, event->state);
transaction_commit_dirty();

View file

@ -1482,7 +1482,6 @@ void seat_consider_warp_to_focus(struct sway_seat *seat) {
}
if (seat->cursor->hidden){
cursor_unhide(seat->cursor);
wl_event_source_timer_update(seat->cursor->hide_source, cursor_get_timeout(seat->cursor));
}
}

View file

@ -38,6 +38,7 @@ int swaynag_parse_options(int argc, char **argv, struct swaynag *swaynag,
TO_COLOR_BORDER,
TO_COLOR_BORDER_BOTTOM,
TO_COLOR_BUTTON,
TO_COLOR_DETAILS,
TO_COLOR_TEXT,
TO_COLOR_BUTTON_TEXT,
TO_THICK_BAR_BORDER,
@ -77,6 +78,7 @@ int swaynag_parse_options(int argc, char **argv, struct swaynag *swaynag,
{"border-bottom-size", required_argument, NULL, TO_THICK_BAR_BORDER},
{"message-padding", required_argument, NULL, TO_PADDING_MESSAGE},
{"details-border-size", required_argument, NULL, TO_THICK_DET_BORDER},
{"details-background", required_argument, NULL, TO_COLOR_DETAILS},
{"button-border-size", required_argument, NULL, TO_THICK_BTN_BORDER},
{"button-gap", required_argument, NULL, TO_GAP_BTN},
{"button-dismiss-gap", required_argument, NULL, TO_GAP_BTN_DISMISS},
@ -122,6 +124,7 @@ int swaynag_parse_options(int argc, char **argv, struct swaynag *swaynag,
" --border-bottom-size size Thickness of the bar border.\n"
" --message-padding padding Padding for the message.\n"
" --details-border-size size Thickness for the details border.\n"
" --details-background RRGGBB[AA] Details background color.\n"
" --button-border-size size Thickness for the button border.\n"
" --button-gap gap Size of the gap between buttons\n"
" --button-dismiss-gap gap Size of the gap for dismiss button.\n"
@ -253,6 +256,11 @@ int swaynag_parse_options(int argc, char **argv, struct swaynag *swaynag,
fprintf(stderr, "Invalid button background color: %s", optarg);
}
break;
case TO_COLOR_DETAILS: // Details background color
if (type && !parse_color(optarg, &type->details_background)) {
fprintf(stderr, "Invalid details background color: %s", optarg);
}
break;
case TO_COLOR_TEXT: // Text color
if (type && !parse_color(optarg, &type->text)) {
fprintf(stderr, "Invalid text color: %s", optarg);

View file

@ -37,7 +37,7 @@ static void render_details_scroll_button(cairo_t *cairo,
int border = swaynag->type->button_border_thickness * swaynag->scale;
int padding = swaynag->type->button_padding * swaynag->scale;
cairo_set_source_u32(cairo, swaynag->type->border);
cairo_set_source_u32(cairo, swaynag->type->details_background);
cairo_rectangle(cairo, button->x, button->y,
button->width, button->height);
cairo_fill(cairo);
@ -153,7 +153,7 @@ static uint32_t render_detailed(cairo_t *cairo, struct swaynag *swaynag,
&swaynag->details.button_down);
}
cairo_set_source_u32(cairo, swaynag->type->border);
cairo_set_source_u32(cairo, swaynag->type->details_background);
cairo_rectangle(cairo, swaynag->details.x, swaynag->details.y,
swaynag->details.width, swaynag->details.height);
cairo_fill(cairo);

View file

@ -106,6 +106,9 @@ _swaynag_ [options...]
*--message-padding* <padding>
Set the padding for the message.
*--details-background* <RRGGBB[AA]>
Set the color for the background for details.
*--details-border-size* <size>
Set the thickness for the details border.

View file

@ -53,6 +53,9 @@ The following sizing options can also be set:
*message-padding=<padding>*
Set the padding for the message.
*details-gackground=<color>*
The background color for the details.
*details-border-size=<size>*
Set the thickness for the details border.

View file

@ -36,6 +36,7 @@ void swaynag_types_add_default(list_t *types) {
| ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT
| ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT;
type_defaults->button_background = 0x333333FF;
type_defaults->details_background = 0x333333FF;
type_defaults->background = 0x323232FF;
type_defaults->text = 0xFFFFFFFF;
type_defaults->button_text = 0xFFFFFFFF;
@ -53,6 +54,7 @@ void swaynag_types_add_default(list_t *types) {
struct swaynag_type *type_error = swaynag_type_new("error");
type_error->button_background = 0x680A0AFF;
type_error->details_background = 0x680A0AFF;
type_error->background = 0x900000FF;
type_error->text = 0xFFFFFFFF;
type_error->button_text = 0xFFFFFFFF;
@ -62,6 +64,7 @@ void swaynag_types_add_default(list_t *types) {
struct swaynag_type *type_warning = swaynag_type_new("warning");
type_warning->button_background = 0xFFC100FF;
type_warning->details_background = 0xFFC100FF;
type_warning->background = 0xFFA800FF;
type_warning->text = 0x000000FF;
type_warning->button_text = 0x000000FF;
@ -102,6 +105,10 @@ void swaynag_type_merge(struct swaynag_type *dest, struct swaynag_type *src) {
dest->button_background = src->button_background;
}
if (src->details_background > 0) {
dest->details_background = src->details_background;
}
if (src->background > 0) {
dest->background = src->background;
}