aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog13
-rw-r--r--src/dispextern.h20
-rw-r--r--src/nsgui.h15
-rw-r--r--src/w32gui.h12
-rw-r--r--src/xterm.h9
5 files changed, 33 insertions, 36 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 87dd0eacc04..70c76e34c8c 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,16 @@
12014-07-16 Daiki Ueno <ueno@gnu.org>
2
3 Consolidate XChar2b macros for the X, W32, and NS
4 Suggested by Jan Djärv in:
5 https://lists.gnu.org/archive/html/emacs-devel/2014-07/msg00203.html
6 * w32gui.h (XChar2b, STORE_XCHAR2B, XCHAR2B_BYTE1, XCHAR2B_BYTE2):
7 Move the fallback definitions to dispextern.h.
8 * nsgui.h (XChar2b, STORE_XCHAR2B, XCHAR2B_BYTE1, XCHAR2B_BYTE2):
9 Likewise. Share the same definition with W32.
10 * xterm.h (STORE_XCHAR2B, XCHAR2B_BYTE1, XCHAR2B_BYTE2): Move to ...
11 * dispextern.h (STORE_XCHAR2B, XCHAR2B_BYTE1, XCHAR2B_BYTE2):
12 ... here for the consistency with W32 and NS.
13
12014-07-15 Dmitry Antipov <dmantipov@yandex.ru> 142014-07-15 Dmitry Antipov <dmantipov@yandex.ru>
2 15
3 * xmenu.c (toplevel): Use LWLIB_ID for next_menubar_widget_id. 16 * xmenu.c (toplevel): Use LWLIB_ID for next_menubar_widget_id.
diff --git a/src/dispextern.h b/src/dispextern.h
index 0e04cc466d3..615d41d5a7f 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -31,6 +31,15 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
31#include <X11/Intrinsic.h> 31#include <X11/Intrinsic.h>
32#endif /* USE_X_TOOLKIT */ 32#endif /* USE_X_TOOLKIT */
33 33
34#define STORE_XCHAR2B(chp, b1, b2) \
35 ((chp)->byte1 = (b1), (chp)->byte2 = (b2))
36
37#define XCHAR2B_BYTE1(chp) \
38 ((chp)->byte1)
39
40#define XCHAR2B_BYTE2(chp) \
41 ((chp)->byte2)
42
34#else /* !HAVE_X_WINDOWS */ 43#else /* !HAVE_X_WINDOWS */
35 44
36/* X-related stuff used by non-X gui code. */ 45/* X-related stuff used by non-X gui code. */
@@ -42,6 +51,17 @@ typedef struct {
42 char pad; 51 char pad;
43} XColor; 52} XColor;
44 53
54typedef unsigned short XChar2b;
55
56#define STORE_XCHAR2B(chp, b1, b2) \
57 (*(chp) = ((XChar2b)((((b1) & 0x00ff) << 8) | ((b2) & 0x00ff))))
58
59#define XCHAR2B_BYTE1(chp) \
60 ((*(chp) & 0xff00) >> 8)
61
62#define XCHAR2B_BYTE2(chp) \
63 (*(chp) & 0x00ff)
64
45#endif /* HAVE_X_WINDOWS */ 65#endif /* HAVE_X_WINDOWS */
46 66
47#ifdef MSDOS 67#ifdef MSDOS
diff --git a/src/nsgui.h b/src/nsgui.h
index 0e1e9bb73e9..b38b4482b87 100644
--- a/src/nsgui.h
+++ b/src/nsgui.h
@@ -58,21 +58,6 @@ typedef struct _XCharStruct
58 int descent; 58 int descent;
59} XCharStruct; 59} XCharStruct;
60 60
61/* Fake structure from Xlib.h to represent two-byte characters. */
62#ifndef __OBJC__
63typedef unsigned short unichar;
64#endif
65typedef unichar XChar2b;
66
67#define STORE_XCHAR2B(chp, b1, b2) \
68 (*(chp) = ((XChar2b)((((b1) & 0x00ff) << 8) | ((b2) & 0x00ff))))
69
70#define XCHAR2B_BYTE1(chp) \
71 (((*chp) & 0xff00) >> 8)
72
73#define XCHAR2B_BYTE2(chp) \
74 ((*chp) & 0x00ff)
75
76 61
77/* XXX: xfaces requires these structures, but the question is are we 62/* XXX: xfaces requires these structures, but the question is are we
78 forced to use them? */ 63 forced to use them? */
diff --git a/src/w32gui.h b/src/w32gui.h
index d04ce625d1d..8642c479be8 100644
--- a/src/w32gui.h
+++ b/src/w32gui.h
@@ -52,18 +52,6 @@ typedef HCURSOR Cursor;
52 52
53#define No_Cursor (0) 53#define No_Cursor (0)
54 54
55#define XChar2b wchar_t
56
57/* Dealing with bits of wchar_t as if they were an XChar2b. */
58#define STORE_XCHAR2B(chp, byte1, byte2) \
59 ((*(chp)) = ((XChar2b)((((byte1) & 0x00ff) << 8) | ((byte2) & 0x00ff))))
60
61#define XCHAR2B_BYTE1(chp) \
62 (((*(chp)) & 0xff00) >> 8)
63
64#define XCHAR2B_BYTE2(chp) \
65 ((*(chp)) & 0x00ff)
66
67 55
68/* Windows equivalent of XImage. */ 56/* Windows equivalent of XImage. */
69typedef struct _XImage 57typedef struct _XImage
diff --git a/src/xterm.h b/src/xterm.h
index 6d80d1253ae..370006366ef 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -1047,15 +1047,6 @@ extern void x_clear_under_internal_border (struct frame *f);
1047 1047
1048#define FRAME_X_EMBEDDED_P(f) (FRAME_X_OUTPUT(f)->explicit_parent != 0) 1048#define FRAME_X_EMBEDDED_P(f) (FRAME_X_OUTPUT(f)->explicit_parent != 0)
1049 1049
1050#define STORE_XCHAR2B(chp, b1, b2) \
1051 ((chp)->byte1 = (b1), (chp)->byte2 = (b2))
1052
1053#define XCHAR2B_BYTE1(chp) \
1054 ((chp)->byte1)
1055
1056#define XCHAR2B_BYTE2(chp) \
1057 ((chp)->byte2)
1058
1059#define STORE_NATIVE_RECT(nr,rx,ry,rwidth,rheight) \ 1050#define STORE_NATIVE_RECT(nr,rx,ry,rwidth,rheight) \
1060 ((nr).x = (rx), \ 1051 ((nr).x = (rx), \
1061 (nr).y = (ry), \ 1052 (nr).y = (ry), \