Clear stale X11 urgency indicators
1e7a40ee43f7ecc4626c17a30bd583435ce4a11d
1 parent
fa20417b
swm.c
+10 -4
| 6852 | 6852 | client_t *c = wl_container_of(listener, c, dissociate); |
|
| 6853 | 6853 | wl_list_remove(&c->map.link); |
|
| 6854 | 6854 | wl_list_remove(&c->unmap.link); |
|
| 6855 | 6855 | } |
|
| 6856 | 6856 | ||
| 6857 | + | /* Read X11's urgency hint; deleting WM_HINTS clears urgency. */ |
|
| 6858 | + | static bool x11_hints_urgent(client_t *c) { |
|
| 6859 | + | return c->surface.xwayland->hints && |
|
| 6860 | + | xcb_icccm_wm_hints_get_urgency(c->surface.xwayland->hints); |
|
| 6861 | + | } |
|
| 6862 | + | ||
| 6857 | 6863 | /* Update urgency and input behavior from an X11 window's hints. */ |
|
| 6858 | 6864 | void set_hints(struct wl_listener *listener, void *data) { |
|
| 6859 | 6865 | client_t *c = wl_container_of(listener, c, set_hints); |
|
| 6860 | 6866 | struct wlr_surface *surface = client_surface(c); |
|
| 6861 | 6867 | ||
| 6862 | - | if (c == focus_top(selmon) || !c->surface.xwayland->hints) |
|
| 6868 | + | if (c == focus_top(selmon)) |
|
| 6863 | 6869 | return; |
|
| 6864 | 6870 | ||
| 6865 | - | c->is_urgent = xcb_icccm_wm_hints_get_urgency(c->surface.xwayland->hints); |
|
| 6871 | + | c->is_urgent = x11_hints_urgent(c); |
|
| 6866 | 6872 | print_status(); |
|
| 6867 | 6873 | ||
| 6868 | - | if (c->is_urgent && surface && surface->mapped) |
|
| 6869 | - | client_set_border_color(c, urgentcolor); |
|
| 6874 | + | if (surface && surface->mapped) |
|
| 6875 | + | client_set_border_color(c, c->is_urgent ? urgentcolor : bordercolor); |
|
| 6870 | 6876 | } |
|
| 6871 | 6877 | ||
| 6872 | 6878 | /* Connect XWayland to swm's seat and set its default cursor. */ |
|
| 6873 | 6879 | void xwayland_ready(struct wl_listener *listener, void *data) { |
|
| 6874 | 6880 | struct wlr_xcursor *xcursor; |
test/unit.c
+10 -0
| 872 | 872 | }; |
|
| 873 | 873 | ||
| 874 | 874 | assert(layer_surface_output_monitor(&wrapper) == &monitor); |
|
| 875 | 875 | } |
|
| 876 | 876 | ||
| 877 | + | /* Verify deleting X11 WM_HINTS clears a previously urgent window. */ |
|
| 878 | + | static void test_x11_urgency(void) { |
|
| 879 | + | struct wlr_xwayland_surface xsurface = {}; |
|
| 880 | + | client_t client = { .type = X11, .is_urgent = true }; |
|
| 881 | + | ||
| 882 | + | client.surface.xwayland = &xsurface; |
|
| 883 | + | assert(!x11_hints_urgent(&client)); |
|
| 884 | + | } |
|
| 885 | + | ||
| 877 | 886 | /* Verify text-input and input-method wrappers are created and released. */ |
|
| 878 | 887 | static void test_input_method_lifecycle(void) { |
|
| 879 | 888 | struct wlr_seat fake_seat = {}; |
|
| 880 | 889 | struct wlr_text_input_manager_v3 fake_ti_manager = {}; |
|
| 881 | 890 | struct wlr_text_input_v3 text_input = {}; |
| 1105 | 1114 | { "small-helpers", test_small_helpers }, |
|
| 1106 | 1115 | { "pointer-grab-button", test_pointer_grab_button }, |
|
| 1107 | 1116 | { "client-accessors", test_client_accessors }, |
|
| 1108 | 1117 | { "autostart", test_autostart_execution }, |
|
| 1109 | 1118 | { "pointer-gestures", test_pointer_gestures }, |
|
| 1119 | + | { "x11-urgency", test_x11_urgency }, |
|
| 1110 | 1120 | { "shortcut-release", test_shortcut_release }, |
|
| 1111 | 1121 | { "input-method", test_input_method_lifecycle }, |
|
| 1112 | 1122 | { "output-role-scale-change", test_output_role_scale_change }, |
|
| 1113 | 1123 | { "input-early-paths", test_input_early_paths }, |
|
| 1114 | 1124 | { "command-line", test_command_line_errors }, |