Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set MessageMetaItem.label.selectable to false when run on touchscreen #1535

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tpikonen
Copy link
Contributor

Add new function Dino.Ui.on_touchscreen() which returns true when Dino is run on a touchscreen device. Use this function to set the selectable property on MessageMetaItem labels.

This makes it possible to move from the conversation view to the conversation list by swiping.

Add new function Dino.Ui.on_touchscreen() which returns true when Dino
is run on a touchscreen device. Use this function to set the selectable
property on MessageMetaItem labels.

This makes it possible to move from the conversation view to the
conversation list by swiping.
@fiaxh
Copy link
Member

fiaxh commented Jan 13, 2024

With this change, people that use laptops with touch screens would not be able to select text anymore.

Also, setting selectable=false might also not be what you want on mobile - mobile users might also want to select text.

I don't know the solution to those issues or whether there is one. Maybe try to search for other projects that use the libadwaita leaflet container and make use of selectable labels, and see if and how they solve the issue.

@tpikonen
Copy link
Contributor Author

I don't know the solution to those issues or whether there is one. Maybe try to search for other projects that use libadwaita, and make use of selectable labels, and see if and how they solve the issue.

The optimal solution would be to fix GtkLabel (or make a new label widget) to have a separate selection mode. AFAIK this does not exist yet, but for now this hack has worked fine for me.

@fiaxh
Copy link
Member

fiaxh commented Jan 13, 2024

but for now this hack has worked fine for me.

As I just mentioned, it breaks text selection on laptops with touch screens. This is a blocker for merging.

@eerielili
Copy link
Contributor

eerielili commented Jan 18, 2024

@fiaxh @tpikonen Maybe also checking own ressource stanza to check if on desktop/laptop should do the trick ?
ie:

stream_interactor.get_module(EntityInfo.IDENTITY).get_identity.begin(conversation.account, full_jid, (_, res) => {
Xep.ServiceDiscovery.Identity? identity = stream_interactor.get_module(EntityInfo.IDENTITY).get_identity.end(res);
Image image = new Image() { hexpand=false, valign=Align.CENTER };
if (identity != null && (identity.type_ == Xep.ServiceDiscovery.Identity.TYPE_PHONE || identity.type_ == Xep.ServiceDiscovery.Identity.TYPE_TABLET)) {
image.set_from_icon_name("dino-device-phone-symbolic");
} else {
image.set_from_icon_name("dino-device-desktop-symbolic");
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants