gxmessage selection bug in v3.4.3

Post here if you feel others can duplicate your so discovered "bug"

Moderator: Forum moderators

Post Reply
User avatar
MochiMoppel
Posts: 1294
Joined: Mon Jun 15, 2020 6:25 am
Location: Japan
Has thanked: 22 times
Been thanked: 479 times

gxmessage selection bug in v3.4.3

Post by MochiMoppel »

gxmessage version 3.4.3
Bug: Message text can not be selected and copied when background color set
Example: gxmessage -bg red sampletext
What happens: mouse cursor turns into beam when hovering over sampletext, but text is not selectable

However when setting foreground color gxmessage works as expected. Text is selectable:
gxmessage -fg red sampletext

Observed in Fossapup64_9.6 .Other distros (e.g. Slacko8) may be affected too.

Burunduk
Posts: 258
Joined: Thu Jun 16, 2022 6:16 pm
Has thanked: 7 times
Been thanked: 127 times

Re: gxmessage selection bug in v3.4.3

Post by Burunduk »

The gxmessage-2.20.4 (gtk2) from Fossapup64 9.5 doesn't have this problem.
In the gxmessage-3.4.3 (gtk3) text can be selected but is not properly highlighted.
It may be a bug in gtk_widget_override_background_color. The function is deprecated and probably won't be fixed.

I've tried to adapt an example from docs.gtk.org. I don't really know how but it seems to work.

gxmessage-3.4.3/gxmessage.c patch:

Code: Select all

443a444,446
>         GtkCssProvider  *provider;
>         GtkStyleContext *context;
>         guint8     css_data[128] = {0};
446c449
<     gtk_window_set_default_icon_name ("gxmessage");
---
>     //gtk_window_set_default_icon_name ("gxmessage");
519,520c522,524
< 			gtk_widget_override_color (message_widget,
< 			  GTK_STATE_NORMAL, &color);
---
> 			snprintf(css_data, sizeof(css_data),
>                                  "textview text { color: %s; }\n",
>                                  gdk_rgba_to_string(&color));
525,526c529,533
< 			gtk_widget_override_background_color (message_widget,
< 			  GTK_STATE_NORMAL, &color);
---
> 			snprintf(css_data+strlen(css_data),
>                                  sizeof(css_data)-strlen(css_data),
>                                  "textview text { background-color: %s; }\n",
>                                  gdk_rgba_to_string(&color));
>                         
528a536,543
>         if (strlen(css_data)) {
>                 provider = gtk_css_provider_new ();
>                 gtk_css_provider_load_from_data (provider, css_data, -1, NULL);
>                 context = gtk_widget_get_style_context (message_widget);
>                 gtk_style_context_add_provider (context,
>                                                 GTK_STYLE_PROVIDER (provider),
>                                                 GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
>         }

Note: //gtk_window_set_default_icon_name ("gxmessage"); is from a different story. I've removed it to choose an icon with the -name option.

Post Reply

Return to “Bug Reports”