re-import $macro_backtrace patch and improve it by adding $n_args and $args
[nedit-bw.git] / ewmh-raise.diff
blobd81007f0d2ebe634c5066b7de32230cac3dc2079
1 ---
3 source/server.c | 5 ++++-
4 util/misc.c | 30 ++++++++++++++++++++++++++++++
5 util/misc.h | 4 ++++
6 3 files changed, 38 insertions(+), 1 deletion(-)
8 diff --quilt old/source/server.c new/source/server.c
9 --- old/source/server.c
10 +++ new/source/server.c
11 @@ -353,6 +353,7 @@ static void processServerCommandString(c
13 else {
14 RaiseDocument(window);
15 + WmClientMsg(TheDisplay, XtWindow(window->shell), "_NET_ACTIVE_WINDOW", 0, 0, 0, 0, 0);
16 XMapRaised(TheDisplay, XtWindow(window->shell));
18 return;
19 @@ -498,8 +499,10 @@ static void processServerCommandString(c
20 if (*doCommand != '\0') {
21 RaiseDocument(window);
23 - if (!iconicFlag)
24 + if (!iconicFlag) {
25 + WmClientMsg(TheDisplay, XtWindow(window->shell), "_NET_ACTIVE_WINDOW", 0, 0, 0, 0, 0);
26 XMapRaised(TheDisplay, XtWindow(window->shell));
27 + }
29 /* Starting a new command while another one is still running
30 in the same window is not possible (crashes). */
31 diff --quilt old/util/misc.c new/util/misc.c
32 --- old/util/misc.c
33 +++ new/util/misc.c
34 @@ -164,6 +164,35 @@ static long queryDesktop(Display *displa
35 static void warning(const char* mesg);
36 static void microsleep(long usecs);
38 +int WmClientMsg(Display *disp, Window win, const char *msg, /* {{{ */
39 + unsigned long data0, unsigned long data1,
40 + unsigned long data2, unsigned long data3,
41 + unsigned long data4) {
42 + XEvent event;
43 + long mask = SubstructureRedirectMask | SubstructureNotifyMask;
45 + event.xclient.type = ClientMessage;
46 + event.xclient.serial = 0;
47 + event.xclient.send_event = True;
48 + event.xclient.message_type = XInternAtom(disp, msg, False);
49 + event.xclient.window = win;
50 + event.xclient.format = 32;
51 + event.xclient.data.l[0] = data0;
52 + event.xclient.data.l[1] = data1;
53 + event.xclient.data.l[2] = data2;
54 + event.xclient.data.l[3] = data3;
55 + event.xclient.data.l[4] = data4;
57 + if (XSendEvent(disp, DefaultRootWindow(disp), False, mask, &event)) {
58 + return EXIT_SUCCESS;
59 + }
60 + else {
61 + fprintf(stderr, "Cannot send %s event.\n", msg);
62 + return EXIT_FAILURE;
63 + }
64 +}/*}}}*/
68 ** Set up closeCB to be called when the user selects close from the
69 ** window menu. The close menu item usually activates f.kill which
70 @@ -891,6 +920,7 @@ void RaiseWindow(Display *display, Windo
71 XSetInputFocus(display, w, RevertToParent, CurrentTime);
74 + WmClientMsg(display, w, "_NET_ACTIVE_WINDOW", 0, 0, 0, 0, 0);
75 XMapRaised(display, w);
78 diff --quilt old/util/misc.h new/util/misc.h
79 --- old/util/misc.h
80 +++ new/util/misc.h
81 @@ -48,6 +48,10 @@
82 #define BUTTON_WIDTH_MARGIN 12
85 +int WmClientMsg(Display *disp, Window win, const char *msg,
86 + unsigned long data0, unsigned long data1,
87 + unsigned long data2, unsigned long data3,
88 + unsigned long data4);
89 void AddMotifCloseCallback(Widget shell, XtCallbackProc closeCB, void *arg);
90 void SuppressPassiveGrabWarnings(void);
91 void PopDownBugPatch(Widget w);