Mercurial > emacs
annotate src/xterm.c @ 6679:490b7e2db978
(Freplace_match): Don't capitalize unless all matched words are capitalized.
| author | Karl Heuer <kwzh@gnu.org> |
|---|---|
| date | Tue, 05 Apr 1994 04:51:58 +0000 |
| parents | cb14d76e993c |
| children | af1629dfdb4c |
| rev | line source |
|---|---|
| 286 | 1 /* X Communication module for terminals which understand the X protocol. |
|
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2 Copyright (C) 1989, 1993, 1994 Free Software Foundation, Inc. |
| 286 | 3 |
| 4 This file is part of GNU Emacs. | |
| 5 | |
| 6 GNU Emacs is free software; you can redistribute it and/or modify | |
| 7 it under the terms of the GNU General Public License as published by | |
| 621 | 8 the Free Software Foundation; either version 2, or (at your option) |
| 286 | 9 any later version. |
| 10 | |
| 11 GNU Emacs is distributed in the hope that it will be useful, | |
| 12 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 14 GNU General Public License for more details. | |
| 15 | |
| 16 You should have received a copy of the GNU General Public License | |
| 17 along with GNU Emacs; see the file COPYING. If not, write to | |
| 18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
| 19 | |
| 20 /* Serious problems: | |
| 21 | |
| 22 Kludge: dup2 is used to put the X-connection socket into desc # 0 | |
| 23 so that wait_reading_process_input will wait for it in place of | |
| 24 actual terminal input. | |
| 25 | |
| 26 */ | |
| 27 | |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
28 /* Xt features made by Fred Pierresteguy. */ |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
29 |
|
2195
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
30 #define NEW_SELECTIONS |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
31 |
|
2977
ddcad1457cd5
Move signal.h and stdio.h before config.h.
Richard M. Stallman <rms@gnu.org>
parents:
2958
diff
changeset
|
32 /* On 4.3 these lose if they come after xterm.h. */ |
|
ddcad1457cd5
Move signal.h and stdio.h before config.h.
Richard M. Stallman <rms@gnu.org>
parents:
2958
diff
changeset
|
33 /* On HP-UX 8.0 signal.h loses if it comes after config.h. */ |
|
ddcad1457cd5
Move signal.h and stdio.h before config.h.
Richard M. Stallman <rms@gnu.org>
parents:
2958
diff
changeset
|
34 /* Putting these at the beginning seems to be standard for other .c files. */ |
|
ddcad1457cd5
Move signal.h and stdio.h before config.h.
Richard M. Stallman <rms@gnu.org>
parents:
2958
diff
changeset
|
35 #include <stdio.h> |
|
ddcad1457cd5
Move signal.h and stdio.h before config.h.
Richard M. Stallman <rms@gnu.org>
parents:
2958
diff
changeset
|
36 #include <signal.h> |
|
ddcad1457cd5
Move signal.h and stdio.h before config.h.
Richard M. Stallman <rms@gnu.org>
parents:
2958
diff
changeset
|
37 |
|
4696
1fc792473491
Include <config.h> instead of "config.h".
Roland McGrath <roland@gnu.org>
parents:
4683
diff
changeset
|
38 #include <config.h> |
| 286 | 39 |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
40 /* Need syssignal.h for various externs and definitions that may be required |
|
5825
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
41 by some configurations for calls to signal later in this source file. */ |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
42 #include "syssignal.h" |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
43 |
| 286 | 44 #ifdef HAVE_X_WINDOWS |
| 45 | |
| 46 #include "lisp.h" | |
|
2439
b6c62e4abf59
Put interrupt input blocking in a separate file from xterm.h.
Jim Blandy <jimb@redhat.com>
parents:
2353
diff
changeset
|
47 #include "blockinput.h" |
| 286 | 48 |
| 49 /* This may include sys/types.h, and that somehow loses | |
| 50 if this is not done before the other system files. */ | |
| 51 #include "xterm.h" | |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
52 #include <X11/cursorfont.h> |
| 286 | 53 |
|
1020
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
54 #ifndef USG |
| 286 | 55 /* Load sys/types.h if not already loaded. |
| 56 In some systems loading it twice is suicidal. */ | |
| 57 #ifndef makedev | |
| 58 #include <sys/types.h> | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
59 #endif /* makedev */ |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
60 #endif /* USG */ |
| 286 | 61 |
| 62 #ifdef BSD | |
| 63 #include <sys/ioctl.h> | |
| 64 #include <strings.h> | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
65 #else /* ! defined (BSD) */ |
|
2353
ec8d40776ff1
* xterm.c [VMS]: Don't #include <sys/termio.h> and <string.h>.
Jim Blandy <jimb@redhat.com>
parents:
2285
diff
changeset
|
66 #ifndef VMS |
| 286 | 67 #include <string.h> |
|
2353
ec8d40776ff1
* xterm.c [VMS]: Don't #include <sys/termio.h> and <string.h>.
Jim Blandy <jimb@redhat.com>
parents:
2285
diff
changeset
|
68 #endif |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
69 #endif /* ! defined (BSD) */ |
| 286 | 70 |
|
3355
e0c2e8a2ef75
(XTread_socket, case KeyPress) [HPUX]: Test IsModifiedKey.
Richard M. Stallman <rms@gnu.org>
parents:
3284
diff
changeset
|
71 #include "systty.h" |
| 555 | 72 #include "systime.h" |
| 286 | 73 |
|
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
74 #ifndef INCLUDED_FCNTL |
| 286 | 75 #include <fcntl.h> |
|
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
76 #endif |
| 286 | 77 #include <ctype.h> |
| 78 #include <errno.h> | |
| 79 #include <setjmp.h> | |
| 80 #include <sys/stat.h> | |
| 81 #include <sys/param.h> | |
| 82 | |
| 83 #include "dispextern.h" | |
| 84 #include "termhooks.h" | |
| 85 #include "termopts.h" | |
| 86 #include "termchar.h" | |
| 87 #if 0 | |
| 88 #include "sink.h" | |
| 89 #include "sinkmask.h" | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
90 #endif /* ! 0 */ |
| 286 | 91 #include "gnu.h" |
| 771 | 92 #include "frame.h" |
| 286 | 93 #include "disptab.h" |
| 94 #include "buffer.h" | |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
95 #include "window.h" |
| 286 | 96 |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
97 #ifdef USE_X_TOOLKIT |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
98 extern XtAppContext Xt_app_con; |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
99 extern Widget Xt_app_shell; |
|
5898
105c99071e9b
(x_destroy_window) [USE_X_TOOLKIT]: Call free_frame_menubar.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5872
diff
changeset
|
100 extern void free_frame_menubar (); |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
101 #endif /* USE_X_TOOLKIT */ |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
102 |
|
6022
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
103 #ifndef USE_X_TOOLKIT |
|
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
104 #define x_any_window_to_frame x_window_to_frame |
|
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
105 #endif |
|
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
106 |
| 286 | 107 #ifdef HAVE_X11 |
| 108 #define XMapWindow XMapRaised /* Raise them when mapping. */ | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
109 #else /* ! defined (HAVE_X11) */ |
| 286 | 110 #include <X/Xkeyboard.h> |
| 111 /*#include <X/Xproto.h> */ | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
112 #endif /* ! defined (HAVE_X11) */ |
| 286 | 113 |
|
3924
44fe472b66ba
* xterm.c: Add CPP tangle from process.c to get definitions for
Jim Blandy <jimb@redhat.com>
parents:
3890
diff
changeset
|
114 #ifdef FD_SET |
|
44fe472b66ba
* xterm.c: Add CPP tangle from process.c to get definitions for
Jim Blandy <jimb@redhat.com>
parents:
3890
diff
changeset
|
115 /* We could get this from param.h, but better not to depend on finding that. |
|
44fe472b66ba
* xterm.c: Add CPP tangle from process.c to get definitions for
Jim Blandy <jimb@redhat.com>
parents:
3890
diff
changeset
|
116 And better not to risk that it might define other symbols used in this |
|
44fe472b66ba
* xterm.c: Add CPP tangle from process.c to get definitions for
Jim Blandy <jimb@redhat.com>
parents:
3890
diff
changeset
|
117 file. */ |
|
44fe472b66ba
* xterm.c: Add CPP tangle from process.c to get definitions for
Jim Blandy <jimb@redhat.com>
parents:
3890
diff
changeset
|
118 #ifdef FD_SETSIZE |
|
44fe472b66ba
* xterm.c: Add CPP tangle from process.c to get definitions for
Jim Blandy <jimb@redhat.com>
parents:
3890
diff
changeset
|
119 #define MAXDESC FD_SETSIZE |
|
44fe472b66ba
* xterm.c: Add CPP tangle from process.c to get definitions for
Jim Blandy <jimb@redhat.com>
parents:
3890
diff
changeset
|
120 #else |
|
44fe472b66ba
* xterm.c: Add CPP tangle from process.c to get definitions for
Jim Blandy <jimb@redhat.com>
parents:
3890
diff
changeset
|
121 #define MAXDESC 64 |
|
44fe472b66ba
* xterm.c: Add CPP tangle from process.c to get definitions for
Jim Blandy <jimb@redhat.com>
parents:
3890
diff
changeset
|
122 #endif |
|
44fe472b66ba
* xterm.c: Add CPP tangle from process.c to get definitions for
Jim Blandy <jimb@redhat.com>
parents:
3890
diff
changeset
|
123 #define SELECT_TYPE fd_set |
|
44fe472b66ba
* xterm.c: Add CPP tangle from process.c to get definitions for
Jim Blandy <jimb@redhat.com>
parents:
3890
diff
changeset
|
124 #else /* no FD_SET */ |
|
44fe472b66ba
* xterm.c: Add CPP tangle from process.c to get definitions for
Jim Blandy <jimb@redhat.com>
parents:
3890
diff
changeset
|
125 #define MAXDESC 32 |
|
44fe472b66ba
* xterm.c: Add CPP tangle from process.c to get definitions for
Jim Blandy <jimb@redhat.com>
parents:
3890
diff
changeset
|
126 #define SELECT_TYPE int |
|
44fe472b66ba
* xterm.c: Add CPP tangle from process.c to get definitions for
Jim Blandy <jimb@redhat.com>
parents:
3890
diff
changeset
|
127 |
|
44fe472b66ba
* xterm.c: Add CPP tangle from process.c to get definitions for
Jim Blandy <jimb@redhat.com>
parents:
3890
diff
changeset
|
128 /* Define the macros to access a single-int bitmap of descriptors. */ |
|
44fe472b66ba
* xterm.c: Add CPP tangle from process.c to get definitions for
Jim Blandy <jimb@redhat.com>
parents:
3890
diff
changeset
|
129 #define FD_SET(n, p) (*(p) |= (1 << (n))) |
|
44fe472b66ba
* xterm.c: Add CPP tangle from process.c to get definitions for
Jim Blandy <jimb@redhat.com>
parents:
3890
diff
changeset
|
130 #define FD_CLR(n, p) (*(p) &= ~(1 << (n))) |
|
44fe472b66ba
* xterm.c: Add CPP tangle from process.c to get definitions for
Jim Blandy <jimb@redhat.com>
parents:
3890
diff
changeset
|
131 #define FD_ISSET(n, p) (*(p) & (1 << (n))) |
|
44fe472b66ba
* xterm.c: Add CPP tangle from process.c to get definitions for
Jim Blandy <jimb@redhat.com>
parents:
3890
diff
changeset
|
132 #define FD_ZERO(p) (*(p) = 0) |
|
44fe472b66ba
* xterm.c: Add CPP tangle from process.c to get definitions for
Jim Blandy <jimb@redhat.com>
parents:
3890
diff
changeset
|
133 #endif /* no FD_SET */ |
|
44fe472b66ba
* xterm.c: Add CPP tangle from process.c to get definitions for
Jim Blandy <jimb@redhat.com>
parents:
3890
diff
changeset
|
134 |
| 286 | 135 /* For sending Meta-characters. Do we need this? */ |
| 136 #define METABIT 0200 | |
| 137 | |
| 138 #define min(a,b) ((a)<(b) ? (a) : (b)) | |
| 139 #define max(a,b) ((a)>(b) ? (a) : (b)) | |
|
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
140 |
| 286 | 141 /* Nonzero means we must reprint all windows |
| 142 because 1) we received an ExposeWindow event | |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
143 or 2) we received too many ExposeRegion events to record. |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
144 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
145 This is never needed under X11. */ |
| 286 | 146 static int expose_all_windows; |
| 147 | |
| 148 /* Nonzero means we must reprint all icon windows. */ | |
| 149 | |
| 150 static int expose_all_icons; | |
| 151 | |
| 152 #ifndef HAVE_X11 | |
| 153 /* ExposeRegion events, when received, are copied into this queue | |
| 154 for later processing. */ | |
| 155 | |
| 156 static struct event_queue x_expose_queue; | |
| 157 | |
|
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
158 /* ButtonPress and ButtonReleased events, when received, |
| 286 | 159 are copied into this queue for later processing. */ |
| 160 | |
| 161 struct event_queue x_mouse_queue; | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
162 #endif /* HAVE_X11 */ |
| 286 | 163 |
| 164 #if defined (SIGIO) && defined (FIONREAD) | |
| 165 int BLOCK_INPUT_mask; | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
166 #endif /* ! defined (SIGIO) && defined (FIONREAD) */ |
| 286 | 167 |
| 168 /* The id of a bitmap used for icon windows. | |
| 169 One such map is shared by all Emacs icon windows. | |
| 170 This is zero if we have not yet had a need to create the bitmap. */ | |
| 171 | |
| 172 static Bitmap icon_bitmap; | |
| 173 | |
| 174 /* Font used for text icons. */ | |
| 175 | |
| 176 static FONT_TYPE *icon_font_info; | |
| 177 | |
| 178 /* Stuff for dealing with the main icon title. */ | |
| 179 | |
| 180 extern Lisp_Object Vcommand_line_args; | |
| 398 | 181 char *hostname, *x_id_name; |
| 286 | 182 |
| 183 /* This is the X connection that we are using. */ | |
| 184 | |
| 185 Display *x_current_display; | |
| 186 | |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
187 /* The cursor to use for vertical scroll bars on x_current_display. */ |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
188 static Cursor x_vertical_scroll_bar_cursor; |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
189 |
|
2474
86c8a6e08fd4
Fix typo in comment delimiter.
Richard M. Stallman <rms@gnu.org>
parents:
2468
diff
changeset
|
190 /* Frame being updated by update_frame. This is declared in term.c. |
|
2468
35aa32e1a003
* xterm.c (updating_frame): Declare this extern instead of static,
Jim Blandy <jimb@redhat.com>
parents:
2439
diff
changeset
|
191 This is set by update_begin and looked at by all the |
| 286 | 192 XT functions. It is zero while not inside an update. |
| 771 | 193 In that case, the XT functions assume that `selected_frame' |
| 194 is the frame to apply to. */ | |
|
2468
35aa32e1a003
* xterm.c (updating_frame): Declare this extern instead of static,
Jim Blandy <jimb@redhat.com>
parents:
2439
diff
changeset
|
195 extern struct frame *updating_frame; |
| 771 | 196 |
| 197 /* The frame (if any) which has the X window that has keyboard focus. | |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
198 Zero if none. This is examined by Ffocus_frame in frame.c. Note |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
199 that a mere EnterNotify event can set this; if you need to know the |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
200 last frame specified in a FocusIn or FocusOut event, use |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
201 x_focus_event_frame. */ |
| 771 | 202 struct frame *x_focus_frame; |
| 203 | |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
204 /* The last frame mentioned in a FocusIn or FocusOut event. This is |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
205 separate from x_focus_frame, because whether or not LeaveNotify |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
206 events cause us to lose focus depends on whether or not we have |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
207 received a FocusIn event for it. */ |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
208 struct frame *x_focus_event_frame; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
209 |
| 771 | 210 /* The frame which currently has the visual highlight, and should get |
| 211 keyboard input (other sorts of input have the frame encoded in the | |
| 212 event). It points to the X focus frame's selected window's | |
| 213 frame. It differs from x_focus_frame when we're using a global | |
| 369 | 214 minibuffer. */ |
| 771 | 215 static struct frame *x_highlight_frame; |
| 369 | 216 |
| 286 | 217 /* From .Xdefaults, the value of "emacs.WarpMouse". If non-zero, |
| 771 | 218 mouse is moved to inside of frame when frame is de-iconified. */ |
| 286 | 219 |
| 220 static int warp_mouse_on_deiconify; | |
| 221 | |
| 222 /* During an update, maximum vpos for ins/del line operations to affect. */ | |
| 223 | |
| 224 static int flexlines; | |
| 225 | |
| 226 /* During an update, nonzero if chars output now should be highlighted. */ | |
| 227 | |
| 228 static int highlight; | |
| 229 | |
| 230 /* Nominal cursor position -- where to draw output. | |
| 231 During an update, these are different from the cursor-box position. */ | |
| 232 | |
| 233 static int curs_x; | |
| 234 static int curs_y; | |
| 235 | |
|
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
236 /* Mouse movement. |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
237 |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
238 In order to avoid asking for motion events and then throwing most |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
239 of them away or busy-polling the server for mouse positions, we ask |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
240 the server for pointer motion hints. This means that we get only |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
241 one event per group of mouse movements. "Groups" are delimited by |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
242 other kinds of events (focus changes and button clicks, for |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
243 example), or by XQueryPointer calls; when one of these happens, we |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
244 get another MotionNotify event the next time the mouse moves. This |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
245 is at least as efficient as getting motion events when mouse |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
246 tracking is on, and I suspect only negligibly worse when tracking |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
247 is off. |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
248 |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
249 The silly O'Reilly & Associates Nutshell guides barely document |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
250 pointer motion hints at all (I think you have to infer how they |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
251 work from an example), and the description of XQueryPointer doesn't |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
252 mention that calling it causes you to get another motion hint from |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
253 the server, which is very important. */ |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
254 |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
255 /* Where the mouse was last time we reported a mouse event. */ |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
256 static FRAME_PTR last_mouse_frame; |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
257 static XRectangle last_mouse_glyph; |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
258 |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
259 /* The scroll bar in which the last X motion event occurred. |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
260 |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
261 If the last X motion event occurred in a scroll bar, we set this |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
262 so XTmouse_position can know whether to report a scroll bar motion or |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
263 an ordinary motion. |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
264 |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
265 If the last X motion event didn't occur in a scroll bar, we set this |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
266 to Qnil, to tell XTmouse_position to return an ordinary motion event. */ |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
267 static Lisp_Object last_mouse_scroll_bar; |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
268 |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
269 /* Record which buttons are currently pressed. */ |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
270 unsigned int x_mouse_grabbed; |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
271 |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
272 /* This is a hack. We would really prefer that XTmouse_position would |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
273 return the time associated with the position it returns, but there |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
274 doesn't seem to be any way to wrest the timestamp from the server |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
275 along with the position query. So, we just keep track of the time |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
276 of the last movement we received, and return that in hopes that |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
277 it's somewhat accurate. */ |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
278 static Time last_mouse_movement_time; |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
279 |
|
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
280 /* These variables describe the range of text currently shown |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
281 in its mouse-face, together with the window they apply to. |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
282 As long as the mouse stays within this range, we need not |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
283 redraw anything on its account. */ |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
284 static int mouse_face_beg, mouse_face_end; |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
285 static Lisp_Object mouse_face_window; |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
286 static int mouse_face_face_id; |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
287 |
|
6660
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
288 /* 1 if a mouse motion event came and we didn't handle it right away because |
|
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
289 gc was in progress. */ |
|
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
290 static int mouse_face_deferred_gc; |
|
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
291 |
|
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
292 /* FRAME and X, Y position of mouse when last checked for highlighting. */ |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
293 static FRAME_PTR mouse_face_mouse_frame; |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
294 static int mouse_face_mouse_x, mouse_face_mouse_y; |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
295 |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
296 /* Nonzero means defer mouse-motion highlighting. */ |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
297 static int mouse_face_defer; |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
298 |
| 286 | 299 #ifdef HAVE_X11 |
| 300 /* `t' if a mouse button is depressed. */ | |
| 301 | |
| 302 extern Lisp_Object Vmouse_depressed; | |
| 303 | |
| 304 /* Tells if a window manager is present or not. */ | |
| 305 | |
| 306 extern Lisp_Object Vx_no_window_manager; | |
| 307 | |
| 308 /* Timestamp that we requested selection data was made. */ | |
| 309 extern Time requestor_time; | |
| 310 | |
| 311 /* ID of the window requesting selection data. */ | |
| 312 extern Window requestor_window; | |
| 313 | |
| 314 /* Nonzero enables some debugging for the X interface code. */ | |
| 315 extern int _Xdebug; | |
| 316 | |
|
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
317 extern Qface, Qmouse_face; |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
318 |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
319 #else /* ! defined (HAVE_X11) */ |
| 286 | 320 |
| 321 /* Bit patterns for the mouse cursor. */ | |
| 322 | |
| 323 short MouseCursor[] = { | |
| 324 0x0000, 0x0008, 0x0018, 0x0038, | |
| 325 0x0078, 0x00f8, 0x01f8, 0x03f8, | |
| 326 0x07f8, 0x00f8, 0x00d8, 0x0188, | |
| 327 0x0180, 0x0300, 0x0300, 0x0000}; | |
| 328 | |
| 329 short MouseMask[] = { | |
| 330 0x000c, 0x001c, 0x003c, 0x007c, | |
| 331 0x00fc, 0x01fc, 0x03fc, 0x07fc, | |
| 332 0x0ffc, 0x0ffc, 0x01fc, 0x03dc, | |
| 333 0x03cc, 0x0780, 0x0780, 0x0300}; | |
| 334 | |
| 335 static short grey_bits[] = { | |
| 336 0x0005, 0x000a, 0x0005, 0x000a}; | |
| 337 | |
| 338 static Pixmap GreyPixmap = 0; | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
339 #endif /* ! defined (HAVE_X11) */ |
| 286 | 340 |
| 341 /* From time to time we get info on an Emacs window, here. */ | |
| 342 | |
| 343 static WINDOWINFO_TYPE windowinfo; | |
| 344 | |
| 345 extern int errno; | |
| 346 | |
|
2661
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
347 /* A mask of extra modifier bits to put into every keyboard char. */ |
|
1841
338e4ffdb54b
(XTread_socket): Support extra_keyboard_modifiers.
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
348 extern int extra_keyboard_modifiers; |
|
338e4ffdb54b
(XTread_socket): Support extra_keyboard_modifiers.
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
349 |
| 286 | 350 extern Display *XOpenDisplay (); |
| 351 extern Window XCreateWindow (); | |
| 352 | |
| 353 extern Cursor XCreateCursor (); | |
| 354 extern FONT_TYPE *XOpenFont (); | |
| 355 | |
| 356 static void flashback (); | |
|
4277
c3fbb9249f5b
(redraw_previous_char): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4244
diff
changeset
|
357 static void redraw_previous_char (); |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
358 static unsigned int x_x_to_emacs_modifiers (); |
| 286 | 359 |
|
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
360 static void note_mouse_highlight (); |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
361 static void clear_mouse_face (); |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
362 static void show_mouse_face (); |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
363 |
| 286 | 364 #ifndef HAVE_X11 |
| 365 static void dumpqueue (); | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
366 #endif /* HAVE_X11 */ |
| 286 | 367 |
| 368 void dumpborder (); | |
| 621 | 369 static int XTcursor_to (); |
| 370 static int XTclear_end_of_line (); | |
|
1020
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
371 |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
372 |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
373 /* Starting and ending updates. |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
374 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
375 These hooks are called by update_frame at the beginning and end |
| 771 | 376 of a frame update. We record in `updating_frame' the identity |
| 377 of the frame being updated, so that the XT... functions do not | |
| 378 need to take a frame as argument. Most of the XT... functions | |
| 286 | 379 should never be called except during an update, the only exceptions |
|
4277
c3fbb9249f5b
(redraw_previous_char): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4244
diff
changeset
|
380 being XTcursor_to, XTwrite_glyphs and XTreassert_line_highlight. */ |
| 286 | 381 |
| 382 extern int mouse_track_top, mouse_track_left, mouse_track_width; | |
| 383 | |
| 384 static | |
| 771 | 385 XTupdate_begin (f) |
| 386 struct frame *f; | |
| 286 | 387 { |
| 388 int mask; | |
| 389 | |
| 771 | 390 if (f == 0) |
| 286 | 391 abort (); |
| 392 | |
| 771 | 393 flexlines = f->height; |
| 286 | 394 highlight = 0; |
| 395 | |
| 396 BLOCK_INPUT; | |
|
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
397 |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
398 if (f == mouse_face_mouse_frame) |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
399 { |
|
6660
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
400 /* Don't do highlighting for mouse motion during the update. */ |
|
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
401 mouse_face_defer = 1; |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
402 if (!NILP (mouse_face_window)) |
|
6660
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
403 { |
|
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
404 int firstline, lastline, i; |
|
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
405 struct window *w = XWINDOW (mouse_face_window); |
|
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
406 |
|
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
407 /* Find the first, and the last+1, lines affected by redisplay. */ |
|
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
408 for (firstline = 0; firstline < f->height; firstline++) |
|
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
409 if (FRAME_DESIRED_GLYPHS (f)->enable[firstline]) |
|
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
410 break; |
|
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
411 |
|
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
412 lastline = f->height; |
|
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
413 for (i = f->height - 1; i >= 0; i--) |
|
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
414 { |
|
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
415 if (FRAME_DESIRED_GLYPHS (f)->enable[i]) |
|
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
416 break; |
|
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
417 else |
|
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
418 lastline = i; |
|
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
419 } |
|
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
420 |
|
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
421 /* Can we tell that this update does not affect the window |
|
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
422 where the mouse highlight is? If so, no need to turn off. */ |
|
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
423 if (! (firstline > (XFASTINT (w->top) + window_internal_height (w)) |
|
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
424 || lastline < XFASTINT (w->top))) |
|
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
425 /* Otherwise turn off the mouse highlight now. */ |
|
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
426 clear_mouse_face (); |
|
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
427 } |
|
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
428 } |
| 286 | 429 #ifndef HAVE_X11 |
| 430 dumpqueue (); | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
431 #endif /* HAVE_X11 */ |
| 286 | 432 UNBLOCK_INPUT; |
| 433 } | |
| 434 | |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
435 #ifndef HAVE_X11 |
| 286 | 436 static void x_do_pending_expose (); |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
437 #endif |
| 286 | 438 |
| 439 static | |
| 771 | 440 XTupdate_end (f) |
| 441 struct frame *f; | |
| 286 | 442 { |
| 443 int mask; | |
| 444 | |
| 445 BLOCK_INPUT; | |
| 446 #ifndef HAVE_X11 | |
| 447 dumpqueue (); | |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
448 x_do_pending_expose (); |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
449 #endif /* HAVE_X11 */ |
| 286 | 450 |
| 771 | 451 x_display_cursor (f, 1); |
| 452 | |
|
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
453 if (f == mouse_face_mouse_frame) |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
454 mouse_face_defer = 0; |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
455 #if 0 |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
456 /* This fails in the case of having updated only the echo area |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
457 if we have switched buffers. In that case, FRAME_CURRENT_GLYPHS |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
458 has no relation to the current contents, and its charstarts |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
459 have no relation to the contents of the window-buffer. |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
460 I don't know a clean way to check |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
461 for that case. window_end_valid isn't set up yet. */ |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
462 if (f == mouse_face_mouse_frame) |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
463 note_mouse_highlight (f, mouse_face_mouse_x, mouse_face_mouse_y); |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
464 #endif |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
465 |
| 286 | 466 XFlushQueue (); |
| 467 UNBLOCK_INPUT; | |
| 468 } | |
|
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
469 |
|
6660
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
470 /* This is called after a redisplay on frame F. */ |
|
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
471 |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
472 static |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
473 XTframe_up_to_date (f) |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
474 FRAME_PTR f; |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
475 { |
|
6660
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
476 if (mouse_face_deferred_gc || f == mouse_face_mouse_frame) |
|
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
477 { |
|
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
478 note_mouse_highlight (mouse_face_mouse_frame, |
|
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
479 mouse_face_mouse_x, mouse_face_mouse_y); |
|
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
480 mouse_face_deferred_gc = 0; |
|
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
481 } |
|
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
482 } |
| 286 | 483 |
| 484 /* External interface to control of standout mode. | |
| 485 Call this when about to modify line at position VPOS | |
| 486 and not change whether it is highlighted. */ | |
| 487 | |
| 488 XTreassert_line_highlight (new, vpos) | |
| 489 int new, vpos; | |
| 490 { | |
| 491 highlight = new; | |
| 492 } | |
| 493 | |
| 494 /* Call this when about to modify line at position VPOS | |
| 495 and change whether it is highlighted. */ | |
| 496 | |
| 497 static | |
| 498 XTchange_line_highlight (new_highlight, vpos, first_unused_hpos) | |
| 499 int new_highlight, vpos, first_unused_hpos; | |
| 500 { | |
| 501 highlight = new_highlight; | |
| 502 XTcursor_to (vpos, 0); | |
| 771 | 503 XTclear_end_of_line (updating_frame->width); |
| 286 | 504 } |
| 505 | |
| 506 /* This is used when starting Emacs and when restarting after suspend. | |
| 507 When starting Emacs, no X window is mapped. And nothing must be done | |
| 508 to Emacs's own window if it is suspended (though that rarely happens). */ | |
| 509 | |
| 510 static | |
| 511 XTset_terminal_modes () | |
| 512 { | |
| 513 } | |
| 514 | |
| 515 /* This is called when exiting or suspending Emacs. | |
| 516 Exiting will make the X-windows go away, and suspending | |
| 517 requires no action. */ | |
| 518 | |
| 519 static | |
| 520 XTreset_terminal_modes () | |
| 521 { | |
| 771 | 522 /* XTclear_frame (); */ |
| 286 | 523 } |
| 524 | |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
525 /* Set the nominal cursor position of the frame. |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
526 This is where display update commands will take effect. |
| 286 | 527 This does not affect the place where the cursor-box is displayed. */ |
| 528 | |
| 621 | 529 static int |
| 286 | 530 XTcursor_to (row, col) |
| 531 register int row, col; | |
| 532 { | |
| 533 int mask; | |
| 534 int orow = row; | |
| 535 | |
| 536 curs_x = col; | |
| 537 curs_y = row; | |
| 538 | |
| 771 | 539 if (updating_frame == 0) |
| 286 | 540 { |
| 541 BLOCK_INPUT; | |
| 771 | 542 x_display_cursor (selected_frame, 1); |
| 286 | 543 XFlushQueue (); |
| 544 UNBLOCK_INPUT; | |
| 545 } | |
| 546 } | |
| 547 | |
| 548 /* Display a sequence of N glyphs found at GP. | |
| 549 WINDOW is the x-window to output to. LEFT and TOP are starting coords. | |
|
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
550 HL is 1 if this text is highlighted, 2 if the cursor is on it, |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
551 3 if should appear in its mouse-face. |
| 286 | 552 |
|
2732
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
553 FONT is the default font to use (for glyphs whose font-code is 0). |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
554 |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
555 Since the display generation code is responsible for calling |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
556 compute_char_face and compute_glyph_face on everything it puts in |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
557 the display structure, we can assume that the face code on each |
|
3883
b9e5a869b33e
Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents:
3839
diff
changeset
|
558 glyph is a valid index into FRAME_COMPUTED_FACES (f), and the one |
|
5872
6389c826f847
(x_display_cursor, process_expose_from_menu): Block input.
Karl Heuer <kwzh@gnu.org>
parents:
5825
diff
changeset
|
559 to which we can actually apply intern_face. |
|
6389c826f847
(x_display_cursor, process_expose_from_menu): Block input.
Karl Heuer <kwzh@gnu.org>
parents:
5825
diff
changeset
|
560 Call this function with input blocked. */ |
|
2732
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
561 |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
562 #if 1 |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
563 /* This is the multi-face code. */ |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
564 |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
565 static void |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
566 dumpglyphs (f, left, top, gp, n, hl) |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
567 struct frame *f; |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
568 int left, top; |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
569 register GLYPH *gp; /* Points to first GLYPH. */ |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
570 register int n; /* Number of glyphs to display. */ |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
571 int hl; |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
572 { |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
573 /* Holds characters to be displayed. */ |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
574 char *buf = (char *) alloca (f->width * sizeof (*buf)); |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
575 register char *cp; /* Steps through buf[]. */ |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
576 register int tlen = GLYPH_TABLE_LENGTH; |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
577 register Lisp_Object *tbase = GLYPH_TABLE_BASE; |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
578 Window window = FRAME_X_WINDOW (f); |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
579 |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
580 while (n > 0) |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
581 { |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
582 /* Get the face-code of the next GLYPH. */ |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
583 int cf, len; |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
584 int g = *gp; |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
585 |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
586 GLYPH_FOLLOW_ALIASES (tbase, tlen, g); |
|
6413
6eb1a3cf0371
(dumpglyphs): Use the fast macros.
Karl Heuer <kwzh@gnu.org>
parents:
6356
diff
changeset
|
587 cf = FAST_GLYPH_FACE (g); |
|
2732
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
588 |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
589 /* Find the run of consecutive glyphs with the same face-code. |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
590 Extract their character codes into BUF. */ |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
591 cp = buf; |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
592 while (n > 0) |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
593 { |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
594 g = *gp; |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
595 GLYPH_FOLLOW_ALIASES (tbase, tlen, g); |
|
6413
6eb1a3cf0371
(dumpglyphs): Use the fast macros.
Karl Heuer <kwzh@gnu.org>
parents:
6356
diff
changeset
|
596 if (FAST_GLYPH_FACE (g) != cf) |
|
2732
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
597 break; |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
598 |
|
6413
6eb1a3cf0371
(dumpglyphs): Use the fast macros.
Karl Heuer <kwzh@gnu.org>
parents:
6356
diff
changeset
|
599 *cp++ = FAST_GLYPH_CHAR (g); |
|
2732
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
600 --n; |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
601 ++gp; |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
602 } |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
603 |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
604 /* LEN gets the length of the run. */ |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
605 len = cp - buf; |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
606 |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
607 /* Now output this run of chars, with the font and pixel values |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
608 determined by the face code CF. */ |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
609 { |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
610 struct face *face = FRAME_DEFAULT_FACE (f); |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
611 FONT_TYPE *font = FACE_FONT (face); |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
612 GC gc = FACE_GC (face); |
|
2840
12299f73584e
(dumpglyphs): Create a temporary merged gc
Richard M. Stallman <rms@gnu.org>
parents:
2785
diff
changeset
|
613 int defaulted = 1; |
|
12299f73584e
(dumpglyphs): Create a temporary merged gc
Richard M. Stallman <rms@gnu.org>
parents:
2785
diff
changeset
|
614 int gc_temporary = 0; |
|
12299f73584e
(dumpglyphs): Create a temporary merged gc
Richard M. Stallman <rms@gnu.org>
parents:
2785
diff
changeset
|
615 |
|
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
616 /* HL = 3 means use a mouse face previously chosen. */ |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
617 if (hl == 3) |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
618 cf = mouse_face_face_id; |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
619 |
|
2840
12299f73584e
(dumpglyphs): Create a temporary merged gc
Richard M. Stallman <rms@gnu.org>
parents:
2785
diff
changeset
|
620 /* First look at the face of the text itself. */ |
|
12299f73584e
(dumpglyphs): Create a temporary merged gc
Richard M. Stallman <rms@gnu.org>
parents:
2785
diff
changeset
|
621 if (cf != 0) |
|
2732
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
622 { |
|
5719
d3074ff90741
(dumpglyphs): Don't crash for invalid face code.
Richard M. Stallman <rms@gnu.org>
parents:
5686
diff
changeset
|
623 /* It's possible for the display table to specify |
|
d3074ff90741
(dumpglyphs): Don't crash for invalid face code.
Richard M. Stallman <rms@gnu.org>
parents:
5686
diff
changeset
|
624 a face code that is out of range. Use 0 in that case. */ |
|
3883
b9e5a869b33e
Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents:
3839
diff
changeset
|
625 if (cf < 0 || cf >= FRAME_N_COMPUTED_FACES (f) |
|
b9e5a869b33e
Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents:
3839
diff
changeset
|
626 || FRAME_COMPUTED_FACES (f) [cf] == 0) |
|
5719
d3074ff90741
(dumpglyphs): Don't crash for invalid face code.
Richard M. Stallman <rms@gnu.org>
parents:
5686
diff
changeset
|
627 cf = 0; |
|
2732
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
628 |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
629 if (cf == 1) |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
630 face = FRAME_MODE_LINE_FACE (f); |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
631 else |
|
3883
b9e5a869b33e
Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents:
3839
diff
changeset
|
632 face = intern_face (f, FRAME_COMPUTED_FACES (f) [cf]); |
|
2732
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
633 font = FACE_FONT (face); |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
634 gc = FACE_GC (face); |
|
2840
12299f73584e
(dumpglyphs): Create a temporary merged gc
Richard M. Stallman <rms@gnu.org>
parents:
2785
diff
changeset
|
635 defaulted = 0; |
|
2732
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
636 } |
|
2785
55e9c556bbf8
* xterm.c (dumpglyphs): Give the cursor higher priority than the
Jim Blandy <jimb@redhat.com>
parents:
2732
diff
changeset
|
637 |
|
55e9c556bbf8
* xterm.c (dumpglyphs): Give the cursor higher priority than the
Jim Blandy <jimb@redhat.com>
parents:
2732
diff
changeset
|
638 /* Then comes the distinction between modeline and normal text. */ |
|
2732
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
639 else if (hl == 0) |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
640 ; |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
641 else if (hl == 1) |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
642 { |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
643 face = FRAME_MODE_LINE_FACE (f); |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
644 font = FACE_FONT (face); |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
645 gc = FACE_GC (face); |
|
2840
12299f73584e
(dumpglyphs): Create a temporary merged gc
Richard M. Stallman <rms@gnu.org>
parents:
2785
diff
changeset
|
646 defaulted = 0; |
|
12299f73584e
(dumpglyphs): Create a temporary merged gc
Richard M. Stallman <rms@gnu.org>
parents:
2785
diff
changeset
|
647 } |
|
12299f73584e
(dumpglyphs): Create a temporary merged gc
Richard M. Stallman <rms@gnu.org>
parents:
2785
diff
changeset
|
648 |
|
12299f73584e
(dumpglyphs): Create a temporary merged gc
Richard M. Stallman <rms@gnu.org>
parents:
2785
diff
changeset
|
649 #define FACE_DEFAULT (~0) |
|
12299f73584e
(dumpglyphs): Create a temporary merged gc
Richard M. Stallman <rms@gnu.org>
parents:
2785
diff
changeset
|
650 |
|
12299f73584e
(dumpglyphs): Create a temporary merged gc
Richard M. Stallman <rms@gnu.org>
parents:
2785
diff
changeset
|
651 /* Now override that if the cursor's on this character. */ |
|
3076
e3b3c67cf203
Arrange for font names to get fully resolved - no wildcards.
Jim Blandy <jimb@redhat.com>
parents:
3066
diff
changeset
|
652 if (hl == 2) |
|
2840
12299f73584e
(dumpglyphs): Create a temporary merged gc
Richard M. Stallman <rms@gnu.org>
parents:
2785
diff
changeset
|
653 { |
|
3076
e3b3c67cf203
Arrange for font names to get fully resolved - no wildcards.
Jim Blandy <jimb@redhat.com>
parents:
3066
diff
changeset
|
654 if (defaulted |
|
e3b3c67cf203
Arrange for font names to get fully resolved - no wildcards.
Jim Blandy <jimb@redhat.com>
parents:
3066
diff
changeset
|
655 || !face->font |
|
e3b3c67cf203
Arrange for font names to get fully resolved - no wildcards.
Jim Blandy <jimb@redhat.com>
parents:
3066
diff
changeset
|
656 || (int) face->font == FACE_DEFAULT) |
|
e3b3c67cf203
Arrange for font names to get fully resolved - no wildcards.
Jim Blandy <jimb@redhat.com>
parents:
3066
diff
changeset
|
657 { |
|
e3b3c67cf203
Arrange for font names to get fully resolved - no wildcards.
Jim Blandy <jimb@redhat.com>
parents:
3066
diff
changeset
|
658 gc = f->display.x->cursor_gc; |
|
e3b3c67cf203
Arrange for font names to get fully resolved - no wildcards.
Jim Blandy <jimb@redhat.com>
parents:
3066
diff
changeset
|
659 } |
|
e3b3c67cf203
Arrange for font names to get fully resolved - no wildcards.
Jim Blandy <jimb@redhat.com>
parents:
3066
diff
changeset
|
660 /* Cursor on non-default face: must merge. */ |
|
e3b3c67cf203
Arrange for font names to get fully resolved - no wildcards.
Jim Blandy <jimb@redhat.com>
parents:
3066
diff
changeset
|
661 else |
|
e3b3c67cf203
Arrange for font names to get fully resolved - no wildcards.
Jim Blandy <jimb@redhat.com>
parents:
3066
diff
changeset
|
662 { |
|
e3b3c67cf203
Arrange for font names to get fully resolved - no wildcards.
Jim Blandy <jimb@redhat.com>
parents:
3066
diff
changeset
|
663 XGCValues xgcv; |
|
e3b3c67cf203
Arrange for font names to get fully resolved - no wildcards.
Jim Blandy <jimb@redhat.com>
parents:
3066
diff
changeset
|
664 unsigned long mask; |
|
e3b3c67cf203
Arrange for font names to get fully resolved - no wildcards.
Jim Blandy <jimb@redhat.com>
parents:
3066
diff
changeset
|
665 |
|
e3b3c67cf203
Arrange for font names to get fully resolved - no wildcards.
Jim Blandy <jimb@redhat.com>
parents:
3066
diff
changeset
|
666 xgcv.background = f->display.x->cursor_pixel; |
|
5987
040bdc2fec7c
(dumpglyphs): Try various alternatives for foreground color
Richard M. Stallman <rms@gnu.org>
parents:
5986
diff
changeset
|
667 if (face == FRAME_DEFAULT_FACE (f)) |
|
040bdc2fec7c
(dumpglyphs): Try various alternatives for foreground color
Richard M. Stallman <rms@gnu.org>
parents:
5986
diff
changeset
|
668 xgcv.foreground = f->display.x->cursor_foreground_pixel; |
|
040bdc2fec7c
(dumpglyphs): Try various alternatives for foreground color
Richard M. Stallman <rms@gnu.org>
parents:
5986
diff
changeset
|
669 else |
|
040bdc2fec7c
(dumpglyphs): Try various alternatives for foreground color
Richard M. Stallman <rms@gnu.org>
parents:
5986
diff
changeset
|
670 xgcv.foreground = face->foreground; |
|
040bdc2fec7c
(dumpglyphs): Try various alternatives for foreground color
Richard M. Stallman <rms@gnu.org>
parents:
5986
diff
changeset
|
671 /* If the glyph would be invisible, |
|
040bdc2fec7c
(dumpglyphs): Try various alternatives for foreground color
Richard M. Stallman <rms@gnu.org>
parents:
5986
diff
changeset
|
672 try a different foreground. */ |
|
040bdc2fec7c
(dumpglyphs): Try various alternatives for foreground color
Richard M. Stallman <rms@gnu.org>
parents:
5986
diff
changeset
|
673 if (xgcv.foreground == xgcv.background) |
|
040bdc2fec7c
(dumpglyphs): Try various alternatives for foreground color
Richard M. Stallman <rms@gnu.org>
parents:
5986
diff
changeset
|
674 xgcv.foreground = face->background; |
|
040bdc2fec7c
(dumpglyphs): Try various alternatives for foreground color
Richard M. Stallman <rms@gnu.org>
parents:
5986
diff
changeset
|
675 if (xgcv.foreground == xgcv.background) |
|
040bdc2fec7c
(dumpglyphs): Try various alternatives for foreground color
Richard M. Stallman <rms@gnu.org>
parents:
5986
diff
changeset
|
676 xgcv.foreground = f->display.x->cursor_foreground_pixel; |
|
040bdc2fec7c
(dumpglyphs): Try various alternatives for foreground color
Richard M. Stallman <rms@gnu.org>
parents:
5986
diff
changeset
|
677 if (xgcv.foreground == xgcv.background) |
|
040bdc2fec7c
(dumpglyphs): Try various alternatives for foreground color
Richard M. Stallman <rms@gnu.org>
parents:
5986
diff
changeset
|
678 xgcv.foreground = face->foreground; |
|
040bdc2fec7c
(dumpglyphs): Try various alternatives for foreground color
Richard M. Stallman <rms@gnu.org>
parents:
5986
diff
changeset
|
679 /* Make sure the cursor is distinct from text in this face. */ |
|
040bdc2fec7c
(dumpglyphs): Try various alternatives for foreground color
Richard M. Stallman <rms@gnu.org>
parents:
5986
diff
changeset
|
680 if (xgcv.background == face->background |
|
040bdc2fec7c
(dumpglyphs): Try various alternatives for foreground color
Richard M. Stallman <rms@gnu.org>
parents:
5986
diff
changeset
|
681 && xgcv.foreground == face->foreground) |
|
040bdc2fec7c
(dumpglyphs): Try various alternatives for foreground color
Richard M. Stallman <rms@gnu.org>
parents:
5986
diff
changeset
|
682 { |
|
040bdc2fec7c
(dumpglyphs): Try various alternatives for foreground color
Richard M. Stallman <rms@gnu.org>
parents:
5986
diff
changeset
|
683 xgcv.background = face->foreground; |
|
040bdc2fec7c
(dumpglyphs): Try various alternatives for foreground color
Richard M. Stallman <rms@gnu.org>
parents:
5986
diff
changeset
|
684 xgcv.foreground = face->background; |
|
040bdc2fec7c
(dumpglyphs): Try various alternatives for foreground color
Richard M. Stallman <rms@gnu.org>
parents:
5986
diff
changeset
|
685 } |
|
3076
e3b3c67cf203
Arrange for font names to get fully resolved - no wildcards.
Jim Blandy <jimb@redhat.com>
parents:
3066
diff
changeset
|
686 xgcv.font = face->font->fid; |
|
e3b3c67cf203
Arrange for font names to get fully resolved - no wildcards.
Jim Blandy <jimb@redhat.com>
parents:
3066
diff
changeset
|
687 xgcv.graphics_exposures = 0; |
|
e3b3c67cf203
Arrange for font names to get fully resolved - no wildcards.
Jim Blandy <jimb@redhat.com>
parents:
3066
diff
changeset
|
688 mask = GCForeground | GCBackground | GCFont | GCGraphicsExposures; |
|
e3b3c67cf203
Arrange for font names to get fully resolved - no wildcards.
Jim Blandy <jimb@redhat.com>
parents:
3066
diff
changeset
|
689 gc = XCreateGC (x_current_display, FRAME_X_WINDOW (f), |
|
e3b3c67cf203
Arrange for font names to get fully resolved - no wildcards.
Jim Blandy <jimb@redhat.com>
parents:
3066
diff
changeset
|
690 mask, &xgcv); |
|
2840
12299f73584e
(dumpglyphs): Create a temporary merged gc
Richard M. Stallman <rms@gnu.org>
parents:
2785
diff
changeset
|
691 #if 0 |
|
3076
e3b3c67cf203
Arrange for font names to get fully resolved - no wildcards.
Jim Blandy <jimb@redhat.com>
parents:
3066
diff
changeset
|
692 if (face->stipple && face->stipple != FACE_DEFAULT) |
|
e3b3c67cf203
Arrange for font names to get fully resolved - no wildcards.
Jim Blandy <jimb@redhat.com>
parents:
3066
diff
changeset
|
693 XSetStipple (x_current_display, gc, face->stipple); |
|
2840
12299f73584e
(dumpglyphs): Create a temporary merged gc
Richard M. Stallman <rms@gnu.org>
parents:
2785
diff
changeset
|
694 #endif |
|
3076
e3b3c67cf203
Arrange for font names to get fully resolved - no wildcards.
Jim Blandy <jimb@redhat.com>
parents:
3066
diff
changeset
|
695 gc_temporary = 1; |
|
e3b3c67cf203
Arrange for font names to get fully resolved - no wildcards.
Jim Blandy <jimb@redhat.com>
parents:
3066
diff
changeset
|
696 } |
|
2732
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
697 } |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
698 |
|
3076
e3b3c67cf203
Arrange for font names to get fully resolved - no wildcards.
Jim Blandy <jimb@redhat.com>
parents:
3066
diff
changeset
|
699 if ((int) font == FACE_DEFAULT) |
|
e3b3c67cf203
Arrange for font names to get fully resolved - no wildcards.
Jim Blandy <jimb@redhat.com>
parents:
3066
diff
changeset
|
700 font = f->display.x->font; |
|
e3b3c67cf203
Arrange for font names to get fully resolved - no wildcards.
Jim Blandy <jimb@redhat.com>
parents:
3066
diff
changeset
|
701 |
|
2732
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
702 XDrawImageString (x_current_display, window, gc, |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
703 left, top + FONT_BASE (font), buf, len); |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
704 |
|
2840
12299f73584e
(dumpglyphs): Create a temporary merged gc
Richard M. Stallman <rms@gnu.org>
parents:
2785
diff
changeset
|
705 if (gc_temporary) |
|
12299f73584e
(dumpglyphs): Create a temporary merged gc
Richard M. Stallman <rms@gnu.org>
parents:
2785
diff
changeset
|
706 XFreeGC (x_current_display, gc); |
|
12299f73584e
(dumpglyphs): Create a temporary merged gc
Richard M. Stallman <rms@gnu.org>
parents:
2785
diff
changeset
|
707 |
|
2732
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
708 /* We should probably check for XA_UNDERLINE_POSITION and |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
709 XA_UNDERLINE_THICKNESS properties on the font, but let's |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
710 just get the thing working, and come back to that. */ |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
711 { |
|
2785
55e9c556bbf8
* xterm.c (dumpglyphs): Give the cursor higher priority than the
Jim Blandy <jimb@redhat.com>
parents:
2732
diff
changeset
|
712 int underline_position = 1; |
|
55e9c556bbf8
* xterm.c (dumpglyphs): Give the cursor higher priority than the
Jim Blandy <jimb@redhat.com>
parents:
2732
diff
changeset
|
713 |
|
55e9c556bbf8
* xterm.c (dumpglyphs): Give the cursor higher priority than the
Jim Blandy <jimb@redhat.com>
parents:
2732
diff
changeset
|
714 if (font->descent <= underline_position) |
|
55e9c556bbf8
* xterm.c (dumpglyphs): Give the cursor higher priority than the
Jim Blandy <jimb@redhat.com>
parents:
2732
diff
changeset
|
715 underline_position = font->descent - 1; |
|
2732
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
716 |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
717 if (face->underline) |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
718 XFillRectangle (x_current_display, FRAME_X_WINDOW (f), |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
719 FACE_GC (face), |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
720 left, (top |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
721 + FONT_BASE (font) |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
722 + underline_position), |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
723 len * FONT_WIDTH (font), 1); |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
724 } |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
725 |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
726 left += len * FONT_WIDTH (font); |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
727 } |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
728 } |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
729 } |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
730 #endif /* 1 */ |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
731 |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
732 #if 0 |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
733 /* This is the old single-face code. */ |
| 286 | 734 |
| 735 static void | |
| 771 | 736 dumpglyphs (f, left, top, gp, n, hl, font) |
| 737 struct frame *f; | |
| 286 | 738 int left, top; |
| 739 register GLYPH *gp; /* Points to first GLYPH. */ | |
| 740 register int n; /* Number of glyphs to display. */ | |
| 741 int hl; | |
| 742 FONT_TYPE *font; | |
| 743 { | |
| 744 register int len; | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
745 Window window = FRAME_X_WINDOW (f); |
| 771 | 746 GC drawing_gc = (hl == 2 ? f->display.x->cursor_gc |
| 747 : (hl ? f->display.x->reverse_gc | |
| 748 : f->display.x->normal_gc)); | |
| 286 | 749 |
| 313 | 750 if (sizeof (GLYPH) == sizeof (XChar2b)) |
| 751 XDrawImageString16 (x_current_display, window, drawing_gc, | |
| 752 left, top + FONT_BASE (font), (XChar2b *) gp, n); | |
| 753 else if (sizeof (GLYPH) == sizeof (unsigned char)) | |
| 754 XDrawImageString (x_current_display, window, drawing_gc, | |
| 755 left, top + FONT_BASE (font), (char *) gp, n); | |
| 756 else | |
| 757 /* What size of glyph ARE you using? And does X have a function to | |
| 758 draw them? */ | |
| 759 abort (); | |
| 286 | 760 } |
|
2732
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
761 #endif |
| 286 | 762 |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
763 /* Output some text at the nominal frame cursor position. |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
764 Advance the cursor over the text. |
| 286 | 765 Output LEN glyphs at START. |
| 766 | |
| 767 `highlight', set up by XTreassert_line_highlight or XTchange_line_highlight, | |
| 768 controls the pixel values used for foreground and background. */ | |
| 769 | |
| 770 static | |
| 771 XTwrite_glyphs (start, len) | |
| 772 register GLYPH *start; | |
| 773 int len; | |
| 774 { | |
| 775 register int temp_length; | |
| 776 int mask; | |
| 771 | 777 struct frame *f; |
| 286 | 778 |
| 779 BLOCK_INPUT; | |
| 780 | |
| 771 | 781 f = updating_frame; |
| 782 if (f == 0) | |
| 286 | 783 { |
| 771 | 784 f = selected_frame; |
| 286 | 785 /* If not within an update, |
| 771 | 786 output at the frame's visible cursor. */ |
| 787 curs_x = f->cursor_x; | |
| 788 curs_y = f->cursor_y; | |
| 286 | 789 } |
| 790 | |
| 771 | 791 dumpglyphs (f, |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
792 CHAR_TO_PIXEL_COL (f, curs_x), |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
793 CHAR_TO_PIXEL_ROW (f, curs_y), |
|
2732
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
794 start, len, highlight); |
| 429 | 795 |
| 796 /* If we drew on top of the cursor, note that it is turned off. */ | |
| 771 | 797 if (curs_y == f->phys_cursor_y |
| 798 && curs_x <= f->phys_cursor_x | |
| 799 && curs_x + len > f->phys_cursor_x) | |
| 800 f->phys_cursor_x = -1; | |
| 286 | 801 |
| 771 | 802 if (updating_frame == 0) |
| 286 | 803 { |
| 771 | 804 f->cursor_x += len; |
| 805 x_display_cursor (f, 1); | |
| 806 f->cursor_x -= len; | |
| 286 | 807 } |
| 808 else | |
| 809 curs_x += len; | |
| 810 | |
| 811 UNBLOCK_INPUT; | |
| 812 } | |
| 813 | |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
814 /* Clear to the end of the line. |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
815 Erase the current text line from the nominal cursor position (inclusive) |
| 286 | 816 to column FIRST_UNUSED (exclusive). The idea is that everything |
| 817 from FIRST_UNUSED onward is already erased. */ | |
| 818 | |
| 621 | 819 static int |
| 286 | 820 XTclear_end_of_line (first_unused) |
| 821 register int first_unused; | |
| 822 { | |
| 771 | 823 struct frame *f = updating_frame; |
| 286 | 824 int mask; |
| 825 | |
| 771 | 826 if (f == 0) |
| 286 | 827 abort (); |
| 828 | |
| 771 | 829 if (curs_y < 0 || curs_y >= f->height) |
| 286 | 830 return; |
| 831 if (first_unused <= 0) | |
| 832 return; | |
| 833 | |
| 771 | 834 if (first_unused >= f->width) |
| 835 first_unused = f->width; | |
| 286 | 836 |
| 837 BLOCK_INPUT; | |
| 838 | |
| 429 | 839 /* Notice if the cursor will be cleared by this operation. */ |
| 771 | 840 if (curs_y == f->phys_cursor_y |
| 841 && curs_x <= f->phys_cursor_x | |
| 842 && f->phys_cursor_x < first_unused) | |
| 843 f->phys_cursor_x = -1; | |
| 286 | 844 |
| 845 #ifdef HAVE_X11 | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
846 XClearArea (x_current_display, FRAME_X_WINDOW (f), |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
847 CHAR_TO_PIXEL_COL (f, curs_x), |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
848 CHAR_TO_PIXEL_ROW (f, curs_y), |
| 771 | 849 FONT_WIDTH (f->display.x->font) * (first_unused - curs_x), |
| 850 FONT_HEIGHT (f->display.x->font), False); | |
|
4277
c3fbb9249f5b
(redraw_previous_char): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4244
diff
changeset
|
851 #if 0 |
|
c3fbb9249f5b
(redraw_previous_char): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4244
diff
changeset
|
852 redraw_previous_char (f, curs_x, curs_y); |
|
c3fbb9249f5b
(redraw_previous_char): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4244
diff
changeset
|
853 #endif |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
854 #else /* ! defined (HAVE_X11) */ |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
855 XPixSet (FRAME_X_WINDOW (f), |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
856 CHAR_TO_PIXEL_COL (f, curs_x), |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
857 CHAR_TO_PIXEL_ROW (f, curs_y), |
| 771 | 858 FONT_WIDTH (f->display.x->font) * (first_unused - curs_x), |
| 859 FONT_HEIGHT (f->display.x->font), | |
| 860 f->display.x->background_pixel); | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
861 #endif /* ! defined (HAVE_X11) */ |
| 286 | 862 |
| 863 UNBLOCK_INPUT; | |
| 864 } | |
| 865 | |
|
4277
c3fbb9249f5b
(redraw_previous_char): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4244
diff
changeset
|
866 /* Erase the character (if any) at the position just before X, Y in frame F, |
|
c3fbb9249f5b
(redraw_previous_char): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4244
diff
changeset
|
867 then redraw it and the character before it. |
|
c3fbb9249f5b
(redraw_previous_char): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4244
diff
changeset
|
868 This is necessary when we erase starting at X, |
|
5872
6389c826f847
(x_display_cursor, process_expose_from_menu): Block input.
Karl Heuer <kwzh@gnu.org>
parents:
5825
diff
changeset
|
869 in case the character after X overlaps into the one before X. |
|
6389c826f847
(x_display_cursor, process_expose_from_menu): Block input.
Karl Heuer <kwzh@gnu.org>
parents:
5825
diff
changeset
|
870 Call this function with input blocked. */ |
|
4277
c3fbb9249f5b
(redraw_previous_char): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4244
diff
changeset
|
871 |
|
c3fbb9249f5b
(redraw_previous_char): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4244
diff
changeset
|
872 static void |
|
c3fbb9249f5b
(redraw_previous_char): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4244
diff
changeset
|
873 redraw_previous_char (f, x, y) |
|
c3fbb9249f5b
(redraw_previous_char): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4244
diff
changeset
|
874 FRAME_PTR f; |
|
c3fbb9249f5b
(redraw_previous_char): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4244
diff
changeset
|
875 int x, y; |
|
c3fbb9249f5b
(redraw_previous_char): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4244
diff
changeset
|
876 { |
|
c3fbb9249f5b
(redraw_previous_char): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4244
diff
changeset
|
877 /* Erase the character before the new ones, in case |
|
c3fbb9249f5b
(redraw_previous_char): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4244
diff
changeset
|
878 what was here before overlaps it. |
|
c3fbb9249f5b
(redraw_previous_char): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4244
diff
changeset
|
879 Reoutput that character, and the previous character |
|
c3fbb9249f5b
(redraw_previous_char): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4244
diff
changeset
|
880 (in case the previous character overlaps it). */ |
|
c3fbb9249f5b
(redraw_previous_char): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4244
diff
changeset
|
881 if (x > 0) |
|
c3fbb9249f5b
(redraw_previous_char): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4244
diff
changeset
|
882 { |
|
c3fbb9249f5b
(redraw_previous_char): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4244
diff
changeset
|
883 int start_x = x - 2; |
|
c3fbb9249f5b
(redraw_previous_char): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4244
diff
changeset
|
884 if (start_x < 0) |
|
c3fbb9249f5b
(redraw_previous_char): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4244
diff
changeset
|
885 start_x = 0; |
|
c3fbb9249f5b
(redraw_previous_char): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4244
diff
changeset
|
886 XClearArea (x_current_display, FRAME_X_WINDOW (f), |
|
c3fbb9249f5b
(redraw_previous_char): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4244
diff
changeset
|
887 CHAR_TO_PIXEL_COL (f, x - 1), |
|
c3fbb9249f5b
(redraw_previous_char): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4244
diff
changeset
|
888 CHAR_TO_PIXEL_ROW (f, y), |
|
c3fbb9249f5b
(redraw_previous_char): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4244
diff
changeset
|
889 FONT_WIDTH (f->display.x->font), |
|
c3fbb9249f5b
(redraw_previous_char): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4244
diff
changeset
|
890 FONT_HEIGHT (f->display.x->font), False); |
|
c3fbb9249f5b
(redraw_previous_char): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4244
diff
changeset
|
891 |
|
c3fbb9249f5b
(redraw_previous_char): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4244
diff
changeset
|
892 dumpglyphs (f, CHAR_TO_PIXEL_COL (f, start_x), |
|
c3fbb9249f5b
(redraw_previous_char): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4244
diff
changeset
|
893 CHAR_TO_PIXEL_ROW (f, y), |
|
c3fbb9249f5b
(redraw_previous_char): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4244
diff
changeset
|
894 &FRAME_CURRENT_GLYPHS (f)->glyphs[y][start_x], |
|
c3fbb9249f5b
(redraw_previous_char): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4244
diff
changeset
|
895 x - start_x, highlight); |
|
c3fbb9249f5b
(redraw_previous_char): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4244
diff
changeset
|
896 } |
|
c3fbb9249f5b
(redraw_previous_char): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4244
diff
changeset
|
897 } |
|
c3fbb9249f5b
(redraw_previous_char): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4244
diff
changeset
|
898 |
| 286 | 899 static |
| 771 | 900 XTclear_frame () |
| 286 | 901 { |
| 902 int mask; | |
| 771 | 903 struct frame *f = updating_frame; |
| 904 | |
| 905 if (f == 0) | |
| 906 f = selected_frame; | |
| 907 | |
| 908 f->phys_cursor_x = -1; /* Cursor not visible. */ | |
| 286 | 909 curs_x = 0; /* Nominal cursor position is top left. */ |
| 910 curs_y = 0; | |
| 911 | |
| 912 BLOCK_INPUT; | |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
913 |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
914 XClear (FRAME_X_WINDOW (f)); |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
915 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
916 /* We have to clear the scroll bars, too. If we have changed |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
917 colors or something like that, then they should be notified. */ |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
918 x_scroll_bar_clear (f); |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
919 |
| 286 | 920 #ifndef HAVE_X11 |
| 771 | 921 dumpborder (f, 0); |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
922 #endif /* HAVE_X11 */ |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
923 |
| 286 | 924 XFlushQueue (); |
| 925 UNBLOCK_INPUT; | |
| 926 } | |
| 927 | |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
928 /* Invert the middle quarter of the frame for .15 sec. */ |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
929 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
930 /* We use the select system call to do the waiting, so we have to make sure |
|
3591
507f64624555
Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents:
3585
diff
changeset
|
931 it's available. If it isn't, we just won't do visual bells. */ |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
932 #if defined (HAVE_TIMEVAL) && defined (HAVE_SELECT) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
933 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
934 /* Subtract the `struct timeval' values X and Y, |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
935 storing the result in RESULT. |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
936 Return 1 if the difference is negative, otherwise 0. */ |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
937 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
938 static int |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
939 timeval_subtract (result, x, y) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
940 struct timeval *result, x, y; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
941 { |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
942 /* Perform the carry for the later subtraction by updating y. |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
943 This is safer because on some systems |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
944 the tv_sec member is unsigned. */ |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
945 if (x.tv_usec < y.tv_usec) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
946 { |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
947 int nsec = (y.tv_usec - x.tv_usec) / 1000000 + 1; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
948 y.tv_usec -= 1000000 * nsec; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
949 y.tv_sec += nsec; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
950 } |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
951 if (x.tv_usec - y.tv_usec > 1000000) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
952 { |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
953 int nsec = (y.tv_usec - x.tv_usec) / 1000000; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
954 y.tv_usec += 1000000 * nsec; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
955 y.tv_sec -= nsec; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
956 } |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
957 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
958 /* Compute the time remaining to wait. tv_usec is certainly positive. */ |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
959 result->tv_sec = x.tv_sec - y.tv_sec; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
960 result->tv_usec = x.tv_usec - y.tv_usec; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
961 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
962 /* Return indication of whether the result should be considered negative. */ |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
963 return x.tv_sec < y.tv_sec; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
964 } |
| 286 | 965 |
| 771 | 966 XTflash (f) |
| 967 struct frame *f; | |
| 286 | 968 { |
| 969 BLOCK_INPUT; | |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
970 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
971 { |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
972 GC gc; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
973 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
974 /* Create a GC that will use the GXxor function to flip foreground pixels |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
975 into background pixels. */ |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
976 { |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
977 XGCValues values; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
978 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
979 values.function = GXxor; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
980 values.foreground = (f->display.x->foreground_pixel |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
981 ^ f->display.x->background_pixel); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
982 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
983 gc = XCreateGC (x_current_display, FRAME_X_WINDOW (f), |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
984 GCFunction | GCForeground, &values); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
985 } |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
986 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
987 { |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
988 int width = PIXEL_WIDTH (f); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
989 int height = PIXEL_HEIGHT (f); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
990 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
991 XFillRectangle (x_current_display, FRAME_X_WINDOW (f), gc, |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
992 width/4, height/4, width/2, height/2); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
993 XFlush (x_current_display); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
994 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
995 { |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
996 struct timeval wakeup, now; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
997 |
|
5362
d1fa597d923d
(XTflush): FIx typo in last change.
Richard M. Stallman <rms@gnu.org>
parents:
5357
diff
changeset
|
998 EMACS_GET_TIME (wakeup); |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
999 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1000 /* Compute time to wait until, propagating carry from usecs. */ |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1001 wakeup.tv_usec += 150000; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1002 wakeup.tv_sec += (wakeup.tv_usec / 1000000); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1003 wakeup.tv_usec %= 1000000; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1004 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1005 /* Keep waiting until past the time wakeup. */ |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1006 while (1) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1007 { |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1008 struct timeval timeout; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1009 |
|
5362
d1fa597d923d
(XTflush): FIx typo in last change.
Richard M. Stallman <rms@gnu.org>
parents:
5357
diff
changeset
|
1010 EMACS_GET_TIME (timeout); |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1011 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1012 /* In effect, timeout = wakeup - timeout. |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1013 Break if result would be negative. */ |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1014 if (timeval_subtract (&timeout, wakeup, timeout)) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1015 break; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1016 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1017 /* Try to wait that long--but we might wake up sooner. */ |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1018 select (0, 0, 0, 0, &timeout); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1019 } |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1020 } |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1021 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1022 XFillRectangle (x_current_display, FRAME_X_WINDOW (f), gc, |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1023 width/4, height/4, width/2, height/2); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1024 XFreeGC (x_current_display, gc); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1025 XFlush (x_current_display); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1026 } |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1027 } |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1028 |
| 286 | 1029 UNBLOCK_INPUT; |
| 1030 } | |
| 1031 | |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1032 #endif |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1033 |
| 286 | 1034 |
| 1035 /* Make audible bell. */ | |
| 1036 | |
| 1037 #ifdef HAVE_X11 | |
|
5825
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
1038 #define XRINGBELL XBell (x_current_display, 0) |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1039 #else /* ! defined (HAVE_X11) */ |
|
5825
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
1040 #define XRINGBELL XFeep (0); |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1041 #endif /* ! defined (HAVE_X11) */ |
| 286 | 1042 |
| 1043 XTring_bell () | |
| 1044 { | |
|
3243
48d20a0b229a
(XTring_bell): Do nothing if x_current_connection is 0.
Richard M. Stallman <rms@gnu.org>
parents:
3218
diff
changeset
|
1045 if (x_current_display == 0) |
|
48d20a0b229a
(XTring_bell): Do nothing if x_current_connection is 0.
Richard M. Stallman <rms@gnu.org>
parents:
3218
diff
changeset
|
1046 return; |
|
48d20a0b229a
(XTring_bell): Do nothing if x_current_connection is 0.
Richard M. Stallman <rms@gnu.org>
parents:
3218
diff
changeset
|
1047 |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1048 #if defined (HAVE_TIMEVAL) && defined (HAVE_SELECT) |
| 286 | 1049 if (visible_bell) |
| 771 | 1050 XTflash (selected_frame); |
| 286 | 1051 else |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1052 #endif |
| 286 | 1053 { |
| 1054 BLOCK_INPUT; | |
| 1055 XRINGBELL; | |
| 1056 XFlushQueue (); | |
| 1057 UNBLOCK_INPUT; | |
| 1058 } | |
| 1059 } | |
| 1060 | |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1061 /* Insert and delete character. |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1062 These are not supposed to be used because we are supposed to turn |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1063 off the feature of using them. */ |
| 286 | 1064 |
| 1065 static | |
| 1066 XTinsert_glyphs (start, len) | |
| 1067 register char *start; | |
| 1068 register int len; | |
| 1069 { | |
| 1070 abort (); | |
| 1071 } | |
| 1072 | |
| 1073 static | |
| 1074 XTdelete_glyphs (n) | |
| 1075 register int n; | |
| 1076 { | |
| 1077 abort (); | |
| 1078 } | |
| 1079 | |
| 1080 /* Specify how many text lines, from the top of the window, | |
| 1081 should be affected by insert-lines and delete-lines operations. | |
| 1082 This, and those operations, are used only within an update | |
| 1083 that is bounded by calls to XTupdate_begin and XTupdate_end. */ | |
| 1084 | |
| 1085 static | |
| 1086 XTset_terminal_window (n) | |
| 1087 register int n; | |
| 1088 { | |
| 771 | 1089 if (updating_frame == 0) |
| 286 | 1090 abort (); |
| 1091 | |
| 771 | 1092 if ((n <= 0) || (n > updating_frame->height)) |
| 1093 flexlines = updating_frame->height; | |
| 286 | 1094 else |
| 1095 flexlines = n; | |
| 1096 } | |
| 1097 | |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1098 /* Perform an insert-lines operation. |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1099 Insert N lines at a vertical position curs_y. */ |
| 286 | 1100 |
| 1101 static void | |
| 1102 stufflines (n) | |
| 1103 register int n; | |
| 1104 { | |
| 1105 register int topregion, bottomregion; | |
| 1106 register int length, newtop, mask; | |
| 771 | 1107 register struct frame *f = updating_frame; |
| 1108 int intborder = f->display.x->internal_border_width; | |
| 286 | 1109 |
| 1110 if (curs_y >= flexlines) | |
| 1111 return; | |
| 1112 | |
| 1113 topregion = curs_y; | |
| 1114 bottomregion = flexlines - (n + 1); | |
| 1115 newtop = topregion + n; | |
| 1116 length = (bottomregion - topregion) + 1; | |
| 1117 | |
| 1118 #ifndef HAVE_X11 | |
| 1119 dumpqueue (); | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1120 #endif /* HAVE_X11 */ |
| 286 | 1121 |
| 1122 if ((length > 0) && (newtop <= flexlines)) | |
| 1123 { | |
| 1124 #ifdef HAVE_X11 | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1125 XCopyArea (x_current_display, FRAME_X_WINDOW (f), |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1126 FRAME_X_WINDOW (f), f->display.x->normal_gc, |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1127 intborder, CHAR_TO_PIXEL_ROW (f, topregion), |
| 771 | 1128 f->width * FONT_WIDTH (f->display.x->font), |
| 1129 length * FONT_HEIGHT (f->display.x->font), intborder, | |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1130 CHAR_TO_PIXEL_ROW (f, newtop)); |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1131 #else /* ! defined (HAVE_X11) */ |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1132 XMoveArea (FRAME_X_WINDOW (f), |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1133 intborder, CHAR_TO_PIXEL_ROW (f, topregion), |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1134 intborder, CHAR_TO_PIXEL_ROW (f, newtop), |
| 771 | 1135 f->width * FONT_WIDTH (f->display.x->font), |
| 1136 length * FONT_HEIGHT (f->display.x->font)); | |
| 286 | 1137 /* Now we must process any ExposeRegion events that occur |
| 1138 if the area being copied from is obscured. | |
| 1139 We can't let it wait because further i/d operations | |
| 1140 may want to copy this area to another area. */ | |
| 1141 x_read_exposes (); | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1142 #endif /* ! defined (HAVE_X11) */ |
| 286 | 1143 } |
| 1144 | |
| 1145 newtop = min (newtop, (flexlines - 1)); | |
| 1146 length = newtop - topregion; | |
| 1147 if (length > 0) | |
| 1148 { | |
| 1149 #ifdef HAVE_X11 | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1150 XClearArea (x_current_display, FRAME_X_WINDOW (f), intborder, |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1151 CHAR_TO_PIXEL_ROW (f, topregion), |
| 771 | 1152 f->width * FONT_WIDTH (f->display.x->font), |
| 1153 n * FONT_HEIGHT (f->display.x->font), False); | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1154 #else /* ! defined (HAVE_X11) */ |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1155 XPixSet (FRAME_X_WINDOW (f), |
| 286 | 1156 intborder, |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1157 CHAR_TO_PIXEL_ROW (f, topregion), |
| 771 | 1158 f->width * FONT_WIDTH (f->display.x->font), |
| 1159 n * FONT_HEIGHT (f->display.x->font), | |
| 1160 f->display.x->background_pixel); | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1161 #endif /* ! defined (HAVE_X11) */ |
| 286 | 1162 } |
| 1163 } | |
| 1164 | |
| 1165 /* Perform a delete-lines operation, deleting N lines | |
| 1166 at a vertical position curs_y. */ | |
| 1167 | |
| 1168 static void | |
| 1169 scraplines (n) | |
| 1170 register int n; | |
| 1171 { | |
| 1172 int mask; | |
| 771 | 1173 register struct frame *f = updating_frame; |
| 1174 int intborder = f->display.x->internal_border_width; | |
| 286 | 1175 |
| 1176 if (curs_y >= flexlines) | |
| 1177 return; | |
| 1178 | |
| 1179 #ifndef HAVE_X11 | |
| 1180 dumpqueue (); | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1181 #endif /* HAVE_X11 */ |
| 286 | 1182 |
| 1183 if ((curs_y + n) >= flexlines) | |
| 1184 { | |
| 1185 if (flexlines >= (curs_y + 1)) | |
| 1186 { | |
| 1187 #ifdef HAVE_X11 | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1188 XClearArea (x_current_display, FRAME_X_WINDOW (f), intborder, |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1189 CHAR_TO_PIXEL_ROW (f, curs_y), |
| 771 | 1190 f->width * FONT_WIDTH (f->display.x->font), |
| 1191 (flexlines - curs_y) * FONT_HEIGHT (f->display.x->font), False); | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1192 #else /* ! defined (HAVE_X11) */ |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1193 XPixSet (FRAME_X_WINDOW (f), |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1194 intborder, CHAR_TO_PIXEL_ROW (f, curs_y), |
| 771 | 1195 f->width * FONT_WIDTH (f->display.x->font), |
| 1196 (flexlines - curs_y) * FONT_HEIGHT (f->display.x->font), | |
| 1197 f->display.x->background_pixel); | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1198 #endif /* ! defined (HAVE_X11) */ |
| 286 | 1199 } |
| 1200 } | |
| 1201 else | |
| 1202 { | |
| 1203 #ifdef HAVE_X11 | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1204 XCopyArea (x_current_display, FRAME_X_WINDOW (f), |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1205 FRAME_X_WINDOW (f), f->display.x->normal_gc, |
| 286 | 1206 intborder, |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1207 CHAR_TO_PIXEL_ROW (f, curs_y + n), |
| 771 | 1208 f->width * FONT_WIDTH (f->display.x->font), |
| 1209 (flexlines - (curs_y + n)) * FONT_HEIGHT (f->display.x->font), | |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1210 intborder, CHAR_TO_PIXEL_ROW (f, curs_y)); |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1211 XClearArea (x_current_display, FRAME_X_WINDOW (f), |
| 286 | 1212 intborder, |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1213 CHAR_TO_PIXEL_ROW (f, flexlines - n), |
| 771 | 1214 f->width * FONT_WIDTH (f->display.x->font), |
| 1215 n * FONT_HEIGHT (f->display.x->font), False); | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1216 #else /* ! defined (HAVE_X11) */ |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1217 XMoveArea (FRAME_X_WINDOW (f), |
| 286 | 1218 intborder, |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1219 CHAR_TO_PIXEL_ROW (f, curs_y + n), |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1220 intborder, CHAR_TO_PIXEL_ROW (f, curs_y), |
| 771 | 1221 f->width * FONT_WIDTH (f->display.x->font), |
| 1222 (flexlines - (curs_y + n)) * FONT_HEIGHT (f->display.x->font)); | |
| 286 | 1223 /* Now we must process any ExposeRegion events that occur |
| 1224 if the area being copied from is obscured. | |
| 1225 We can't let it wait because further i/d operations | |
| 1226 may want to copy this area to another area. */ | |
| 1227 x_read_exposes (); | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1228 XPixSet (FRAME_X_WINDOW (f), intborder, |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1229 CHAR_TO_PIXEL_ROW (f, flexlines - n), |
| 771 | 1230 f->width * FONT_WIDTH (f->display.x->font), |
| 1231 n * FONT_HEIGHT (f->display.x->font), f->display.x->background_pixel); | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1232 #endif /* ! defined (HAVE_X11) */ |
| 286 | 1233 } |
| 1234 } | |
| 1235 | |
| 1236 /* Perform an insert-lines or delete-lines operation, | |
| 1237 inserting N lines or deleting -N lines at vertical position VPOS. */ | |
| 1238 | |
| 1239 XTins_del_lines (vpos, n) | |
| 1240 int vpos, n; | |
| 1241 { | |
| 771 | 1242 if (updating_frame == 0) |
| 286 | 1243 abort (); |
| 1244 | |
| 429 | 1245 /* Hide the cursor. */ |
| 771 | 1246 x_display_cursor (updating_frame, 0); |
| 286 | 1247 |
| 1248 XTcursor_to (vpos, 0); | |
| 1249 | |
| 1250 BLOCK_INPUT; | |
| 1251 if (n >= 0) | |
| 1252 stufflines (n); | |
| 1253 else | |
| 1254 scraplines (-n); | |
| 1255 XFlushQueue (); | |
| 1256 UNBLOCK_INPUT; | |
| 1257 } | |
| 1258 | |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1259 /* Support routines for exposure events. */ |
| 286 | 1260 static void clear_cursor (); |
| 1261 | |
| 771 | 1262 /* Output into a rectangle of an X-window (for frame F) |
| 1263 the characters in f->phys_lines that overlap that rectangle. | |
| 286 | 1264 TOP and LEFT are the position of the upper left corner of the rectangle. |
|
5872
6389c826f847
(x_display_cursor, process_expose_from_menu): Block input.
Karl Heuer <kwzh@gnu.org>
parents:
5825
diff
changeset
|
1265 ROWS and COLS are the size of the rectangle. |
|
6389c826f847
(x_display_cursor, process_expose_from_menu): Block input.
Karl Heuer <kwzh@gnu.org>
parents:
5825
diff
changeset
|
1266 Call this function with input blocked. */ |
| 286 | 1267 |
| 1268 static void | |
| 771 | 1269 dumprectangle (f, left, top, cols, rows) |
| 1270 struct frame *f; | |
| 286 | 1271 register int left, top, cols, rows; |
| 1272 { | |
| 771 | 1273 register struct frame_glyphs *active_frame = FRAME_CURRENT_GLYPHS (f); |
| 286 | 1274 int cursor_cleared = 0; |
| 1275 int bottom, right; | |
| 1276 register int y; | |
| 1277 | |
| 771 | 1278 if (FRAME_GARBAGED_P (f)) |
| 286 | 1279 return; |
| 1280 | |
| 1281 /* Express rectangle as four edges, instead of position-and-size. */ | |
| 1282 bottom = top + rows; | |
| 1283 right = left + cols; | |
| 1284 | |
| 1285 #ifndef HAVE_X11 /* Window manger does this for X11. */ | |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1286 { |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1287 int intborder = f->display.x->internal_border_width; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1288 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1289 /* If the rectangle includes any of the internal border area, |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1290 redisplay the border emphasis. */ |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1291 if (top < intborder || left < intborder |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1292 || bottom > intborder + f->height * FONT_HEIGHT (f->display.x->font) |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1293 || right > intborder + f->width * FONT_WIDTH (f->display.x->font)) |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1294 dumpborder (f, 0); |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1295 } |
|
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
1296 #endif /* not HAVE_X11 Window manger does this for X11. */ |
| 286 | 1297 |
| 1298 /* Convert rectangle edges in pixels to edges in chars. | |
| 1299 Round down for left and top, up for right and bottom. */ | |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1300 top = PIXEL_TO_CHAR_ROW (f, top); |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1301 left = PIXEL_TO_CHAR_COL (f, left); |
| 771 | 1302 bottom += (FONT_HEIGHT (f->display.x->font) - 1); |
| 1303 right += (FONT_WIDTH (f->display.x->font) - 1); | |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1304 bottom = PIXEL_TO_CHAR_ROW (f, bottom); |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1305 right = PIXEL_TO_CHAR_COL (f, right); |
| 286 | 1306 |
| 1307 /* Clip the rectangle to what can be visible. */ | |
| 1308 if (left < 0) | |
| 1309 left = 0; | |
| 1310 if (top < 0) | |
| 1311 top = 0; | |
| 771 | 1312 if (right > f->width) |
| 1313 right = f->width; | |
| 1314 if (bottom > f->height) | |
| 1315 bottom = f->height; | |
| 286 | 1316 |
| 1317 /* Get size in chars of the rectangle. */ | |
| 1318 cols = right - left; | |
| 1319 rows = bottom - top; | |
| 1320 | |
| 1321 /* If rectangle has zero area, return. */ | |
| 1322 if (rows <= 0) return; | |
| 1323 if (cols <= 0) return; | |
| 1324 | |
| 1325 /* Turn off the cursor if it is in the rectangle. | |
| 1326 We will turn it back on afterward. */ | |
| 771 | 1327 if ((f->phys_cursor_x >= left) && (f->phys_cursor_x < right) |
| 1328 && (f->phys_cursor_y >= top) && (f->phys_cursor_y < bottom)) | |
| 286 | 1329 { |
| 771 | 1330 clear_cursor (f); |
| 286 | 1331 cursor_cleared = 1; |
| 1332 } | |
| 1333 | |
| 1334 /* Display the text in the rectangle, one text line at a time. */ | |
| 1335 | |
| 1336 for (y = top; y < bottom; y++) | |
| 1337 { | |
| 771 | 1338 GLYPH *line = &active_frame->glyphs[y][left]; |
| 1339 | |
| 1340 if (! active_frame->enable[y] || left > active_frame->used[y]) | |
| 286 | 1341 continue; |
| 1342 | |
| 771 | 1343 dumpglyphs (f, |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1344 CHAR_TO_PIXEL_COL (f, left), |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1345 CHAR_TO_PIXEL_ROW (f, y), |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1346 line, min (cols, active_frame->used[y] - left), |
|
2732
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
1347 active_frame->highlight[y]); |
| 286 | 1348 } |
| 1349 | |
| 1350 /* Turn the cursor on if we turned it off. */ | |
| 1351 | |
| 1352 if (cursor_cleared) | |
| 771 | 1353 x_display_cursor (f, 1); |
| 286 | 1354 } |
| 1355 | |
| 1356 #ifndef HAVE_X11 | |
| 1357 /* Process all queued ExposeRegion events. */ | |
| 1358 | |
| 1359 static void | |
| 1360 dumpqueue () | |
| 1361 { | |
| 1362 register int i; | |
| 1363 XExposeRegionEvent r; | |
| 1364 | |
| 1365 while (dequeue_event (&r, &x_expose_queue)) | |
| 1366 { | |
| 771 | 1367 struct frame *f = x_window_to_frame (r.window); |
| 1368 if (f->display.x->icon_desc == r.window) | |
| 1369 refreshicon (f); | |
| 286 | 1370 else |
| 771 | 1371 dumprectangle (f, r.x, r.y, r.width, r.height); |
| 286 | 1372 } |
| 1373 XFlushQueue (); | |
| 1374 } | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1375 #endif /* HAVE_X11 */ |
| 286 | 1376 |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1377 /* Process all expose events that are pending, for X10. |
| 771 | 1378 Redraws the cursor if necessary on any frame that |
| 1379 is not in the process of being updated with update_frame. */ | |
| 286 | 1380 |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1381 #ifndef HAVE_X11 |
| 286 | 1382 static void |
| 1383 x_do_pending_expose () | |
| 1384 { | |
| 1385 int mask; | |
| 771 | 1386 struct frame *f; |
| 1387 Lisp_Object tail, frame; | |
| 286 | 1388 |
| 1389 if (expose_all_windows) | |
| 1390 { | |
| 1391 expose_all_windows = 0; | |
| 771 | 1392 for (tail = Vframe_list; CONSP (tail); tail = XCONS (tail)->cdr) |
| 286 | 1393 { |
| 1394 register int temp_width, temp_height; | |
| 1395 int intborder; | |
| 1396 | |
| 771 | 1397 frame = XCONS (tail)->car; |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1398 if (XGCTYPE (frame) != Lisp_Frame) |
| 286 | 1399 continue; |
| 771 | 1400 f = XFRAME (frame); |
|
976
cbdfc337ec8f
* xterm.c (x_wm_hints): New variable.
Jim Blandy <jimb@redhat.com>
parents:
786
diff
changeset
|
1401 if (! FRAME_X_P (f)) |
| 286 | 1402 continue; |
|
1658
452ba03935d7
* xterm.c (XTread_socket): When we get MapNotify, UnmapNotify,
Jim Blandy <jimb@redhat.com>
parents:
1530
diff
changeset
|
1403 if (!f->async_visible) |
| 286 | 1404 continue; |
| 771 | 1405 if (!f->display.x->needs_exposure) |
| 286 | 1406 continue; |
| 1407 | |
| 771 | 1408 intborder = f->display.x->internal_border_width; |
| 1409 | |
| 1410 clear_cursor (f); | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1411 XGetWindowInfo (FRAME_X_WINDOW (f), &windowinfo); |
| 286 | 1412 temp_width = ((windowinfo.width - 2 * intborder |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1413 - f->display.x->v_scroll_bar_width) |
| 771 | 1414 / FONT_WIDTH (f->display.x->font)); |
| 286 | 1415 temp_height = ((windowinfo.height- 2 * intborder |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1416 - f->display.x->h_scroll_bar_height) |
| 771 | 1417 / FONT_HEIGHT (f->display.x->font)); |
| 1418 if (temp_width != f->width || temp_height != f->height) | |
| 286 | 1419 { |
| 771 | 1420 change_frame_size (f, max (1, temp_height), |
|
976
cbdfc337ec8f
* xterm.c (x_wm_hints): New variable.
Jim Blandy <jimb@redhat.com>
parents:
786
diff
changeset
|
1421 max (1, temp_width), 0, 1); |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1422 x_resize_scroll_bars (f); |
| 286 | 1423 } |
| 771 | 1424 f->display.x->left_pos = windowinfo.x; |
| 1425 f->display.x->top_pos = windowinfo.y; | |
| 1426 dumprectangle (f, 0, 0, PIXEL_WIDTH (f), PIXEL_HEIGHT (f)); | |
| 286 | 1427 #if 0 |
| 771 | 1428 dumpborder (f, 0); |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1429 #endif /* ! 0 */ |
| 771 | 1430 f->display.x->needs_exposure = 0; |
| 1431 if (updating_frame != f) | |
| 1432 x_display_cursor (f, 1); | |
| 286 | 1433 XFlushQueue (); |
| 1434 } | |
| 1435 } | |
| 1436 else | |
| 1437 /* Handle any individual-rectangle expose events queued | |
| 1438 for various windows. */ | |
| 1439 #ifdef HAVE_X11 | |
| 1440 ; | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1441 #else /* ! defined (HAVE_X11) */ |
| 286 | 1442 dumpqueue (); |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1443 #endif /* ! defined (HAVE_X11) */ |
| 286 | 1444 } |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1445 #endif |
| 286 | 1446 |
| 1447 #ifdef HAVE_X11 | |
| 1448 static void | |
| 771 | 1449 frame_highlight (frame) |
| 1450 struct frame *frame; | |
| 286 | 1451 { |
|
3943
cbdf67dd68d0
* xterm.c (frame_highlight, frame_unhighlight): Don't test
Jim Blandy <jimb@redhat.com>
parents:
3938
diff
changeset
|
1452 /* We used to only do this if Vx_no_window_manager was non-nil, but |
|
cbdf67dd68d0
* xterm.c (frame_highlight, frame_unhighlight): Don't test
Jim Blandy <jimb@redhat.com>
parents:
3938
diff
changeset
|
1453 the ICCCM (section 4.1.6) says that the window's border pixmap |
|
cbdf67dd68d0
* xterm.c (frame_highlight, frame_unhighlight): Don't test
Jim Blandy <jimb@redhat.com>
parents:
3938
diff
changeset
|
1454 and border pixel are window attributes which are "private to the |
|
cbdf67dd68d0
* xterm.c (frame_highlight, frame_unhighlight): Don't test
Jim Blandy <jimb@redhat.com>
parents:
3938
diff
changeset
|
1455 client", so we can always change it to whatever we want. */ |
|
cbdf67dd68d0
* xterm.c (frame_highlight, frame_unhighlight): Don't test
Jim Blandy <jimb@redhat.com>
parents:
3938
diff
changeset
|
1456 BLOCK_INPUT; |
|
cbdf67dd68d0
* xterm.c (frame_highlight, frame_unhighlight): Don't test
Jim Blandy <jimb@redhat.com>
parents:
3938
diff
changeset
|
1457 XSetWindowBorder (x_current_display, FRAME_X_WINDOW (frame), |
|
cbdf67dd68d0
* xterm.c (frame_highlight, frame_unhighlight): Don't test
Jim Blandy <jimb@redhat.com>
parents:
3938
diff
changeset
|
1458 frame->display.x->border_pixel); |
|
cbdf67dd68d0
* xterm.c (frame_highlight, frame_unhighlight): Don't test
Jim Blandy <jimb@redhat.com>
parents:
3938
diff
changeset
|
1459 UNBLOCK_INPUT; |
| 771 | 1460 x_display_cursor (frame, 1); |
| 286 | 1461 } |
| 1462 | |
| 1463 static void | |
| 771 | 1464 frame_unhighlight (frame) |
| 1465 struct frame *frame; | |
| 286 | 1466 { |
|
3943
cbdf67dd68d0
* xterm.c (frame_highlight, frame_unhighlight): Don't test
Jim Blandy <jimb@redhat.com>
parents:
3938
diff
changeset
|
1467 /* We used to only do this if Vx_no_window_manager was non-nil, but |
|
cbdf67dd68d0
* xterm.c (frame_highlight, frame_unhighlight): Don't test
Jim Blandy <jimb@redhat.com>
parents:
3938
diff
changeset
|
1468 the ICCCM (section 4.1.6) says that the window's border pixmap |
|
cbdf67dd68d0
* xterm.c (frame_highlight, frame_unhighlight): Don't test
Jim Blandy <jimb@redhat.com>
parents:
3938
diff
changeset
|
1469 and border pixel are window attributes which are "private to the |
|
cbdf67dd68d0
* xterm.c (frame_highlight, frame_unhighlight): Don't test
Jim Blandy <jimb@redhat.com>
parents:
3938
diff
changeset
|
1470 client", so we can always change it to whatever we want. */ |
|
cbdf67dd68d0
* xterm.c (frame_highlight, frame_unhighlight): Don't test
Jim Blandy <jimb@redhat.com>
parents:
3938
diff
changeset
|
1471 BLOCK_INPUT; |
|
cbdf67dd68d0
* xterm.c (frame_highlight, frame_unhighlight): Don't test
Jim Blandy <jimb@redhat.com>
parents:
3938
diff
changeset
|
1472 XSetWindowBorderPixmap (x_current_display, FRAME_X_WINDOW (frame), |
|
cbdf67dd68d0
* xterm.c (frame_highlight, frame_unhighlight): Don't test
Jim Blandy <jimb@redhat.com>
parents:
3938
diff
changeset
|
1473 frame->display.x->border_tile); |
|
cbdf67dd68d0
* xterm.c (frame_highlight, frame_unhighlight): Don't test
Jim Blandy <jimb@redhat.com>
parents:
3938
diff
changeset
|
1474 UNBLOCK_INPUT; |
| 771 | 1475 x_display_cursor (frame, 1); |
| 286 | 1476 } |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1477 #else /* ! defined (HAVE_X11) */ |
| 771 | 1478 /* Dump the border-emphasis of frame F. |
| 1479 If F is selected, this is a lining of the same color as the border, | |
| 286 | 1480 just within the border, occupying a portion of the internal border. |
| 771 | 1481 If F is not selected, it is background in the same place. |
| 286 | 1482 If ALWAYS is 0, don't bother explicitly drawing if it's background. |
| 1483 | |
| 771 | 1484 ALWAYS = 1 is used when a frame becomes selected or deselected. |
| 286 | 1485 In that case, we also turn the cursor off and on again |
| 1486 so it will appear in the proper shape (solid if selected; else hollow.) */ | |
| 1487 | |
| 1488 static void | |
| 771 | 1489 dumpborder (f, always) |
| 1490 struct frame *f; | |
| 286 | 1491 int always; |
| 1492 { | |
| 771 | 1493 int thickness = f->display.x->internal_border_width / 2; |
| 1494 int width = PIXEL_WIDTH (f); | |
| 1495 int height = PIXEL_HEIGHT (f); | |
| 286 | 1496 int pixel; |
| 1497 | |
| 771 | 1498 if (f != selected_frame) |
| 286 | 1499 { |
| 1500 if (!always) | |
| 1501 return; | |
| 1502 | |
| 771 | 1503 pixel = f->display.x->background_pixel; |
| 286 | 1504 } |
| 1505 else | |
| 1506 { | |
| 771 | 1507 pixel = f->display.x->border_pixel; |
| 286 | 1508 } |
| 1509 | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1510 XPixSet (FRAME_X_WINDOW (f), 0, 0, width, thickness, pixel); |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1511 XPixSet (FRAME_X_WINDOW (f), 0, 0, thickness, height, pixel); |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1512 XPixSet (FRAME_X_WINDOW (f), 0, height - thickness, width, |
| 286 | 1513 thickness, pixel); |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1514 XPixSet (FRAME_X_WINDOW (f), width - thickness, 0, thickness, |
| 286 | 1515 height, pixel); |
| 1516 | |
| 1517 if (always) | |
| 771 | 1518 x_display_cursor (f, 1); |
| 286 | 1519 } |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1520 #endif /* ! defined (HAVE_X11) */ |
| 286 | 1521 |
| 771 | 1522 static void XTframe_rehighlight (); |
| 1523 | |
| 1524 /* The focus has changed. Update the frames as necessary to reflect | |
| 1525 the new situation. Note that we can't change the selected frame | |
| 286 | 1526 here, because the lisp code we are interrupting might become confused. |
|
3591
507f64624555
Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents:
3585
diff
changeset
|
1527 Each event gets marked with the frame in which it occurred, so the |
| 369 | 1528 lisp code can tell when the switch took place by examining the events. */ |
| 1529 | |
| 1530 static void | |
| 771 | 1531 x_new_focus_frame (frame) |
| 1532 struct frame *frame; | |
| 286 | 1533 { |
| 771 | 1534 struct frame *old_focus = x_focus_frame; |
| 286 | 1535 int events_enqueued = 0; |
| 1536 | |
| 771 | 1537 if (frame != x_focus_frame) |
| 286 | 1538 { |
| 369 | 1539 /* Set this before calling other routines, so that they see |
| 771 | 1540 the correct value of x_focus_frame. */ |
| 1541 x_focus_frame = frame; | |
| 369 | 1542 |
| 1543 if (old_focus && old_focus->auto_lower) | |
| 771 | 1544 x_lower_frame (old_focus); |
| 286 | 1545 |
| 1546 #if 0 | |
| 771 | 1547 selected_frame = frame; |
| 1548 XSET (XWINDOW (selected_frame->selected_window)->frame, | |
| 1549 Lisp_Frame, selected_frame); | |
| 1550 Fselect_window (selected_frame->selected_window); | |
| 1551 choose_minibuf_frame (); | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1552 #endif /* ! 0 */ |
| 286 | 1553 |
| 771 | 1554 if (x_focus_frame && x_focus_frame->auto_raise) |
| 1555 x_raise_frame (x_focus_frame); | |
| 369 | 1556 } |
| 1557 | |
| 771 | 1558 XTframe_rehighlight (); |
| 369 | 1559 } |
| 1560 | |
| 1561 | |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1562 /* The focus has changed, or we have redirected a frame's focus to |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1563 another frame (this happens when a frame uses a surrogate |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1564 minibuffer frame). Shift the highlight as appropriate. */ |
| 369 | 1565 static void |
| 771 | 1566 XTframe_rehighlight () |
| 369 | 1567 { |
| 771 | 1568 struct frame *old_highlight = x_highlight_frame; |
| 1569 | |
| 1570 if (x_focus_frame) | |
| 286 | 1571 { |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1572 x_highlight_frame = |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1573 ((XGCTYPE (FRAME_FOCUS_FRAME (x_focus_frame)) == Lisp_Frame) |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1574 ? XFRAME (FRAME_FOCUS_FRAME (x_focus_frame)) |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1575 : x_focus_frame); |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1576 if (! FRAME_LIVE_P (x_highlight_frame)) |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1577 { |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1578 FRAME_FOCUS_FRAME (x_focus_frame) = Qnil; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1579 x_highlight_frame = x_focus_frame; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1580 } |
| 286 | 1581 } |
| 369 | 1582 else |
| 771 | 1583 x_highlight_frame = 0; |
| 1584 | |
| 1585 if (x_highlight_frame != old_highlight) | |
| 369 | 1586 { |
| 1587 if (old_highlight) | |
| 771 | 1588 frame_unhighlight (old_highlight); |
| 1589 if (x_highlight_frame) | |
| 1590 frame_highlight (x_highlight_frame); | |
| 369 | 1591 } |
| 286 | 1592 } |
| 1593 | |
|
3585
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1594 /* Keyboard processing - modifier keys, vendor-specific keysyms, etc. */ |
| 286 | 1595 |
|
1279
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1596 /* Which modifier keys are on which modifier bits? |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1597 |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1598 With each keystroke, X returns eight bits indicating which modifier |
|
1436
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
1599 keys were held down when the key was pressed. The interpretation |
|
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
1600 of the top five modifier bits depends on what keys are attached |
|
1279
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1601 to them. If the Meta_L and Meta_R keysyms are on mod5, then mod5 |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1602 is the meta bit. |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1603 |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1604 x_meta_mod_mask is a mask containing the bits used for the meta key. |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1605 It may have more than one bit set, if more than one modifier bit |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1606 has meta keys on it. Basically, if EVENT is a KeyPress event, |
|
1436
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
1607 the meta key is pressed if (EVENT.state & x_meta_mod_mask) != 0. |
|
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
1608 |
|
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
1609 x_shift_lock_mask is LockMask if the XK_Shift_Lock keysym is on the |
|
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
1610 lock modifier bit, or zero otherwise. Non-alphabetic keys should |
|
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
1611 only be affected by the lock modifier bit if XK_Shift_Lock is in |
|
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
1612 use; XK_Caps_Lock should only affect alphabetic keys. With this |
|
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
1613 arrangement, the lock modifier should shift the character if |
|
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
1614 (EVENT.state & x_shift_lock_mask) != 0. */ |
|
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
1615 static int x_meta_mod_mask, x_shift_lock_mask; |
|
1279
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1616 |
|
2047
e179f9f55aa8
(x_alt_mod_mask, x_super_mod_mask, x_hyper_mod_mask): New variables.
Richard M. Stallman <rms@gnu.org>
parents:
2016
diff
changeset
|
1617 /* These are like x_meta_mod_mask, but for different modifiers. */ |
|
e179f9f55aa8
(x_alt_mod_mask, x_super_mod_mask, x_hyper_mod_mask): New variables.
Richard M. Stallman <rms@gnu.org>
parents:
2016
diff
changeset
|
1618 static int x_alt_mod_mask, x_super_mod_mask, x_hyper_mod_mask; |
|
e179f9f55aa8
(x_alt_mod_mask, x_super_mod_mask, x_hyper_mod_mask): New variables.
Richard M. Stallman <rms@gnu.org>
parents:
2016
diff
changeset
|
1619 |
|
1279
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1620 /* Initialize mode_switch_bit and modifier_meaning. */ |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1621 static void |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1622 x_find_modifier_meanings () |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1623 { |
|
1324
44215417cf6e
* xterm.c (x_find_modifier_meanings): If there are no
Jim Blandy <jimb@redhat.com>
parents:
1279
diff
changeset
|
1624 int min_code, max_code; |
|
1279
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1625 KeySym *syms; |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1626 int syms_per_code; |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1627 XModifierKeymap *mods; |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1628 |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1629 x_meta_mod_mask = 0; |
|
1436
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
1630 x_shift_lock_mask = 0; |
|
2047
e179f9f55aa8
(x_alt_mod_mask, x_super_mod_mask, x_hyper_mod_mask): New variables.
Richard M. Stallman <rms@gnu.org>
parents:
2016
diff
changeset
|
1631 x_alt_mod_mask = 0; |
|
e179f9f55aa8
(x_alt_mod_mask, x_super_mod_mask, x_hyper_mod_mask): New variables.
Richard M. Stallman <rms@gnu.org>
parents:
2016
diff
changeset
|
1632 x_super_mod_mask = 0; |
|
e179f9f55aa8
(x_alt_mod_mask, x_super_mod_mask, x_hyper_mod_mask): New variables.
Richard M. Stallman <rms@gnu.org>
parents:
2016
diff
changeset
|
1633 x_hyper_mod_mask = 0; |
|
1279
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1634 |
|
2127
adaf588e32a6
* xterm.c (x_find_modifier_meanings): XDisplayKeycodes only
Jim Blandy <jimb@redhat.com>
parents:
2064
diff
changeset
|
1635 #ifdef HAVE_X11R4 |
|
1279
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1636 XDisplayKeycodes (x_current_display, &min_code, &max_code); |
|
2127
adaf588e32a6
* xterm.c (x_find_modifier_meanings): XDisplayKeycodes only
Jim Blandy <jimb@redhat.com>
parents:
2064
diff
changeset
|
1637 #else |
|
adaf588e32a6
* xterm.c (x_find_modifier_meanings): XDisplayKeycodes only
Jim Blandy <jimb@redhat.com>
parents:
2064
diff
changeset
|
1638 min_code = x_current_display->min_keycode; |
|
adaf588e32a6
* xterm.c (x_find_modifier_meanings): XDisplayKeycodes only
Jim Blandy <jimb@redhat.com>
parents:
2064
diff
changeset
|
1639 max_code = x_current_display->max_keycode; |
|
adaf588e32a6
* xterm.c (x_find_modifier_meanings): XDisplayKeycodes only
Jim Blandy <jimb@redhat.com>
parents:
2064
diff
changeset
|
1640 #endif |
|
adaf588e32a6
* xterm.c (x_find_modifier_meanings): XDisplayKeycodes only
Jim Blandy <jimb@redhat.com>
parents:
2064
diff
changeset
|
1641 |
|
1279
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1642 syms = XGetKeyboardMapping (x_current_display, |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1643 min_code, max_code - min_code + 1, |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1644 &syms_per_code); |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1645 mods = XGetModifierMapping (x_current_display); |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1646 |
|
1436
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
1647 /* Scan the modifier table to see which modifier bits the Meta and |
|
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
1648 Alt keysyms are on. */ |
|
1279
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1649 { |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1650 int row, col; /* The row and column in the modifier table. */ |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1651 |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1652 for (row = 3; row < 8; row++) |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1653 for (col = 0; col < mods->max_keypermod; col++) |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1654 { |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1655 KeyCode code = |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1656 mods->modifiermap[(row * mods->max_keypermod) + col]; |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1657 |
|
6560
a071babfa9ea
(x_find_modifier_meanings): Skip zero entries.
Karl Heuer <kwzh@gnu.org>
parents:
6521
diff
changeset
|
1658 /* Zeroes are used for filler. Skip them. */ |
|
a071babfa9ea
(x_find_modifier_meanings): Skip zero entries.
Karl Heuer <kwzh@gnu.org>
parents:
6521
diff
changeset
|
1659 if (code == 0) |
|
a071babfa9ea
(x_find_modifier_meanings): Skip zero entries.
Karl Heuer <kwzh@gnu.org>
parents:
6521
diff
changeset
|
1660 continue; |
|
a071babfa9ea
(x_find_modifier_meanings): Skip zero entries.
Karl Heuer <kwzh@gnu.org>
parents:
6521
diff
changeset
|
1661 |
|
1279
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1662 /* Are any of this keycode's keysyms a meta key? */ |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1663 { |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1664 int code_col; |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1665 |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1666 for (code_col = 0; code_col < syms_per_code; code_col++) |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1667 { |
|
1324
44215417cf6e
* xterm.c (x_find_modifier_meanings): If there are no
Jim Blandy <jimb@redhat.com>
parents:
1279
diff
changeset
|
1668 int sym = syms[((code - min_code) * syms_per_code) + code_col]; |
|
44215417cf6e
* xterm.c (x_find_modifier_meanings): If there are no
Jim Blandy <jimb@redhat.com>
parents:
1279
diff
changeset
|
1669 |
|
44215417cf6e
* xterm.c (x_find_modifier_meanings): If there are no
Jim Blandy <jimb@redhat.com>
parents:
1279
diff
changeset
|
1670 switch (sym) |
|
1279
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1671 { |
|
1324
44215417cf6e
* xterm.c (x_find_modifier_meanings): If there are no
Jim Blandy <jimb@redhat.com>
parents:
1279
diff
changeset
|
1672 case XK_Meta_L: |
|
44215417cf6e
* xterm.c (x_find_modifier_meanings): If there are no
Jim Blandy <jimb@redhat.com>
parents:
1279
diff
changeset
|
1673 case XK_Meta_R: |
|
1279
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1674 x_meta_mod_mask |= (1 << row); |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1675 break; |
|
1324
44215417cf6e
* xterm.c (x_find_modifier_meanings): If there are no
Jim Blandy <jimb@redhat.com>
parents:
1279
diff
changeset
|
1676 |
|
44215417cf6e
* xterm.c (x_find_modifier_meanings): If there are no
Jim Blandy <jimb@redhat.com>
parents:
1279
diff
changeset
|
1677 case XK_Alt_L: |
|
44215417cf6e
* xterm.c (x_find_modifier_meanings): If there are no
Jim Blandy <jimb@redhat.com>
parents:
1279
diff
changeset
|
1678 case XK_Alt_R: |
|
2047
e179f9f55aa8
(x_alt_mod_mask, x_super_mod_mask, x_hyper_mod_mask): New variables.
Richard M. Stallman <rms@gnu.org>
parents:
2016
diff
changeset
|
1679 x_alt_mod_mask |= (1 << row); |
|
e179f9f55aa8
(x_alt_mod_mask, x_super_mod_mask, x_hyper_mod_mask): New variables.
Richard M. Stallman <rms@gnu.org>
parents:
2016
diff
changeset
|
1680 break; |
|
e179f9f55aa8
(x_alt_mod_mask, x_super_mod_mask, x_hyper_mod_mask): New variables.
Richard M. Stallman <rms@gnu.org>
parents:
2016
diff
changeset
|
1681 |
|
e179f9f55aa8
(x_alt_mod_mask, x_super_mod_mask, x_hyper_mod_mask): New variables.
Richard M. Stallman <rms@gnu.org>
parents:
2016
diff
changeset
|
1682 case XK_Hyper_L: |
|
e179f9f55aa8
(x_alt_mod_mask, x_super_mod_mask, x_hyper_mod_mask): New variables.
Richard M. Stallman <rms@gnu.org>
parents:
2016
diff
changeset
|
1683 case XK_Hyper_R: |
|
e179f9f55aa8
(x_alt_mod_mask, x_super_mod_mask, x_hyper_mod_mask): New variables.
Richard M. Stallman <rms@gnu.org>
parents:
2016
diff
changeset
|
1684 x_hyper_mod_mask |= (1 << row); |
|
e179f9f55aa8
(x_alt_mod_mask, x_super_mod_mask, x_hyper_mod_mask): New variables.
Richard M. Stallman <rms@gnu.org>
parents:
2016
diff
changeset
|
1685 break; |
|
e179f9f55aa8
(x_alt_mod_mask, x_super_mod_mask, x_hyper_mod_mask): New variables.
Richard M. Stallman <rms@gnu.org>
parents:
2016
diff
changeset
|
1686 |
|
e179f9f55aa8
(x_alt_mod_mask, x_super_mod_mask, x_hyper_mod_mask): New variables.
Richard M. Stallman <rms@gnu.org>
parents:
2016
diff
changeset
|
1687 case XK_Super_L: |
|
e179f9f55aa8
(x_alt_mod_mask, x_super_mod_mask, x_hyper_mod_mask): New variables.
Richard M. Stallman <rms@gnu.org>
parents:
2016
diff
changeset
|
1688 case XK_Super_R: |
|
e179f9f55aa8
(x_alt_mod_mask, x_super_mod_mask, x_hyper_mod_mask): New variables.
Richard M. Stallman <rms@gnu.org>
parents:
2016
diff
changeset
|
1689 x_super_mod_mask |= (1 << row); |
|
1324
44215417cf6e
* xterm.c (x_find_modifier_meanings): If there are no
Jim Blandy <jimb@redhat.com>
parents:
1279
diff
changeset
|
1690 break; |
|
1436
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
1691 |
|
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
1692 case XK_Shift_Lock: |
|
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
1693 /* Ignore this if it's not on the lock modifier. */ |
|
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
1694 if ((1 << row) == LockMask) |
|
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
1695 x_shift_lock_mask = LockMask; |
|
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
1696 break; |
|
1279
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1697 } |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1698 } |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1699 } |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1700 } |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1701 } |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1702 |
|
1324
44215417cf6e
* xterm.c (x_find_modifier_meanings): If there are no
Jim Blandy <jimb@redhat.com>
parents:
1279
diff
changeset
|
1703 /* If we couldn't find any meta keys, accept any alt keys as meta keys. */ |
|
44215417cf6e
* xterm.c (x_find_modifier_meanings): If there are no
Jim Blandy <jimb@redhat.com>
parents:
1279
diff
changeset
|
1704 if (! x_meta_mod_mask) |
|
2047
e179f9f55aa8
(x_alt_mod_mask, x_super_mod_mask, x_hyper_mod_mask): New variables.
Richard M. Stallman <rms@gnu.org>
parents:
2016
diff
changeset
|
1705 { |
|
e179f9f55aa8
(x_alt_mod_mask, x_super_mod_mask, x_hyper_mod_mask): New variables.
Richard M. Stallman <rms@gnu.org>
parents:
2016
diff
changeset
|
1706 x_meta_mod_mask = x_alt_mod_mask; |
|
e179f9f55aa8
(x_alt_mod_mask, x_super_mod_mask, x_hyper_mod_mask): New variables.
Richard M. Stallman <rms@gnu.org>
parents:
2016
diff
changeset
|
1707 x_alt_mod_mask = 0; |
|
e179f9f55aa8
(x_alt_mod_mask, x_super_mod_mask, x_hyper_mod_mask): New variables.
Richard M. Stallman <rms@gnu.org>
parents:
2016
diff
changeset
|
1708 } |
|
1324
44215417cf6e
* xterm.c (x_find_modifier_meanings): If there are no
Jim Blandy <jimb@redhat.com>
parents:
1279
diff
changeset
|
1709 |
|
2923
c8997402dd6b
(x_find_modifier_meanings): If some keys are meta and alt,
Richard M. Stallman <rms@gnu.org>
parents:
2882
diff
changeset
|
1710 /* If some keys are both alt and meta, |
|
c8997402dd6b
(x_find_modifier_meanings): If some keys are meta and alt,
Richard M. Stallman <rms@gnu.org>
parents:
2882
diff
changeset
|
1711 make them just meta, not alt. */ |
|
c8997402dd6b
(x_find_modifier_meanings): If some keys are meta and alt,
Richard M. Stallman <rms@gnu.org>
parents:
2882
diff
changeset
|
1712 if (x_alt_mod_mask & x_meta_mod_mask) |
|
c8997402dd6b
(x_find_modifier_meanings): If some keys are meta and alt,
Richard M. Stallman <rms@gnu.org>
parents:
2882
diff
changeset
|
1713 { |
|
c8997402dd6b
(x_find_modifier_meanings): If some keys are meta and alt,
Richard M. Stallman <rms@gnu.org>
parents:
2882
diff
changeset
|
1714 x_alt_mod_mask &= ~x_meta_mod_mask; |
|
c8997402dd6b
(x_find_modifier_meanings): If some keys are meta and alt,
Richard M. Stallman <rms@gnu.org>
parents:
2882
diff
changeset
|
1715 } |
|
c8997402dd6b
(x_find_modifier_meanings): If some keys are meta and alt,
Richard M. Stallman <rms@gnu.org>
parents:
2882
diff
changeset
|
1716 |
|
1279
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1717 XFree ((char *) syms); |
|
1324
44215417cf6e
* xterm.c (x_find_modifier_meanings): If there are no
Jim Blandy <jimb@redhat.com>
parents:
1279
diff
changeset
|
1718 XFreeModifiermap (mods); |
|
1279
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1719 } |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1720 |
|
2661
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
1721 /* Convert between the modifier bits X uses and the modifier bits |
|
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
1722 Emacs uses. */ |
|
1530
a7f8a1fe258e
* xterm.c (x_convert_modifiers): Declare this to return an
Jim Blandy <jimb@redhat.com>
parents:
1436
diff
changeset
|
1723 static unsigned int |
|
2661
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
1724 x_x_to_emacs_modifiers (state) |
| 286 | 1725 unsigned int state; |
| 1726 { | |
|
1436
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
1727 return ( ((state & (ShiftMask | x_shift_lock_mask)) ? shift_modifier : 0) |
|
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
1728 | ((state & ControlMask) ? ctrl_modifier : 0) |
|
2047
e179f9f55aa8
(x_alt_mod_mask, x_super_mod_mask, x_hyper_mod_mask): New variables.
Richard M. Stallman <rms@gnu.org>
parents:
2016
diff
changeset
|
1729 | ((state & x_meta_mod_mask) ? meta_modifier : 0) |
|
e179f9f55aa8
(x_alt_mod_mask, x_super_mod_mask, x_hyper_mod_mask): New variables.
Richard M. Stallman <rms@gnu.org>
parents:
2016
diff
changeset
|
1730 | ((state & x_alt_mod_mask) ? alt_modifier : 0) |
|
e179f9f55aa8
(x_alt_mod_mask, x_super_mod_mask, x_hyper_mod_mask): New variables.
Richard M. Stallman <rms@gnu.org>
parents:
2016
diff
changeset
|
1731 | ((state & x_super_mod_mask) ? super_modifier : 0) |
|
e179f9f55aa8
(x_alt_mod_mask, x_super_mod_mask, x_hyper_mod_mask): New variables.
Richard M. Stallman <rms@gnu.org>
parents:
2016
diff
changeset
|
1732 | ((state & x_hyper_mod_mask) ? hyper_modifier : 0)); |
| 286 | 1733 } |
| 1734 | |
|
2661
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
1735 static unsigned int |
|
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
1736 x_emacs_to_x_modifiers (state) |
|
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
1737 unsigned int state; |
|
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
1738 { |
|
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
1739 return ( ((state & alt_modifier) ? x_alt_mod_mask : 0) |
|
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
1740 | ((state & super_modifier) ? x_super_mod_mask : 0) |
|
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
1741 | ((state & hyper_modifier) ? x_hyper_mod_mask : 0) |
|
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
1742 | ((state & shift_modifier) ? ShiftMask : 0) |
|
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
1743 | ((state & ctrl_modifier) ? ControlMask : 0) |
|
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
1744 | ((state & meta_modifier) ? x_meta_mod_mask : 0)); |
|
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
1745 } |
|
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
1746 |
|
3585
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1747 /* Return true iff KEYSYM is a vendor-specific keysym that we should |
|
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1748 return as a function key. If you add a keysym to this, you should |
|
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1749 make sure that the tables make_lispy_event uses contain a suitable |
|
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1750 name for it. */ |
|
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1751 static int |
|
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1752 x_is_vendor_fkey (sym) |
|
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1753 KeySym sym; |
|
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1754 { |
|
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1755 return 0 |
|
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1756 #ifdef DXK_Remove |
|
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1757 || (sym == DXK_Remove) |
|
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1758 #endif |
|
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1759 ; |
|
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1760 } |
|
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1761 |
|
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1762 |
|
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1763 /* Mouse clicks and mouse movement. Rah. */ |
|
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1764 #ifdef HAVE_X11 |
|
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1765 |
|
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1766 /* Given a pixel position (PIX_X, PIX_Y) on the frame F, return |
|
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1767 glyph co-ordinates in (*X, *Y). Set *BOUNDS to the rectangle |
|
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
1768 that the glyph at X, Y occupies, if BOUNDS != 0. |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
1769 If NOCLIP is nonzero, do not force the value into range. */ |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
1770 |
|
6023
67aa546e4ff1
(construct_menu_click): Undo previous change.
Richard M. Stallman <rms@gnu.org>
parents:
6022
diff
changeset
|
1771 void |
|
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
1772 pixel_to_glyph_coords (f, pix_x, pix_y, x, y, bounds, noclip) |
|
3585
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1773 FRAME_PTR f; |
|
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
1774 register int pix_x, pix_y; |
|
3585
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1775 register int *x, *y; |
|
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1776 XRectangle *bounds; |
|
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
1777 int noclip; |
|
3585
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1778 { |
|
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
1779 /* Arrange for the division in PIXEL_TO_CHAR_COL etc. to round down |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
1780 even for negative values. */ |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
1781 if (pix_x < 0) |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
1782 pix_x -= FONT_WIDTH ((f)->display.x->font) - 1; |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
1783 if (pix_y < 0) |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
1784 pix_y -= FONT_HEIGHT ((f)->display.x->font) - 1; |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
1785 |
|
3585
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1786 pix_x = PIXEL_TO_CHAR_COL (f, pix_x); |
|
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1787 pix_y = PIXEL_TO_CHAR_ROW (f, pix_y); |
|
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1788 |
|
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1789 if (bounds) |
|
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1790 { |
|
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1791 bounds->width = FONT_WIDTH (f->display.x->font); |
|
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1792 bounds->height = FONT_HEIGHT (f->display.x->font); |
|
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1793 bounds->x = CHAR_TO_PIXEL_COL (f, pix_x); |
|
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1794 bounds->y = CHAR_TO_PIXEL_ROW (f, pix_y); |
|
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1795 } |
|
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1796 |
|
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
1797 if (!noclip) |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
1798 { |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
1799 if (pix_x < 0) |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
1800 pix_x = 0; |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
1801 else if (pix_x > f->width) |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
1802 pix_x = f->width; |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
1803 |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
1804 if (pix_y < 0) |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
1805 pix_y = 0; |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
1806 else if (pix_y > f->height) |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
1807 pix_y = f->height; |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
1808 } |
|
3585
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1809 |
|
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1810 *x = pix_x; |
|
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1811 *y = pix_y; |
|
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1812 } |
|
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1813 |
|
6055
a9f61727a90c
(construct_mouse_click): Don't convert to glyph units.
Richard M. Stallman <rms@gnu.org>
parents:
6023
diff
changeset
|
1814 void |
|
a9f61727a90c
(construct_mouse_click): Don't convert to glyph units.
Richard M. Stallman <rms@gnu.org>
parents:
6023
diff
changeset
|
1815 glyph_to_pixel_coords (f, x, y, pix_x, pix_y) |
|
a9f61727a90c
(construct_mouse_click): Don't convert to glyph units.
Richard M. Stallman <rms@gnu.org>
parents:
6023
diff
changeset
|
1816 FRAME_PTR f; |
|
a9f61727a90c
(construct_mouse_click): Don't convert to glyph units.
Richard M. Stallman <rms@gnu.org>
parents:
6023
diff
changeset
|
1817 register int x, y; |
|
a9f61727a90c
(construct_mouse_click): Don't convert to glyph units.
Richard M. Stallman <rms@gnu.org>
parents:
6023
diff
changeset
|
1818 register int *pix_x, *pix_y; |
|
a9f61727a90c
(construct_mouse_click): Don't convert to glyph units.
Richard M. Stallman <rms@gnu.org>
parents:
6023
diff
changeset
|
1819 { |
|
a9f61727a90c
(construct_mouse_click): Don't convert to glyph units.
Richard M. Stallman <rms@gnu.org>
parents:
6023
diff
changeset
|
1820 *pix_x = CHAR_TO_PIXEL_COL (f, x); |
|
a9f61727a90c
(construct_mouse_click): Don't convert to glyph units.
Richard M. Stallman <rms@gnu.org>
parents:
6023
diff
changeset
|
1821 *pix_y = CHAR_TO_PIXEL_ROW (f, y); |
|
a9f61727a90c
(construct_mouse_click): Don't convert to glyph units.
Richard M. Stallman <rms@gnu.org>
parents:
6023
diff
changeset
|
1822 } |
|
a9f61727a90c
(construct_mouse_click): Don't convert to glyph units.
Richard M. Stallman <rms@gnu.org>
parents:
6023
diff
changeset
|
1823 |
| 286 | 1824 /* Prepare a mouse-event in *RESULT for placement in the input queue. |
| 1825 | |
| 1826 If the event is a button press, then note that we have grabbed | |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1827 the mouse. */ |
| 286 | 1828 |
| 1829 static Lisp_Object | |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1830 construct_mouse_click (result, event, f) |
| 286 | 1831 struct input_event *result; |
| 1832 XButtonEvent *event; | |
| 771 | 1833 struct frame *f; |
| 286 | 1834 { |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1835 /* Make the event type no_event; we'll change that when we decide |
| 286 | 1836 otherwise. */ |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1837 result->kind = mouse_click; |
|
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
1838 result->code = event->button - Button1; |
| 708 | 1839 result->timestamp = event->time; |
|
2661
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
1840 result->modifiers = (x_x_to_emacs_modifiers (event->state) |
|
1324
44215417cf6e
* xterm.c (x_find_modifier_meanings): If there are no
Jim Blandy <jimb@redhat.com>
parents:
1279
diff
changeset
|
1841 | (event->type == ButtonRelease |
|
44215417cf6e
* xterm.c (x_find_modifier_meanings): If there are no
Jim Blandy <jimb@redhat.com>
parents:
1279
diff
changeset
|
1842 ? up_modifier |
|
44215417cf6e
* xterm.c (x_find_modifier_meanings): If there are no
Jim Blandy <jimb@redhat.com>
parents:
1279
diff
changeset
|
1843 : down_modifier)); |
| 286 | 1844 |
| 1845 /* Notice if the mouse is still grabbed. */ | |
| 1846 if (event->type == ButtonPress) | |
| 1847 { | |
| 1848 if (! x_mouse_grabbed) | |
| 1849 Vmouse_depressed = Qt; | |
| 429 | 1850 x_mouse_grabbed |= (1 << event->button); |
|
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
1851 last_mouse_frame = f; |
| 286 | 1852 } |
| 1853 else if (event->type == ButtonRelease) | |
| 1854 { | |
| 429 | 1855 x_mouse_grabbed &= ~(1 << event->button); |
| 286 | 1856 if (!x_mouse_grabbed) |
| 1857 Vmouse_depressed = Qnil; | |
| 1858 } | |
| 1859 | |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1860 { |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1861 int row, column; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1862 |
|
6055
a9f61727a90c
(construct_mouse_click): Don't convert to glyph units.
Richard M. Stallman <rms@gnu.org>
parents:
6023
diff
changeset
|
1863 #if 0 |
|
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
1864 pixel_to_glyph_coords (f, event->x, event->y, &column, &row, NULL, 0); |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1865 XFASTINT (result->x) = column; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1866 XFASTINT (result->y) = row; |
|
6055
a9f61727a90c
(construct_mouse_click): Don't convert to glyph units.
Richard M. Stallman <rms@gnu.org>
parents:
6023
diff
changeset
|
1867 #endif |
|
6626
59c44532d2a0
(construct_menu_click, construct_mouse_click):
Richard M. Stallman <rms@gnu.org>
parents:
6616
diff
changeset
|
1868 XSET (result->x, Lisp_Int, event->x); |
|
59c44532d2a0
(construct_menu_click, construct_mouse_click):
Richard M. Stallman <rms@gnu.org>
parents:
6616
diff
changeset
|
1869 XSET (result->y, Lisp_Int, event->y); |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1870 XSET (result->frame_or_window, Lisp_Frame, f); |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1871 } |
| 286 | 1872 } |
|
6022
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
1873 |
|
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
1874 /* Prepare a menu-event in *RESULT for placement in the input queue. */ |
|
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
1875 |
|
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
1876 static Lisp_Object |
|
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
1877 construct_menu_click (result, event, f) |
|
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
1878 struct input_event *result; |
|
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
1879 XButtonEvent *event; |
|
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
1880 struct frame *f; |
|
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
1881 { |
|
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
1882 /* Make the event type no_event; we'll change that when we decide |
|
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
1883 otherwise. */ |
|
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
1884 result->kind = mouse_click; |
|
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
1885 XSET (result->code, Lisp_Int, event->button - Button1); |
|
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
1886 result->timestamp = event->time; |
|
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
1887 result->modifiers = (x_x_to_emacs_modifiers (event->state) |
|
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
1888 | (event->type == ButtonRelease |
|
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
1889 ? up_modifier |
|
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
1890 : down_modifier)); |
|
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
1891 |
|
6626
59c44532d2a0
(construct_menu_click, construct_mouse_click):
Richard M. Stallman <rms@gnu.org>
parents:
6616
diff
changeset
|
1892 XSET (result->x, Lisp_Int, event->x); |
|
59c44532d2a0
(construct_menu_click, construct_mouse_click):
Richard M. Stallman <rms@gnu.org>
parents:
6616
diff
changeset
|
1893 XSET (result->y, Lisp_Int, -1); |
|
6023
67aa546e4ff1
(construct_menu_click): Undo previous change.
Richard M. Stallman <rms@gnu.org>
parents:
6022
diff
changeset
|
1894 XSET (result->frame_or_window, Lisp_Frame, f); |
|
6022
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
1895 } |
|
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
1896 |
| 429 | 1897 /* Function to report a mouse movement to the mainstream Emacs code. |
| 1898 The input handler calls this. | |
| 1899 | |
| 1900 We have received a mouse movement event, which is given in *event. | |
| 1901 If the mouse is over a different glyph than it was last time, tell | |
| 1902 the mainstream emacs code by setting mouse_moved. If not, ask for | |
| 1903 another motion event, so we can check again the next time it moves. */ | |
|
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
1904 |
| 429 | 1905 static void |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1906 note_mouse_movement (frame, event) |
| 771 | 1907 FRAME_PTR frame; |
| 429 | 1908 XMotionEvent *event; |
| 1909 | |
| 1910 { | |
| 732 | 1911 last_mouse_movement_time = event->time; |
| 1912 | |
| 429 | 1913 /* Has the mouse moved off the glyph it was on at the last sighting? */ |
| 1914 if (event->x < last_mouse_glyph.x | |
| 1915 || event->x >= last_mouse_glyph.x + last_mouse_glyph.width | |
| 1916 || event->y < last_mouse_glyph.y | |
| 1917 || event->y >= last_mouse_glyph.y + last_mouse_glyph.height) | |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1918 { |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1919 mouse_moved = 1; |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1920 last_mouse_scroll_bar = Qnil; |
|
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
1921 |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
1922 note_mouse_highlight (frame, event->x, event->y); |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
1923 |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
1924 /* Ask for another mouse motion event. */ |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
1925 { |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
1926 int dummy; |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
1927 |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
1928 XQueryPointer (event->display, event->window, |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
1929 (Window *) &dummy, (Window *) &dummy, |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
1930 &dummy, &dummy, &dummy, &dummy, |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
1931 (unsigned int *) &dummy); |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
1932 } |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1933 } |
| 429 | 1934 else |
| 1935 { | |
| 1936 /* It's on the same glyph. Call XQueryPointer so we'll get an | |
| 1937 event the next time the mouse moves and we can see if it's | |
| 1938 *still* on the same glyph. */ | |
| 1939 int dummy; | |
| 1940 | |
| 1941 XQueryPointer (event->display, event->window, | |
| 1942 (Window *) &dummy, (Window *) &dummy, | |
| 1943 &dummy, &dummy, &dummy, &dummy, | |
| 1944 (unsigned int *) &dummy); | |
| 1945 } | |
| 1946 } | |
| 1947 | |
|
6644
8e2379ce4fcb
(fast_find_position): Always return coords within the window.
Richard M. Stallman <rms@gnu.org>
parents:
6631
diff
changeset
|
1948 /* This is used for debugging, to turn off note_mouse_highlight. */ |
|
8e2379ce4fcb
(fast_find_position): Always return coords within the window.
Richard M. Stallman <rms@gnu.org>
parents:
6631
diff
changeset
|
1949 static int disable_mouse_highlight; |
|
8e2379ce4fcb
(fast_find_position): Always return coords within the window.
Richard M. Stallman <rms@gnu.org>
parents:
6631
diff
changeset
|
1950 |
|
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
1951 /* Take proper action when the mouse has moved to position X, Y on frame F |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
1952 as regards highlighting characters that have mouse-face properties. |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
1953 Also dehighlighting chars where the mouse was before. */ |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
1954 |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
1955 static void |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
1956 note_mouse_highlight (f, x, y) |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
1957 FRAME_PTR f; |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
1958 { |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
1959 int row, column, portion; |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
1960 XRectangle new_glyph; |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
1961 Lisp_Object window; |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
1962 struct window *w; |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
1963 |
|
6644
8e2379ce4fcb
(fast_find_position): Always return coords within the window.
Richard M. Stallman <rms@gnu.org>
parents:
6631
diff
changeset
|
1964 if (disable_mouse_highlight) |
|
8e2379ce4fcb
(fast_find_position): Always return coords within the window.
Richard M. Stallman <rms@gnu.org>
parents:
6631
diff
changeset
|
1965 return; |
|
8e2379ce4fcb
(fast_find_position): Always return coords within the window.
Richard M. Stallman <rms@gnu.org>
parents:
6631
diff
changeset
|
1966 |
|
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
1967 mouse_face_mouse_x = x; |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
1968 mouse_face_mouse_y = y; |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
1969 mouse_face_mouse_frame = f; |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
1970 |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
1971 if (mouse_face_defer) |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
1972 return; |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
1973 |
|
6660
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
1974 if (gc_in_progress) |
|
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
1975 { |
|
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
1976 mouse_face_deferred_gc = 1; |
|
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
1977 return; |
|
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
1978 } |
|
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
1979 |
|
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
1980 /* Find out which glyph the mouse is on. */ |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
1981 pixel_to_glyph_coords (f, x, y, &column, &row, |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
1982 &new_glyph, x_mouse_grabbed); |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
1983 |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
1984 /* Which window is that in? */ |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
1985 window = window_from_coordinates (f, column, row, &portion); |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
1986 w = XWINDOW (window); |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
1987 |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
1988 /* If we were displaying active text in another window, clear that. */ |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
1989 if (! EQ (window, mouse_face_window)) |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
1990 clear_mouse_face (); |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
1991 |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
1992 /* Are we in a window whose display is up to date? */ |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
1993 if (WINDOWP (window) && portion == 0 |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
1994 && EQ (w->window_end_valid, Qt)) |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
1995 { |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
1996 int *ptr = FRAME_CURRENT_GLYPHS (f)->charstarts[row]; |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
1997 int i, pos; |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
1998 |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
1999 /* Find which buffer position the mouse corresponds to. */ |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2000 for (i = column; i >= 0; i--) |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2001 if (ptr[i] > 0) |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2002 break; |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2003 pos = ptr[i]; |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2004 /* Is it outside the displayed active region (if any)? */ |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2005 if (pos > 0 |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2006 && ! (EQ (window, mouse_face_window) |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2007 && pos >= mouse_face_beg && pos < mouse_face_end)) |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2008 { |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2009 Lisp_Object mouse_face, overlay, position; |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2010 Lisp_Object *overlay_vec; |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2011 int len, noverlays, ignor1; |
|
6649
1305248ee38a
(note_mouse_highlight): Reject out-of-range pos value
Richard M. Stallman <rms@gnu.org>
parents:
6644
diff
changeset
|
2012 struct buffer *obuf; |
|
1305248ee38a
(note_mouse_highlight): Reject out-of-range pos value
Richard M. Stallman <rms@gnu.org>
parents:
6644
diff
changeset
|
2013 |
|
1305248ee38a
(note_mouse_highlight): Reject out-of-range pos value
Richard M. Stallman <rms@gnu.org>
parents:
6644
diff
changeset
|
2014 /* If we get an out-of-range value, return now; |
|
1305248ee38a
(note_mouse_highlight): Reject out-of-range pos value
Richard M. Stallman <rms@gnu.org>
parents:
6644
diff
changeset
|
2015 don't get an error. */ |
|
1305248ee38a
(note_mouse_highlight): Reject out-of-range pos value
Richard M. Stallman <rms@gnu.org>
parents:
6644
diff
changeset
|
2016 if (pos > BUF_ZV (XBUFFER (w->buffer))) |
|
1305248ee38a
(note_mouse_highlight): Reject out-of-range pos value
Richard M. Stallman <rms@gnu.org>
parents:
6644
diff
changeset
|
2017 return; |
|
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2018 |
|
6626
59c44532d2a0
(construct_menu_click, construct_mouse_click):
Richard M. Stallman <rms@gnu.org>
parents:
6616
diff
changeset
|
2019 /* Make the window's buffer temporarily current for |
|
59c44532d2a0
(construct_menu_click, construct_mouse_click):
Richard M. Stallman <rms@gnu.org>
parents:
6616
diff
changeset
|
2020 overlays_at and compute_char_face. */ |
|
6649
1305248ee38a
(note_mouse_highlight): Reject out-of-range pos value
Richard M. Stallman <rms@gnu.org>
parents:
6644
diff
changeset
|
2021 obuf = current_buffer; |
|
6626
59c44532d2a0
(construct_menu_click, construct_mouse_click):
Richard M. Stallman <rms@gnu.org>
parents:
6616
diff
changeset
|
2022 current_buffer = XBUFFER (w->buffer); |
|
59c44532d2a0
(construct_menu_click, construct_mouse_click):
Richard M. Stallman <rms@gnu.org>
parents:
6616
diff
changeset
|
2023 |
|
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2024 /* Yes. Clear the display of the old active region, if any. */ |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2025 clear_mouse_face (); |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2026 |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2027 /* Is this char mouse-active? */ |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2028 XSET (position, Lisp_Int, pos); |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2029 |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2030 len = 10; |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2031 overlay_vec = (Lisp_Object *) xmalloc (len * sizeof (Lisp_Object)); |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2032 |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2033 /* Put all the overlays we want in a vector in overlay_vec. |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2034 Store the length in len. */ |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2035 noverlays = overlays_at (XINT (pos), 1, &overlay_vec, &len, &ignor1); |
|
6626
59c44532d2a0
(construct_menu_click, construct_mouse_click):
Richard M. Stallman <rms@gnu.org>
parents:
6616
diff
changeset
|
2036 noverlays = sort_overlays (overlay_vec, noverlays, w); |
|
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2037 |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2038 /* Find the highest priority overlay that has a mouse-face prop. */ |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2039 overlay = Qnil; |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2040 for (i = 0; i < noverlays; i++) |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2041 { |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2042 mouse_face = Foverlay_get (overlay_vec[i], Qmouse_face); |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2043 if (!NILP (mouse_face)) |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2044 { |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2045 overlay = overlay_vec[i]; |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2046 break; |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2047 } |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2048 } |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2049 free (overlay_vec); |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2050 /* If no overlay applies, get a text property. */ |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2051 if (NILP (overlay)) |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2052 mouse_face = Fget_text_property (position, Qmouse_face, w->buffer); |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2053 |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2054 /* Handle the overlay case. */ |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2055 if (! NILP (overlay)) |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2056 { |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2057 /* Find the range of text around this char that |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2058 should be active. */ |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2059 Lisp_Object before, after; |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2060 int ignore; |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2061 |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2062 before = Foverlay_start (overlay); |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2063 after = Foverlay_end (overlay); |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2064 /* Record this as the current active region. */ |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2065 mouse_face_beg = XFASTINT (before); |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2066 mouse_face_end = XFASTINT (after); |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2067 mouse_face_window = window; |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2068 mouse_face_face_id = compute_char_face (f, w, pos, 0, 0, |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2069 &ignore, pos + 1, 1); |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2070 |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2071 /* Display it as active. */ |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2072 show_mouse_face (1); |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2073 } |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2074 /* Handle the text property case. */ |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2075 else if (! NILP (mouse_face)) |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2076 { |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2077 /* Find the range of text around this char that |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2078 should be active. */ |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2079 Lisp_Object before, after, beginning, end; |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2080 int ignore; |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2081 |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2082 beginning = Fmarker_position (w->start); |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2083 XSET (end, Lisp_Int, |
|
6626
59c44532d2a0
(construct_menu_click, construct_mouse_click):
Richard M. Stallman <rms@gnu.org>
parents:
6616
diff
changeset
|
2084 (BUF_Z (XBUFFER (w->buffer)) |
|
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2085 - XFASTINT (w->window_end_pos))); |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2086 before |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2087 = Fprevious_single_property_change (make_number (pos + 1), |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2088 Qmouse_face, |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2089 w->buffer, beginning); |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2090 after |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2091 = Fnext_single_property_change (position, Qmouse_face, |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2092 w->buffer, end); |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2093 /* Record this as the current active region. */ |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2094 mouse_face_beg = XFASTINT (before); |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2095 mouse_face_end = XFASTINT (after); |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2096 mouse_face_window = window; |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2097 mouse_face_face_id |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2098 = compute_char_face (f, w, pos, 0, 0, |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2099 &ignore, pos + 1, 1); |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2100 |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2101 /* Display it as active. */ |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2102 show_mouse_face (1); |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2103 } |
|
6626
59c44532d2a0
(construct_menu_click, construct_mouse_click):
Richard M. Stallman <rms@gnu.org>
parents:
6616
diff
changeset
|
2104 current_buffer = obuf; |
|
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2105 } |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2106 else if (pos <= 0) |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2107 clear_mouse_face (); |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2108 } |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2109 } |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2110 |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2111 /* Find the row and column of position POS in window WINDOW. |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2112 Store them in *COLUMNP and *ROWP. |
|
6644
8e2379ce4fcb
(fast_find_position): Always return coords within the window.
Richard M. Stallman <rms@gnu.org>
parents:
6631
diff
changeset
|
2113 This assumes display in WINDOW is up to date. |
|
8e2379ce4fcb
(fast_find_position): Always return coords within the window.
Richard M. Stallman <rms@gnu.org>
parents:
6631
diff
changeset
|
2114 If POS is above start of WINDOW, return coords |
|
8e2379ce4fcb
(fast_find_position): Always return coords within the window.
Richard M. Stallman <rms@gnu.org>
parents:
6631
diff
changeset
|
2115 of start of first screen line. |
|
8e2379ce4fcb
(fast_find_position): Always return coords within the window.
Richard M. Stallman <rms@gnu.org>
parents:
6631
diff
changeset
|
2116 If POS is after end of WINDOW, return coords of end of last screen line. */ |
|
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2117 |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2118 static int |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2119 fast_find_position (window, pos, columnp, rowp) |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2120 Lisp_Object window; |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2121 int pos; |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2122 int *columnp, *rowp; |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2123 { |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2124 struct window *w = XWINDOW (window); |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2125 FRAME_PTR f = XFRAME (WINDOW_FRAME (w)); |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2126 int i; |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2127 int row; |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2128 int left = w->left; |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2129 int top = w->top; |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2130 int height = XFASTINT (w->height) - ! MINI_WINDOW_P (w); |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2131 int width = window_internal_width (w); |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2132 int *charstarts; |
|
6644
8e2379ce4fcb
(fast_find_position): Always return coords within the window.
Richard M. Stallman <rms@gnu.org>
parents:
6631
diff
changeset
|
2133 int lastcol; |
|
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2134 |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2135 for (i = 0; |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2136 i < height; |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2137 i++) |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2138 { |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2139 int linestart = FRAME_CURRENT_GLYPHS (f)->charstarts[top + i][left]; |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2140 if (linestart > pos) |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2141 break; |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2142 if (linestart > 0) |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2143 row = i; |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2144 } |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2145 |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2146 charstarts = FRAME_CURRENT_GLYPHS (f)->charstarts[top + row]; |
|
6644
8e2379ce4fcb
(fast_find_position): Always return coords within the window.
Richard M. Stallman <rms@gnu.org>
parents:
6631
diff
changeset
|
2147 lastcol = left; |
|
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2148 for (i = 0; i < width; i++) |
|
6644
8e2379ce4fcb
(fast_find_position): Always return coords within the window.
Richard M. Stallman <rms@gnu.org>
parents:
6631
diff
changeset
|
2149 { |
|
8e2379ce4fcb
(fast_find_position): Always return coords within the window.
Richard M. Stallman <rms@gnu.org>
parents:
6631
diff
changeset
|
2150 if (charstarts[left + i] == pos) |
|
8e2379ce4fcb
(fast_find_position): Always return coords within the window.
Richard M. Stallman <rms@gnu.org>
parents:
6631
diff
changeset
|
2151 { |
|
8e2379ce4fcb
(fast_find_position): Always return coords within the window.
Richard M. Stallman <rms@gnu.org>
parents:
6631
diff
changeset
|
2152 *rowp = row + top; |
|
8e2379ce4fcb
(fast_find_position): Always return coords within the window.
Richard M. Stallman <rms@gnu.org>
parents:
6631
diff
changeset
|
2153 *columnp = i + left; |
|
8e2379ce4fcb
(fast_find_position): Always return coords within the window.
Richard M. Stallman <rms@gnu.org>
parents:
6631
diff
changeset
|
2154 return 1; |
|
8e2379ce4fcb
(fast_find_position): Always return coords within the window.
Richard M. Stallman <rms@gnu.org>
parents:
6631
diff
changeset
|
2155 } |
|
8e2379ce4fcb
(fast_find_position): Always return coords within the window.
Richard M. Stallman <rms@gnu.org>
parents:
6631
diff
changeset
|
2156 else if (charstarts[left + i] > pos) |
|
8e2379ce4fcb
(fast_find_position): Always return coords within the window.
Richard M. Stallman <rms@gnu.org>
parents:
6631
diff
changeset
|
2157 lastcol = left + i; |
|
8e2379ce4fcb
(fast_find_position): Always return coords within the window.
Richard M. Stallman <rms@gnu.org>
parents:
6631
diff
changeset
|
2158 } |
|
8e2379ce4fcb
(fast_find_position): Always return coords within the window.
Richard M. Stallman <rms@gnu.org>
parents:
6631
diff
changeset
|
2159 |
|
8e2379ce4fcb
(fast_find_position): Always return coords within the window.
Richard M. Stallman <rms@gnu.org>
parents:
6631
diff
changeset
|
2160 *rowp = row + top; |
|
8e2379ce4fcb
(fast_find_position): Always return coords within the window.
Richard M. Stallman <rms@gnu.org>
parents:
6631
diff
changeset
|
2161 *columnp = lastcol; |
|
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2162 return 0; |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2163 } |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2164 |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2165 /* Display the active region described by mouse_face_* |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2166 in its mouse-face if HL > 0, in its normal face if HL = 0. */ |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2167 |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2168 static void |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2169 show_mouse_face (hl) |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2170 int hl; |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2171 { |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2172 int begcol, begrow, endcol, endrow; |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2173 struct window *w = XWINDOW (mouse_face_window); |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2174 int width = window_internal_width (w); |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2175 FRAME_PTR f = XFRAME (WINDOW_FRAME (w)); |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2176 int i; |
|
6660
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
2177 int curs_x = f->phys_cursor_x; |
|
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
2178 int curs_y = f->phys_cursor_y; |
|
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
2179 int cursor_off = 0; |
|
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2180 |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2181 fast_find_position (mouse_face_window, mouse_face_beg, |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2182 &begcol, &begrow); |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2183 fast_find_position (mouse_face_window, mouse_face_end, |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2184 &endcol, &endrow); |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2185 |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2186 for (i = begrow; i <= endrow; i++) |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2187 { |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2188 int column = (i == begrow ? begcol : w->left); |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2189 int endcolumn = (i == endrow ? endcol : w->left + width); |
|
6660
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
2190 endcolumn = min (endcolumn, FRAME_CURRENT_GLYPHS (f)->used[i] - w->left); |
|
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
2191 |
|
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
2192 /* If the cursor's in the text we are about to rewrite, |
|
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
2193 turn the cursor off. */ |
|
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
2194 if (i == curs_y |
|
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
2195 && (curs_x >= begrow - 1 || curs_x <= endrow)) |
|
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
2196 { |
|
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
2197 x_display_cursor (f, 0); |
|
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
2198 cursor_off = 1; |
|
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
2199 } |
|
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2200 |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2201 dumpglyphs (f, |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2202 CHAR_TO_PIXEL_COL (f, column), |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2203 CHAR_TO_PIXEL_ROW (f, i), |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2204 FRAME_CURRENT_GLYPHS (f)->glyphs[i] + column, |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2205 endcolumn - column, |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2206 /* Highlight with mouse face if hl > 0. */ |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2207 hl > 0 ? 3 : 0); |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2208 } |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2209 |
|
6660
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
2210 /* If we turned the cursor off, turn it back on. */ |
|
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
2211 if (cursor_off) |
|
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
2212 x_display_cursor (f, 1); |
|
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2213 } |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2214 |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2215 /* Clear out the mouse-highlighted active region. |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2216 Redraw it unhighlighted first. */ |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2217 |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2218 static void |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2219 clear_mouse_face () |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2220 { |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2221 if (! NILP (mouse_face_window)) |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2222 show_mouse_face (0); |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2223 |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2224 mouse_face_beg = -1; |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2225 mouse_face_end = -1; |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2226 mouse_face_window = Qnil; |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2227 } |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2228 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2229 static struct scroll_bar *x_window_to_scroll_bar (); |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2230 static void x_scroll_bar_report_motion (); |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2231 |
| 429 | 2232 /* Return the current position of the mouse. |
| 2233 | |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2234 If the mouse movement started in a scroll bar, set *f, *bar_window, |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2235 and *part to the frame, window, and scroll bar part that the mouse |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2236 is over. Set *x and *y to the portion and whole of the mouse's |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2237 position on the scroll bar. |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2238 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2239 If the mouse movement started elsewhere, set *f to the frame the |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2240 mouse is on, *bar_window to nil, and *x and *y to the character cell |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2241 the mouse is over. |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2242 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2243 Set *time to the server timestamp for the time at which the mouse |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2244 was at this position. |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2245 |
|
3669
fd4187a96445
(XTmouse_position): Don't set *f at all unless we win.
Richard M. Stallman <rms@gnu.org>
parents:
3639
diff
changeset
|
2246 Don't store anything if we don't have a valid set of values to report. |
|
fd4187a96445
(XTmouse_position): Don't set *f at all unless we win.
Richard M. Stallman <rms@gnu.org>
parents:
3639
diff
changeset
|
2247 |
| 429 | 2248 This clears the mouse_moved flag, so we can wait for the next mouse |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2249 movement. This also calls XQueryPointer, which will cause the |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2250 server to give us another MotionNotify when the mouse moves |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2251 again. */ |
| 429 | 2252 |
| 2253 static void | |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2254 XTmouse_position (f, bar_window, part, x, y, time) |
|
4974
09139fb51584
(XTmouse_position): Undo roland's change.
Richard M. Stallman <rms@gnu.org>
parents:
4972
diff
changeset
|
2255 FRAME_PTR *f; |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2256 Lisp_Object *bar_window; |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2257 enum scroll_bar_part *part; |
| 429 | 2258 Lisp_Object *x, *y; |
| 732 | 2259 unsigned long *time; |
| 429 | 2260 { |
|
3669
fd4187a96445
(XTmouse_position): Don't set *f at all unless we win.
Richard M. Stallman <rms@gnu.org>
parents:
3639
diff
changeset
|
2261 FRAME_PTR f1; |
|
fd4187a96445
(XTmouse_position): Don't set *f at all unless we win.
Richard M. Stallman <rms@gnu.org>
parents:
3639
diff
changeset
|
2262 |
| 429 | 2263 BLOCK_INPUT; |
| 2264 | |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2265 if (! NILP (last_mouse_scroll_bar)) |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2266 x_scroll_bar_report_motion (f, bar_window, part, x, y, time); |
| 429 | 2267 else |
| 2268 { | |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2269 Window root; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2270 int root_x, root_y; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2271 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2272 Window dummy_window; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2273 int dummy; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2274 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2275 mouse_moved = 0; |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2276 last_mouse_scroll_bar = Qnil; |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2277 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2278 /* Figure out which root window we're on. */ |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2279 XQueryPointer (x_current_display, |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2280 DefaultRootWindow (x_current_display), |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2281 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2282 /* The root window which contains the pointer. */ |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2283 &root, |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2284 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2285 /* Trash which we can't trust if the pointer is on |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2286 a different screen. */ |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2287 &dummy_window, |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2288 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2289 /* The position on that root window. */ |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2290 &root_x, &root_y, |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2291 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2292 /* More trash we can't trust. */ |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2293 &dummy, &dummy, |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2294 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2295 /* Modifier keys and pointer buttons, about which |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2296 we don't care. */ |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2297 (unsigned int *) &dummy); |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2298 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2299 /* Now we have a position on the root; find the innermost window |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2300 containing the pointer. */ |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2301 { |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2302 Window win, child; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2303 int win_x, win_y; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2304 int parent_x, parent_y; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2305 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2306 win = root; |
|
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2307 |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2308 if (x_mouse_grabbed) |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2309 { |
|
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2310 /* If mouse was grabbed on a frame, give coords for that frame |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2311 even if the mouse is now outside it. */ |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2312 XTranslateCoordinates (x_current_display, |
|
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2313 |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2314 /* From-window, to-window. */ |
|
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2315 root, FRAME_X_WINDOW (last_mouse_frame), |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2316 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2317 /* From-position, to-position. */ |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2318 root_x, root_y, &win_x, &win_y, |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2319 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2320 /* Child of win. */ |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2321 &child); |
|
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2322 f1 = last_mouse_frame; |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2323 } |
|
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2324 else |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2325 { |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2326 while (1) |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2327 { |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2328 XTranslateCoordinates (x_current_display, |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2329 |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2330 /* From-window, to-window. */ |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2331 root, win, |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2332 |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2333 /* From-position, to-position. */ |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2334 root_x, root_y, &win_x, &win_y, |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2335 |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2336 /* Child of win. */ |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2337 &child); |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2338 |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2339 if (child == None) |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2340 break; |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2341 |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2342 win = child; |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2343 parent_x = win_x; |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2344 parent_y = win_y; |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2345 } |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2346 |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2347 /* Now we know that: |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2348 win is the innermost window containing the pointer |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2349 (XTC says it has no child containing the pointer), |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2350 win_x and win_y are the pointer's position in it |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2351 (XTC did this the last time through), and |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2352 parent_x and parent_y are the pointer's position in win's parent. |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2353 (They are what win_x and win_y were when win was child. |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2354 If win is the root window, it has no parent, and |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2355 parent_{x,y} are invalid, but that's okay, because we'll |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2356 never use them in that case.) */ |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2357 |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2358 /* Is win one of our frames? */ |
|
6055
a9f61727a90c
(construct_mouse_click): Don't convert to glyph units.
Richard M. Stallman <rms@gnu.org>
parents:
6023
diff
changeset
|
2359 f1 = x_any_window_to_frame (win); |
|
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2360 } |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2361 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2362 /* If not, is it one of our scroll bars? */ |
|
3669
fd4187a96445
(XTmouse_position): Don't set *f at all unless we win.
Richard M. Stallman <rms@gnu.org>
parents:
3639
diff
changeset
|
2363 if (! f1) |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2364 { |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2365 struct scroll_bar *bar = x_window_to_scroll_bar (win); |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2366 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2367 if (bar) |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2368 { |
|
3669
fd4187a96445
(XTmouse_position): Don't set *f at all unless we win.
Richard M. Stallman <rms@gnu.org>
parents:
3639
diff
changeset
|
2369 f1 = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2370 win_x = parent_x; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2371 win_y = parent_y; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2372 } |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2373 } |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2374 |
|
3669
fd4187a96445
(XTmouse_position): Don't set *f at all unless we win.
Richard M. Stallman <rms@gnu.org>
parents:
3639
diff
changeset
|
2375 if (f1) |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2376 { |
|
6055
a9f61727a90c
(construct_mouse_click): Don't convert to glyph units.
Richard M. Stallman <rms@gnu.org>
parents:
6023
diff
changeset
|
2377 int ignore1, ignore2; |
|
a9f61727a90c
(construct_mouse_click): Don't convert to glyph units.
Richard M. Stallman <rms@gnu.org>
parents:
6023
diff
changeset
|
2378 |
|
a9f61727a90c
(construct_mouse_click): Don't convert to glyph units.
Richard M. Stallman <rms@gnu.org>
parents:
6023
diff
changeset
|
2379 /* Ok, we found a frame. Store all the values. */ |
|
a9f61727a90c
(construct_mouse_click): Don't convert to glyph units.
Richard M. Stallman <rms@gnu.org>
parents:
6023
diff
changeset
|
2380 |
|
a9f61727a90c
(construct_mouse_click): Don't convert to glyph units.
Richard M. Stallman <rms@gnu.org>
parents:
6023
diff
changeset
|
2381 pixel_to_glyph_coords (f1, win_x, win_y, &ignore1, &ignore2, |
|
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2382 &last_mouse_glyph, x_mouse_grabbed); |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2383 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2384 *bar_window = Qnil; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2385 *part = 0; |
|
3669
fd4187a96445
(XTmouse_position): Don't set *f at all unless we win.
Richard M. Stallman <rms@gnu.org>
parents:
3639
diff
changeset
|
2386 *f = f1; |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2387 XSET (*x, Lisp_Int, win_x); |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2388 XSET (*y, Lisp_Int, win_y); |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2389 *time = last_mouse_movement_time; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2390 } |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2391 } |
| 429 | 2392 } |
| 2393 | |
| 2394 UNBLOCK_INPUT; | |
| 2395 } | |
| 2396 | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
2397 #else /* ! defined (HAVE_X11) */ |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
2398 #define XEvent XKeyPressedEvent |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
2399 #endif /* ! defined (HAVE_X11) */ |
| 429 | 2400 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2401 /* Scroll bar support. */ |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2402 |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2403 /* Given an X window ID, find the struct scroll_bar which manages it. |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2404 This can be called in GC, so we have to make sure to strip off mark |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2405 bits. */ |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2406 static struct scroll_bar * |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2407 x_window_to_scroll_bar (window_id) |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2408 Window window_id; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2409 { |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2410 Lisp_Object tail, frame; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2411 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2412 for (tail = Vframe_list; |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2413 XGCTYPE (tail) == Lisp_Cons; |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2414 tail = XCONS (tail)->cdr) |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2415 { |
|
6521
a975c5944916
(x_window_to_scroll_bar, x_new_font): Use assignment, not initialization.
Karl Heuer <kwzh@gnu.org>
parents:
6413
diff
changeset
|
2416 Lisp_Object frame, bar, condemned; |
|
a975c5944916
(x_window_to_scroll_bar, x_new_font): Use assignment, not initialization.
Karl Heuer <kwzh@gnu.org>
parents:
6413
diff
changeset
|
2417 |
|
a975c5944916
(x_window_to_scroll_bar, x_new_font): Use assignment, not initialization.
Karl Heuer <kwzh@gnu.org>
parents:
6413
diff
changeset
|
2418 frame = XCONS (tail)->car; |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2419 /* All elements of Vframe_list should be frames. */ |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2420 if (XGCTYPE (frame) != Lisp_Frame) |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2421 abort (); |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2422 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2423 /* Scan this frame's scroll bar list for a scroll bar with the |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2424 right window ID. */ |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2425 condemned = FRAME_CONDEMNED_SCROLL_BARS (XFRAME (frame)); |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2426 for (bar = FRAME_SCROLL_BARS (XFRAME (frame)); |
|
1803
5752a95053f2
* xterm.c (x_window_to_scrollbar): Search frames'
Jim Blandy <jimb@redhat.com>
parents:
1793
diff
changeset
|
2427 /* This trick allows us to search both the ordinary and |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2428 condemned scroll bar lists with one loop. */ |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2429 ! GC_NILP (bar) || (bar = condemned, |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2430 condemned = Qnil, |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2431 ! GC_NILP (bar)); |
|
5825
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
2432 bar = XSCROLL_BAR (bar)->next) |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2433 if (SCROLL_BAR_X_WINDOW (XSCROLL_BAR (bar)) == window_id) |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2434 return XSCROLL_BAR (bar); |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2435 } |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2436 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2437 return 0; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2438 } |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2439 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2440 /* Open a new X window to serve as a scroll bar, and return the |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2441 scroll bar vector for it. */ |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2442 static struct scroll_bar * |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2443 x_scroll_bar_create (window, top, left, width, height) |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2444 struct window *window; |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2445 int top, left, width, height; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2446 { |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2447 FRAME_PTR frame = XFRAME (WINDOW_FRAME (window)); |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2448 struct scroll_bar *bar = |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2449 XSCROLL_BAR (Fmake_vector (make_number (SCROLL_BAR_VEC_SIZE), Qnil)); |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2450 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2451 BLOCK_INPUT; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2452 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2453 { |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2454 XSetWindowAttributes a; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2455 unsigned long mask; |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2456 a.background_pixel = frame->display.x->background_pixel; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2457 a.event_mask = (ButtonPressMask | ButtonReleaseMask |
|
1793
cf4c3f01ddb9
* xterm.c (x_scrollbar_create): Include PointerMotionHintMask in
Jim Blandy <jimb@redhat.com>
parents:
1787
diff
changeset
|
2458 | ButtonMotionMask | PointerMotionHintMask |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2459 | ExposureMask); |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2460 a.cursor = x_vertical_scroll_bar_cursor; |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
2461 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
2462 mask = (CWBackPixel | CWEventMask | CWCursor); |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2463 |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
2464 #if 0 |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
2465 |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
2466 ac = 0; |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
2467 XtSetArg (al[ac], XtNx, left); ac++; |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
2468 XtSetArg (al[ac], XtNy, top); ac++; |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
2469 XtSetArg (al[ac], XtNwidth, width); ac++; |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
2470 XtSetArg (al[ac], XtNheight, height); ac++; |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
2471 XtSetArg (al[ac], XtNborderWidth, 0); ac++; |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
2472 sb_widget = XtCreateManagedWidget ("box", |
|
5916
4e827db2523a
(x_scroll_bar_create): Fix indentation.
Karl Heuer <kwzh@gnu.org>
parents:
5898
diff
changeset
|
2473 boxWidgetClass, |
|
4e827db2523a
(x_scroll_bar_create): Fix indentation.
Karl Heuer <kwzh@gnu.org>
parents:
5898
diff
changeset
|
2474 frame->display.x->edit_widget, al, ac); |
|
4e827db2523a
(x_scroll_bar_create): Fix indentation.
Karl Heuer <kwzh@gnu.org>
parents:
5898
diff
changeset
|
2475 SET_SCROLL_BAR_X_WINDOW |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
2476 (bar, sb_widget->core.window); |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
2477 #endif |
|
5916
4e827db2523a
(x_scroll_bar_create): Fix indentation.
Karl Heuer <kwzh@gnu.org>
parents:
5898
diff
changeset
|
2478 SET_SCROLL_BAR_X_WINDOW |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2479 (bar, |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2480 XCreateWindow (x_current_display, FRAME_X_WINDOW (frame), |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2481 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2482 /* Position and size of scroll bar. */ |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2483 left, top, width, height, |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2484 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2485 /* Border width, depth, class, and visual. */ |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2486 0, CopyFromParent, CopyFromParent, CopyFromParent, |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2487 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2488 /* Attributes. */ |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2489 mask, &a)); |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2490 } |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2491 |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2492 XSET (bar->window, Lisp_Window, window); |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2493 XSET (bar->top, Lisp_Int, top); |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2494 XSET (bar->left, Lisp_Int, left); |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2495 XSET (bar->width, Lisp_Int, width); |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2496 XSET (bar->height, Lisp_Int, height); |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2497 XSET (bar->start, Lisp_Int, 0); |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2498 XSET (bar->end, Lisp_Int, 0); |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2499 bar->dragging = Qnil; |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2500 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2501 /* Add bar to its frame's list of scroll bars. */ |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2502 bar->next = FRAME_SCROLL_BARS (frame); |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2503 bar->prev = Qnil; |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2504 XSET (FRAME_SCROLL_BARS (frame), Lisp_Vector, bar); |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2505 if (! NILP (bar->next)) |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2506 XSET (XSCROLL_BAR (bar->next)->prev, Lisp_Vector, bar); |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2507 |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2508 XMapWindow (x_current_display, SCROLL_BAR_X_WINDOW (bar)); |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2509 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2510 UNBLOCK_INPUT; |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2511 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2512 return bar; |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2513 } |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2514 |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2515 /* Draw BAR's handle in the proper position. |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2516 If the handle is already drawn from START to END, don't bother |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2517 redrawing it, unless REBUILD is non-zero; in that case, always |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2518 redraw it. (REBUILD is handy for drawing the handle after expose |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2519 events.) |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2520 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2521 Normally, we want to constrain the start and end of the handle to |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2522 fit inside its rectangle, but if the user is dragging the scroll bar |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2523 handle, we want to let them drag it down all the way, so that the |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2524 bar's top is as far down as it goes; otherwise, there's no way to |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2525 move to the very end of the buffer. */ |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2526 static void |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2527 x_scroll_bar_set_handle (bar, start, end, rebuild) |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2528 struct scroll_bar *bar; |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2529 int start, end; |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2530 int rebuild; |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2531 { |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2532 int dragging = ! NILP (bar->dragging); |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2533 Window w = SCROLL_BAR_X_WINDOW (bar); |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2534 GC gc = XFRAME (WINDOW_FRAME (XWINDOW (bar->window)))->display.x->normal_gc; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2535 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2536 /* If the display is already accurate, do nothing. */ |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2537 if (! rebuild |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2538 && start == XINT (bar->start) |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2539 && end == XINT (bar->end)) |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2540 return; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2541 |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2542 BLOCK_INPUT; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2543 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2544 { |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2545 int inside_width = VERTICAL_SCROLL_BAR_INSIDE_WIDTH (XINT (bar->width)); |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2546 int inside_height = VERTICAL_SCROLL_BAR_INSIDE_HEIGHT (XINT (bar->height)); |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2547 int top_range = VERTICAL_SCROLL_BAR_TOP_RANGE (XINT (bar->height)); |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2548 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2549 /* Make sure the values are reasonable, and try to preserve |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2550 the distance between start and end. */ |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2551 { |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2552 int length = end - start; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2553 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2554 if (start < 0) |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2555 start = 0; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2556 else if (start > top_range) |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2557 start = top_range; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2558 end = start + length; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2559 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2560 if (end < start) |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2561 end = start; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2562 else if (end > top_range && ! dragging) |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2563 end = top_range; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2564 } |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2565 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2566 /* Store the adjusted setting in the scroll bar. */ |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2567 XSET (bar->start, Lisp_Int, start); |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2568 XSET (bar->end, Lisp_Int, end); |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2569 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2570 /* Clip the end position, just for display. */ |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2571 if (end > top_range) |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2572 end = top_range; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2573 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2574 /* Draw bottom positions VERTICAL_SCROLL_BAR_MIN_HANDLE pixels |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2575 below top positions, to make sure the handle is always at least |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2576 that many pixels tall. */ |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2577 end += VERTICAL_SCROLL_BAR_MIN_HANDLE; |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2578 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2579 /* Draw the empty space above the handle. Note that we can't clear |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2580 zero-height areas; that means "clear to end of window." */ |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2581 if (0 < start) |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2582 XClearArea (x_current_display, w, |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2583 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2584 /* x, y, width, height, and exposures. */ |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2585 VERTICAL_SCROLL_BAR_LEFT_BORDER, |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2586 VERTICAL_SCROLL_BAR_TOP_BORDER, |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2587 inside_width, start, |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2588 False); |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2589 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2590 /* Draw the handle itself. */ |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2591 XFillRectangle (x_current_display, w, gc, |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2592 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2593 /* x, y, width, height */ |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2594 VERTICAL_SCROLL_BAR_LEFT_BORDER, |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2595 VERTICAL_SCROLL_BAR_TOP_BORDER + start, |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2596 inside_width, end - start); |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2597 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2598 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2599 /* Draw the empty space below the handle. Note that we can't |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2600 clear zero-height areas; that means "clear to end of window." */ |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2601 if (end < inside_height) |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2602 XClearArea (x_current_display, w, |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2603 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2604 /* x, y, width, height, and exposures. */ |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2605 VERTICAL_SCROLL_BAR_LEFT_BORDER, |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2606 VERTICAL_SCROLL_BAR_TOP_BORDER + end, |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2607 inside_width, inside_height - end, |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2608 False); |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2609 |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2610 } |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2611 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2612 UNBLOCK_INPUT; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2613 } |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2614 |
|
3591
507f64624555
Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents:
3585
diff
changeset
|
2615 /* Move a scroll bar around on the screen, to accommodate changing |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2616 window configurations. */ |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2617 static void |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2618 x_scroll_bar_move (bar, top, left, width, height) |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2619 struct scroll_bar *bar; |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2620 int top, left, width, height; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2621 { |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2622 BLOCK_INPUT; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2623 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2624 { |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2625 XWindowChanges wc; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2626 unsigned int mask = 0; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2627 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2628 wc.x = left; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2629 wc.y = top; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2630 wc.width = width; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2631 wc.height = height; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2632 |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2633 if (left != XINT (bar->left)) mask |= CWX; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2634 if (top != XINT (bar->top)) mask |= CWY; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2635 if (width != XINT (bar->width)) mask |= CWWidth; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2636 if (height != XINT (bar->height)) mask |= CWHeight; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2637 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2638 if (mask) |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2639 XConfigureWindow (x_current_display, SCROLL_BAR_X_WINDOW (bar), |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2640 mask, &wc); |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2641 } |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2642 |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2643 XSET (bar->left, Lisp_Int, left); |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2644 XSET (bar->top, Lisp_Int, top); |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2645 XSET (bar->width, Lisp_Int, width); |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2646 XSET (bar->height, Lisp_Int, height); |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2647 |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2648 UNBLOCK_INPUT; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2649 } |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2650 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2651 /* Destroy the X window for BAR, and set its Emacs window's scroll bar |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2652 to nil. */ |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2653 static void |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2654 x_scroll_bar_remove (bar) |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2655 struct scroll_bar *bar; |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2656 { |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2657 FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2658 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2659 BLOCK_INPUT; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2660 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2661 /* Destroy the window. */ |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2662 XDestroyWindow (x_current_display, SCROLL_BAR_X_WINDOW (bar)); |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2663 |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2664 /* Disassociate this scroll bar from its window. */ |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2665 XWINDOW (bar->window)->vertical_scroll_bar = Qnil; |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2666 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2667 UNBLOCK_INPUT; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2668 } |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2669 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2670 /* Set the handle of the vertical scroll bar for WINDOW to indicate |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2671 that we are displaying PORTION characters out of a total of WHOLE |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2672 characters, starting at POSITION. If WINDOW has no scroll bar, |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2673 create one. */ |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2674 static void |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2675 XTset_vertical_scroll_bar (window, portion, whole, position) |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2676 struct window *window; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2677 int portion, whole, position; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2678 { |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2679 FRAME_PTR f = XFRAME (WINDOW_FRAME (window)); |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2680 int top = XINT (window->top); |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2681 int left = WINDOW_VERTICAL_SCROLL_BAR_COLUMN (window); |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2682 int height = WINDOW_VERTICAL_SCROLL_BAR_HEIGHT (window); |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2683 |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2684 /* Where should this scroll bar be, pixelwise? */ |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2685 int pixel_top = CHAR_TO_PIXEL_ROW (f, top); |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2686 int pixel_left = CHAR_TO_PIXEL_COL (f, left); |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2687 int pixel_width = VERTICAL_SCROLL_BAR_PIXEL_WIDTH (f); |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2688 int pixel_height = VERTICAL_SCROLL_BAR_PIXEL_HEIGHT (f, height); |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2689 |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2690 struct scroll_bar *bar; |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2691 |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2692 /* Does the scroll bar exist yet? */ |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2693 if (NILP (window->vertical_scroll_bar)) |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2694 bar = x_scroll_bar_create (window, |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2695 pixel_top, pixel_left, |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2696 pixel_width, pixel_height); |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2697 else |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2698 { |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2699 /* It may just need to be moved and resized. */ |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2700 bar = XSCROLL_BAR (window->vertical_scroll_bar); |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2701 x_scroll_bar_move (bar, pixel_top, pixel_left, pixel_width, pixel_height); |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2702 } |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2703 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2704 /* Set the scroll bar's current state, unless we're currently being |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2705 dragged. */ |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2706 if (NILP (bar->dragging)) |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2707 { |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2708 int top_range = |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2709 VERTICAL_SCROLL_BAR_TOP_RANGE (pixel_height); |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2710 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2711 if (whole == 0) |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2712 x_scroll_bar_set_handle (bar, 0, top_range, 0); |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2713 else |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2714 { |
|
3686
910ea1d66bfd
* xterm.c (XTset_vertical_scroll_bar): Use double type for
Jim Blandy <jimb@redhat.com>
parents:
3683
diff
changeset
|
2715 int start = ((double) position * top_range) / whole; |
|
910ea1d66bfd
* xterm.c (XTset_vertical_scroll_bar): Use double type for
Jim Blandy <jimb@redhat.com>
parents:
3683
diff
changeset
|
2716 int end = ((double) (position + portion) * top_range) / whole; |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2717 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2718 x_scroll_bar_set_handle (bar, start, end, 0); |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2719 } |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2720 } |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2721 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2722 XSET (window->vertical_scroll_bar, Lisp_Vector, bar); |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2723 } |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2724 |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2725 |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2726 /* The following three hooks are used when we're doing a thorough |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2727 redisplay of the frame. We don't explicitly know which scroll bars |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2728 are going to be deleted, because keeping track of when windows go |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2729 away is a real pain - "Can you say set-window-configuration, boys |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2730 and girls?" Instead, we just assert at the beginning of redisplay |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2731 that *all* scroll bars are to be removed, and then save a scroll bar |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2732 from the fiery pit when we actually redisplay its window. */ |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2733 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2734 /* Arrange for all scroll bars on FRAME to be removed at the next call |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2735 to `*judge_scroll_bars_hook'. A scroll bar may be spared if |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2736 `*redeem_scroll_bar_hook' is applied to its window before the judgement. */ |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2737 static void |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2738 XTcondemn_scroll_bars (frame) |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2739 FRAME_PTR frame; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2740 { |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2741 /* The condemned list should be empty at this point; if it's not, |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2742 then the rest of Emacs isn't using the condemn/redeem/judge |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2743 protocol correctly. */ |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2744 if (! NILP (FRAME_CONDEMNED_SCROLL_BARS (frame))) |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2745 abort (); |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2746 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2747 /* Move them all to the "condemned" list. */ |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2748 FRAME_CONDEMNED_SCROLL_BARS (frame) = FRAME_SCROLL_BARS (frame); |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2749 FRAME_SCROLL_BARS (frame) = Qnil; |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2750 } |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2751 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2752 /* Unmark WINDOW's scroll bar for deletion in this judgement cycle. |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2753 Note that WINDOW isn't necessarily condemned at all. */ |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2754 static void |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2755 XTredeem_scroll_bar (window) |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2756 struct window *window; |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2757 { |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2758 struct scroll_bar *bar; |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2759 |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2760 /* We can't redeem this window's scroll bar if it doesn't have one. */ |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2761 if (NILP (window->vertical_scroll_bar)) |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2762 abort (); |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2763 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2764 bar = XSCROLL_BAR (window->vertical_scroll_bar); |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2765 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2766 /* Unlink it from the condemned list. */ |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2767 { |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2768 FRAME_PTR f = XFRAME (WINDOW_FRAME (window)); |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2769 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2770 if (NILP (bar->prev)) |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2771 { |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2772 /* If the prev pointer is nil, it must be the first in one of |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2773 the lists. */ |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2774 if (EQ (FRAME_SCROLL_BARS (f), window->vertical_scroll_bar)) |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2775 /* It's not condemned. Everything's fine. */ |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2776 return; |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2777 else if (EQ (FRAME_CONDEMNED_SCROLL_BARS (f), |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2778 window->vertical_scroll_bar)) |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2779 FRAME_CONDEMNED_SCROLL_BARS (f) = bar->next; |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2780 else |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2781 /* If its prev pointer is nil, it must be at the front of |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2782 one or the other! */ |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2783 abort (); |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2784 } |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2785 else |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2786 XSCROLL_BAR (bar->prev)->next = bar->next; |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2787 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2788 if (! NILP (bar->next)) |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2789 XSCROLL_BAR (bar->next)->prev = bar->prev; |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2790 |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2791 bar->next = FRAME_SCROLL_BARS (f); |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2792 bar->prev = Qnil; |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2793 XSET (FRAME_SCROLL_BARS (f), Lisp_Vector, bar); |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2794 if (! NILP (bar->next)) |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2795 XSET (XSCROLL_BAR (bar->next)->prev, Lisp_Vector, bar); |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2796 } |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2797 } |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2798 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2799 /* Remove all scroll bars on FRAME that haven't been saved since the |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2800 last call to `*condemn_scroll_bars_hook'. */ |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2801 static void |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2802 XTjudge_scroll_bars (f) |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2803 FRAME_PTR f; |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2804 { |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2805 Lisp_Object bar, next; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2806 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2807 bar = FRAME_CONDEMNED_SCROLL_BARS (f); |
|
1803
5752a95053f2
* xterm.c (x_window_to_scrollbar): Search frames'
Jim Blandy <jimb@redhat.com>
parents:
1793
diff
changeset
|
2808 |
|
5752a95053f2
* xterm.c (x_window_to_scrollbar): Search frames'
Jim Blandy <jimb@redhat.com>
parents:
1793
diff
changeset
|
2809 /* Clear out the condemned list now so we won't try to process any |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2810 more events on the hapless scroll bars. */ |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2811 FRAME_CONDEMNED_SCROLL_BARS (f) = Qnil; |
|
1803
5752a95053f2
* xterm.c (x_window_to_scrollbar): Search frames'
Jim Blandy <jimb@redhat.com>
parents:
1793
diff
changeset
|
2812 |
|
5752a95053f2
* xterm.c (x_window_to_scrollbar): Search frames'
Jim Blandy <jimb@redhat.com>
parents:
1793
diff
changeset
|
2813 for (; ! NILP (bar); bar = next) |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2814 { |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2815 struct scroll_bar *b = XSCROLL_BAR (bar); |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2816 |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2817 x_scroll_bar_remove (b); |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2818 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2819 next = b->next; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2820 b->next = b->prev = Qnil; |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2821 } |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2822 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2823 /* Now there should be no references to the condemned scroll bars, |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2824 and they should get garbage-collected. */ |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2825 } |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2826 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2827 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2828 /* Handle an Expose or GraphicsExpose event on a scroll bar. |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2829 |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2830 This may be called from a signal handler, so we have to ignore GC |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2831 mark bits. */ |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2832 static void |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2833 x_scroll_bar_expose (bar, event) |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2834 struct scroll_bar *bar; |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2835 XEvent *event; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2836 { |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2837 Window w = SCROLL_BAR_X_WINDOW (bar); |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2838 GC gc = XFRAME (WINDOW_FRAME (XWINDOW (bar->window)))->display.x->normal_gc; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2839 |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2840 BLOCK_INPUT; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2841 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2842 x_scroll_bar_set_handle (bar, XINT (bar->start), XINT (bar->end), 1); |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2843 |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2844 /* Draw a one-pixel border just inside the edges of the scroll bar. */ |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2845 XDrawRectangle (x_current_display, w, gc, |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2846 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2847 /* x, y, width, height */ |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2848 0, 0, XINT (bar->width) - 1, XINT (bar->height) - 1); |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2849 |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2850 UNBLOCK_INPUT; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2851 } |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2852 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2853 /* Handle a mouse click on the scroll bar BAR. If *EMACS_EVENT's kind |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2854 is set to something other than no_event, it is enqueued. |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2855 |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2856 This may be called from a signal handler, so we have to ignore GC |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2857 mark bits. */ |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2858 static void |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2859 x_scroll_bar_handle_click (bar, event, emacs_event) |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2860 struct scroll_bar *bar; |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2861 XEvent *event; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2862 struct input_event *emacs_event; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2863 { |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2864 if (XGCTYPE (bar->window) != Lisp_Window) |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2865 abort (); |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2866 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2867 emacs_event->kind = scroll_bar_click; |
|
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2868 emacs_event->code = event->xbutton.button - Button1; |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2869 emacs_event->modifiers = |
|
2661
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
2870 (x_x_to_emacs_modifiers (event->xbutton.state) |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2871 | (event->type == ButtonRelease |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2872 ? up_modifier |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2873 : down_modifier)); |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2874 emacs_event->frame_or_window = bar->window; |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2875 emacs_event->timestamp = event->xbutton.time; |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2876 { |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2877 int internal_height = |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2878 VERTICAL_SCROLL_BAR_INSIDE_HEIGHT (XINT (bar->height)); |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2879 int top_range = |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2880 VERTICAL_SCROLL_BAR_TOP_RANGE (XINT (bar->height)); |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2881 int y = event->xbutton.y - VERTICAL_SCROLL_BAR_TOP_BORDER; |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2882 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2883 if (y < 0) y = 0; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2884 if (y > top_range) y = top_range; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2885 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2886 if (y < XINT (bar->start)) |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2887 emacs_event->part = scroll_bar_above_handle; |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2888 else if (y < XINT (bar->end) + VERTICAL_SCROLL_BAR_MIN_HANDLE) |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2889 emacs_event->part = scroll_bar_handle; |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2890 else |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2891 emacs_event->part = scroll_bar_below_handle; |
|
2953
5440f00480e6
* xterm.c (x_scroll_bar_handle_click): Never grab the scroll bar;
Jim Blandy <jimb@redhat.com>
parents:
2923
diff
changeset
|
2892 |
|
5440f00480e6
* xterm.c (x_scroll_bar_handle_click): Never grab the scroll bar;
Jim Blandy <jimb@redhat.com>
parents:
2923
diff
changeset
|
2893 /* Just because the user has clicked on the handle doesn't mean |
|
2958
3124e6244d1a
* xterm.c (x_scroll_bar_handle_click): Never grab the scroll bar;
Jim Blandy <jimb@redhat.com>
parents:
2953
diff
changeset
|
2894 they want to drag it. Lisp code needs to be able to decide |
|
3124e6244d1a
* xterm.c (x_scroll_bar_handle_click): Never grab the scroll bar;
Jim Blandy <jimb@redhat.com>
parents:
2953
diff
changeset
|
2895 whether or not we're dragging. */ |
|
2953
5440f00480e6
* xterm.c (x_scroll_bar_handle_click): Never grab the scroll bar;
Jim Blandy <jimb@redhat.com>
parents:
2923
diff
changeset
|
2896 #if 0 |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2897 /* If the user has just clicked on the handle, record where they're |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2898 holding it. */ |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2899 if (event->type == ButtonPress |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2900 && emacs_event->part == scroll_bar_handle) |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2901 XSET (bar->dragging, Lisp_Int, y - XINT (bar->start)); |
|
2953
5440f00480e6
* xterm.c (x_scroll_bar_handle_click): Never grab the scroll bar;
Jim Blandy <jimb@redhat.com>
parents:
2923
diff
changeset
|
2902 #endif |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2903 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2904 /* If the user has released the handle, set it to its final position. */ |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2905 if (event->type == ButtonRelease |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2906 && ! NILP (bar->dragging)) |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2907 { |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2908 int new_start = y - XINT (bar->dragging); |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2909 int new_end = new_start + (XINT (bar->end) - XINT (bar->start)); |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2910 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2911 x_scroll_bar_set_handle (bar, new_start, new_end, 0); |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2912 bar->dragging = Qnil; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2913 } |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2914 |
|
2958
3124e6244d1a
* xterm.c (x_scroll_bar_handle_click): Never grab the scroll bar;
Jim Blandy <jimb@redhat.com>
parents:
2953
diff
changeset
|
2915 /* Same deal here as the other #if 0. */ |
|
3124e6244d1a
* xterm.c (x_scroll_bar_handle_click): Never grab the scroll bar;
Jim Blandy <jimb@redhat.com>
parents:
2953
diff
changeset
|
2916 #if 0 |
|
3591
507f64624555
Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents:
3585
diff
changeset
|
2917 /* Clicks on the handle are always reported as occurring at the top of |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2918 the handle. */ |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2919 if (emacs_event->part == scroll_bar_handle) |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2920 emacs_event->x = bar->start; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2921 else |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2922 XSET (emacs_event->x, Lisp_Int, y); |
|
2958
3124e6244d1a
* xterm.c (x_scroll_bar_handle_click): Never grab the scroll bar;
Jim Blandy <jimb@redhat.com>
parents:
2953
diff
changeset
|
2923 #else |
|
3124e6244d1a
* xterm.c (x_scroll_bar_handle_click): Never grab the scroll bar;
Jim Blandy <jimb@redhat.com>
parents:
2953
diff
changeset
|
2924 XSET (emacs_event->x, Lisp_Int, y); |
|
3124e6244d1a
* xterm.c (x_scroll_bar_handle_click): Never grab the scroll bar;
Jim Blandy <jimb@redhat.com>
parents:
2953
diff
changeset
|
2925 #endif |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2926 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2927 XSET (emacs_event->y, Lisp_Int, top_range); |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2928 } |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2929 } |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2930 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2931 /* Handle some mouse motion while someone is dragging the scroll bar. |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2932 |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2933 This may be called from a signal handler, so we have to ignore GC |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2934 mark bits. */ |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2935 static void |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2936 x_scroll_bar_note_movement (bar, event) |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2937 struct scroll_bar *bar; |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2938 XEvent *event; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2939 { |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2940 last_mouse_movement_time = event->xmotion.time; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2941 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2942 mouse_moved = 1; |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2943 XSET (last_mouse_scroll_bar, Lisp_Vector, bar); |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2944 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2945 /* If we're dragging the bar, display it. */ |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2946 if (! GC_NILP (bar->dragging)) |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2947 { |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2948 /* Where should the handle be now? */ |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2949 int new_start = event->xmotion.y - XINT (bar->dragging); |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2950 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2951 if (new_start != XINT (bar->start)) |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2952 { |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2953 int new_end = new_start + (XINT (bar->end) - XINT (bar->start)); |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2954 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2955 x_scroll_bar_set_handle (bar, new_start, new_end, 0); |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2956 } |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2957 } |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2958 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2959 /* Call XQueryPointer so we'll get an event the next time the mouse |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2960 moves and we can see *still* on the same position. */ |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2961 { |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2962 int dummy; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2963 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2964 XQueryPointer (event->xmotion.display, event->xmotion.window, |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2965 (Window *) &dummy, (Window *) &dummy, |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2966 &dummy, &dummy, &dummy, &dummy, |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2967 (unsigned int *) &dummy); |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2968 } |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2969 } |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2970 |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2971 /* Return information to the user about the current position of the mouse |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2972 on the scroll bar. */ |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2973 static void |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2974 x_scroll_bar_report_motion (f, bar_window, part, x, y, time) |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2975 FRAME_PTR *f; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2976 Lisp_Object *bar_window; |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2977 enum scroll_bar_part *part; |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2978 Lisp_Object *x, *y; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2979 unsigned long *time; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2980 { |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2981 struct scroll_bar *bar = XSCROLL_BAR (last_mouse_scroll_bar); |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2982 int win_x, win_y; |
|
2982
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
2983 Window dummy_window; |
|
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
2984 int dummy_coord; |
|
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
2985 unsigned int dummy_mask; |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2986 |
|
1803
5752a95053f2
* xterm.c (x_window_to_scrollbar): Search frames'
Jim Blandy <jimb@redhat.com>
parents:
1793
diff
changeset
|
2987 BLOCK_INPUT; |
|
5752a95053f2
* xterm.c (x_window_to_scrollbar): Search frames'
Jim Blandy <jimb@redhat.com>
parents:
1793
diff
changeset
|
2988 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2989 /* Get the mouse's position relative to the scroll bar window, and |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2990 report that. */ |
|
2982
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
2991 if (! XQueryPointer (x_current_display, |
|
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
2992 SCROLL_BAR_X_WINDOW (bar), |
|
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
2993 |
|
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
2994 /* Root, child, root x and root y. */ |
|
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
2995 &dummy_window, &dummy_window, |
|
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
2996 &dummy_coord, &dummy_coord, |
|
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
2997 |
|
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
2998 /* Position relative to scroll bar. */ |
|
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
2999 &win_x, &win_y, |
|
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3000 |
|
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3001 /* Mouse buttons and modifier keys. */ |
|
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3002 &dummy_mask)) |
|
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3003 *f = 0; |
|
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3004 else |
|
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3005 { |
|
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3006 int inside_height |
|
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3007 = VERTICAL_SCROLL_BAR_INSIDE_HEIGHT (XINT (bar->height)); |
|
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3008 int top_range |
|
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3009 = VERTICAL_SCROLL_BAR_TOP_RANGE (XINT (bar->height)); |
|
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3010 |
|
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3011 win_y -= VERTICAL_SCROLL_BAR_TOP_BORDER; |
|
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3012 |
|
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3013 if (! NILP (bar->dragging)) |
|
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3014 win_y -= XINT (bar->dragging); |
|
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3015 |
|
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3016 if (win_y < 0) |
|
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3017 win_y = 0; |
|
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3018 if (win_y > top_range) |
|
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3019 win_y = top_range; |
|
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3020 |
|
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3021 *f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); |
|
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3022 *bar_window = bar->window; |
|
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3023 |
|
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3024 if (! NILP (bar->dragging)) |
|
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3025 *part = scroll_bar_handle; |
|
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3026 else if (win_y < XINT (bar->start)) |
|
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3027 *part = scroll_bar_above_handle; |
|
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3028 else if (win_y < XINT (bar->end) + VERTICAL_SCROLL_BAR_MIN_HANDLE) |
|
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3029 *part = scroll_bar_handle; |
|
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3030 else |
|
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3031 *part = scroll_bar_below_handle; |
|
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3032 |
|
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3033 XSET (*x, Lisp_Int, win_y); |
|
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3034 XSET (*y, Lisp_Int, top_range); |
|
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3035 |
|
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3036 mouse_moved = 0; |
|
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3037 last_mouse_scroll_bar = Qnil; |
|
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3038 } |
|
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3039 |
|
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3040 *time = last_mouse_movement_time; |
|
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3041 |
|
1803
5752a95053f2
* xterm.c (x_window_to_scrollbar): Search frames'
Jim Blandy <jimb@redhat.com>
parents:
1793
diff
changeset
|
3042 UNBLOCK_INPUT; |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
3043 } |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
3044 |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3045 |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3046 /* The screen has been cleared so we may have changed foreground or |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3047 background colors, and the scroll bars may need to be redrawn. |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3048 Clear out the scroll bars, and ask for expose events, so we can |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3049 redraw them. */ |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3050 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3051 x_scroll_bar_clear (f) |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3052 FRAME_PTR f; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3053 { |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3054 Lisp_Object bar; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3055 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3056 for (bar = FRAME_SCROLL_BARS (f); |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3057 XTYPE (bar) == Lisp_Vector; |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3058 bar = XSCROLL_BAR (bar)->next) |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3059 XClearArea (x_current_display, SCROLL_BAR_X_WINDOW (XSCROLL_BAR (bar)), |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3060 0, 0, 0, 0, True); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3061 } |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3062 |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3063 /* This processes Expose events from the menubar specific X event |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3064 loop in menubar.c. This allows to redisplay the frame if necessary |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3065 when handling menubar or popup items. */ |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3066 |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3067 void |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3068 process_expose_from_menu (event) |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3069 XEvent event; |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3070 { |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3071 FRAME_PTR f; |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3072 |
|
5872
6389c826f847
(x_display_cursor, process_expose_from_menu): Block input.
Karl Heuer <kwzh@gnu.org>
parents:
5825
diff
changeset
|
3073 BLOCK_INPUT; |
|
6389c826f847
(x_display_cursor, process_expose_from_menu): Block input.
Karl Heuer <kwzh@gnu.org>
parents:
5825
diff
changeset
|
3074 |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3075 f = x_window_to_frame (event.xexpose.window); |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3076 if (f) |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3077 { |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3078 if (f->async_visible == 0) |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3079 { |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3080 f->async_visible = 1; |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3081 f->async_iconified = 0; |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3082 SET_FRAME_GARBAGED (f); |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3083 } |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3084 else |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3085 { |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3086 dumprectangle (x_window_to_frame (event.xexpose.window), |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3087 event.xexpose.x, event.xexpose.y, |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3088 event.xexpose.width, event.xexpose.height); |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3089 } |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3090 } |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3091 else |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3092 { |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3093 struct scroll_bar *bar |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3094 = x_window_to_scroll_bar (event.xexpose.window); |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3095 |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3096 if (bar) |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3097 x_scroll_bar_expose (bar, &event); |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3098 } |
|
5872
6389c826f847
(x_display_cursor, process_expose_from_menu): Block input.
Karl Heuer <kwzh@gnu.org>
parents:
5825
diff
changeset
|
3099 |
|
6389c826f847
(x_display_cursor, process_expose_from_menu): Block input.
Karl Heuer <kwzh@gnu.org>
parents:
5825
diff
changeset
|
3100 UNBLOCK_INPUT; |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3101 } |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3102 |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3103 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3104 /* The main X event-reading loop - XTread_socket. */ |
| 286 | 3105 |
| 3106 /* Timestamp of enter window event. This is only used by XTread_socket, | |
| 3107 but we have to put it out here, since static variables within functions | |
| 3108 sometimes don't work. */ | |
| 3109 static Time enter_timestamp; | |
| 3110 | |
|
1436
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
3111 /* This holds the state XLookupString needs to implement dead keys |
|
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
3112 and other tricks known as "compose processing". _X Window System_ |
|
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
3113 says that a portable program can't use this, but Stephen Gildea assures |
|
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
3114 me that letting the compiler initialize it to zeros will work okay. |
|
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
3115 |
|
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
3116 This must be defined outside of XTread_socket, for the same reasons |
|
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
3117 given for enter_timestamp, above. */ |
|
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
3118 static XComposeStatus compose_status; |
|
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
3119 |
| 642 | 3120 /* Communication with window managers. */ |
| 3121 Atom Xatom_wm_protocols; | |
| 3122 | |
| 3123 /* Kinds of protocol things we may receive. */ | |
| 3124 Atom Xatom_wm_take_focus; | |
| 3125 Atom Xatom_wm_save_yourself; | |
| 3126 Atom Xatom_wm_delete_window; | |
| 3127 | |
| 3128 /* Other WM communication */ | |
| 3129 Atom Xatom_wm_configure_denied; /* When our config request is denied */ | |
| 3130 Atom Xatom_wm_window_moved; /* When the WM moves us. */ | |
| 3131 | |
|
2195
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3132 /* Window manager communication. */ |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3133 Atom Xatom_wm_change_state; |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3134 |
| 2064 | 3135 /* Record the last 100 characters stored |
| 3136 to help debug the loss-of-chars-during-GC problem. */ | |
| 3137 int temp_index; | |
| 3138 short temp_buffer[100]; | |
| 3139 | |
| 286 | 3140 /* Read events coming from the X server. |
| 3141 This routine is called by the SIGIO handler. | |
| 3142 We return as soon as there are no more events to be read. | |
| 3143 | |
| 3144 Events representing keys are stored in buffer BUFP, | |
| 3145 which can hold up to NUMCHARS characters. | |
| 3146 We return the number of characters stored into the buffer, | |
| 3147 thus pretending to be `read'. | |
| 3148 | |
| 3149 WAITP is nonzero if we should block until input arrives. | |
| 3150 EXPECTED is nonzero if the caller knows input is available. */ | |
| 3151 | |
|
1530
a7f8a1fe258e
* xterm.c (x_convert_modifiers): Declare this to return an
Jim Blandy <jimb@redhat.com>
parents:
1436
diff
changeset
|
3152 int |
| 286 | 3153 XTread_socket (sd, bufp, numchars, waitp, expected) |
| 3154 register int sd; | |
| 3155 register struct input_event *bufp; | |
| 3156 register int numchars; | |
| 3157 int waitp; | |
| 3158 int expected; | |
| 3159 { | |
| 3160 int count = 0; | |
| 3161 int nbytes = 0; | |
| 3162 int mask; | |
| 3163 int items_pending; /* How many items are in the X queue. */ | |
| 3164 XEvent event; | |
| 771 | 3165 struct frame *f; |
|
3938
83d870a52936
* xterm.c (XTread_socket): Initialize event_found to zero, and
Jim Blandy <jimb@redhat.com>
parents:
3924
diff
changeset
|
3166 int event_found = 0; |
| 286 | 3167 int prefix; |
| 3168 Lisp_Object part; | |
| 3169 | |
|
2439
b6c62e4abf59
Put interrupt input blocking in a separate file from xterm.h.
Jim Blandy <jimb@redhat.com>
parents:
2353
diff
changeset
|
3170 if (interrupt_input_blocked) |
| 286 | 3171 { |
|
2439
b6c62e4abf59
Put interrupt input blocking in a separate file from xterm.h.
Jim Blandy <jimb@redhat.com>
parents:
2353
diff
changeset
|
3172 interrupt_input_pending = 1; |
| 286 | 3173 return -1; |
| 3174 } | |
| 3175 | |
|
2439
b6c62e4abf59
Put interrupt input blocking in a separate file from xterm.h.
Jim Blandy <jimb@redhat.com>
parents:
2353
diff
changeset
|
3176 interrupt_input_pending = 0; |
| 286 | 3177 BLOCK_INPUT; |
| 3178 | |
| 3179 if (numchars <= 0) | |
| 3180 abort (); /* Don't think this happens. */ | |
| 3181 | |
| 3182 #ifdef FIOSNBIO | |
| 3183 /* If available, Xlib uses FIOSNBIO to make the socket | |
| 3184 non-blocking, and then looks for EWOULDBLOCK. If O_NDELAY is set, | |
| 3185 FIOSNBIO is ignored, and instead of signalling EWOULDBLOCK, | |
| 3186 a read returns 0, which Xlib interprets as equivalent to EPIPE. */ | |
| 3187 fcntl (fileno (stdin), F_SETFL, 0); | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3188 #endif /* ! defined (FIOSNBIO) */ |
| 286 | 3189 |
| 3190 #ifndef SIGIO | |
| 3191 #ifndef HAVE_SELECT | |
| 3192 if (! (fcntl (fileno (stdin), F_GETFL, 0) & O_NDELAY)) | |
| 3193 { | |
| 3194 extern int read_alarm_should_throw; | |
| 3195 read_alarm_should_throw = 1; | |
| 3196 XPeekEvent (XDISPLAY &event); | |
| 3197 read_alarm_should_throw = 0; | |
| 3198 } | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3199 #endif /* HAVE_SELECT */ |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3200 #endif /* SIGIO */ |
| 286 | 3201 |
| 3202 while (XStuffPending () != 0) | |
| 3203 { | |
| 3204 XNextEvent (XDISPLAY &event); | |
| 3205 event_found = 1; | |
| 3206 | |
| 3207 switch (event.type) | |
| 3208 { | |
| 3209 #ifdef HAVE_X11 | |
| 642 | 3210 case ClientMessage: |
| 3211 { | |
| 3212 if (event.xclient.message_type == Xatom_wm_protocols | |
| 3213 && event.xclient.format == 32) | |
| 3214 { | |
| 3215 if (event.xclient.data.l[0] == Xatom_wm_take_focus) | |
| 3216 { | |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3217 #ifdef USE_X_TOOLKIT |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3218 /* f = x_any_window_to_frame (event.xclient.window); */ |
| 771 | 3219 f = x_window_to_frame (event.xclient.window); |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3220 #else |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3221 f = x_window_to_frame (event.xclient.window); |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3222 #endif |
| 771 | 3223 if (f) |
| 3224 x_focus_on_frame (f); | |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3225 /* Not certain about handling scroll bars here */ |
| 642 | 3226 } |
| 3227 else if (event.xclient.data.l[0] == Xatom_wm_save_yourself) | |
| 3228 { | |
| 3229 /* Save state modify the WM_COMMAND property to | |
| 3230 something which can reinstate us. This notifies | |
| 3231 the session manager, who's looking for such a | |
| 3232 PropertyNotify. Can restart processing when | |
| 3233 a keyboard or mouse event arrives. */ | |
| 3234 if (numchars > 0) | |
| 3235 { | |
| 3236 } | |
| 3237 } | |
| 3238 else if (event.xclient.data.l[0] == Xatom_wm_delete_window) | |
| 3239 { | |
|
6114
b69bdef4f7f6
(XTread_socket): For case ClientMessage and Xatom_wm_delete_window, use
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6088
diff
changeset
|
3240 struct frame *f = x_any_window_to_frame (event.xclient.window); |
| 771 | 3241 |
| 3242 if (f) | |
|
5156
fd78458b8c43
(XTread_socket): Really handle Xatom_wm_window_moved events.
Richard M. Stallman <rms@gnu.org>
parents:
5018
diff
changeset
|
3243 { |
|
fd78458b8c43
(XTread_socket): Really handle Xatom_wm_window_moved events.
Richard M. Stallman <rms@gnu.org>
parents:
5018
diff
changeset
|
3244 if (numchars == 0) |
|
fd78458b8c43
(XTread_socket): Really handle Xatom_wm_window_moved events.
Richard M. Stallman <rms@gnu.org>
parents:
5018
diff
changeset
|
3245 abort (); |
|
fd78458b8c43
(XTread_socket): Really handle Xatom_wm_window_moved events.
Richard M. Stallman <rms@gnu.org>
parents:
5018
diff
changeset
|
3246 |
|
fd78458b8c43
(XTread_socket): Really handle Xatom_wm_window_moved events.
Richard M. Stallman <rms@gnu.org>
parents:
5018
diff
changeset
|
3247 bufp->kind = delete_window_event; |
|
fd78458b8c43
(XTread_socket): Really handle Xatom_wm_window_moved events.
Richard M. Stallman <rms@gnu.org>
parents:
5018
diff
changeset
|
3248 XSET (bufp->frame_or_window, Lisp_Frame, f); |
|
fd78458b8c43
(XTread_socket): Really handle Xatom_wm_window_moved events.
Richard M. Stallman <rms@gnu.org>
parents:
5018
diff
changeset
|
3249 bufp++; |
|
fd78458b8c43
(XTread_socket): Really handle Xatom_wm_window_moved events.
Richard M. Stallman <rms@gnu.org>
parents:
5018
diff
changeset
|
3250 |
|
fd78458b8c43
(XTread_socket): Really handle Xatom_wm_window_moved events.
Richard M. Stallman <rms@gnu.org>
parents:
5018
diff
changeset
|
3251 count += 1; |
|
fd78458b8c43
(XTread_socket): Really handle Xatom_wm_window_moved events.
Richard M. Stallman <rms@gnu.org>
parents:
5018
diff
changeset
|
3252 numchars -= 1; |
|
fd78458b8c43
(XTread_socket): Really handle Xatom_wm_window_moved events.
Richard M. Stallman <rms@gnu.org>
parents:
5018
diff
changeset
|
3253 } |
| 642 | 3254 } |
| 3255 } | |
| 3256 else if (event.xclient.message_type == Xatom_wm_configure_denied) | |
| 3257 { | |
| 3258 } | |
| 3259 else if (event.xclient.message_type == Xatom_wm_window_moved) | |
| 3260 { | |
| 3261 int new_x, new_y; | |
|
5156
fd78458b8c43
(XTread_socket): Really handle Xatom_wm_window_moved events.
Richard M. Stallman <rms@gnu.org>
parents:
5018
diff
changeset
|
3262 struct frame *f = x_window_to_frame (event.xclient.window); |
|
fd78458b8c43
(XTread_socket): Really handle Xatom_wm_window_moved events.
Richard M. Stallman <rms@gnu.org>
parents:
5018
diff
changeset
|
3263 |
| 786 | 3264 new_x = event.xclient.data.s[0]; |
| 3265 new_y = event.xclient.data.s[1]; | |
|
5156
fd78458b8c43
(XTread_socket): Really handle Xatom_wm_window_moved events.
Richard M. Stallman <rms@gnu.org>
parents:
5018
diff
changeset
|
3266 |
|
fd78458b8c43
(XTread_socket): Really handle Xatom_wm_window_moved events.
Richard M. Stallman <rms@gnu.org>
parents:
5018
diff
changeset
|
3267 if (f) |
|
fd78458b8c43
(XTread_socket): Really handle Xatom_wm_window_moved events.
Richard M. Stallman <rms@gnu.org>
parents:
5018
diff
changeset
|
3268 { |
|
fd78458b8c43
(XTread_socket): Really handle Xatom_wm_window_moved events.
Richard M. Stallman <rms@gnu.org>
parents:
5018
diff
changeset
|
3269 f->display.x->left_pos = new_x; |
|
fd78458b8c43
(XTread_socket): Really handle Xatom_wm_window_moved events.
Richard M. Stallman <rms@gnu.org>
parents:
5018
diff
changeset
|
3270 f->display.x->top_pos = new_y; |
|
fd78458b8c43
(XTread_socket): Really handle Xatom_wm_window_moved events.
Richard M. Stallman <rms@gnu.org>
parents:
5018
diff
changeset
|
3271 } |
| 642 | 3272 } |
| 3273 } | |
| 3274 break; | |
| 286 | 3275 |
|
2195
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3276 #ifdef NEW_SELECTIONS |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3277 case SelectionNotify: |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3278 #ifdef USE_X_TOOLKIT |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3279 if (x_window_to_frame (event.xselection.requestor)) |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3280 x_handle_selection_notify (&event); |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3281 else |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3282 goto OTHER; |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3283 #else /* not USE_X_TOOLKIT */ |
|
2195
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3284 x_handle_selection_notify (&event); |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3285 #endif /* not USE_X_TOOLKIT */ |
|
2195
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3286 break; |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3287 #endif /* NEW_SELECTIONS */ |
|
2195
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3288 |
| 286 | 3289 case SelectionClear: /* Someone has grabbed ownership. */ |
|
2195
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3290 #ifdef NEW_SELECTIONS |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3291 { |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3292 #ifdef USE_X_TOOLKIT |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3293 if (x_window_to_frame (event.xselectionclear.window)) |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3294 { |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3295 #endif /* USE_X_TOOLKIT */ |
|
2195
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3296 XSelectionClearEvent *eventp = (XSelectionClearEvent *) &event; |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3297 |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3298 if (numchars == 0) |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3299 abort (); |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3300 |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3301 bufp->kind = selection_clear_event; |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3302 SELECTION_EVENT_DISPLAY (bufp) = eventp->display; |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3303 SELECTION_EVENT_SELECTION (bufp) = eventp->selection; |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3304 SELECTION_EVENT_TIME (bufp) = eventp->time; |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3305 bufp++; |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3306 |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3307 count += 1; |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3308 numchars -= 1; |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3309 #ifdef USE_X_TOOLKIT |
|
2195
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3310 } |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3311 else |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3312 goto OTHER; |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3313 #endif /* USE_X_TOOLKIT */ |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3314 } |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3315 #else /* not NEW_SELECTIONS */ |
| 286 | 3316 x_disown_selection (event.xselectionclear.window, |
| 3317 event.xselectionclear.selection, | |
| 3318 event.xselectionclear.time); | |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3319 #endif /* not NEW_SELECTIONS */ |
| 286 | 3320 break; |
| 3321 | |
| 3322 case SelectionRequest: /* Someone wants our selection. */ | |
|
2195
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3323 #ifdef NEW_SELECTIONS |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3324 { |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3325 #ifdef USE_X_TOOLKIT |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3326 if (x_window_to_frame (event.xselectionrequest.owner)) |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3327 { |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3328 #endif /* USE_X_TOOLKIT */ |
|
2195
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3329 XSelectionRequestEvent *eventp = (XSelectionRequestEvent *) &event; |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3330 |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3331 if (numchars == 0) |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3332 abort (); |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3333 |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3334 bufp->kind = selection_request_event; |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3335 SELECTION_EVENT_DISPLAY (bufp) = eventp->display; |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3336 SELECTION_EVENT_REQUESTOR (bufp) = eventp->requestor; |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3337 SELECTION_EVENT_SELECTION (bufp) = eventp->selection; |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3338 SELECTION_EVENT_TARGET (bufp) = eventp->target; |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3339 SELECTION_EVENT_PROPERTY (bufp) = eventp->property; |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3340 SELECTION_EVENT_TIME (bufp) = eventp->time; |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3341 bufp++; |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3342 |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3343 count += 1; |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3344 numchars -= 1; |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3345 #ifdef USE_X_TOOLKIT |
|
2195
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3346 } |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3347 else |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3348 goto OTHER; |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3349 #endif /* USE_X_TOOLKIT */ |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3350 } |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3351 #else /* not NEW_SELECTIONS */ |
| 286 | 3352 x_answer_selection_request (event); |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3353 #endif /* not NEW_SELECTIONS */ |
| 286 | 3354 break; |
| 3355 | |
| 3356 case PropertyNotify: | |
|
2195
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3357 #ifdef NEW_SELECTIONS |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3358 #ifdef USE_X_TOOLKIT |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3359 if (x_any_window_to_frame (event.xproperty.window)) |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3360 x_handle_property_notify (&event); |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3361 else |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3362 goto OTHER; |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3363 #else /* not USE_X_TOOLKIT */ |
|
2195
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3364 x_handle_property_notify (&event); |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3365 #endif /* not USE_X_TOOLKIT */ |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3366 #else /* not NEW_SELECTIONS */ |
|
1279
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
3367 /* If we're being told about a root window property, then it's |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
3368 a cut buffer change. */ |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
3369 if (event.xproperty.window == ROOT_WINDOW) |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
3370 x_invalidate_cut_buffer_cache (&event.xproperty); |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
3371 |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
3372 /* Otherwise, we're probably handling an incremental |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
3373 selection transmission. */ |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
3374 else |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
3375 { |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
3376 /* If we were to do this synchronously, there'd be no worry |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
3377 about re-selecting. */ |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
3378 x_send_incremental (event); |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
3379 } |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3380 #endif /* not NEW_SELECTIONS */ |
| 286 | 3381 break; |
| 3382 | |
|
3045
0267fb20b0df
(XTread_socket, ConfigureNotify case):
Richard M. Stallman <rms@gnu.org>
parents:
3030
diff
changeset
|
3383 case ReparentNotify: |
|
0267fb20b0df
(XTread_socket, ConfigureNotify case):
Richard M. Stallman <rms@gnu.org>
parents:
3030
diff
changeset
|
3384 f = x_window_to_frame (event.xreparent.window); |
|
0267fb20b0df
(XTread_socket, ConfigureNotify case):
Richard M. Stallman <rms@gnu.org>
parents:
3030
diff
changeset
|
3385 if (f) |
|
0267fb20b0df
(XTread_socket, ConfigureNotify case):
Richard M. Stallman <rms@gnu.org>
parents:
3030
diff
changeset
|
3386 f->display.x->parent_desc = event.xreparent.parent; |
|
0267fb20b0df
(XTread_socket, ConfigureNotify case):
Richard M. Stallman <rms@gnu.org>
parents:
3030
diff
changeset
|
3387 break; |
|
0267fb20b0df
(XTread_socket, ConfigureNotify case):
Richard M. Stallman <rms@gnu.org>
parents:
3030
diff
changeset
|
3388 |
| 286 | 3389 case Expose: |
| 771 | 3390 f = x_window_to_frame (event.xexpose.window); |
| 3391 if (f) | |
| 286 | 3392 { |
|
1658
452ba03935d7
* xterm.c (XTread_socket): When we get MapNotify, UnmapNotify,
Jim Blandy <jimb@redhat.com>
parents:
1530
diff
changeset
|
3393 if (f->async_visible == 0) |
| 286 | 3394 { |
|
1658
452ba03935d7
* xterm.c (XTread_socket): When we get MapNotify, UnmapNotify,
Jim Blandy <jimb@redhat.com>
parents:
1530
diff
changeset
|
3395 f->async_visible = 1; |
|
452ba03935d7
* xterm.c (XTread_socket): When we get MapNotify, UnmapNotify,
Jim Blandy <jimb@redhat.com>
parents:
1530
diff
changeset
|
3396 f->async_iconified = 0; |
| 771 | 3397 SET_FRAME_GARBAGED (f); |
| 286 | 3398 } |
| 3399 else | |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3400 { |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3401 dumprectangle (x_window_to_frame (event.xexpose.window), |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3402 event.xexpose.x, event.xexpose.y, |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3403 event.xexpose.width, event.xexpose.height); |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3404 } |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3405 } |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3406 else |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3407 { |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3408 struct scroll_bar *bar |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3409 = x_window_to_scroll_bar (event.xexpose.window); |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3410 |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3411 if (bar) |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3412 x_scroll_bar_expose (bar, &event); |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3413 #ifdef USE_X_TOOLKIT |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3414 else |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3415 goto OTHER; |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3416 #endif /* USE_X_TOOLKIT */ |
| 286 | 3417 } |
| 3418 break; | |
| 3419 | |
| 3420 case GraphicsExpose: /* This occurs when an XCopyArea's | |
| 3421 source area was obscured or not | |
| 3422 available.*/ | |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3423 f = x_window_to_frame (event.xgraphicsexpose.drawable); |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3424 if (f) |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3425 { |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3426 dumprectangle (f, |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3427 event.xgraphicsexpose.x, event.xgraphicsexpose.y, |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3428 event.xgraphicsexpose.width, |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3429 event.xgraphicsexpose.height); |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3430 } |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3431 #ifdef USE_X_TOOLKIT |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3432 else |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3433 goto OTHER; |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3434 #endif /* USE_X_TOOLKIT */ |
| 286 | 3435 break; |
| 3436 | |
| 3437 case NoExpose: /* This occurs when an XCopyArea's | |
| 3438 source area was completely | |
| 3439 available */ | |
| 3440 break; | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3441 #else /* ! defined (HAVE_X11) */ |
| 286 | 3442 case ExposeWindow: |
| 3443 if (event.subwindow != 0) | |
| 3444 break; /* duplicate event */ | |
| 771 | 3445 f = x_window_to_frame (event.window); |
| 3446 if (event.window == f->display.x->icon_desc) | |
| 286 | 3447 { |
| 771 | 3448 refreshicon (f); |
|
1658
452ba03935d7
* xterm.c (XTread_socket): When we get MapNotify, UnmapNotify,
Jim Blandy <jimb@redhat.com>
parents:
1530
diff
changeset
|
3449 f->async_iconified = 1; |
| 286 | 3450 } |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3451 if (event.window == FRAME_X_WINDOW (f)) |
| 286 | 3452 { |
| 3453 /* Say must check all windows' needs_exposure flags. */ | |
| 3454 expose_all_windows = 1; | |
| 771 | 3455 f->display.x->needs_exposure = 1; |
|
1658
452ba03935d7
* xterm.c (XTread_socket): When we get MapNotify, UnmapNotify,
Jim Blandy <jimb@redhat.com>
parents:
1530
diff
changeset
|
3456 f->async_visible = 1; |
| 286 | 3457 } |
| 3458 break; | |
| 3459 | |
| 3460 case ExposeRegion: | |
| 3461 if (event.subwindow != 0) | |
| 3462 break; /* duplicate event */ | |
| 771 | 3463 f = x_window_to_frame (event.window); |
| 3464 if (event.window == f->display.x->icon_desc) | |
| 286 | 3465 { |
| 771 | 3466 refreshicon (f); |
| 286 | 3467 break; |
| 3468 } | |
| 3469 /* If window already needs full redraw, ignore this rectangle. */ | |
| 771 | 3470 if (expose_all_windows && f->display.x->needs_exposure) |
| 286 | 3471 break; |
| 3472 /* Put the event on the queue of rectangles to redraw. */ | |
| 3473 if (enqueue_event (&event, &x_expose_queue)) | |
| 3474 /* If it is full, we can't record the rectangle, | |
| 3475 so redraw this entire window. */ | |
| 3476 { | |
| 3477 /* Say must check all windows' needs_exposure flags. */ | |
| 3478 expose_all_windows = 1; | |
| 771 | 3479 f->display.x->needs_exposure = 1; |
| 286 | 3480 } |
| 3481 break; | |
| 3482 | |
| 3483 case ExposeCopy: | |
| 3484 /* This should happen only when we are expecting it, | |
| 3485 in x_read_exposes. */ | |
| 3486 abort (); | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3487 #endif /* ! defined (HAVE_X11) */ |
| 286 | 3488 |
| 3489 #ifdef HAVE_X11 | |
| 3490 case UnmapNotify: | |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3491 f = x_window_to_frame (event.xunmap.window); |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3492 if (f) /* F may no longer exist if |
| 771 | 3493 the frame was deleted. */ |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3494 { |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3495 /* While a frame is unmapped, display generation is |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3496 disabled; you don't want to spend time updating a |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3497 display that won't ever be seen. */ |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3498 f->async_visible = 0; |
|
3284
a47979ffad1e
(XTread_socket): For UnmapNotify, if frame was visible,
Richard M. Stallman <rms@gnu.org>
parents:
3282
diff
changeset
|
3499 /* The window manager never makes a window invisible |
|
a47979ffad1e
(XTread_socket): For UnmapNotify, if frame was visible,
Richard M. Stallman <rms@gnu.org>
parents:
3282
diff
changeset
|
3500 ("withdrawn"); all it does is switch between visible |
|
a47979ffad1e
(XTread_socket): For UnmapNotify, if frame was visible,
Richard M. Stallman <rms@gnu.org>
parents:
3282
diff
changeset
|
3501 and iconified. Frames get into the invisible state |
|
4147
c6657758fb6f
* xterm.c (x_term_init): Adjust message printed when we can't
Jim Blandy <jimb@redhat.com>
parents:
3951
diff
changeset
|
3502 only through x_make_frame_invisible. */ |
|
3284
a47979ffad1e
(XTread_socket): For UnmapNotify, if frame was visible,
Richard M. Stallman <rms@gnu.org>
parents:
3282
diff
changeset
|
3503 if (FRAME_VISIBLE_P (f) || FRAME_ICONIFIED_P (f)) |
|
a47979ffad1e
(XTread_socket): For UnmapNotify, if frame was visible,
Richard M. Stallman <rms@gnu.org>
parents:
3282
diff
changeset
|
3504 f->async_iconified = 1; |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3505 } |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3506 #ifdef USE_X_TOOLKIT |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3507 goto OTHER; |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3508 #endif /* USE_X_TOOLKIT */ |
| 286 | 3509 break; |
| 3510 | |
| 3511 case MapNotify: | |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3512 #ifdef USE_X_TOOLKIT |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3513 f = x_any_window_to_frame (event.xmap.window); |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3514 #else /* not USE_X_TOOLKIT */ |
| 771 | 3515 f = x_window_to_frame (event.xmap.window); |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3516 #endif /* not USE_X_TOOLKIT */ |
| 771 | 3517 if (f) |
| 286 | 3518 { |
|
1658
452ba03935d7
* xterm.c (XTread_socket): When we get MapNotify, UnmapNotify,
Jim Blandy <jimb@redhat.com>
parents:
1530
diff
changeset
|
3519 f->async_visible = 1; |
|
452ba03935d7
* xterm.c (XTread_socket): When we get MapNotify, UnmapNotify,
Jim Blandy <jimb@redhat.com>
parents:
1530
diff
changeset
|
3520 f->async_iconified = 0; |
| 286 | 3521 |
| 3522 /* wait_reading_process_input will notice this and update | |
| 771 | 3523 the frame's display structures. */ |
| 3524 SET_FRAME_GARBAGED (f); | |
| 286 | 3525 } |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3526 #ifdef USE_X_TOOLKIT |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3527 goto OTHER; |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3528 #endif /* USE_X_TOOLKIT */ |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3529 break; |
| 286 | 3530 |
| 3531 /* Turn off processing if we become fully obscured. */ | |
| 3532 case VisibilityNotify: | |
| 3533 break; | |
| 3534 | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3535 #else /* ! defined (HAVE_X11) */ |
| 286 | 3536 case UnmapWindow: |
| 771 | 3537 f = x_window_to_frame (event.window); |
| 3538 if (event.window == f->display.x->icon_desc) | |
|
1658
452ba03935d7
* xterm.c (XTread_socket): When we get MapNotify, UnmapNotify,
Jim Blandy <jimb@redhat.com>
parents:
1530
diff
changeset
|
3539 f->async_iconified = 0; |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3540 if (event.window == FRAME_X_WINDOW (f)) |
|
1658
452ba03935d7
* xterm.c (XTread_socket): When we get MapNotify, UnmapNotify,
Jim Blandy <jimb@redhat.com>
parents:
1530
diff
changeset
|
3541 f->async_visible = 0; |
| 286 | 3542 break; |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3543 #endif /* ! defined (HAVE_X11) */ |
| 286 | 3544 |
| 3545 #ifdef HAVE_X11 | |
| 3546 case KeyPress: | |
|
6010
1f9f36411af8
(XTread_socket--cases KeyPress, EnterNotify, LeaveNotify)
Richard M. Stallman <rms@gnu.org>
parents:
5987
diff
changeset
|
3547 f = x_any_window_to_frame (event.xkey.window); |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3548 |
| 771 | 3549 if (f != 0) |
| 286 | 3550 { |
|
3355
e0c2e8a2ef75
(XTread_socket, case KeyPress) [HPUX]: Test IsModifiedKey.
Richard M. Stallman <rms@gnu.org>
parents:
3284
diff
changeset
|
3551 KeySym keysym, orig_keysym; |
|
5018
14f3c98a5cc1
(XTread_socket): Increase length of copy_buffer to 81.
Richard M. Stallman <rms@gnu.org>
parents:
4974
diff
changeset
|
3552 /* al%imercury@uunet.uu.net says that making this 81 instead of |
|
14f3c98a5cc1
(XTread_socket): Increase length of copy_buffer to 81.
Richard M. Stallman <rms@gnu.org>
parents:
4974
diff
changeset
|
3553 80 fixed a bug whereby meta chars made his Emacs hang. */ |
|
14f3c98a5cc1
(XTread_socket): Increase length of copy_buffer to 81.
Richard M. Stallman <rms@gnu.org>
parents:
4974
diff
changeset
|
3554 unsigned char copy_buffer[81]; |
|
1841
338e4ffdb54b
(XTread_socket): Support extra_keyboard_modifiers.
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
3555 int modifiers; |
|
338e4ffdb54b
(XTread_socket): Support extra_keyboard_modifiers.
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
3556 |
|
2661
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
3557 event.xkey.state |
|
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
3558 |= x_emacs_to_x_modifiers (extra_keyboard_modifiers); |
|
1841
338e4ffdb54b
(XTread_socket): Support extra_keyboard_modifiers.
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
3559 modifiers = event.xkey.state; |
| 555 | 3560 |
|
1436
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
3561 /* This will have to go some day... */ |
|
2881
11eced50eaa6
* xterm.c (XTread_socket): Turn off ControlMask for XLookupString.
Jim Blandy <jimb@redhat.com>
parents:
2840
diff
changeset
|
3562 |
|
11eced50eaa6
* xterm.c (XTread_socket): Turn off ControlMask for XLookupString.
Jim Blandy <jimb@redhat.com>
parents:
2840
diff
changeset
|
3563 /* make_lispy_event turns chars into control chars. |
|
11eced50eaa6
* xterm.c (XTread_socket): Turn off ControlMask for XLookupString.
Jim Blandy <jimb@redhat.com>
parents:
2840
diff
changeset
|
3564 Don't do it here because XLookupString is too eager. */ |
|
11eced50eaa6
* xterm.c (XTread_socket): Turn off ControlMask for XLookupString.
Jim Blandy <jimb@redhat.com>
parents:
2840
diff
changeset
|
3565 event.xkey.state &= ~ControlMask; |
|
1436
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
3566 nbytes = |
|
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
3567 XLookupString (&event.xkey, copy_buffer, 80, &keysym, |
|
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
3568 &compose_status); |
| 286 | 3569 |
| 395 | 3570 /* Strip off the vendor-specific keysym bit, and take a shot |
| 3571 at recognizing the codes. HP servers have extra keysyms | |
| 3572 that fit into the MiscFunctionKey category. */ | |
|
3355
e0c2e8a2ef75
(XTread_socket, case KeyPress) [HPUX]: Test IsModifiedKey.
Richard M. Stallman <rms@gnu.org>
parents:
3284
diff
changeset
|
3573 orig_keysym = keysym; |
| 395 | 3574 keysym &= ~(1<<28); |
| 3575 | |
| 286 | 3576 if (numchars > 1) |
| 3577 { | |
|
3839
3cc238ae0de5
* xterm.c (XTread_socket): Never treat a modifier key as a
Jim Blandy <jimb@redhat.com>
parents:
3710
diff
changeset
|
3578 if (((keysym >= XK_BackSpace && keysym <= XK_Escape) |
|
3cc238ae0de5
* xterm.c (XTread_socket): Never treat a modifier key as a
Jim Blandy <jimb@redhat.com>
parents:
3710
diff
changeset
|
3579 || keysym == XK_Delete |
|
3cc238ae0de5
* xterm.c (XTread_socket): Never treat a modifier key as a
Jim Blandy <jimb@redhat.com>
parents:
3710
diff
changeset
|
3580 || IsCursorKey (keysym) /* 0xff50 <= x < 0xff60 */ |
|
3cc238ae0de5
* xterm.c (XTread_socket): Never treat a modifier key as a
Jim Blandy <jimb@redhat.com>
parents:
3710
diff
changeset
|
3581 || IsMiscFunctionKey (keysym) /* 0xff60 <= x < VARIES */ |
|
3218
0069a30d083f
(XTread_socket, case KeyPress) [HPUX]:
Richard M. Stallman <rms@gnu.org>
parents:
3135
diff
changeset
|
3582 #ifdef HPUX |
|
3839
3cc238ae0de5
* xterm.c (XTread_socket): Never treat a modifier key as a
Jim Blandy <jimb@redhat.com>
parents:
3710
diff
changeset
|
3583 /* This recognizes the "extended function keys". |
|
3cc238ae0de5
* xterm.c (XTread_socket): Never treat a modifier key as a
Jim Blandy <jimb@redhat.com>
parents:
3710
diff
changeset
|
3584 It seems there's no cleaner way. |
|
3cc238ae0de5
* xterm.c (XTread_socket): Never treat a modifier key as a
Jim Blandy <jimb@redhat.com>
parents:
3710
diff
changeset
|
3585 Test IsModifierKey to avoid handling mode_switch |
|
3cc238ae0de5
* xterm.c (XTread_socket): Never treat a modifier key as a
Jim Blandy <jimb@redhat.com>
parents:
3710
diff
changeset
|
3586 incorrectly. */ |
|
3cc238ae0de5
* xterm.c (XTread_socket): Never treat a modifier key as a
Jim Blandy <jimb@redhat.com>
parents:
3710
diff
changeset
|
3587 || ((unsigned) (keysym) >= XK_Select |
|
3cc238ae0de5
* xterm.c (XTread_socket): Never treat a modifier key as a
Jim Blandy <jimb@redhat.com>
parents:
3710
diff
changeset
|
3588 && (unsigned)(keysym) < XK_KP_Space) |
|
3218
0069a30d083f
(XTread_socket, case KeyPress) [HPUX]:
Richard M. Stallman <rms@gnu.org>
parents:
3135
diff
changeset
|
3589 #endif |
|
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3590 #ifdef XK_dead_circumflex |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3591 || orig_keysym == XK_dead_circumflex |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3592 #endif |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3593 #ifdef XK_dead_grave |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3594 || orig_keysym == XK_dead_grave |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3595 #endif |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3596 #ifdef XK_dead_tilde |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3597 || orig_keysym == XK_dead_tilde |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3598 #endif |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3599 #ifdef XK_dead_diaeresis |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3600 || orig_keysym == XK_dead_diaeresis |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3601 #endif |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3602 #ifdef XK_dead_macron |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3603 || orig_keysym == XK_dead_macron |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3604 #endif |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3605 #ifdef XK_dead_degree |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3606 || orig_keysym == XK_dead_degree |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3607 #endif |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3608 #ifdef XK_dead_acute |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3609 || orig_keysym == XK_dead_acute |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3610 #endif |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3611 #ifdef XK_dead_cedilla |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3612 || orig_keysym == XK_dead_cedilla |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3613 #endif |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3614 #ifdef XK_dead_breve |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3615 || orig_keysym == XK_dead_breve |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3616 #endif |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3617 #ifdef XK_dead_ogonek |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3618 || orig_keysym == XK_dead_ogonek |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3619 #endif |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3620 #ifdef XK_dead_caron |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3621 || orig_keysym == XK_dead_caron |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3622 #endif |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3623 #ifdef XK_dead_doubleacute |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3624 || orig_keysym == XK_dead_doubleacute |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3625 #endif |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3626 #ifdef XK_dead_abovedot |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3627 || orig_keysym == XK_dead_abovedot |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3628 #endif |
|
3839
3cc238ae0de5
* xterm.c (XTread_socket): Never treat a modifier key as a
Jim Blandy <jimb@redhat.com>
parents:
3710
diff
changeset
|
3629 || IsKeypadKey (keysym) /* 0xff80 <= x < 0xffbe */ |
|
3cc238ae0de5
* xterm.c (XTread_socket): Never treat a modifier key as a
Jim Blandy <jimb@redhat.com>
parents:
3710
diff
changeset
|
3630 || IsFunctionKey (keysym) /* 0xffbe <= x < 0xffe1 */ |
|
3cc238ae0de5
* xterm.c (XTread_socket): Never treat a modifier key as a
Jim Blandy <jimb@redhat.com>
parents:
3710
diff
changeset
|
3631 || x_is_vendor_fkey (orig_keysym)) |
|
4244
bc70363458c3
(XTread_socket) [! HAVE_X11R5]:
Richard M. Stallman <rms@gnu.org>
parents:
4147
diff
changeset
|
3632 && ! (IsModifierKey (orig_keysym) |
|
bc70363458c3
(XTread_socket) [! HAVE_X11R5]:
Richard M. Stallman <rms@gnu.org>
parents:
4147
diff
changeset
|
3633 #ifndef HAVE_X11R5 |
|
bc70363458c3
(XTread_socket) [! HAVE_X11R5]:
Richard M. Stallman <rms@gnu.org>
parents:
4147
diff
changeset
|
3634 #ifdef XK_Mode_switch |
|
bc70363458c3
(XTread_socket) [! HAVE_X11R5]:
Richard M. Stallman <rms@gnu.org>
parents:
4147
diff
changeset
|
3635 || ((unsigned)(orig_keysym) == XK_Mode_switch) |
|
bc70363458c3
(XTread_socket) [! HAVE_X11R5]:
Richard M. Stallman <rms@gnu.org>
parents:
4147
diff
changeset
|
3636 #endif |
|
bc70363458c3
(XTread_socket) [! HAVE_X11R5]:
Richard M. Stallman <rms@gnu.org>
parents:
4147
diff
changeset
|
3637 #ifdef XK_Num_Lock |
|
bc70363458c3
(XTread_socket) [! HAVE_X11R5]:
Richard M. Stallman <rms@gnu.org>
parents:
4147
diff
changeset
|
3638 || ((unsigned)(orig_keysym) == XK_Num_Lock) |
|
bc70363458c3
(XTread_socket) [! HAVE_X11R5]:
Richard M. Stallman <rms@gnu.org>
parents:
4147
diff
changeset
|
3639 #endif |
|
bc70363458c3
(XTread_socket) [! HAVE_X11R5]:
Richard M. Stallman <rms@gnu.org>
parents:
4147
diff
changeset
|
3640 #endif /* not HAVE_X11R5 */ |
|
bc70363458c3
(XTread_socket) [! HAVE_X11R5]:
Richard M. Stallman <rms@gnu.org>
parents:
4147
diff
changeset
|
3641 )) |
| 286 | 3642 { |
| 2064 | 3643 if (temp_index == sizeof temp_buffer / sizeof (short)) |
| 3644 temp_index = 0; | |
| 3645 temp_buffer[temp_index++] = keysym; | |
| 286 | 3646 bufp->kind = non_ascii_keystroke; |
|
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3647 bufp->code = keysym; |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
3648 XSET (bufp->frame_or_window, Lisp_Frame, f); |
|
2661
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
3649 bufp->modifiers = x_x_to_emacs_modifiers (modifiers); |
| 708 | 3650 bufp->timestamp = event.xkey.time; |
| 286 | 3651 bufp++; |
| 3652 count++; | |
| 3653 numchars--; | |
| 3654 } | |
| 3655 else if (numchars > nbytes) | |
| 3656 { | |
| 3657 register int i; | |
| 3658 | |
| 2064 | 3659 for (i = 0; i < nbytes; i++) |
| 286 | 3660 { |
| 2064 | 3661 if (temp_index == sizeof temp_buffer / sizeof (short)) |
| 3662 temp_index = 0; | |
| 3663 temp_buffer[temp_index++] = copy_buffer[i]; | |
| 286 | 3664 bufp->kind = ascii_keystroke; |
|
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3665 bufp->code = copy_buffer[i]; |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
3666 XSET (bufp->frame_or_window, Lisp_Frame, f); |
|
2661
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
3667 bufp->modifiers = x_x_to_emacs_modifiers (modifiers); |
| 708 | 3668 bufp->timestamp = event.xkey.time; |
| 286 | 3669 bufp++; |
| 3670 } | |
| 3671 | |
| 3672 count += nbytes; | |
| 3673 numchars -= nbytes; | |
| 3674 } | |
| 2064 | 3675 else |
| 3676 abort (); | |
| 286 | 3677 } |
| 2064 | 3678 else |
| 3679 abort (); | |
| 286 | 3680 } |
| 3681 break; | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3682 #else /* ! defined (HAVE_X11) */ |
| 286 | 3683 case KeyPressed: |
| 3684 { | |
| 3685 register char *where_mapping; | |
| 3686 | |
| 771 | 3687 f = x_window_to_frame (event.window); |
| 286 | 3688 /* Ignore keys typed on icon windows. */ |
| 771 | 3689 if (f != 0 && event.window == f->display.x->icon_desc) |
| 286 | 3690 break; |
| 3691 where_mapping = XLookupMapping (&event, &nbytes); | |
| 3692 /* Nasty fix for arrow keys */ | |
| 3693 if (!nbytes && IsCursorKey (event.detail & 0xff)) | |
| 3694 { | |
| 3695 switch (event.detail & 0xff) | |
| 3696 { | |
| 3697 case KC_CURSOR_LEFT: | |
| 3698 where_mapping = "\002"; | |
| 3699 break; | |
| 3700 case KC_CURSOR_RIGHT: | |
| 3701 where_mapping = "\006"; | |
| 3702 break; | |
| 3703 case KC_CURSOR_UP: | |
| 3704 where_mapping = "\020"; | |
| 3705 break; | |
| 3706 case KC_CURSOR_DOWN: | |
| 3707 where_mapping = "\016"; | |
| 3708 break; | |
| 3709 } | |
| 3710 nbytes = 1; | |
| 3711 } | |
| 3712 if (numchars - nbytes > 0) | |
| 3713 { | |
| 3714 register int i; | |
| 3715 | |
| 3716 for (i = 0; i < nbytes; i++) | |
| 3717 { | |
| 3718 bufp->kind = ascii_keystroke; | |
|
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3719 bufp->code = where_mapping[i]; |
| 429 | 3720 XSET (bufp->time, Lisp_Int, event.xkey.time); |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
3721 XSET (bufp->frame_or_window, Lisp_Frame, f); |
| 286 | 3722 bufp++; |
| 3723 } | |
| 3724 count += nbytes; | |
| 3725 numchars -= nbytes; | |
| 3726 } | |
| 3727 } | |
| 3728 break; | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3729 #endif /* ! defined (HAVE_X11) */ |
| 286 | 3730 |
| 3731 #ifdef HAVE_X11 | |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3732 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3733 /* Here's a possible interpretation of the whole |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3734 FocusIn-EnterNotify FocusOut-LeaveNotify mess. If you get a |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3735 FocusIn event, you have to get a FocusOut event before you |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3736 relinquish the focus. If you haven't received a FocusIn event, |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3737 then a mere LeaveNotify is enough to free you. */ |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3738 |
| 286 | 3739 case EnterNotify: |
|
6010
1f9f36411af8
(XTread_socket--cases KeyPress, EnterNotify, LeaveNotify)
Richard M. Stallman <rms@gnu.org>
parents:
5987
diff
changeset
|
3740 f = x_any_window_to_frame (event.xcrossing.window); |
| 369 | 3741 |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3742 if (event.xcrossing.focus) /* Entered Window */ |
| 286 | 3743 { |
| 3744 /* Avoid nasty pop/raise loops. */ | |
| 771 | 3745 if (f && (!(f->auto_raise) |
| 3746 || !(f->auto_lower) | |
| 286 | 3747 || (event.xcrossing.time - enter_timestamp) > 500)) |
| 3748 { | |
| 771 | 3749 x_new_focus_frame (f); |
| 286 | 3750 enter_timestamp = event.xcrossing.time; |
| 3751 } | |
| 3752 } | |
| 771 | 3753 else if (f == x_focus_frame) |
| 3754 x_new_focus_frame (0); | |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3755 #ifdef USE_X_TOOLKIT |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3756 goto OTHER; |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3757 #endif /* USE_X_TOOLKIT */ |
| 286 | 3758 break; |
| 3759 | |
| 3760 case FocusIn: | |
|
6010
1f9f36411af8
(XTread_socket--cases KeyPress, EnterNotify, LeaveNotify)
Richard M. Stallman <rms@gnu.org>
parents:
5987
diff
changeset
|
3761 f = x_any_window_to_frame (event.xfocus.window); |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3762 if (event.xfocus.detail != NotifyPointer) |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3763 x_focus_event_frame = f; |
| 771 | 3764 if (f) |
| 3765 x_new_focus_frame (f); | |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3766 #ifdef USE_X_TOOLKIT |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3767 goto OTHER; |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3768 #endif /* USE_X_TOOLKIT */ |
| 286 | 3769 break; |
| 3770 | |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3771 |
| 286 | 3772 case LeaveNotify: |
|
6010
1f9f36411af8
(XTread_socket--cases KeyPress, EnterNotify, LeaveNotify)
Richard M. Stallman <rms@gnu.org>
parents:
5987
diff
changeset
|
3773 f = x_any_window_to_frame (event.xcrossing.window); |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3774 |
|
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
3775 if (f == mouse_face_mouse_frame) |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
3776 /* If we move outside the frame, |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
3777 then we're certainly no longer on any text in the frame. */ |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
3778 clear_mouse_face (); |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
3779 |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3780 if (event.xcrossing.focus) |
| 286 | 3781 { |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3782 if (! x_focus_event_frame) |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3783 x_new_focus_frame (0); |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3784 else |
| 771 | 3785 x_new_focus_frame (f); |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3786 } |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3787 else |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3788 { |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3789 if (f == x_focus_event_frame) |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3790 x_focus_event_frame = 0; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3791 if (f == x_focus_frame) |
| 771 | 3792 x_new_focus_frame (0); |
| 286 | 3793 } |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3794 #ifdef USE_X_TOOLKIT |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3795 goto OTHER; |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3796 #endif /* USE_X_TOOLKIT */ |
| 286 | 3797 break; |
| 3798 | |
| 3799 case FocusOut: | |
|
6010
1f9f36411af8
(XTread_socket--cases KeyPress, EnterNotify, LeaveNotify)
Richard M. Stallman <rms@gnu.org>
parents:
5987
diff
changeset
|
3800 f = x_any_window_to_frame (event.xfocus.window); |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3801 if (event.xfocus.detail != NotifyPointer |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3802 && f == x_focus_event_frame) |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3803 x_focus_event_frame = 0; |
| 771 | 3804 if (f && f == x_focus_frame) |
| 3805 x_new_focus_frame (0); | |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3806 #ifdef USE_X_TOOLKIT |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3807 goto OTHER; |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3808 #endif /* USE_X_TOOLKIT */ |
| 286 | 3809 break; |
| 3810 | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3811 #else /* ! defined (HAVE_X11) */ |
| 286 | 3812 |
| 3813 case EnterWindow: | |
| 3814 if ((event.detail & 0xFF) == 1) | |
| 3815 break; /* Coming from our own subwindow */ | |
| 3816 if (event.subwindow != 0) | |
| 3817 break; /* Entering our own subwindow. */ | |
| 3818 | |
| 3819 { | |
| 771 | 3820 f = x_window_to_frame (event.window); |
| 3821 x_mouse_frame = f; | |
| 3822 | |
| 3823 x_new_focus_frame (f); | |
| 286 | 3824 } |
| 3825 break; | |
| 3826 | |
| 3827 case LeaveWindow: | |
| 3828 if ((event.detail & 0xFF) == 1) | |
| 3829 break; /* Entering our own subwindow */ | |
| 3830 if (event.subwindow != 0) | |
| 3831 break; /* Leaving our own subwindow. */ | |
| 3832 | |
| 771 | 3833 x_mouse_frame = 0; |
| 3834 if (x_focus_frame == 0 | |
| 3835 && x_input_frame != 0 | |
| 3836 && x_input_frame == x_window_to_frame (event.window) | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3837 && event.window == FRAME_X_WINDOW (x_input_frame)) |
| 286 | 3838 { |
| 771 | 3839 f = x_input_frame; |
| 3840 x_input_frame = 0; | |
| 3841 if (f) | |
| 3842 frame_unhighlight (f); | |
| 286 | 3843 } |
| 3844 break; | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3845 #endif /* ! defined (HAVE_X11) */ |
| 286 | 3846 |
| 3847 #ifdef HAVE_X11 | |
| 3848 case MotionNotify: | |
| 3849 { | |
|
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3850 if (x_mouse_grabbed) |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3851 f = last_mouse_frame; |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3852 else |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3853 f = x_window_to_frame (event.xmotion.window); |
| 771 | 3854 if (f) |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
3855 note_mouse_movement (f, &event.xmotion); |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3856 else |
| 286 | 3857 { |
|
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3858 struct scroll_bar *bar |
|
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3859 = x_window_to_scroll_bar (event.xmotion.window); |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3860 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3861 if (bar) |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3862 x_scroll_bar_note_movement (bar, &event); |
|
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
3863 |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
3864 /* If we move outside the frame, |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
3865 then we're certainly no longer on any text in the frame. */ |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
3866 clear_mouse_face (); |
| 286 | 3867 } |
| 3868 } | |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3869 #ifdef USE_X_TOOLKIT |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3870 goto OTHER; |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3871 #endif /* USE_X_TOOLKIT */ |
| 286 | 3872 break; |
| 3873 | |
| 3874 case ConfigureNotify: | |
|
6088
8e38fcb2df96
(XTread_socket): For case ConfigureNotify, call x_any_window_to_frame.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6055
diff
changeset
|
3875 f = x_any_window_to_frame (event.xconfigure.window); |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3876 #ifdef USE_X_TOOLKIT |
|
6088
8e38fcb2df96
(XTread_socket): For case ConfigureNotify, call x_any_window_to_frame.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6055
diff
changeset
|
3877 if (f |
|
8e38fcb2df96
(XTread_socket): For case ConfigureNotify, call x_any_window_to_frame.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6055
diff
changeset
|
3878 && ! event.xconfigure.send_event |
|
8e38fcb2df96
(XTread_socket): For case ConfigureNotify, call x_any_window_to_frame.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6055
diff
changeset
|
3879 && (event.xconfigure.window == XtWindow (f->display.x->widget))) |
|
8e38fcb2df96
(XTread_socket): For case ConfigureNotify, call x_any_window_to_frame.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6055
diff
changeset
|
3880 { |
|
8e38fcb2df96
(XTread_socket): For case ConfigureNotify, call x_any_window_to_frame.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6055
diff
changeset
|
3881 Window win, child; |
|
8e38fcb2df96
(XTread_socket): For case ConfigureNotify, call x_any_window_to_frame.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6055
diff
changeset
|
3882 int win_x, win_y; |
|
8e38fcb2df96
(XTread_socket): For case ConfigureNotify, call x_any_window_to_frame.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6055
diff
changeset
|
3883 |
|
8e38fcb2df96
(XTread_socket): For case ConfigureNotify, call x_any_window_to_frame.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6055
diff
changeset
|
3884 /* Find the position of the outside upper-left corner of |
|
8e38fcb2df96
(XTread_socket): For case ConfigureNotify, call x_any_window_to_frame.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6055
diff
changeset
|
3885 the window, in the root coordinate system. Don't |
|
8e38fcb2df96
(XTread_socket): For case ConfigureNotify, call x_any_window_to_frame.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6055
diff
changeset
|
3886 refer to the parent window here; we may be processing |
|
8e38fcb2df96
(XTread_socket): For case ConfigureNotify, call x_any_window_to_frame.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6055
diff
changeset
|
3887 this event after the window manager has changed our |
|
8e38fcb2df96
(XTread_socket): For case ConfigureNotify, call x_any_window_to_frame.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6055
diff
changeset
|
3888 parent, but before we have reached the ReparentNotify. */ |
|
8e38fcb2df96
(XTread_socket): For case ConfigureNotify, call x_any_window_to_frame.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6055
diff
changeset
|
3889 XTranslateCoordinates (x_current_display, |
|
8e38fcb2df96
(XTread_socket): For case ConfigureNotify, call x_any_window_to_frame.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6055
diff
changeset
|
3890 |
|
8e38fcb2df96
(XTread_socket): For case ConfigureNotify, call x_any_window_to_frame.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6055
diff
changeset
|
3891 /* From-window, to-window. */ |
|
8e38fcb2df96
(XTread_socket): For case ConfigureNotify, call x_any_window_to_frame.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6055
diff
changeset
|
3892 XtWindow (f->display.x->widget), |
|
8e38fcb2df96
(XTread_socket): For case ConfigureNotify, call x_any_window_to_frame.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6055
diff
changeset
|
3893 ROOT_WINDOW, |
|
8e38fcb2df96
(XTread_socket): For case ConfigureNotify, call x_any_window_to_frame.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6055
diff
changeset
|
3894 |
|
8e38fcb2df96
(XTread_socket): For case ConfigureNotify, call x_any_window_to_frame.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6055
diff
changeset
|
3895 /* From-position, to-position. */ |
|
8e38fcb2df96
(XTread_socket): For case ConfigureNotify, call x_any_window_to_frame.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6055
diff
changeset
|
3896 -event.xconfigure.border_width, |
|
8e38fcb2df96
(XTread_socket): For case ConfigureNotify, call x_any_window_to_frame.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6055
diff
changeset
|
3897 -event.xconfigure.border_width, |
|
8e38fcb2df96
(XTread_socket): For case ConfigureNotify, call x_any_window_to_frame.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6055
diff
changeset
|
3898 &win_x, &win_y, |
|
8e38fcb2df96
(XTread_socket): For case ConfigureNotify, call x_any_window_to_frame.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6055
diff
changeset
|
3899 |
|
8e38fcb2df96
(XTread_socket): For case ConfigureNotify, call x_any_window_to_frame.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6055
diff
changeset
|
3900 /* Child of win. */ |
|
8e38fcb2df96
(XTread_socket): For case ConfigureNotify, call x_any_window_to_frame.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6055
diff
changeset
|
3901 &child); |
|
8e38fcb2df96
(XTread_socket): For case ConfigureNotify, call x_any_window_to_frame.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6055
diff
changeset
|
3902 event.xconfigure.x = win_x; |
|
8e38fcb2df96
(XTread_socket): For case ConfigureNotify, call x_any_window_to_frame.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6055
diff
changeset
|
3903 event.xconfigure.y = win_y; |
|
8e38fcb2df96
(XTread_socket): For case ConfigureNotify, call x_any_window_to_frame.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6055
diff
changeset
|
3904 |
|
8e38fcb2df96
(XTread_socket): For case ConfigureNotify, call x_any_window_to_frame.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6055
diff
changeset
|
3905 f->display.x->pixel_width = event.xconfigure.width; |
|
8e38fcb2df96
(XTread_socket): For case ConfigureNotify, call x_any_window_to_frame.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6055
diff
changeset
|
3906 f->display.x->pixel_height = event.xconfigure.height; |
|
8e38fcb2df96
(XTread_socket): For case ConfigureNotify, call x_any_window_to_frame.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6055
diff
changeset
|
3907 f->display.x->left_pos = event.xconfigure.x; |
|
8e38fcb2df96
(XTread_socket): For case ConfigureNotify, call x_any_window_to_frame.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6055
diff
changeset
|
3908 f->display.x->top_pos = event.xconfigure.y; |
|
8e38fcb2df96
(XTread_socket): For case ConfigureNotify, call x_any_window_to_frame.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6055
diff
changeset
|
3909 } |
|
8e38fcb2df96
(XTread_socket): For case ConfigureNotify, call x_any_window_to_frame.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6055
diff
changeset
|
3910 goto OTHER; |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3911 #else /* not USE_X_TOOLKIT */ |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3912 if (f) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3913 { |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3914 int rows = PIXEL_TO_CHAR_HEIGHT (f, event.xconfigure.height); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3915 int columns = PIXEL_TO_CHAR_WIDTH (f, event.xconfigure.width); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3916 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3917 /* Even if the number of character rows and columns has |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3918 not changed, the font size may have changed, so we need |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3919 to check the pixel dimensions as well. */ |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3920 if (columns != f->width |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3921 || rows != f->height |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3922 || event.xconfigure.width != f->display.x->pixel_width |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3923 || event.xconfigure.height != f->display.x->pixel_height) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3924 { |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3925 change_frame_size (f, rows, columns, 0, 1); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3926 SET_FRAME_GARBAGED (f); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3927 } |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3928 |
|
3045
0267fb20b0df
(XTread_socket, ConfigureNotify case):
Richard M. Stallman <rms@gnu.org>
parents:
3030
diff
changeset
|
3929 if (! event.xconfigure.send_event) |
|
3030
2c5ea1c98256
(XTread_socket): For ConfigureNotify event,
Richard M. Stallman <rms@gnu.org>
parents:
3016
diff
changeset
|
3930 { |
|
2c5ea1c98256
(XTread_socket): For ConfigureNotify event,
Richard M. Stallman <rms@gnu.org>
parents:
3016
diff
changeset
|
3931 Window win, child; |
|
2c5ea1c98256
(XTread_socket): For ConfigureNotify event,
Richard M. Stallman <rms@gnu.org>
parents:
3016
diff
changeset
|
3932 int win_x, win_y; |
|
2c5ea1c98256
(XTread_socket): For ConfigureNotify event,
Richard M. Stallman <rms@gnu.org>
parents:
3016
diff
changeset
|
3933 |
|
3951
9da0fb7d815e
* xterm.c (XTread_socket): When handing non-synthetic
Jim Blandy <jimb@redhat.com>
parents:
3943
diff
changeset
|
3934 /* Find the position of the outside upper-left corner of |
|
9da0fb7d815e
* xterm.c (XTread_socket): When handing non-synthetic
Jim Blandy <jimb@redhat.com>
parents:
3943
diff
changeset
|
3935 the window, in the root coordinate system. Don't |
|
9da0fb7d815e
* xterm.c (XTread_socket): When handing non-synthetic
Jim Blandy <jimb@redhat.com>
parents:
3943
diff
changeset
|
3936 refer to the parent window here; we may be processing |
|
9da0fb7d815e
* xterm.c (XTread_socket): When handing non-synthetic
Jim Blandy <jimb@redhat.com>
parents:
3943
diff
changeset
|
3937 this event after the window manager has changed our |
|
9da0fb7d815e
* xterm.c (XTread_socket): When handing non-synthetic
Jim Blandy <jimb@redhat.com>
parents:
3943
diff
changeset
|
3938 parent, but before we have reached the ReparentNotify. */ |
|
3030
2c5ea1c98256
(XTread_socket): For ConfigureNotify event,
Richard M. Stallman <rms@gnu.org>
parents:
3016
diff
changeset
|
3939 XTranslateCoordinates (x_current_display, |
|
2c5ea1c98256
(XTread_socket): For ConfigureNotify event,
Richard M. Stallman <rms@gnu.org>
parents:
3016
diff
changeset
|
3940 |
|
2c5ea1c98256
(XTread_socket): For ConfigureNotify event,
Richard M. Stallman <rms@gnu.org>
parents:
3016
diff
changeset
|
3941 /* From-window, to-window. */ |
|
3951
9da0fb7d815e
* xterm.c (XTread_socket): When handing non-synthetic
Jim Blandy <jimb@redhat.com>
parents:
3943
diff
changeset
|
3942 f->display.x->window_desc, |
|
3045
0267fb20b0df
(XTread_socket, ConfigureNotify case):
Richard M. Stallman <rms@gnu.org>
parents:
3030
diff
changeset
|
3943 ROOT_WINDOW, |
|
3030
2c5ea1c98256
(XTread_socket): For ConfigureNotify event,
Richard M. Stallman <rms@gnu.org>
parents:
3016
diff
changeset
|
3944 |
|
2c5ea1c98256
(XTread_socket): For ConfigureNotify event,
Richard M. Stallman <rms@gnu.org>
parents:
3016
diff
changeset
|
3945 /* From-position, to-position. */ |
|
3951
9da0fb7d815e
* xterm.c (XTread_socket): When handing non-synthetic
Jim Blandy <jimb@redhat.com>
parents:
3943
diff
changeset
|
3946 -event.xconfigure.border_width, |
|
9da0fb7d815e
* xterm.c (XTread_socket): When handing non-synthetic
Jim Blandy <jimb@redhat.com>
parents:
3943
diff
changeset
|
3947 -event.xconfigure.border_width, |
|
3030
2c5ea1c98256
(XTread_socket): For ConfigureNotify event,
Richard M. Stallman <rms@gnu.org>
parents:
3016
diff
changeset
|
3948 &win_x, &win_y, |
|
2c5ea1c98256
(XTread_socket): For ConfigureNotify event,
Richard M. Stallman <rms@gnu.org>
parents:
3016
diff
changeset
|
3949 |
|
2c5ea1c98256
(XTread_socket): For ConfigureNotify event,
Richard M. Stallman <rms@gnu.org>
parents:
3016
diff
changeset
|
3950 /* Child of win. */ |
|
2c5ea1c98256
(XTread_socket): For ConfigureNotify event,
Richard M. Stallman <rms@gnu.org>
parents:
3016
diff
changeset
|
3951 &child); |
|
2c5ea1c98256
(XTread_socket): For ConfigureNotify event,
Richard M. Stallman <rms@gnu.org>
parents:
3016
diff
changeset
|
3952 event.xconfigure.x = win_x; |
|
2c5ea1c98256
(XTread_socket): For ConfigureNotify event,
Richard M. Stallman <rms@gnu.org>
parents:
3016
diff
changeset
|
3953 event.xconfigure.y = win_y; |
|
2c5ea1c98256
(XTread_socket): For ConfigureNotify event,
Richard M. Stallman <rms@gnu.org>
parents:
3016
diff
changeset
|
3954 } |
|
2c5ea1c98256
(XTread_socket): For ConfigureNotify event,
Richard M. Stallman <rms@gnu.org>
parents:
3016
diff
changeset
|
3955 |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3956 f->display.x->pixel_width = event.xconfigure.width; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3957 f->display.x->pixel_height = event.xconfigure.height; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3958 f->display.x->left_pos = event.xconfigure.x; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3959 f->display.x->top_pos = event.xconfigure.y; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3960 } |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3961 #endif /* not USE_X_TOOLKIT */ |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3962 break; |
| 286 | 3963 |
| 3964 case ButtonPress: | |
| 3965 case ButtonRelease: | |
| 3966 { | |
| 3967 /* If we decide we want to generate an event to be seen | |
| 3968 by the rest of Emacs, we put it here. */ | |
| 3969 struct input_event emacs_event; | |
| 3970 emacs_event.kind = no_event; | |
| 3971 | |
| 771 | 3972 f = x_window_to_frame (event.xbutton.window); |
| 3973 if (f) | |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3974 { |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3975 if (!x_focus_frame || (f == x_focus_frame)) |
|
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3976 construct_mouse_click (&emacs_event, &event, f); |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3977 } |
| 286 | 3978 else |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3979 { |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3980 struct scroll_bar *bar = |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3981 x_window_to_scroll_bar (event.xbutton.window); |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3982 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3983 if (bar) |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3984 x_scroll_bar_handle_click (bar, &event, &emacs_event); |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3985 #ifdef USE_X_TOOLKIT |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3986 else |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3987 { |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3988 f = x_any_window_to_frame (event.xbutton.window); |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3989 if (f && event.type == ButtonPress) |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3990 construct_menu_click (&emacs_event, |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3991 &event, f); |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3992 } |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3993 #endif /* USE_X_TOOLKIT */ |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3994 } |
| 286 | 3995 |
| 3996 if (numchars >= 1 && emacs_event.kind != no_event) | |
| 3997 { | |
| 3998 bcopy (&emacs_event, bufp, sizeof (struct input_event)); | |
| 3999 bufp++; | |
| 4000 count++; | |
| 4001 numchars--; | |
| 4002 } | |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
4003 |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
4004 #ifdef USE_X_TOOLKIT |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
4005 goto OTHER; |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
4006 #endif /* USE_X_TOOLKIT */ |
| 286 | 4007 } |
| 4008 break; | |
| 4009 | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4010 #else /* ! defined (HAVE_X11) */ |
| 286 | 4011 case ButtonPressed: |
| 4012 case ButtonReleased: | |
| 771 | 4013 f = x_window_to_frame (event.window); |
| 4014 if (f) | |
| 286 | 4015 { |
| 771 | 4016 if (event.window == f->display.x->icon_desc) |
| 286 | 4017 { |
| 771 | 4018 x_make_frame_visible (f); |
| 286 | 4019 |
| 4020 if (warp_mouse_on_deiconify) | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4021 XWarpMouse (FRAME_X_WINDOW (f), 10, 10); |
| 286 | 4022 break; |
| 4023 } | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4024 if (event.window == FRAME_X_WINDOW (f)) |
| 286 | 4025 { |
| 771 | 4026 if (f->auto_raise) |
| 4027 x_raise_frame (f); | |
| 286 | 4028 } |
| 4029 } | |
| 4030 enqueue_event (&event, &x_mouse_queue); | |
| 4031 if (numchars >= 2) | |
| 4032 { | |
| 4033 bufp->kind = ascii_keystroke; | |
|
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
4034 bufp->code = 'X' & 037; /* C-x */ |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
4035 XSET (bufp->frame_or_window, Lisp_Frame, f); |
| 429 | 4036 XSET (bufp->time, Lisp_Int, event.xkey.time); |
| 286 | 4037 bufp++; |
| 4038 | |
| 4039 bufp->kind = ascii_keystroke; | |
|
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
4040 bufp->code = 0; /* C-@ */ |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
4041 XSET (bufp->frame_or_window, Lisp_Frame, f); |
| 429 | 4042 XSET (bufp->time, Lisp_Int, event.xkey.time); |
| 286 | 4043 bufp++; |
| 4044 | |
| 4045 count += 2; | |
| 4046 numchars -= 2; | |
| 4047 } | |
| 4048 break; | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4049 #endif /* ! defined (HAVE_X11) */ |
| 286 | 4050 |
| 4051 #ifdef HAVE_X11 | |
| 4052 | |
| 4053 case CirculateNotify: | |
| 4054 break; | |
| 4055 case CirculateRequest: | |
| 4056 break; | |
| 4057 | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4058 #endif /* ! defined (HAVE_X11) */ |
| 286 | 4059 |
| 4060 case MappingNotify: | |
|
1436
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
4061 /* Someone has changed the keyboard mapping - update the |
|
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
4062 local cache. */ |
|
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
4063 switch (event.xmapping.request) |
|
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
4064 { |
|
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
4065 case MappingModifier: |
|
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
4066 x_find_modifier_meanings (); |
|
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
4067 /* This is meant to fall through. */ |
|
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
4068 case MappingKeyboard: |
|
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
4069 XRefreshKeyboardMapping (&event.xmapping); |
|
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
4070 } |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
4071 #ifdef USE_X_TOOLKIT |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
4072 goto OTHER; |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
4073 #endif /* USE_X_TOOLKIT */ |
| 286 | 4074 break; |
| 4075 | |
| 4076 default: | |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
4077 #ifdef USE_X_TOOLKIT |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
4078 OTHER: |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
4079 BLOCK_INPUT; |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
4080 XtDispatchEvent (&event); |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
4081 UNBLOCK_INPUT; |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
4082 #endif /* USE_X_TOOLKIT */ |
| 286 | 4083 break; |
| 4084 } | |
| 4085 } | |
| 4086 | |
|
5753
eb44ecad5557
(XTread_socket): Add X_IO_BUG conditional.
Richard M. Stallman <rms@gnu.org>
parents:
5740
diff
changeset
|
4087 #ifdef X_IO_BUG |
|
eb44ecad5557
(XTread_socket): Add X_IO_BUG conditional.
Richard M. Stallman <rms@gnu.org>
parents:
5740
diff
changeset
|
4088 if (! event_found) |
|
eb44ecad5557
(XTread_socket): Add X_IO_BUG conditional.
Richard M. Stallman <rms@gnu.org>
parents:
5740
diff
changeset
|
4089 /* On some systems, an X bug causes Emacs to get no more events |
|
5953
60f711724bc9
(XTread_socket): Do not assume that select returning
Richard M. Stallman <rms@gnu.org>
parents:
5916
diff
changeset
|
4090 when the window is destroyed. Detect that. (1994.) */ |
|
5753
eb44ecad5557
(XTread_socket): Add X_IO_BUG conditional.
Richard M. Stallman <rms@gnu.org>
parents:
5740
diff
changeset
|
4091 XNoOp (x_current_display); |
|
eb44ecad5557
(XTread_socket): Add X_IO_BUG conditional.
Richard M. Stallman <rms@gnu.org>
parents:
5740
diff
changeset
|
4092 #endif /* X_IO_BUG */ |
|
eb44ecad5557
(XTread_socket): Add X_IO_BUG conditional.
Richard M. Stallman <rms@gnu.org>
parents:
5740
diff
changeset
|
4093 |
|
5953
60f711724bc9
(XTread_socket): Do not assume that select returning
Richard M. Stallman <rms@gnu.org>
parents:
5916
diff
changeset
|
4094 #if 0 /* This fails for serial-line connections to the X server, |
|
60f711724bc9
(XTread_socket): Do not assume that select returning
Richard M. Stallman <rms@gnu.org>
parents:
5916
diff
changeset
|
4095 because the characters arrive one by one, and a partial |
|
60f711724bc9
(XTread_socket): Do not assume that select returning
Richard M. Stallman <rms@gnu.org>
parents:
5916
diff
changeset
|
4096 command makes select return but gives nothing to read. |
|
60f711724bc9
(XTread_socket): Do not assume that select returning
Richard M. Stallman <rms@gnu.org>
parents:
5916
diff
changeset
|
4097 We'll have to hope that the bug that this tried to fix |
|
60f711724bc9
(XTread_socket): Do not assume that select returning
Richard M. Stallman <rms@gnu.org>
parents:
5916
diff
changeset
|
4098 in 1988 has been fixed in Xlib or the X server. */ |
| 286 | 4099 #ifdef HAVE_SELECT |
| 4100 if (expected && ! event_found) | |
| 4101 { | |
| 4102 /* AOJ 880406: if select returns true but XPending doesn't, it means that | |
| 4103 there is an EOF condition; in other words, that X has died. | |
| 4104 Act as if there had been a hangup. */ | |
| 4105 int fd = ConnectionNumber (x_current_display); | |
|
5357
b36dfc938ba4
(XTread_socket): Make proper junk values to pass to select.
Richard M. Stallman <rms@gnu.org>
parents:
5354
diff
changeset
|
4106 SELECT_TYPE mask, junk1, junk2; |
|
3938
83d870a52936
* xterm.c (XTread_socket): Initialize event_found to zero, and
Jim Blandy <jimb@redhat.com>
parents:
3924
diff
changeset
|
4107 EMACS_TIME timeout; |
|
3924
44fe472b66ba
* xterm.c: Add CPP tangle from process.c to get definitions for
Jim Blandy <jimb@redhat.com>
parents:
3890
diff
changeset
|
4108 |
|
4683
6a5197116086
(x_term_init): Call change_keyboard_wait_descriptor,
Richard M. Stallman <rms@gnu.org>
parents:
4630
diff
changeset
|
4109 FD_ZERO (&mask); |
|
6a5197116086
(x_term_init): Call change_keyboard_wait_descriptor,
Richard M. Stallman <rms@gnu.org>
parents:
4630
diff
changeset
|
4110 FD_SET (fd, &mask); |
|
3938
83d870a52936
* xterm.c (XTread_socket): Initialize event_found to zero, and
Jim Blandy <jimb@redhat.com>
parents:
3924
diff
changeset
|
4111 EMACS_SET_SECS_USECS (timeout, 0, 0); |
|
5357
b36dfc938ba4
(XTread_socket): Make proper junk values to pass to select.
Richard M. Stallman <rms@gnu.org>
parents:
5354
diff
changeset
|
4112 FD_ZERO (&junk1); |
|
b36dfc938ba4
(XTread_socket): Make proper junk values to pass to select.
Richard M. Stallman <rms@gnu.org>
parents:
5354
diff
changeset
|
4113 FD_ZERO (&junk2); |
|
b36dfc938ba4
(XTread_socket): Make proper junk values to pass to select.
Richard M. Stallman <rms@gnu.org>
parents:
5354
diff
changeset
|
4114 if (0 != select (fd + 1, &mask, &junk1, &junk2, &timeout) |
| 286 | 4115 && !XStuffPending ()) |
| 4116 kill (getpid (), SIGHUP); | |
| 4117 } | |
|
4683
6a5197116086
(x_term_init): Call change_keyboard_wait_descriptor,
Richard M. Stallman <rms@gnu.org>
parents:
4630
diff
changeset
|
4118 #endif /* HAVE_SELECT */ |
|
5953
60f711724bc9
(XTread_socket): Do not assume that select returning
Richard M. Stallman <rms@gnu.org>
parents:
5916
diff
changeset
|
4119 #endif /* 0 */ |
| 286 | 4120 |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
4121 #ifndef HAVE_X11 |
| 771 | 4122 if (updating_frame == 0) |
| 286 | 4123 x_do_pending_expose (); |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
4124 #endif |
| 286 | 4125 |
| 4126 UNBLOCK_INPUT; | |
| 4127 return count; | |
| 4128 } | |
| 4129 | |
| 4130 #ifndef HAVE_X11 | |
| 4131 /* Read and process only Expose events | |
| 4132 until we get an ExposeCopy event; then return. | |
| 4133 This is used in insert/delete line. | |
| 4134 We assume input is already blocked. */ | |
| 4135 | |
| 4136 static void | |
| 4137 x_read_exposes () | |
| 4138 { | |
| 771 | 4139 struct frame *f; |
| 286 | 4140 XKeyPressedEvent event; |
| 4141 | |
| 4142 while (1) | |
| 4143 { | |
| 4144 /* while there are more events*/ | |
| 4145 XMaskEvent (ExposeWindow | ExposeRegion | ExposeCopy, &event); | |
| 4146 switch (event.type) | |
| 4147 { | |
| 4148 case ExposeWindow: | |
| 4149 if (event.subwindow != 0) | |
| 4150 break; /* duplicate event */ | |
| 771 | 4151 f = x_window_to_frame (event.window); |
| 4152 if (event.window == f->display.x->icon_desc) | |
| 286 | 4153 { |
| 771 | 4154 refreshicon (f); |
| 286 | 4155 break; |
| 4156 } | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4157 if (event.window == FRAME_X_WINDOW (f)) |
| 286 | 4158 { |
| 4159 expose_all_windows = 1; | |
| 771 | 4160 f->display.x->needs_exposure = 1; |
| 286 | 4161 break; |
| 4162 } | |
| 4163 break; | |
| 4164 | |
| 4165 case ExposeRegion: | |
| 4166 if (event.subwindow != 0) | |
| 4167 break; /* duplicate event */ | |
| 771 | 4168 f = x_window_to_frame (event.window); |
| 4169 if (event.window == f->display.x->icon_desc) | |
| 286 | 4170 { |
| 771 | 4171 refreshicon (f); |
| 286 | 4172 break; |
| 4173 } | |
| 4174 /* If window already needs full redraw, ignore this rectangle. */ | |
| 771 | 4175 if (expose_all_windows && f->display.x->needs_exposure) |
| 286 | 4176 break; |
| 4177 /* Put the event on the queue of rectangles to redraw. */ | |
| 4178 if (enqueue_event (&event, &x_expose_queue)) | |
| 4179 /* If it is full, we can't record the rectangle, | |
| 4180 so redraw this entire window. */ | |
| 4181 { | |
| 4182 /* Say must check all windows' needs_exposure flags. */ | |
| 4183 expose_all_windows = 1; | |
| 771 | 4184 f->display.x->needs_exposure = 1; |
| 286 | 4185 } |
| 4186 break; | |
| 4187 | |
| 4188 case ExposeCopy: | |
| 4189 return; | |
| 4190 } | |
| 4191 } | |
| 4192 } | |
| 4193 #endif /* HAVE_X11 */ | |
| 4194 | |
| 4195 | |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
4196 /* Drawing the cursor. */ |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
4197 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
4198 |
| 286 | 4199 /* Draw a hollow box cursor. Don't change the inside of the box. */ |
| 4200 | |
| 4201 static void | |
| 771 | 4202 x_draw_box (f) |
| 4203 struct frame *f; | |
| 286 | 4204 { |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
4205 int left = CHAR_TO_PIXEL_COL (f, f->cursor_x); |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
4206 int top = CHAR_TO_PIXEL_ROW (f, f->cursor_y); |
| 771 | 4207 int width = FONT_WIDTH (f->display.x->font); |
| 4208 int height = FONT_HEIGHT (f->display.x->font); | |
| 286 | 4209 |
| 4210 #ifdef HAVE_X11 | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4211 XDrawRectangle (x_current_display, FRAME_X_WINDOW (f), |
| 771 | 4212 f->display.x->cursor_gc, |
| 286 | 4213 left, top, width - 1, height - 1); |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4214 #else /* ! defined (HAVE_X11) */ |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4215 XPixSet (FRAME_X_WINDOW (f), |
| 286 | 4216 left, top, width, 1, |
| 771 | 4217 f->display.x->cursor_pixel); |
| 4218 | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4219 XPixSet (FRAME_X_WINDOW (f), |
| 286 | 4220 left, top, 1, height, |
| 771 | 4221 f->display.x->cursor_pixel); |
| 4222 | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4223 XPixSet (FRAME_X_WINDOW (f), |
| 286 | 4224 left+width-1, top, 1, height, |
| 771 | 4225 f->display.x->cursor_pixel); |
| 4226 | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4227 XPixSet (FRAME_X_WINDOW (f), |
| 286 | 4228 left, top+height-1, width, 1, |
| 771 | 4229 f->display.x->cursor_pixel); |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4230 #endif /* ! defined (HAVE_X11) */ |
| 286 | 4231 } |
| 4232 | |
| 771 | 4233 /* Clear the cursor of frame F to background color, |
| 286 | 4234 and mark the cursor as not shown. |
| 4235 This is used when the text where the cursor is | |
| 4236 is about to be rewritten. */ | |
| 4237 | |
| 4238 static void | |
| 771 | 4239 clear_cursor (f) |
| 4240 struct frame *f; | |
| 286 | 4241 { |
| 4242 int mask; | |
| 4243 | |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
4244 if (! FRAME_VISIBLE_P (f) |
| 771 | 4245 || f->phys_cursor_x < 0) |
| 286 | 4246 return; |
| 4247 | |
| 4248 #ifdef HAVE_X11 | |
| 771 | 4249 x_display_cursor (f, 0); |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4250 #else /* ! defined (HAVE_X11) */ |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4251 XPixSet (FRAME_X_WINDOW (f), |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
4252 CHAR_TO_PIXEL_COL (f, f->phys_cursor_x), |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
4253 CHAR_TO_PIXEL_ROW (f, f->phys_cursor_y), |
| 771 | 4254 FONT_WIDTH (f->display.x->font), FONT_HEIGHT (f->display.x->font), |
| 4255 f->display.x->background_pixel); | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4256 #endif /* ! defined (HAVE_X11) */ |
| 771 | 4257 f->phys_cursor_x = -1; |
| 286 | 4258 } |
| 4259 | |
| 771 | 4260 /* Redraw the glyph at ROW, COLUMN on frame F, in the style |
| 429 | 4261 HIGHLIGHT. HIGHLIGHT is as defined for dumpglyphs. Return the |
| 4262 glyph drawn. */ | |
| 286 | 4263 |
| 4264 static void | |
| 771 | 4265 x_draw_single_glyph (f, row, column, glyph, highlight) |
| 4266 struct frame *f; | |
| 286 | 4267 int row, column; |
| 429 | 4268 GLYPH glyph; |
| 286 | 4269 int highlight; |
| 4270 { | |
| 771 | 4271 dumpglyphs (f, |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
4272 CHAR_TO_PIXEL_COL (f, column), |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
4273 CHAR_TO_PIXEL_ROW (f, row), |
|
2732
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
4274 &glyph, 1, highlight); |
| 286 | 4275 } |
| 4276 | |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4277 static void |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4278 x_display_bar_cursor (f, on) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4279 struct frame *f; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4280 int on; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4281 { |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4282 struct frame_glyphs *current_glyphs = FRAME_CURRENT_GLYPHS (f); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4283 |
|
2235
80e0d36bbb77
* xterm.c (x_display_box_cursor, x_display_bar_cursor): Don't
Jim Blandy <jimb@redhat.com>
parents:
2195
diff
changeset
|
4284 /* This is pointless on invisible frames, and dangerous on garbaged |
|
80e0d36bbb77
* xterm.c (x_display_box_cursor, x_display_bar_cursor): Don't
Jim Blandy <jimb@redhat.com>
parents:
2195
diff
changeset
|
4285 frames; in the latter case, the frame may be in the midst of |
|
80e0d36bbb77
* xterm.c (x_display_box_cursor, x_display_bar_cursor): Don't
Jim Blandy <jimb@redhat.com>
parents:
2195
diff
changeset
|
4286 changing its size, and curs_x and curs_y may be off the frame. */ |
|
80e0d36bbb77
* xterm.c (x_display_box_cursor, x_display_bar_cursor): Don't
Jim Blandy <jimb@redhat.com>
parents:
2195
diff
changeset
|
4287 if (! FRAME_VISIBLE_P (f) || FRAME_GARBAGED_P (f)) |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4288 return; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4289 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4290 if (! on && f->phys_cursor_x < 0) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4291 return; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4292 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4293 /* If we're not updating, then we want to use the current frame's |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4294 cursor position, not our local idea of where the cursor ought to be. */ |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4295 if (f != updating_frame) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4296 { |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4297 curs_x = FRAME_CURSOR_X (f); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4298 curs_y = FRAME_CURSOR_Y (f); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4299 } |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4300 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4301 /* If there is anything wrong with the current cursor state, remove it. */ |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4302 if (f->phys_cursor_x >= 0 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4303 && (!on |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4304 || f->phys_cursor_x != curs_x |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4305 || f->phys_cursor_y != curs_y |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4306 || f->display.x->current_cursor != bar_cursor)) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4307 { |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4308 /* Erase the cursor by redrawing the character underneath it. */ |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4309 x_draw_single_glyph (f, f->phys_cursor_y, f->phys_cursor_x, |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4310 f->phys_cursor_glyph, |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4311 current_glyphs->highlight[f->phys_cursor_y]); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4312 f->phys_cursor_x = -1; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4313 } |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4314 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4315 /* If we now need a cursor in the new place or in the new form, do it so. */ |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4316 if (on |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4317 && (f->phys_cursor_x < 0 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4318 || (f->display.x->current_cursor != bar_cursor))) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4319 { |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4320 f->phys_cursor_glyph |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4321 = ((current_glyphs->enable[curs_y] |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4322 && curs_x < current_glyphs->used[curs_y]) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4323 ? current_glyphs->glyphs[curs_y][curs_x] |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4324 : SPACEGLYPH); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4325 XFillRectangle (x_current_display, FRAME_X_WINDOW (f), |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4326 f->display.x->cursor_gc, |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4327 CHAR_TO_PIXEL_COL (f, curs_x), |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4328 CHAR_TO_PIXEL_ROW (f, curs_y), |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4329 1, FONT_HEIGHT (f->display.x->font)); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4330 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4331 f->phys_cursor_x = curs_x; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4332 f->phys_cursor_y = curs_y; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4333 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4334 f->display.x->current_cursor = bar_cursor; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4335 } |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4336 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4337 if (updating_frame != f) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4338 XFlushQueue (); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4339 } |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4340 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4341 |
| 771 | 4342 /* Turn the displayed cursor of frame F on or off according to ON. |
| 286 | 4343 If ON is nonzero, where to put the cursor is specified |
| 771 | 4344 by F->cursor_x and F->cursor_y. */ |
| 286 | 4345 |
| 4346 static void | |
| 771 | 4347 x_display_box_cursor (f, on) |
| 4348 struct frame *f; | |
| 286 | 4349 int on; |
| 4350 { | |
| 771 | 4351 struct frame_glyphs *current_glyphs = FRAME_CURRENT_GLYPHS (f); |
| 4352 | |
|
2235
80e0d36bbb77
* xterm.c (x_display_box_cursor, x_display_bar_cursor): Don't
Jim Blandy <jimb@redhat.com>
parents:
2195
diff
changeset
|
4353 /* This is pointless on invisible frames, and dangerous on garbaged |
|
80e0d36bbb77
* xterm.c (x_display_box_cursor, x_display_bar_cursor): Don't
Jim Blandy <jimb@redhat.com>
parents:
2195
diff
changeset
|
4354 frames; in the latter case, the frame may be in the midst of |
|
80e0d36bbb77
* xterm.c (x_display_box_cursor, x_display_bar_cursor): Don't
Jim Blandy <jimb@redhat.com>
parents:
2195
diff
changeset
|
4355 changing its size, and curs_x and curs_y may be off the frame. */ |
|
80e0d36bbb77
* xterm.c (x_display_box_cursor, x_display_bar_cursor): Don't
Jim Blandy <jimb@redhat.com>
parents:
2195
diff
changeset
|
4356 if (! FRAME_VISIBLE_P (f) || FRAME_GARBAGED_P (f)) |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4357 return; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4358 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4359 /* If cursor is off and we want it off, return quickly. */ |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4360 if (!on && f->phys_cursor_x < 0) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4361 return; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4362 |
| 771 | 4363 /* If we're not updating, then we want to use the current frame's |
| 708 | 4364 cursor position, not our local idea of where the cursor ought to be. */ |
| 771 | 4365 if (f != updating_frame) |
| 708 | 4366 { |
| 771 | 4367 curs_x = FRAME_CURSOR_X (f); |
| 4368 curs_y = FRAME_CURSOR_Y (f); | |
| 708 | 4369 } |
| 4370 | |
| 286 | 4371 /* If cursor is currently being shown and we don't want it to be |
| 4372 or it is in the wrong place, | |
| 4373 or we want a hollow box and it's not so, (pout!) | |
| 4374 erase it. */ | |
| 771 | 4375 if (f->phys_cursor_x >= 0 |
| 286 | 4376 && (!on |
| 771 | 4377 || f->phys_cursor_x != curs_x |
| 4378 || f->phys_cursor_y != curs_y | |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4379 || (f->display.x->current_cursor != hollow_box_cursor |
| 771 | 4380 && (f != x_highlight_frame)))) |
| 286 | 4381 { |
| 4382 /* Erase the cursor by redrawing the character underneath it. */ | |
| 771 | 4383 x_draw_single_glyph (f, f->phys_cursor_y, f->phys_cursor_x, |
| 4384 f->phys_cursor_glyph, | |
| 4385 current_glyphs->highlight[f->phys_cursor_y]); | |
| 4386 f->phys_cursor_x = -1; | |
| 286 | 4387 } |
| 4388 | |
| 4389 /* If we want to show a cursor, | |
| 4390 or we want a box cursor and it's not so, | |
| 4391 write it in the right place. */ | |
| 4392 if (on | |
| 771 | 4393 && (f->phys_cursor_x < 0 |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4394 || (f->display.x->current_cursor != filled_box_cursor |
| 771 | 4395 && f == x_highlight_frame))) |
| 286 | 4396 { |
| 771 | 4397 f->phys_cursor_glyph |
| 708 | 4398 = ((current_glyphs->enable[curs_y] |
| 4399 && curs_x < current_glyphs->used[curs_y]) | |
| 4400 ? current_glyphs->glyphs[curs_y][curs_x] | |
| 429 | 4401 : SPACEGLYPH); |
| 771 | 4402 if (f != x_highlight_frame) |
| 286 | 4403 { |
| 771 | 4404 x_draw_box (f); |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4405 f->display.x->current_cursor = hollow_box_cursor; |
| 286 | 4406 } |
| 4407 else | |
| 4408 { | |
| 771 | 4409 x_draw_single_glyph (f, curs_y, curs_x, |
| 4410 f->phys_cursor_glyph, 2); | |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4411 f->display.x->current_cursor = filled_box_cursor; |
| 286 | 4412 } |
| 4413 | |
| 771 | 4414 f->phys_cursor_x = curs_x; |
| 4415 f->phys_cursor_y = curs_y; | |
| 286 | 4416 } |
| 4417 | |
| 771 | 4418 if (updating_frame != f) |
| 286 | 4419 XFlushQueue (); |
| 4420 } | |
| 4421 | |
| 771 | 4422 x_display_cursor (f, on) |
| 4423 struct frame *f; | |
| 286 | 4424 int on; |
| 4425 { | |
|
5872
6389c826f847
(x_display_cursor, process_expose_from_menu): Block input.
Karl Heuer <kwzh@gnu.org>
parents:
5825
diff
changeset
|
4426 BLOCK_INPUT; |
|
6389c826f847
(x_display_cursor, process_expose_from_menu): Block input.
Karl Heuer <kwzh@gnu.org>
parents:
5825
diff
changeset
|
4427 |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4428 if (FRAME_DESIRED_CURSOR (f) == filled_box_cursor) |
| 771 | 4429 x_display_box_cursor (f, on); |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4430 else if (FRAME_DESIRED_CURSOR (f) == bar_cursor) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4431 x_display_bar_cursor (f, on); |
| 286 | 4432 else |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4433 /* Those are the only two we have implemented! */ |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4434 abort (); |
|
5872
6389c826f847
(x_display_cursor, process_expose_from_menu): Block input.
Karl Heuer <kwzh@gnu.org>
parents:
5825
diff
changeset
|
4435 |
|
6389c826f847
(x_display_cursor, process_expose_from_menu): Block input.
Karl Heuer <kwzh@gnu.org>
parents:
5825
diff
changeset
|
4436 UNBLOCK_INPUT; |
| 286 | 4437 } |
| 4438 | |
| 4439 /* Icons. */ | |
| 4440 | |
| 771 | 4441 /* Refresh bitmap kitchen sink icon for frame F |
| 286 | 4442 when we get an expose event for it. */ |
| 4443 | |
| 771 | 4444 refreshicon (f) |
| 4445 struct frame *f; | |
| 286 | 4446 { |
| 4447 #ifdef HAVE_X11 | |
| 4448 /* Normally, the window manager handles this function. */ | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4449 #else /* ! defined (HAVE_X11) */ |
| 286 | 4450 int mask; |
| 4451 | |
| 771 | 4452 if (f->display.x->icon_bitmap_flag) |
| 4453 XBitmapBitsPut (f->display.x->icon_desc, 0, 0, sink_width, sink_height, | |
| 286 | 4454 sink_bits, BlackPixel, WHITE_PIX_DEFAULT, |
| 4455 icon_bitmap, GXcopy, AllPlanes); | |
| 4456 else | |
| 4457 { | |
| 771 | 4458 extern struct frame *selected_frame; |
| 286 | 4459 struct Lisp_String *str; |
| 4460 unsigned char *string; | |
| 4461 | |
| 4462 string | |
| 771 | 4463 = XSTRING (XBUFFER (XWINDOW (f->selected_window)->buffer)->name)->data; |
| 4464 | |
| 4465 if (f->display.x->icon_label != string) | |
| 286 | 4466 { |
| 771 | 4467 f->display.x->icon_label = string; |
| 4468 XChangeWindow (f->display.x->icon_desc, | |
| 286 | 4469 XQueryWidth (string, icon_font_info->id) + 10, |
| 4470 icon_font_info->height + 10); | |
| 4471 } | |
| 4472 | |
| 771 | 4473 XText (f->display.x->icon_desc, 5, 5, string, |
| 286 | 4474 str->size, icon_font_info->id, |
| 4475 BLACK_PIX_DEFAULT, WHITE_PIX_DEFAULT); | |
| 4476 } | |
| 4477 XFlushQueue (); | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4478 #endif /* ! defined (HAVE_X11) */ |
| 286 | 4479 } |
| 4480 | |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4481 /* Make the x-window of frame F use the gnu icon bitmap. */ |
| 286 | 4482 |
| 4483 int | |
| 771 | 4484 x_bitmap_icon (f) |
| 4485 struct frame *f; | |
| 286 | 4486 { |
| 4487 int mask; | |
| 4488 Window icon_window; | |
| 4489 | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4490 if (FRAME_X_WINDOW (f) == 0) |
| 286 | 4491 return 1; |
| 4492 | |
| 4493 #ifdef HAVE_X11 | |
|
3282
a3c8d3866d01
(x_bitmap_icon): Don't free icon_bitmap;
Richard M. Stallman <rms@gnu.org>
parents:
3272
diff
changeset
|
4494 if (! icon_bitmap) |
|
a3c8d3866d01
(x_bitmap_icon): Don't free icon_bitmap;
Richard M. Stallman <rms@gnu.org>
parents:
3272
diff
changeset
|
4495 icon_bitmap = |
|
a3c8d3866d01
(x_bitmap_icon): Don't free icon_bitmap;
Richard M. Stallman <rms@gnu.org>
parents:
3272
diff
changeset
|
4496 XCreateBitmapFromData (x_current_display, FRAME_X_WINDOW (f), |
|
a3c8d3866d01
(x_bitmap_icon): Don't free icon_bitmap;
Richard M. Stallman <rms@gnu.org>
parents:
3272
diff
changeset
|
4497 gnu_bits, gnu_width, gnu_height); |
| 771 | 4498 x_wm_set_icon_pixmap (f, icon_bitmap); |
| 4499 f->display.x->icon_bitmap_flag = 1; | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4500 #else /* ! defined (HAVE_X11) */ |
| 771 | 4501 if (f->display.x->icon_desc) |
| 286 | 4502 { |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4503 XClearIconWindow (FRAME_X_WINDOW (f)); |
| 771 | 4504 XDestroyWindow (f->display.x->icon_desc); |
| 286 | 4505 } |
| 4506 | |
| 771 | 4507 icon_window = XCreateWindow (f->display.x->parent_desc, |
| 286 | 4508 0, 0, sink_width, sink_height, |
| 4509 2, WhitePixmap, (Pixmap) NULL); | |
| 4510 | |
| 4511 if (icon_window == 0) | |
| 4512 return 1; | |
| 4513 | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4514 XSetIconWindow (FRAME_X_WINDOW (f), icon_window); |
| 286 | 4515 XSelectInput (icon_window, ExposeWindow | UnmapWindow); |
| 4516 | |
| 771 | 4517 f->display.x->icon_desc = icon_window; |
| 4518 f->display.x->icon_bitmap_flag = 1; | |
| 286 | 4519 |
| 4520 if (icon_bitmap == 0) | |
| 4521 icon_bitmap | |
| 4522 = XStoreBitmap (sink_mask_width, sink_mask_height, sink_mask_bits); | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4523 #endif /* ! defined (HAVE_X11) */ |
| 286 | 4524 |
| 4525 return 0; | |
| 4526 } | |
| 4527 | |
| 4528 | |
| 771 | 4529 /* Make the x-window of frame F use a rectangle with text. */ |
| 286 | 4530 |
| 4531 int | |
| 771 | 4532 x_text_icon (f, icon_name) |
| 4533 struct frame *f; | |
| 286 | 4534 char *icon_name; |
| 4535 { | |
| 4536 #ifndef HAVE_X11 | |
| 4537 int mask; | |
| 4538 int width; | |
| 4539 Window icon_window; | |
| 4540 char *X_DefaultValue; | |
| 4541 Bitmap b1; | |
| 4542 | |
| 4543 #ifndef WhitePixel | |
| 4544 #define WhitePixel 1 | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4545 #endif /* WhitePixel */ |
| 286 | 4546 |
| 4547 #ifndef BlackPixel | |
| 4548 #define BlackPixel 0 | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4549 #endif /* BlackPixel */ |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4550 #endif /* HAVE_X11 */ |
| 286 | 4551 |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4552 if (FRAME_X_WINDOW (f) == 0) |
| 286 | 4553 return 1; |
| 4554 | |
| 4555 #ifdef HAVE_X11 | |
| 4556 if (icon_name) | |
| 771 | 4557 f->display.x->icon_label = icon_name; |
| 286 | 4558 else |
| 771 | 4559 if (! f->display.x->icon_label) |
| 4560 f->display.x->icon_label = " *emacs* "; | |
| 286 | 4561 |
|
2661
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
4562 #if 0 |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4563 XSetIconName (x_current_display, FRAME_X_WINDOW (f), |
| 771 | 4564 (char *) f->display.x->icon_label); |
|
2661
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
4565 #endif |
| 286 | 4566 |
| 771 | 4567 f->display.x->icon_bitmap_flag = 0; |
|
976
cbdfc337ec8f
* xterm.c (x_wm_hints): New variable.
Jim Blandy <jimb@redhat.com>
parents:
786
diff
changeset
|
4568 x_wm_set_icon_pixmap (f, 0); |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4569 #else /* ! defined (HAVE_X11) */ |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4570 if (icon_font_info == 0) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4571 icon_font_info |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4572 = XGetFont (XGetDefault (XDISPLAY |
|
2279
012b04efa234
* emacs.c (Finvocation_name): New function.
Jim Blandy <jimb@redhat.com>
parents:
2235
diff
changeset
|
4573 (char *) XSTRING (Vinvocation_name)->data, |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4574 "BodyFont")); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4575 |
| 771 | 4576 if (f->display.x->icon_desc) |
| 286 | 4577 { |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4578 XClearIconWindow (XDISPLAY FRAME_X_WINDOW (f)); |
| 771 | 4579 XDestroyWindow (XDISPLAY f->display.x->icon_desc); |
| 286 | 4580 } |
| 4581 | |
| 4582 if (icon_name) | |
| 771 | 4583 f->display.x->icon_label = (unsigned char *) icon_name; |
| 286 | 4584 else |
| 771 | 4585 if (! f->display.x->icon_label) |
| 4586 f->display.x->icon_label = XSTRING (f->name)->data; | |
| 4587 | |
| 4588 width = XStringWidth (f->display.x->icon_label, icon_font_info, 0, 0); | |
| 4589 icon_window = XCreateWindow (f->display.x->parent_desc, | |
| 4590 f->display.x->left_pos, | |
| 4591 f->display.x->top_pos, | |
| 286 | 4592 width + 10, icon_font_info->height + 10, |
| 4593 2, BlackPixmap, WhitePixmap); | |
| 4594 | |
| 4595 if (icon_window == 0) | |
| 4596 return 1; | |
| 4597 | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4598 XSetIconWindow (FRAME_X_WINDOW (f), icon_window); |
| 286 | 4599 XSelectInput (icon_window, ExposeWindow | ExposeRegion | UnmapWindow | ButtonPressed); |
| 4600 | |
| 771 | 4601 f->display.x->icon_desc = icon_window; |
| 4602 f->display.x->icon_bitmap_flag = 0; | |
| 4603 f->display.x->icon_label = 0; | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4604 #endif /* ! defined (HAVE_X11) */ |
| 286 | 4605 |
| 4606 return 0; | |
| 4607 } | |
| 4608 | |
| 621 | 4609 /* Handling X errors. */ |
| 4610 | |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
4611 /* Shut down Emacs in an orderly fashion, because of a SIGPIPE on the |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
4612 X server's connection, or an error reported via the X protocol. */ |
|
1020
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
4613 |
| 621 | 4614 static SIGTYPE |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4615 x_connection_closed () |
| 621 | 4616 { |
| 4617 if (_Xdebug) | |
| 4618 abort (); | |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
4619 |
|
3710
38e8dc7fd1e8
(x_connection_closed): Pass new arg to shut_down_emacs.
Richard M. Stallman <rms@gnu.org>
parents:
3686
diff
changeset
|
4620 shut_down_emacs (0, 1, Qnil); |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
4621 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
4622 exit (70); |
| 621 | 4623 } |
| 4624 | |
|
1875
f569bc4e9b8f
* xterm.c (x_set_window_size): Call change_frame_size instead of
Jim Blandy <jimb@redhat.com>
parents:
1841
diff
changeset
|
4625 /* An X error handler which prints an error message and then kills |
|
f569bc4e9b8f
* xterm.c (x_set_window_size): Call change_frame_size instead of
Jim Blandy <jimb@redhat.com>
parents:
1841
diff
changeset
|
4626 Emacs. This is what's normally installed as Xlib's handler for |
|
f569bc4e9b8f
* xterm.c (x_set_window_size): Call change_frame_size instead of
Jim Blandy <jimb@redhat.com>
parents:
1841
diff
changeset
|
4627 protocol errors. */ |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4628 static int |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4629 x_error_quitter (display, error) |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4630 Display *display; |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4631 XErrorEvent *error; |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4632 { |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4633 char buf[256]; |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4634 |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4635 /* Note that there is no real way portable across R3/R4 to get the |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4636 original error handler. */ |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4637 |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4638 XGetErrorText (display, error->error_code, buf, sizeof (buf)); |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4639 fprintf (stderr, "X protocol error: %s on protocol request %d\n", |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4640 buf, error->request_code); |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4641 |
|
3683
568c8391744d
* xterm.c (x_error_quitter, x_io_error_quitter): Remove calls to
Jim Blandy <jimb@redhat.com>
parents:
3669
diff
changeset
|
4642 #if 0 |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
4643 /* While we're testing Emacs 19, we'll just dump core whenever we |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
4644 get an X error, so we can figure out why it happened. */ |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
4645 abort (); |
|
3683
568c8391744d
* xterm.c (x_error_quitter, x_io_error_quitter): Remove calls to
Jim Blandy <jimb@redhat.com>
parents:
3669
diff
changeset
|
4646 #endif |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
4647 |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4648 x_connection_closed (); |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4649 } |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4650 |
|
1875
f569bc4e9b8f
* xterm.c (x_set_window_size): Call change_frame_size instead of
Jim Blandy <jimb@redhat.com>
parents:
1841
diff
changeset
|
4651 /* A handler for X IO errors which prints an error message and then |
|
f569bc4e9b8f
* xterm.c (x_set_window_size): Call change_frame_size instead of
Jim Blandy <jimb@redhat.com>
parents:
1841
diff
changeset
|
4652 kills Emacs. This is what is always installed as Xlib's handler |
|
f569bc4e9b8f
* xterm.c (x_set_window_size): Call change_frame_size instead of
Jim Blandy <jimb@redhat.com>
parents:
1841
diff
changeset
|
4653 for I/O errors. */ |
|
f569bc4e9b8f
* xterm.c (x_set_window_size): Call change_frame_size instead of
Jim Blandy <jimb@redhat.com>
parents:
1841
diff
changeset
|
4654 static int |
|
f569bc4e9b8f
* xterm.c (x_set_window_size): Call change_frame_size instead of
Jim Blandy <jimb@redhat.com>
parents:
1841
diff
changeset
|
4655 x_io_error_quitter (display) |
|
f569bc4e9b8f
* xterm.c (x_set_window_size): Call change_frame_size instead of
Jim Blandy <jimb@redhat.com>
parents:
1841
diff
changeset
|
4656 Display *display; |
|
f569bc4e9b8f
* xterm.c (x_set_window_size): Call change_frame_size instead of
Jim Blandy <jimb@redhat.com>
parents:
1841
diff
changeset
|
4657 { |
|
f569bc4e9b8f
* xterm.c (x_set_window_size): Call change_frame_size instead of
Jim Blandy <jimb@redhat.com>
parents:
1841
diff
changeset
|
4658 fprintf (stderr, "Connection to X server %s lost.\n", |
|
f569bc4e9b8f
* xterm.c (x_set_window_size): Call change_frame_size instead of
Jim Blandy <jimb@redhat.com>
parents:
1841
diff
changeset
|
4659 XDisplayName (DisplayString (display))); |
|
f569bc4e9b8f
* xterm.c (x_set_window_size): Call change_frame_size instead of
Jim Blandy <jimb@redhat.com>
parents:
1841
diff
changeset
|
4660 |
|
3683
568c8391744d
* xterm.c (x_error_quitter, x_io_error_quitter): Remove calls to
Jim Blandy <jimb@redhat.com>
parents:
3669
diff
changeset
|
4661 #if 0 |
|
1875
f569bc4e9b8f
* xterm.c (x_set_window_size): Call change_frame_size instead of
Jim Blandy <jimb@redhat.com>
parents:
1841
diff
changeset
|
4662 /* While we're testing Emacs 19, we'll just dump core whenever we |
|
f569bc4e9b8f
* xterm.c (x_set_window_size): Call change_frame_size instead of
Jim Blandy <jimb@redhat.com>
parents:
1841
diff
changeset
|
4663 get an X error, so we can figure out why it happened. */ |
|
f569bc4e9b8f
* xterm.c (x_set_window_size): Call change_frame_size instead of
Jim Blandy <jimb@redhat.com>
parents:
1841
diff
changeset
|
4664 abort (); |
|
3683
568c8391744d
* xterm.c (x_error_quitter, x_io_error_quitter): Remove calls to
Jim Blandy <jimb@redhat.com>
parents:
3669
diff
changeset
|
4665 #endif |
|
1875
f569bc4e9b8f
* xterm.c (x_set_window_size): Call change_frame_size instead of
Jim Blandy <jimb@redhat.com>
parents:
1841
diff
changeset
|
4666 |
|
f569bc4e9b8f
* xterm.c (x_set_window_size): Call change_frame_size instead of
Jim Blandy <jimb@redhat.com>
parents:
1841
diff
changeset
|
4667 x_connection_closed (); |
|
f569bc4e9b8f
* xterm.c (x_set_window_size): Call change_frame_size instead of
Jim Blandy <jimb@redhat.com>
parents:
1841
diff
changeset
|
4668 } |
|
f569bc4e9b8f
* xterm.c (x_set_window_size): Call change_frame_size instead of
Jim Blandy <jimb@redhat.com>
parents:
1841
diff
changeset
|
4669 |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4670 /* A buffer for storing X error messages. */ |
|
3558
f7f187debe2d
(x_caught_error_message): Change type to char* from char*[].
Richard M. Stallman <rms@gnu.org>
parents:
3511
diff
changeset
|
4671 static char *x_caught_error_message; |
|
f7f187debe2d
(x_caught_error_message): Change type to char* from char*[].
Richard M. Stallman <rms@gnu.org>
parents:
3511
diff
changeset
|
4672 #define X_CAUGHT_ERROR_MESSAGE_SIZE 200 |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4673 |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4674 /* An X error handler which stores the error message in |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4675 x_caught_error_message. This is what's installed when |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4676 x_catch_errors is in effect. */ |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4677 static int |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4678 x_error_catcher (display, error) |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4679 Display *display; |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4680 XErrorEvent *error; |
| 286 | 4681 { |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4682 XGetErrorText (display, error->error_code, |
|
3558
f7f187debe2d
(x_caught_error_message): Change type to char* from char*[].
Richard M. Stallman <rms@gnu.org>
parents:
3511
diff
changeset
|
4683 x_caught_error_message, X_CAUGHT_ERROR_MESSAGE_SIZE); |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4684 } |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4685 |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4686 |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4687 /* Begin trapping X errors. |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4688 |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4689 After calling this function, X protocol errors no longer cause |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4690 Emacs to exit; instead, they are recorded in x_cfc_error_message. |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4691 |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4692 Calling x_check_errors signals an Emacs error if an X error has |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4693 occurred since the last call to x_catch_errors or x_check_errors. |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4694 |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4695 Calling x_uncatch_errors resumes the normal error handling. */ |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4696 |
|
5825
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
4697 void x_catch_errors (), x_check_errors (), x_uncatch_errors (); |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4698 |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4699 void |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4700 x_catch_errors () |
| 286 | 4701 { |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4702 /* Make sure any errors from previous requests have been dealt with. */ |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4703 XSync (x_current_display, False); |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4704 |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4705 /* Set up the error buffer. */ |
|
3465
d23de4338f96
(x_catch_errors): Fill in missing array size in cast.
Richard M. Stallman <rms@gnu.org>
parents:
3444
diff
changeset
|
4706 x_caught_error_message |
|
3558
f7f187debe2d
(x_caught_error_message): Change type to char* from char*[].
Richard M. Stallman <rms@gnu.org>
parents:
3511
diff
changeset
|
4707 = (char*) xmalloc (X_CAUGHT_ERROR_MESSAGE_SIZE); |
|
f7f187debe2d
(x_caught_error_message): Change type to char* from char*[].
Richard M. Stallman <rms@gnu.org>
parents:
3511
diff
changeset
|
4708 x_caught_error_message[0] = '\0'; |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4709 |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4710 /* Install our little error handler. */ |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4711 XHandleError (x_error_catcher); |
| 286 | 4712 } |
| 4713 | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4714 /* If any X protocol errors have arrived since the last call to |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4715 x_catch_errors or x_check_errors, signal an Emacs error using |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4716 sprintf (a buffer, FORMAT, the x error message text) as the text. */ |
| 5986 | 4717 |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4718 void |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4719 x_check_errors (format) |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4720 char *format; |
| 286 | 4721 { |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4722 /* Make sure to catch any errors incurred so far. */ |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4723 XSync (x_current_display, False); |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4724 |
|
3558
f7f187debe2d
(x_caught_error_message): Change type to char* from char*[].
Richard M. Stallman <rms@gnu.org>
parents:
3511
diff
changeset
|
4725 if (x_caught_error_message[0]) |
| 286 | 4726 { |
|
3558
f7f187debe2d
(x_caught_error_message): Change type to char* from char*[].
Richard M. Stallman <rms@gnu.org>
parents:
3511
diff
changeset
|
4727 char buf[X_CAUGHT_ERROR_MESSAGE_SIZE + 56]; |
|
f7f187debe2d
(x_caught_error_message): Change type to char* from char*[].
Richard M. Stallman <rms@gnu.org>
parents:
3511
diff
changeset
|
4728 |
|
f7f187debe2d
(x_caught_error_message): Change type to char* from char*[].
Richard M. Stallman <rms@gnu.org>
parents:
3511
diff
changeset
|
4729 sprintf (buf, format, x_caught_error_message); |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4730 x_uncatch_errors (); |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4731 error (buf); |
| 286 | 4732 } |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4733 } |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4734 |
|
6022
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
4735 /* Nonzero if we had any X protocol errors since we did x_catch_errors. */ |
|
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
4736 |
|
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
4737 int |
|
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
4738 x_had_errors_p () |
|
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
4739 { |
|
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
4740 /* Make sure to catch any errors incurred so far. */ |
|
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
4741 XSync (x_current_display, False); |
|
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
4742 |
|
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
4743 return x_caught_error_message[0] != 0; |
|
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
4744 } |
|
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
4745 |
| 5986 | 4746 /* Stop catching X protocol errors and let them make Emacs die. */ |
| 4747 | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4748 void |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4749 x_uncatch_errors () |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4750 { |
|
2439
b6c62e4abf59
Put interrupt input blocking in a separate file from xterm.h.
Jim Blandy <jimb@redhat.com>
parents:
2353
diff
changeset
|
4751 xfree (x_caught_error_message); |
|
3558
f7f187debe2d
(x_caught_error_message): Change type to char* from char*[].
Richard M. Stallman <rms@gnu.org>
parents:
3511
diff
changeset
|
4752 x_caught_error_message = 0; |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4753 XHandleError (x_error_quitter); |
| 286 | 4754 } |
| 4755 | |
| 4756 #if 0 | |
| 4757 static unsigned int x_wire_count; | |
| 4758 x_trace_wire () | |
| 4759 { | |
| 4760 fprintf (stderr, "Lib call: %d\n", ++x_wire_count); | |
| 4761 } | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4762 #endif /* ! 0 */ |
| 286 | 4763 |
| 4764 | |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
4765 /* Changing the font of the frame. */ |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
4766 |
| 771 | 4767 /* Set the font of the x-window specified by frame F |
| 286 | 4768 to the font named NEWNAME. This is safe to use |
| 771 | 4769 even before F has an actual x-window. */ |
| 286 | 4770 |
| 4771 #ifdef HAVE_X11 | |
| 4772 | |
|
4493
d0143beb12f0
(struct font_info): New structure.
Richard M. Stallman <rms@gnu.org>
parents:
4476
diff
changeset
|
4773 struct font_info |
|
d0143beb12f0
(struct font_info): New structure.
Richard M. Stallman <rms@gnu.org>
parents:
4476
diff
changeset
|
4774 { |
|
d0143beb12f0
(struct font_info): New structure.
Richard M. Stallman <rms@gnu.org>
parents:
4476
diff
changeset
|
4775 XFontStruct *font; |
|
d0143beb12f0
(struct font_info): New structure.
Richard M. Stallman <rms@gnu.org>
parents:
4476
diff
changeset
|
4776 char *name; |
|
d0143beb12f0
(struct font_info): New structure.
Richard M. Stallman <rms@gnu.org>
parents:
4476
diff
changeset
|
4777 }; |
|
d0143beb12f0
(struct font_info): New structure.
Richard M. Stallman <rms@gnu.org>
parents:
4476
diff
changeset
|
4778 |
| 286 | 4779 /* A table of all the fonts we have already loaded. */ |
|
4493
d0143beb12f0
(struct font_info): New structure.
Richard M. Stallman <rms@gnu.org>
parents:
4476
diff
changeset
|
4780 static struct font_info *x_font_table; |
| 286 | 4781 |
| 4782 /* The current capacity of x_font_table. */ | |
| 4783 static int x_font_table_size; | |
| 4784 | |
| 4785 /* The number of fonts actually stored in x_font_table. | |
| 4786 x_font_table[n] is used and valid iff 0 <= n < n_fonts. | |
| 4787 0 <= n_fonts <= x_font_table_size. */ | |
| 4788 static int n_fonts; | |
| 4789 | |
|
3076
e3b3c67cf203
Arrange for font names to get fully resolved - no wildcards.
Jim Blandy <jimb@redhat.com>
parents:
3066
diff
changeset
|
4790 Lisp_Object |
| 771 | 4791 x_new_font (f, fontname) |
| 4792 struct frame *f; | |
| 286 | 4793 register char *fontname; |
| 4794 { | |
| 4795 int already_loaded; | |
| 4796 int n_matching_fonts; | |
| 4797 XFontStruct *font_info; | |
| 4798 char **font_names; | |
| 4799 | |
| 4800 /* Get a list of all the fonts that match this name. Once we | |
| 4801 have a list of matching fonts, we compare them against the fonts | |
| 4802 we already have by comparing font ids. */ | |
|
4493
d0143beb12f0
(struct font_info): New structure.
Richard M. Stallman <rms@gnu.org>
parents:
4476
diff
changeset
|
4803 font_names = (char **) XListFonts (x_current_display, fontname, |
|
d0143beb12f0
(struct font_info): New structure.
Richard M. Stallman <rms@gnu.org>
parents:
4476
diff
changeset
|
4804 1024, &n_matching_fonts); |
|
3639
70a688f0cdae
* xterm.c (x_new_font): If font_names is zero, that's all the
Jim Blandy <jimb@redhat.com>
parents:
3591
diff
changeset
|
4805 /* Apparently it doesn't set n_matching_fonts to zero when it can't |
|
70a688f0cdae
* xterm.c (x_new_font): If font_names is zero, that's all the
Jim Blandy <jimb@redhat.com>
parents:
3591
diff
changeset
|
4806 find any matches; font_names == 0 is the only clue. */ |
|
70a688f0cdae
* xterm.c (x_new_font): If font_names is zero, that's all the
Jim Blandy <jimb@redhat.com>
parents:
3591
diff
changeset
|
4807 if (! font_names) |
|
70a688f0cdae
* xterm.c (x_new_font): If font_names is zero, that's all the
Jim Blandy <jimb@redhat.com>
parents:
3591
diff
changeset
|
4808 n_matching_fonts = 0; |
|
70a688f0cdae
* xterm.c (x_new_font): If font_names is zero, that's all the
Jim Blandy <jimb@redhat.com>
parents:
3591
diff
changeset
|
4809 |
|
3511
21fae09a3ad2
(x_new_font): Don't give up right away if XListFontsWithInfo
Richard M. Stallman <rms@gnu.org>
parents:
3465
diff
changeset
|
4810 /* Don't just give up if n_matching_fonts is 0. |
|
21fae09a3ad2
(x_new_font): Don't give up right away if XListFontsWithInfo
Richard M. Stallman <rms@gnu.org>
parents:
3465
diff
changeset
|
4811 Apparently there's a bug on Suns: XListFontsWithInfo can |
|
21fae09a3ad2
(x_new_font): Don't give up right away if XListFontsWithInfo
Richard M. Stallman <rms@gnu.org>
parents:
3465
diff
changeset
|
4812 fail to find a font, but XLoadQueryFont may still find it. */ |
| 286 | 4813 |
| 429 | 4814 /* See if we've already loaded a matching font. */ |
|
3511
21fae09a3ad2
(x_new_font): Don't give up right away if XListFontsWithInfo
Richard M. Stallman <rms@gnu.org>
parents:
3465
diff
changeset
|
4815 already_loaded = -1; |
|
21fae09a3ad2
(x_new_font): Don't give up right away if XListFontsWithInfo
Richard M. Stallman <rms@gnu.org>
parents:
3465
diff
changeset
|
4816 if (n_matching_fonts != 0) |
|
21fae09a3ad2
(x_new_font): Don't give up right away if XListFontsWithInfo
Richard M. Stallman <rms@gnu.org>
parents:
3465
diff
changeset
|
4817 { |
|
21fae09a3ad2
(x_new_font): Don't give up right away if XListFontsWithInfo
Richard M. Stallman <rms@gnu.org>
parents:
3465
diff
changeset
|
4818 int i, j; |
|
21fae09a3ad2
(x_new_font): Don't give up right away if XListFontsWithInfo
Richard M. Stallman <rms@gnu.org>
parents:
3465
diff
changeset
|
4819 |
|
21fae09a3ad2
(x_new_font): Don't give up right away if XListFontsWithInfo
Richard M. Stallman <rms@gnu.org>
parents:
3465
diff
changeset
|
4820 for (i = 0; i < n_fonts; i++) |
|
21fae09a3ad2
(x_new_font): Don't give up right away if XListFontsWithInfo
Richard M. Stallman <rms@gnu.org>
parents:
3465
diff
changeset
|
4821 for (j = 0; j < n_matching_fonts; j++) |
|
4493
d0143beb12f0
(struct font_info): New structure.
Richard M. Stallman <rms@gnu.org>
parents:
4476
diff
changeset
|
4822 if (!strcmp (x_font_table[i].name, font_names[j])) |
|
3511
21fae09a3ad2
(x_new_font): Don't give up right away if XListFontsWithInfo
Richard M. Stallman <rms@gnu.org>
parents:
3465
diff
changeset
|
4823 { |
|
21fae09a3ad2
(x_new_font): Don't give up right away if XListFontsWithInfo
Richard M. Stallman <rms@gnu.org>
parents:
3465
diff
changeset
|
4824 already_loaded = i; |
|
21fae09a3ad2
(x_new_font): Don't give up right away if XListFontsWithInfo
Richard M. Stallman <rms@gnu.org>
parents:
3465
diff
changeset
|
4825 fontname = font_names[j]; |
|
21fae09a3ad2
(x_new_font): Don't give up right away if XListFontsWithInfo
Richard M. Stallman <rms@gnu.org>
parents:
3465
diff
changeset
|
4826 goto found_font; |
|
21fae09a3ad2
(x_new_font): Don't give up right away if XListFontsWithInfo
Richard M. Stallman <rms@gnu.org>
parents:
3465
diff
changeset
|
4827 } |
|
21fae09a3ad2
(x_new_font): Don't give up right away if XListFontsWithInfo
Richard M. Stallman <rms@gnu.org>
parents:
3465
diff
changeset
|
4828 } |
| 286 | 4829 found_font: |
| 4830 | |
| 4831 /* If we have, just return it from the table. */ | |
|
4493
d0143beb12f0
(struct font_info): New structure.
Richard M. Stallman <rms@gnu.org>
parents:
4476
diff
changeset
|
4832 if (already_loaded >= 0) |
|
d0143beb12f0
(struct font_info): New structure.
Richard M. Stallman <rms@gnu.org>
parents:
4476
diff
changeset
|
4833 f->display.x->font = x_font_table[already_loaded].font; |
| 429 | 4834 |
| 286 | 4835 /* Otherwise, load the font and add it to the table. */ |
| 4836 else | |
| 4837 { | |
|
3016
ce9ea90b5848
* xterm.c (x_new_font): Reject fonts with varying spacing. We
Jim Blandy <jimb@redhat.com>
parents:
2982
diff
changeset
|
4838 int i; |
| 286 | 4839 XFontStruct *font; |
| 4840 | |
|
3016
ce9ea90b5848
* xterm.c (x_new_font): Reject fonts with varying spacing. We
Jim Blandy <jimb@redhat.com>
parents:
2982
diff
changeset
|
4841 /* Try to find a character-cell font in the list. */ |
|
3066
039cbddadc51
* xfaces.c (merge_faces): You can't tell if a font is a
Jim Blandy <jimb@redhat.com>
parents:
3045
diff
changeset
|
4842 #if 0 |
|
039cbddadc51
* xfaces.c (merge_faces): You can't tell if a font is a
Jim Blandy <jimb@redhat.com>
parents:
3045
diff
changeset
|
4843 /* A laudable goal, but this isn't how to do it. */ |
|
3016
ce9ea90b5848
* xterm.c (x_new_font): Reject fonts with varying spacing. We
Jim Blandy <jimb@redhat.com>
parents:
2982
diff
changeset
|
4844 for (i = 0; i < n_matching_fonts; i++) |
|
ce9ea90b5848
* xterm.c (x_new_font): Reject fonts with varying spacing. We
Jim Blandy <jimb@redhat.com>
parents:
2982
diff
changeset
|
4845 if (! font_info[i].per_char) |
|
ce9ea90b5848
* xterm.c (x_new_font): Reject fonts with varying spacing. We
Jim Blandy <jimb@redhat.com>
parents:
2982
diff
changeset
|
4846 break; |
|
3066
039cbddadc51
* xfaces.c (merge_faces): You can't tell if a font is a
Jim Blandy <jimb@redhat.com>
parents:
3045
diff
changeset
|
4847 #else |
|
039cbddadc51
* xfaces.c (merge_faces): You can't tell if a font is a
Jim Blandy <jimb@redhat.com>
parents:
3045
diff
changeset
|
4848 i = 0; |
|
039cbddadc51
* xfaces.c (merge_faces): You can't tell if a font is a
Jim Blandy <jimb@redhat.com>
parents:
3045
diff
changeset
|
4849 #endif |
|
3016
ce9ea90b5848
* xterm.c (x_new_font): Reject fonts with varying spacing. We
Jim Blandy <jimb@redhat.com>
parents:
2982
diff
changeset
|
4850 |
|
3511
21fae09a3ad2
(x_new_font): Don't give up right away if XListFontsWithInfo
Richard M. Stallman <rms@gnu.org>
parents:
3465
diff
changeset
|
4851 /* See comment above. */ |
|
21fae09a3ad2
(x_new_font): Don't give up right away if XListFontsWithInfo
Richard M. Stallman <rms@gnu.org>
parents:
3465
diff
changeset
|
4852 if (n_matching_fonts != 0) |
|
3016
ce9ea90b5848
* xterm.c (x_new_font): Reject fonts with varying spacing. We
Jim Blandy <jimb@redhat.com>
parents:
2982
diff
changeset
|
4853 fontname = font_names[i]; |
|
ce9ea90b5848
* xterm.c (x_new_font): Reject fonts with varying spacing. We
Jim Blandy <jimb@redhat.com>
parents:
2982
diff
changeset
|
4854 |
| 286 | 4855 font = (XFontStruct *) XLoadQueryFont (x_current_display, fontname); |
| 4856 if (! font) | |
|
3511
21fae09a3ad2
(x_new_font): Don't give up right away if XListFontsWithInfo
Richard M. Stallman <rms@gnu.org>
parents:
3465
diff
changeset
|
4857 { |
|
4493
d0143beb12f0
(struct font_info): New structure.
Richard M. Stallman <rms@gnu.org>
parents:
4476
diff
changeset
|
4858 /* Free the information from XListFonts. */ |
|
3511
21fae09a3ad2
(x_new_font): Don't give up right away if XListFontsWithInfo
Richard M. Stallman <rms@gnu.org>
parents:
3465
diff
changeset
|
4859 if (n_matching_fonts) |
|
4493
d0143beb12f0
(struct font_info): New structure.
Richard M. Stallman <rms@gnu.org>
parents:
4476
diff
changeset
|
4860 XFreeFontNames (font_names); |
|
3511
21fae09a3ad2
(x_new_font): Don't give up right away if XListFontsWithInfo
Richard M. Stallman <rms@gnu.org>
parents:
3465
diff
changeset
|
4861 return Qnil; |
|
21fae09a3ad2
(x_new_font): Don't give up right away if XListFontsWithInfo
Richard M. Stallman <rms@gnu.org>
parents:
3465
diff
changeset
|
4862 } |
| 286 | 4863 |
| 4864 /* Do we need to create the table? */ | |
| 4865 if (x_font_table_size == 0) | |
| 4866 { | |
| 4867 x_font_table_size = 16; | |
| 4868 x_font_table | |
|
4493
d0143beb12f0
(struct font_info): New structure.
Richard M. Stallman <rms@gnu.org>
parents:
4476
diff
changeset
|
4869 = (struct font_info *) xmalloc (x_font_table_size |
|
d0143beb12f0
(struct font_info): New structure.
Richard M. Stallman <rms@gnu.org>
parents:
4476
diff
changeset
|
4870 * sizeof (x_font_table[0])); |
| 286 | 4871 } |
| 4872 /* Do we need to grow the table? */ | |
| 4873 else if (n_fonts >= x_font_table_size) | |
| 4874 { | |
| 429 | 4875 x_font_table_size *= 2; |
| 286 | 4876 x_font_table |
|
4493
d0143beb12f0
(struct font_info): New structure.
Richard M. Stallman <rms@gnu.org>
parents:
4476
diff
changeset
|
4877 = (struct font_info *) xrealloc (x_font_table, |
|
d0143beb12f0
(struct font_info): New structure.
Richard M. Stallman <rms@gnu.org>
parents:
4476
diff
changeset
|
4878 (x_font_table_size |
|
d0143beb12f0
(struct font_info): New structure.
Richard M. Stallman <rms@gnu.org>
parents:
4476
diff
changeset
|
4879 * sizeof (x_font_table[0]))); |
| 286 | 4880 } |
| 4881 | |
|
4909
74ae77c7d742
(x_new_font): xmalloc arg was 1 too small.
Richard M. Stallman <rms@gnu.org>
parents:
4777
diff
changeset
|
4882 x_font_table[n_fonts].name = (char *) xmalloc (strlen (fontname) + 1); |
|
4493
d0143beb12f0
(struct font_info): New structure.
Richard M. Stallman <rms@gnu.org>
parents:
4476
diff
changeset
|
4883 bcopy (fontname, x_font_table[n_fonts].name, strlen (fontname) + 1); |
|
d0143beb12f0
(struct font_info): New structure.
Richard M. Stallman <rms@gnu.org>
parents:
4476
diff
changeset
|
4884 f->display.x->font = x_font_table[n_fonts++].font = font; |
| 286 | 4885 } |
|
4493
d0143beb12f0
(struct font_info): New structure.
Richard M. Stallman <rms@gnu.org>
parents:
4476
diff
changeset
|
4886 |
| 771 | 4887 /* Now make the frame display the given font. */ |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4888 if (FRAME_X_WINDOW (f) != 0) |
| 286 | 4889 { |
| 771 | 4890 XSetFont (x_current_display, f->display.x->normal_gc, |
| 4891 f->display.x->font->fid); | |
| 4892 XSetFont (x_current_display, f->display.x->reverse_gc, | |
| 4893 f->display.x->font->fid); | |
| 4894 XSetFont (x_current_display, f->display.x->cursor_gc, | |
| 4895 f->display.x->font->fid); | |
| 4896 | |
|
5825
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
4897 x_set_window_size (f, 0, f->width, f->height); |
| 286 | 4898 } |
| 4899 | |
|
3076
e3b3c67cf203
Arrange for font names to get fully resolved - no wildcards.
Jim Blandy <jimb@redhat.com>
parents:
3066
diff
changeset
|
4900 { |
|
6521
a975c5944916
(x_window_to_scroll_bar, x_new_font): Use assignment, not initialization.
Karl Heuer <kwzh@gnu.org>
parents:
6413
diff
changeset
|
4901 Lisp_Object lispy_name; |
|
a975c5944916
(x_window_to_scroll_bar, x_new_font): Use assignment, not initialization.
Karl Heuer <kwzh@gnu.org>
parents:
6413
diff
changeset
|
4902 |
|
a975c5944916
(x_window_to_scroll_bar, x_new_font): Use assignment, not initialization.
Karl Heuer <kwzh@gnu.org>
parents:
6413
diff
changeset
|
4903 lispy_name = build_string (fontname); |
|
3076
e3b3c67cf203
Arrange for font names to get fully resolved - no wildcards.
Jim Blandy <jimb@redhat.com>
parents:
3066
diff
changeset
|
4904 |
|
4493
d0143beb12f0
(struct font_info): New structure.
Richard M. Stallman <rms@gnu.org>
parents:
4476
diff
changeset
|
4905 /* Free the information from XListFonts. The data |
|
3076
e3b3c67cf203
Arrange for font names to get fully resolved - no wildcards.
Jim Blandy <jimb@redhat.com>
parents:
3066
diff
changeset
|
4906 we actually retain comes from XLoadQueryFont. */ |
|
4493
d0143beb12f0
(struct font_info): New structure.
Richard M. Stallman <rms@gnu.org>
parents:
4476
diff
changeset
|
4907 XFreeFontNames (font_names); |
|
3076
e3b3c67cf203
Arrange for font names to get fully resolved - no wildcards.
Jim Blandy <jimb@redhat.com>
parents:
3066
diff
changeset
|
4908 |
|
e3b3c67cf203
Arrange for font names to get fully resolved - no wildcards.
Jim Blandy <jimb@redhat.com>
parents:
3066
diff
changeset
|
4909 return lispy_name; |
|
e3b3c67cf203
Arrange for font names to get fully resolved - no wildcards.
Jim Blandy <jimb@redhat.com>
parents:
3066
diff
changeset
|
4910 } |
| 286 | 4911 } |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4912 #else /* ! defined (HAVE_X11) */ |
| 771 | 4913 x_new_font (f, newname) |
| 4914 struct frame *f; | |
| 286 | 4915 register char *newname; |
| 4916 { | |
| 4917 FONT_TYPE *temp; | |
| 4918 int mask; | |
| 4919 | |
| 4920 temp = XGetFont (newname); | |
| 4921 if (temp == (FONT_TYPE *) 0) | |
| 4922 return 1; | |
| 4923 | |
| 771 | 4924 if (f->display.x->font) |
| 4925 XLoseFont (f->display.x->font); | |
| 4926 | |
| 4927 f->display.x->font = temp; | |
| 4928 | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4929 if (FRAME_X_WINDOW (f) != 0) |
|
5825
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
4930 x_set_window_size (f, 0, f->width, f->height); |
| 286 | 4931 |
| 4932 return 0; | |
| 4933 } | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4934 #endif /* ! defined (HAVE_X11) */ |
| 286 | 4935 |
| 771 | 4936 x_calc_absolute_position (f) |
| 4937 struct frame *f; | |
| 286 | 4938 { |
| 4939 #ifdef HAVE_X11 | |
|
4630
70247ce8b381
(x_wm_set_size_hint): New args spec_x and spec_y.
Richard M. Stallman <rms@gnu.org>
parents:
4493
diff
changeset
|
4940 Window win, child; |
|
70247ce8b381
(x_wm_set_size_hint): New args spec_x and spec_y.
Richard M. Stallman <rms@gnu.org>
parents:
4493
diff
changeset
|
4941 int win_x = 0, win_y = 0; |
|
70247ce8b381
(x_wm_set_size_hint): New args spec_x and spec_y.
Richard M. Stallman <rms@gnu.org>
parents:
4493
diff
changeset
|
4942 |
|
70247ce8b381
(x_wm_set_size_hint): New args spec_x and spec_y.
Richard M. Stallman <rms@gnu.org>
parents:
4493
diff
changeset
|
4943 /* Find the position of the outside upper-left corner of |
|
70247ce8b381
(x_wm_set_size_hint): New args spec_x and spec_y.
Richard M. Stallman <rms@gnu.org>
parents:
4493
diff
changeset
|
4944 the inner window, with respect to the outer window. */ |
|
70247ce8b381
(x_wm_set_size_hint): New args spec_x and spec_y.
Richard M. Stallman <rms@gnu.org>
parents:
4493
diff
changeset
|
4945 if (f->display.x->parent_desc != ROOT_WINDOW) |
|
70247ce8b381
(x_wm_set_size_hint): New args spec_x and spec_y.
Richard M. Stallman <rms@gnu.org>
parents:
4493
diff
changeset
|
4946 { |
|
70247ce8b381
(x_wm_set_size_hint): New args spec_x and spec_y.
Richard M. Stallman <rms@gnu.org>
parents:
4493
diff
changeset
|
4947 BLOCK_INPUT; |
|
70247ce8b381
(x_wm_set_size_hint): New args spec_x and spec_y.
Richard M. Stallman <rms@gnu.org>
parents:
4493
diff
changeset
|
4948 XTranslateCoordinates (x_current_display, |
|
70247ce8b381
(x_wm_set_size_hint): New args spec_x and spec_y.
Richard M. Stallman <rms@gnu.org>
parents:
4493
diff
changeset
|
4949 |
|
70247ce8b381
(x_wm_set_size_hint): New args spec_x and spec_y.
Richard M. Stallman <rms@gnu.org>
parents:
4493
diff
changeset
|
4950 /* From-window, to-window. */ |
|
70247ce8b381
(x_wm_set_size_hint): New args spec_x and spec_y.
Richard M. Stallman <rms@gnu.org>
parents:
4493
diff
changeset
|
4951 f->display.x->window_desc, |
|
70247ce8b381
(x_wm_set_size_hint): New args spec_x and spec_y.
Richard M. Stallman <rms@gnu.org>
parents:
4493
diff
changeset
|
4952 f->display.x->parent_desc, |
|
70247ce8b381
(x_wm_set_size_hint): New args spec_x and spec_y.
Richard M. Stallman <rms@gnu.org>
parents:
4493
diff
changeset
|
4953 |
|
70247ce8b381
(x_wm_set_size_hint): New args spec_x and spec_y.
Richard M. Stallman <rms@gnu.org>
parents:
4493
diff
changeset
|
4954 /* From-position, to-position. */ |
|
70247ce8b381
(x_wm_set_size_hint): New args spec_x and spec_y.
Richard M. Stallman <rms@gnu.org>
parents:
4493
diff
changeset
|
4955 0, 0, &win_x, &win_y, |
|
70247ce8b381
(x_wm_set_size_hint): New args spec_x and spec_y.
Richard M. Stallman <rms@gnu.org>
parents:
4493
diff
changeset
|
4956 |
|
70247ce8b381
(x_wm_set_size_hint): New args spec_x and spec_y.
Richard M. Stallman <rms@gnu.org>
parents:
4493
diff
changeset
|
4957 /* Child of win. */ |
|
70247ce8b381
(x_wm_set_size_hint): New args spec_x and spec_y.
Richard M. Stallman <rms@gnu.org>
parents:
4493
diff
changeset
|
4958 &child); |
|
70247ce8b381
(x_wm_set_size_hint): New args spec_x and spec_y.
Richard M. Stallman <rms@gnu.org>
parents:
4493
diff
changeset
|
4959 UNBLOCK_INPUT; |
|
70247ce8b381
(x_wm_set_size_hint): New args spec_x and spec_y.
Richard M. Stallman <rms@gnu.org>
parents:
4493
diff
changeset
|
4960 } |
|
70247ce8b381
(x_wm_set_size_hint): New args spec_x and spec_y.
Richard M. Stallman <rms@gnu.org>
parents:
4493
diff
changeset
|
4961 |
|
70247ce8b381
(x_wm_set_size_hint): New args spec_x and spec_y.
Richard M. Stallman <rms@gnu.org>
parents:
4493
diff
changeset
|
4962 /* Treat negative positions as relative to the leftmost bottommost |
|
70247ce8b381
(x_wm_set_size_hint): New args spec_x and spec_y.
Richard M. Stallman <rms@gnu.org>
parents:
4493
diff
changeset
|
4963 position that fits on the screen. */ |
| 771 | 4964 if (f->display.x->left_pos < 0) |
|
3890
ab295012a818
* xterm.c (XTread_socket): Remove #if 0''s around code which tests
Jim Blandy <jimb@redhat.com>
parents:
3883
diff
changeset
|
4965 f->display.x->left_pos = (x_screen_width |
|
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
4966 - 2 * f->display.x->border_width - win_x |
|
3890
ab295012a818
* xterm.c (XTread_socket): Remove #if 0''s around code which tests
Jim Blandy <jimb@redhat.com>
parents:
3883
diff
changeset
|
4967 - PIXEL_WIDTH (f) |
|
ab295012a818
* xterm.c (XTread_socket): Remove #if 0''s around code which tests
Jim Blandy <jimb@redhat.com>
parents:
3883
diff
changeset
|
4968 + f->display.x->left_pos); |
| 771 | 4969 |
| 4970 if (f->display.x->top_pos < 0) | |
|
3890
ab295012a818
* xterm.c (XTread_socket): Remove #if 0''s around code which tests
Jim Blandy <jimb@redhat.com>
parents:
3883
diff
changeset
|
4971 f->display.x->top_pos = (x_screen_height |
|
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
4972 - 2 * f->display.x->border_width - win_y |
|
3890
ab295012a818
* xterm.c (XTread_socket): Remove #if 0''s around code which tests
Jim Blandy <jimb@redhat.com>
parents:
3883
diff
changeset
|
4973 - PIXEL_HEIGHT (f) |
|
ab295012a818
* xterm.c (XTread_socket): Remove #if 0''s around code which tests
Jim Blandy <jimb@redhat.com>
parents:
3883
diff
changeset
|
4974 + f->display.x->top_pos); |
|
4630
70247ce8b381
(x_wm_set_size_hint): New args spec_x and spec_y.
Richard M. Stallman <rms@gnu.org>
parents:
4493
diff
changeset
|
4975 |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4976 #else /* ! defined (HAVE_X11) */ |
| 286 | 4977 WINDOWINFO_TYPE parentinfo; |
| 4978 | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4979 XGetWindowInfo (FRAME_X_WINDOW (f), &parentinfo); |
| 771 | 4980 |
| 4981 if (f->display.x->left_pos < 0) | |
| 4982 f->display.x->left_pos = parentinfo.width + (f->display.x->left_pos + 1) | |
| 4983 - PIXEL_WIDTH (f) - 2 * f->display.x->internal_border_width; | |
| 4984 | |
| 4985 if (f->display.x->top_pos < 0) | |
| 4986 f->display.x->top_pos = parentinfo.height + (f->display.x->top_pos + 1) | |
| 4987 - PIXEL_HEIGHT (f) - 2 * f->display.x->internal_border_width; | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4988 #endif /* ! defined (HAVE_X11) */ |
| 286 | 4989 } |
| 4990 | |
| 771 | 4991 x_set_offset (f, xoff, yoff) |
| 4992 struct frame *f; | |
| 286 | 4993 register int xoff, yoff; |
| 4994 { | |
| 771 | 4995 f->display.x->top_pos = yoff; |
| 4996 f->display.x->left_pos = xoff; | |
| 4997 x_calc_absolute_position (f); | |
| 286 | 4998 |
| 4999 BLOCK_INPUT; | |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5000 #ifdef USE_X_TOOLKIT |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5001 XMoveWindow (XDISPLAY XtWindow (f->display.x->widget), |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5002 f->display.x->left_pos, f->display.x->top_pos); |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5003 #else /* not USE_X_TOOLKIT */ |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5004 XMoveWindow (XDISPLAY FRAME_X_WINDOW (f), |
| 771 | 5005 f->display.x->left_pos, f->display.x->top_pos); |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5006 #endif /* not USE_X_TOOLKIT */ |
| 286 | 5007 #ifdef HAVE_X11 |
|
5825
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5008 x_wm_set_size_hint (f, 0, 1, xoff, yoff); |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5009 #endif /* ! defined (HAVE_X11) */ |
| 286 | 5010 UNBLOCK_INPUT; |
| 5011 } | |
| 5012 | |
|
5825
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5013 /* Call this to change the size of frame F's x-window. |
|
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5014 If CHANGE_GRAVITY is 1, we change to top-left-corner window gravity |
|
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5015 for this size change and subsequent size changes. |
|
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5016 Otherwise we leave the window gravity unchanged. */ |
|
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5017 |
|
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5018 x_set_window_size (f, change_gravity, cols, rows) |
| 771 | 5019 struct frame *f; |
|
5825
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5020 int change_gravity; |
|
976
cbdfc337ec8f
* xterm.c (x_wm_hints): New variable.
Jim Blandy <jimb@redhat.com>
parents:
786
diff
changeset
|
5021 int cols, rows; |
| 286 | 5022 { |
| 5023 int pixelwidth, pixelheight; | |
| 5024 int mask; | |
| 5025 | |
|
5686
0c351de98a26
(x_set_window_size): Add USE_X_TOOLKIT conditional. Call EmacsFrameSetCharSize and return.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5685
diff
changeset
|
5026 #ifdef USE_X_TOOLKIT |
|
0c351de98a26
(x_set_window_size): Add USE_X_TOOLKIT conditional. Call EmacsFrameSetCharSize and return.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5685
diff
changeset
|
5027 BLOCK_INPUT; |
|
0c351de98a26
(x_set_window_size): Add USE_X_TOOLKIT conditional. Call EmacsFrameSetCharSize and return.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5685
diff
changeset
|
5028 EmacsFrameSetCharSize (f->display.x->edit_widget, cols, rows); |
|
0c351de98a26
(x_set_window_size): Add USE_X_TOOLKIT conditional. Call EmacsFrameSetCharSize and return.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5685
diff
changeset
|
5029 UNBLOCK_INPUT; |
|
0c351de98a26
(x_set_window_size): Add USE_X_TOOLKIT conditional. Call EmacsFrameSetCharSize and return.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5685
diff
changeset
|
5030 |
|
0c351de98a26
(x_set_window_size): Add USE_X_TOOLKIT conditional. Call EmacsFrameSetCharSize and return.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5685
diff
changeset
|
5031 #else /* not USE_X_TOOLKIT */ |
|
0c351de98a26
(x_set_window_size): Add USE_X_TOOLKIT conditional. Call EmacsFrameSetCharSize and return.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5685
diff
changeset
|
5032 |
| 286 | 5033 BLOCK_INPUT; |
| 5034 | |
|
976
cbdfc337ec8f
* xterm.c (x_wm_hints): New variable.
Jim Blandy <jimb@redhat.com>
parents:
786
diff
changeset
|
5035 check_frame_size (f, &rows, &cols); |
|
4630
70247ce8b381
(x_wm_set_size_hint): New args spec_x and spec_y.
Richard M. Stallman <rms@gnu.org>
parents:
4493
diff
changeset
|
5036 f->display.x->vertical_scroll_bar_extra |
|
70247ce8b381
(x_wm_set_size_hint): New args spec_x and spec_y.
Richard M. Stallman <rms@gnu.org>
parents:
4493
diff
changeset
|
5037 = (FRAME_HAS_VERTICAL_SCROLL_BARS (f) |
|
70247ce8b381
(x_wm_set_size_hint): New args spec_x and spec_y.
Richard M. Stallman <rms@gnu.org>
parents:
4493
diff
changeset
|
5038 ? VERTICAL_SCROLL_BAR_PIXEL_WIDTH (f) |
|
70247ce8b381
(x_wm_set_size_hint): New args spec_x and spec_y.
Richard M. Stallman <rms@gnu.org>
parents:
4493
diff
changeset
|
5039 : 0); |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
5040 pixelwidth = CHAR_TO_PIXEL_WIDTH (f, cols); |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
5041 pixelheight = CHAR_TO_PIXEL_HEIGHT (f, rows); |
| 286 | 5042 |
| 5043 #ifdef HAVE_X11 | |
|
5825
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5044 x_wm_set_size_hint (f, 0, change_gravity, 0, 0); |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5045 #endif /* ! defined (HAVE_X11) */ |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5046 XChangeWindowSize (FRAME_X_WINDOW (f), pixelwidth, pixelheight); |
|
976
cbdfc337ec8f
* xterm.c (x_wm_hints): New variable.
Jim Blandy <jimb@redhat.com>
parents:
786
diff
changeset
|
5047 |
|
cbdfc337ec8f
* xterm.c (x_wm_hints): New variable.
Jim Blandy <jimb@redhat.com>
parents:
786
diff
changeset
|
5048 /* Now, strictly speaking, we can't be sure that this is accurate, |
|
cbdfc337ec8f
* xterm.c (x_wm_hints): New variable.
Jim Blandy <jimb@redhat.com>
parents:
786
diff
changeset
|
5049 but the window manager will get around to dealing with the size |
|
cbdfc337ec8f
* xterm.c (x_wm_hints): New variable.
Jim Blandy <jimb@redhat.com>
parents:
786
diff
changeset
|
5050 change request eventually, and we'll hear how it went when the |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
5051 ConfigureNotify event gets here. |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
5052 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
5053 We could just not bother storing any of this information here, |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
5054 and let the ConfigureNotify event set everything up, but that |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
5055 might be kind of confusing to the lisp code, since size changes |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
5056 wouldn't be reported in the frame parameters until some random |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
5057 point in the future when the ConfigureNotify event arrives. */ |
|
1875
f569bc4e9b8f
* xterm.c (x_set_window_size): Call change_frame_size instead of
Jim Blandy <jimb@redhat.com>
parents:
1841
diff
changeset
|
5058 change_frame_size (f, rows, cols, 0, 0); |
|
976
cbdfc337ec8f
* xterm.c (x_wm_hints): New variable.
Jim Blandy <jimb@redhat.com>
parents:
786
diff
changeset
|
5059 PIXEL_WIDTH (f) = pixelwidth; |
|
cbdfc337ec8f
* xterm.c (x_wm_hints): New variable.
Jim Blandy <jimb@redhat.com>
parents:
786
diff
changeset
|
5060 PIXEL_HEIGHT (f) = pixelheight; |
|
cbdfc337ec8f
* xterm.c (x_wm_hints): New variable.
Jim Blandy <jimb@redhat.com>
parents:
786
diff
changeset
|
5061 |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
5062 /* We've set {FRAME,PIXEL}_{WIDTH,HEIGHT} to the values we hope to |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
5063 receive in the ConfigureNotify event; if we get what we asked |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
5064 for, then the event won't cause the screen to become garbaged, so |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
5065 we have to make sure to do it here. */ |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
5066 SET_FRAME_GARBAGED (f); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
5067 |
| 286 | 5068 XFlushQueue (); |
| 5069 UNBLOCK_INPUT; | |
|
5686
0c351de98a26
(x_set_window_size): Add USE_X_TOOLKIT conditional. Call EmacsFrameSetCharSize and return.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5685
diff
changeset
|
5070 #endif /* not USE_X_TOOLKIT */ |
| 286 | 5071 } |
| 5072 | |
| 5073 #ifndef HAVE_X11 | |
| 771 | 5074 x_set_resize_hint (f) |
| 5075 struct frame *f; | |
| 286 | 5076 { |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
5077 XSetResizeHint (FRAME_X_WINDOW (f), |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
5078 2 * f->display.x->internal_border_width, |
| 771 | 5079 2 * f->display.x->internal_border_width, |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
5080 FONT_WIDTH (f->display.x->font), |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
5081 FONT_HEIGHT (f->display.x->font)); |
| 286 | 5082 } |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5083 #endif /* HAVE_X11 */ |
| 286 | 5084 |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
5085 /* Mouse warping, focus shifting, raising and lowering. */ |
| 286 | 5086 |
| 771 | 5087 x_set_mouse_position (f, x, y) |
| 5088 struct frame *f; | |
| 286 | 5089 int x, y; |
| 5090 { | |
| 5091 int pix_x, pix_y; | |
| 5092 | |
|
5683
b9bafc8d0283
(x_set_mouse_position): Don't raise the frame.
Richard M. Stallman <rms@gnu.org>
parents:
5672
diff
changeset
|
5093 #if 0 /* Let the user ask for this if he wants it. */ |
| 771 | 5094 x_raise_frame (f); |
|
5683
b9bafc8d0283
(x_set_mouse_position): Don't raise the frame.
Richard M. Stallman <rms@gnu.org>
parents:
5672
diff
changeset
|
5095 #endif |
| 286 | 5096 |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
5097 pix_x = CHAR_TO_PIXEL_COL (f, x) + FONT_WIDTH (f->display.x->font) / 2; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
5098 pix_y = CHAR_TO_PIXEL_ROW (f, y) + FONT_HEIGHT (f->display.x->font) / 2; |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
5099 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
5100 if (pix_x < 0) pix_x = 0; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
5101 if (pix_x > PIXEL_WIDTH (f)) pix_x = PIXEL_WIDTH (f); |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
5102 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
5103 if (pix_y < 0) pix_y = 0; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
5104 if (pix_y > PIXEL_HEIGHT (f)) pix_y = PIXEL_HEIGHT (f); |
| 286 | 5105 |
| 5106 BLOCK_INPUT; | |
| 5107 | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5108 XWarpMousePointer (FRAME_X_WINDOW (f), pix_x, pix_y); |
| 286 | 5109 UNBLOCK_INPUT; |
| 5110 } | |
| 5111 | |
| 5112 #ifdef HAVE_X11 | |
| 771 | 5113 x_focus_on_frame (f) |
| 5114 struct frame *f; | |
| 286 | 5115 { |
|
5156
fd78458b8c43
(XTread_socket): Really handle Xatom_wm_window_moved events.
Richard M. Stallman <rms@gnu.org>
parents:
5018
diff
changeset
|
5116 #if 0 /* This proves to be unpleasant. */ |
| 771 | 5117 x_raise_frame (f); |
|
5156
fd78458b8c43
(XTread_socket): Really handle Xatom_wm_window_moved events.
Richard M. Stallman <rms@gnu.org>
parents:
5018
diff
changeset
|
5118 #endif |
| 369 | 5119 #if 0 |
| 5120 /* I don't think that the ICCCM allows programs to do things like this | |
| 5121 without the interaction of the window manager. Whatever you end up | |
| 771 | 5122 doing with this code, do it to x_unfocus_frame too. */ |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5123 XSetInputFocus (x_current_display, FRAME_X_WINDOW (f), |
| 286 | 5124 RevertToPointerRoot, CurrentTime); |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5125 #endif /* ! 0 */ |
| 286 | 5126 } |
| 5127 | |
| 771 | 5128 x_unfocus_frame (f) |
| 5129 struct frame *f; | |
| 286 | 5130 { |
| 369 | 5131 #if 0 |
| 771 | 5132 /* Look at the remarks in x_focus_on_frame. */ |
| 5133 if (x_focus_frame == f) | |
| 286 | 5134 XSetInputFocus (x_current_display, PointerRoot, |
| 5135 RevertToPointerRoot, CurrentTime); | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5136 #endif /* ! 0 */ |
| 286 | 5137 } |
| 5138 | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5139 #endif /* ! defined (HAVE_X11) */ |
| 286 | 5140 |
| 771 | 5141 /* Raise frame F. */ |
| 5142 | |
| 5143 x_raise_frame (f) | |
| 5144 struct frame *f; | |
| 286 | 5145 { |
|
1658
452ba03935d7
* xterm.c (XTread_socket): When we get MapNotify, UnmapNotify,
Jim Blandy <jimb@redhat.com>
parents:
1530
diff
changeset
|
5146 if (f->async_visible) |
| 286 | 5147 { |
| 5148 BLOCK_INPUT; | |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5149 #ifdef USE_X_TOOLKIT |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5150 XRaiseWindow (XDISPLAY XtWindow (f->display.x->widget)); |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5151 #else /* not USE_X_TOOLKIT */ |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5152 XRaiseWindow (XDISPLAY FRAME_X_WINDOW (f)); |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5153 #endif /* not USE_X_TOOLKIT */ |
| 286 | 5154 XFlushQueue (); |
| 5155 UNBLOCK_INPUT; | |
| 5156 } | |
| 5157 } | |
| 5158 | |
| 771 | 5159 /* Lower frame F. */ |
| 5160 | |
| 5161 x_lower_frame (f) | |
| 5162 struct frame *f; | |
| 286 | 5163 { |
|
1658
452ba03935d7
* xterm.c (XTread_socket): When we get MapNotify, UnmapNotify,
Jim Blandy <jimb@redhat.com>
parents:
1530
diff
changeset
|
5164 if (f->async_visible) |
| 286 | 5165 { |
| 5166 BLOCK_INPUT; | |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5167 #ifdef USE_X_TOOLKIT |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5168 XLowerWindow (XDISPLAY XtWindow (f->display.x->widget)); |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5169 #else /* not USE_X_TOOLKIT */ |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5170 XLowerWindow (XDISPLAY FRAME_X_WINDOW (f)); |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5171 #endif /* not USE_X_TOOLKIT */ |
| 286 | 5172 XFlushQueue (); |
| 5173 UNBLOCK_INPUT; | |
| 5174 } | |
| 5175 } | |
| 5176 | |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
5177 static void |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
5178 XTframe_raise_lower (f, raise) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
5179 FRAME_PTR f; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
5180 int raise; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
5181 { |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
5182 if (raise) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
5183 x_raise_frame (f); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
5184 else |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
5185 x_lower_frame (f); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
5186 } |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
5187 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
5188 |
| 286 | 5189 /* Change from withdrawn state to mapped state. */ |
| 5190 | |
| 771 | 5191 x_make_frame_visible (f) |
| 5192 struct frame *f; | |
| 286 | 5193 { |
| 5194 int mask; | |
| 5195 | |
| 429 | 5196 BLOCK_INPUT; |
| 5197 | |
| 771 | 5198 if (! FRAME_VISIBLE_P (f)) |
| 286 | 5199 { |
| 5200 #ifdef HAVE_X11 | |
| 429 | 5201 if (! EQ (Vx_no_window_manager, Qt)) |
| 771 | 5202 x_wm_set_window_state (f, NormalState); |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5203 #ifdef USE_X_TOOLKIT |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5204 XtPopup (f->display.x->widget, XtGrabNone); |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5205 #else /* not USE_X_TOOLKIT */ |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5206 XMapWindow (XDISPLAY FRAME_X_WINDOW (f)); |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5207 #endif /* not USE_X_TOOLKIT */ |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
5208 if (FRAME_HAS_VERTICAL_SCROLL_BARS (f)) |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5209 XMapSubwindows (x_current_display, FRAME_X_WINDOW (f)); |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5210 #else /* ! defined (HAVE_X11) */ |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5211 XMapWindow (XDISPLAY FRAME_X_WINDOW (f)); |
| 771 | 5212 if (f->display.x->icon_desc != 0) |
| 5213 XUnmapWindow (f->display.x->icon_desc); | |
| 429 | 5214 |
| 5215 /* Handled by the MapNotify event for X11 */ | |
|
1658
452ba03935d7
* xterm.c (XTread_socket): When we get MapNotify, UnmapNotify,
Jim Blandy <jimb@redhat.com>
parents:
1530
diff
changeset
|
5216 f->async_visible = 1; |
|
452ba03935d7
* xterm.c (XTread_socket): When we get MapNotify, UnmapNotify,
Jim Blandy <jimb@redhat.com>
parents:
1530
diff
changeset
|
5217 f->async_iconified = 0; |
| 771 | 5218 |
| 5219 /* NOTE: this may cause problems for the first frame. */ | |
| 429 | 5220 XTcursor_to (0, 0); |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5221 #endif /* ! defined (HAVE_X11) */ |
| 429 | 5222 } |
| 286 | 5223 |
| 5224 XFlushQueue (); | |
| 429 | 5225 |
| 286 | 5226 UNBLOCK_INPUT; |
| 5227 } | |
| 5228 | |
| 5229 /* Change from mapped state to withdrawn state. */ | |
| 5230 | |
| 771 | 5231 x_make_frame_invisible (f) |
| 5232 struct frame *f; | |
| 286 | 5233 { |
| 5234 int mask; | |
| 5235 | |
|
3284
a47979ffad1e
(XTread_socket): For UnmapNotify, if frame was visible,
Richard M. Stallman <rms@gnu.org>
parents:
3282
diff
changeset
|
5236 /* Don't keep the highlight on an invisible frame. */ |
|
a47979ffad1e
(XTread_socket): For UnmapNotify, if frame was visible,
Richard M. Stallman <rms@gnu.org>
parents:
3282
diff
changeset
|
5237 if (x_highlight_frame == f) |
|
a47979ffad1e
(XTread_socket): For UnmapNotify, if frame was visible,
Richard M. Stallman <rms@gnu.org>
parents:
3282
diff
changeset
|
5238 x_highlight_frame = 0; |
|
a47979ffad1e
(XTread_socket): For UnmapNotify, if frame was visible,
Richard M. Stallman <rms@gnu.org>
parents:
3282
diff
changeset
|
5239 |
|
a47979ffad1e
(XTread_socket): For UnmapNotify, if frame was visible,
Richard M. Stallman <rms@gnu.org>
parents:
3282
diff
changeset
|
5240 if (! f->async_visible && ! f->async_iconified) |
| 286 | 5241 return; |
| 5242 | |
| 5243 BLOCK_INPUT; | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5244 |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5245 #ifdef HAVE_X11R4 |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5246 |
|
5825
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5247 #ifdef USE_X_TOOLKIT |
|
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5248 if (! XWithdrawWindow (x_current_display, XtWindow (f->display.x->widget), |
|
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5249 DefaultScreen (x_current_display))) |
|
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5250 #else /* not USE_X_TOOLKIT */ |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5251 if (! XWithdrawWindow (x_current_display, FRAME_X_WINDOW (f), |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5252 DefaultScreen (x_current_display))) |
|
5825
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5253 #endif /* not USE_X_TOOLKIT */ |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5254 { |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5255 UNBLOCK_INPUT_RESIGNAL; |
|
3591
507f64624555
Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents:
3585
diff
changeset
|
5256 error ("can't notify window manager of window withdrawal"); |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5257 } |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5258 |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5259 #else /* ! defined (HAVE_X11R4) */ |
| 286 | 5260 #ifdef HAVE_X11 |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5261 |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5262 /* Tell the window manager what we're going to do. */ |
| 286 | 5263 if (! EQ (Vx_no_window_manager, Qt)) |
| 5264 { | |
|
1020
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5265 XEvent unmap; |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5266 |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5267 unmap.xunmap.type = UnmapNotify; |
|
5825
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5268 #ifdef USE_X_TOOLKIT |
|
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5269 unmap.xunmap.window = XtWindow (f->display.x->widget); |
|
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5270 #else /* not USE_X_TOOLKIT */ |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5271 unmap.xunmap.window = FRAME_X_WINDOW (f); |
|
5825
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5272 #endif /* not USE_X_TOOLKIT */ |
|
1020
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5273 unmap.xunmap.event = DefaultRootWindow (x_current_display); |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5274 unmap.xunmap.from_configure = False; |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5275 if (! XSendEvent (x_current_display, |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5276 DefaultRootWindow (x_current_display), |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5277 False, |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5278 SubstructureRedirectMask|SubstructureNotifyMask, |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5279 &unmap)) |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5280 { |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5281 UNBLOCK_INPUT_RESIGNAL; |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5282 error ("can't notify window manager of withdrawal"); |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5283 } |
| 286 | 5284 } |
| 5285 | |
|
1020
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5286 /* Unmap the window ourselves. Cheeky! */ |
|
5825
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5287 #ifdef USE_X_TOOLKIT |
|
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5288 XUnmapWindow (x_current_display, XtWindow (f->display.x->widget)); |
|
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5289 #else /* not USE_X_TOOLKIT */ |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5290 XUnmapWindow (x_current_display, FRAME_X_WINDOW (f)); |
|
5825
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5291 #endif /* not USE_X_TOOLKIT */ |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5292 #else /* ! defined (HAVE_X11) */ |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5293 |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5294 XUnmapWindow (FRAME_X_WINDOW (f)); |
|
1658
452ba03935d7
* xterm.c (XTread_socket): When we get MapNotify, UnmapNotify,
Jim Blandy <jimb@redhat.com>
parents:
1530
diff
changeset
|
5295 f->async_visible = 0; /* Handled by the UnMap event for X11 */ |
| 771 | 5296 if (f->display.x->icon_desc != 0) |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5297 XUnmapWindow (f->display.x->icon_desc); |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5298 |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5299 #endif /* ! defined (HAVE_X11) */ |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5300 #endif /* ! defined (HAVE_X11R4) */ |
| 286 | 5301 |
| 5302 XFlushQueue (); | |
| 5303 UNBLOCK_INPUT; | |
| 5304 } | |
| 5305 | |
| 5306 /* Change window state from mapped to iconified. */ | |
| 5307 | |
| 771 | 5308 x_iconify_frame (f) |
| 5309 struct frame *f; | |
| 286 | 5310 { |
| 5311 int mask; | |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5312 int result; |
| 286 | 5313 |
|
3284
a47979ffad1e
(XTread_socket): For UnmapNotify, if frame was visible,
Richard M. Stallman <rms@gnu.org>
parents:
3282
diff
changeset
|
5314 /* Don't keep the highlight on an invisible frame. */ |
|
a47979ffad1e
(XTread_socket): For UnmapNotify, if frame was visible,
Richard M. Stallman <rms@gnu.org>
parents:
3282
diff
changeset
|
5315 if (x_highlight_frame == f) |
|
a47979ffad1e
(XTread_socket): For UnmapNotify, if frame was visible,
Richard M. Stallman <rms@gnu.org>
parents:
3282
diff
changeset
|
5316 x_highlight_frame = 0; |
|
a47979ffad1e
(XTread_socket): For UnmapNotify, if frame was visible,
Richard M. Stallman <rms@gnu.org>
parents:
3282
diff
changeset
|
5317 |
|
1658
452ba03935d7
* xterm.c (XTread_socket): When we get MapNotify, UnmapNotify,
Jim Blandy <jimb@redhat.com>
parents:
1530
diff
changeset
|
5318 if (f->async_iconified) |
| 286 | 5319 return; |
| 5320 | |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5321 #ifdef USE_X_TOOLKIT |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5322 BLOCK_INPUT; |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5323 result = XIconifyWindow (x_current_display, |
|
5825
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5324 XtWindow (f->display.x->widget), |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5325 DefaultScreen (x_current_display)); |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5326 UNBLOCK_INPUT; |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5327 |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5328 if (!result) |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5329 error ("Can't notify window manager of iconification."); |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5330 |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5331 f->async_iconified = 1; |
|
5740
48da4ed089e9
(x_iconify_frame): Fix misbalanced BLOCK_INPUT/UNBLOCK_INPUT.
Karl Heuer <kwzh@gnu.org>
parents:
5737
diff
changeset
|
5332 |
|
48da4ed089e9
(x_iconify_frame): Fix misbalanced BLOCK_INPUT/UNBLOCK_INPUT.
Karl Heuer <kwzh@gnu.org>
parents:
5737
diff
changeset
|
5333 BLOCK_INPUT; |
|
48da4ed089e9
(x_iconify_frame): Fix misbalanced BLOCK_INPUT/UNBLOCK_INPUT.
Karl Heuer <kwzh@gnu.org>
parents:
5737
diff
changeset
|
5334 XFlushQueue (); |
|
48da4ed089e9
(x_iconify_frame): Fix misbalanced BLOCK_INPUT/UNBLOCK_INPUT.
Karl Heuer <kwzh@gnu.org>
parents:
5737
diff
changeset
|
5335 UNBLOCK_INPUT; |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5336 #else /* not USE_X_TOOLKIT */ |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5337 |
| 286 | 5338 BLOCK_INPUT; |
| 5339 | |
| 5340 #ifdef HAVE_X11 | |
|
1020
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5341 /* Since we don't know which revision of X we're running, we'll use both |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5342 the X11R3 and X11R4 techniques. I don't know if this is a good idea. */ |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5343 |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5344 /* X11R4: send a ClientMessage to the window manager using the |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5345 WM_CHANGE_STATE type. */ |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5346 { |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5347 XEvent message; |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5348 |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5349 message.xclient.window = FRAME_X_WINDOW (f); |
|
1020
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5350 message.xclient.type = ClientMessage; |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5351 message.xclient.message_type = Xatom_wm_change_state; |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5352 message.xclient.format = 32; |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5353 message.xclient.data.l[0] = IconicState; |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5354 |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5355 if (! XSendEvent (x_current_display, |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5356 DefaultRootWindow (x_current_display), |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5357 False, |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5358 SubstructureRedirectMask | SubstructureNotifyMask, |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5359 &message)) |
| 286 | 5360 { |
| 5361 UNBLOCK_INPUT_RESIGNAL; | |
| 5362 error ("Can't notify window manager of iconification."); | |
| 5363 } | |
|
1020
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5364 } |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5365 |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5366 /* X11R3: set the initial_state field of the window manager hints to |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5367 IconicState. */ |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5368 x_wm_set_window_state (f, IconicState); |
| 286 | 5369 |
|
4304
b5014da888a8
(x_iconify_frame): Handle case where frame was invisible.
Richard M. Stallman <rms@gnu.org>
parents:
4277
diff
changeset
|
5370 if (!FRAME_VISIBLE_P (f)) |
|
b5014da888a8
(x_iconify_frame): Handle case where frame was invisible.
Richard M. Stallman <rms@gnu.org>
parents:
4277
diff
changeset
|
5371 { |
|
b5014da888a8
(x_iconify_frame): Handle case where frame was invisible.
Richard M. Stallman <rms@gnu.org>
parents:
4277
diff
changeset
|
5372 /* If the frame was withdrawn, before, we must map it. */ |
|
b5014da888a8
(x_iconify_frame): Handle case where frame was invisible.
Richard M. Stallman <rms@gnu.org>
parents:
4277
diff
changeset
|
5373 XMapWindow (XDISPLAY FRAME_X_WINDOW (f)); |
|
b5014da888a8
(x_iconify_frame): Handle case where frame was invisible.
Richard M. Stallman <rms@gnu.org>
parents:
4277
diff
changeset
|
5374 if (FRAME_HAS_VERTICAL_SCROLL_BARS (f)) |
|
b5014da888a8
(x_iconify_frame): Handle case where frame was invisible.
Richard M. Stallman <rms@gnu.org>
parents:
4277
diff
changeset
|
5375 XMapSubwindows (x_current_display, FRAME_X_WINDOW (f)); |
|
b5014da888a8
(x_iconify_frame): Handle case where frame was invisible.
Richard M. Stallman <rms@gnu.org>
parents:
4277
diff
changeset
|
5376 } |
|
b5014da888a8
(x_iconify_frame): Handle case where frame was invisible.
Richard M. Stallman <rms@gnu.org>
parents:
4277
diff
changeset
|
5377 |
|
1658
452ba03935d7
* xterm.c (XTread_socket): When we get MapNotify, UnmapNotify,
Jim Blandy <jimb@redhat.com>
parents:
1530
diff
changeset
|
5378 f->async_iconified = 1; |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5379 #else /* ! defined (HAVE_X11) */ |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5380 XUnmapWindow (XDISPLAY FRAME_X_WINDOW (f)); |
| 771 | 5381 |
|
1658
452ba03935d7
* xterm.c (XTread_socket): When we get MapNotify, UnmapNotify,
Jim Blandy <jimb@redhat.com>
parents:
1530
diff
changeset
|
5382 f->async_visible = 0; /* Handled in the UnMap event for X11. */ |
| 771 | 5383 if (f->display.x->icon_desc != 0) |
| 286 | 5384 { |
| 771 | 5385 XMapWindow (XDISPLAY f->display.x->icon_desc); |
| 5386 refreshicon (f); | |
| 286 | 5387 } |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5388 #endif /* ! defined (HAVE_X11) */ |
| 286 | 5389 |
| 5390 XFlushQueue (); | |
| 5391 UNBLOCK_INPUT; | |
|
5740
48da4ed089e9
(x_iconify_frame): Fix misbalanced BLOCK_INPUT/UNBLOCK_INPUT.
Karl Heuer <kwzh@gnu.org>
parents:
5737
diff
changeset
|
5392 #endif /* not USE_X_TOOLKIT */ |
| 286 | 5393 } |
| 5394 | |
|
1810
bf618128d973
* xterm.c (x_scrollbar_create): Set the scrollbars to use
Jim Blandy <jimb@redhat.com>
parents:
1803
diff
changeset
|
5395 /* Destroy the X window of frame F. */ |
|
bf618128d973
* xterm.c (x_scrollbar_create): Set the scrollbars to use
Jim Blandy <jimb@redhat.com>
parents:
1803
diff
changeset
|
5396 |
|
bf618128d973
* xterm.c (x_scrollbar_create): Set the scrollbars to use
Jim Blandy <jimb@redhat.com>
parents:
1803
diff
changeset
|
5397 x_destroy_window (f) |
| 771 | 5398 struct frame *f; |
| 286 | 5399 { |
| 5400 BLOCK_INPUT; | |
|
1810
bf618128d973
* xterm.c (x_scrollbar_create): Set the scrollbars to use
Jim Blandy <jimb@redhat.com>
parents:
1803
diff
changeset
|
5401 |
|
bf618128d973
* xterm.c (x_scrollbar_create): Set the scrollbars to use
Jim Blandy <jimb@redhat.com>
parents:
1803
diff
changeset
|
5402 if (f->display.x->icon_desc != 0) |
|
bf618128d973
* xterm.c (x_scrollbar_create): Set the scrollbars to use
Jim Blandy <jimb@redhat.com>
parents:
1803
diff
changeset
|
5403 XDestroyWindow (XDISPLAY f->display.x->icon_desc); |
|
bf618128d973
* xterm.c (x_scrollbar_create): Set the scrollbars to use
Jim Blandy <jimb@redhat.com>
parents:
1803
diff
changeset
|
5404 XDestroyWindow (XDISPLAY f->display.x->window_desc); |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5405 #ifdef USE_X_TOOLKIT |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5406 XtDestroyWidget (f->display.x->widget); |
|
5898
105c99071e9b
(x_destroy_window) [USE_X_TOOLKIT]: Call free_frame_menubar.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5872
diff
changeset
|
5407 free_frame_menubar (f); |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5408 #endif /* USE_X_TOOLKIT */ |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5409 |
|
2732
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
5410 free_frame_faces (f); |
| 286 | 5411 XFlushQueue (); |
|
1810
bf618128d973
* xterm.c (x_scrollbar_create): Set the scrollbars to use
Jim Blandy <jimb@redhat.com>
parents:
1803
diff
changeset
|
5412 |
|
2439
b6c62e4abf59
Put interrupt input blocking in a separate file from xterm.h.
Jim Blandy <jimb@redhat.com>
parents:
2353
diff
changeset
|
5413 xfree (f->display.x); |
|
1810
bf618128d973
* xterm.c (x_scrollbar_create): Set the scrollbars to use
Jim Blandy <jimb@redhat.com>
parents:
1803
diff
changeset
|
5414 f->display.x = 0; |
| 771 | 5415 if (f == x_focus_frame) |
| 5416 x_focus_frame = 0; | |
| 5417 if (f == x_highlight_frame) | |
| 5418 x_highlight_frame = 0; | |
|
1810
bf618128d973
* xterm.c (x_scrollbar_create): Set the scrollbars to use
Jim Blandy <jimb@redhat.com>
parents:
1803
diff
changeset
|
5419 |
|
bf618128d973
* xterm.c (x_scrollbar_create): Set the scrollbars to use
Jim Blandy <jimb@redhat.com>
parents:
1803
diff
changeset
|
5420 UNBLOCK_INPUT; |
| 286 | 5421 } |
| 5422 | |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
5423 /* Manage event queues for X10. */ |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
5424 |
| 286 | 5425 #ifndef HAVE_X11 |
| 5426 | |
| 5427 /* Manage event queues. | |
| 5428 | |
| 5429 This code is only used by the X10 support. | |
| 5430 | |
| 5431 We cannot leave events in the X queue and get them when we are ready | |
| 5432 because X does not provide a subroutine to get only a certain kind | |
| 5433 of event but not block if there are no queued events of that kind. | |
| 5434 | |
| 5435 Therefore, we must examine events as they come in and copy events | |
| 5436 of certain kinds into our private queues. | |
| 5437 | |
| 5438 All ExposeRegion events are put in x_expose_queue. | |
|
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
5439 All ButtonPress and ButtonRelease events are put in x_mouse_queue. */ |
| 286 | 5440 |
| 5441 | |
| 5442 /* Write the event *P_XREP into the event queue *QUEUE. | |
| 5443 If the queue is full, do nothing, but return nonzero. */ | |
| 5444 | |
| 5445 int | |
| 5446 enqueue_event (p_xrep, queue) | |
| 5447 register XEvent *p_xrep; | |
| 5448 register struct event_queue *queue; | |
| 5449 { | |
| 5450 int newindex = queue->windex + 1; | |
| 5451 if (newindex == EVENT_BUFFER_SIZE) | |
| 5452 newindex = 0; | |
| 5453 if (newindex == queue->rindex) | |
| 5454 return -1; | |
| 5455 queue->xrep[queue->windex] = *p_xrep; | |
| 5456 queue->windex = newindex; | |
| 5457 return 0; | |
| 5458 } | |
| 5459 | |
| 5460 /* Fetch the next event from queue *QUEUE and store it in *P_XREP. | |
| 5461 If *QUEUE is empty, do nothing and return 0. */ | |
| 5462 | |
| 5463 int | |
| 5464 dequeue_event (p_xrep, queue) | |
| 5465 register XEvent *p_xrep; | |
| 5466 register struct event_queue *queue; | |
| 5467 { | |
| 5468 if (queue->windex == queue->rindex) | |
| 5469 return 0; | |
| 5470 *p_xrep = queue->xrep[queue->rindex++]; | |
| 5471 if (queue->rindex == EVENT_BUFFER_SIZE) | |
| 5472 queue->rindex = 0; | |
| 5473 return 1; | |
| 5474 } | |
| 5475 | |
| 5476 /* Return the number of events buffered in *QUEUE. */ | |
| 5477 | |
| 5478 int | |
| 5479 queue_event_count (queue) | |
| 5480 register struct event_queue *queue; | |
| 5481 { | |
| 5482 int tem = queue->windex - queue->rindex; | |
| 5483 if (tem >= 0) | |
| 5484 return tem; | |
| 5485 return EVENT_BUFFER_SIZE + tem; | |
| 5486 } | |
| 5487 | |
| 5488 /* Return nonzero if mouse input is pending. */ | |
| 5489 | |
| 5490 int | |
| 5491 mouse_event_pending_p () | |
| 5492 { | |
| 5493 return queue_event_count (&x_mouse_queue); | |
| 5494 } | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5495 #endif /* HAVE_X11 */ |
| 286 | 5496 |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
5497 /* Setting window manager hints. */ |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
5498 |
| 286 | 5499 #ifdef HAVE_X11 |
| 5500 | |
|
5825
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5501 /* Record the gravity used previously, in case CHANGE_GRAVITY is 0. */ |
|
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5502 static int previous_gravity; |
|
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5503 |
|
4630
70247ce8b381
(x_wm_set_size_hint): New args spec_x and spec_y.
Richard M. Stallman <rms@gnu.org>
parents:
4493
diff
changeset
|
5504 /* SPEC_X and SPEC_Y are the specified positions. |
|
5825
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5505 We look only at their sign, to decide the gravity. |
|
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5506 If CHANGE_GRAVITY is 0, we ignore SPEC_X and SPEC_Y |
|
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5507 and leave the gravity unchanged. */ |
|
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5508 |
|
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5509 x_wm_set_size_hint (f, prompting, change_gravity, spec_x, spec_y) |
| 771 | 5510 struct frame *f; |
| 286 | 5511 long prompting; |
|
5825
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5512 int change_gravity; |
|
4630
70247ce8b381
(x_wm_set_size_hint): New args spec_x and spec_y.
Richard M. Stallman <rms@gnu.org>
parents:
4493
diff
changeset
|
5513 int spec_x, spec_y; |
| 286 | 5514 { |
| 5515 XSizeHints size_hints; | |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5516 |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5517 #ifdef USE_X_TOOLKIT |
|
6631
eea1789dc6fd
(x_wm_set_size_hint): Add USE_X_TOOLKIT conditional and call
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6626
diff
changeset
|
5518 Arg al[2]; |
|
eea1789dc6fd
(x_wm_set_size_hint): Add USE_X_TOOLKIT conditional and call
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6626
diff
changeset
|
5519 int ac = 0; |
|
eea1789dc6fd
(x_wm_set_size_hint): Add USE_X_TOOLKIT conditional and call
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6626
diff
changeset
|
5520 Dimension widget_width, widget_height; |
|
5825
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5521 Window window = XtWindow (f->display.x->widget); |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5522 #else /* not USE_X_TOOLKIT */ |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5523 Window window = FRAME_X_WINDOW (f); |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5524 #endif /* not USE_X_TOOLKIT */ |
| 286 | 5525 |
|
3135
c344fe6cca79
(x_wm_set_size_hint): Don't set hints for max size.
Richard M. Stallman <rms@gnu.org>
parents:
3076
diff
changeset
|
5526 size_hints.flags = PResizeInc | PMinSize /* | PMaxSize */; |
| 286 | 5527 |
| 771 | 5528 flexlines = f->height; |
| 5529 | |
| 5530 size_hints.x = f->display.x->left_pos; | |
| 5531 size_hints.y = f->display.x->top_pos; | |
|
6631
eea1789dc6fd
(x_wm_set_size_hint): Add USE_X_TOOLKIT conditional and call
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6626
diff
changeset
|
5532 #ifdef USE_X_TOOLKIT |
|
eea1789dc6fd
(x_wm_set_size_hint): Add USE_X_TOOLKIT conditional and call
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6626
diff
changeset
|
5533 XtSetArg (al[ac], XtNwidth, &widget_width); ac++; |
|
eea1789dc6fd
(x_wm_set_size_hint): Add USE_X_TOOLKIT conditional and call
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6626
diff
changeset
|
5534 XtSetArg (al[ac], XtNheight, &widget_height); ac++; |
|
eea1789dc6fd
(x_wm_set_size_hint): Add USE_X_TOOLKIT conditional and call
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6626
diff
changeset
|
5535 XtGetValues (f->display.x->column_widget, al, ac); |
|
eea1789dc6fd
(x_wm_set_size_hint): Add USE_X_TOOLKIT conditional and call
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6626
diff
changeset
|
5536 size_hints.height = widget_height; |
|
eea1789dc6fd
(x_wm_set_size_hint): Add USE_X_TOOLKIT conditional and call
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6626
diff
changeset
|
5537 size_hints.width = widget_width; |
|
eea1789dc6fd
(x_wm_set_size_hint): Add USE_X_TOOLKIT conditional and call
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6626
diff
changeset
|
5538 #else /* not USE_X_TOOLKIT */ |
| 771 | 5539 size_hints.height = PIXEL_HEIGHT (f); |
| 5540 size_hints.width = PIXEL_WIDTH (f); | |
|
6631
eea1789dc6fd
(x_wm_set_size_hint): Add USE_X_TOOLKIT conditional and call
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6626
diff
changeset
|
5541 #endif /* not USE_X_TOOLKIT */ |
| 771 | 5542 size_hints.width_inc = FONT_WIDTH (f->display.x->font); |
| 5543 size_hints.height_inc = FONT_HEIGHT (f->display.x->font); | |
|
3135
c344fe6cca79
(x_wm_set_size_hint): Don't set hints for max size.
Richard M. Stallman <rms@gnu.org>
parents:
3076
diff
changeset
|
5544 #if 0 |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
5545 size_hints.max_width = x_screen_width - CHAR_TO_PIXEL_WIDTH (f, 0); |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
5546 size_hints.max_height = x_screen_height - CHAR_TO_PIXEL_HEIGHT (f, 0); |
|
3135
c344fe6cca79
(x_wm_set_size_hint): Don't set hints for max size.
Richard M. Stallman <rms@gnu.org>
parents:
3076
diff
changeset
|
5547 #endif |
|
976
cbdfc337ec8f
* xterm.c (x_wm_hints): New variable.
Jim Blandy <jimb@redhat.com>
parents:
786
diff
changeset
|
5548 { |
|
1127
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
5549 int base_width, base_height; |
|
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
5550 |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
5551 base_width = CHAR_TO_PIXEL_WIDTH (f, 0); |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
5552 base_height = CHAR_TO_PIXEL_HEIGHT (f, 0); |
|
1127
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
5553 |
|
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
5554 { |
|
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
5555 int min_rows = 0, min_cols = 0; |
|
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
5556 check_frame_size (f, &min_rows, &min_cols); |
|
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
5557 |
|
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
5558 /* The window manager uses the base width hints to calculate the |
|
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
5559 current number of rows and columns in the frame while |
|
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
5560 resizing; min_width and min_height aren't useful for this |
|
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
5561 purpose, since they might not give the dimensions for a |
|
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
5562 zero-row, zero-column frame. |
|
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
5563 |
|
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
5564 We use the base_width and base_height members if we have |
|
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
5565 them; otherwise, we set the min_width and min_height members |
|
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
5566 to the size for a zero x zero frame. */ |
|
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
5567 |
|
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
5568 #ifdef HAVE_X11R4 |
|
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
5569 size_hints.flags |= PBaseSize; |
|
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
5570 size_hints.base_width = base_width; |
|
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
5571 size_hints.base_height = base_height; |
|
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
5572 size_hints.min_width = base_width + min_cols * size_hints.width_inc; |
|
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
5573 size_hints.min_height = base_height + min_rows * size_hints.height_inc; |
|
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
5574 #else |
|
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
5575 size_hints.min_width = base_width; |
|
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
5576 size_hints.min_height = base_height; |
|
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
5577 #endif |
|
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
5578 } |
|
1020
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5579 |
|
976
cbdfc337ec8f
* xterm.c (x_wm_hints): New variable.
Jim Blandy <jimb@redhat.com>
parents:
786
diff
changeset
|
5580 } |
| 286 | 5581 |
| 5582 if (prompting) | |
| 5583 size_hints.flags |= prompting; | |
| 5584 else | |
| 5585 { | |
| 5586 XSizeHints hints; /* Sometimes I hate X Windows... */ | |
| 5587 | |
|
3444
2a646c40a4cf
(x_wm_set_size_hint): Handle XGetNormalHints returning 0.
Richard M. Stallman <rms@gnu.org>
parents:
3369
diff
changeset
|
5588 if (XGetNormalHints (x_current_display, window, &hints) == 0) |
|
2a646c40a4cf
(x_wm_set_size_hint): Handle XGetNormalHints returning 0.
Richard M. Stallman <rms@gnu.org>
parents:
3369
diff
changeset
|
5589 hints.flags = 0; |
| 286 | 5590 if (hints.flags & PSize) |
| 5591 size_hints.flags |= PSize; | |
| 5592 if (hints.flags & PPosition) | |
| 5593 size_hints.flags |= PPosition; | |
| 5594 if (hints.flags & USPosition) | |
| 5595 size_hints.flags |= USPosition; | |
| 5596 if (hints.flags & USSize) | |
| 5597 size_hints.flags |= USSize; | |
| 5598 } | |
|
4777
21ed9c9bb210
(w_wn_set_size_hint): Make recent window gravity addition
Brian Fox <bfox@gnu.org>
parents:
4696
diff
changeset
|
5599 #if defined (PWinGravity) |
|
5825
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5600 if (change_gravity) |
|
4630
70247ce8b381
(x_wm_set_size_hint): New args spec_x and spec_y.
Richard M. Stallman <rms@gnu.org>
parents:
4493
diff
changeset
|
5601 { |
|
5825
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5602 switch (((spec_x < 0) << 1) + (spec_y < 0)) |
|
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5603 { |
|
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5604 case 0: |
|
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5605 size_hints.win_gravity = NorthWestGravity; |
|
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5606 break; |
|
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5607 case 1: |
|
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5608 size_hints.win_gravity = NorthEastGravity; |
|
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5609 break; |
|
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5610 case 2: |
|
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5611 size_hints.win_gravity = SouthWestGravity; |
|
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5612 break; |
|
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5613 case 3: |
|
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5614 size_hints.win_gravity = SouthEastGravity; |
|
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5615 break; |
|
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5616 } |
|
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5617 previous_gravity = size_hints.win_gravity; |
|
4630
70247ce8b381
(x_wm_set_size_hint): New args spec_x and spec_y.
Richard M. Stallman <rms@gnu.org>
parents:
4493
diff
changeset
|
5618 } |
|
5825
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5619 else |
|
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5620 size_hints.win_gravity = previous_gravity; |
|
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5621 |
|
4630
70247ce8b381
(x_wm_set_size_hint): New args spec_x and spec_y.
Richard M. Stallman <rms@gnu.org>
parents:
4493
diff
changeset
|
5622 size_hints.flags |= PWinGravity; |
|
4777
21ed9c9bb210
(w_wn_set_size_hint): Make recent window gravity addition
Brian Fox <bfox@gnu.org>
parents:
4696
diff
changeset
|
5623 #endif /* PWinGravity */ |
|
4630
70247ce8b381
(x_wm_set_size_hint): New args spec_x and spec_y.
Richard M. Stallman <rms@gnu.org>
parents:
4493
diff
changeset
|
5624 |
|
1127
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
5625 #ifdef HAVE_X11R4 |
|
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
5626 XSetWMNormalHints (x_current_display, window, &size_hints); |
|
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
5627 #else |
| 286 | 5628 XSetNormalHints (x_current_display, window, &size_hints); |
|
1127
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
5629 #endif |
| 286 | 5630 } |
| 5631 | |
| 5632 /* Used for IconicState or NormalState */ | |
| 771 | 5633 x_wm_set_window_state (f, state) |
| 5634 struct frame *f; | |
| 286 | 5635 int state; |
| 5636 { | |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5637 #ifdef USE_X_TOOLKIT |
|
5825
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5638 Window window = XtWindow (f->display.x->widget); |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5639 #else /* not USE_X_TOOLKIT */ |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5640 Window window = FRAME_X_WINDOW (f); |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5641 #endif /* not USE_X_TOOLKIT */ |
| 286 | 5642 |
|
1020
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5643 f->display.x->wm_hints.flags |= StateHint; |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5644 f->display.x->wm_hints.initial_state = state; |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5645 |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5646 XSetWMHints (x_current_display, window, &f->display.x->wm_hints); |
| 286 | 5647 } |
| 5648 | |
| 771 | 5649 x_wm_set_icon_pixmap (f, icon_pixmap) |
| 5650 struct frame *f; | |
| 286 | 5651 Pixmap icon_pixmap; |
| 5652 { | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5653 Window window = FRAME_X_WINDOW (f); |
| 286 | 5654 |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
5655 if (icon_pixmap) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
5656 { |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
5657 f->display.x->wm_hints.icon_pixmap = icon_pixmap; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
5658 f->display.x->wm_hints.flags |= IconPixmapHint; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
5659 } |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
5660 else |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
5661 f->display.x->wm_hints.flags &= ~IconPixmapHint; |
|
1020
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5662 |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5663 XSetWMHints (x_current_display, window, &f->display.x->wm_hints); |
| 286 | 5664 } |
| 5665 | |
| 771 | 5666 x_wm_set_icon_position (f, icon_x, icon_y) |
| 5667 struct frame *f; | |
| 286 | 5668 int icon_x, icon_y; |
| 5669 { | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5670 Window window = FRAME_X_WINDOW (f); |
| 286 | 5671 |
|
1020
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5672 f->display.x->wm_hints.flags |= IconPositionHint; |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5673 f->display.x->wm_hints.icon_x = icon_x; |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5674 f->display.x->wm_hints.icon_y = icon_y; |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5675 |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5676 XSetWMHints (x_current_display, window, &f->display.x->wm_hints); |
| 286 | 5677 } |
| 5678 | |
| 5679 | |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
5680 /* Initialization. */ |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
5681 |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5682 #ifdef USE_X_TOOLKIT |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5683 static XrmOptionDescRec emacs_options[] = { |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5684 {"-geometry", ".geometry", XrmoptionSepArg, NULL}, |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5685 {"-iconic", ".iconic", XrmoptionNoArg, (XtPointer) "yes"}, |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5686 |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5687 {"-internal-border-width", "*EmacsScreen.internalBorderWidth", |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5688 XrmoptionSepArg, NULL}, |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5689 {"-ib", "*EmacsScreen.internalBorderWidth", XrmoptionSepArg, NULL}, |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5690 |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5691 {"-T", "*EmacsShell.title", XrmoptionSepArg, (XtPointer) NULL}, |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5692 {"-wn", "*EmacsShell.title", XrmoptionSepArg, (XtPointer) NULL}, |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5693 {"-title", "*EmacsShell.title", XrmoptionSepArg, (XtPointer) NULL}, |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5694 {"-iconname", "*EmacsShell.iconName", XrmoptionSepArg, (XtPointer) NULL}, |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5695 {"-in", "*EmacsShell.iconName", XrmoptionSepArg, (XtPointer) NULL}, |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5696 {"-mc", "*pointerColor", XrmoptionSepArg, (XtPointer) NULL}, |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5697 {"-cr", "*cursorColor", XrmoptionSepArg, (XtPointer) NULL} |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5698 }; |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5699 #endif /* USE_X_TOOLKIT */ |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5700 |
| 286 | 5701 void |
| 5702 x_term_init (display_name) | |
| 5703 char *display_name; | |
| 5704 { | |
| 771 | 5705 Lisp_Object frame; |
| 286 | 5706 char *defaultvalue; |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5707 int argc = 0; |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5708 char** argv = 0; |
|
4147
c6657758fb6f
* xterm.c (x_term_init): Adjust message printed when we can't
Jim Blandy <jimb@redhat.com>
parents:
3951
diff
changeset
|
5709 #ifndef F_SETOWN_BUG |
| 286 | 5710 #ifdef F_SETOWN |
| 5711 extern int old_fcntl_owner; | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5712 #endif /* ! defined (F_SETOWN) */ |
|
4147
c6657758fb6f
* xterm.c (x_term_init): Adjust message printed when we can't
Jim Blandy <jimb@redhat.com>
parents:
3951
diff
changeset
|
5713 #endif /* F_SETOWN_BUG */ |
| 369 | 5714 |
| 771 | 5715 x_focus_frame = x_highlight_frame = 0; |
| 286 | 5716 |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5717 #ifdef USE_X_TOOLKIT |
|
5685
07f5e3a0f905
* xterm.c (x_term_init): Cast to (char **) before assignment to argv.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5683
diff
changeset
|
5718 argv = (char **) XtMalloc (3 * sizeof (char *)); |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5719 argv [0] = ""; |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5720 argv [1] = "-display"; |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5721 argv [2] = display_name; |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5722 argc = 3; |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5723 Xt_app_shell = XtAppInitialize (&Xt_app_con, "Emacs", |
|
5825
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5724 emacs_options, XtNumber (emacs_options), |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5725 &argc, argv, |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5726 NULL, NULL, 0); |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5727 XtFree (argv); |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5728 x_current_display = XtDisplay (Xt_app_shell); |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5729 |
|
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5730 #else /* not USE_X_TOOLKIT */ |
| 286 | 5731 x_current_display = XOpenDisplay (display_name); |
|
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5732 #endif /* not USE_X_TOOLKIT */ |
| 286 | 5733 if (x_current_display == 0) |
|
4147
c6657758fb6f
* xterm.c (x_term_init): Adjust message printed when we can't
Jim Blandy <jimb@redhat.com>
parents:
3951
diff
changeset
|
5734 fatal ("X server %s not responding.\n\ |
|
c6657758fb6f
* xterm.c (x_term_init): Adjust message printed when we can't
Jim Blandy <jimb@redhat.com>
parents:
3951
diff
changeset
|
5735 Check the DISPLAY environment variable or use \"-d\"\n", |
| 286 | 5736 display_name); |
| 5737 | |
| 5738 #ifdef HAVE_X11 | |
| 5739 { | |
| 5740 #if 0 | |
| 5741 XSetAfterFunction (x_current_display, x_trace_wire); | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5742 #endif /* ! 0 */ |
|
5737
eb722251d156
(x_term_init): Use get_system_name instead of gethostname.
Karl Heuer <kwzh@gnu.org>
parents:
5719
diff
changeset
|
5743 hostname = get_system_name (); |
|
2279
012b04efa234
* emacs.c (Finvocation_name): New function.
Jim Blandy <jimb@redhat.com>
parents:
2235
diff
changeset
|
5744 x_id_name = (char *) xmalloc (XSTRING (Vinvocation_name)->size |
| 398 | 5745 + strlen (hostname) |
| 5746 + 2); | |
|
2279
012b04efa234
* emacs.c (Finvocation_name): New function.
Jim Blandy <jimb@redhat.com>
parents:
2235
diff
changeset
|
5747 sprintf (x_id_name, "%s@%s", XSTRING (Vinvocation_name)->data, hostname); |
| 286 | 5748 } |
|
1279
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
5749 |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
5750 /* Figure out which modifier bits mean what. */ |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
5751 x_find_modifier_meanings (); |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
5752 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
5753 /* Get the scroll bar cursor. */ |
|
2195
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
5754 x_vertical_scroll_bar_cursor |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
5755 = XCreateFontCursor (x_current_display, XC_sb_v_double_arrow); |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
5756 |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
5757 #if 0 |
|
1279
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
5758 /* Watch for PropertyNotify events on the root window; we use them |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
5759 to figure out when to invalidate our cache of the cut buffers. */ |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
5760 x_watch_cut_buffer_cache (); |
|
2195
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
5761 #endif |
|
1279
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
5762 |
|
2285
f0a979beceab
* xterm.c (x_term_init): If the X connection is already in file
Jim Blandy <jimb@redhat.com>
parents:
2279
diff
changeset
|
5763 if (ConnectionNumber (x_current_display) != 0) |
|
4683
6a5197116086
(x_term_init): Call change_keyboard_wait_descriptor,
Richard M. Stallman <rms@gnu.org>
parents:
4630
diff
changeset
|
5764 change_keyboard_wait_descriptor (ConnectionNumber (x_current_display)); |
|
6a5197116086
(x_term_init): Call change_keyboard_wait_descriptor,
Richard M. Stallman <rms@gnu.org>
parents:
4630
diff
changeset
|
5765 change_input_fd (ConnectionNumber (x_current_display)); |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5766 |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5767 #endif /* ! defined (HAVE_X11) */ |
| 286 | 5768 |
|
4147
c6657758fb6f
* xterm.c (x_term_init): Adjust message printed when we can't
Jim Blandy <jimb@redhat.com>
parents:
3951
diff
changeset
|
5769 #ifndef F_SETOWN_BUG |
| 286 | 5770 #ifdef F_SETOWN |
|
4683
6a5197116086
(x_term_init): Call change_keyboard_wait_descriptor,
Richard M. Stallman <rms@gnu.org>
parents:
4630
diff
changeset
|
5771 old_fcntl_owner = fcntl (ConnectionNumber (x_current_display), F_GETOWN, 0); |
| 286 | 5772 #ifdef F_SETOWN_SOCK_NEG |
|
4683
6a5197116086
(x_term_init): Call change_keyboard_wait_descriptor,
Richard M. Stallman <rms@gnu.org>
parents:
4630
diff
changeset
|
5773 /* stdin is a socket here */ |
|
6a5197116086
(x_term_init): Call change_keyboard_wait_descriptor,
Richard M. Stallman <rms@gnu.org>
parents:
4630
diff
changeset
|
5774 fcntl (ConnectionNumber (x_current_display), F_SETOWN, -getpid ()); |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5775 #else /* ! defined (F_SETOWN_SOCK_NEG) */ |
|
4683
6a5197116086
(x_term_init): Call change_keyboard_wait_descriptor,
Richard M. Stallman <rms@gnu.org>
parents:
4630
diff
changeset
|
5776 fcntl (ConnectionNumber (x_current_display), F_SETOWN, getpid ()); |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5777 #endif /* ! defined (F_SETOWN_SOCK_NEG) */ |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5778 #endif /* ! defined (F_SETOWN) */ |
|
4147
c6657758fb6f
* xterm.c (x_term_init): Adjust message printed when we can't
Jim Blandy <jimb@redhat.com>
parents:
3951
diff
changeset
|
5779 #endif /* F_SETOWN_BUG */ |
| 286 | 5780 |
| 5781 #ifdef SIGIO | |
| 5782 init_sigio (); | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5783 #endif /* ! defined (SIGIO) */ |
| 286 | 5784 |
| 5785 expose_all_windows = 0; | |
| 5786 | |
| 771 | 5787 clear_frame_hook = XTclear_frame; |
| 286 | 5788 clear_end_of_line_hook = XTclear_end_of_line; |
| 5789 ins_del_lines_hook = XTins_del_lines; | |
| 5790 change_line_highlight_hook = XTchange_line_highlight; | |
| 5791 insert_glyphs_hook = XTinsert_glyphs; | |
| 5792 write_glyphs_hook = XTwrite_glyphs; | |
| 5793 delete_glyphs_hook = XTdelete_glyphs; | |
| 5794 ring_bell_hook = XTring_bell; | |
| 5795 reset_terminal_modes_hook = XTreset_terminal_modes; | |
| 5796 set_terminal_modes_hook = XTset_terminal_modes; | |
| 5797 update_begin_hook = XTupdate_begin; | |
| 5798 update_end_hook = XTupdate_end; | |
| 5799 set_terminal_window_hook = XTset_terminal_window; | |
| 5800 read_socket_hook = XTread_socket; | |
|
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
5801 frame_up_to_date_hook = XTframe_up_to_date; |
| 286 | 5802 cursor_to_hook = XTcursor_to; |
| 5803 reassert_line_highlight_hook = XTreassert_line_highlight; | |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
5804 mouse_position_hook = XTmouse_position; |
| 771 | 5805 frame_rehighlight_hook = XTframe_rehighlight; |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
5806 frame_raise_lower_hook = XTframe_raise_lower; |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
5807 set_vertical_scroll_bar_hook = XTset_vertical_scroll_bar; |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
5808 condemn_scroll_bars_hook = XTcondemn_scroll_bars; |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
5809 redeem_scroll_bar_hook = XTredeem_scroll_bar; |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
5810 judge_scroll_bars_hook = XTjudge_scroll_bars; |
| 286 | 5811 |
| 771 | 5812 scroll_region_ok = 1; /* we'll scroll partial frames */ |
| 286 | 5813 char_ins_del_ok = 0; /* just as fast to write the line */ |
| 5814 line_ins_del_ok = 1; /* we'll just blt 'em */ | |
| 5815 fast_clear_end_of_line = 1; /* X does this well */ | |
| 771 | 5816 memory_below_frame = 0; /* we don't remember what scrolls |
| 286 | 5817 off the bottom */ |
| 5818 baud_rate = 19200; | |
| 5819 | |
|
4476
e7de1b007447
(x_term_init): Set the hooks before we call Fset_input_mode.
Richard M. Stallman <rms@gnu.org>
parents:
4304
diff
changeset
|
5820 /* Try to use interrupt input; if we can't, then start polling. */ |
|
e7de1b007447
(x_term_init): Set the hooks before we call Fset_input_mode.
Richard M. Stallman <rms@gnu.org>
parents:
4304
diff
changeset
|
5821 Fset_input_mode (Qt, Qnil, Qt, Qnil); |
|
e7de1b007447
(x_term_init): Set the hooks before we call Fset_input_mode.
Richard M. Stallman <rms@gnu.org>
parents:
4304
diff
changeset
|
5822 |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5823 /* Note that there is no real way portable across R3/R4 to get the |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5824 original error handler. */ |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5825 XHandleError (x_error_quitter); |
|
1875
f569bc4e9b8f
* xterm.c (x_set_window_size): Call change_frame_size instead of
Jim Blandy <jimb@redhat.com>
parents:
1841
diff
changeset
|
5826 XHandleIOError (x_io_error_quitter); |
| 286 | 5827 |
| 5828 /* Disable Window Change signals; they are handled by X events. */ | |
| 5829 #ifdef SIGWINCH | |
| 5830 signal (SIGWINCH, SIG_DFL); | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5831 #endif /* ! defined (SIGWINCH) */ |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5832 |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5833 signal (SIGPIPE, x_connection_closed); |
| 286 | 5834 } |
| 395 | 5835 |
| 5836 void | |
| 5837 syms_of_xterm () | |
| 5838 { | |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
5839 staticpro (&last_mouse_scroll_bar); |
|
4948
7653c78ac0c1
(syms_of_xterm): Initialize last_mouse_scroll_bar.
Richard M. Stallman <rms@gnu.org>
parents:
4909
diff
changeset
|
5840 last_mouse_scroll_bar = Qnil; |
|
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
5841 staticpro (&mouse_face_window); |
|
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
5842 mouse_face_window = Qnil; |
| 395 | 5843 } |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5844 #endif /* ! defined (HAVE_X11) */ |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5845 #endif /* ! defined (HAVE_X_WINDOWS) */ |
