Browse Source

room-history: Be consistent about compact visual content activation

It was already not possible with the mouse, but there was still a hover
effect, and the key bindings where still working.
merge-requests/2003/head
Kévin Commaille 11 months ago
parent
commit
eea9e9122e
No known key found for this signature in database
GPG Key ID: C971D9DBC9D678D
  1. 26
      data/resources/stylesheet/_room_history.scss
  2. 15
      src/session/view/content/room_history/message_row/visual_media.rs

26
data/resources/stylesheet/_room_history.scss

@ -279,6 +279,12 @@ state-group-row.room-history-row {
border-radius: vendor.$menu_radius;
}
&.compact {
> .instructions {
padding: 6px;
}
}
// Copied from .osd button style in https://gitlab.gnome.org/GNOME/libadwaita/-/blob/main/src/stylesheet/widgets/_buttons.scss
&.has-placeholder {
> .instructions {
@ -290,17 +296,19 @@ state-group-row.room-history-row {
}
}
&:hover {
> .instructions {
color: white;
background-color: color-mix(in srgb, black calc(0.85 * 65%), currentColor calc(0.15 * 65%));
&:not(.compact) {
&:hover {
> .instructions {
color: white;
background-color: color-mix(in srgb, black calc(0.85 * 65%), currentColor calc(0.15 * 65%));
}
}
}
&:active {
> .instructions {
color: white;
background-color: color-mix(in srgb, black calc(0.75 * 65%), currentColor calc(0.25 * 65%));
&:active {
> .instructions {
color: white;
background-color: color-mix(in srgb, black calc(0.75 * 65%), currentColor calc(0.25 * 65%));
}
}
}
}

15
src/session/view/content/room_history/message_row/visual_media.rs

@ -357,7 +357,7 @@ mod imp {
};
self.preview_instructions_icon.set_icon_size(icon_size);
self.update_gesture_click();
self.update_activation();
self.obj().notify_compact();
}
@ -369,16 +369,16 @@ mod imp {
self.activatable.set(activatable);
self.update_gesture_click();
self.update_activation();
self.obj().notify_activatable();
}
/// Add or remove the click controller given the current state.
fn update_gesture_click(&self) {
let needs_controller = self.activatable.get() && !self.compact.get();
/// Enable or disable the activation of this row for the current state.
fn update_activation(&self) {
let is_activatable = self.activatable.get() && !self.compact.get();
let gesture_click = self.gesture_click.upgrade();
if needs_controller && gesture_click.is_none() {
if is_activatable && gesture_click.is_none() {
let gesture_click = gtk::GestureClick::new();
gesture_click.connect_released(clone!(
@ -395,6 +395,9 @@ mod imp {
self.gesture_click.set(None);
self.overlay.remove_controller(&gesture_click);
}
self.obj()
.action_set_enabled("message-visual-media.activate", is_activatable);
}
/// Set the cache key with the given value.

Loading…
Cancel
Save