From: Julien Danjou <julien@danjou.info>
To: emacs-devel@gnu.org
Cc: Julien Danjou <julien@danjou.info>
Subject: [PATCH 2/6] xselect: split x_send_client_event to use Atom directly
Date: Wed, 10 Nov 2010 14:49:52 +0100 [thread overview]
Message-ID: <1289396996-26774-3-git-send-email-julien@danjou.info> (raw)
In-Reply-To: <1289396996-26774-1-git-send-email-julien@danjou.info>
Signed-off-by: Julien Danjou <julien@danjou.info>
---
src/ChangeLog | 9 +++++++++
src/lisp.h | 1 -
src/xselect.c | 17 +++++++++++++----
src/xterm.c | 38 +++++++++++++++++++-------------------
src/xterm.h | 7 +++++++
5 files changed, 48 insertions(+), 24 deletions(-)
diff --git a/src/ChangeLog b/src/ChangeLog
index 994d106..8810dad 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,14 @@
2010-11-09 Julien Danjou <julien@danjou.info>
+ * xterm.c (set_wm_state): Use x_send_client_event rather than
+ Fx_send_client_event, using Atom directly.
+ (x_ewmh_activate_frame): Ditto.
+
+ * xselect.c (Fx_send_client_event): Split and create
+ x_send_client_event.
+
+ * lisp.h: Do not EXFUN Fx_send_client_event.
+
* xterm.c (x_set_frame_alpha): Use _NET_WM_WINDOW_OPACITY atom
from dpyinfo.
(wm_supports): Use atoms from dpyinfo.
diff --git a/src/lisp.h b/src/lisp.h
index 4adf9ef..6c00aa2 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -3600,7 +3600,6 @@ extern void syms_of_xfns (void);
extern void syms_of_xsmfns (void);
/* Defined in xselect.c */
-EXFUN (Fx_send_client_event, 6);
extern void syms_of_xselect (void);
/* Defined in xterm.c */
diff --git a/src/xselect.c b/src/xselect.c
index 7479f24..b566b90 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -2527,6 +2527,18 @@ are ignored. */)
(Lisp_Object display, Lisp_Object dest, Lisp_Object from, Lisp_Object message_type, Lisp_Object format, Lisp_Object values)
{
struct x_display_info *dpyinfo = check_x_display_info (display);
+
+ x_send_client_event(display, dest, from,
+ XInternAtom (dpyinfo->display, SDATA (message_type), False),
+ format, values);
+
+ return Qnil;
+}
+
+void
+x_send_client_event (Lisp_Object display, Lisp_Object dest, Lisp_Object from, Atom message_type, Lisp_Object format, Lisp_Object values)
+{
+ struct x_display_info *dpyinfo = check_x_display_info (display);
Window wdest;
XEvent event;
Lisp_Object cons;
@@ -2584,8 +2596,7 @@ are ignored. */)
BLOCK_INPUT;
- event.xclient.message_type
- = XInternAtom (dpyinfo->display, SDATA (message_type), False);
+ event.xclient.message_type = message_type;
event.xclient.display = dpyinfo->display;
/* Some clients (metacity for example) expects sending window to be here
@@ -2610,8 +2621,6 @@ are ignored. */)
}
x_uncatch_errors ();
UNBLOCK_INPUT;
-
- return Qnil;
}
\f
diff --git a/src/xterm.c b/src/xterm.c
index 5df0fbc..f8e95ba 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -8371,19 +8371,20 @@ wm_supports (struct frame *f, Atom want_atom)
static void
set_wm_state (Lisp_Object frame, int add, const char *what, const char *what2)
{
- const char *atom = "_NET_WM_STATE";
- Fx_send_client_event (frame, make_number (0), frame,
- make_unibyte_string (atom, strlen (atom)),
- make_number (32),
- /* 1 = add, 0 = remove */
+ struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (XFRAME (frame));
+
+ x_send_client_event (frame, make_number (0), frame,
+ dpyinfo->Xatom_net_wm_state,
+ make_number (32),
+ /* 1 = add, 0 = remove */
+ Fcons
+ (make_number (add ? 1 : 0),
Fcons
- (make_number (add ? 1 : 0),
- Fcons
- (make_unibyte_string (what, strlen (what)),
- what2 != 0
- ? Fcons (make_unibyte_string (what2, strlen (what2)),
- Qnil)
- : Qnil)));
+ (make_unibyte_string (what, strlen (what)),
+ what2 != 0
+ ? Fcons (make_unibyte_string (what2, strlen (what2)),
+ Qnil)
+ : Qnil)));
}
void
@@ -8962,18 +8963,17 @@ x_ewmh_activate_frame (FRAME_PTR f)
/* See Window Manager Specification/Extended Window Manager Hints at
http://freedesktop.org/wiki/Specifications/wm-spec */
- const char *atom = "_NET_ACTIVE_WINDOW";
struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
if (f->async_visible && wm_supports (f, dpyinfo->Xatom_net_active_window))
{
Lisp_Object frame;
XSETFRAME (frame, f);
- Fx_send_client_event (frame, make_number (0), frame,
- make_unibyte_string (atom, strlen (atom)),
- make_number (32),
- Fcons (make_number (1),
- Fcons (make_number (last_user_time),
- Qnil)));
+ x_send_client_event (frame, make_number (0), frame,
+ dpyinfo->Xatom_net_active_window,
+ make_number (32),
+ Fcons (make_number (1),
+ Fcons (make_number (last_user_time),
+ Qnil)));
}
}
diff --git a/src/xterm.h b/src/xterm.h
index 72529b0..d9ed120 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -1015,6 +1015,13 @@ extern void x_handle_selection_notify (XSelectionEvent *);
extern void x_handle_selection_event (struct input_event *);
extern void x_clear_frame_selections (struct frame *);
+extern void x_send_client_event (Lisp_Object display,
+ Lisp_Object dest,
+ Lisp_Object from,
+ Atom message_type,
+ Lisp_Object format,
+ Lisp_Object values);
+
extern int x_handle_dnd_message (struct frame *,
XClientMessageEvent *,
struct x_display_info *,
--
1.7.2.3
next prev parent reply other threads:[~2010-11-10 13:49 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-10 13:49 X atoms rework Julien Danjou
2010-11-10 13:49 ` [PATCH 1/6] xterm: store atoms in dpyinfo Julien Danjou
2010-11-10 13:49 ` Julien Danjou [this message]
2010-11-10 13:49 ` [PATCH 3/6] xterm: use atoms in set_wm_state Julien Danjou
2010-11-10 13:49 ` [PATCH 4/6] xterm: get all atoms in one round-trip Julien Danjou
2010-11-10 13:49 ` [PATCH 5/6] xsmfns: use pre-fetch SM_CLIENT_ID Julien Danjou
2010-11-10 13:49 ` [PATCH 6/6] xsettings: prefetch atoms Julien Danjou
2010-11-10 17:19 ` X atoms rework Jan Djärv
2010-11-11 7:22 ` Jan D.
2010-11-11 8:22 ` Julien Danjou
2010-11-12 9:32 ` Jan Djärv
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1289396996-26774-3-git-send-email-julien@danjou.info \
--to=julien@danjou.info \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.