Skip to content

Commit

Permalink
ratpoison: rework 0010-Notification-on-urgency-flag.patch to fix segf…
Browse files Browse the repository at this point in the history
…ault, relbump
  • Loading branch information
sighook committed May 16, 2024
1 parent d6c595b commit 3589708
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 22 deletions.
2 changes: 1 addition & 1 deletion ratpoison/.md5sum
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ a8da2c3fa7027924308ff32015c39e17 0006-Fix-don-t-draw-help-window-beyond-screen-
4e5e803df9eae0683cec89182e6c46cf 0007-Fix-draw-the-license-text-centered-on-multi-screen-s.patch
be4ad9e2d3afbe4f1b7e7ce336b05a3b 0008-Fix-exclude-degenerate-case-from-frame-overlap.patch
21b1fb165c64945114bbfb2dfa76e425 0009-ratpoison.mdoc.1-add-missing-infofmt-description-and.patch
886d58ca00f8f776c8124cad5a2f78a4 0010-Notification-on-urgency-flag.patch
5102314ef1b7eb7b81a104d0371bcd4e 0010-Notification-on-urgency-flag.patch
63afedddd7897bb248cf6eea2b7f560e genratpoison-re.pl
de38668b1fa3d65821c1da2e35c52cd3 ratpoison-re.pl.diff
52 changes: 32 additions & 20 deletions ratpoison/0010-Notification-on-urgency-flag.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 809f81ba75cb8e0b134f9dacfb027c7a9ec6d292 Mon Sep 17 00:00:00 2001
From 3e303a26053fa5e865d8285b58f9951bb3482829 Mon Sep 17 00:00:00 2001
From: Alexandr Savca <[email protected]>
Date: Sun, 12 May 2024 18:46:35 +0300
Subject: [PATCH] Notification on urgency flag
Subject: [PATCH 10/10] Notification on urgency flag

Slightly modified original patch by Eoin McLoughlin (see below).

Expand All @@ -24,16 +24,16 @@ Reference:
https://lists.nongnu.org/archive/html/ratpoison-devel/2009-11/msg00004.htm
https://lists.nongnu.org/archive/html/ratpoison-devel/2009-11/msg00005.htm
---
src/events.c | 14 ++++++++++++++
src/manage.c | 10 ++++++++++
src/events.c | 20 ++++++++++++++++++++
src/manage.c | 16 ++++++++++++++++
src/manage.h | 1 +
3 files changed, 25 insertions(+)
3 files changed, 37 insertions(+)

diff --git a/src/events.c b/src/events.c
index 4808d29..8031d3d 100644
index 4808d29..9aac114 100644
--- a/src/events.c
+++ b/src/events.c
@@ -632,6 +632,20 @@ property_notify (XEvent *ev)
@@ -632,6 +632,26 @@ property_notify (XEvent *ev)
win->transient = XGetTransientForHint (dpy, win->w, &win->transient_for);
break;

Expand All @@ -42,35 +42,47 @@ index 4808d29..8031d3d 100644
+
+ if (has_urgency_flag (win))
+ {
+ rp_group *g = groups_find_group_by_window (win);
+ rp_window_elem *elem = group_find_window (&g->mapped_windows, win);
+ char* commandStr = xsprintf ("echo Window %i (%s) in group %i wants attention",
+ elem->number, win->wm_name, g->number);
+ command (0, commandStr);
+ free (commandStr);
+ rp_group *group = groups_find_group_by_window (win);
+ rp_window_elem *win_elem;
+
+ if (group != NULL)
+ win_elem = group_find_window (&group->mapped_windows, win);
+
+ if (!win_elem && group != NULL)
+ win_elem = group_find_window (&group->unmapped_windows, win);
+
+ if (win_elem)
+ marked_message_printf (0, 0, "Window %i (%s) in group %i wants attention",
+ win_elem->number, window_name (win), group->number);
+ }
+ break;
+
default:
PRINT_DEBUG (("Unhandled property notify event: %ld\n", ev->xproperty.atom));
break;
diff --git a/src/manage.c b/src/manage.c
index 78be591..9cc428f 100644
index 78be591..06e5442 100644
--- a/src/manage.c
+++ b/src/manage.c
@@ -173,6 +173,16 @@ update_normal_hints (rp_window *win)
@@ -173,6 +173,22 @@ update_normal_hints (rp_window *win)
#endif
}

+/* Return non-zero if window hints have urgency flag set */
+int
+has_urgency_flag (rp_window *win)
+{
+ XWMHints *hints = XGetWMHints (dpy, win->w);
+ int has_urgency = (hints->flags & XUrgencyHint) == XUrgencyHint;
+ XWMHints *wmh;
+ int urgency_flag = 0;
+
+ if (!(wmh = XGetWMHints (dpy, win->w)))
+ return 0;
+
+ if (wmh->flags & XUrgencyHint)
+ urgency_flag = 1;
+
+ XFree (hints);
+ return has_urgency;
+ XFree (wmh);
+ return urgency_flag;
+}

static char *
Expand All @@ -88,5 +100,5 @@ index 8001e09..ed80179 100644
void set_state (rp_window *win, int state);
long get_state (rp_window *win);
--
2.45.0
2.45.1

2 changes: 1 addition & 1 deletion ratpoison/Pkgfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

name=ratpoison
version=1.4.9-db94d49
release=4
release=5
source="0001-obeyresizehints-option-to-dis-obey-ICCCM-window-resi.patch
0002-fix-dedicate-frame.patch
0003-fix-edge-case-for-find_frame_-left-right-up-down-fun.patch
Expand Down

0 comments on commit 3589708

Please sign in to comment.