annotate src/extw-Xlib.c @ 5602:c9e5612f5424

Support the MP library on recent FreeBSD, have it pass relevant tests. src/ChangeLog addition: 2011-11-26 Aidan Kehoe <kehoea@parhasard.net> * number-mp.c (bignum_to_string): Don't overwrite the accumulator we've just set up for this function. * number-mp.c (BIGNUM_TO_TYPE): mp_itom() doesn't necessarily do what this code used to think with negative numbers, it can treat them as unsigned ints. Subtract numbers from bignum_zero instead of multiplying them by -1 to convert them to their negative equivalents. * number-mp.c (bignum_to_int): * number-mp.c (bignum_to_uint): * number-mp.c (bignum_to_long): * number-mp.c (bignum_to_ulong): * number-mp.c (bignum_to_double): Use the changed BIGNUM_TO_TYPE() in these functions. * number-mp.c (bignum_ceil): * number-mp.c (bignum_floor): In these functions, be more careful about rounding to positive and negative infinity, respectively. Don't use the sign of QUOTIENT when working out out whether to add or subtract one, rather use the sign QUOTIENT would have if arbitrary-precision division were done. * number-mp.h: * number-mp.h (MP_GCD): Wrap #include <mp.h> in BEGIN_C_DECLS/END_C_DECLS. * number.c (Fbigfloat_get_precision): * number.c (Fbigfloat_set_precision): Don't attempt to call XBIGFLOAT_GET_PREC if this build doesn't support big floats.
author Aidan Kehoe <kehoea@parhasard.net>
date Sat, 26 Nov 2011 17:59:14 +0000
parents 2aa9cd456ae7
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 /* Common code between client and shell widgets; not Xt-specific.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 Copyright (C) 1993, 1994 Sun Microsystems, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3
5405
2aa9cd456ae7 Move src/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents: 0
diff changeset
4 This library is free software: you can redistribute it and/or modify it
2aa9cd456ae7 Move src/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents: 0
diff changeset
5 under the terms of the GNU General Public License as published by the
2aa9cd456ae7 Move src/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents: 0
diff changeset
6 Free Software Foundation, either version 3 of the License, or (at your
2aa9cd456ae7 Move src/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents: 0
diff changeset
7 option) any later version.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8
5405
2aa9cd456ae7 Move src/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents: 0
diff changeset
9 This library is distributed in the hope that it will be useful, but WITHOUT
2aa9cd456ae7 Move src/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents: 0
diff changeset
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
2aa9cd456ae7 Move src/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents: 0
diff changeset
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
2aa9cd456ae7 Move src/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents: 0
diff changeset
12 for more details.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13
5405
2aa9cd456ae7 Move src/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents: 0
diff changeset
14 You should have received a copy of the GNU General Public License
2aa9cd456ae7 Move src/ to GPLv3.
Mike Sperber <sperber@deinprogramm.de>
parents: 0
diff changeset
15 along with this library. If not, see <http://www.gnu.org/licenses/>. */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 /* Synched up with: Not in FSF. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 /* Written by Ben Wing, September 1993. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 #ifdef emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 #include <config.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 #ifndef EXTERNAL_WIDGET
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 ERROR! This ought not be getting compiled if EXTERNAL_WIDGET is undefined
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 #include <X11/Xlib.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 #include "extw-Xlib.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 int extw_which_side;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 static int atoms_initialized;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 Atom a_EXTW_QUERY_GEOMETRY, a_EXTW_GEOMETRY_MANAGER, a_EXTW_WIDGET_GEOMETRY,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 a_EXTW_NOTIFY;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 extw_initialize_atoms(Display *display)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 if (!atoms_initialized) {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 a_EXTW_QUERY_GEOMETRY =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 XInternAtom(display, "EXTW_QUERY_GEOMETRY", False);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 a_EXTW_GEOMETRY_MANAGER =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 XInternAtom(display, "EXTW_GEOMETRY_MANAGER", False);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 a_EXTW_WIDGET_GEOMETRY =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 XInternAtom(display, "EXTW_WIDGET_GEOMETRY", False);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 a_EXTW_NOTIFY =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 XInternAtom(display, "EXTW_NOTIFY", False);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 atoms_initialized = 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 /* send a notification to the other-side widget. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 extw_send_notify_3(Display *display, Window win, en_extw_notify type,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 long data0, long data1, long data2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 XClientMessageEvent xev;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 xev.type = ClientMessage;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 xev.message_type = a_EXTW_NOTIFY;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 xev.format = 32;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 xev.display = display;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 xev.window = win;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 xev.data.l[0] = extw_which_side;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 xev.data.l[1] = type;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 xev.data.l[2] = data0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 xev.data.l[3] = data1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 xev.data.l[4] = data2;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 /* UGGGHHHH! All I want to do is ensure that the ClientMessage gets
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 received. Unfortunately X doesn't provide any simple way to do
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 that but instead has this event_mask bogosity in XSendEvent. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 XSendEvent(display, win, False,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 extw_which_side == extw_shell_send ? 0 : StructureNotifyMask,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 (XEvent *) &xev);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 }