Mercurial > emacs
annotate src/xterm.c @ 8555:f1b1537ed3f6
(Fcall_process_region): gcpro filename_string.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Wed, 17 Aug 1994 21:44:49 +0000 |
parents | e52f4cbff616 |
children | 5447a2a6972e |
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 | |
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
20 /* 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
|
21 |
2977
ddcad1457cd5
Move signal.h and stdio.h before config.h.
Richard M. Stallman <rms@gnu.org>
parents:
2958
diff
changeset
|
22 /* 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
|
23 /* 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
|
24 /* 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
|
25 #include <signal.h> |
ddcad1457cd5
Move signal.h and stdio.h before config.h.
Richard M. Stallman <rms@gnu.org>
parents:
2958
diff
changeset
|
26 |
4696
1fc792473491
Include <config.h> instead of "config.h".
Roland McGrath <roland@gnu.org>
parents:
4683
diff
changeset
|
27 #include <config.h> |
286 | 28 |
7902
22b9aaaf0302
Put stdio.h after config.h.
Richard M. Stallman <rms@gnu.org>
parents:
7870
diff
changeset
|
29 #include <stdio.h> |
22b9aaaf0302
Put stdio.h after config.h.
Richard M. Stallman <rms@gnu.org>
parents:
7870
diff
changeset
|
30 |
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
31 /* 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
|
32 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
|
33 #include "syssignal.h" |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
34 |
286 | 35 #ifdef HAVE_X_WINDOWS |
36 | |
37 #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
|
38 #include "blockinput.h" |
286 | 39 |
40 /* This may include sys/types.h, and that somehow loses | |
41 if this is not done before the other system files. */ | |
42 #include "xterm.h" | |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
43 #include <X11/cursorfont.h> |
286 | 44 |
1020
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
45 #ifndef USG |
286 | 46 /* Load sys/types.h if not already loaded. |
47 In some systems loading it twice is suicidal. */ | |
48 #ifndef makedev | |
49 #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
|
50 #endif /* makedev */ |
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
51 #endif /* USG */ |
286 | 52 |
53 #ifdef BSD | |
54 #include <sys/ioctl.h> | |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
55 #endif /* ! defined (BSD) */ |
286 | 56 |
3355
e0c2e8a2ef75
(XTread_socket, case KeyPress) [HPUX]: Test IsModifiedKey.
Richard M. Stallman <rms@gnu.org>
parents:
3284
diff
changeset
|
57 #include "systty.h" |
555 | 58 #include "systime.h" |
286 | 59 |
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
60 #ifndef INCLUDED_FCNTL |
286 | 61 #include <fcntl.h> |
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
62 #endif |
286 | 63 #include <ctype.h> |
64 #include <errno.h> | |
65 #include <setjmp.h> | |
66 #include <sys/stat.h> | |
67 #include <sys/param.h> | |
68 | |
69 #include "dispextern.h" | |
70 #include "termhooks.h" | |
71 #include "termopts.h" | |
72 #include "termchar.h" | |
73 #if 0 | |
74 #include "sink.h" | |
75 #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
|
76 #endif /* ! 0 */ |
286 | 77 #include "gnu.h" |
771 | 78 #include "frame.h" |
286 | 79 #include "disptab.h" |
80 #include "buffer.h" | |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
81 #include "window.h" |
286 | 82 |
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
83 #ifdef USE_X_TOOLKIT |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
84 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
|
85 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
|
86 extern void free_frame_menubar (); |
6941
a914781ef58a
(Xatom_editres_name): Variable defined.
Richard M. Stallman <rms@gnu.org>
parents:
6934
diff
changeset
|
87 extern void _XEditResCheckMessages (); |
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
88 #endif /* USE_X_TOOLKIT */ |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
89 |
6022
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
90 #ifndef USE_X_TOOLKIT |
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
91 #define x_any_window_to_frame x_window_to_frame |
6983
b18e5c09d7c3
(XTread_socket, case ClientMessage): Use x_window_to_frame unconditionally.
Richard M. Stallman <rms@gnu.org>
parents:
6941
diff
changeset
|
92 #define x_top_window_to_frame x_window_to_frame |
6022
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
93 #endif |
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
94 |
7602
136819b017fc
(x_wm_set_window_state) [USE_X_TOOLKIT]: Use XtSetValues.
Richard M. Stallman <rms@gnu.org>
parents:
7508
diff
changeset
|
95 #ifdef USE_X_TOOLKIT |
136819b017fc
(x_wm_set_window_state) [USE_X_TOOLKIT]: Use XtSetValues.
Richard M. Stallman <rms@gnu.org>
parents:
7508
diff
changeset
|
96 #ifndef XtNinitialState |
136819b017fc
(x_wm_set_window_state) [USE_X_TOOLKIT]: Use XtSetValues.
Richard M. Stallman <rms@gnu.org>
parents:
7508
diff
changeset
|
97 #define XtNinitialState "initialState" |
136819b017fc
(x_wm_set_window_state) [USE_X_TOOLKIT]: Use XtSetValues.
Richard M. Stallman <rms@gnu.org>
parents:
7508
diff
changeset
|
98 #endif |
136819b017fc
(x_wm_set_window_state) [USE_X_TOOLKIT]: Use XtSetValues.
Richard M. Stallman <rms@gnu.org>
parents:
7508
diff
changeset
|
99 #endif |
136819b017fc
(x_wm_set_window_state) [USE_X_TOOLKIT]: Use XtSetValues.
Richard M. Stallman <rms@gnu.org>
parents:
7508
diff
changeset
|
100 |
286 | 101 #ifdef HAVE_X11 |
102 #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
|
103 #else /* ! defined (HAVE_X11) */ |
286 | 104 #include <X/Xkeyboard.h> |
105 /*#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
|
106 #endif /* ! defined (HAVE_X11) */ |
286 | 107 |
3924
44fe472b66ba
* xterm.c: Add CPP tangle from process.c to get definitions for
Jim Blandy <jimb@redhat.com>
parents:
3890
diff
changeset
|
108 #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
|
109 /* 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
|
110 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
|
111 file. */ |
44fe472b66ba
* xterm.c: Add CPP tangle from process.c to get definitions for
Jim Blandy <jimb@redhat.com>
parents:
3890
diff
changeset
|
112 #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
|
113 #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
|
114 #else |
44fe472b66ba
* xterm.c: Add CPP tangle from process.c to get definitions for
Jim Blandy <jimb@redhat.com>
parents:
3890
diff
changeset
|
115 #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
|
116 #endif |
44fe472b66ba
* xterm.c: Add CPP tangle from process.c to get definitions for
Jim Blandy <jimb@redhat.com>
parents:
3890
diff
changeset
|
117 #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
|
118 #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
|
119 #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
|
120 #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
|
121 |
44fe472b66ba
* xterm.c: Add CPP tangle from process.c to get definitions for
Jim Blandy <jimb@redhat.com>
parents:
3890
diff
changeset
|
122 /* 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
|
123 #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
|
124 #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
|
125 #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
|
126 #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
|
127 #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
|
128 |
286 | 129 /* For sending Meta-characters. Do we need this? */ |
130 #define METABIT 0200 | |
131 | |
132 #define min(a,b) ((a)<(b) ? (a) : (b)) | |
133 #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
|
134 |
286 | 135 /* Nonzero means we must reprint all windows |
136 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
|
137 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
|
138 |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
139 This is never needed under X11. */ |
286 | 140 static int expose_all_windows; |
141 | |
142 /* Nonzero means we must reprint all icon windows. */ | |
143 | |
144 static int expose_all_icons; | |
145 | |
146 #ifndef HAVE_X11 | |
147 /* ExposeRegion events, when received, are copied into this queue | |
148 for later processing. */ | |
149 | |
150 static struct event_queue x_expose_queue; | |
151 | |
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
152 /* ButtonPress and ButtonReleased events, when received, |
286 | 153 are copied into this queue for later processing. */ |
154 | |
155 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
|
156 #endif /* HAVE_X11 */ |
286 | 157 |
158 #if defined (SIGIO) && defined (FIONREAD) | |
159 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
|
160 #endif /* ! defined (SIGIO) && defined (FIONREAD) */ |
286 | 161 |
162 /* The id of a bitmap used for icon windows. | |
163 One such map is shared by all Emacs icon windows. | |
164 This is zero if we have not yet had a need to create the bitmap. */ | |
165 | |
166 static Bitmap icon_bitmap; | |
167 | |
168 /* Font used for text icons. */ | |
169 | |
170 static FONT_TYPE *icon_font_info; | |
171 | |
172 /* Stuff for dealing with the main icon title. */ | |
173 | |
7905
cbc288be9c89
(x_term_init): Don't call get_system_name.
Karl Heuer <kwzh@gnu.org>
parents:
7902
diff
changeset
|
174 extern Lisp_Object Vcommand_line_args, Vsystem_name; |
cbc288be9c89
(x_term_init): Don't call get_system_name.
Karl Heuer <kwzh@gnu.org>
parents:
7902
diff
changeset
|
175 char *x_id_name; |
286 | 176 |
7870
537930034e73
(XTread_socket): Handle Xatom_wm_save_yourself by calling XSetCommand.
Richard M. Stallman <rms@gnu.org>
parents:
7806
diff
changeset
|
177 /* Initial values of argv and argc. */ |
537930034e73
(XTread_socket): Handle Xatom_wm_save_yourself by calling XSetCommand.
Richard M. Stallman <rms@gnu.org>
parents:
7806
diff
changeset
|
178 extern char **initial_argv; |
537930034e73
(XTread_socket): Handle Xatom_wm_save_yourself by calling XSetCommand.
Richard M. Stallman <rms@gnu.org>
parents:
7806
diff
changeset
|
179 extern int initial_argc; |
537930034e73
(XTread_socket): Handle Xatom_wm_save_yourself by calling XSetCommand.
Richard M. Stallman <rms@gnu.org>
parents:
7806
diff
changeset
|
180 |
286 | 181 /* This is the X connection that we are using. */ |
182 | |
183 Display *x_current_display; | |
184 | |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
185 /* 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
|
186 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
|
187 |
2474
86c8a6e08fd4
Fix typo in comment delimiter.
Richard M. Stallman <rms@gnu.org>
parents:
2468
diff
changeset
|
188 /* 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
|
189 This is set by update_begin and looked at by all the |
286 | 190 XT functions. It is zero while not inside an update. |
771 | 191 In that case, the XT functions assume that `selected_frame' |
192 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
|
193 extern struct frame *updating_frame; |
771 | 194 |
195 /* 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
|
196 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
|
197 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
|
198 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
|
199 x_focus_event_frame. */ |
771 | 200 struct frame *x_focus_frame; |
201 | |
6883
77ceede38423
(x_make_frame_visible): Don't call XMapSubwindows.
Richard M. Stallman <rms@gnu.org>
parents:
6791
diff
changeset
|
202 /* This is a frame waiting to be autoraised, within XTread_socket. */ |
77ceede38423
(x_make_frame_visible): Don't call XMapSubwindows.
Richard M. Stallman <rms@gnu.org>
parents:
6791
diff
changeset
|
203 struct frame *pending_autoraise_frame; |
77ceede38423
(x_make_frame_visible): Don't call XMapSubwindows.
Richard M. Stallman <rms@gnu.org>
parents:
6791
diff
changeset
|
204 |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
205 /* 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
|
206 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
|
207 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
|
208 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
|
209 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
|
210 |
771 | 211 /* The frame which currently has the visual highlight, and should get |
212 keyboard input (other sorts of input have the frame encoded in the | |
213 event). It points to the X focus frame's selected window's | |
214 frame. It differs from x_focus_frame when we're using a global | |
369 | 215 minibuffer. */ |
771 | 216 static struct frame *x_highlight_frame; |
369 | 217 |
286 | 218 /* From .Xdefaults, the value of "emacs.WarpMouse". If non-zero, |
771 | 219 mouse is moved to inside of frame when frame is de-iconified. */ |
286 | 220 |
221 static int warp_mouse_on_deiconify; | |
222 | |
223 /* During an update, maximum vpos for ins/del line operations to affect. */ | |
224 | |
225 static int flexlines; | |
226 | |
227 /* During an update, nonzero if chars output now should be highlighted. */ | |
228 | |
229 static int highlight; | |
230 | |
231 /* Nominal cursor position -- where to draw output. | |
232 During an update, these are different from the cursor-box position. */ | |
233 | |
234 static int curs_x; | |
235 static int curs_y; | |
236 | |
7935
f15e1a058e93
(scratch_cursor_gc): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7916
diff
changeset
|
237 /* Reusable Graphics Context for drawing a cursor in a non-default face. */ |
f15e1a058e93
(scratch_cursor_gc): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7916
diff
changeset
|
238 static GC scratch_cursor_gc; |
f15e1a058e93
(scratch_cursor_gc): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7916
diff
changeset
|
239 |
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
240 /* Mouse movement. |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
241 |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
242 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
|
243 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
|
244 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
|
245 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
|
246 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
|
247 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
|
248 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
|
249 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
|
250 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
|
251 is off. |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
252 |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
253 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
|
254 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
|
255 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
|
256 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
|
257 the server, which is very important. */ |
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 /* 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
|
260 static FRAME_PTR last_mouse_frame; |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
261 static XRectangle last_mouse_glyph; |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
262 |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
263 /* 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
|
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 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
|
266 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
|
267 an ordinary motion. |
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 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
|
270 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
|
271 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
|
272 |
7210
682ff6213c36
(x_wm_set_size_hint): Always set PWinGravity.
Richard M. Stallman <rms@gnu.org>
parents:
7187
diff
changeset
|
273 /* Record which buttons are currently pressed. */ |
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
274 unsigned int x_mouse_grabbed; |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
275 |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
276 /* 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
|
277 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
|
278 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
|
279 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
|
280 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
|
281 it's somewhat accurate. */ |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
282 static Time last_mouse_movement_time; |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
283 |
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
284 /* 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
|
285 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
|
286 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
|
287 redraw anything on its account. */ |
7283
3dc9a9e95d32
(note_mouse_highlight, show_mouse_face, clear_mouse_face, x_destroy_window):
Karl Heuer <kwzh@gnu.org>
parents:
7282
diff
changeset
|
288 static int mouse_face_beg_row, mouse_face_beg_col; |
3dc9a9e95d32
(note_mouse_highlight, show_mouse_face, clear_mouse_face, x_destroy_window):
Karl Heuer <kwzh@gnu.org>
parents:
7282
diff
changeset
|
289 static int mouse_face_end_row, mouse_face_end_col; |
7651
1569a13efdcd
(x_set_window_size): If cursor outside new size, mark it off.
Richard M. Stallman <rms@gnu.org>
parents:
7602
diff
changeset
|
290 static int mouse_face_past_end; |
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
291 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
|
292 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
|
293 |
6660
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
294 /* 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
|
295 gc was in progress. */ |
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
296 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
|
297 |
7680
8212755ff793
(note_mouse_movement): Use frame's window in XQueryPointer.
Richard M. Stallman <rms@gnu.org>
parents:
7651
diff
changeset
|
298 /* FRAME and X, Y position of mouse when last checked for |
8212755ff793
(note_mouse_movement): Use frame's window in XQueryPointer.
Richard M. Stallman <rms@gnu.org>
parents:
7651
diff
changeset
|
299 highlighting. X and Y can be negative or out of range for the frame. */ |
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
300 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
|
301 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
|
302 |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
303 /* 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
|
304 static int mouse_face_defer; |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
305 |
286 | 306 #ifdef HAVE_X11 |
307 /* `t' if a mouse button is depressed. */ | |
308 | |
309 extern Lisp_Object Vmouse_depressed; | |
310 | |
311 /* Tells if a window manager is present or not. */ | |
312 | |
313 extern Lisp_Object Vx_no_window_manager; | |
314 | |
315 /* Timestamp that we requested selection data was made. */ | |
316 extern Time requestor_time; | |
317 | |
318 /* ID of the window requesting selection data. */ | |
319 extern Window requestor_window; | |
320 | |
321 /* Nonzero enables some debugging for the X interface code. */ | |
322 extern int _Xdebug; | |
323 | |
6941
a914781ef58a
(Xatom_editres_name): Variable defined.
Richard M. Stallman <rms@gnu.org>
parents:
6934
diff
changeset
|
324 extern Lisp_Object Qface, Qmouse_face; |
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
325 |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
326 #else /* ! defined (HAVE_X11) */ |
286 | 327 |
328 /* Bit patterns for the mouse cursor. */ | |
329 | |
330 short MouseCursor[] = { | |
331 0x0000, 0x0008, 0x0018, 0x0038, | |
332 0x0078, 0x00f8, 0x01f8, 0x03f8, | |
333 0x07f8, 0x00f8, 0x00d8, 0x0188, | |
334 0x0180, 0x0300, 0x0300, 0x0000}; | |
335 | |
336 short MouseMask[] = { | |
337 0x000c, 0x001c, 0x003c, 0x007c, | |
338 0x00fc, 0x01fc, 0x03fc, 0x07fc, | |
339 0x0ffc, 0x0ffc, 0x01fc, 0x03dc, | |
340 0x03cc, 0x0780, 0x0780, 0x0300}; | |
341 | |
342 static short grey_bits[] = { | |
343 0x0005, 0x000a, 0x0005, 0x000a}; | |
344 | |
345 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
|
346 #endif /* ! defined (HAVE_X11) */ |
286 | 347 |
7916
50e9e0c8806a
(x_noop_count): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7905
diff
changeset
|
348 static int x_noop_count; |
50e9e0c8806a
(x_noop_count): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7905
diff
changeset
|
349 |
50e9e0c8806a
(x_noop_count): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7905
diff
changeset
|
350 |
286 | 351 /* From time to time we get info on an Emacs window, here. */ |
352 | |
353 static WINDOWINFO_TYPE windowinfo; | |
354 | |
355 extern int errno; | |
356 | |
2661
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
357 /* 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
|
358 extern int extra_keyboard_modifiers; |
338e4ffdb54b
(XTread_socket): Support extra_keyboard_modifiers.
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
359 |
286 | 360 extern Display *XOpenDisplay (); |
361 extern Window XCreateWindow (); | |
362 | |
363 extern Cursor XCreateCursor (); | |
364 extern FONT_TYPE *XOpenFont (); | |
365 | |
366 static void flashback (); | |
4277
c3fbb9249f5b
(redraw_previous_char): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4244
diff
changeset
|
367 static void redraw_previous_char (); |
6791
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
368 static void redraw_following_char (); |
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
369 static unsigned int x_x_to_emacs_modifiers (); |
286 | 370 |
7282
2bc4929691e9
(show_mouse_face): Fix test for cursor in highlighted area.
Karl Heuer <kwzh@gnu.org>
parents:
7264
diff
changeset
|
371 static int fast_find_position (); |
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
372 static void note_mouse_highlight (); |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
373 static void clear_mouse_face (); |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
374 static void show_mouse_face (); |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
375 |
286 | 376 #ifndef HAVE_X11 |
377 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
|
378 #endif /* HAVE_X11 */ |
286 | 379 |
380 void dumpborder (); | |
621 | 381 static int XTcursor_to (); |
382 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
|
383 |
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
384 |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
385 /* Starting and ending updates. |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
386 |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
387 These hooks are called by update_frame at the beginning and end |
771 | 388 of a frame update. We record in `updating_frame' the identity |
389 of the frame being updated, so that the XT... functions do not | |
390 need to take a frame as argument. Most of the XT... functions | |
286 | 391 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
|
392 being XTcursor_to, XTwrite_glyphs and XTreassert_line_highlight. */ |
286 | 393 |
394 extern int mouse_track_top, mouse_track_left, mouse_track_width; | |
395 | |
396 static | |
771 | 397 XTupdate_begin (f) |
398 struct frame *f; | |
286 | 399 { |
400 int mask; | |
401 | |
771 | 402 if (f == 0) |
286 | 403 abort (); |
404 | |
771 | 405 flexlines = f->height; |
286 | 406 highlight = 0; |
407 | |
408 BLOCK_INPUT; | |
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
409 |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
410 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
|
411 { |
6660
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
412 /* 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
|
413 mouse_face_defer = 1; |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
414 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
|
415 { |
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
416 int firstline, lastline, i; |
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
417 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
|
418 |
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
419 /* 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
|
420 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
|
421 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
|
422 break; |
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
423 |
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
424 lastline = f->height; |
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
425 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
|
426 { |
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
427 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
|
428 break; |
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
429 else |
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
430 lastline = i; |
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
431 } |
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
432 |
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
433 /* 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
|
434 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
|
435 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
|
436 || lastline < XFASTINT (w->top))) |
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
437 /* 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
|
438 clear_mouse_face (); |
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
439 } |
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
440 } |
286 | 441 #ifndef HAVE_X11 |
442 dumpqueue (); | |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
443 #endif /* HAVE_X11 */ |
286 | 444 UNBLOCK_INPUT; |
445 } | |
446 | |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
447 #ifndef HAVE_X11 |
286 | 448 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
|
449 #endif |
286 | 450 |
451 static | |
771 | 452 XTupdate_end (f) |
453 struct frame *f; | |
286 | 454 { |
455 int mask; | |
456 | |
457 BLOCK_INPUT; | |
458 #ifndef HAVE_X11 | |
459 dumpqueue (); | |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
460 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
|
461 #endif /* HAVE_X11 */ |
286 | 462 |
771 | 463 x_display_cursor (f, 1); |
464 | |
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
465 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
|
466 mouse_face_defer = 0; |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
467 #if 0 |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
468 /* 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
|
469 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
|
470 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
|
471 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
|
472 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
|
473 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
|
474 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
|
475 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
|
476 #endif |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
477 |
286 | 478 XFlushQueue (); |
479 UNBLOCK_INPUT; | |
480 } | |
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
481 |
6660
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
482 /* 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
|
483 |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
484 static |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
485 XTframe_up_to_date (f) |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
486 FRAME_PTR f; |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
487 { |
6660
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
488 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
|
489 { |
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
490 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
|
491 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
|
492 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
|
493 } |
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
494 } |
286 | 495 |
496 /* External interface to control of standout mode. | |
497 Call this when about to modify line at position VPOS | |
498 and not change whether it is highlighted. */ | |
499 | |
500 XTreassert_line_highlight (new, vpos) | |
501 int new, vpos; | |
502 { | |
503 highlight = new; | |
504 } | |
505 | |
506 /* Call this when about to modify line at position VPOS | |
507 and change whether it is highlighted. */ | |
508 | |
509 static | |
510 XTchange_line_highlight (new_highlight, vpos, first_unused_hpos) | |
511 int new_highlight, vpos, first_unused_hpos; | |
512 { | |
513 highlight = new_highlight; | |
514 XTcursor_to (vpos, 0); | |
771 | 515 XTclear_end_of_line (updating_frame->width); |
286 | 516 } |
517 | |
518 /* This is used when starting Emacs and when restarting after suspend. | |
519 When starting Emacs, no X window is mapped. And nothing must be done | |
520 to Emacs's own window if it is suspended (though that rarely happens). */ | |
521 | |
522 static | |
523 XTset_terminal_modes () | |
524 { | |
525 } | |
526 | |
527 /* This is called when exiting or suspending Emacs. | |
528 Exiting will make the X-windows go away, and suspending | |
529 requires no action. */ | |
530 | |
531 static | |
532 XTreset_terminal_modes () | |
533 { | |
771 | 534 /* XTclear_frame (); */ |
286 | 535 } |
536 | |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
537 /* 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
|
538 This is where display update commands will take effect. |
286 | 539 This does not affect the place where the cursor-box is displayed. */ |
540 | |
621 | 541 static int |
286 | 542 XTcursor_to (row, col) |
543 register int row, col; | |
544 { | |
545 int mask; | |
546 int orow = row; | |
547 | |
548 curs_x = col; | |
549 curs_y = row; | |
550 | |
771 | 551 if (updating_frame == 0) |
286 | 552 { |
553 BLOCK_INPUT; | |
771 | 554 x_display_cursor (selected_frame, 1); |
286 | 555 XFlushQueue (); |
556 UNBLOCK_INPUT; | |
557 } | |
558 } | |
559 | |
560 /* Display a sequence of N glyphs found at GP. | |
561 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
|
562 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
|
563 3 if should appear in its mouse-face. |
6791
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
564 JUST_FOREGROUND if 1 means draw only the foreground; |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
565 don't alter the background. |
286 | 566 |
2732
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
567 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
|
568 |
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
569 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
|
570 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
|
571 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
|
572 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
|
573 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
|
574 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
|
575 |
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
576 #if 1 |
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
577 /* 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
|
578 |
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
579 static void |
6791
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
580 dumpglyphs (f, left, top, gp, n, hl, just_foreground) |
2732
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
581 struct frame *f; |
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
582 int left, top; |
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
583 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
|
584 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
|
585 int hl; |
6791
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
586 int just_foreground; |
2732
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
587 { |
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
588 /* Holds characters to be displayed. */ |
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
589 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
|
590 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
|
591 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
|
592 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
|
593 Window window = FRAME_X_WINDOW (f); |
6791
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
594 int orig_left = left; |
2732
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
595 |
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
596 while (n > 0) |
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
597 { |
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
598 /* 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
|
599 int cf, len; |
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
600 int g = *gp; |
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
601 |
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
602 GLYPH_FOLLOW_ALIASES (tbase, tlen, g); |
6413
6eb1a3cf0371
(dumpglyphs): Use the fast macros.
Karl Heuer <kwzh@gnu.org>
parents:
6356
diff
changeset
|
603 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
|
604 |
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
605 /* 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
|
606 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
|
607 cp = buf; |
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
608 while (n > 0) |
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 g = *gp; |
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
611 GLYPH_FOLLOW_ALIASES (tbase, tlen, g); |
6413
6eb1a3cf0371
(dumpglyphs): Use the fast macros.
Karl Heuer <kwzh@gnu.org>
parents:
6356
diff
changeset
|
612 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
|
613 break; |
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
614 |
6413
6eb1a3cf0371
(dumpglyphs): Use the fast macros.
Karl Heuer <kwzh@gnu.org>
parents:
6356
diff
changeset
|
615 *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
|
616 --n; |
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
617 ++gp; |
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
618 } |
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
619 |
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
620 /* 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
|
621 len = cp - buf; |
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
622 |
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
623 /* 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
|
624 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
|
625 { |
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
626 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
|
627 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
|
628 GC gc = FACE_GC (face); |
2840
12299f73584e
(dumpglyphs): Create a temporary merged gc
Richard M. Stallman <rms@gnu.org>
parents:
2785
diff
changeset
|
629 |
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
630 /* 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
|
631 if (hl == 3) |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
632 cf = mouse_face_face_id; |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
633 |
2840
12299f73584e
(dumpglyphs): Create a temporary merged gc
Richard M. Stallman <rms@gnu.org>
parents:
2785
diff
changeset
|
634 /* 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
|
635 if (cf != 0) |
2732
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
636 { |
5719
d3074ff90741
(dumpglyphs): Don't crash for invalid face code.
Richard M. Stallman <rms@gnu.org>
parents:
5686
diff
changeset
|
637 /* 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
|
638 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
|
639 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
|
640 || 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
|
641 cf = 0; |
2732
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 if (cf == 1) |
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
644 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
|
645 else |
3883
b9e5a869b33e
Separate parameter faces (those created and modified by the user)
Jim Blandy <jimb@redhat.com>
parents:
3839
diff
changeset
|
646 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
|
647 font = FACE_FONT (face); |
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
648 gc = FACE_GC (face); |
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
649 } |
2785
55e9c556bbf8
* xterm.c (dumpglyphs): Give the cursor higher priority than the
Jim Blandy <jimb@redhat.com>
parents:
2732
diff
changeset
|
650 |
55e9c556bbf8
* xterm.c (dumpglyphs): Give the cursor higher priority than the
Jim Blandy <jimb@redhat.com>
parents:
2732
diff
changeset
|
651 /* 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
|
652 else if (hl == 0) |
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
653 ; |
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
654 else if (hl == 1) |
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
655 { |
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
656 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
|
657 font = FACE_FONT (face); |
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
658 gc = FACE_GC (face); |
2840
12299f73584e
(dumpglyphs): Create a temporary merged gc
Richard M. Stallman <rms@gnu.org>
parents:
2785
diff
changeset
|
659 } |
12299f73584e
(dumpglyphs): Create a temporary merged gc
Richard M. Stallman <rms@gnu.org>
parents:
2785
diff
changeset
|
660 |
12299f73584e
(dumpglyphs): Create a temporary merged gc
Richard M. Stallman <rms@gnu.org>
parents:
2785
diff
changeset
|
661 #define FACE_DEFAULT (~0) |
12299f73584e
(dumpglyphs): Create a temporary merged gc
Richard M. Stallman <rms@gnu.org>
parents:
2785
diff
changeset
|
662 |
12299f73584e
(dumpglyphs): Create a temporary merged gc
Richard M. Stallman <rms@gnu.org>
parents:
2785
diff
changeset
|
663 /* 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
|
664 if (hl == 2) |
2840
12299f73584e
(dumpglyphs): Create a temporary merged gc
Richard M. Stallman <rms@gnu.org>
parents:
2785
diff
changeset
|
665 { |
7935
f15e1a058e93
(scratch_cursor_gc): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7916
diff
changeset
|
666 if ((!face->font |
f15e1a058e93
(scratch_cursor_gc): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7916
diff
changeset
|
667 || (int) face->font == FACE_DEFAULT |
f15e1a058e93
(scratch_cursor_gc): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7916
diff
changeset
|
668 || face->font == f->display.x->font) |
f15e1a058e93
(scratch_cursor_gc): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7916
diff
changeset
|
669 && face->background == f->display.x->background_pixel |
f15e1a058e93
(scratch_cursor_gc): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7916
diff
changeset
|
670 && face->foreground == f->display.x->foreground_pixel) |
3076
e3b3c67cf203
Arrange for font names to get fully resolved - no wildcards.
Jim Blandy <jimb@redhat.com>
parents:
3066
diff
changeset
|
671 { |
e3b3c67cf203
Arrange for font names to get fully resolved - no wildcards.
Jim Blandy <jimb@redhat.com>
parents:
3066
diff
changeset
|
672 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
|
673 } |
e3b3c67cf203
Arrange for font names to get fully resolved - no wildcards.
Jim Blandy <jimb@redhat.com>
parents:
3066
diff
changeset
|
674 /* 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
|
675 else |
e3b3c67cf203
Arrange for font names to get fully resolved - no wildcards.
Jim Blandy <jimb@redhat.com>
parents:
3066
diff
changeset
|
676 { |
e3b3c67cf203
Arrange for font names to get fully resolved - no wildcards.
Jim Blandy <jimb@redhat.com>
parents:
3066
diff
changeset
|
677 XGCValues xgcv; |
e3b3c67cf203
Arrange for font names to get fully resolved - no wildcards.
Jim Blandy <jimb@redhat.com>
parents:
3066
diff
changeset
|
678 unsigned long mask; |
e3b3c67cf203
Arrange for font names to get fully resolved - no wildcards.
Jim Blandy <jimb@redhat.com>
parents:
3066
diff
changeset
|
679 |
e3b3c67cf203
Arrange for font names to get fully resolved - no wildcards.
Jim Blandy <jimb@redhat.com>
parents:
3066
diff
changeset
|
680 xgcv.background = f->display.x->cursor_pixel; |
7935
f15e1a058e93
(scratch_cursor_gc): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7916
diff
changeset
|
681 xgcv.foreground = face->background; |
5987
040bdc2fec7c
(dumpglyphs): Try various alternatives for foreground color
Richard M. Stallman <rms@gnu.org>
parents:
5986
diff
changeset
|
682 /* If the glyph would be invisible, |
040bdc2fec7c
(dumpglyphs): Try various alternatives for foreground color
Richard M. Stallman <rms@gnu.org>
parents:
5986
diff
changeset
|
683 try a different foreground. */ |
040bdc2fec7c
(dumpglyphs): Try various alternatives for foreground color
Richard M. Stallman <rms@gnu.org>
parents:
5986
diff
changeset
|
684 if (xgcv.foreground == xgcv.background) |
7469
24b292242269
(dumpglyphs): For cursor foreground, try the
Richard M. Stallman <rms@gnu.org>
parents:
7415
diff
changeset
|
685 xgcv.foreground = face->foreground; |
5987
040bdc2fec7c
(dumpglyphs): Try various alternatives for foreground color
Richard M. Stallman <rms@gnu.org>
parents:
5986
diff
changeset
|
686 if (xgcv.foreground == xgcv.background) |
040bdc2fec7c
(dumpglyphs): Try various alternatives for foreground color
Richard M. Stallman <rms@gnu.org>
parents:
5986
diff
changeset
|
687 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
|
688 if (xgcv.foreground == xgcv.background) |
040bdc2fec7c
(dumpglyphs): Try various alternatives for foreground color
Richard M. Stallman <rms@gnu.org>
parents:
5986
diff
changeset
|
689 xgcv.foreground = face->foreground; |
040bdc2fec7c
(dumpglyphs): Try various alternatives for foreground color
Richard M. Stallman <rms@gnu.org>
parents:
5986
diff
changeset
|
690 /* 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
|
691 if (xgcv.background == face->background |
040bdc2fec7c
(dumpglyphs): Try various alternatives for foreground color
Richard M. Stallman <rms@gnu.org>
parents:
5986
diff
changeset
|
692 && xgcv.foreground == face->foreground) |
040bdc2fec7c
(dumpglyphs): Try various alternatives for foreground color
Richard M. Stallman <rms@gnu.org>
parents:
5986
diff
changeset
|
693 { |
040bdc2fec7c
(dumpglyphs): Try various alternatives for foreground color
Richard M. Stallman <rms@gnu.org>
parents:
5986
diff
changeset
|
694 xgcv.background = face->foreground; |
040bdc2fec7c
(dumpglyphs): Try various alternatives for foreground color
Richard M. Stallman <rms@gnu.org>
parents:
5986
diff
changeset
|
695 xgcv.foreground = face->background; |
040bdc2fec7c
(dumpglyphs): Try various alternatives for foreground color
Richard M. Stallman <rms@gnu.org>
parents:
5986
diff
changeset
|
696 } |
3076
e3b3c67cf203
Arrange for font names to get fully resolved - no wildcards.
Jim Blandy <jimb@redhat.com>
parents:
3066
diff
changeset
|
697 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
|
698 xgcv.graphics_exposures = 0; |
e3b3c67cf203
Arrange for font names to get fully resolved - no wildcards.
Jim Blandy <jimb@redhat.com>
parents:
3066
diff
changeset
|
699 mask = GCForeground | GCBackground | GCFont | GCGraphicsExposures; |
7935
f15e1a058e93
(scratch_cursor_gc): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7916
diff
changeset
|
700 if (scratch_cursor_gc) |
f15e1a058e93
(scratch_cursor_gc): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7916
diff
changeset
|
701 XChangeGC (x_current_display, scratch_cursor_gc, mask, &xgcv); |
f15e1a058e93
(scratch_cursor_gc): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7916
diff
changeset
|
702 else |
f15e1a058e93
(scratch_cursor_gc): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7916
diff
changeset
|
703 scratch_cursor_gc = |
f15e1a058e93
(scratch_cursor_gc): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7916
diff
changeset
|
704 XCreateGC (x_current_display, window, mask, &xgcv); |
f15e1a058e93
(scratch_cursor_gc): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7916
diff
changeset
|
705 gc = scratch_cursor_gc; |
2840
12299f73584e
(dumpglyphs): Create a temporary merged gc
Richard M. Stallman <rms@gnu.org>
parents:
2785
diff
changeset
|
706 #if 0 |
7935
f15e1a058e93
(scratch_cursor_gc): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7916
diff
changeset
|
707 /* If this code is restored, it must also reset to the default stipple |
f15e1a058e93
(scratch_cursor_gc): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7916
diff
changeset
|
708 if necessary. */ |
3076
e3b3c67cf203
Arrange for font names to get fully resolved - no wildcards.
Jim Blandy <jimb@redhat.com>
parents:
3066
diff
changeset
|
709 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
|
710 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
|
711 #endif |
3076
e3b3c67cf203
Arrange for font names to get fully resolved - no wildcards.
Jim Blandy <jimb@redhat.com>
parents:
3066
diff
changeset
|
712 } |
2732
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
713 } |
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
714 |
3076
e3b3c67cf203
Arrange for font names to get fully resolved - no wildcards.
Jim Blandy <jimb@redhat.com>
parents:
3066
diff
changeset
|
715 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
|
716 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
|
717 |
6791
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
718 if (just_foreground) |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
719 XDrawString (x_current_display, window, gc, |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
720 left, top + FONT_BASE (font), buf, len); |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
721 else |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
722 { |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
723 XDrawImageString (x_current_display, window, gc, |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
724 left, top + FONT_BASE (font), buf, len); |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
725 /* Clear the rest of the line's height. */ |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
726 if (f->display.x->line_height != FONT_HEIGHT (font)) |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
727 XClearArea (x_current_display, window, left, |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
728 top + FONT_HEIGHT (font), |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
729 FONT_WIDTH (font) * len, |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
730 /* This is how many pixels of height |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
731 we have to clear. */ |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
732 f->display.x->line_height - FONT_HEIGHT (font), |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
733 False); |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
734 } |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
735 |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
736 #if 0 /* Doesn't work, because it uses FRAME_CURRENT_GLYPHS, |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
737 which often is not up to date yet. */ |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
738 if (!just_foreground) |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
739 { |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
740 if (left == orig_left) |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
741 redraw_previous_char (f, PIXEL_TO_CHAR_COL (f, left), |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
742 PIXEL_TO_CHAR_ROW (f, top), hl == 1); |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
743 if (n == 0) |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
744 redraw_following_char (f, PIXEL_TO_CHAR_COL (f, left + len * FONT_WIDTH (font)), |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
745 PIXEL_TO_CHAR_ROW (f, top), hl == 1); |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
746 } |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
747 #endif |
2732
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
748 |
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
749 /* 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
|
750 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
|
751 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
|
752 { |
2785
55e9c556bbf8
* xterm.c (dumpglyphs): Give the cursor higher priority than the
Jim Blandy <jimb@redhat.com>
parents:
2732
diff
changeset
|
753 int underline_position = 1; |
55e9c556bbf8
* xterm.c (dumpglyphs): Give the cursor higher priority than the
Jim Blandy <jimb@redhat.com>
parents:
2732
diff
changeset
|
754 |
55e9c556bbf8
* xterm.c (dumpglyphs): Give the cursor higher priority than the
Jim Blandy <jimb@redhat.com>
parents:
2732
diff
changeset
|
755 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
|
756 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
|
757 |
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
758 if (face->underline) |
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
759 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
|
760 FACE_GC (face), |
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
761 left, (top |
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
762 + FONT_BASE (font) |
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
763 + underline_position), |
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
764 len * FONT_WIDTH (font), 1); |
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
765 } |
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
766 |
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
767 left += len * FONT_WIDTH (font); |
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
768 } |
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
769 } |
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
770 } |
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
771 #endif /* 1 */ |
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
772 |
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
773 #if 0 |
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
774 /* This is the old single-face code. */ |
286 | 775 |
776 static void | |
771 | 777 dumpglyphs (f, left, top, gp, n, hl, font) |
778 struct frame *f; | |
286 | 779 int left, top; |
780 register GLYPH *gp; /* Points to first GLYPH. */ | |
781 register int n; /* Number of glyphs to display. */ | |
782 int hl; | |
783 FONT_TYPE *font; | |
784 { | |
785 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
|
786 Window window = FRAME_X_WINDOW (f); |
771 | 787 GC drawing_gc = (hl == 2 ? f->display.x->cursor_gc |
788 : (hl ? f->display.x->reverse_gc | |
789 : f->display.x->normal_gc)); | |
286 | 790 |
313 | 791 if (sizeof (GLYPH) == sizeof (XChar2b)) |
792 XDrawImageString16 (x_current_display, window, drawing_gc, | |
793 left, top + FONT_BASE (font), (XChar2b *) gp, n); | |
794 else if (sizeof (GLYPH) == sizeof (unsigned char)) | |
795 XDrawImageString (x_current_display, window, drawing_gc, | |
796 left, top + FONT_BASE (font), (char *) gp, n); | |
797 else | |
798 /* What size of glyph ARE you using? And does X have a function to | |
799 draw them? */ | |
800 abort (); | |
286 | 801 } |
2732
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
802 #endif |
286 | 803 |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
804 /* 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
|
805 Advance the cursor over the text. |
286 | 806 Output LEN glyphs at START. |
807 | |
808 `highlight', set up by XTreassert_line_highlight or XTchange_line_highlight, | |
809 controls the pixel values used for foreground and background. */ | |
810 | |
811 static | |
812 XTwrite_glyphs (start, len) | |
813 register GLYPH *start; | |
814 int len; | |
815 { | |
816 register int temp_length; | |
817 int mask; | |
771 | 818 struct frame *f; |
286 | 819 |
820 BLOCK_INPUT; | |
821 | |
771 | 822 f = updating_frame; |
823 if (f == 0) | |
286 | 824 { |
771 | 825 f = selected_frame; |
286 | 826 /* If not within an update, |
771 | 827 output at the frame's visible cursor. */ |
828 curs_x = f->cursor_x; | |
829 curs_y = f->cursor_y; | |
286 | 830 } |
831 | |
771 | 832 dumpglyphs (f, |
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
833 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
|
834 CHAR_TO_PIXEL_ROW (f, curs_y), |
6791
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
835 start, len, highlight, 0); |
429 | 836 |
837 /* If we drew on top of the cursor, note that it is turned off. */ | |
771 | 838 if (curs_y == f->phys_cursor_y |
839 && curs_x <= f->phys_cursor_x | |
840 && curs_x + len > f->phys_cursor_x) | |
841 f->phys_cursor_x = -1; | |
286 | 842 |
771 | 843 if (updating_frame == 0) |
286 | 844 { |
771 | 845 f->cursor_x += len; |
846 x_display_cursor (f, 1); | |
847 f->cursor_x -= len; | |
286 | 848 } |
849 else | |
850 curs_x += len; | |
851 | |
852 UNBLOCK_INPUT; | |
853 } | |
854 | |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
855 /* 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
|
856 Erase the current text line from the nominal cursor position (inclusive) |
286 | 857 to column FIRST_UNUSED (exclusive). The idea is that everything |
858 from FIRST_UNUSED onward is already erased. */ | |
859 | |
621 | 860 static int |
286 | 861 XTclear_end_of_line (first_unused) |
862 register int first_unused; | |
863 { | |
771 | 864 struct frame *f = updating_frame; |
286 | 865 int mask; |
866 | |
771 | 867 if (f == 0) |
286 | 868 abort (); |
869 | |
771 | 870 if (curs_y < 0 || curs_y >= f->height) |
286 | 871 return; |
872 if (first_unused <= 0) | |
873 return; | |
874 | |
771 | 875 if (first_unused >= f->width) |
876 first_unused = f->width; | |
286 | 877 |
878 BLOCK_INPUT; | |
879 | |
429 | 880 /* Notice if the cursor will be cleared by this operation. */ |
771 | 881 if (curs_y == f->phys_cursor_y |
882 && curs_x <= f->phys_cursor_x | |
883 && f->phys_cursor_x < first_unused) | |
884 f->phys_cursor_x = -1; | |
286 | 885 |
886 #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
|
887 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
|
888 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
|
889 CHAR_TO_PIXEL_ROW (f, curs_y), |
771 | 890 FONT_WIDTH (f->display.x->font) * (first_unused - curs_x), |
6767
8fbcee1c2059
(stufflines, scraplines, dumprectangle, x_do_pending_expose)
Richard M. Stallman <rms@gnu.org>
parents:
6757
diff
changeset
|
891 f->display.x->line_height, False); |
4277
c3fbb9249f5b
(redraw_previous_char): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4244
diff
changeset
|
892 #if 0 |
6791
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
893 redraw_previous_char (f, curs_x, curs_y, highlight); |
4277
c3fbb9249f5b
(redraw_previous_char): New function.
Richard M. Stallman <rms@gnu.org>
parents:
4244
diff
changeset
|
894 #endif |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
895 #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
|
896 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
|
897 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
|
898 CHAR_TO_PIXEL_ROW (f, curs_y), |
771 | 899 FONT_WIDTH (f->display.x->font) * (first_unused - curs_x), |
6767
8fbcee1c2059
(stufflines, scraplines, dumprectangle, x_do_pending_expose)
Richard M. Stallman <rms@gnu.org>
parents:
6757
diff
changeset
|
900 f->display.x->line_height, |
771 | 901 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
|
902 #endif /* ! defined (HAVE_X11) */ |
286 | 903 |
904 UNBLOCK_INPUT; | |
905 } | |
906 | |
907 static | |
771 | 908 XTclear_frame () |
286 | 909 { |
910 int mask; | |
771 | 911 struct frame *f = updating_frame; |
912 | |
913 if (f == 0) | |
914 f = selected_frame; | |
915 | |
916 f->phys_cursor_x = -1; /* Cursor not visible. */ | |
286 | 917 curs_x = 0; /* Nominal cursor position is top left. */ |
918 curs_y = 0; | |
919 | |
920 BLOCK_INPUT; | |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
921 |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
922 XClear (FRAME_X_WINDOW (f)); |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
923 |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
924 /* 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
|
925 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
|
926 x_scroll_bar_clear (f); |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
927 |
286 | 928 #ifndef HAVE_X11 |
771 | 929 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
|
930 #endif /* HAVE_X11 */ |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
931 |
286 | 932 XFlushQueue (); |
933 UNBLOCK_INPUT; | |
934 } | |
935 | |
6791
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
936 #if 0 |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
937 /* This currently does not work because FRAME_CURRENT_GLYPHS doesn't |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
938 always contain the right glyphs to use. |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
939 |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
940 It also needs to be changed to look at the details of the font and |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
941 see whether there is really overlap, and do nothing when there is |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
942 not. This can use font_char_overlap_left and font_char_overlap_right, |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
943 but just how to use them is not clear. */ |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
944 |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
945 /* Erase the character (if any) at the position just before X, Y in frame F, |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
946 then redraw it and the character before it. |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
947 This is necessary when we erase starting at X, |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
948 in case the character after X overlaps into the one before X. |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
949 Call this function with input blocked. */ |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
950 |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
951 static void |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
952 redraw_previous_char (f, x, y, highlight_flag) |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
953 FRAME_PTR f; |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
954 int x, y; |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
955 int highlight_flag; |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
956 { |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
957 /* Erase the character before the new ones, in case |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
958 what was here before overlaps it. |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
959 Reoutput that character, and the previous character |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
960 (in case the previous character overlaps it). */ |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
961 if (x > 0) |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
962 { |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
963 int start_x = x - 2; |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
964 if (start_x < 0) |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
965 start_x = 0; |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
966 XClearArea (x_current_display, FRAME_X_WINDOW (f), |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
967 CHAR_TO_PIXEL_COL (f, x - 1), |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
968 CHAR_TO_PIXEL_ROW (f, y), |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
969 FONT_WIDTH (f->display.x->font), |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
970 f->display.x->line_height, False); |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
971 |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
972 dumpglyphs (f, CHAR_TO_PIXEL_COL (f, start_x), |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
973 CHAR_TO_PIXEL_ROW (f, y), |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
974 &FRAME_CURRENT_GLYPHS (f)->glyphs[y][start_x], |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
975 x - start_x, highlight_flag, 1); |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
976 } |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
977 } |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
978 |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
979 /* Erase the character (if any) at the position X, Y in frame F, |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
980 then redraw it and the character after it. |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
981 This is necessary when we erase endng at X, |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
982 in case the character after X overlaps into the one before X. |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
983 Call this function with input blocked. */ |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
984 |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
985 static void |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
986 redraw_following_char (f, x, y, highlight_flag) |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
987 FRAME_PTR f; |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
988 int x, y; |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
989 int highlight_flag; |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
990 { |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
991 int limit = FRAME_CURRENT_GLYPHS (f)->used[y]; |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
992 /* Erase the character after the new ones, in case |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
993 what was here before overlaps it. |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
994 Reoutput that character, and the following character |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
995 (in case the following character overlaps it). */ |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
996 if (x < limit |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
997 && FRAME_CURRENT_GLYPHS (f)->glyphs[y][x] != SPACEGLYPH) |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
998 { |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
999 int end_x = x + 2; |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1000 if (end_x > limit) |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1001 end_x = limit; |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1002 XClearArea (x_current_display, FRAME_X_WINDOW (f), |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1003 CHAR_TO_PIXEL_COL (f, x), |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1004 CHAR_TO_PIXEL_ROW (f, y), |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1005 FONT_WIDTH (f->display.x->font), |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1006 f->display.x->line_height, False); |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1007 |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1008 dumpglyphs (f, CHAR_TO_PIXEL_COL (f, x), |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1009 CHAR_TO_PIXEL_ROW (f, y), |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1010 &FRAME_CURRENT_GLYPHS (f)->glyphs[y][x], |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1011 end_x - x, highlight_flag, 1); |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1012 } |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1013 } |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1014 #endif /* 0 */ |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1015 |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1016 #if 0 /* Not in use yet */ |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1017 |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1018 /* Return 1 if character C in font F extends past its left edge. */ |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1019 |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1020 static int |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1021 font_char_overlap_left (font, c) |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1022 XFontStruct *font; |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1023 int c; |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1024 { |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1025 XCharStruct *s; |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1026 |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1027 /* Find the bounding-box info for C. */ |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1028 if (font->per_char == 0) |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1029 s = &font->max_bounds; |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1030 else |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1031 { |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1032 int rowlen = font->max_char_or_byte2 - font->min_char_or_byte2 + 1; |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1033 int row, within; |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1034 |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1035 /* Decode char into row number (byte 1) and code within row (byte 2). */ |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1036 row = c >> 8; |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1037 within = c & 0177; |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1038 if (!(within >= font->min_char_or_byte2 |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1039 && within <= font->max_char_or_byte2 |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1040 && row >= font->min_byte1 |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1041 && row <= font->max_byte1)) |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1042 { |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1043 /* If char is out of range, try the font's default char instead. */ |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1044 c = font->default_char; |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1045 row = c >> (INTBITS - 8); |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1046 within = c & 0177; |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1047 } |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1048 if (!(within >= font->min_char_or_byte2 |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1049 && within <= font->max_char_or_byte2 |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1050 && row >= font->min_byte1 |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1051 && row <= font->max_byte1)) |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1052 /* Still out of range means this char does not overlap. */ |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1053 return 0; |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1054 else |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1055 /* We found the info for this char. */ |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1056 s = (font->per_char + (within - font->min_char_or_byte2) |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1057 + row * rowlen); |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1058 } |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1059 |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1060 return (s && s->lbearing < 0); |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1061 } |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1062 |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1063 /* Return 1 if character C in font F extends past its right edge. */ |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1064 |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1065 static int |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1066 font_char_overlap_right (font, c) |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1067 XFontStruct *font; |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1068 int c; |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1069 { |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1070 XCharStruct *s; |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1071 |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1072 /* Find the bounding-box info for C. */ |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1073 if (font->per_char == 0) |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1074 s = &font->max_bounds; |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1075 else |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1076 { |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1077 int rowlen = font->max_char_or_byte2 - font->min_char_or_byte2 + 1; |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1078 int row, within; |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1079 |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1080 /* Decode char into row number (byte 1) and code within row (byte 2). */ |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1081 row = c >> 8; |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1082 within = c & 0177; |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1083 if (!(within >= font->min_char_or_byte2 |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1084 && within <= font->max_char_or_byte2 |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1085 && row >= font->min_byte1 |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1086 && row <= font->max_byte1)) |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1087 { |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1088 /* If char is out of range, try the font's default char instead. */ |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1089 c = font->default_char; |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1090 row = c >> (INTBITS - 8); |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1091 within = c & 0177; |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1092 } |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1093 if (!(within >= font->min_char_or_byte2 |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1094 && within <= font->max_char_or_byte2 |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1095 && row >= font->min_byte1 |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1096 && row <= font->max_byte1)) |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1097 /* Still out of range means this char does not overlap. */ |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1098 return 0; |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1099 else |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1100 /* We found the info for this char. */ |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1101 s = (font->per_char + (within - font->min_char_or_byte2) |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1102 + row * rowlen); |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1103 } |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1104 |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1105 return (s && s->rbearing >= s->width); |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1106 } |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1107 #endif /* 0 */ |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1108 |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1109 /* 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
|
1110 |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1111 /* 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
|
1112 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
|
1113 #if defined (HAVE_TIMEVAL) && defined (HAVE_SELECT) |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1114 |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1115 /* Subtract the `struct timeval' values X and Y, |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1116 storing the result in RESULT. |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1117 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
|
1118 |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1119 static int |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1120 timeval_subtract (result, x, y) |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1121 struct timeval *result, x, y; |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1122 { |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1123 /* 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
|
1124 This is safer because on some systems |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1125 the tv_sec member is unsigned. */ |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1126 if (x.tv_usec < y.tv_usec) |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1127 { |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1128 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
|
1129 y.tv_usec -= 1000000 * nsec; |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1130 y.tv_sec += nsec; |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1131 } |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1132 if (x.tv_usec - y.tv_usec > 1000000) |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1133 { |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1134 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
|
1135 y.tv_usec += 1000000 * nsec; |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1136 y.tv_sec -= nsec; |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1137 } |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1138 |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1139 /* 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
|
1140 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
|
1141 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
|
1142 |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1143 /* 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
|
1144 return x.tv_sec < y.tv_sec; |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1145 } |
286 | 1146 |
771 | 1147 XTflash (f) |
1148 struct frame *f; | |
286 | 1149 { |
1150 BLOCK_INPUT; | |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1151 |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1152 { |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1153 GC gc; |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1154 |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1155 /* 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
|
1156 into background pixels. */ |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1157 { |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1158 XGCValues values; |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1159 |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1160 values.function = GXxor; |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1161 values.foreground = (f->display.x->foreground_pixel |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1162 ^ f->display.x->background_pixel); |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1163 |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1164 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
|
1165 GCFunction | GCForeground, &values); |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1166 } |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1167 |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1168 { |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1169 int width = PIXEL_WIDTH (f); |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1170 int height = PIXEL_HEIGHT (f); |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1171 |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1172 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
|
1173 width/4, height/4, width/2, height/2); |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1174 XFlush (x_current_display); |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1175 |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1176 { |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1177 struct timeval wakeup, now; |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1178 |
5362
d1fa597d923d
(XTflush): FIx typo in last change.
Richard M. Stallman <rms@gnu.org>
parents:
5357
diff
changeset
|
1179 EMACS_GET_TIME (wakeup); |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1180 |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1181 /* 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
|
1182 wakeup.tv_usec += 150000; |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1183 wakeup.tv_sec += (wakeup.tv_usec / 1000000); |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1184 wakeup.tv_usec %= 1000000; |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1185 |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1186 /* Keep waiting until past the time wakeup. */ |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1187 while (1) |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1188 { |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1189 struct timeval timeout; |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1190 |
5362
d1fa597d923d
(XTflush): FIx typo in last change.
Richard M. Stallman <rms@gnu.org>
parents:
5357
diff
changeset
|
1191 EMACS_GET_TIME (timeout); |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1192 |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1193 /* In effect, timeout = wakeup - timeout. |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1194 Break if result would be negative. */ |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1195 if (timeval_subtract (&timeout, wakeup, timeout)) |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1196 break; |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1197 |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1198 /* 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
|
1199 select (0, 0, 0, 0, &timeout); |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1200 } |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1201 } |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1202 |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1203 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
|
1204 width/4, height/4, width/2, height/2); |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1205 XFreeGC (x_current_display, gc); |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1206 XFlush (x_current_display); |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1207 } |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1208 } |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1209 |
286 | 1210 UNBLOCK_INPUT; |
1211 } | |
1212 | |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1213 #endif |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1214 |
286 | 1215 |
1216 /* Make audible bell. */ | |
1217 | |
1218 #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
|
1219 #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
|
1220 #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
|
1221 #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
|
1222 #endif /* ! defined (HAVE_X11) */ |
286 | 1223 |
1224 XTring_bell () | |
1225 { | |
3243
48d20a0b229a
(XTring_bell): Do nothing if x_current_connection is 0.
Richard M. Stallman <rms@gnu.org>
parents:
3218
diff
changeset
|
1226 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
|
1227 return; |
48d20a0b229a
(XTring_bell): Do nothing if x_current_connection is 0.
Richard M. Stallman <rms@gnu.org>
parents:
3218
diff
changeset
|
1228 |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1229 #if defined (HAVE_TIMEVAL) && defined (HAVE_SELECT) |
286 | 1230 if (visible_bell) |
771 | 1231 XTflash (selected_frame); |
286 | 1232 else |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1233 #endif |
286 | 1234 { |
1235 BLOCK_INPUT; | |
1236 XRINGBELL; | |
1237 XFlushQueue (); | |
1238 UNBLOCK_INPUT; | |
1239 } | |
1240 } | |
1241 | |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1242 /* Insert and delete character. |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1243 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
|
1244 off the feature of using them. */ |
286 | 1245 |
1246 static | |
1247 XTinsert_glyphs (start, len) | |
1248 register char *start; | |
1249 register int len; | |
1250 { | |
1251 abort (); | |
1252 } | |
1253 | |
1254 static | |
1255 XTdelete_glyphs (n) | |
1256 register int n; | |
1257 { | |
1258 abort (); | |
1259 } | |
1260 | |
1261 /* Specify how many text lines, from the top of the window, | |
1262 should be affected by insert-lines and delete-lines operations. | |
1263 This, and those operations, are used only within an update | |
1264 that is bounded by calls to XTupdate_begin and XTupdate_end. */ | |
1265 | |
1266 static | |
1267 XTset_terminal_window (n) | |
1268 register int n; | |
1269 { | |
771 | 1270 if (updating_frame == 0) |
286 | 1271 abort (); |
1272 | |
771 | 1273 if ((n <= 0) || (n > updating_frame->height)) |
1274 flexlines = updating_frame->height; | |
286 | 1275 else |
1276 flexlines = n; | |
1277 } | |
1278 | |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1279 /* 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
|
1280 Insert N lines at a vertical position curs_y. */ |
286 | 1281 |
1282 static void | |
1283 stufflines (n) | |
1284 register int n; | |
1285 { | |
1286 register int topregion, bottomregion; | |
1287 register int length, newtop, mask; | |
771 | 1288 register struct frame *f = updating_frame; |
1289 int intborder = f->display.x->internal_border_width; | |
286 | 1290 |
1291 if (curs_y >= flexlines) | |
1292 return; | |
1293 | |
1294 topregion = curs_y; | |
1295 bottomregion = flexlines - (n + 1); | |
1296 newtop = topregion + n; | |
1297 length = (bottomregion - topregion) + 1; | |
1298 | |
1299 #ifndef HAVE_X11 | |
1300 dumpqueue (); | |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1301 #endif /* HAVE_X11 */ |
286 | 1302 |
1303 if ((length > 0) && (newtop <= flexlines)) | |
1304 { | |
1305 #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
|
1306 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
|
1307 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
|
1308 intborder, CHAR_TO_PIXEL_ROW (f, topregion), |
771 | 1309 f->width * FONT_WIDTH (f->display.x->font), |
6767
8fbcee1c2059
(stufflines, scraplines, dumprectangle, x_do_pending_expose)
Richard M. Stallman <rms@gnu.org>
parents:
6757
diff
changeset
|
1310 length * f->display.x->line_height, intborder, |
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1311 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
|
1312 #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
|
1313 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
|
1314 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
|
1315 intborder, CHAR_TO_PIXEL_ROW (f, newtop), |
771 | 1316 f->width * FONT_WIDTH (f->display.x->font), |
6767
8fbcee1c2059
(stufflines, scraplines, dumprectangle, x_do_pending_expose)
Richard M. Stallman <rms@gnu.org>
parents:
6757
diff
changeset
|
1317 length * f->display.x->line_height); |
286 | 1318 /* Now we must process any ExposeRegion events that occur |
1319 if the area being copied from is obscured. | |
1320 We can't let it wait because further i/d operations | |
1321 may want to copy this area to another area. */ | |
1322 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
|
1323 #endif /* ! defined (HAVE_X11) */ |
286 | 1324 } |
1325 | |
1326 newtop = min (newtop, (flexlines - 1)); | |
1327 length = newtop - topregion; | |
1328 if (length > 0) | |
1329 { | |
1330 #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
|
1331 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
|
1332 CHAR_TO_PIXEL_ROW (f, topregion), |
771 | 1333 f->width * FONT_WIDTH (f->display.x->font), |
6767
8fbcee1c2059
(stufflines, scraplines, dumprectangle, x_do_pending_expose)
Richard M. Stallman <rms@gnu.org>
parents:
6757
diff
changeset
|
1334 n * f->display.x->line_height, False); |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1335 #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
|
1336 XPixSet (FRAME_X_WINDOW (f), |
286 | 1337 intborder, |
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1338 CHAR_TO_PIXEL_ROW (f, topregion), |
771 | 1339 f->width * FONT_WIDTH (f->display.x->font), |
6767
8fbcee1c2059
(stufflines, scraplines, dumprectangle, x_do_pending_expose)
Richard M. Stallman <rms@gnu.org>
parents:
6757
diff
changeset
|
1340 n * f->display.x->line_height, |
771 | 1341 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
|
1342 #endif /* ! defined (HAVE_X11) */ |
286 | 1343 } |
1344 } | |
1345 | |
1346 /* Perform a delete-lines operation, deleting N lines | |
1347 at a vertical position curs_y. */ | |
1348 | |
1349 static void | |
1350 scraplines (n) | |
1351 register int n; | |
1352 { | |
1353 int mask; | |
771 | 1354 register struct frame *f = updating_frame; |
1355 int intborder = f->display.x->internal_border_width; | |
286 | 1356 |
1357 if (curs_y >= flexlines) | |
1358 return; | |
1359 | |
1360 #ifndef HAVE_X11 | |
1361 dumpqueue (); | |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1362 #endif /* HAVE_X11 */ |
286 | 1363 |
1364 if ((curs_y + n) >= flexlines) | |
1365 { | |
1366 if (flexlines >= (curs_y + 1)) | |
1367 { | |
1368 #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
|
1369 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
|
1370 CHAR_TO_PIXEL_ROW (f, curs_y), |
771 | 1371 f->width * FONT_WIDTH (f->display.x->font), |
6767
8fbcee1c2059
(stufflines, scraplines, dumprectangle, x_do_pending_expose)
Richard M. Stallman <rms@gnu.org>
parents:
6757
diff
changeset
|
1372 (flexlines - curs_y) * f->display.x->line_height, False); |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1373 #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
|
1374 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
|
1375 intborder, CHAR_TO_PIXEL_ROW (f, curs_y), |
771 | 1376 f->width * FONT_WIDTH (f->display.x->font), |
6767
8fbcee1c2059
(stufflines, scraplines, dumprectangle, x_do_pending_expose)
Richard M. Stallman <rms@gnu.org>
parents:
6757
diff
changeset
|
1377 (flexlines - curs_y) * f->display.x->line_height, |
771 | 1378 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
|
1379 #endif /* ! defined (HAVE_X11) */ |
286 | 1380 } |
1381 } | |
1382 else | |
1383 { | |
1384 #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
|
1385 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
|
1386 FRAME_X_WINDOW (f), f->display.x->normal_gc, |
286 | 1387 intborder, |
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1388 CHAR_TO_PIXEL_ROW (f, curs_y + n), |
771 | 1389 f->width * FONT_WIDTH (f->display.x->font), |
6767
8fbcee1c2059
(stufflines, scraplines, dumprectangle, x_do_pending_expose)
Richard M. Stallman <rms@gnu.org>
parents:
6757
diff
changeset
|
1390 (flexlines - (curs_y + n)) * f->display.x->line_height, |
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1391 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
|
1392 XClearArea (x_current_display, FRAME_X_WINDOW (f), |
286 | 1393 intborder, |
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1394 CHAR_TO_PIXEL_ROW (f, flexlines - n), |
771 | 1395 f->width * FONT_WIDTH (f->display.x->font), |
6767
8fbcee1c2059
(stufflines, scraplines, dumprectangle, x_do_pending_expose)
Richard M. Stallman <rms@gnu.org>
parents:
6757
diff
changeset
|
1396 n * f->display.x->line_height, False); |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1397 #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
|
1398 XMoveArea (FRAME_X_WINDOW (f), |
286 | 1399 intborder, |
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1400 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
|
1401 intborder, CHAR_TO_PIXEL_ROW (f, curs_y), |
771 | 1402 f->width * FONT_WIDTH (f->display.x->font), |
6767
8fbcee1c2059
(stufflines, scraplines, dumprectangle, x_do_pending_expose)
Richard M. Stallman <rms@gnu.org>
parents:
6757
diff
changeset
|
1403 (flexlines - (curs_y + n)) * f->display.x->line_height); |
286 | 1404 /* Now we must process any ExposeRegion events that occur |
1405 if the area being copied from is obscured. | |
1406 We can't let it wait because further i/d operations | |
1407 may want to copy this area to another area. */ | |
1408 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
|
1409 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
|
1410 CHAR_TO_PIXEL_ROW (f, flexlines - n), |
771 | 1411 f->width * FONT_WIDTH (f->display.x->font), |
6767
8fbcee1c2059
(stufflines, scraplines, dumprectangle, x_do_pending_expose)
Richard M. Stallman <rms@gnu.org>
parents:
6757
diff
changeset
|
1412 n * f->display.x->line_height, 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
|
1413 #endif /* ! defined (HAVE_X11) */ |
286 | 1414 } |
1415 } | |
1416 | |
1417 /* Perform an insert-lines or delete-lines operation, | |
1418 inserting N lines or deleting -N lines at vertical position VPOS. */ | |
1419 | |
1420 XTins_del_lines (vpos, n) | |
1421 int vpos, n; | |
1422 { | |
771 | 1423 if (updating_frame == 0) |
286 | 1424 abort (); |
1425 | |
429 | 1426 /* Hide the cursor. */ |
771 | 1427 x_display_cursor (updating_frame, 0); |
286 | 1428 |
1429 XTcursor_to (vpos, 0); | |
1430 | |
1431 BLOCK_INPUT; | |
1432 if (n >= 0) | |
1433 stufflines (n); | |
1434 else | |
1435 scraplines (-n); | |
1436 XFlushQueue (); | |
1437 UNBLOCK_INPUT; | |
1438 } | |
1439 | |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1440 /* Support routines for exposure events. */ |
286 | 1441 static void clear_cursor (); |
1442 | |
771 | 1443 /* Output into a rectangle of an X-window (for frame F) |
1444 the characters in f->phys_lines that overlap that rectangle. | |
286 | 1445 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
|
1446 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
|
1447 Call this function with input blocked. */ |
286 | 1448 |
1449 static void | |
771 | 1450 dumprectangle (f, left, top, cols, rows) |
1451 struct frame *f; | |
286 | 1452 register int left, top, cols, rows; |
1453 { | |
771 | 1454 register struct frame_glyphs *active_frame = FRAME_CURRENT_GLYPHS (f); |
286 | 1455 int cursor_cleared = 0; |
1456 int bottom, right; | |
1457 register int y; | |
1458 | |
771 | 1459 if (FRAME_GARBAGED_P (f)) |
286 | 1460 return; |
1461 | |
1462 /* Express rectangle as four edges, instead of position-and-size. */ | |
1463 bottom = top + rows; | |
1464 right = left + cols; | |
1465 | |
1466 #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
|
1467 { |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1468 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
|
1469 |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1470 /* 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
|
1471 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
|
1472 if (top < intborder || left < intborder |
6767
8fbcee1c2059
(stufflines, scraplines, dumprectangle, x_do_pending_expose)
Richard M. Stallman <rms@gnu.org>
parents:
6757
diff
changeset
|
1473 || bottom > intborder + f->height * f->display.x->line_height |
8fbcee1c2059
(stufflines, scraplines, dumprectangle, x_do_pending_expose)
Richard M. Stallman <rms@gnu.org>
parents:
6757
diff
changeset
|
1474 || right > intborder + f->width * f->display.x->line_height) |
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1475 dumpborder (f, 0); |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1476 } |
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
1477 #endif /* not HAVE_X11 Window manger does this for X11. */ |
286 | 1478 |
1479 /* Convert rectangle edges in pixels to edges in chars. | |
1480 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
|
1481 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
|
1482 left = PIXEL_TO_CHAR_COL (f, left); |
6767
8fbcee1c2059
(stufflines, scraplines, dumprectangle, x_do_pending_expose)
Richard M. Stallman <rms@gnu.org>
parents:
6757
diff
changeset
|
1483 bottom += (f->display.x->line_height - 1); |
771 | 1484 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
|
1485 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
|
1486 right = PIXEL_TO_CHAR_COL (f, right); |
286 | 1487 |
1488 /* Clip the rectangle to what can be visible. */ | |
1489 if (left < 0) | |
1490 left = 0; | |
1491 if (top < 0) | |
1492 top = 0; | |
771 | 1493 if (right > f->width) |
1494 right = f->width; | |
1495 if (bottom > f->height) | |
1496 bottom = f->height; | |
286 | 1497 |
1498 /* Get size in chars of the rectangle. */ | |
1499 cols = right - left; | |
1500 rows = bottom - top; | |
1501 | |
1502 /* If rectangle has zero area, return. */ | |
1503 if (rows <= 0) return; | |
1504 if (cols <= 0) return; | |
1505 | |
1506 /* Turn off the cursor if it is in the rectangle. | |
1507 We will turn it back on afterward. */ | |
771 | 1508 if ((f->phys_cursor_x >= left) && (f->phys_cursor_x < right) |
1509 && (f->phys_cursor_y >= top) && (f->phys_cursor_y < bottom)) | |
286 | 1510 { |
771 | 1511 clear_cursor (f); |
286 | 1512 cursor_cleared = 1; |
1513 } | |
1514 | |
1515 /* Display the text in the rectangle, one text line at a time. */ | |
1516 | |
1517 for (y = top; y < bottom; y++) | |
1518 { | |
771 | 1519 GLYPH *line = &active_frame->glyphs[y][left]; |
1520 | |
1521 if (! active_frame->enable[y] || left > active_frame->used[y]) | |
286 | 1522 continue; |
1523 | |
771 | 1524 dumpglyphs (f, |
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1525 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
|
1526 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
|
1527 line, min (cols, active_frame->used[y] - left), |
6791
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
1528 active_frame->highlight[y], 0); |
286 | 1529 } |
1530 | |
1531 /* Turn the cursor on if we turned it off. */ | |
1532 | |
1533 if (cursor_cleared) | |
771 | 1534 x_display_cursor (f, 1); |
286 | 1535 } |
1536 | |
1537 #ifndef HAVE_X11 | |
1538 /* Process all queued ExposeRegion events. */ | |
1539 | |
1540 static void | |
1541 dumpqueue () | |
1542 { | |
1543 register int i; | |
1544 XExposeRegionEvent r; | |
1545 | |
1546 while (dequeue_event (&r, &x_expose_queue)) | |
1547 { | |
771 | 1548 struct frame *f = x_window_to_frame (r.window); |
1549 if (f->display.x->icon_desc == r.window) | |
1550 refreshicon (f); | |
286 | 1551 else |
771 | 1552 dumprectangle (f, r.x, r.y, r.width, r.height); |
286 | 1553 } |
1554 XFlushQueue (); | |
1555 } | |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1556 #endif /* HAVE_X11 */ |
286 | 1557 |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1558 /* Process all expose events that are pending, for X10. |
771 | 1559 Redraws the cursor if necessary on any frame that |
1560 is not in the process of being updated with update_frame. */ | |
286 | 1561 |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1562 #ifndef HAVE_X11 |
286 | 1563 static void |
1564 x_do_pending_expose () | |
1565 { | |
1566 int mask; | |
771 | 1567 struct frame *f; |
1568 Lisp_Object tail, frame; | |
286 | 1569 |
1570 if (expose_all_windows) | |
1571 { | |
1572 expose_all_windows = 0; | |
771 | 1573 for (tail = Vframe_list; CONSP (tail); tail = XCONS (tail)->cdr) |
286 | 1574 { |
1575 register int temp_width, temp_height; | |
1576 int intborder; | |
1577 | |
771 | 1578 frame = XCONS (tail)->car; |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1579 if (XGCTYPE (frame) != Lisp_Frame) |
286 | 1580 continue; |
771 | 1581 f = XFRAME (frame); |
976
cbdfc337ec8f
* xterm.c (x_wm_hints): New variable.
Jim Blandy <jimb@redhat.com>
parents:
786
diff
changeset
|
1582 if (! FRAME_X_P (f)) |
286 | 1583 continue; |
1658
452ba03935d7
* xterm.c (XTread_socket): When we get MapNotify, UnmapNotify,
Jim Blandy <jimb@redhat.com>
parents:
1530
diff
changeset
|
1584 if (!f->async_visible) |
286 | 1585 continue; |
771 | 1586 if (!f->display.x->needs_exposure) |
286 | 1587 continue; |
1588 | |
771 | 1589 intborder = f->display.x->internal_border_width; |
1590 | |
1591 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
|
1592 XGetWindowInfo (FRAME_X_WINDOW (f), &windowinfo); |
286 | 1593 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
|
1594 - f->display.x->v_scroll_bar_width) |
771 | 1595 / FONT_WIDTH (f->display.x->font)); |
286 | 1596 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
|
1597 - f->display.x->h_scroll_bar_height) |
6767
8fbcee1c2059
(stufflines, scraplines, dumprectangle, x_do_pending_expose)
Richard M. Stallman <rms@gnu.org>
parents:
6757
diff
changeset
|
1598 / f->display.x->line_height); |
771 | 1599 if (temp_width != f->width || temp_height != f->height) |
286 | 1600 { |
771 | 1601 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
|
1602 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
|
1603 x_resize_scroll_bars (f); |
286 | 1604 } |
771 | 1605 f->display.x->left_pos = windowinfo.x; |
1606 f->display.x->top_pos = windowinfo.y; | |
1607 dumprectangle (f, 0, 0, PIXEL_WIDTH (f), PIXEL_HEIGHT (f)); | |
286 | 1608 #if 0 |
771 | 1609 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
|
1610 #endif /* ! 0 */ |
771 | 1611 f->display.x->needs_exposure = 0; |
1612 if (updating_frame != f) | |
1613 x_display_cursor (f, 1); | |
286 | 1614 XFlushQueue (); |
1615 } | |
1616 } | |
1617 else | |
1618 /* Handle any individual-rectangle expose events queued | |
1619 for various windows. */ | |
1620 #ifdef HAVE_X11 | |
1621 ; | |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1622 #else /* ! defined (HAVE_X11) */ |
286 | 1623 dumpqueue (); |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1624 #endif /* ! defined (HAVE_X11) */ |
286 | 1625 } |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1626 #endif |
286 | 1627 |
1628 #ifdef HAVE_X11 | |
1629 static void | |
771 | 1630 frame_highlight (frame) |
1631 struct frame *frame; | |
286 | 1632 { |
3943
cbdf67dd68d0
* xterm.c (frame_highlight, frame_unhighlight): Don't test
Jim Blandy <jimb@redhat.com>
parents:
3938
diff
changeset
|
1633 /* 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
|
1634 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
|
1635 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
|
1636 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
|
1637 BLOCK_INPUT; |
cbdf67dd68d0
* xterm.c (frame_highlight, frame_unhighlight): Don't test
Jim Blandy <jimb@redhat.com>
parents:
3938
diff
changeset
|
1638 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
|
1639 frame->display.x->border_pixel); |
cbdf67dd68d0
* xterm.c (frame_highlight, frame_unhighlight): Don't test
Jim Blandy <jimb@redhat.com>
parents:
3938
diff
changeset
|
1640 UNBLOCK_INPUT; |
771 | 1641 x_display_cursor (frame, 1); |
286 | 1642 } |
1643 | |
1644 static void | |
771 | 1645 frame_unhighlight (frame) |
1646 struct frame *frame; | |
286 | 1647 { |
3943
cbdf67dd68d0
* xterm.c (frame_highlight, frame_unhighlight): Don't test
Jim Blandy <jimb@redhat.com>
parents:
3938
diff
changeset
|
1648 /* 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
|
1649 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
|
1650 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
|
1651 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
|
1652 BLOCK_INPUT; |
cbdf67dd68d0
* xterm.c (frame_highlight, frame_unhighlight): Don't test
Jim Blandy <jimb@redhat.com>
parents:
3938
diff
changeset
|
1653 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
|
1654 frame->display.x->border_tile); |
cbdf67dd68d0
* xterm.c (frame_highlight, frame_unhighlight): Don't test
Jim Blandy <jimb@redhat.com>
parents:
3938
diff
changeset
|
1655 UNBLOCK_INPUT; |
771 | 1656 x_display_cursor (frame, 1); |
286 | 1657 } |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1658 #else /* ! defined (HAVE_X11) */ |
771 | 1659 /* Dump the border-emphasis of frame F. |
1660 If F is selected, this is a lining of the same color as the border, | |
286 | 1661 just within the border, occupying a portion of the internal border. |
771 | 1662 If F is not selected, it is background in the same place. |
286 | 1663 If ALWAYS is 0, don't bother explicitly drawing if it's background. |
1664 | |
771 | 1665 ALWAYS = 1 is used when a frame becomes selected or deselected. |
286 | 1666 In that case, we also turn the cursor off and on again |
1667 so it will appear in the proper shape (solid if selected; else hollow.) */ | |
1668 | |
1669 static void | |
771 | 1670 dumpborder (f, always) |
1671 struct frame *f; | |
286 | 1672 int always; |
1673 { | |
771 | 1674 int thickness = f->display.x->internal_border_width / 2; |
1675 int width = PIXEL_WIDTH (f); | |
1676 int height = PIXEL_HEIGHT (f); | |
286 | 1677 int pixel; |
1678 | |
771 | 1679 if (f != selected_frame) |
286 | 1680 { |
1681 if (!always) | |
1682 return; | |
1683 | |
771 | 1684 pixel = f->display.x->background_pixel; |
286 | 1685 } |
1686 else | |
1687 { | |
771 | 1688 pixel = f->display.x->border_pixel; |
286 | 1689 } |
1690 | |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1691 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
|
1692 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
|
1693 XPixSet (FRAME_X_WINDOW (f), 0, height - thickness, width, |
286 | 1694 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
|
1695 XPixSet (FRAME_X_WINDOW (f), width - thickness, 0, thickness, |
286 | 1696 height, pixel); |
1697 | |
1698 if (always) | |
771 | 1699 x_display_cursor (f, 1); |
286 | 1700 } |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1701 #endif /* ! defined (HAVE_X11) */ |
286 | 1702 |
771 | 1703 static void XTframe_rehighlight (); |
1704 | |
1705 /* The focus has changed. Update the frames as necessary to reflect | |
1706 the new situation. Note that we can't change the selected frame | |
286 | 1707 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
|
1708 Each event gets marked with the frame in which it occurred, so the |
369 | 1709 lisp code can tell when the switch took place by examining the events. */ |
1710 | |
1711 static void | |
771 | 1712 x_new_focus_frame (frame) |
1713 struct frame *frame; | |
286 | 1714 { |
771 | 1715 struct frame *old_focus = x_focus_frame; |
286 | 1716 int events_enqueued = 0; |
1717 | |
771 | 1718 if (frame != x_focus_frame) |
286 | 1719 { |
369 | 1720 /* Set this before calling other routines, so that they see |
771 | 1721 the correct value of x_focus_frame. */ |
1722 x_focus_frame = frame; | |
369 | 1723 |
1724 if (old_focus && old_focus->auto_lower) | |
771 | 1725 x_lower_frame (old_focus); |
286 | 1726 |
1727 #if 0 | |
771 | 1728 selected_frame = frame; |
1729 XSET (XWINDOW (selected_frame->selected_window)->frame, | |
1730 Lisp_Frame, selected_frame); | |
1731 Fselect_window (selected_frame->selected_window); | |
1732 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
|
1733 #endif /* ! 0 */ |
286 | 1734 |
771 | 1735 if (x_focus_frame && x_focus_frame->auto_raise) |
6883
77ceede38423
(x_make_frame_visible): Don't call XMapSubwindows.
Richard M. Stallman <rms@gnu.org>
parents:
6791
diff
changeset
|
1736 pending_autoraise_frame = x_focus_frame; |
77ceede38423
(x_make_frame_visible): Don't call XMapSubwindows.
Richard M. Stallman <rms@gnu.org>
parents:
6791
diff
changeset
|
1737 else |
77ceede38423
(x_make_frame_visible): Don't call XMapSubwindows.
Richard M. Stallman <rms@gnu.org>
parents:
6791
diff
changeset
|
1738 pending_autoraise_frame = 0; |
369 | 1739 } |
1740 | |
771 | 1741 XTframe_rehighlight (); |
369 | 1742 } |
1743 | |
1744 | |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1745 /* 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
|
1746 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
|
1747 minibuffer frame). Shift the highlight as appropriate. */ |
369 | 1748 static void |
771 | 1749 XTframe_rehighlight () |
369 | 1750 { |
771 | 1751 struct frame *old_highlight = x_highlight_frame; |
1752 | |
1753 if (x_focus_frame) | |
286 | 1754 { |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1755 x_highlight_frame = |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1756 ((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
|
1757 ? 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
|
1758 : x_focus_frame); |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1759 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
|
1760 { |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1761 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
|
1762 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
|
1763 } |
286 | 1764 } |
369 | 1765 else |
771 | 1766 x_highlight_frame = 0; |
1767 | |
1768 if (x_highlight_frame != old_highlight) | |
369 | 1769 { |
1770 if (old_highlight) | |
771 | 1771 frame_unhighlight (old_highlight); |
1772 if (x_highlight_frame) | |
1773 frame_highlight (x_highlight_frame); | |
369 | 1774 } |
286 | 1775 } |
1776 | |
3585
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1777 /* Keyboard processing - modifier keys, vendor-specific keysyms, etc. */ |
286 | 1778 |
1279
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1779 /* 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
|
1780 |
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1781 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
|
1782 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
|
1783 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
|
1784 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
|
1785 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
|
1786 |
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1787 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
|
1788 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
|
1789 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
|
1790 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
|
1791 |
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
1792 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
|
1793 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
|
1794 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
|
1795 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
|
1796 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
|
1797 (EVENT.state & x_shift_lock_mask) != 0. */ |
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
1798 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
|
1799 |
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
|
1800 /* 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
|
1801 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
|
1802 |
1279
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1803 /* 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
|
1804 static void |
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1805 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
|
1806 { |
1324
44215417cf6e
* xterm.c (x_find_modifier_meanings): If there are no
Jim Blandy <jimb@redhat.com>
parents:
1279
diff
changeset
|
1807 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
|
1808 KeySym *syms; |
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1809 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
|
1810 XModifierKeymap *mods; |
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1811 |
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1812 x_meta_mod_mask = 0; |
1436
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
1813 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
|
1814 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
|
1815 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
|
1816 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
|
1817 |
2127
adaf588e32a6
* xterm.c (x_find_modifier_meanings): XDisplayKeycodes only
Jim Blandy <jimb@redhat.com>
parents:
2064
diff
changeset
|
1818 #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
|
1819 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
|
1820 #else |
adaf588e32a6
* xterm.c (x_find_modifier_meanings): XDisplayKeycodes only
Jim Blandy <jimb@redhat.com>
parents:
2064
diff
changeset
|
1821 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
|
1822 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
|
1823 #endif |
adaf588e32a6
* xterm.c (x_find_modifier_meanings): XDisplayKeycodes only
Jim Blandy <jimb@redhat.com>
parents:
2064
diff
changeset
|
1824 |
1279
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1825 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
|
1826 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
|
1827 &syms_per_code); |
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1828 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
|
1829 |
1436
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
1830 /* 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
|
1831 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
|
1832 { |
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1833 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
|
1834 |
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1835 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
|
1836 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
|
1837 { |
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1838 KeyCode code = |
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1839 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
|
1840 |
6560
a071babfa9ea
(x_find_modifier_meanings): Skip zero entries.
Karl Heuer <kwzh@gnu.org>
parents:
6521
diff
changeset
|
1841 /* Zeroes are used for filler. Skip them. */ |
a071babfa9ea
(x_find_modifier_meanings): Skip zero entries.
Karl Heuer <kwzh@gnu.org>
parents:
6521
diff
changeset
|
1842 if (code == 0) |
a071babfa9ea
(x_find_modifier_meanings): Skip zero entries.
Karl Heuer <kwzh@gnu.org>
parents:
6521
diff
changeset
|
1843 continue; |
a071babfa9ea
(x_find_modifier_meanings): Skip zero entries.
Karl Heuer <kwzh@gnu.org>
parents:
6521
diff
changeset
|
1844 |
1279
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1845 /* 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
|
1846 { |
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1847 int code_col; |
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1848 |
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1849 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
|
1850 { |
1324
44215417cf6e
* xterm.c (x_find_modifier_meanings): If there are no
Jim Blandy <jimb@redhat.com>
parents:
1279
diff
changeset
|
1851 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
|
1852 |
44215417cf6e
* xterm.c (x_find_modifier_meanings): If there are no
Jim Blandy <jimb@redhat.com>
parents:
1279
diff
changeset
|
1853 switch (sym) |
1279
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1854 { |
1324
44215417cf6e
* xterm.c (x_find_modifier_meanings): If there are no
Jim Blandy <jimb@redhat.com>
parents:
1279
diff
changeset
|
1855 case XK_Meta_L: |
44215417cf6e
* xterm.c (x_find_modifier_meanings): If there are no
Jim Blandy <jimb@redhat.com>
parents:
1279
diff
changeset
|
1856 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
|
1857 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
|
1858 break; |
1324
44215417cf6e
* xterm.c (x_find_modifier_meanings): If there are no
Jim Blandy <jimb@redhat.com>
parents:
1279
diff
changeset
|
1859 |
44215417cf6e
* xterm.c (x_find_modifier_meanings): If there are no
Jim Blandy <jimb@redhat.com>
parents:
1279
diff
changeset
|
1860 case XK_Alt_L: |
44215417cf6e
* xterm.c (x_find_modifier_meanings): If there are no
Jim Blandy <jimb@redhat.com>
parents:
1279
diff
changeset
|
1861 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
|
1862 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
|
1863 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
|
1864 |
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
|
1865 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
|
1866 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
|
1867 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
|
1868 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
|
1869 |
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
|
1870 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
|
1871 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
|
1872 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
|
1873 break; |
1436
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
1874 |
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
1875 case XK_Shift_Lock: |
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
1876 /* 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
|
1877 if ((1 << row) == LockMask) |
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
1878 x_shift_lock_mask = LockMask; |
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
1879 break; |
1279
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1880 } |
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1881 } |
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1882 } |
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1883 } |
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1884 } |
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1885 |
1324
44215417cf6e
* xterm.c (x_find_modifier_meanings): If there are no
Jim Blandy <jimb@redhat.com>
parents:
1279
diff
changeset
|
1886 /* 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
|
1887 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
|
1888 { |
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
|
1889 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
|
1890 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
|
1891 } |
1324
44215417cf6e
* xterm.c (x_find_modifier_meanings): If there are no
Jim Blandy <jimb@redhat.com>
parents:
1279
diff
changeset
|
1892 |
2923
c8997402dd6b
(x_find_modifier_meanings): If some keys are meta and alt,
Richard M. Stallman <rms@gnu.org>
parents:
2882
diff
changeset
|
1893 /* 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
|
1894 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
|
1895 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
|
1896 { |
c8997402dd6b
(x_find_modifier_meanings): If some keys are meta and alt,
Richard M. Stallman <rms@gnu.org>
parents:
2882
diff
changeset
|
1897 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
|
1898 } |
c8997402dd6b
(x_find_modifier_meanings): If some keys are meta and alt,
Richard M. Stallman <rms@gnu.org>
parents:
2882
diff
changeset
|
1899 |
1279
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1900 XFree ((char *) syms); |
1324
44215417cf6e
* xterm.c (x_find_modifier_meanings): If there are no
Jim Blandy <jimb@redhat.com>
parents:
1279
diff
changeset
|
1901 XFreeModifiermap (mods); |
1279
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1902 } |
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1903 |
2661
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
1904 /* 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
|
1905 Emacs uses. */ |
1530
a7f8a1fe258e
* xterm.c (x_convert_modifiers): Declare this to return an
Jim Blandy <jimb@redhat.com>
parents:
1436
diff
changeset
|
1906 static unsigned int |
2661
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
1907 x_x_to_emacs_modifiers (state) |
286 | 1908 unsigned int state; |
1909 { | |
1436
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
1910 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
|
1911 | ((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
|
1912 | ((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
|
1913 | ((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
|
1914 | ((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
|
1915 | ((state & x_hyper_mod_mask) ? hyper_modifier : 0)); |
286 | 1916 } |
1917 | |
2661
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
1918 static unsigned int |
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
1919 x_emacs_to_x_modifiers (state) |
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
1920 unsigned int state; |
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
1921 { |
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
1922 return ( ((state & alt_modifier) ? x_alt_mod_mask : 0) |
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
1923 | ((state & super_modifier) ? x_super_mod_mask : 0) |
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
1924 | ((state & hyper_modifier) ? x_hyper_mod_mask : 0) |
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
1925 | ((state & shift_modifier) ? ShiftMask : 0) |
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
1926 | ((state & ctrl_modifier) ? ControlMask : 0) |
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
1927 | ((state & meta_modifier) ? x_meta_mod_mask : 0)); |
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
1928 } |
3585
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1929 |
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1930 /* Mouse clicks and mouse movement. Rah. */ |
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1931 #ifdef HAVE_X11 |
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1932 |
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1933 /* 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
|
1934 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
|
1935 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
|
1936 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
|
1937 |
6023
67aa546e4ff1
(construct_menu_click): Undo previous change.
Richard M. Stallman <rms@gnu.org>
parents:
6022
diff
changeset
|
1938 void |
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
1939 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
|
1940 FRAME_PTR f; |
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
1941 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
|
1942 register int *x, *y; |
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1943 XRectangle *bounds; |
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
1944 int noclip; |
3585
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1945 { |
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
1946 /* 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
|
1947 even for negative values. */ |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
1948 if (pix_x < 0) |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
1949 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
|
1950 if (pix_y < 0) |
6767
8fbcee1c2059
(stufflines, scraplines, dumprectangle, x_do_pending_expose)
Richard M. Stallman <rms@gnu.org>
parents:
6757
diff
changeset
|
1951 pix_y -= (f)->display.x->line_height - 1; |
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
1952 |
3585
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1953 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
|
1954 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
|
1955 |
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1956 if (bounds) |
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1957 { |
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1958 bounds->width = FONT_WIDTH (f->display.x->font); |
6767
8fbcee1c2059
(stufflines, scraplines, dumprectangle, x_do_pending_expose)
Richard M. Stallman <rms@gnu.org>
parents:
6757
diff
changeset
|
1959 bounds->height = f->display.x->line_height; |
3585
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1960 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
|
1961 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
|
1962 } |
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1963 |
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
1964 if (!noclip) |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
1965 { |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
1966 if (pix_x < 0) |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
1967 pix_x = 0; |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
1968 else if (pix_x > f->width) |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
1969 pix_x = f->width; |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
1970 |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
1971 if (pix_y < 0) |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
1972 pix_y = 0; |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
1973 else if (pix_y > f->height) |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
1974 pix_y = f->height; |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
1975 } |
3585
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1976 |
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1977 *x = pix_x; |
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1978 *y = pix_y; |
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1979 } |
19aab2d09a4d
* xterm.c (x_is_vendor_fkey): New function.
Jim Blandy <jimb@redhat.com>
parents:
3558
diff
changeset
|
1980 |
6055
a9f61727a90c
(construct_mouse_click): Don't convert to glyph units.
Richard M. Stallman <rms@gnu.org>
parents:
6023
diff
changeset
|
1981 void |
a9f61727a90c
(construct_mouse_click): Don't convert to glyph units.
Richard M. Stallman <rms@gnu.org>
parents:
6023
diff
changeset
|
1982 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
|
1983 FRAME_PTR f; |
a9f61727a90c
(construct_mouse_click): Don't convert to glyph units.
Richard M. Stallman <rms@gnu.org>
parents:
6023
diff
changeset
|
1984 register int x, y; |
a9f61727a90c
(construct_mouse_click): Don't convert to glyph units.
Richard M. Stallman <rms@gnu.org>
parents:
6023
diff
changeset
|
1985 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
|
1986 { |
a9f61727a90c
(construct_mouse_click): Don't convert to glyph units.
Richard M. Stallman <rms@gnu.org>
parents:
6023
diff
changeset
|
1987 *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
|
1988 *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
|
1989 } |
a9f61727a90c
(construct_mouse_click): Don't convert to glyph units.
Richard M. Stallman <rms@gnu.org>
parents:
6023
diff
changeset
|
1990 |
286 | 1991 /* Prepare a mouse-event in *RESULT for placement in the input queue. |
1992 | |
1993 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
|
1994 the mouse. */ |
286 | 1995 |
1996 static Lisp_Object | |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1997 construct_mouse_click (result, event, f) |
286 | 1998 struct input_event *result; |
1999 XButtonEvent *event; | |
771 | 2000 struct frame *f; |
286 | 2001 { |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2002 /* Make the event type no_event; we'll change that when we decide |
286 | 2003 otherwise. */ |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2004 result->kind = mouse_click; |
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2005 result->code = event->button - Button1; |
708 | 2006 result->timestamp = event->time; |
2661
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
2007 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
|
2008 | (event->type == ButtonRelease |
44215417cf6e
* xterm.c (x_find_modifier_meanings): If there are no
Jim Blandy <jimb@redhat.com>
parents:
1279
diff
changeset
|
2009 ? up_modifier |
44215417cf6e
* xterm.c (x_find_modifier_meanings): If there are no
Jim Blandy <jimb@redhat.com>
parents:
1279
diff
changeset
|
2010 : down_modifier)); |
286 | 2011 |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2012 { |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2013 int row, column; |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2014 |
6055
a9f61727a90c
(construct_mouse_click): Don't convert to glyph units.
Richard M. Stallman <rms@gnu.org>
parents:
6023
diff
changeset
|
2015 #if 0 |
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2016 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
|
2017 XFASTINT (result->x) = column; |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2018 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
|
2019 #endif |
6626
59c44532d2a0
(construct_menu_click, construct_mouse_click):
Richard M. Stallman <rms@gnu.org>
parents:
6616
diff
changeset
|
2020 XSET (result->x, Lisp_Int, event->x); |
59c44532d2a0
(construct_menu_click, construct_mouse_click):
Richard M. Stallman <rms@gnu.org>
parents:
6616
diff
changeset
|
2021 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
|
2022 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
|
2023 } |
286 | 2024 } |
6022
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
2025 |
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
2026 /* 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
|
2027 |
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
2028 static Lisp_Object |
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
2029 construct_menu_click (result, event, f) |
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
2030 struct input_event *result; |
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
2031 XButtonEvent *event; |
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
2032 struct frame *f; |
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
2033 { |
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
2034 /* 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
|
2035 otherwise. */ |
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
2036 result->kind = mouse_click; |
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
2037 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
|
2038 result->timestamp = event->time; |
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
2039 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
|
2040 | (event->type == ButtonRelease |
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
2041 ? up_modifier |
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
2042 : down_modifier)); |
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
2043 |
6626
59c44532d2a0
(construct_menu_click, construct_mouse_click):
Richard M. Stallman <rms@gnu.org>
parents:
6616
diff
changeset
|
2044 XSET (result->x, Lisp_Int, event->x); |
59c44532d2a0
(construct_menu_click, construct_mouse_click):
Richard M. Stallman <rms@gnu.org>
parents:
6616
diff
changeset
|
2045 XSET (result->y, Lisp_Int, -1); |
6023
67aa546e4ff1
(construct_menu_click): Undo previous change.
Richard M. Stallman <rms@gnu.org>
parents:
6022
diff
changeset
|
2046 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
|
2047 } |
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2048 |
429 | 2049 /* Function to report a mouse movement to the mainstream Emacs code. |
2050 The input handler calls this. | |
2051 | |
2052 We have received a mouse movement event, which is given in *event. | |
2053 If the mouse is over a different glyph than it was last time, tell | |
2054 the mainstream emacs code by setting mouse_moved. If not, ask for | |
2055 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
|
2056 |
429 | 2057 static void |
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2058 note_mouse_movement (frame, event) |
771 | 2059 FRAME_PTR frame; |
429 | 2060 XMotionEvent *event; |
2061 | |
2062 { | |
732 | 2063 last_mouse_movement_time = event->time; |
2064 | |
7680
8212755ff793
(note_mouse_movement): Use frame's window in XQueryPointer.
Richard M. Stallman <rms@gnu.org>
parents:
7651
diff
changeset
|
2065 if (event->window != FRAME_X_WINDOW (frame)) |
8212755ff793
(note_mouse_movement): Use frame's window in XQueryPointer.
Richard M. Stallman <rms@gnu.org>
parents:
7651
diff
changeset
|
2066 { |
8212755ff793
(note_mouse_movement): Use frame's window in XQueryPointer.
Richard M. Stallman <rms@gnu.org>
parents:
7651
diff
changeset
|
2067 mouse_moved = 1; |
8212755ff793
(note_mouse_movement): Use frame's window in XQueryPointer.
Richard M. Stallman <rms@gnu.org>
parents:
7651
diff
changeset
|
2068 last_mouse_scroll_bar = Qnil; |
8212755ff793
(note_mouse_movement): Use frame's window in XQueryPointer.
Richard M. Stallman <rms@gnu.org>
parents:
7651
diff
changeset
|
2069 |
8212755ff793
(note_mouse_movement): Use frame's window in XQueryPointer.
Richard M. Stallman <rms@gnu.org>
parents:
7651
diff
changeset
|
2070 note_mouse_highlight (frame, -1, -1); |
8212755ff793
(note_mouse_movement): Use frame's window in XQueryPointer.
Richard M. Stallman <rms@gnu.org>
parents:
7651
diff
changeset
|
2071 |
8212755ff793
(note_mouse_movement): Use frame's window in XQueryPointer.
Richard M. Stallman <rms@gnu.org>
parents:
7651
diff
changeset
|
2072 /* Ask for another mouse motion event. */ |
8212755ff793
(note_mouse_movement): Use frame's window in XQueryPointer.
Richard M. Stallman <rms@gnu.org>
parents:
7651
diff
changeset
|
2073 { |
8212755ff793
(note_mouse_movement): Use frame's window in XQueryPointer.
Richard M. Stallman <rms@gnu.org>
parents:
7651
diff
changeset
|
2074 int dummy; |
8279
4cde734c20e8
(note_mouse_movement): Use proper data type for window
Richard M. Stallman <rms@gnu.org>
parents:
8164
diff
changeset
|
2075 Window dummy_window; |
7680
8212755ff793
(note_mouse_movement): Use frame's window in XQueryPointer.
Richard M. Stallman <rms@gnu.org>
parents:
7651
diff
changeset
|
2076 |
8212755ff793
(note_mouse_movement): Use frame's window in XQueryPointer.
Richard M. Stallman <rms@gnu.org>
parents:
7651
diff
changeset
|
2077 XQueryPointer (event->display, FRAME_X_WINDOW (frame), |
8279
4cde734c20e8
(note_mouse_movement): Use proper data type for window
Richard M. Stallman <rms@gnu.org>
parents:
8164
diff
changeset
|
2078 &dummy_window, &dummy_window, |
7680
8212755ff793
(note_mouse_movement): Use frame's window in XQueryPointer.
Richard M. Stallman <rms@gnu.org>
parents:
7651
diff
changeset
|
2079 &dummy, &dummy, &dummy, &dummy, |
8212755ff793
(note_mouse_movement): Use frame's window in XQueryPointer.
Richard M. Stallman <rms@gnu.org>
parents:
7651
diff
changeset
|
2080 (unsigned int *) &dummy); |
8212755ff793
(note_mouse_movement): Use frame's window in XQueryPointer.
Richard M. Stallman <rms@gnu.org>
parents:
7651
diff
changeset
|
2081 } |
8212755ff793
(note_mouse_movement): Use frame's window in XQueryPointer.
Richard M. Stallman <rms@gnu.org>
parents:
7651
diff
changeset
|
2082 } |
8212755ff793
(note_mouse_movement): Use frame's window in XQueryPointer.
Richard M. Stallman <rms@gnu.org>
parents:
7651
diff
changeset
|
2083 |
429 | 2084 /* Has the mouse moved off the glyph it was on at the last sighting? */ |
7680
8212755ff793
(note_mouse_movement): Use frame's window in XQueryPointer.
Richard M. Stallman <rms@gnu.org>
parents:
7651
diff
changeset
|
2085 else if (event->x < last_mouse_glyph.x |
8212755ff793
(note_mouse_movement): Use frame's window in XQueryPointer.
Richard M. Stallman <rms@gnu.org>
parents:
7651
diff
changeset
|
2086 || event->x >= last_mouse_glyph.x + last_mouse_glyph.width |
8212755ff793
(note_mouse_movement): Use frame's window in XQueryPointer.
Richard M. Stallman <rms@gnu.org>
parents:
7651
diff
changeset
|
2087 || event->y < last_mouse_glyph.y |
8212755ff793
(note_mouse_movement): Use frame's window in XQueryPointer.
Richard M. Stallman <rms@gnu.org>
parents:
7651
diff
changeset
|
2088 || 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
|
2089 { |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2090 mouse_moved = 1; |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2091 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
|
2092 |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2093 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
|
2094 |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2095 /* 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
|
2096 { |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2097 int dummy; |
8279
4cde734c20e8
(note_mouse_movement): Use proper data type for window
Richard M. Stallman <rms@gnu.org>
parents:
8164
diff
changeset
|
2098 Window dummy_window; |
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2099 |
7680
8212755ff793
(note_mouse_movement): Use frame's window in XQueryPointer.
Richard M. Stallman <rms@gnu.org>
parents:
7651
diff
changeset
|
2100 XQueryPointer (event->display, FRAME_X_WINDOW (frame), |
8279
4cde734c20e8
(note_mouse_movement): Use proper data type for window
Richard M. Stallman <rms@gnu.org>
parents:
8164
diff
changeset
|
2101 &dummy_window, &dummy_window, |
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2102 &dummy, &dummy, &dummy, &dummy, |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2103 (unsigned int *) &dummy); |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2104 } |
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2105 } |
429 | 2106 else |
2107 { | |
2108 /* It's on the same glyph. Call XQueryPointer so we'll get an | |
2109 event the next time the mouse moves and we can see if it's | |
2110 *still* on the same glyph. */ | |
2111 int dummy; | |
8279
4cde734c20e8
(note_mouse_movement): Use proper data type for window
Richard M. Stallman <rms@gnu.org>
parents:
8164
diff
changeset
|
2112 Window dummy_window; |
429 | 2113 |
7680
8212755ff793
(note_mouse_movement): Use frame's window in XQueryPointer.
Richard M. Stallman <rms@gnu.org>
parents:
7651
diff
changeset
|
2114 XQueryPointer (event->display, FRAME_X_WINDOW (frame), |
8279
4cde734c20e8
(note_mouse_movement): Use proper data type for window
Richard M. Stallman <rms@gnu.org>
parents:
8164
diff
changeset
|
2115 &dummy_window, &dummy_window, |
429 | 2116 &dummy, &dummy, &dummy, &dummy, |
2117 (unsigned int *) &dummy); | |
2118 } | |
2119 } | |
2120 | |
6644
8e2379ce4fcb
(fast_find_position): Always return coords within the window.
Richard M. Stallman <rms@gnu.org>
parents:
6631
diff
changeset
|
2121 /* 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
|
2122 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
|
2123 |
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2124 /* 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
|
2125 as regards highlighting characters that have mouse-face properties. |
7680
8212755ff793
(note_mouse_movement): Use frame's window in XQueryPointer.
Richard M. Stallman <rms@gnu.org>
parents:
7651
diff
changeset
|
2126 Also dehighlighting chars where the mouse was before. |
8212755ff793
(note_mouse_movement): Use frame's window in XQueryPointer.
Richard M. Stallman <rms@gnu.org>
parents:
7651
diff
changeset
|
2127 X and Y can be negative or out of range. */ |
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2128 |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2129 static void |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2130 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
|
2131 FRAME_PTR f; |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2132 { |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2133 int row, column, portion; |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2134 XRectangle new_glyph; |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2135 Lisp_Object window; |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2136 struct window *w; |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2137 |
6644
8e2379ce4fcb
(fast_find_position): Always return coords within the window.
Richard M. Stallman <rms@gnu.org>
parents:
6631
diff
changeset
|
2138 if (disable_mouse_highlight) |
8e2379ce4fcb
(fast_find_position): Always return coords within the window.
Richard M. Stallman <rms@gnu.org>
parents:
6631
diff
changeset
|
2139 return; |
8e2379ce4fcb
(fast_find_position): Always return coords within the window.
Richard M. Stallman <rms@gnu.org>
parents:
6631
diff
changeset
|
2140 |
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2141 mouse_face_mouse_x = x; |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2142 mouse_face_mouse_y = y; |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2143 mouse_face_mouse_frame = f; |
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 if (mouse_face_defer) |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2146 return; |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2147 |
6660
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
2148 if (gc_in_progress) |
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
2149 { |
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
2150 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
|
2151 return; |
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
2152 } |
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
2153 |
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2154 /* 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
|
2155 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
|
2156 &new_glyph, x_mouse_grabbed); |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2157 |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2158 /* Which window is that in? */ |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2159 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
|
2160 w = XWINDOW (window); |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2161 |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2162 /* 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
|
2163 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
|
2164 clear_mouse_face (); |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2165 |
6791
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
2166 /* Are we in a window whose display is up to date? |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
2167 And verify the buffer's text has not changed. */ |
7680
8212755ff793
(note_mouse_movement): Use frame's window in XQueryPointer.
Richard M. Stallman <rms@gnu.org>
parents:
7651
diff
changeset
|
2168 if (WINDOWP (window) && portion == 0 && row >= 0 && column >= 0 |
8212755ff793
(note_mouse_movement): Use frame's window in XQueryPointer.
Richard M. Stallman <rms@gnu.org>
parents:
7651
diff
changeset
|
2169 && row < FRAME_HEIGHT (f) && column < FRAME_WIDTH (f) |
6791
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
2170 && EQ (w->window_end_valid, w->buffer) |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
2171 && w->last_modified == BUF_MODIFF (XBUFFER (w->buffer))) |
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2172 { |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2173 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
|
2174 int i, pos; |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2175 |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2176 /* 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
|
2177 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
|
2178 if (ptr[i] > 0) |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2179 break; |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2180 pos = ptr[i]; |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2181 /* Is it outside the displayed active region (if any)? */ |
7282
2bc4929691e9
(show_mouse_face): Fix test for cursor in highlighted area.
Karl Heuer <kwzh@gnu.org>
parents:
7264
diff
changeset
|
2182 if (pos <= 0) |
2bc4929691e9
(show_mouse_face): Fix test for cursor in highlighted area.
Karl Heuer <kwzh@gnu.org>
parents:
7264
diff
changeset
|
2183 clear_mouse_face (); |
2bc4929691e9
(show_mouse_face): Fix test for cursor in highlighted area.
Karl Heuer <kwzh@gnu.org>
parents:
7264
diff
changeset
|
2184 else if (! (EQ (window, mouse_face_window) |
7283
3dc9a9e95d32
(note_mouse_highlight, show_mouse_face, clear_mouse_face, x_destroy_window):
Karl Heuer <kwzh@gnu.org>
parents:
7282
diff
changeset
|
2185 && row >= mouse_face_beg_row |
3dc9a9e95d32
(note_mouse_highlight, show_mouse_face, clear_mouse_face, x_destroy_window):
Karl Heuer <kwzh@gnu.org>
parents:
7282
diff
changeset
|
2186 && row <= mouse_face_end_row |
3dc9a9e95d32
(note_mouse_highlight, show_mouse_face, clear_mouse_face, x_destroy_window):
Karl Heuer <kwzh@gnu.org>
parents:
7282
diff
changeset
|
2187 && (row > mouse_face_beg_row || column >= mouse_face_beg_col) |
7651
1569a13efdcd
(x_set_window_size): If cursor outside new size, mark it off.
Richard M. Stallman <rms@gnu.org>
parents:
7602
diff
changeset
|
2188 && (row < mouse_face_end_row || column < mouse_face_end_col |
1569a13efdcd
(x_set_window_size): If cursor outside new size, mark it off.
Richard M. Stallman <rms@gnu.org>
parents:
7602
diff
changeset
|
2189 || mouse_face_past_end))) |
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2190 { |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2191 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
|
2192 Lisp_Object *overlay_vec; |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2193 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
|
2194 struct buffer *obuf; |
6683
af1629dfdb4c
(note_mouse_highlight): Temporarily widen the buffer.
Richard M. Stallman <rms@gnu.org>
parents:
6660
diff
changeset
|
2195 int obegv, ozv; |
af1629dfdb4c
(note_mouse_highlight): Temporarily widen the buffer.
Richard M. Stallman <rms@gnu.org>
parents:
6660
diff
changeset
|
2196 |
af1629dfdb4c
(note_mouse_highlight): Temporarily widen the buffer.
Richard M. Stallman <rms@gnu.org>
parents:
6660
diff
changeset
|
2197 /* If we get an out-of-range value, return now; avoid an error. */ |
af1629dfdb4c
(note_mouse_highlight): Temporarily widen the buffer.
Richard M. Stallman <rms@gnu.org>
parents:
6660
diff
changeset
|
2198 if (pos > BUF_Z (XBUFFER (w->buffer))) |
6649
1305248ee38a
(note_mouse_highlight): Reject out-of-range pos value
Richard M. Stallman <rms@gnu.org>
parents:
6644
diff
changeset
|
2199 return; |
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2200 |
6626
59c44532d2a0
(construct_menu_click, construct_mouse_click):
Richard M. Stallman <rms@gnu.org>
parents:
6616
diff
changeset
|
2201 /* 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
|
2202 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
|
2203 obuf = current_buffer; |
6626
59c44532d2a0
(construct_menu_click, construct_mouse_click):
Richard M. Stallman <rms@gnu.org>
parents:
6616
diff
changeset
|
2204 current_buffer = XBUFFER (w->buffer); |
6683
af1629dfdb4c
(note_mouse_highlight): Temporarily widen the buffer.
Richard M. Stallman <rms@gnu.org>
parents:
6660
diff
changeset
|
2205 obegv = BEGV; |
af1629dfdb4c
(note_mouse_highlight): Temporarily widen the buffer.
Richard M. Stallman <rms@gnu.org>
parents:
6660
diff
changeset
|
2206 ozv = ZV; |
af1629dfdb4c
(note_mouse_highlight): Temporarily widen the buffer.
Richard M. Stallman <rms@gnu.org>
parents:
6660
diff
changeset
|
2207 BEGV = BEG; |
af1629dfdb4c
(note_mouse_highlight): Temporarily widen the buffer.
Richard M. Stallman <rms@gnu.org>
parents:
6660
diff
changeset
|
2208 ZV = Z; |
6626
59c44532d2a0
(construct_menu_click, construct_mouse_click):
Richard M. Stallman <rms@gnu.org>
parents:
6616
diff
changeset
|
2209 |
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2210 /* 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
|
2211 clear_mouse_face (); |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2212 |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2213 /* Is this char mouse-active? */ |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2214 XSET (position, Lisp_Int, pos); |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2215 |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2216 len = 10; |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2217 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
|
2218 |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2219 /* 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
|
2220 Store the length in len. */ |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2221 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
|
2222 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
|
2223 |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2224 /* 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
|
2225 overlay = Qnil; |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2226 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
|
2227 { |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2228 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
|
2229 if (!NILP (mouse_face)) |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2230 { |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2231 overlay = overlay_vec[i]; |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2232 break; |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2233 } |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2234 } |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2235 free (overlay_vec); |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2236 /* 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
|
2237 if (NILP (overlay)) |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2238 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
|
2239 |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2240 /* Handle the overlay case. */ |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2241 if (! NILP (overlay)) |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2242 { |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2243 /* 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
|
2244 should be active. */ |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2245 Lisp_Object before, after; |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2246 int ignore; |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2247 |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2248 before = Foverlay_start (overlay); |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2249 after = Foverlay_end (overlay); |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2250 /* Record this as the current active region. */ |
7651
1569a13efdcd
(x_set_window_size): If cursor outside new size, mark it off.
Richard M. Stallman <rms@gnu.org>
parents:
7602
diff
changeset
|
2251 fast_find_position (window, before, &mouse_face_beg_col, |
1569a13efdcd
(x_set_window_size): If cursor outside new size, mark it off.
Richard M. Stallman <rms@gnu.org>
parents:
7602
diff
changeset
|
2252 &mouse_face_beg_row); |
1569a13efdcd
(x_set_window_size): If cursor outside new size, mark it off.
Richard M. Stallman <rms@gnu.org>
parents:
7602
diff
changeset
|
2253 mouse_face_past_end |
1569a13efdcd
(x_set_window_size): If cursor outside new size, mark it off.
Richard M. Stallman <rms@gnu.org>
parents:
7602
diff
changeset
|
2254 = !fast_find_position (window, after, &mouse_face_end_col, |
1569a13efdcd
(x_set_window_size): If cursor outside new size, mark it off.
Richard M. Stallman <rms@gnu.org>
parents:
7602
diff
changeset
|
2255 &mouse_face_end_row); |
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2256 mouse_face_window = window; |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2257 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
|
2258 &ignore, pos + 1, 1); |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2259 |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2260 /* Display it as active. */ |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2261 show_mouse_face (1); |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2262 } |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2263 /* Handle the text property case. */ |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2264 else if (! NILP (mouse_face)) |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2265 { |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2266 /* 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
|
2267 should be active. */ |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2268 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
|
2269 int ignore; |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2270 |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2271 beginning = Fmarker_position (w->start); |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2272 XSET (end, Lisp_Int, |
6626
59c44532d2a0
(construct_menu_click, construct_mouse_click):
Richard M. Stallman <rms@gnu.org>
parents:
6616
diff
changeset
|
2273 (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
|
2274 - XFASTINT (w->window_end_pos))); |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2275 before |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2276 = 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
|
2277 Qmouse_face, |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2278 w->buffer, beginning); |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2279 after |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2280 = 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
|
2281 w->buffer, end); |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2282 /* Record this as the current active region. */ |
7651
1569a13efdcd
(x_set_window_size): If cursor outside new size, mark it off.
Richard M. Stallman <rms@gnu.org>
parents:
7602
diff
changeset
|
2283 fast_find_position (window, before, &mouse_face_beg_col, |
1569a13efdcd
(x_set_window_size): If cursor outside new size, mark it off.
Richard M. Stallman <rms@gnu.org>
parents:
7602
diff
changeset
|
2284 &mouse_face_beg_row); |
1569a13efdcd
(x_set_window_size): If cursor outside new size, mark it off.
Richard M. Stallman <rms@gnu.org>
parents:
7602
diff
changeset
|
2285 mouse_face_past_end |
1569a13efdcd
(x_set_window_size): If cursor outside new size, mark it off.
Richard M. Stallman <rms@gnu.org>
parents:
7602
diff
changeset
|
2286 = !fast_find_position (window, after, &mouse_face_end_col, |
1569a13efdcd
(x_set_window_size): If cursor outside new size, mark it off.
Richard M. Stallman <rms@gnu.org>
parents:
7602
diff
changeset
|
2287 &mouse_face_end_row); |
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2288 mouse_face_window = window; |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2289 mouse_face_face_id |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2290 = 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
|
2291 &ignore, pos + 1, 1); |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2292 |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2293 /* Display it as active. */ |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2294 show_mouse_face (1); |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2295 } |
6683
af1629dfdb4c
(note_mouse_highlight): Temporarily widen the buffer.
Richard M. Stallman <rms@gnu.org>
parents:
6660
diff
changeset
|
2296 BEGV = obegv; |
af1629dfdb4c
(note_mouse_highlight): Temporarily widen the buffer.
Richard M. Stallman <rms@gnu.org>
parents:
6660
diff
changeset
|
2297 ZV = ozv; |
6626
59c44532d2a0
(construct_menu_click, construct_mouse_click):
Richard M. Stallman <rms@gnu.org>
parents:
6616
diff
changeset
|
2298 current_buffer = obuf; |
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2299 } |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2300 } |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2301 } |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2302 |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2303 /* 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
|
2304 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
|
2305 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
|
2306 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
|
2307 of start of first screen line. |
7651
1569a13efdcd
(x_set_window_size): If cursor outside new size, mark it off.
Richard M. Stallman <rms@gnu.org>
parents:
7602
diff
changeset
|
2308 If POS is after end of WINDOW, return coords of end of last screen line. |
1569a13efdcd
(x_set_window_size): If cursor outside new size, mark it off.
Richard M. Stallman <rms@gnu.org>
parents:
7602
diff
changeset
|
2309 |
1569a13efdcd
(x_set_window_size): If cursor outside new size, mark it off.
Richard M. Stallman <rms@gnu.org>
parents:
7602
diff
changeset
|
2310 Value is 1 if POS is in range, 0 if it was off screen. */ |
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2311 |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2312 static int |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2313 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
|
2314 Lisp_Object window; |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2315 int pos; |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2316 int *columnp, *rowp; |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2317 { |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2318 struct window *w = XWINDOW (window); |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2319 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
|
2320 int i; |
7651
1569a13efdcd
(x_set_window_size): If cursor outside new size, mark it off.
Richard M. Stallman <rms@gnu.org>
parents:
7602
diff
changeset
|
2321 int row = 0; |
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2322 int left = w->left; |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2323 int top = w->top; |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2324 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
|
2325 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
|
2326 int *charstarts; |
6644
8e2379ce4fcb
(fast_find_position): Always return coords within the window.
Richard M. Stallman <rms@gnu.org>
parents:
6631
diff
changeset
|
2327 int lastcol; |
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2328 |
7651
1569a13efdcd
(x_set_window_size): If cursor outside new size, mark it off.
Richard M. Stallman <rms@gnu.org>
parents:
7602
diff
changeset
|
2329 /* Find the right row. */ |
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2330 for (i = 0; |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2331 i < height; |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2332 i++) |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2333 { |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2334 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
|
2335 if (linestart > pos) |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2336 break; |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2337 if (linestart > 0) |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2338 row = i; |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2339 } |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2340 |
7651
1569a13efdcd
(x_set_window_size): If cursor outside new size, mark it off.
Richard M. Stallman <rms@gnu.org>
parents:
7602
diff
changeset
|
2341 /* Find the right column with in it. */ |
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2342 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
|
2343 lastcol = left; |
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2344 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
|
2345 { |
8e2379ce4fcb
(fast_find_position): Always return coords within the window.
Richard M. Stallman <rms@gnu.org>
parents:
6631
diff
changeset
|
2346 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
|
2347 { |
8e2379ce4fcb
(fast_find_position): Always return coords within the window.
Richard M. Stallman <rms@gnu.org>
parents:
6631
diff
changeset
|
2348 *rowp = row + top; |
8e2379ce4fcb
(fast_find_position): Always return coords within the window.
Richard M. Stallman <rms@gnu.org>
parents:
6631
diff
changeset
|
2349 *columnp = i + left; |
8e2379ce4fcb
(fast_find_position): Always return coords within the window.
Richard M. Stallman <rms@gnu.org>
parents:
6631
diff
changeset
|
2350 return 1; |
8e2379ce4fcb
(fast_find_position): Always return coords within the window.
Richard M. Stallman <rms@gnu.org>
parents:
6631
diff
changeset
|
2351 } |
8e2379ce4fcb
(fast_find_position): Always return coords within the window.
Richard M. Stallman <rms@gnu.org>
parents:
6631
diff
changeset
|
2352 else if (charstarts[left + i] > pos) |
7651
1569a13efdcd
(x_set_window_size): If cursor outside new size, mark it off.
Richard M. Stallman <rms@gnu.org>
parents:
7602
diff
changeset
|
2353 break; |
1569a13efdcd
(x_set_window_size): If cursor outside new size, mark it off.
Richard M. Stallman <rms@gnu.org>
parents:
7602
diff
changeset
|
2354 else if (charstarts[left + i] > 0) |
6644
8e2379ce4fcb
(fast_find_position): Always return coords within the window.
Richard M. Stallman <rms@gnu.org>
parents:
6631
diff
changeset
|
2355 lastcol = left + i; |
8e2379ce4fcb
(fast_find_position): Always return coords within the window.
Richard M. Stallman <rms@gnu.org>
parents:
6631
diff
changeset
|
2356 } |
8e2379ce4fcb
(fast_find_position): Always return coords within the window.
Richard M. Stallman <rms@gnu.org>
parents:
6631
diff
changeset
|
2357 |
8e2379ce4fcb
(fast_find_position): Always return coords within the window.
Richard M. Stallman <rms@gnu.org>
parents:
6631
diff
changeset
|
2358 *rowp = row + top; |
8e2379ce4fcb
(fast_find_position): Always return coords within the window.
Richard M. Stallman <rms@gnu.org>
parents:
6631
diff
changeset
|
2359 *columnp = lastcol; |
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2360 return 0; |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2361 } |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2362 |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2363 /* 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
|
2364 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
|
2365 |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2366 static void |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2367 show_mouse_face (hl) |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2368 int hl; |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2369 { |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2370 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
|
2371 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
|
2372 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
|
2373 int i; |
6660
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
2374 int cursor_off = 0; |
8164
3b90e6a741f1
(XTread_socket, construct_menu_click) [USE_X_TOOLKIT]:
Richard M. Stallman <rms@gnu.org>
parents:
8098
diff
changeset
|
2375 int old_curs_x = curs_x; |
3b90e6a741f1
(XTread_socket, construct_menu_click) [USE_X_TOOLKIT]:
Richard M. Stallman <rms@gnu.org>
parents:
8098
diff
changeset
|
2376 int old_curs_y = curs_y; |
3b90e6a741f1
(XTread_socket, construct_menu_click) [USE_X_TOOLKIT]:
Richard M. Stallman <rms@gnu.org>
parents:
8098
diff
changeset
|
2377 |
3b90e6a741f1
(XTread_socket, construct_menu_click) [USE_X_TOOLKIT]:
Richard M. Stallman <rms@gnu.org>
parents:
8098
diff
changeset
|
2378 /* Set these variables temporarily |
3b90e6a741f1
(XTread_socket, construct_menu_click) [USE_X_TOOLKIT]:
Richard M. Stallman <rms@gnu.org>
parents:
8098
diff
changeset
|
2379 so that if we have to turn the cursor off and on again |
3b90e6a741f1
(XTread_socket, construct_menu_click) [USE_X_TOOLKIT]:
Richard M. Stallman <rms@gnu.org>
parents:
8098
diff
changeset
|
2380 we will put it back at the same place. */ |
3b90e6a741f1
(XTread_socket, construct_menu_click) [USE_X_TOOLKIT]:
Richard M. Stallman <rms@gnu.org>
parents:
8098
diff
changeset
|
2381 curs_x = f->phys_cursor_x; |
3b90e6a741f1
(XTread_socket, construct_menu_click) [USE_X_TOOLKIT]:
Richard M. Stallman <rms@gnu.org>
parents:
8098
diff
changeset
|
2382 curs_y = f->phys_cursor_y; |
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2383 |
7283
3dc9a9e95d32
(note_mouse_highlight, show_mouse_face, clear_mouse_face, x_destroy_window):
Karl Heuer <kwzh@gnu.org>
parents:
7282
diff
changeset
|
2384 for (i = mouse_face_beg_row; i <= mouse_face_end_row; i++) |
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2385 { |
7283
3dc9a9e95d32
(note_mouse_highlight, show_mouse_face, clear_mouse_face, x_destroy_window):
Karl Heuer <kwzh@gnu.org>
parents:
7282
diff
changeset
|
2386 int column = (i == mouse_face_beg_row ? mouse_face_beg_col : w->left); |
3dc9a9e95d32
(note_mouse_highlight, show_mouse_face, clear_mouse_face, x_destroy_window):
Karl Heuer <kwzh@gnu.org>
parents:
7282
diff
changeset
|
2387 int endcolumn = (i == mouse_face_end_row ? mouse_face_end_col : w->left + width); |
7992
7bb45acbcaa6
(show_mouse_face): Set endcolumn ok in side-by-side windows.
Richard M. Stallman <rms@gnu.org>
parents:
7959
diff
changeset
|
2388 endcolumn = min (endcolumn, FRAME_CURRENT_GLYPHS (f)->used[i]); |
6660
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
2389 |
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
2390 /* 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
|
2391 turn the cursor off. */ |
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
2392 if (i == curs_y |
7283
3dc9a9e95d32
(note_mouse_highlight, show_mouse_face, clear_mouse_face, x_destroy_window):
Karl Heuer <kwzh@gnu.org>
parents:
7282
diff
changeset
|
2393 && curs_x >= mouse_face_beg_col - 1 && curs_x <= mouse_face_end_col) |
6660
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
2394 { |
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
2395 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
|
2396 cursor_off = 1; |
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
2397 } |
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2398 |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2399 dumpglyphs (f, |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2400 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
|
2401 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
|
2402 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
|
2403 endcolumn - column, |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2404 /* Highlight with mouse face if hl > 0. */ |
6791
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
2405 hl > 0 ? 3 : 0, 0); |
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2406 } |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2407 |
6660
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
2408 /* 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
|
2409 if (cursor_off) |
cb14d76e993c
(note_mouse_highlight): Do nothing if gc_in_progress.
Richard M. Stallman <rms@gnu.org>
parents:
6649
diff
changeset
|
2410 x_display_cursor (f, 1); |
6757
770fe370479b
(show_mouse_face): Change the mouse cursor accordingly.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6683
diff
changeset
|
2411 |
8164
3b90e6a741f1
(XTread_socket, construct_menu_click) [USE_X_TOOLKIT]:
Richard M. Stallman <rms@gnu.org>
parents:
8098
diff
changeset
|
2412 curs_x = old_curs_x; |
3b90e6a741f1
(XTread_socket, construct_menu_click) [USE_X_TOOLKIT]:
Richard M. Stallman <rms@gnu.org>
parents:
8098
diff
changeset
|
2413 curs_y = old_curs_y; |
3b90e6a741f1
(XTread_socket, construct_menu_click) [USE_X_TOOLKIT]:
Richard M. Stallman <rms@gnu.org>
parents:
8098
diff
changeset
|
2414 |
6757
770fe370479b
(show_mouse_face): Change the mouse cursor accordingly.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6683
diff
changeset
|
2415 /* Change the mouse cursor according to the value of HL. */ |
770fe370479b
(show_mouse_face): Change the mouse cursor accordingly.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6683
diff
changeset
|
2416 if (hl > 0) |
770fe370479b
(show_mouse_face): Change the mouse cursor accordingly.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6683
diff
changeset
|
2417 XDefineCursor (XDISPLAY FRAME_X_WINDOW (f), f->display.x->cross_cursor); |
770fe370479b
(show_mouse_face): Change the mouse cursor accordingly.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6683
diff
changeset
|
2418 else |
770fe370479b
(show_mouse_face): Change the mouse cursor accordingly.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6683
diff
changeset
|
2419 XDefineCursor (XDISPLAY FRAME_X_WINDOW (f), f->display.x->text_cursor); |
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2420 } |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2421 |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2422 /* 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
|
2423 Redraw it unhighlighted first. */ |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2424 |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2425 static void |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2426 clear_mouse_face () |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2427 { |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2428 if (! NILP (mouse_face_window)) |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2429 show_mouse_face (0); |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2430 |
7283
3dc9a9e95d32
(note_mouse_highlight, show_mouse_face, clear_mouse_face, x_destroy_window):
Karl Heuer <kwzh@gnu.org>
parents:
7282
diff
changeset
|
2431 mouse_face_beg_row = mouse_face_beg_col = -1; |
3dc9a9e95d32
(note_mouse_highlight, show_mouse_face, clear_mouse_face, x_destroy_window):
Karl Heuer <kwzh@gnu.org>
parents:
7282
diff
changeset
|
2432 mouse_face_end_row = mouse_face_end_col = -1; |
6616
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2433 mouse_face_window = Qnil; |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2434 } |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
2435 |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2436 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
|
2437 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
|
2438 |
429 | 2439 /* Return the current position of the mouse. |
2440 | |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2441 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
|
2442 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
|
2443 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
|
2444 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
|
2445 |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2446 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
|
2447 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
|
2448 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
|
2449 |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2450 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
|
2451 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
|
2452 |
3669
fd4187a96445
(XTmouse_position): Don't set *f at all unless we win.
Richard M. Stallman <rms@gnu.org>
parents:
3639
diff
changeset
|
2453 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
|
2454 |
429 | 2455 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
|
2456 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
|
2457 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
|
2458 again. */ |
429 | 2459 |
2460 static void | |
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2461 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
|
2462 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
|
2463 Lisp_Object *bar_window; |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2464 enum scroll_bar_part *part; |
429 | 2465 Lisp_Object *x, *y; |
732 | 2466 unsigned long *time; |
429 | 2467 { |
3669
fd4187a96445
(XTmouse_position): Don't set *f at all unless we win.
Richard M. Stallman <rms@gnu.org>
parents:
3639
diff
changeset
|
2468 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
|
2469 |
429 | 2470 BLOCK_INPUT; |
2471 | |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2472 if (! NILP (last_mouse_scroll_bar)) |
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2473 x_scroll_bar_report_motion (f, bar_window, part, x, y, time); |
429 | 2474 else |
2475 { | |
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2476 Window root; |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2477 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
|
2478 |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2479 Window dummy_window; |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2480 int dummy; |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2481 |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2482 mouse_moved = 0; |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2483 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
|
2484 |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2485 /* 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
|
2486 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
|
2487 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
|
2488 |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2489 /* 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
|
2490 &root, |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2491 |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2492 /* 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
|
2493 a different screen. */ |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2494 &dummy_window, |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2495 |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2496 /* 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
|
2497 &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
|
2498 |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2499 /* 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
|
2500 &dummy, &dummy, |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2501 |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2502 /* 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
|
2503 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
|
2504 (unsigned int *) &dummy); |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2505 |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2506 /* 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
|
2507 containing the pointer. */ |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2508 { |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2509 Window win, child; |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2510 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
|
2511 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
|
2512 |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2513 win = root; |
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2514 |
8430
356e5509efda
(construct_mouse_click, construct_menu_click):
Richard M. Stallman <rms@gnu.org>
parents:
8353
diff
changeset
|
2515 if (x_mouse_grabbed && last_mouse_frame |
356e5509efda
(construct_mouse_click, construct_menu_click):
Richard M. Stallman <rms@gnu.org>
parents:
8353
diff
changeset
|
2516 && FRAME_LIVE_P (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
|
2517 { |
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2518 /* 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
|
2519 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
|
2520 XTranslateCoordinates (x_current_display, |
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2521 |
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2522 /* From-window, to-window. */ |
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2523 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
|
2524 |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2525 /* 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
|
2526 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
|
2527 |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2528 /* Child of win. */ |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2529 &child); |
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2530 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
|
2531 } |
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2532 else |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2533 { |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2534 while (1) |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2535 { |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2536 XTranslateCoordinates (x_current_display, |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2537 |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2538 /* From-window, to-window. */ |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2539 root, win, |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2540 |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2541 /* From-position, to-position. */ |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2542 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
|
2543 |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2544 /* Child of win. */ |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2545 &child); |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2546 |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2547 if (child == None) |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2548 break; |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2549 |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2550 win = child; |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2551 parent_x = win_x; |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2552 parent_y = win_y; |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2553 } |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2554 |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2555 /* Now we know that: |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2556 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
|
2557 (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
|
2558 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
|
2559 (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
|
2560 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
|
2561 (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
|
2562 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
|
2563 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
|
2564 never use them in that case.) */ |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2565 |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
2566 /* 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
|
2567 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
|
2568 } |
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2569 |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2570 /* 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
|
2571 if (! f1) |
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2572 { |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2573 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
|
2574 |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2575 if (bar) |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2576 { |
3669
fd4187a96445
(XTmouse_position): Don't set *f at all unless we win.
Richard M. Stallman <rms@gnu.org>
parents:
3639
diff
changeset
|
2577 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
|
2578 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
|
2579 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
|
2580 } |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2581 } |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2582 |
3669
fd4187a96445
(XTmouse_position): Don't set *f at all unless we win.
Richard M. Stallman <rms@gnu.org>
parents:
3639
diff
changeset
|
2583 if (f1) |
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2584 { |
6055
a9f61727a90c
(construct_mouse_click): Don't convert to glyph units.
Richard M. Stallman <rms@gnu.org>
parents:
6023
diff
changeset
|
2585 int ignore1, ignore2; |
a9f61727a90c
(construct_mouse_click): Don't convert to glyph units.
Richard M. Stallman <rms@gnu.org>
parents:
6023
diff
changeset
|
2586 |
a9f61727a90c
(construct_mouse_click): Don't convert to glyph units.
Richard M. Stallman <rms@gnu.org>
parents:
6023
diff
changeset
|
2587 /* 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
|
2588 |
a9f61727a90c
(construct_mouse_click): Don't convert to glyph units.
Richard M. Stallman <rms@gnu.org>
parents:
6023
diff
changeset
|
2589 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
|
2590 &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
|
2591 |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2592 *bar_window = Qnil; |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2593 *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
|
2594 *f = f1; |
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2595 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
|
2596 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
|
2597 *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
|
2598 } |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2599 } |
429 | 2600 } |
2601 | |
2602 UNBLOCK_INPUT; | |
2603 } | |
2604 | |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
2605 #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
|
2606 #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
|
2607 #endif /* ! defined (HAVE_X11) */ |
429 | 2608 |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2609 /* Scroll bar support. */ |
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2610 |
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2611 /* 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
|
2612 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
|
2613 bits. */ |
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2614 static struct scroll_bar * |
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2615 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
|
2616 Window window_id; |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2617 { |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2618 Lisp_Object tail, frame; |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2619 |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2620 for (tail = Vframe_list; |
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2621 XGCTYPE (tail) == Lisp_Cons; |
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2622 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
|
2623 { |
6521
a975c5944916
(x_window_to_scroll_bar, x_new_font): Use assignment, not initialization.
Karl Heuer <kwzh@gnu.org>
parents:
6413
diff
changeset
|
2624 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
|
2625 |
a975c5944916
(x_window_to_scroll_bar, x_new_font): Use assignment, not initialization.
Karl Heuer <kwzh@gnu.org>
parents:
6413
diff
changeset
|
2626 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
|
2627 /* 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
|
2628 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
|
2629 abort (); |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2630 |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2631 /* 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
|
2632 right window ID. */ |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2633 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
|
2634 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
|
2635 /* 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
|
2636 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
|
2637 ! GC_NILP (bar) || (bar = condemned, |
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2638 condemned = Qnil, |
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2639 ! 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
|
2640 bar = XSCROLL_BAR (bar)->next) |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2641 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
|
2642 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
|
2643 } |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2644 |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2645 return 0; |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2646 } |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2647 |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2648 /* 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
|
2649 scroll bar vector for it. */ |
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2650 static struct scroll_bar * |
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2651 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
|
2652 struct window *window; |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2653 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
|
2654 { |
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2655 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
|
2656 struct scroll_bar *bar = |
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2657 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
|
2658 |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2659 BLOCK_INPUT; |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2660 |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2661 { |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2662 XSetWindowAttributes a; |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2663 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
|
2664 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
|
2665 a.event_mask = (ButtonPressMask | ButtonReleaseMask |
1793
cf4c3f01ddb9
* xterm.c (x_scrollbar_create): Include PointerMotionHintMask in
Jim Blandy <jimb@redhat.com>
parents:
1787
diff
changeset
|
2666 | ButtonMotionMask | PointerMotionHintMask |
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2667 | ExposureMask); |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2668 a.cursor = x_vertical_scroll_bar_cursor; |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
2669 |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
2670 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
|
2671 |
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
2672 #if 0 |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
2673 |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
2674 ac = 0; |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
2675 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
|
2676 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
|
2677 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
|
2678 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
|
2679 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
|
2680 sb_widget = XtCreateManagedWidget ("box", |
5916
4e827db2523a
(x_scroll_bar_create): Fix indentation.
Karl Heuer <kwzh@gnu.org>
parents:
5898
diff
changeset
|
2681 boxWidgetClass, |
4e827db2523a
(x_scroll_bar_create): Fix indentation.
Karl Heuer <kwzh@gnu.org>
parents:
5898
diff
changeset
|
2682 frame->display.x->edit_widget, al, ac); |
4e827db2523a
(x_scroll_bar_create): Fix indentation.
Karl Heuer <kwzh@gnu.org>
parents:
5898
diff
changeset
|
2683 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
|
2684 (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
|
2685 #endif |
5916
4e827db2523a
(x_scroll_bar_create): Fix indentation.
Karl Heuer <kwzh@gnu.org>
parents:
5898
diff
changeset
|
2686 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
|
2687 (bar, |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2688 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
|
2689 |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2690 /* 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
|
2691 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
|
2692 |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2693 /* 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
|
2694 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
|
2695 |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2696 /* Attributes. */ |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2697 mask, &a)); |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2698 } |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2699 |
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2700 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
|
2701 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
|
2702 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
|
2703 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
|
2704 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
|
2705 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
|
2706 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
|
2707 bar->dragging = Qnil; |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2708 |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2709 /* 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
|
2710 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
|
2711 bar->prev = Qnil; |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2712 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
|
2713 if (! NILP (bar->next)) |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2714 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
|
2715 |
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2716 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
|
2717 |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2718 UNBLOCK_INPUT; |
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2719 |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2720 return bar; |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2721 } |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2722 |
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2723 /* 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
|
2724 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
|
2725 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
|
2726 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
|
2727 events.) |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2728 |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2729 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
|
2730 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
|
2731 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
|
2732 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
|
2733 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
|
2734 static void |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2735 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
|
2736 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
|
2737 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
|
2738 int rebuild; |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2739 { |
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2740 int dragging = ! NILP (bar->dragging); |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2741 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
|
2742 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
|
2743 |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2744 /* 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
|
2745 if (! rebuild |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2746 && 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
|
2747 && 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
|
2748 return; |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2749 |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2750 BLOCK_INPUT; |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2751 |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2752 { |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2753 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
|
2754 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
|
2755 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
|
2756 |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2757 /* 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
|
2758 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
|
2759 { |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2760 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
|
2761 |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2762 if (start < 0) |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2763 start = 0; |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2764 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
|
2765 start = top_range; |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2766 end = start + length; |
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 if (end < start) |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2769 end = start; |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2770 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
|
2771 end = top_range; |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2772 } |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2773 |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2774 /* 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
|
2775 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
|
2776 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
|
2777 |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2778 /* 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
|
2779 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
|
2780 end = top_range; |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2781 |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2782 /* 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
|
2783 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
|
2784 that many pixels tall. */ |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2785 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
|
2786 |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2787 /* 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
|
2788 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
|
2789 if (0 < start) |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2790 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
|
2791 |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2792 /* 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
|
2793 VERTICAL_SCROLL_BAR_LEFT_BORDER, |
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2794 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
|
2795 inside_width, start, |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2796 False); |
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 /* 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
|
2799 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
|
2800 |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2801 /* x, y, width, height */ |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2802 VERTICAL_SCROLL_BAR_LEFT_BORDER, |
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2803 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
|
2804 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
|
2805 |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2806 |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2807 /* 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
|
2808 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
|
2809 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
|
2810 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
|
2811 |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2812 /* 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
|
2813 VERTICAL_SCROLL_BAR_LEFT_BORDER, |
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2814 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
|
2815 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
|
2816 False); |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2817 |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2818 } |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2819 |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2820 UNBLOCK_INPUT; |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2821 } |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2822 |
3591
507f64624555
Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents:
3585
diff
changeset
|
2823 /* 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
|
2824 window configurations. */ |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2825 static void |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2826 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
|
2827 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
|
2828 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
|
2829 { |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2830 BLOCK_INPUT; |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2831 |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2832 { |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2833 XWindowChanges wc; |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2834 unsigned int mask = 0; |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2835 |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2836 wc.x = left; |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2837 wc.y = top; |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2838 wc.width = width; |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2839 wc.height = height; |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2840 |
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2841 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
|
2842 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
|
2843 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
|
2844 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
|
2845 |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2846 if (mask) |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2847 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
|
2848 mask, &wc); |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2849 } |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2850 |
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2851 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
|
2852 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
|
2853 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
|
2854 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
|
2855 |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2856 UNBLOCK_INPUT; |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2857 } |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2858 |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2859 /* 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
|
2860 to nil. */ |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2861 static void |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2862 x_scroll_bar_remove (bar) |
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2863 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
|
2864 { |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2865 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
|
2866 |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2867 BLOCK_INPUT; |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2868 |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2869 /* Destroy the window. */ |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2870 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
|
2871 |
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2872 /* 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
|
2873 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
|
2874 |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2875 UNBLOCK_INPUT; |
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 |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2878 /* 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
|
2879 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
|
2880 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
|
2881 create one. */ |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2882 static void |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2883 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
|
2884 struct window *window; |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2885 int portion, whole, position; |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2886 { |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2887 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
|
2888 int top = XINT (window->top); |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2889 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
|
2890 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
|
2891 |
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2892 /* 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
|
2893 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
|
2894 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
|
2895 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
|
2896 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
|
2897 |
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2898 struct scroll_bar *bar; |
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2899 |
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2900 /* Does the scroll bar exist yet? */ |
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2901 if (NILP (window->vertical_scroll_bar)) |
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2902 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
|
2903 pixel_top, pixel_left, |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2904 pixel_width, pixel_height); |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2905 else |
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2906 { |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2907 /* 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
|
2908 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
|
2909 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
|
2910 } |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2911 |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2912 /* 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
|
2913 dragged. */ |
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2914 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
|
2915 { |
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2916 int top_range = |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2917 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
|
2918 |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2919 if (whole == 0) |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2920 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
|
2921 else |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2922 { |
3686
910ea1d66bfd
* xterm.c (XTset_vertical_scroll_bar): Use double type for
Jim Blandy <jimb@redhat.com>
parents:
3683
diff
changeset
|
2923 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
|
2924 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
|
2925 |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2926 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
|
2927 } |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2928 } |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2929 |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2930 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
|
2931 } |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2932 |
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2933 |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2934 /* 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
|
2935 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
|
2936 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
|
2937 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
|
2938 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
|
2939 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
|
2940 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
|
2941 |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2942 /* 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
|
2943 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
|
2944 `*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
|
2945 static void |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2946 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
|
2947 FRAME_PTR frame; |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2948 { |
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2949 /* 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
|
2950 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
|
2951 protocol correctly. */ |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2952 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
|
2953 abort (); |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2954 |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2955 /* 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
|
2956 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
|
2957 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
|
2958 } |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2959 |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2960 /* 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
|
2961 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
|
2962 static void |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2963 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
|
2964 struct window *window; |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2965 { |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2966 struct scroll_bar *bar; |
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2967 |
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2968 /* 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
|
2969 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
|
2970 abort (); |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2971 |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2972 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
|
2973 |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2974 /* 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
|
2975 { |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2976 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
|
2977 |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2978 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
|
2979 { |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2980 /* 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
|
2981 the lists. */ |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2982 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
|
2983 /* 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
|
2984 return; |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2985 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
|
2986 window->vertical_scroll_bar)) |
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2987 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
|
2988 else |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2989 /* 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
|
2990 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
|
2991 abort (); |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2992 } |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2993 else |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2994 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
|
2995 |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2996 if (! NILP (bar->next)) |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2997 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
|
2998 |
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2999 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
|
3000 bar->prev = Qnil; |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3001 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
|
3002 if (! NILP (bar->next)) |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3003 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
|
3004 } |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3005 } |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3006 |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3007 /* 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
|
3008 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
|
3009 static void |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3010 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
|
3011 FRAME_PTR f; |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3012 { |
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
3013 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
|
3014 |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3015 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
|
3016 |
5752a95053f2
* xterm.c (x_window_to_scrollbar): Search frames'
Jim Blandy <jimb@redhat.com>
parents:
1793
diff
changeset
|
3017 /* 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
|
3018 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
|
3019 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
|
3020 |
5752a95053f2
* xterm.c (x_window_to_scrollbar): Search frames'
Jim Blandy <jimb@redhat.com>
parents:
1793
diff
changeset
|
3021 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
|
3022 { |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3023 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
|
3024 |
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3025 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
|
3026 |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
3027 next = b->next; |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
3028 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
|
3029 } |
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
3030 |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3031 /* 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
|
3032 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
|
3033 } |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3034 |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3035 |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3036 /* 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
|
3037 |
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3038 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
|
3039 mark bits. */ |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3040 static void |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3041 x_scroll_bar_expose (bar, event) |
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3042 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
|
3043 XEvent *event; |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3044 { |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3045 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
|
3046 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
|
3047 |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3048 BLOCK_INPUT; |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3049 |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3050 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
|
3051 |
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3052 /* 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
|
3053 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
|
3054 |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3055 /* 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
|
3056 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
|
3057 |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3058 UNBLOCK_INPUT; |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3059 } |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3060 |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3061 /* 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
|
3062 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
|
3063 |
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3064 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
|
3065 mark bits. */ |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3066 static void |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3067 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
|
3068 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
|
3069 XEvent *event; |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3070 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
|
3071 { |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3072 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
|
3073 abort (); |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
3074 |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3075 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
|
3076 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
|
3077 emacs_event->modifiers = |
2661
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
3078 (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
|
3079 | (event->type == ButtonRelease |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3080 ? up_modifier |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3081 : down_modifier)); |
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
3082 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
|
3083 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
|
3084 { |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
3085 int internal_height = |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3086 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
|
3087 int top_range = |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3088 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
|
3089 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
|
3090 |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
3091 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
|
3092 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
|
3093 |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
3094 if (y < XINT (bar->start)) |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3095 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
|
3096 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
|
3097 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
|
3098 else |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3099 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
|
3100 |
5440f00480e6
* xterm.c (x_scroll_bar_handle_click): Never grab the scroll bar;
Jim Blandy <jimb@redhat.com>
parents:
2923
diff
changeset
|
3101 /* 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
|
3102 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
|
3103 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
|
3104 #if 0 |
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
3105 /* 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
|
3106 holding it. */ |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
3107 if (event->type == ButtonPress |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3108 && 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
|
3109 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
|
3110 #endif |
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
3111 |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
3112 /* 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
|
3113 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
|
3114 && ! NILP (bar->dragging)) |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
3115 { |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
3116 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
|
3117 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
|
3118 |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3119 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
|
3120 bar->dragging = Qnil; |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
3121 } |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
3122 |
2958
3124e6244d1a
* xterm.c (x_scroll_bar_handle_click): Never grab the scroll bar;
Jim Blandy <jimb@redhat.com>
parents:
2953
diff
changeset
|
3123 /* 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
|
3124 #if 0 |
3591
507f64624555
Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents:
3585
diff
changeset
|
3125 /* 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
|
3126 the handle. */ |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3127 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
|
3128 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
|
3129 else |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
3130 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
|
3131 #else |
3124e6244d1a
* xterm.c (x_scroll_bar_handle_click): Never grab the scroll bar;
Jim Blandy <jimb@redhat.com>
parents:
2953
diff
changeset
|
3132 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
|
3133 #endif |
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
3134 |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
3135 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
|
3136 } |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3137 } |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3138 |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3139 /* 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
|
3140 |
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3141 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
|
3142 mark bits. */ |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3143 static void |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3144 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
|
3145 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
|
3146 XEvent *event; |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3147 { |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3148 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
|
3149 |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3150 mouse_moved = 1; |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3151 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
|
3152 |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3153 /* 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
|
3154 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
|
3155 { |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3156 /* 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
|
3157 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
|
3158 |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
3159 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
|
3160 { |
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
3161 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
|
3162 |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3163 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
|
3164 } |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3165 } |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3166 |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3167 /* 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
|
3168 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
|
3169 { |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3170 int dummy; |
8279
4cde734c20e8
(note_mouse_movement): Use proper data type for window
Richard M. Stallman <rms@gnu.org>
parents:
8164
diff
changeset
|
3171 Window dummy_window; |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3172 |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3173 XQueryPointer (event->xmotion.display, event->xmotion.window, |
8279
4cde734c20e8
(note_mouse_movement): Use proper data type for window
Richard M. Stallman <rms@gnu.org>
parents:
8164
diff
changeset
|
3174 &dummy_window, &dummy_window, |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3175 &dummy, &dummy, &dummy, &dummy, |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3176 (unsigned int *) &dummy); |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3177 } |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3178 } |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3179 |
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
3180 /* 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
|
3181 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
|
3182 static void |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3183 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
|
3184 FRAME_PTR *f; |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
3185 Lisp_Object *bar_window; |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3186 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
|
3187 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
|
3188 unsigned long *time; |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
3189 { |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3190 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
|
3191 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
|
3192 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
|
3193 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
|
3194 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
|
3195 |
1803
5752a95053f2
* xterm.c (x_window_to_scrollbar): Search frames'
Jim Blandy <jimb@redhat.com>
parents:
1793
diff
changeset
|
3196 BLOCK_INPUT; |
5752a95053f2
* xterm.c (x_window_to_scrollbar): Search frames'
Jim Blandy <jimb@redhat.com>
parents:
1793
diff
changeset
|
3197 |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3198 /* 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
|
3199 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
|
3200 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
|
3201 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
|
3202 |
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3203 /* 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
|
3204 &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
|
3205 &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
|
3206 |
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3207 /* 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
|
3208 &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
|
3209 |
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3210 /* 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
|
3211 &dummy_mask)) |
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3212 *f = 0; |
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3213 else |
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3214 { |
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3215 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
|
3216 = 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
|
3217 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
|
3218 = 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
|
3219 |
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3220 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
|
3221 |
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3222 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
|
3223 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
|
3224 |
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3225 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
|
3226 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
|
3227 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
|
3228 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
|
3229 |
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3230 *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
|
3231 *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
|
3232 |
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3233 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
|
3234 *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
|
3235 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
|
3236 *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
|
3237 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
|
3238 *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
|
3239 else |
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3240 *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
|
3241 |
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3242 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
|
3243 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
|
3244 |
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3245 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
|
3246 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
|
3247 } |
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3248 |
44ed08628516
* xterm.c (x_scroll_bar_report_motion): Set *TIME whether or not
Jim Blandy <jimb@redhat.com>
parents:
2977
diff
changeset
|
3249 *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
|
3250 |
1803
5752a95053f2
* xterm.c (x_window_to_scrollbar): Search frames'
Jim Blandy <jimb@redhat.com>
parents:
1793
diff
changeset
|
3251 UNBLOCK_INPUT; |
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
3252 } |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
3253 |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3254 |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3255 /* 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
|
3256 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
|
3257 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
|
3258 redraw them. */ |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3259 |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3260 x_scroll_bar_clear (f) |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3261 FRAME_PTR f; |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3262 { |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3263 Lisp_Object bar; |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3264 |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3265 for (bar = FRAME_SCROLL_BARS (f); |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3266 XTYPE (bar) == Lisp_Vector; |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3267 bar = XSCROLL_BAR (bar)->next) |
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3268 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
|
3269 0, 0, 0, 0, True); |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3270 } |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3271 |
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3272 /* 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
|
3273 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
|
3274 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
|
3275 |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3276 void |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3277 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
|
3278 XEvent event; |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3279 { |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3280 FRAME_PTR f; |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3281 |
5872
6389c826f847
(x_display_cursor, process_expose_from_menu): Block input.
Karl Heuer <kwzh@gnu.org>
parents:
5825
diff
changeset
|
3282 BLOCK_INPUT; |
6389c826f847
(x_display_cursor, process_expose_from_menu): Block input.
Karl Heuer <kwzh@gnu.org>
parents:
5825
diff
changeset
|
3283 |
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3284 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
|
3285 if (f) |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3286 { |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3287 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
|
3288 { |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3289 f->async_visible = 1; |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3290 f->async_iconified = 0; |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3291 SET_FRAME_GARBAGED (f); |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3292 } |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3293 else |
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 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
|
3296 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
|
3297 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
|
3298 } |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3299 } |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3300 else |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3301 { |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3302 struct scroll_bar *bar |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3303 = 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
|
3304 |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3305 if (bar) |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3306 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
|
3307 } |
5872
6389c826f847
(x_display_cursor, process_expose_from_menu): Block input.
Karl Heuer <kwzh@gnu.org>
parents:
5825
diff
changeset
|
3308 |
6389c826f847
(x_display_cursor, process_expose_from_menu): Block input.
Karl Heuer <kwzh@gnu.org>
parents:
5825
diff
changeset
|
3309 UNBLOCK_INPUT; |
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3310 } |
8353
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3311 |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3312 /* Define a queue to save up SelectionRequest events for later handling. */ |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3313 |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3314 struct selection_event_queue |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3315 { |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3316 XEvent event; |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3317 struct selection_event_queue *next; |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3318 }; |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3319 |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3320 static struct selection_event_queue *queue; |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3321 |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3322 /* Nonzero means queue up certain events--don't process them yet. */ |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3323 static int x_queue_selection_requests; |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3324 |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3325 /* Queue up an X event *EVENT, to be processed later. */ |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3326 |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3327 static void |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3328 x_queue_event (event) |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3329 XEvent *event; |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3330 { |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3331 struct selection_event_queue *queue_tmp |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3332 = (struct selection_event_queue *) malloc (sizeof (struct selection_event_queue)); |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3333 |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3334 if (queue_tmp != NULL) |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3335 { |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3336 queue_tmp->event = *event; |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3337 queue_tmp->next = queue; |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3338 queue = queue_tmp; |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3339 } |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3340 } |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3341 |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3342 /* Take all the queued events and put them back |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3343 so that they get processed afresh. */ |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3344 |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3345 static void |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3346 x_unqueue_events () |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3347 { |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3348 while (queue != NULL) |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3349 { |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3350 struct selection_event_queue *queue_tmp = queue; |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3351 XPutBackEvent (XDISPLAY &queue_tmp->event); |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3352 queue = queue_tmp->next; |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3353 free ((char *)queue_tmp); |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3354 } |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3355 } |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3356 |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3357 /* Start queuing SelectionRequest events. */ |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3358 |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3359 void |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3360 x_start_queuing_selection_requests () |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3361 { |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3362 x_queue_selection_requests++; |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3363 } |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3364 |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3365 /* Stop queuing SelectionRequest events. */ |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3366 |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3367 void |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3368 x_stop_queuing_selection_requests () |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3369 { |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3370 x_queue_selection_requests--; |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3371 x_unqueue_events (); |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3372 } |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3373 |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3374 /* The main X event-reading loop - XTread_socket. */ |
286 | 3375 |
3376 /* Timestamp of enter window event. This is only used by XTread_socket, | |
3377 but we have to put it out here, since static variables within functions | |
3378 sometimes don't work. */ | |
3379 static Time enter_timestamp; | |
3380 | |
1436
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
3381 /* 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
|
3382 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
|
3383 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
|
3384 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
|
3385 |
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
3386 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
|
3387 given for enter_timestamp, above. */ |
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
3388 static XComposeStatus compose_status; |
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
3389 |
642 | 3390 /* Communication with window managers. */ |
3391 Atom Xatom_wm_protocols; | |
3392 | |
3393 /* Kinds of protocol things we may receive. */ | |
3394 Atom Xatom_wm_take_focus; | |
3395 Atom Xatom_wm_save_yourself; | |
3396 Atom Xatom_wm_delete_window; | |
3397 | |
3398 /* Other WM communication */ | |
3399 Atom Xatom_wm_configure_denied; /* When our config request is denied */ | |
3400 Atom Xatom_wm_window_moved; /* When the WM moves us. */ | |
3401 | |
2195
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3402 /* Window manager communication. */ |
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3403 Atom Xatom_wm_change_state; |
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3404 |
6941
a914781ef58a
(Xatom_editres_name): Variable defined.
Richard M. Stallman <rms@gnu.org>
parents:
6934
diff
changeset
|
3405 /* EditRes protocol */ |
a914781ef58a
(Xatom_editres_name): Variable defined.
Richard M. Stallman <rms@gnu.org>
parents:
6934
diff
changeset
|
3406 Atom Xatom_editres_name; |
a914781ef58a
(Xatom_editres_name): Variable defined.
Richard M. Stallman <rms@gnu.org>
parents:
6934
diff
changeset
|
3407 |
2064 | 3408 /* Record the last 100 characters stored |
3409 to help debug the loss-of-chars-during-GC problem. */ | |
3410 int temp_index; | |
3411 short temp_buffer[100]; | |
3412 | |
286 | 3413 /* Read events coming from the X server. |
3414 This routine is called by the SIGIO handler. | |
3415 We return as soon as there are no more events to be read. | |
3416 | |
3417 Events representing keys are stored in buffer BUFP, | |
3418 which can hold up to NUMCHARS characters. | |
3419 We return the number of characters stored into the buffer, | |
3420 thus pretending to be `read'. | |
3421 | |
3422 WAITP is nonzero if we should block until input arrives. | |
3423 EXPECTED is nonzero if the caller knows input is available. */ | |
3424 | |
1530
a7f8a1fe258e
* xterm.c (x_convert_modifiers): Declare this to return an
Jim Blandy <jimb@redhat.com>
parents:
1436
diff
changeset
|
3425 int |
286 | 3426 XTread_socket (sd, bufp, numchars, waitp, expected) |
3427 register int sd; | |
3428 register struct input_event *bufp; | |
3429 register int numchars; | |
3430 int waitp; | |
3431 int expected; | |
3432 { | |
3433 int count = 0; | |
3434 int nbytes = 0; | |
3435 int mask; | |
3436 int items_pending; /* How many items are in the X queue. */ | |
3437 XEvent event; | |
771 | 3438 struct frame *f; |
3938
83d870a52936
* xterm.c (XTread_socket): Initialize event_found to zero, and
Jim Blandy <jimb@redhat.com>
parents:
3924
diff
changeset
|
3439 int event_found = 0; |
286 | 3440 int prefix; |
3441 Lisp_Object part; | |
3442 | |
2439
b6c62e4abf59
Put interrupt input blocking in a separate file from xterm.h.
Jim Blandy <jimb@redhat.com>
parents:
2353
diff
changeset
|
3443 if (interrupt_input_blocked) |
286 | 3444 { |
2439
b6c62e4abf59
Put interrupt input blocking in a separate file from xterm.h.
Jim Blandy <jimb@redhat.com>
parents:
2353
diff
changeset
|
3445 interrupt_input_pending = 1; |
286 | 3446 return -1; |
3447 } | |
3448 | |
2439
b6c62e4abf59
Put interrupt input blocking in a separate file from xterm.h.
Jim Blandy <jimb@redhat.com>
parents:
2353
diff
changeset
|
3449 interrupt_input_pending = 0; |
286 | 3450 BLOCK_INPUT; |
3451 | |
3452 if (numchars <= 0) | |
3453 abort (); /* Don't think this happens. */ | |
3454 | |
3455 #ifdef FIOSNBIO | |
3456 /* If available, Xlib uses FIOSNBIO to make the socket | |
3457 non-blocking, and then looks for EWOULDBLOCK. If O_NDELAY is set, | |
3458 FIOSNBIO is ignored, and instead of signalling EWOULDBLOCK, | |
3459 a read returns 0, which Xlib interprets as equivalent to EPIPE. */ | |
3460 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
|
3461 #endif /* ! defined (FIOSNBIO) */ |
286 | 3462 |
3463 #ifndef SIGIO | |
3464 #ifndef HAVE_SELECT | |
3465 if (! (fcntl (fileno (stdin), F_GETFL, 0) & O_NDELAY)) | |
3466 { | |
3467 extern int read_alarm_should_throw; | |
3468 read_alarm_should_throw = 1; | |
3469 XPeekEvent (XDISPLAY &event); | |
3470 read_alarm_should_throw = 0; | |
3471 } | |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3472 #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
|
3473 #endif /* SIGIO */ |
286 | 3474 |
3475 while (XStuffPending () != 0) | |
3476 { | |
3477 XNextEvent (XDISPLAY &event); | |
3478 event_found = 1; | |
3479 | |
3480 switch (event.type) | |
3481 { | |
3482 #ifdef HAVE_X11 | |
642 | 3483 case ClientMessage: |
3484 { | |
3485 if (event.xclient.message_type == Xatom_wm_protocols | |
3486 && event.xclient.format == 32) | |
3487 { | |
3488 if (event.xclient.data.l[0] == Xatom_wm_take_focus) | |
3489 { | |
771 | 3490 f = x_window_to_frame (event.xclient.window); |
7128
6c6a776a64e1
(XTread_socket, case ClientMessage): Don't call
Richard M. Stallman <rms@gnu.org>
parents:
7123
diff
changeset
|
3491 /* Since we set WM_TAKE_FOCUS, we must call |
6c6a776a64e1
(XTread_socket, case ClientMessage): Don't call
Richard M. Stallman <rms@gnu.org>
parents:
7123
diff
changeset
|
3492 XSetInputFocus explicitly. But not if f is null, |
6c6a776a64e1
(XTread_socket, case ClientMessage): Don't call
Richard M. Stallman <rms@gnu.org>
parents:
7123
diff
changeset
|
3493 since that might be an event for a deleted frame. */ |
771 | 3494 if (f) |
6983
b18e5c09d7c3
(XTread_socket, case ClientMessage): Use x_window_to_frame unconditionally.
Richard M. Stallman <rms@gnu.org>
parents:
6941
diff
changeset
|
3495 XSetInputFocus (event.xclient.display, |
b18e5c09d7c3
(XTread_socket, case ClientMessage): Use x_window_to_frame unconditionally.
Richard M. Stallman <rms@gnu.org>
parents:
6941
diff
changeset
|
3496 event.xclient.window, |
b18e5c09d7c3
(XTread_socket, case ClientMessage): Use x_window_to_frame unconditionally.
Richard M. Stallman <rms@gnu.org>
parents:
6941
diff
changeset
|
3497 RevertToPointerRoot, |
b18e5c09d7c3
(XTread_socket, case ClientMessage): Use x_window_to_frame unconditionally.
Richard M. Stallman <rms@gnu.org>
parents:
6941
diff
changeset
|
3498 event.xclient.data.l[1]); |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3499 /* Not certain about handling scroll bars here */ |
642 | 3500 } |
3501 else if (event.xclient.data.l[0] == Xatom_wm_save_yourself) | |
3502 { | |
3503 /* Save state modify the WM_COMMAND property to | |
3504 something which can reinstate us. This notifies | |
3505 the session manager, who's looking for such a | |
3506 PropertyNotify. Can restart processing when | |
3507 a keyboard or mouse event arrives. */ | |
3508 if (numchars > 0) | |
3509 { | |
7870
537930034e73
(XTread_socket): Handle Xatom_wm_save_yourself by calling XSetCommand.
Richard M. Stallman <rms@gnu.org>
parents:
7806
diff
changeset
|
3510 /* This is just so we only give real data once |
537930034e73
(XTread_socket): Handle Xatom_wm_save_yourself by calling XSetCommand.
Richard M. Stallman <rms@gnu.org>
parents:
7806
diff
changeset
|
3511 for a single Emacs process. */ |
7902
22b9aaaf0302
Put stdio.h after config.h.
Richard M. Stallman <rms@gnu.org>
parents:
7870
diff
changeset
|
3512 if (x_top_window_to_frame (event.xclient.window) |
22b9aaaf0302
Put stdio.h after config.h.
Richard M. Stallman <rms@gnu.org>
parents:
7870
diff
changeset
|
3513 == selected_frame) |
7870
537930034e73
(XTread_socket): Handle Xatom_wm_save_yourself by calling XSetCommand.
Richard M. Stallman <rms@gnu.org>
parents:
7806
diff
changeset
|
3514 XSetCommand (x_current_display, |
537930034e73
(XTread_socket): Handle Xatom_wm_save_yourself by calling XSetCommand.
Richard M. Stallman <rms@gnu.org>
parents:
7806
diff
changeset
|
3515 event.xclient.window, |
537930034e73
(XTread_socket): Handle Xatom_wm_save_yourself by calling XSetCommand.
Richard M. Stallman <rms@gnu.org>
parents:
7806
diff
changeset
|
3516 initial_argv, initial_argc); |
537930034e73
(XTread_socket): Handle Xatom_wm_save_yourself by calling XSetCommand.
Richard M. Stallman <rms@gnu.org>
parents:
7806
diff
changeset
|
3517 else |
537930034e73
(XTread_socket): Handle Xatom_wm_save_yourself by calling XSetCommand.
Richard M. Stallman <rms@gnu.org>
parents:
7806
diff
changeset
|
3518 XSetCommand (x_current_display, |
537930034e73
(XTread_socket): Handle Xatom_wm_save_yourself by calling XSetCommand.
Richard M. Stallman <rms@gnu.org>
parents:
7806
diff
changeset
|
3519 event.xclient.window, |
537930034e73
(XTread_socket): Handle Xatom_wm_save_yourself by calling XSetCommand.
Richard M. Stallman <rms@gnu.org>
parents:
7806
diff
changeset
|
3520 0, 0); |
642 | 3521 } |
3522 } | |
3523 else if (event.xclient.data.l[0] == Xatom_wm_delete_window) | |
3524 { | |
6114
b69bdef4f7f6
(XTread_socket): For case ClientMessage and Xatom_wm_delete_window, use
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6088
diff
changeset
|
3525 struct frame *f = x_any_window_to_frame (event.xclient.window); |
771 | 3526 |
3527 if (f) | |
5156
fd78458b8c43
(XTread_socket): Really handle Xatom_wm_window_moved events.
Richard M. Stallman <rms@gnu.org>
parents:
5018
diff
changeset
|
3528 { |
fd78458b8c43
(XTread_socket): Really handle Xatom_wm_window_moved events.
Richard M. Stallman <rms@gnu.org>
parents:
5018
diff
changeset
|
3529 if (numchars == 0) |
fd78458b8c43
(XTread_socket): Really handle Xatom_wm_window_moved events.
Richard M. Stallman <rms@gnu.org>
parents:
5018
diff
changeset
|
3530 abort (); |
fd78458b8c43
(XTread_socket): Really handle Xatom_wm_window_moved events.
Richard M. Stallman <rms@gnu.org>
parents:
5018
diff
changeset
|
3531 |
fd78458b8c43
(XTread_socket): Really handle Xatom_wm_window_moved events.
Richard M. Stallman <rms@gnu.org>
parents:
5018
diff
changeset
|
3532 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
|
3533 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
|
3534 bufp++; |
fd78458b8c43
(XTread_socket): Really handle Xatom_wm_window_moved events.
Richard M. Stallman <rms@gnu.org>
parents:
5018
diff
changeset
|
3535 |
fd78458b8c43
(XTread_socket): Really handle Xatom_wm_window_moved events.
Richard M. Stallman <rms@gnu.org>
parents:
5018
diff
changeset
|
3536 count += 1; |
fd78458b8c43
(XTread_socket): Really handle Xatom_wm_window_moved events.
Richard M. Stallman <rms@gnu.org>
parents:
5018
diff
changeset
|
3537 numchars -= 1; |
fd78458b8c43
(XTread_socket): Really handle Xatom_wm_window_moved events.
Richard M. Stallman <rms@gnu.org>
parents:
5018
diff
changeset
|
3538 } |
642 | 3539 } |
3540 } | |
3541 else if (event.xclient.message_type == Xatom_wm_configure_denied) | |
3542 { | |
3543 } | |
3544 else if (event.xclient.message_type == Xatom_wm_window_moved) | |
3545 { | |
3546 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
|
3547 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
|
3548 |
786 | 3549 new_x = event.xclient.data.s[0]; |
3550 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
|
3551 |
fd78458b8c43
(XTread_socket): Really handle Xatom_wm_window_moved events.
Richard M. Stallman <rms@gnu.org>
parents:
5018
diff
changeset
|
3552 if (f) |
fd78458b8c43
(XTread_socket): Really handle Xatom_wm_window_moved events.
Richard M. Stallman <rms@gnu.org>
parents:
5018
diff
changeset
|
3553 { |
fd78458b8c43
(XTread_socket): Really handle Xatom_wm_window_moved events.
Richard M. Stallman <rms@gnu.org>
parents:
5018
diff
changeset
|
3554 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
|
3555 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
|
3556 } |
642 | 3557 } |
6983
b18e5c09d7c3
(XTread_socket, case ClientMessage): Use x_window_to_frame unconditionally.
Richard M. Stallman <rms@gnu.org>
parents:
6941
diff
changeset
|
3558 #if defined (USE_X_TOOLKIT) && defined (HAVE_X11R5) |
6941
a914781ef58a
(Xatom_editres_name): Variable defined.
Richard M. Stallman <rms@gnu.org>
parents:
6934
diff
changeset
|
3559 else if (event.xclient.message_type == Xatom_editres_name) |
a914781ef58a
(Xatom_editres_name): Variable defined.
Richard M. Stallman <rms@gnu.org>
parents:
6934
diff
changeset
|
3560 { |
a914781ef58a
(Xatom_editres_name): Variable defined.
Richard M. Stallman <rms@gnu.org>
parents:
6934
diff
changeset
|
3561 struct frame *f = x_any_window_to_frame (event.xclient.window); |
a914781ef58a
(Xatom_editres_name): Variable defined.
Richard M. Stallman <rms@gnu.org>
parents:
6934
diff
changeset
|
3562 _XEditResCheckMessages (f->display.x->widget, NULL, &event, NULL); |
a914781ef58a
(Xatom_editres_name): Variable defined.
Richard M. Stallman <rms@gnu.org>
parents:
6934
diff
changeset
|
3563 } |
6983
b18e5c09d7c3
(XTread_socket, case ClientMessage): Use x_window_to_frame unconditionally.
Richard M. Stallman <rms@gnu.org>
parents:
6941
diff
changeset
|
3564 #endif /* USE_X_TOOLKIT and HAVE_X11R5 */ |
642 | 3565 } |
3566 break; | |
286 | 3567 |
2195
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3568 case SelectionNotify: |
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3569 #ifdef USE_X_TOOLKIT |
6984
8e9465c13702
(XTread_socket): Delete the non-NEW_SELECTIONS code
Richard M. Stallman <rms@gnu.org>
parents:
6983
diff
changeset
|
3570 if (! x_window_to_frame (event.xselection.requestor)) |
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3571 goto OTHER; |
6984
8e9465c13702
(XTread_socket): Delete the non-NEW_SELECTIONS code
Richard M. Stallman <rms@gnu.org>
parents:
6983
diff
changeset
|
3572 #endif /* not USE_X_TOOLKIT */ |
2195
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3573 x_handle_selection_notify (&event); |
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3574 break; |
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3575 |
286 | 3576 case SelectionClear: /* Someone has grabbed ownership. */ |
6984
8e9465c13702
(XTread_socket): Delete the non-NEW_SELECTIONS code
Richard M. Stallman <rms@gnu.org>
parents:
6983
diff
changeset
|
3577 #ifdef USE_X_TOOLKIT |
8e9465c13702
(XTread_socket): Delete the non-NEW_SELECTIONS code
Richard M. Stallman <rms@gnu.org>
parents:
6983
diff
changeset
|
3578 if (! x_window_to_frame (event.xselectionclear.window)) |
8e9465c13702
(XTread_socket): Delete the non-NEW_SELECTIONS code
Richard M. Stallman <rms@gnu.org>
parents:
6983
diff
changeset
|
3579 goto OTHER; |
8e9465c13702
(XTread_socket): Delete the non-NEW_SELECTIONS code
Richard M. Stallman <rms@gnu.org>
parents:
6983
diff
changeset
|
3580 #endif /* USE_X_TOOLKIT */ |
2195
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3581 { |
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3582 XSelectionClearEvent *eventp = (XSelectionClearEvent *) &event; |
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3583 |
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3584 if (numchars == 0) |
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3585 abort (); |
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3586 |
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3587 bufp->kind = selection_clear_event; |
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3588 SELECTION_EVENT_DISPLAY (bufp) = eventp->display; |
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3589 SELECTION_EVENT_SELECTION (bufp) = eventp->selection; |
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3590 SELECTION_EVENT_TIME (bufp) = eventp->time; |
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3591 bufp++; |
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3592 |
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3593 count += 1; |
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3594 numchars -= 1; |
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
3595 } |
286 | 3596 break; |
3597 | |
3598 case SelectionRequest: /* Someone wants our selection. */ | |
6984
8e9465c13702
(XTread_socket): Delete the non-NEW_SELECTIONS code
Richard M. Stallman <rms@gnu.org>
parents:
6983
diff
changeset
|
3599 #ifdef USE_X_TOOLKIT |
8e9465c13702
(XTread_socket): Delete the non-NEW_SELECTIONS code
Richard M. Stallman <rms@gnu.org>
parents:
6983
diff
changeset
|
3600 if (!x_window_to_frame (event.xselectionrequest.owner)) |
8e9465c13702
(XTread_socket): Delete the non-NEW_SELECTIONS code
Richard M. Stallman <rms@gnu.org>
parents:
6983
diff
changeset
|
3601 goto OTHER; |
8e9465c13702
(XTread_socket): Delete the non-NEW_SELECTIONS code
Richard M. Stallman <rms@gnu.org>
parents:
6983
diff
changeset
|
3602 #endif /* USE_X_TOOLKIT */ |
8353
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3603 if (x_queue_selection_requests) |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3604 x_queue_event (&event); |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3605 else |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3606 { |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3607 XSelectionRequestEvent *eventp = (XSelectionRequestEvent *) &event; |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3608 |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3609 if (numchars == 0) |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3610 abort (); |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3611 |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3612 bufp->kind = selection_request_event; |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3613 SELECTION_EVENT_DISPLAY (bufp) = eventp->display; |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3614 SELECTION_EVENT_REQUESTOR (bufp) = eventp->requestor; |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3615 SELECTION_EVENT_SELECTION (bufp) = eventp->selection; |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3616 SELECTION_EVENT_TARGET (bufp) = eventp->target; |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3617 SELECTION_EVENT_PROPERTY (bufp) = eventp->property; |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3618 SELECTION_EVENT_TIME (bufp) = eventp->time; |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3619 bufp++; |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3620 |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3621 count += 1; |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3622 numchars -= 1; |
525e990ca9d2
(x_queue_event, x_unqueue_events): New functions.
Richard M. Stallman <rms@gnu.org>
parents:
8291
diff
changeset
|
3623 } |
286 | 3624 break; |
3625 | |
3626 case PropertyNotify: | |
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3627 #ifdef USE_X_TOOLKIT |
6984
8e9465c13702
(XTread_socket): Delete the non-NEW_SELECTIONS code
Richard M. Stallman <rms@gnu.org>
parents:
6983
diff
changeset
|
3628 if (!x_any_window_to_frame (event.xproperty.window)) |
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3629 goto OTHER; |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3630 #endif /* not USE_X_TOOLKIT */ |
6984
8e9465c13702
(XTread_socket): Delete the non-NEW_SELECTIONS code
Richard M. Stallman <rms@gnu.org>
parents:
6983
diff
changeset
|
3631 x_handle_property_notify (&event); |
286 | 3632 break; |
3633 | |
3045
0267fb20b0df
(XTread_socket, ConfigureNotify case):
Richard M. Stallman <rms@gnu.org>
parents:
3030
diff
changeset
|
3634 case ReparentNotify: |
7409
fe56a02838ba
(x_set_offset): Set gravity and size hint
Richard M. Stallman <rms@gnu.org>
parents:
7346
diff
changeset
|
3635 f = x_top_window_to_frame (event.xreparent.window); |
3045
0267fb20b0df
(XTread_socket, ConfigureNotify case):
Richard M. Stallman <rms@gnu.org>
parents:
3030
diff
changeset
|
3636 if (f) |
7409
fe56a02838ba
(x_set_offset): Set gravity and size hint
Richard M. Stallman <rms@gnu.org>
parents:
7346
diff
changeset
|
3637 { |
fe56a02838ba
(x_set_offset): Set gravity and size hint
Richard M. Stallman <rms@gnu.org>
parents:
7346
diff
changeset
|
3638 int x, y; |
fe56a02838ba
(x_set_offset): Set gravity and size hint
Richard M. Stallman <rms@gnu.org>
parents:
7346
diff
changeset
|
3639 f->display.x->parent_desc = event.xreparent.parent; |
fe56a02838ba
(x_set_offset): Set gravity and size hint
Richard M. Stallman <rms@gnu.org>
parents:
7346
diff
changeset
|
3640 x_real_positions (f, &x, &y); |
fe56a02838ba
(x_set_offset): Set gravity and size hint
Richard M. Stallman <rms@gnu.org>
parents:
7346
diff
changeset
|
3641 f->display.x->left_pos = x; |
fe56a02838ba
(x_set_offset): Set gravity and size hint
Richard M. Stallman <rms@gnu.org>
parents:
7346
diff
changeset
|
3642 f->display.x->top_pos = y; |
fe56a02838ba
(x_set_offset): Set gravity and size hint
Richard M. Stallman <rms@gnu.org>
parents:
7346
diff
changeset
|
3643 } |
3045
0267fb20b0df
(XTread_socket, ConfigureNotify case):
Richard M. Stallman <rms@gnu.org>
parents:
3030
diff
changeset
|
3644 break; |
0267fb20b0df
(XTread_socket, ConfigureNotify case):
Richard M. Stallman <rms@gnu.org>
parents:
3030
diff
changeset
|
3645 |
286 | 3646 case Expose: |
771 | 3647 f = x_window_to_frame (event.xexpose.window); |
3648 if (f) | |
286 | 3649 { |
1658
452ba03935d7
* xterm.c (XTread_socket): When we get MapNotify, UnmapNotify,
Jim Blandy <jimb@redhat.com>
parents:
1530
diff
changeset
|
3650 if (f->async_visible == 0) |
286 | 3651 { |
1658
452ba03935d7
* xterm.c (XTread_socket): When we get MapNotify, UnmapNotify,
Jim Blandy <jimb@redhat.com>
parents:
1530
diff
changeset
|
3652 f->async_visible = 1; |
452ba03935d7
* xterm.c (XTread_socket): When we get MapNotify, UnmapNotify,
Jim Blandy <jimb@redhat.com>
parents:
1530
diff
changeset
|
3653 f->async_iconified = 0; |
771 | 3654 SET_FRAME_GARBAGED (f); |
286 | 3655 } |
3656 else | |
6984
8e9465c13702
(XTread_socket): Delete the non-NEW_SELECTIONS code
Richard M. Stallman <rms@gnu.org>
parents:
6983
diff
changeset
|
3657 dumprectangle (x_window_to_frame (event.xexpose.window), |
8e9465c13702
(XTread_socket): Delete the non-NEW_SELECTIONS code
Richard M. Stallman <rms@gnu.org>
parents:
6983
diff
changeset
|
3658 event.xexpose.x, event.xexpose.y, |
8e9465c13702
(XTread_socket): Delete the non-NEW_SELECTIONS code
Richard M. Stallman <rms@gnu.org>
parents:
6983
diff
changeset
|
3659 event.xexpose.width, event.xexpose.height); |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3660 } |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3661 else |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3662 { |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3663 struct scroll_bar *bar |
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3664 = 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
|
3665 |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3666 if (bar) |
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3667 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
|
3668 #ifdef USE_X_TOOLKIT |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3669 else |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3670 goto OTHER; |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3671 #endif /* USE_X_TOOLKIT */ |
286 | 3672 } |
3673 break; | |
3674 | |
3675 case GraphicsExpose: /* This occurs when an XCopyArea's | |
3676 source area was obscured or not | |
3677 available.*/ | |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3678 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
|
3679 if (f) |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3680 { |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3681 dumprectangle (f, |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3682 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
|
3683 event.xgraphicsexpose.width, |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3684 event.xgraphicsexpose.height); |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3685 } |
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3686 #ifdef USE_X_TOOLKIT |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3687 else |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3688 goto OTHER; |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3689 #endif /* USE_X_TOOLKIT */ |
286 | 3690 break; |
3691 | |
3692 case NoExpose: /* This occurs when an XCopyArea's | |
3693 source area was completely | |
3694 available */ | |
3695 break; | |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3696 #else /* ! defined (HAVE_X11) */ |
286 | 3697 case ExposeWindow: |
3698 if (event.subwindow != 0) | |
3699 break; /* duplicate event */ | |
771 | 3700 f = x_window_to_frame (event.window); |
3701 if (event.window == f->display.x->icon_desc) | |
286 | 3702 { |
771 | 3703 refreshicon (f); |
1658
452ba03935d7
* xterm.c (XTread_socket): When we get MapNotify, UnmapNotify,
Jim Blandy <jimb@redhat.com>
parents:
1530
diff
changeset
|
3704 f->async_iconified = 1; |
286 | 3705 } |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3706 if (event.window == FRAME_X_WINDOW (f)) |
286 | 3707 { |
3708 /* Say must check all windows' needs_exposure flags. */ | |
3709 expose_all_windows = 1; | |
771 | 3710 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
|
3711 f->async_visible = 1; |
286 | 3712 } |
3713 break; | |
3714 | |
3715 case ExposeRegion: | |
3716 if (event.subwindow != 0) | |
3717 break; /* duplicate event */ | |
771 | 3718 f = x_window_to_frame (event.window); |
3719 if (event.window == f->display.x->icon_desc) | |
286 | 3720 { |
771 | 3721 refreshicon (f); |
286 | 3722 break; |
3723 } | |
3724 /* If window already needs full redraw, ignore this rectangle. */ | |
771 | 3725 if (expose_all_windows && f->display.x->needs_exposure) |
286 | 3726 break; |
3727 /* Put the event on the queue of rectangles to redraw. */ | |
3728 if (enqueue_event (&event, &x_expose_queue)) | |
3729 /* If it is full, we can't record the rectangle, | |
3730 so redraw this entire window. */ | |
3731 { | |
3732 /* Say must check all windows' needs_exposure flags. */ | |
3733 expose_all_windows = 1; | |
771 | 3734 f->display.x->needs_exposure = 1; |
286 | 3735 } |
3736 break; | |
3737 | |
3738 case ExposeCopy: | |
3739 /* This should happen only when we are expecting it, | |
3740 in x_read_exposes. */ | |
3741 abort (); | |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3742 #endif /* ! defined (HAVE_X11) */ |
286 | 3743 |
3744 #ifdef HAVE_X11 | |
3745 case UnmapNotify: | |
6934
e0ab4f59004e
(dumpglyphs): When HL=2, check explicitly for using
Richard M. Stallman <rms@gnu.org>
parents:
6883
diff
changeset
|
3746 f = x_any_window_to_frame (event.xunmap.window); |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3747 if (f) /* F may no longer exist if |
771 | 3748 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
|
3749 { |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3750 /* 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
|
3751 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
|
3752 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
|
3753 f->async_visible = 0; |
6983
b18e5c09d7c3
(XTread_socket, case ClientMessage): Use x_window_to_frame unconditionally.
Richard M. Stallman <rms@gnu.org>
parents:
6941
diff
changeset
|
3754 /* We can't distinguish, from the event, whether the window |
b18e5c09d7c3
(XTread_socket, case ClientMessage): Use x_window_to_frame unconditionally.
Richard M. Stallman <rms@gnu.org>
parents:
6941
diff
changeset
|
3755 has become iconified or invisible. So assume, if it |
b18e5c09d7c3
(XTread_socket, case ClientMessage): Use x_window_to_frame unconditionally.
Richard M. Stallman <rms@gnu.org>
parents:
6941
diff
changeset
|
3756 was previously visible, than now it is iconified. |
b18e5c09d7c3
(XTread_socket, case ClientMessage): Use x_window_to_frame unconditionally.
Richard M. Stallman <rms@gnu.org>
parents:
6941
diff
changeset
|
3757 We depend on x_make_frame_invisible to mark it iconified. */ |
3284
a47979ffad1e
(XTread_socket): For UnmapNotify, if frame was visible,
Richard M. Stallman <rms@gnu.org>
parents:
3282
diff
changeset
|
3758 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
|
3759 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
|
3760 } |
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3761 #ifdef USE_X_TOOLKIT |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3762 goto OTHER; |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3763 #endif /* USE_X_TOOLKIT */ |
286 | 3764 break; |
3765 | |
3766 case MapNotify: | |
6984
8e9465c13702
(XTread_socket): Delete the non-NEW_SELECTIONS code
Richard M. Stallman <rms@gnu.org>
parents:
6983
diff
changeset
|
3767 /* We use x_top_window_to_frame because map events can come |
8e9465c13702
(XTread_socket): Delete the non-NEW_SELECTIONS code
Richard M. Stallman <rms@gnu.org>
parents:
6983
diff
changeset
|
3768 for subwindows and they don't mean that the frame is visible. */ |
6983
b18e5c09d7c3
(XTread_socket, case ClientMessage): Use x_window_to_frame unconditionally.
Richard M. Stallman <rms@gnu.org>
parents:
6941
diff
changeset
|
3769 f = x_top_window_to_frame (event.xmap.window); |
771 | 3770 if (f) |
286 | 3771 { |
1658
452ba03935d7
* xterm.c (XTread_socket): When we get MapNotify, UnmapNotify,
Jim Blandy <jimb@redhat.com>
parents:
1530
diff
changeset
|
3772 f->async_visible = 1; |
452ba03935d7
* xterm.c (XTread_socket): When we get MapNotify, UnmapNotify,
Jim Blandy <jimb@redhat.com>
parents:
1530
diff
changeset
|
3773 f->async_iconified = 0; |
286 | 3774 |
3775 /* wait_reading_process_input will notice this and update | |
771 | 3776 the frame's display structures. */ |
3777 SET_FRAME_GARBAGED (f); | |
286 | 3778 } |
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3779 #ifdef USE_X_TOOLKIT |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3780 goto OTHER; |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
3781 #endif /* USE_X_TOOLKIT */ |
6984
8e9465c13702
(XTread_socket): Delete the non-NEW_SELECTIONS code
Richard M. Stallman <rms@gnu.org>
parents:
6983
diff
changeset
|
3782 break; |
286 | 3783 |
3784 /* Turn off processing if we become fully obscured. */ | |
3785 case VisibilityNotify: | |
3786 break; | |
3787 | |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3788 #else /* ! defined (HAVE_X11) */ |
286 | 3789 case UnmapWindow: |
771 | 3790 f = x_window_to_frame (event.window); |
3791 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
|
3792 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
|
3793 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
|
3794 f->async_visible = 0; |
286 | 3795 break; |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3796 #endif /* ! defined (HAVE_X11) */ |
286 | 3797 |
3798 #ifdef HAVE_X11 | |
3799 case KeyPress: | |
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.xkey.window); |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3801 |
771 | 3802 if (f != 0) |
286 | 3803 { |
3355
e0c2e8a2ef75
(XTread_socket, case KeyPress) [HPUX]: Test IsModifiedKey.
Richard M. Stallman <rms@gnu.org>
parents:
3284
diff
changeset
|
3804 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
|
3805 /* 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
|
3806 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
|
3807 unsigned char copy_buffer[81]; |
1841
338e4ffdb54b
(XTread_socket): Support extra_keyboard_modifiers.
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
3808 int modifiers; |
338e4ffdb54b
(XTread_socket): Support extra_keyboard_modifiers.
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
3809 |
2661
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
3810 event.xkey.state |
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
3811 |= 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
|
3812 modifiers = event.xkey.state; |
555 | 3813 |
1436
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
3814 /* 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
|
3815 |
11eced50eaa6
* xterm.c (XTread_socket): Turn off ControlMask for XLookupString.
Jim Blandy <jimb@redhat.com>
parents:
2840
diff
changeset
|
3816 /* 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
|
3817 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
|
3818 event.xkey.state &= ~ControlMask; |
1436
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
3819 nbytes = |
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
3820 XLookupString (&event.xkey, copy_buffer, 80, &keysym, |
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
3821 &compose_status); |
286 | 3822 |
3355
e0c2e8a2ef75
(XTread_socket, case KeyPress) [HPUX]: Test IsModifiedKey.
Richard M. Stallman <rms@gnu.org>
parents:
3284
diff
changeset
|
3823 orig_keysym = keysym; |
395 | 3824 |
286 | 3825 if (numchars > 1) |
3826 { | |
3839
3cc238ae0de5
* xterm.c (XTread_socket): Never treat a modifier key as a
Jim Blandy <jimb@redhat.com>
parents:
3710
diff
changeset
|
3827 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
|
3828 || keysym == XK_Delete |
3cc238ae0de5
* xterm.c (XTread_socket): Never treat a modifier key as a
Jim Blandy <jimb@redhat.com>
parents:
3710
diff
changeset
|
3829 || 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
|
3830 || IsMiscFunctionKey (keysym) /* 0xff60 <= x < VARIES */ |
3218
0069a30d083f
(XTread_socket, case KeyPress) [HPUX]:
Richard M. Stallman <rms@gnu.org>
parents:
3135
diff
changeset
|
3831 #ifdef HPUX |
3839
3cc238ae0de5
* xterm.c (XTread_socket): Never treat a modifier key as a
Jim Blandy <jimb@redhat.com>
parents:
3710
diff
changeset
|
3832 /* 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
|
3833 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
|
3834 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
|
3835 incorrectly. */ |
3cc238ae0de5
* xterm.c (XTread_socket): Never treat a modifier key as a
Jim Blandy <jimb@redhat.com>
parents:
3710
diff
changeset
|
3836 || ((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
|
3837 && (unsigned)(keysym) < XK_KP_Space) |
3218
0069a30d083f
(XTread_socket, case KeyPress) [HPUX]:
Richard M. Stallman <rms@gnu.org>
parents:
3135
diff
changeset
|
3838 #endif |
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3839 #ifdef XK_dead_circumflex |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3840 || orig_keysym == XK_dead_circumflex |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3841 #endif |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3842 #ifdef XK_dead_grave |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3843 || orig_keysym == XK_dead_grave |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3844 #endif |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3845 #ifdef XK_dead_tilde |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3846 || orig_keysym == XK_dead_tilde |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3847 #endif |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3848 #ifdef XK_dead_diaeresis |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3849 || orig_keysym == XK_dead_diaeresis |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3850 #endif |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3851 #ifdef XK_dead_macron |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3852 || orig_keysym == XK_dead_macron |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3853 #endif |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3854 #ifdef XK_dead_degree |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3855 || orig_keysym == XK_dead_degree |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3856 #endif |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3857 #ifdef XK_dead_acute |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3858 || orig_keysym == XK_dead_acute |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3859 #endif |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3860 #ifdef XK_dead_cedilla |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3861 || orig_keysym == XK_dead_cedilla |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3862 #endif |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3863 #ifdef XK_dead_breve |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3864 || orig_keysym == XK_dead_breve |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3865 #endif |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3866 #ifdef XK_dead_ogonek |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3867 || orig_keysym == XK_dead_ogonek |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3868 #endif |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3869 #ifdef XK_dead_caron |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3870 || orig_keysym == XK_dead_caron |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3871 #endif |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3872 #ifdef XK_dead_doubleacute |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3873 || orig_keysym == XK_dead_doubleacute |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3874 #endif |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3875 #ifdef XK_dead_abovedot |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3876 || orig_keysym == XK_dead_abovedot |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3877 #endif |
3839
3cc238ae0de5
* xterm.c (XTread_socket): Never treat a modifier key as a
Jim Blandy <jimb@redhat.com>
parents:
3710
diff
changeset
|
3878 || 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
|
3879 || IsFunctionKey (keysym) /* 0xffbe <= x < 0xffe1 */ |
7706
44ff7a0a70b6
(x_is_vendor_fkey): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
7680
diff
changeset
|
3880 /* Any "vendor-specific" key is ok. */ |
44ff7a0a70b6
(x_is_vendor_fkey): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents:
7680
diff
changeset
|
3881 || (orig_keysym & (1 << 28))) |
4244
bc70363458c3
(XTread_socket) [! HAVE_X11R5]:
Richard M. Stallman <rms@gnu.org>
parents:
4147
diff
changeset
|
3882 && ! (IsModifierKey (orig_keysym) |
bc70363458c3
(XTread_socket) [! HAVE_X11R5]:
Richard M. Stallman <rms@gnu.org>
parents:
4147
diff
changeset
|
3883 #ifndef HAVE_X11R5 |
bc70363458c3
(XTread_socket) [! HAVE_X11R5]:
Richard M. Stallman <rms@gnu.org>
parents:
4147
diff
changeset
|
3884 #ifdef XK_Mode_switch |
bc70363458c3
(XTread_socket) [! HAVE_X11R5]:
Richard M. Stallman <rms@gnu.org>
parents:
4147
diff
changeset
|
3885 || ((unsigned)(orig_keysym) == XK_Mode_switch) |
bc70363458c3
(XTread_socket) [! HAVE_X11R5]:
Richard M. Stallman <rms@gnu.org>
parents:
4147
diff
changeset
|
3886 #endif |
bc70363458c3
(XTread_socket) [! HAVE_X11R5]:
Richard M. Stallman <rms@gnu.org>
parents:
4147
diff
changeset
|
3887 #ifdef XK_Num_Lock |
bc70363458c3
(XTread_socket) [! HAVE_X11R5]:
Richard M. Stallman <rms@gnu.org>
parents:
4147
diff
changeset
|
3888 || ((unsigned)(orig_keysym) == XK_Num_Lock) |
bc70363458c3
(XTread_socket) [! HAVE_X11R5]:
Richard M. Stallman <rms@gnu.org>
parents:
4147
diff
changeset
|
3889 #endif |
bc70363458c3
(XTread_socket) [! HAVE_X11R5]:
Richard M. Stallman <rms@gnu.org>
parents:
4147
diff
changeset
|
3890 #endif /* not HAVE_X11R5 */ |
bc70363458c3
(XTread_socket) [! HAVE_X11R5]:
Richard M. Stallman <rms@gnu.org>
parents:
4147
diff
changeset
|
3891 )) |
286 | 3892 { |
2064 | 3893 if (temp_index == sizeof temp_buffer / sizeof (short)) |
3894 temp_index = 0; | |
3895 temp_buffer[temp_index++] = keysym; | |
286 | 3896 bufp->kind = non_ascii_keystroke; |
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3897 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
|
3898 XSET (bufp->frame_or_window, Lisp_Frame, f); |
2661
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
3899 bufp->modifiers = x_x_to_emacs_modifiers (modifiers); |
708 | 3900 bufp->timestamp = event.xkey.time; |
286 | 3901 bufp++; |
3902 count++; | |
3903 numchars--; | |
3904 } | |
3905 else if (numchars > nbytes) | |
3906 { | |
3907 register int i; | |
3908 | |
2064 | 3909 for (i = 0; i < nbytes; i++) |
286 | 3910 { |
2064 | 3911 if (temp_index == sizeof temp_buffer / sizeof (short)) |
3912 temp_index = 0; | |
3913 temp_buffer[temp_index++] = copy_buffer[i]; | |
286 | 3914 bufp->kind = ascii_keystroke; |
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3915 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
|
3916 XSET (bufp->frame_or_window, Lisp_Frame, f); |
2661
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
3917 bufp->modifiers = x_x_to_emacs_modifiers (modifiers); |
708 | 3918 bufp->timestamp = event.xkey.time; |
286 | 3919 bufp++; |
3920 } | |
3921 | |
3922 count += nbytes; | |
3923 numchars -= nbytes; | |
3924 } | |
2064 | 3925 else |
3926 abort (); | |
286 | 3927 } |
2064 | 3928 else |
3929 abort (); | |
286 | 3930 } |
3931 break; | |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3932 #else /* ! defined (HAVE_X11) */ |
286 | 3933 case KeyPressed: |
3934 { | |
3935 register char *where_mapping; | |
3936 | |
771 | 3937 f = x_window_to_frame (event.window); |
286 | 3938 /* Ignore keys typed on icon windows. */ |
771 | 3939 if (f != 0 && event.window == f->display.x->icon_desc) |
286 | 3940 break; |
3941 where_mapping = XLookupMapping (&event, &nbytes); | |
3942 /* Nasty fix for arrow keys */ | |
3943 if (!nbytes && IsCursorKey (event.detail & 0xff)) | |
3944 { | |
3945 switch (event.detail & 0xff) | |
3946 { | |
3947 case KC_CURSOR_LEFT: | |
3948 where_mapping = "\002"; | |
3949 break; | |
3950 case KC_CURSOR_RIGHT: | |
3951 where_mapping = "\006"; | |
3952 break; | |
3953 case KC_CURSOR_UP: | |
3954 where_mapping = "\020"; | |
3955 break; | |
3956 case KC_CURSOR_DOWN: | |
3957 where_mapping = "\016"; | |
3958 break; | |
3959 } | |
3960 nbytes = 1; | |
3961 } | |
3962 if (numchars - nbytes > 0) | |
3963 { | |
3964 register int i; | |
3965 | |
3966 for (i = 0; i < nbytes; i++) | |
3967 { | |
3968 bufp->kind = ascii_keystroke; | |
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
3969 bufp->code = where_mapping[i]; |
429 | 3970 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
|
3971 XSET (bufp->frame_or_window, Lisp_Frame, f); |
286 | 3972 bufp++; |
3973 } | |
3974 count += nbytes; | |
3975 numchars -= nbytes; | |
3976 } | |
3977 } | |
3978 break; | |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3979 #endif /* ! defined (HAVE_X11) */ |
286 | 3980 |
3981 #ifdef HAVE_X11 | |
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 /* 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
|
3984 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
|
3985 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
|
3986 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
|
3987 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
|
3988 |
286 | 3989 case EnterNotify: |
6010
1f9f36411af8
(XTread_socket--cases KeyPress, EnterNotify, LeaveNotify)
Richard M. Stallman <rms@gnu.org>
parents:
5987
diff
changeset
|
3990 f = x_any_window_to_frame (event.xcrossing.window); |
369 | 3991 |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3992 if (event.xcrossing.focus) /* Entered Window */ |
286 | 3993 { |
3994 /* Avoid nasty pop/raise loops. */ | |
771 | 3995 if (f && (!(f->auto_raise) |
3996 || !(f->auto_lower) | |
286 | 3997 || (event.xcrossing.time - enter_timestamp) > 500)) |
3998 { | |
771 | 3999 x_new_focus_frame (f); |
286 | 4000 enter_timestamp = event.xcrossing.time; |
4001 } | |
4002 } | |
771 | 4003 else if (f == x_focus_frame) |
4004 x_new_focus_frame (0); | |
7469
24b292242269
(dumpglyphs): For cursor foreground, try the
Richard M. Stallman <rms@gnu.org>
parents:
7415
diff
changeset
|
4005 /* EnterNotify counts as mouse movement, |
24b292242269
(dumpglyphs): For cursor foreground, try the
Richard M. Stallman <rms@gnu.org>
parents:
7415
diff
changeset
|
4006 so update things that depend on mouse position. */ |
24b292242269
(dumpglyphs): For cursor foreground, try the
Richard M. Stallman <rms@gnu.org>
parents:
7415
diff
changeset
|
4007 if (f) |
24b292242269
(dumpglyphs): For cursor foreground, try the
Richard M. Stallman <rms@gnu.org>
parents:
7415
diff
changeset
|
4008 note_mouse_movement (f, &event.xmotion); |
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
4009 #ifdef USE_X_TOOLKIT |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
4010 goto OTHER; |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
4011 #endif /* USE_X_TOOLKIT */ |
286 | 4012 break; |
4013 | |
4014 case FocusIn: | |
6010
1f9f36411af8
(XTread_socket--cases KeyPress, EnterNotify, LeaveNotify)
Richard M. Stallman <rms@gnu.org>
parents:
5987
diff
changeset
|
4015 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
|
4016 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
|
4017 x_focus_event_frame = f; |
771 | 4018 if (f) |
4019 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
|
4020 #ifdef USE_X_TOOLKIT |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
4021 goto OTHER; |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
4022 #endif /* USE_X_TOOLKIT */ |
286 | 4023 break; |
4024 | |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
4025 |
286 | 4026 case LeaveNotify: |
7169
c21fcad6f1f5
(XTread_socket): Only top window cares about LeaveNotify.
Karl Heuer <kwzh@gnu.org>
parents:
7167
diff
changeset
|
4027 f = x_top_window_to_frame (event.xcrossing.window); |
c21fcad6f1f5
(XTread_socket): Only top window cares about LeaveNotify.
Karl Heuer <kwzh@gnu.org>
parents:
7167
diff
changeset
|
4028 if (f) |
286 | 4029 { |
7169
c21fcad6f1f5
(XTread_socket): Only top window cares about LeaveNotify.
Karl Heuer <kwzh@gnu.org>
parents:
7167
diff
changeset
|
4030 if (f == mouse_face_mouse_frame) |
c21fcad6f1f5
(XTread_socket): Only top window cares about LeaveNotify.
Karl Heuer <kwzh@gnu.org>
parents:
7167
diff
changeset
|
4031 /* If we move outside the frame, |
c21fcad6f1f5
(XTread_socket): Only top window cares about LeaveNotify.
Karl Heuer <kwzh@gnu.org>
parents:
7167
diff
changeset
|
4032 then we're certainly no longer on any text in the frame. */ |
c21fcad6f1f5
(XTread_socket): Only top window cares about LeaveNotify.
Karl Heuer <kwzh@gnu.org>
parents:
7167
diff
changeset
|
4033 clear_mouse_face (); |
c21fcad6f1f5
(XTread_socket): Only top window cares about LeaveNotify.
Karl Heuer <kwzh@gnu.org>
parents:
7167
diff
changeset
|
4034 |
c21fcad6f1f5
(XTread_socket): Only top window cares about LeaveNotify.
Karl Heuer <kwzh@gnu.org>
parents:
7167
diff
changeset
|
4035 if (event.xcrossing.focus) |
c21fcad6f1f5
(XTread_socket): Only top window cares about LeaveNotify.
Karl Heuer <kwzh@gnu.org>
parents:
7167
diff
changeset
|
4036 { |
c21fcad6f1f5
(XTread_socket): Only top window cares about LeaveNotify.
Karl Heuer <kwzh@gnu.org>
parents:
7167
diff
changeset
|
4037 if (! x_focus_event_frame) |
c21fcad6f1f5
(XTread_socket): Only top window cares about LeaveNotify.
Karl Heuer <kwzh@gnu.org>
parents:
7167
diff
changeset
|
4038 x_new_focus_frame (0); |
c21fcad6f1f5
(XTread_socket): Only top window cares about LeaveNotify.
Karl Heuer <kwzh@gnu.org>
parents:
7167
diff
changeset
|
4039 else |
c21fcad6f1f5
(XTread_socket): Only top window cares about LeaveNotify.
Karl Heuer <kwzh@gnu.org>
parents:
7167
diff
changeset
|
4040 x_new_focus_frame (f); |
c21fcad6f1f5
(XTread_socket): Only top window cares about LeaveNotify.
Karl Heuer <kwzh@gnu.org>
parents:
7167
diff
changeset
|
4041 } |
c21fcad6f1f5
(XTread_socket): Only top window cares about LeaveNotify.
Karl Heuer <kwzh@gnu.org>
parents:
7167
diff
changeset
|
4042 else |
c21fcad6f1f5
(XTread_socket): Only top window cares about LeaveNotify.
Karl Heuer <kwzh@gnu.org>
parents:
7167
diff
changeset
|
4043 { |
c21fcad6f1f5
(XTread_socket): Only top window cares about LeaveNotify.
Karl Heuer <kwzh@gnu.org>
parents:
7167
diff
changeset
|
4044 if (f == x_focus_event_frame) |
c21fcad6f1f5
(XTread_socket): Only top window cares about LeaveNotify.
Karl Heuer <kwzh@gnu.org>
parents:
7167
diff
changeset
|
4045 x_focus_event_frame = 0; |
c21fcad6f1f5
(XTread_socket): Only top window cares about LeaveNotify.
Karl Heuer <kwzh@gnu.org>
parents:
7167
diff
changeset
|
4046 if (f == x_focus_frame) |
c21fcad6f1f5
(XTread_socket): Only top window cares about LeaveNotify.
Karl Heuer <kwzh@gnu.org>
parents:
7167
diff
changeset
|
4047 x_new_focus_frame (0); |
c21fcad6f1f5
(XTread_socket): Only top window cares about LeaveNotify.
Karl Heuer <kwzh@gnu.org>
parents:
7167
diff
changeset
|
4048 } |
286 | 4049 } |
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
4050 #ifdef USE_X_TOOLKIT |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
4051 goto OTHER; |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
4052 #endif /* USE_X_TOOLKIT */ |
286 | 4053 break; |
4054 | |
4055 case FocusOut: | |
6010
1f9f36411af8
(XTread_socket--cases KeyPress, EnterNotify, LeaveNotify)
Richard M. Stallman <rms@gnu.org>
parents:
5987
diff
changeset
|
4056 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
|
4057 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
|
4058 && 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
|
4059 x_focus_event_frame = 0; |
771 | 4060 if (f && f == x_focus_frame) |
4061 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
|
4062 #ifdef USE_X_TOOLKIT |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
4063 goto OTHER; |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
4064 #endif /* USE_X_TOOLKIT */ |
286 | 4065 break; |
4066 | |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4067 #else /* ! defined (HAVE_X11) */ |
286 | 4068 |
4069 case EnterWindow: | |
4070 if ((event.detail & 0xFF) == 1) | |
4071 break; /* Coming from our own subwindow */ | |
4072 if (event.subwindow != 0) | |
4073 break; /* Entering our own subwindow. */ | |
4074 | |
4075 { | |
771 | 4076 f = x_window_to_frame (event.window); |
4077 x_mouse_frame = f; | |
4078 | |
4079 x_new_focus_frame (f); | |
286 | 4080 } |
4081 break; | |
4082 | |
4083 case LeaveWindow: | |
4084 if ((event.detail & 0xFF) == 1) | |
4085 break; /* Entering our own subwindow */ | |
4086 if (event.subwindow != 0) | |
4087 break; /* Leaving our own subwindow. */ | |
4088 | |
771 | 4089 x_mouse_frame = 0; |
4090 if (x_focus_frame == 0 | |
4091 && x_input_frame != 0 | |
4092 && 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
|
4093 && event.window == FRAME_X_WINDOW (x_input_frame)) |
286 | 4094 { |
771 | 4095 f = x_input_frame; |
4096 x_input_frame = 0; | |
4097 if (f) | |
4098 frame_unhighlight (f); | |
286 | 4099 } |
4100 break; | |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4101 #endif /* ! defined (HAVE_X11) */ |
286 | 4102 |
4103 #ifdef HAVE_X11 | |
4104 case MotionNotify: | |
4105 { | |
8430
356e5509efda
(construct_mouse_click, construct_menu_click):
Richard M. Stallman <rms@gnu.org>
parents:
8353
diff
changeset
|
4106 if (x_mouse_grabbed && last_mouse_frame |
356e5509efda
(construct_mouse_click, construct_menu_click):
Richard M. Stallman <rms@gnu.org>
parents:
8353
diff
changeset
|
4107 && FRAME_LIVE_P (last_mouse_frame)) |
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
4108 f = last_mouse_frame; |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
4109 else |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
4110 f = x_window_to_frame (event.xmotion.window); |
771 | 4111 if (f) |
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
4112 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
|
4113 else |
286 | 4114 { |
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
4115 struct scroll_bar *bar |
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
4116 = 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
|
4117 |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
4118 if (bar) |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
4119 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
|
4120 |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
4121 /* 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
|
4122 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
|
4123 clear_mouse_face (); |
286 | 4124 } |
4125 } | |
7128
6c6a776a64e1
(XTread_socket, case ClientMessage): Don't call
Richard M. Stallman <rms@gnu.org>
parents:
7123
diff
changeset
|
4126 #if 0 /* This should be unnecessary, since the toolkit has no use |
6c6a776a64e1
(XTread_socket, case ClientMessage): Don't call
Richard M. Stallman <rms@gnu.org>
parents:
7123
diff
changeset
|
4127 for motion events that happen outside of the menu event loop, |
6c6a776a64e1
(XTread_socket, case ClientMessage): Don't call
Richard M. Stallman <rms@gnu.org>
parents:
7123
diff
changeset
|
4128 and it seems to cause the bug that mouse events stop coming |
6c6a776a64e1
(XTread_socket, case ClientMessage): Don't call
Richard M. Stallman <rms@gnu.org>
parents:
7123
diff
changeset
|
4129 after a while. */ |
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
4130 #ifdef USE_X_TOOLKIT |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
4131 goto OTHER; |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
4132 #endif /* USE_X_TOOLKIT */ |
7128
6c6a776a64e1
(XTread_socket, case ClientMessage): Don't call
Richard M. Stallman <rms@gnu.org>
parents:
7123
diff
changeset
|
4133 #endif |
286 | 4134 break; |
4135 | |
4136 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
|
4137 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
|
4138 #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
|
4139 if (f |
7409
fe56a02838ba
(x_set_offset): Set gravity and size hint
Richard M. Stallman <rms@gnu.org>
parents:
7346
diff
changeset
|
4140 #if 0 |
6088
8e38fcb2df96
(XTread_socket): For case ConfigureNotify, call x_any_window_to_frame.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6055
diff
changeset
|
4141 && ! event.xconfigure.send_event |
7409
fe56a02838ba
(x_set_offset): Set gravity and size hint
Richard M. Stallman <rms@gnu.org>
parents:
7346
diff
changeset
|
4142 #endif |
6088
8e38fcb2df96
(XTread_socket): For case ConfigureNotify, call x_any_window_to_frame.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6055
diff
changeset
|
4143 && (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
|
4144 { |
8e38fcb2df96
(XTread_socket): For case ConfigureNotify, call x_any_window_to_frame.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6055
diff
changeset
|
4145 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
|
4146 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
|
4147 |
8e38fcb2df96
(XTread_socket): For case ConfigureNotify, call x_any_window_to_frame.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6055
diff
changeset
|
4148 /* 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
|
4149 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
|
4150 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
|
4151 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
|
4152 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
|
4153 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
|
4154 |
8e38fcb2df96
(XTread_socket): For case ConfigureNotify, call x_any_window_to_frame.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6055
diff
changeset
|
4155 /* 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
|
4156 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
|
4157 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
|
4158 |
8e38fcb2df96
(XTread_socket): For case ConfigureNotify, call x_any_window_to_frame.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6055
diff
changeset
|
4159 /* 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
|
4160 -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
|
4161 -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
|
4162 &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
|
4163 |
8e38fcb2df96
(XTread_socket): For case ConfigureNotify, call x_any_window_to_frame.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6055
diff
changeset
|
4164 /* 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
|
4165 &child); |
8e38fcb2df96
(XTread_socket): For case ConfigureNotify, call x_any_window_to_frame.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6055
diff
changeset
|
4166 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
|
4167 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
|
4168 |
8e38fcb2df96
(XTread_socket): For case ConfigureNotify, call x_any_window_to_frame.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6055
diff
changeset
|
4169 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
|
4170 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
|
4171 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
|
4172 f->display.x->top_pos = event.xconfigure.y; |
7409
fe56a02838ba
(x_set_offset): Set gravity and size hint
Richard M. Stallman <rms@gnu.org>
parents:
7346
diff
changeset
|
4173 |
fe56a02838ba
(x_set_offset): Set gravity and size hint
Richard M. Stallman <rms@gnu.org>
parents:
7346
diff
changeset
|
4174 /* What we have now is the position of Emacs's own window. |
fe56a02838ba
(x_set_offset): Set gravity and size hint
Richard M. Stallman <rms@gnu.org>
parents:
7346
diff
changeset
|
4175 Convert that to the position of the window manager window. */ |
fe56a02838ba
(x_set_offset): Set gravity and size hint
Richard M. Stallman <rms@gnu.org>
parents:
7346
diff
changeset
|
4176 { |
fe56a02838ba
(x_set_offset): Set gravity and size hint
Richard M. Stallman <rms@gnu.org>
parents:
7346
diff
changeset
|
4177 int x, y; |
fe56a02838ba
(x_set_offset): Set gravity and size hint
Richard M. Stallman <rms@gnu.org>
parents:
7346
diff
changeset
|
4178 x_real_positions (f, &x, &y); |
fe56a02838ba
(x_set_offset): Set gravity and size hint
Richard M. Stallman <rms@gnu.org>
parents:
7346
diff
changeset
|
4179 f->display.x->left_pos = x; |
fe56a02838ba
(x_set_offset): Set gravity and size hint
Richard M. Stallman <rms@gnu.org>
parents:
7346
diff
changeset
|
4180 f->display.x->top_pos = y; |
fe56a02838ba
(x_set_offset): Set gravity and size hint
Richard M. Stallman <rms@gnu.org>
parents:
7346
diff
changeset
|
4181 } |
6088
8e38fcb2df96
(XTread_socket): For case ConfigureNotify, call x_any_window_to_frame.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6055
diff
changeset
|
4182 } |
8e38fcb2df96
(XTread_socket): For case ConfigureNotify, call x_any_window_to_frame.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6055
diff
changeset
|
4183 goto OTHER; |
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
4184 #else /* not USE_X_TOOLKIT */ |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4185 if (f) |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4186 { |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4187 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
|
4188 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
|
4189 |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4190 /* 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
|
4191 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
|
4192 to check the pixel dimensions as well. */ |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4193 if (columns != f->width |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4194 || rows != f->height |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4195 || event.xconfigure.width != f->display.x->pixel_width |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4196 || event.xconfigure.height != f->display.x->pixel_height) |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4197 { |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4198 change_frame_size (f, rows, columns, 0, 1); |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4199 SET_FRAME_GARBAGED (f); |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4200 } |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4201 |
3045
0267fb20b0df
(XTread_socket, ConfigureNotify case):
Richard M. Stallman <rms@gnu.org>
parents:
3030
diff
changeset
|
4202 if (! event.xconfigure.send_event) |
3030
2c5ea1c98256
(XTread_socket): For ConfigureNotify event,
Richard M. Stallman <rms@gnu.org>
parents:
3016
diff
changeset
|
4203 { |
2c5ea1c98256
(XTread_socket): For ConfigureNotify event,
Richard M. Stallman <rms@gnu.org>
parents:
3016
diff
changeset
|
4204 Window win, child; |
2c5ea1c98256
(XTread_socket): For ConfigureNotify event,
Richard M. Stallman <rms@gnu.org>
parents:
3016
diff
changeset
|
4205 int win_x, win_y; |
2c5ea1c98256
(XTread_socket): For ConfigureNotify event,
Richard M. Stallman <rms@gnu.org>
parents:
3016
diff
changeset
|
4206 |
3951
9da0fb7d815e
* xterm.c (XTread_socket): When handing non-synthetic
Jim Blandy <jimb@redhat.com>
parents:
3943
diff
changeset
|
4207 /* 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
|
4208 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
|
4209 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
|
4210 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
|
4211 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
|
4212 XTranslateCoordinates (x_current_display, |
2c5ea1c98256
(XTread_socket): For ConfigureNotify event,
Richard M. Stallman <rms@gnu.org>
parents:
3016
diff
changeset
|
4213 |
2c5ea1c98256
(XTread_socket): For ConfigureNotify event,
Richard M. Stallman <rms@gnu.org>
parents:
3016
diff
changeset
|
4214 /* From-window, to-window. */ |
3951
9da0fb7d815e
* xterm.c (XTread_socket): When handing non-synthetic
Jim Blandy <jimb@redhat.com>
parents:
3943
diff
changeset
|
4215 f->display.x->window_desc, |
3045
0267fb20b0df
(XTread_socket, ConfigureNotify case):
Richard M. Stallman <rms@gnu.org>
parents:
3030
diff
changeset
|
4216 ROOT_WINDOW, |
3030
2c5ea1c98256
(XTread_socket): For ConfigureNotify event,
Richard M. Stallman <rms@gnu.org>
parents:
3016
diff
changeset
|
4217 |
2c5ea1c98256
(XTread_socket): For ConfigureNotify event,
Richard M. Stallman <rms@gnu.org>
parents:
3016
diff
changeset
|
4218 /* From-position, to-position. */ |
3951
9da0fb7d815e
* xterm.c (XTread_socket): When handing non-synthetic
Jim Blandy <jimb@redhat.com>
parents:
3943
diff
changeset
|
4219 -event.xconfigure.border_width, |
9da0fb7d815e
* xterm.c (XTread_socket): When handing non-synthetic
Jim Blandy <jimb@redhat.com>
parents:
3943
diff
changeset
|
4220 -event.xconfigure.border_width, |
3030
2c5ea1c98256
(XTread_socket): For ConfigureNotify event,
Richard M. Stallman <rms@gnu.org>
parents:
3016
diff
changeset
|
4221 &win_x, &win_y, |
2c5ea1c98256
(XTread_socket): For ConfigureNotify event,
Richard M. Stallman <rms@gnu.org>
parents:
3016
diff
changeset
|
4222 |
2c5ea1c98256
(XTread_socket): For ConfigureNotify event,
Richard M. Stallman <rms@gnu.org>
parents:
3016
diff
changeset
|
4223 /* Child of win. */ |
2c5ea1c98256
(XTread_socket): For ConfigureNotify event,
Richard M. Stallman <rms@gnu.org>
parents:
3016
diff
changeset
|
4224 &child); |
2c5ea1c98256
(XTread_socket): For ConfigureNotify event,
Richard M. Stallman <rms@gnu.org>
parents:
3016
diff
changeset
|
4225 event.xconfigure.x = win_x; |
2c5ea1c98256
(XTread_socket): For ConfigureNotify event,
Richard M. Stallman <rms@gnu.org>
parents:
3016
diff
changeset
|
4226 event.xconfigure.y = win_y; |
2c5ea1c98256
(XTread_socket): For ConfigureNotify event,
Richard M. Stallman <rms@gnu.org>
parents:
3016
diff
changeset
|
4227 } |
2c5ea1c98256
(XTread_socket): For ConfigureNotify event,
Richard M. Stallman <rms@gnu.org>
parents:
3016
diff
changeset
|
4228 |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4229 f->display.x->pixel_width = event.xconfigure.width; |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4230 f->display.x->pixel_height = event.xconfigure.height; |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4231 f->display.x->left_pos = event.xconfigure.x; |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4232 f->display.x->top_pos = event.xconfigure.y; |
7409
fe56a02838ba
(x_set_offset): Set gravity and size hint
Richard M. Stallman <rms@gnu.org>
parents:
7346
diff
changeset
|
4233 |
fe56a02838ba
(x_set_offset): Set gravity and size hint
Richard M. Stallman <rms@gnu.org>
parents:
7346
diff
changeset
|
4234 /* What we have now is the position of Emacs's own window. |
fe56a02838ba
(x_set_offset): Set gravity and size hint
Richard M. Stallman <rms@gnu.org>
parents:
7346
diff
changeset
|
4235 Convert that to the position of the window manager window. */ |
fe56a02838ba
(x_set_offset): Set gravity and size hint
Richard M. Stallman <rms@gnu.org>
parents:
7346
diff
changeset
|
4236 { |
fe56a02838ba
(x_set_offset): Set gravity and size hint
Richard M. Stallman <rms@gnu.org>
parents:
7346
diff
changeset
|
4237 int x, y; |
fe56a02838ba
(x_set_offset): Set gravity and size hint
Richard M. Stallman <rms@gnu.org>
parents:
7346
diff
changeset
|
4238 x_real_positions (f, &x, &y); |
fe56a02838ba
(x_set_offset): Set gravity and size hint
Richard M. Stallman <rms@gnu.org>
parents:
7346
diff
changeset
|
4239 f->display.x->left_pos = x; |
fe56a02838ba
(x_set_offset): Set gravity and size hint
Richard M. Stallman <rms@gnu.org>
parents:
7346
diff
changeset
|
4240 f->display.x->top_pos = y; |
7738
a810335742bb
(x_iconify_frame): Call x_set_offset,
Richard M. Stallman <rms@gnu.org>
parents:
7706
diff
changeset
|
4241 if (y != event.xconfigure.y) |
a810335742bb
(x_iconify_frame): Call x_set_offset,
Richard M. Stallman <rms@gnu.org>
parents:
7706
diff
changeset
|
4242 { |
a810335742bb
(x_iconify_frame): Call x_set_offset,
Richard M. Stallman <rms@gnu.org>
parents:
7706
diff
changeset
|
4243 /* Since the WM decorations come below top_pos now, |
a810335742bb
(x_iconify_frame): Call x_set_offset,
Richard M. Stallman <rms@gnu.org>
parents:
7706
diff
changeset
|
4244 we must put them below top_pos in the future. */ |
a810335742bb
(x_iconify_frame): Call x_set_offset,
Richard M. Stallman <rms@gnu.org>
parents:
7706
diff
changeset
|
4245 f->display.x->win_gravity = NorthWestGravity; |
a810335742bb
(x_iconify_frame): Call x_set_offset,
Richard M. Stallman <rms@gnu.org>
parents:
7706
diff
changeset
|
4246 x_wm_set_size_hint (f, 0, 0); |
a810335742bb
(x_iconify_frame): Call x_set_offset,
Richard M. Stallman <rms@gnu.org>
parents:
7706
diff
changeset
|
4247 } |
7409
fe56a02838ba
(x_set_offset): Set gravity and size hint
Richard M. Stallman <rms@gnu.org>
parents:
7346
diff
changeset
|
4248 } |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4249 } |
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
4250 #endif /* not USE_X_TOOLKIT */ |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4251 break; |
286 | 4252 |
4253 case ButtonPress: | |
4254 case ButtonRelease: | |
4255 { | |
4256 /* If we decide we want to generate an event to be seen | |
4257 by the rest of Emacs, we put it here. */ | |
4258 struct input_event emacs_event; | |
4259 emacs_event.kind = no_event; | |
4260 | |
7501
7196bd4f57d4
(XTread_socket): For button events, clear compose_status.
Richard M. Stallman <rms@gnu.org>
parents:
7469
diff
changeset
|
4261 bzero (&compose_status, sizeof (compose_status)); |
7196bd4f57d4
(XTread_socket): For button events, clear compose_status.
Richard M. Stallman <rms@gnu.org>
parents:
7469
diff
changeset
|
4262 |
771 | 4263 f = x_window_to_frame (event.xbutton.window); |
4264 if (f) | |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
4265 { |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
4266 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
|
4267 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
|
4268 } |
286 | 4269 else |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
4270 { |
8164
3b90e6a741f1
(XTread_socket, construct_menu_click) [USE_X_TOOLKIT]:
Richard M. Stallman <rms@gnu.org>
parents:
8098
diff
changeset
|
4271 struct scroll_bar *bar |
3b90e6a741f1
(XTread_socket, construct_menu_click) [USE_X_TOOLKIT]:
Richard M. Stallman <rms@gnu.org>
parents:
8098
diff
changeset
|
4272 = 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
|
4273 |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
4274 if (bar) |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
4275 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
|
4276 #ifdef USE_X_TOOLKIT |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
4277 else |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
4278 { |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
4279 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
|
4280 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
|
4281 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
|
4282 &event, f); |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
4283 } |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
4284 #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
|
4285 } |
286 | 4286 |
8430
356e5509efda
(construct_mouse_click, construct_menu_click):
Richard M. Stallman <rms@gnu.org>
parents:
8353
diff
changeset
|
4287 if (event.type == ButtonPress) |
356e5509efda
(construct_mouse_click, construct_menu_click):
Richard M. Stallman <rms@gnu.org>
parents:
8353
diff
changeset
|
4288 { |
356e5509efda
(construct_mouse_click, construct_menu_click):
Richard M. Stallman <rms@gnu.org>
parents:
8353
diff
changeset
|
4289 x_mouse_grabbed |= (1 << event.xbutton.button); |
356e5509efda
(construct_mouse_click, construct_menu_click):
Richard M. Stallman <rms@gnu.org>
parents:
8353
diff
changeset
|
4290 Vmouse_depressed = Qt; |
356e5509efda
(construct_mouse_click, construct_menu_click):
Richard M. Stallman <rms@gnu.org>
parents:
8353
diff
changeset
|
4291 last_mouse_frame = f; |
356e5509efda
(construct_mouse_click, construct_menu_click):
Richard M. Stallman <rms@gnu.org>
parents:
8353
diff
changeset
|
4292 } |
356e5509efda
(construct_mouse_click, construct_menu_click):
Richard M. Stallman <rms@gnu.org>
parents:
8353
diff
changeset
|
4293 else |
356e5509efda
(construct_mouse_click, construct_menu_click):
Richard M. Stallman <rms@gnu.org>
parents:
8353
diff
changeset
|
4294 { |
356e5509efda
(construct_mouse_click, construct_menu_click):
Richard M. Stallman <rms@gnu.org>
parents:
8353
diff
changeset
|
4295 x_mouse_grabbed &= ~(1 << event.xbutton.button); |
356e5509efda
(construct_mouse_click, construct_menu_click):
Richard M. Stallman <rms@gnu.org>
parents:
8353
diff
changeset
|
4296 if (!x_mouse_grabbed) |
356e5509efda
(construct_mouse_click, construct_menu_click):
Richard M. Stallman <rms@gnu.org>
parents:
8353
diff
changeset
|
4297 Vmouse_depressed = Qnil; |
356e5509efda
(construct_mouse_click, construct_menu_click):
Richard M. Stallman <rms@gnu.org>
parents:
8353
diff
changeset
|
4298 } |
356e5509efda
(construct_mouse_click, construct_menu_click):
Richard M. Stallman <rms@gnu.org>
parents:
8353
diff
changeset
|
4299 |
286 | 4300 if (numchars >= 1 && emacs_event.kind != no_event) |
4301 { | |
4302 bcopy (&emacs_event, bufp, sizeof (struct input_event)); | |
4303 bufp++; | |
4304 count++; | |
4305 numchars--; | |
4306 } | |
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
4307 |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
4308 #ifdef USE_X_TOOLKIT |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
4309 goto OTHER; |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
4310 #endif /* USE_X_TOOLKIT */ |
286 | 4311 } |
4312 break; | |
4313 | |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4314 #else /* ! defined (HAVE_X11) */ |
286 | 4315 case ButtonPressed: |
4316 case ButtonReleased: | |
771 | 4317 f = x_window_to_frame (event.window); |
4318 if (f) | |
286 | 4319 { |
771 | 4320 if (event.window == f->display.x->icon_desc) |
286 | 4321 { |
771 | 4322 x_make_frame_visible (f); |
286 | 4323 |
4324 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
|
4325 XWarpMouse (FRAME_X_WINDOW (f), 10, 10); |
286 | 4326 break; |
4327 } | |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4328 if (event.window == FRAME_X_WINDOW (f)) |
286 | 4329 { |
771 | 4330 if (f->auto_raise) |
4331 x_raise_frame (f); | |
286 | 4332 } |
4333 } | |
4334 enqueue_event (&event, &x_mouse_queue); | |
4335 if (numchars >= 2) | |
4336 { | |
4337 bufp->kind = ascii_keystroke; | |
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
4338 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
|
4339 XSET (bufp->frame_or_window, Lisp_Frame, f); |
429 | 4340 XSET (bufp->time, Lisp_Int, event.xkey.time); |
286 | 4341 bufp++; |
4342 | |
4343 bufp->kind = ascii_keystroke; | |
5228
c094c1df2e87
(XTread_socket): Don't offset keysym here.
Richard M. Stallman <rms@gnu.org>
parents:
5156
diff
changeset
|
4344 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
|
4345 XSET (bufp->frame_or_window, Lisp_Frame, f); |
429 | 4346 XSET (bufp->time, Lisp_Int, event.xkey.time); |
286 | 4347 bufp++; |
4348 | |
4349 count += 2; | |
4350 numchars -= 2; | |
4351 } | |
4352 break; | |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4353 #endif /* ! defined (HAVE_X11) */ |
286 | 4354 |
4355 #ifdef HAVE_X11 | |
4356 | |
4357 case CirculateNotify: | |
4358 break; | |
4359 case CirculateRequest: | |
4360 break; | |
4361 | |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4362 #endif /* ! defined (HAVE_X11) */ |
286 | 4363 |
4364 case MappingNotify: | |
1436
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
4365 /* Someone has changed the keyboard mapping - update the |
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
4366 local cache. */ |
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
4367 switch (event.xmapping.request) |
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
4368 { |
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
4369 case MappingModifier: |
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
4370 x_find_modifier_meanings (); |
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
4371 /* This is meant to fall through. */ |
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
4372 case MappingKeyboard: |
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
4373 XRefreshKeyboardMapping (&event.xmapping); |
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
4374 } |
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
4375 #ifdef USE_X_TOOLKIT |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
4376 goto OTHER; |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
4377 #endif /* USE_X_TOOLKIT */ |
286 | 4378 break; |
4379 | |
4380 default: | |
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
4381 #ifdef USE_X_TOOLKIT |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
4382 OTHER: |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
4383 BLOCK_INPUT; |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
4384 XtDispatchEvent (&event); |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
4385 UNBLOCK_INPUT; |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
4386 #endif /* USE_X_TOOLKIT */ |
286 | 4387 break; |
4388 } | |
4389 } | |
4390 | |
8485
6e4b40c80021
(XTread_socket): Don't test X_IO_BUG; make that code unconditional.
Richard M. Stallman <rms@gnu.org>
parents:
8437
diff
changeset
|
4391 /* On some systems, an X bug causes Emacs to get no more events |
6e4b40c80021
(XTread_socket): Don't test X_IO_BUG; make that code unconditional.
Richard M. Stallman <rms@gnu.org>
parents:
8437
diff
changeset
|
4392 when the window is destroyed. Detect that. (1994.) */ |
7916
50e9e0c8806a
(x_noop_count): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7905
diff
changeset
|
4393 if (! event_found) |
50e9e0c8806a
(x_noop_count): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7905
diff
changeset
|
4394 { |
50e9e0c8806a
(x_noop_count): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7905
diff
changeset
|
4395 /* Emacs and the X Server eats up CPU time if XNoOp is done every time. |
50e9e0c8806a
(x_noop_count): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7905
diff
changeset
|
4396 One XNOOP in 100 loops will make Emacs terminate. |
50e9e0c8806a
(x_noop_count): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7905
diff
changeset
|
4397 B. Bretthauer, 1994 */ |
50e9e0c8806a
(x_noop_count): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7905
diff
changeset
|
4398 x_noop_count++; |
50e9e0c8806a
(x_noop_count): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7905
diff
changeset
|
4399 if (x_noop_count >= 100) |
50e9e0c8806a
(x_noop_count): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7905
diff
changeset
|
4400 { |
50e9e0c8806a
(x_noop_count): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7905
diff
changeset
|
4401 x_noop_count=0; |
50e9e0c8806a
(x_noop_count): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7905
diff
changeset
|
4402 XNoOp (x_current_display); |
50e9e0c8806a
(x_noop_count): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7905
diff
changeset
|
4403 } |
50e9e0c8806a
(x_noop_count): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7905
diff
changeset
|
4404 } |
5753
eb44ecad5557
(XTread_socket): Add X_IO_BUG conditional.
Richard M. Stallman <rms@gnu.org>
parents:
5740
diff
changeset
|
4405 |
5953
60f711724bc9
(XTread_socket): Do not assume that select returning
Richard M. Stallman <rms@gnu.org>
parents:
5916
diff
changeset
|
4406 #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
|
4407 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
|
4408 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
|
4409 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
|
4410 in 1988 has been fixed in Xlib or the X server. */ |
286 | 4411 #ifdef HAVE_SELECT |
4412 if (expected && ! event_found) | |
4413 { | |
4414 /* AOJ 880406: if select returns true but XPending doesn't, it means that | |
4415 there is an EOF condition; in other words, that X has died. | |
4416 Act as if there had been a hangup. */ | |
4417 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
|
4418 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
|
4419 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
|
4420 |
4683
6a5197116086
(x_term_init): Call change_keyboard_wait_descriptor,
Richard M. Stallman <rms@gnu.org>
parents:
4630
diff
changeset
|
4421 FD_ZERO (&mask); |
6a5197116086
(x_term_init): Call change_keyboard_wait_descriptor,
Richard M. Stallman <rms@gnu.org>
parents:
4630
diff
changeset
|
4422 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
|
4423 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
|
4424 FD_ZERO (&junk1); |
b36dfc938ba4
(XTread_socket): Make proper junk values to pass to select.
Richard M. Stallman <rms@gnu.org>
parents:
5354
diff
changeset
|
4425 FD_ZERO (&junk2); |
b36dfc938ba4
(XTread_socket): Make proper junk values to pass to select.
Richard M. Stallman <rms@gnu.org>
parents:
5354
diff
changeset
|
4426 if (0 != select (fd + 1, &mask, &junk1, &junk2, &timeout) |
286 | 4427 && !XStuffPending ()) |
4428 kill (getpid (), SIGHUP); | |
4429 } | |
4683
6a5197116086
(x_term_init): Call change_keyboard_wait_descriptor,
Richard M. Stallman <rms@gnu.org>
parents:
4630
diff
changeset
|
4430 #endif /* HAVE_SELECT */ |
5953
60f711724bc9
(XTread_socket): Do not assume that select returning
Richard M. Stallman <rms@gnu.org>
parents:
5916
diff
changeset
|
4431 #endif /* 0 */ |
286 | 4432 |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
4433 #ifndef HAVE_X11 |
771 | 4434 if (updating_frame == 0) |
286 | 4435 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
|
4436 #endif |
286 | 4437 |
6883
77ceede38423
(x_make_frame_visible): Don't call XMapSubwindows.
Richard M. Stallman <rms@gnu.org>
parents:
6791
diff
changeset
|
4438 /* If the focus was just given to an autoraising frame, |
77ceede38423
(x_make_frame_visible): Don't call XMapSubwindows.
Richard M. Stallman <rms@gnu.org>
parents:
6791
diff
changeset
|
4439 raise it now. */ |
77ceede38423
(x_make_frame_visible): Don't call XMapSubwindows.
Richard M. Stallman <rms@gnu.org>
parents:
6791
diff
changeset
|
4440 #ifdef HAVE_X11 |
77ceede38423
(x_make_frame_visible): Don't call XMapSubwindows.
Richard M. Stallman <rms@gnu.org>
parents:
6791
diff
changeset
|
4441 if (pending_autoraise_frame) |
77ceede38423
(x_make_frame_visible): Don't call XMapSubwindows.
Richard M. Stallman <rms@gnu.org>
parents:
6791
diff
changeset
|
4442 { |
77ceede38423
(x_make_frame_visible): Don't call XMapSubwindows.
Richard M. Stallman <rms@gnu.org>
parents:
6791
diff
changeset
|
4443 x_raise_frame (pending_autoraise_frame); |
77ceede38423
(x_make_frame_visible): Don't call XMapSubwindows.
Richard M. Stallman <rms@gnu.org>
parents:
6791
diff
changeset
|
4444 pending_autoraise_frame = 0; |
77ceede38423
(x_make_frame_visible): Don't call XMapSubwindows.
Richard M. Stallman <rms@gnu.org>
parents:
6791
diff
changeset
|
4445 } |
77ceede38423
(x_make_frame_visible): Don't call XMapSubwindows.
Richard M. Stallman <rms@gnu.org>
parents:
6791
diff
changeset
|
4446 #endif |
77ceede38423
(x_make_frame_visible): Don't call XMapSubwindows.
Richard M. Stallman <rms@gnu.org>
parents:
6791
diff
changeset
|
4447 |
286 | 4448 UNBLOCK_INPUT; |
4449 return count; | |
4450 } | |
4451 | |
4452 #ifndef HAVE_X11 | |
4453 /* Read and process only Expose events | |
4454 until we get an ExposeCopy event; then return. | |
4455 This is used in insert/delete line. | |
4456 We assume input is already blocked. */ | |
4457 | |
4458 static void | |
4459 x_read_exposes () | |
4460 { | |
771 | 4461 struct frame *f; |
286 | 4462 XKeyPressedEvent event; |
4463 | |
4464 while (1) | |
4465 { | |
4466 /* while there are more events*/ | |
4467 XMaskEvent (ExposeWindow | ExposeRegion | ExposeCopy, &event); | |
4468 switch (event.type) | |
4469 { | |
4470 case ExposeWindow: | |
4471 if (event.subwindow != 0) | |
4472 break; /* duplicate event */ | |
771 | 4473 f = x_window_to_frame (event.window); |
4474 if (event.window == f->display.x->icon_desc) | |
286 | 4475 { |
771 | 4476 refreshicon (f); |
286 | 4477 break; |
4478 } | |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4479 if (event.window == FRAME_X_WINDOW (f)) |
286 | 4480 { |
4481 expose_all_windows = 1; | |
771 | 4482 f->display.x->needs_exposure = 1; |
286 | 4483 break; |
4484 } | |
4485 break; | |
4486 | |
4487 case ExposeRegion: | |
4488 if (event.subwindow != 0) | |
4489 break; /* duplicate event */ | |
771 | 4490 f = x_window_to_frame (event.window); |
4491 if (event.window == f->display.x->icon_desc) | |
286 | 4492 { |
771 | 4493 refreshicon (f); |
286 | 4494 break; |
4495 } | |
4496 /* If window already needs full redraw, ignore this rectangle. */ | |
771 | 4497 if (expose_all_windows && f->display.x->needs_exposure) |
286 | 4498 break; |
4499 /* Put the event on the queue of rectangles to redraw. */ | |
4500 if (enqueue_event (&event, &x_expose_queue)) | |
4501 /* If it is full, we can't record the rectangle, | |
4502 so redraw this entire window. */ | |
4503 { | |
4504 /* Say must check all windows' needs_exposure flags. */ | |
4505 expose_all_windows = 1; | |
771 | 4506 f->display.x->needs_exposure = 1; |
286 | 4507 } |
4508 break; | |
4509 | |
4510 case ExposeCopy: | |
4511 return; | |
4512 } | |
4513 } | |
4514 } | |
4515 #endif /* HAVE_X11 */ | |
4516 | |
4517 | |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
4518 /* Drawing the cursor. */ |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
4519 |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
4520 |
286 | 4521 /* Draw a hollow box cursor. Don't change the inside of the box. */ |
4522 | |
4523 static void | |
771 | 4524 x_draw_box (f) |
4525 struct frame *f; | |
286 | 4526 { |
8098
e44c31d682b1
(x_draw_box): Use curs_x and curs_y, not f->cursor_[xy].
Richard M. Stallman <rms@gnu.org>
parents:
8036
diff
changeset
|
4527 int left = CHAR_TO_PIXEL_COL (f, curs_x); |
e44c31d682b1
(x_draw_box): Use curs_x and curs_y, not f->cursor_[xy].
Richard M. Stallman <rms@gnu.org>
parents:
8036
diff
changeset
|
4528 int top = CHAR_TO_PIXEL_ROW (f, curs_y); |
771 | 4529 int width = FONT_WIDTH (f->display.x->font); |
6767
8fbcee1c2059
(stufflines, scraplines, dumprectangle, x_do_pending_expose)
Richard M. Stallman <rms@gnu.org>
parents:
6757
diff
changeset
|
4530 int height = f->display.x->line_height; |
286 | 4531 |
4532 #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
|
4533 XDrawRectangle (x_current_display, FRAME_X_WINDOW (f), |
771 | 4534 f->display.x->cursor_gc, |
286 | 4535 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
|
4536 #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
|
4537 XPixSet (FRAME_X_WINDOW (f), |
286 | 4538 left, top, width, 1, |
771 | 4539 f->display.x->cursor_pixel); |
4540 | |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4541 XPixSet (FRAME_X_WINDOW (f), |
286 | 4542 left, top, 1, height, |
771 | 4543 f->display.x->cursor_pixel); |
4544 | |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4545 XPixSet (FRAME_X_WINDOW (f), |
286 | 4546 left+width-1, top, 1, height, |
771 | 4547 f->display.x->cursor_pixel); |
4548 | |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4549 XPixSet (FRAME_X_WINDOW (f), |
286 | 4550 left, top+height-1, width, 1, |
771 | 4551 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
|
4552 #endif /* ! defined (HAVE_X11) */ |
286 | 4553 } |
4554 | |
771 | 4555 /* Clear the cursor of frame F to background color, |
286 | 4556 and mark the cursor as not shown. |
4557 This is used when the text where the cursor is | |
4558 is about to be rewritten. */ | |
4559 | |
4560 static void | |
771 | 4561 clear_cursor (f) |
4562 struct frame *f; | |
286 | 4563 { |
4564 int mask; | |
4565 | |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
4566 if (! FRAME_VISIBLE_P (f) |
771 | 4567 || f->phys_cursor_x < 0) |
286 | 4568 return; |
4569 | |
4570 #ifdef HAVE_X11 | |
771 | 4571 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
|
4572 #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
|
4573 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
|
4574 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
|
4575 CHAR_TO_PIXEL_ROW (f, f->phys_cursor_y), |
6767
8fbcee1c2059
(stufflines, scraplines, dumprectangle, x_do_pending_expose)
Richard M. Stallman <rms@gnu.org>
parents:
6757
diff
changeset
|
4576 FONT_WIDTH (f->display.x->font), f->display.x->line_height, |
771 | 4577 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
|
4578 #endif /* ! defined (HAVE_X11) */ |
771 | 4579 f->phys_cursor_x = -1; |
286 | 4580 } |
4581 | |
771 | 4582 /* Redraw the glyph at ROW, COLUMN on frame F, in the style |
429 | 4583 HIGHLIGHT. HIGHLIGHT is as defined for dumpglyphs. Return the |
4584 glyph drawn. */ | |
286 | 4585 |
4586 static void | |
771 | 4587 x_draw_single_glyph (f, row, column, glyph, highlight) |
4588 struct frame *f; | |
286 | 4589 int row, column; |
429 | 4590 GLYPH glyph; |
286 | 4591 int highlight; |
4592 { | |
771 | 4593 dumpglyphs (f, |
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
4594 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
|
4595 CHAR_TO_PIXEL_ROW (f, row), |
6791
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
4596 &glyph, 1, highlight, 0); |
286 | 4597 } |
4598 | |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4599 static void |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4600 x_display_bar_cursor (f, on) |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4601 struct frame *f; |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4602 int on; |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4603 { |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4604 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
|
4605 |
2235
80e0d36bbb77
* xterm.c (x_display_box_cursor, x_display_bar_cursor): Don't
Jim Blandy <jimb@redhat.com>
parents:
2195
diff
changeset
|
4606 /* 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
|
4607 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
|
4608 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
|
4609 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
|
4610 return; |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4611 |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4612 if (! on && f->phys_cursor_x < 0) |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4613 return; |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4614 |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4615 /* 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
|
4616 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
|
4617 if (f != updating_frame) |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4618 { |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4619 curs_x = FRAME_CURSOR_X (f); |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4620 curs_y = FRAME_CURSOR_Y (f); |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4621 } |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4622 |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4623 /* 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
|
4624 if (f->phys_cursor_x >= 0 |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4625 && (!on |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4626 || f->phys_cursor_x != curs_x |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4627 || f->phys_cursor_y != curs_y |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4628 || f->display.x->current_cursor != bar_cursor)) |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4629 { |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4630 /* 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
|
4631 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
|
4632 f->phys_cursor_glyph, |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4633 current_glyphs->highlight[f->phys_cursor_y]); |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4634 f->phys_cursor_x = -1; |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4635 } |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4636 |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4637 /* 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
|
4638 if (on |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4639 && (f->phys_cursor_x < 0 |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4640 || (f->display.x->current_cursor != bar_cursor))) |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4641 { |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4642 f->phys_cursor_glyph |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4643 = ((current_glyphs->enable[curs_y] |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4644 && curs_x < current_glyphs->used[curs_y]) |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4645 ? current_glyphs->glyphs[curs_y][curs_x] |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4646 : SPACEGLYPH); |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4647 XFillRectangle (x_current_display, FRAME_X_WINDOW (f), |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4648 f->display.x->cursor_gc, |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4649 CHAR_TO_PIXEL_COL (f, curs_x), |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4650 CHAR_TO_PIXEL_ROW (f, curs_y), |
6767
8fbcee1c2059
(stufflines, scraplines, dumprectangle, x_do_pending_expose)
Richard M. Stallman <rms@gnu.org>
parents:
6757
diff
changeset
|
4651 1, f->display.x->line_height); |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4652 |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4653 f->phys_cursor_x = curs_x; |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4654 f->phys_cursor_y = curs_y; |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4655 |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4656 f->display.x->current_cursor = bar_cursor; |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4657 } |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4658 |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4659 if (updating_frame != f) |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4660 XFlushQueue (); |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4661 } |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4662 |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4663 |
771 | 4664 /* Turn the displayed cursor of frame F on or off according to ON. |
286 | 4665 If ON is nonzero, where to put the cursor is specified |
771 | 4666 by F->cursor_x and F->cursor_y. */ |
286 | 4667 |
4668 static void | |
771 | 4669 x_display_box_cursor (f, on) |
4670 struct frame *f; | |
286 | 4671 int on; |
4672 { | |
771 | 4673 struct frame_glyphs *current_glyphs = FRAME_CURRENT_GLYPHS (f); |
4674 | |
2235
80e0d36bbb77
* xterm.c (x_display_box_cursor, x_display_bar_cursor): Don't
Jim Blandy <jimb@redhat.com>
parents:
2195
diff
changeset
|
4675 /* 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
|
4676 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
|
4677 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
|
4678 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
|
4679 return; |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4680 |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4681 /* 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
|
4682 if (!on && f->phys_cursor_x < 0) |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4683 return; |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4684 |
771 | 4685 /* If we're not updating, then we want to use the current frame's |
708 | 4686 cursor position, not our local idea of where the cursor ought to be. */ |
771 | 4687 if (f != updating_frame) |
708 | 4688 { |
771 | 4689 curs_x = FRAME_CURSOR_X (f); |
4690 curs_y = FRAME_CURSOR_Y (f); | |
708 | 4691 } |
4692 | |
286 | 4693 /* If cursor is currently being shown and we don't want it to be |
4694 or it is in the wrong place, | |
4695 or we want a hollow box and it's not so, (pout!) | |
4696 erase it. */ | |
771 | 4697 if (f->phys_cursor_x >= 0 |
286 | 4698 && (!on |
771 | 4699 || f->phys_cursor_x != curs_x |
4700 || f->phys_cursor_y != curs_y | |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4701 || (f->display.x->current_cursor != hollow_box_cursor |
771 | 4702 && (f != x_highlight_frame)))) |
286 | 4703 { |
7508
a15923bc982d
(x_display_box_cursor): Preserve mouse highlight if the old cursor was in it.
Richard M. Stallman <rms@gnu.org>
parents:
7501
diff
changeset
|
4704 int mouse_face_here = 0; |
a15923bc982d
(x_display_box_cursor): Preserve mouse highlight if the old cursor was in it.
Richard M. Stallman <rms@gnu.org>
parents:
7501
diff
changeset
|
4705 |
a15923bc982d
(x_display_box_cursor): Preserve mouse highlight if the old cursor was in it.
Richard M. Stallman <rms@gnu.org>
parents:
7501
diff
changeset
|
4706 /* If the cursor is in the mouse face area, redisplay that when |
a15923bc982d
(x_display_box_cursor): Preserve mouse highlight if the old cursor was in it.
Richard M. Stallman <rms@gnu.org>
parents:
7501
diff
changeset
|
4707 we clear the cursor. */ |
a15923bc982d
(x_display_box_cursor): Preserve mouse highlight if the old cursor was in it.
Richard M. Stallman <rms@gnu.org>
parents:
7501
diff
changeset
|
4708 if (f == mouse_face_mouse_frame |
a15923bc982d
(x_display_box_cursor): Preserve mouse highlight if the old cursor was in it.
Richard M. Stallman <rms@gnu.org>
parents:
7501
diff
changeset
|
4709 && |
a15923bc982d
(x_display_box_cursor): Preserve mouse highlight if the old cursor was in it.
Richard M. Stallman <rms@gnu.org>
parents:
7501
diff
changeset
|
4710 (f->phys_cursor_y > mouse_face_beg_row |
a15923bc982d
(x_display_box_cursor): Preserve mouse highlight if the old cursor was in it.
Richard M. Stallman <rms@gnu.org>
parents:
7501
diff
changeset
|
4711 || (f->phys_cursor_y == mouse_face_beg_row |
a15923bc982d
(x_display_box_cursor): Preserve mouse highlight if the old cursor was in it.
Richard M. Stallman <rms@gnu.org>
parents:
7501
diff
changeset
|
4712 && f->phys_cursor_x >= mouse_face_beg_col)) |
a15923bc982d
(x_display_box_cursor): Preserve mouse highlight if the old cursor was in it.
Richard M. Stallman <rms@gnu.org>
parents:
7501
diff
changeset
|
4713 && |
a15923bc982d
(x_display_box_cursor): Preserve mouse highlight if the old cursor was in it.
Richard M. Stallman <rms@gnu.org>
parents:
7501
diff
changeset
|
4714 (f->phys_cursor_y < mouse_face_end_row |
a15923bc982d
(x_display_box_cursor): Preserve mouse highlight if the old cursor was in it.
Richard M. Stallman <rms@gnu.org>
parents:
7501
diff
changeset
|
4715 || (f->phys_cursor_y == mouse_face_end_row |
a15923bc982d
(x_display_box_cursor): Preserve mouse highlight if the old cursor was in it.
Richard M. Stallman <rms@gnu.org>
parents:
7501
diff
changeset
|
4716 && f->phys_cursor_x < mouse_face_end_col))) |
a15923bc982d
(x_display_box_cursor): Preserve mouse highlight if the old cursor was in it.
Richard M. Stallman <rms@gnu.org>
parents:
7501
diff
changeset
|
4717 mouse_face_here = 1; |
a15923bc982d
(x_display_box_cursor): Preserve mouse highlight if the old cursor was in it.
Richard M. Stallman <rms@gnu.org>
parents:
7501
diff
changeset
|
4718 |
6791
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
4719 /* If the font is not as tall as a whole line, |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
4720 we must explicitly clear the line's whole height. */ |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
4721 if (FONT_HEIGHT (f->display.x->font) != f->display.x->line_height) |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
4722 XClearArea (x_current_display, FRAME_X_WINDOW (f), |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
4723 CHAR_TO_PIXEL_COL (f, f->phys_cursor_x), |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
4724 CHAR_TO_PIXEL_ROW (f, f->phys_cursor_y), |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
4725 FONT_WIDTH (f->display.x->font), |
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
4726 f->display.x->line_height, False); |
286 | 4727 /* Erase the cursor by redrawing the character underneath it. */ |
771 | 4728 x_draw_single_glyph (f, f->phys_cursor_y, f->phys_cursor_x, |
4729 f->phys_cursor_glyph, | |
7508
a15923bc982d
(x_display_box_cursor): Preserve mouse highlight if the old cursor was in it.
Richard M. Stallman <rms@gnu.org>
parents:
7501
diff
changeset
|
4730 (mouse_face_here |
a15923bc982d
(x_display_box_cursor): Preserve mouse highlight if the old cursor was in it.
Richard M. Stallman <rms@gnu.org>
parents:
7501
diff
changeset
|
4731 ? 3 |
a15923bc982d
(x_display_box_cursor): Preserve mouse highlight if the old cursor was in it.
Richard M. Stallman <rms@gnu.org>
parents:
7501
diff
changeset
|
4732 : current_glyphs->highlight[f->phys_cursor_y])); |
771 | 4733 f->phys_cursor_x = -1; |
286 | 4734 } |
4735 | |
4736 /* If we want to show a cursor, | |
4737 or we want a box cursor and it's not so, | |
4738 write it in the right place. */ | |
4739 if (on | |
771 | 4740 && (f->phys_cursor_x < 0 |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4741 || (f->display.x->current_cursor != filled_box_cursor |
771 | 4742 && f == x_highlight_frame))) |
286 | 4743 { |
771 | 4744 f->phys_cursor_glyph |
708 | 4745 = ((current_glyphs->enable[curs_y] |
4746 && curs_x < current_glyphs->used[curs_y]) | |
4747 ? current_glyphs->glyphs[curs_y][curs_x] | |
429 | 4748 : SPACEGLYPH); |
771 | 4749 if (f != x_highlight_frame) |
286 | 4750 { |
771 | 4751 x_draw_box (f); |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4752 f->display.x->current_cursor = hollow_box_cursor; |
286 | 4753 } |
4754 else | |
4755 { | |
771 | 4756 x_draw_single_glyph (f, curs_y, curs_x, |
4757 f->phys_cursor_glyph, 2); | |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4758 f->display.x->current_cursor = filled_box_cursor; |
286 | 4759 } |
4760 | |
771 | 4761 f->phys_cursor_x = curs_x; |
4762 f->phys_cursor_y = curs_y; | |
286 | 4763 } |
4764 | |
771 | 4765 if (updating_frame != f) |
286 | 4766 XFlushQueue (); |
4767 } | |
4768 | |
771 | 4769 x_display_cursor (f, on) |
4770 struct frame *f; | |
286 | 4771 int on; |
4772 { | |
5872
6389c826f847
(x_display_cursor, process_expose_from_menu): Block input.
Karl Heuer <kwzh@gnu.org>
parents:
5825
diff
changeset
|
4773 BLOCK_INPUT; |
6389c826f847
(x_display_cursor, process_expose_from_menu): Block input.
Karl Heuer <kwzh@gnu.org>
parents:
5825
diff
changeset
|
4774 |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4775 if (FRAME_DESIRED_CURSOR (f) == filled_box_cursor) |
771 | 4776 x_display_box_cursor (f, on); |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4777 else if (FRAME_DESIRED_CURSOR (f) == bar_cursor) |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4778 x_display_bar_cursor (f, on); |
286 | 4779 else |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4780 /* Those are the only two we have implemented! */ |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4781 abort (); |
5872
6389c826f847
(x_display_cursor, process_expose_from_menu): Block input.
Karl Heuer <kwzh@gnu.org>
parents:
5825
diff
changeset
|
4782 |
6389c826f847
(x_display_cursor, process_expose_from_menu): Block input.
Karl Heuer <kwzh@gnu.org>
parents:
5825
diff
changeset
|
4783 UNBLOCK_INPUT; |
286 | 4784 } |
4785 | |
4786 /* Icons. */ | |
4787 | |
771 | 4788 /* Refresh bitmap kitchen sink icon for frame F |
286 | 4789 when we get an expose event for it. */ |
4790 | |
771 | 4791 refreshicon (f) |
4792 struct frame *f; | |
286 | 4793 { |
4794 #ifdef HAVE_X11 | |
4795 /* 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
|
4796 #else /* ! defined (HAVE_X11) */ |
286 | 4797 int mask; |
4798 | |
771 | 4799 if (f->display.x->icon_bitmap_flag) |
4800 XBitmapBitsPut (f->display.x->icon_desc, 0, 0, sink_width, sink_height, | |
286 | 4801 sink_bits, BlackPixel, WHITE_PIX_DEFAULT, |
4802 icon_bitmap, GXcopy, AllPlanes); | |
4803 else | |
4804 { | |
771 | 4805 extern struct frame *selected_frame; |
286 | 4806 struct Lisp_String *str; |
4807 unsigned char *string; | |
4808 | |
4809 string | |
771 | 4810 = XSTRING (XBUFFER (XWINDOW (f->selected_window)->buffer)->name)->data; |
4811 | |
4812 if (f->display.x->icon_label != string) | |
286 | 4813 { |
771 | 4814 f->display.x->icon_label = string; |
4815 XChangeWindow (f->display.x->icon_desc, | |
286 | 4816 XQueryWidth (string, icon_font_info->id) + 10, |
4817 icon_font_info->height + 10); | |
4818 } | |
4819 | |
771 | 4820 XText (f->display.x->icon_desc, 5, 5, string, |
286 | 4821 str->size, icon_font_info->id, |
4822 BLACK_PIX_DEFAULT, WHITE_PIX_DEFAULT); | |
4823 } | |
4824 XFlushQueue (); | |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4825 #endif /* ! defined (HAVE_X11) */ |
286 | 4826 } |
4827 | |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4828 /* Make the x-window of frame F use the gnu icon bitmap. */ |
286 | 4829 |
4830 int | |
771 | 4831 x_bitmap_icon (f) |
4832 struct frame *f; | |
286 | 4833 { |
4834 int mask; | |
4835 Window icon_window; | |
4836 | |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4837 if (FRAME_X_WINDOW (f) == 0) |
286 | 4838 return 1; |
4839 | |
4840 #ifdef HAVE_X11 | |
3282
a3c8d3866d01
(x_bitmap_icon): Don't free icon_bitmap;
Richard M. Stallman <rms@gnu.org>
parents:
3272
diff
changeset
|
4841 if (! icon_bitmap) |
a3c8d3866d01
(x_bitmap_icon): Don't free icon_bitmap;
Richard M. Stallman <rms@gnu.org>
parents:
3272
diff
changeset
|
4842 icon_bitmap = |
a3c8d3866d01
(x_bitmap_icon): Don't free icon_bitmap;
Richard M. Stallman <rms@gnu.org>
parents:
3272
diff
changeset
|
4843 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
|
4844 gnu_bits, gnu_width, gnu_height); |
771 | 4845 x_wm_set_icon_pixmap (f, icon_bitmap); |
4846 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
|
4847 #else /* ! defined (HAVE_X11) */ |
771 | 4848 if (f->display.x->icon_desc) |
286 | 4849 { |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4850 XClearIconWindow (FRAME_X_WINDOW (f)); |
771 | 4851 XDestroyWindow (f->display.x->icon_desc); |
286 | 4852 } |
4853 | |
771 | 4854 icon_window = XCreateWindow (f->display.x->parent_desc, |
286 | 4855 0, 0, sink_width, sink_height, |
4856 2, WhitePixmap, (Pixmap) NULL); | |
4857 | |
4858 if (icon_window == 0) | |
4859 return 1; | |
4860 | |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4861 XSetIconWindow (FRAME_X_WINDOW (f), icon_window); |
286 | 4862 XSelectInput (icon_window, ExposeWindow | UnmapWindow); |
4863 | |
771 | 4864 f->display.x->icon_desc = icon_window; |
4865 f->display.x->icon_bitmap_flag = 1; | |
286 | 4866 |
4867 if (icon_bitmap == 0) | |
4868 icon_bitmap | |
4869 = 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
|
4870 #endif /* ! defined (HAVE_X11) */ |
286 | 4871 |
4872 return 0; | |
4873 } | |
4874 | |
4875 | |
771 | 4876 /* Make the x-window of frame F use a rectangle with text. */ |
286 | 4877 |
4878 int | |
771 | 4879 x_text_icon (f, icon_name) |
4880 struct frame *f; | |
286 | 4881 char *icon_name; |
4882 { | |
4883 #ifndef HAVE_X11 | |
4884 int mask; | |
4885 int width; | |
4886 Window icon_window; | |
4887 char *X_DefaultValue; | |
4888 Bitmap b1; | |
4889 | |
4890 #ifndef WhitePixel | |
4891 #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
|
4892 #endif /* WhitePixel */ |
286 | 4893 |
4894 #ifndef BlackPixel | |
4895 #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
|
4896 #endif /* BlackPixel */ |
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4897 #endif /* HAVE_X11 */ |
286 | 4898 |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4899 if (FRAME_X_WINDOW (f) == 0) |
286 | 4900 return 1; |
4901 | |
4902 #ifdef HAVE_X11 | |
4903 if (icon_name) | |
771 | 4904 f->display.x->icon_label = icon_name; |
286 | 4905 else |
771 | 4906 if (! f->display.x->icon_label) |
4907 f->display.x->icon_label = " *emacs* "; | |
286 | 4908 |
2661
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
4909 #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
|
4910 XSetIconName (x_current_display, FRAME_X_WINDOW (f), |
771 | 4911 (char *) f->display.x->icon_label); |
2661
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
4912 #endif |
286 | 4913 |
771 | 4914 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
|
4915 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
|
4916 #else /* ! defined (HAVE_X11) */ |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4917 if (icon_font_info == 0) |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4918 icon_font_info |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4919 = XGetFont (XGetDefault (XDISPLAY |
2279
012b04efa234
* emacs.c (Finvocation_name): New function.
Jim Blandy <jimb@redhat.com>
parents:
2235
diff
changeset
|
4920 (char *) XSTRING (Vinvocation_name)->data, |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4921 "BodyFont")); |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4922 |
771 | 4923 if (f->display.x->icon_desc) |
286 | 4924 { |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4925 XClearIconWindow (XDISPLAY FRAME_X_WINDOW (f)); |
771 | 4926 XDestroyWindow (XDISPLAY f->display.x->icon_desc); |
286 | 4927 } |
4928 | |
4929 if (icon_name) | |
771 | 4930 f->display.x->icon_label = (unsigned char *) icon_name; |
286 | 4931 else |
771 | 4932 if (! f->display.x->icon_label) |
4933 f->display.x->icon_label = XSTRING (f->name)->data; | |
4934 | |
4935 width = XStringWidth (f->display.x->icon_label, icon_font_info, 0, 0); | |
4936 icon_window = XCreateWindow (f->display.x->parent_desc, | |
4937 f->display.x->left_pos, | |
4938 f->display.x->top_pos, | |
286 | 4939 width + 10, icon_font_info->height + 10, |
4940 2, BlackPixmap, WhitePixmap); | |
4941 | |
4942 if (icon_window == 0) | |
4943 return 1; | |
4944 | |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4945 XSetIconWindow (FRAME_X_WINDOW (f), icon_window); |
286 | 4946 XSelectInput (icon_window, ExposeWindow | ExposeRegion | UnmapWindow | ButtonPressed); |
4947 | |
771 | 4948 f->display.x->icon_desc = icon_window; |
4949 f->display.x->icon_bitmap_flag = 0; | |
4950 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
|
4951 #endif /* ! defined (HAVE_X11) */ |
286 | 4952 |
4953 return 0; | |
4954 } | |
4955 | |
621 | 4956 /* Handling X errors. */ |
4957 | |
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
4958 /* 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
|
4959 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
|
4960 |
621 | 4961 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
|
4962 x_connection_closed () |
621 | 4963 { |
4964 if (_Xdebug) | |
4965 abort (); | |
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
4966 |
3710
38e8dc7fd1e8
(x_connection_closed): Pass new arg to shut_down_emacs.
Richard M. Stallman <rms@gnu.org>
parents:
3686
diff
changeset
|
4967 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
|
4968 |
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
4969 exit (70); |
621 | 4970 } |
4971 | |
1875
f569bc4e9b8f
* xterm.c (x_set_window_size): Call change_frame_size instead of
Jim Blandy <jimb@redhat.com>
parents:
1841
diff
changeset
|
4972 /* 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
|
4973 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
|
4974 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
|
4975 static int |
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4976 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
|
4977 Display *display; |
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4978 XErrorEvent *error; |
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4979 { |
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4980 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
|
4981 |
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4982 /* 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
|
4983 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
|
4984 |
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4985 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
|
4986 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
|
4987 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
|
4988 |
3683
568c8391744d
* xterm.c (x_error_quitter, x_io_error_quitter): Remove calls to
Jim Blandy <jimb@redhat.com>
parents:
3669
diff
changeset
|
4989 #if 0 |
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
4990 /* 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
|
4991 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
|
4992 abort (); |
3683
568c8391744d
* xterm.c (x_error_quitter, x_io_error_quitter): Remove calls to
Jim Blandy <jimb@redhat.com>
parents:
3669
diff
changeset
|
4993 #endif |
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
4994 |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4995 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
|
4996 } |
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4997 |
1875
f569bc4e9b8f
* xterm.c (x_set_window_size): Call change_frame_size instead of
Jim Blandy <jimb@redhat.com>
parents:
1841
diff
changeset
|
4998 /* 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
|
4999 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
|
5000 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
|
5001 static int |
f569bc4e9b8f
* xterm.c (x_set_window_size): Call change_frame_size instead of
Jim Blandy <jimb@redhat.com>
parents:
1841
diff
changeset
|
5002 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
|
5003 Display *display; |
f569bc4e9b8f
* xterm.c (x_set_window_size): Call change_frame_size instead of
Jim Blandy <jimb@redhat.com>
parents:
1841
diff
changeset
|
5004 { |
f569bc4e9b8f
* xterm.c (x_set_window_size): Call change_frame_size instead of
Jim Blandy <jimb@redhat.com>
parents:
1841
diff
changeset
|
5005 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
|
5006 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
|
5007 |
3683
568c8391744d
* xterm.c (x_error_quitter, x_io_error_quitter): Remove calls to
Jim Blandy <jimb@redhat.com>
parents:
3669
diff
changeset
|
5008 #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
|
5009 /* 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
|
5010 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
|
5011 abort (); |
3683
568c8391744d
* xterm.c (x_error_quitter, x_io_error_quitter): Remove calls to
Jim Blandy <jimb@redhat.com>
parents:
3669
diff
changeset
|
5012 #endif |
1875
f569bc4e9b8f
* xterm.c (x_set_window_size): Call change_frame_size instead of
Jim Blandy <jimb@redhat.com>
parents:
1841
diff
changeset
|
5013 |
f569bc4e9b8f
* xterm.c (x_set_window_size): Call change_frame_size instead of
Jim Blandy <jimb@redhat.com>
parents:
1841
diff
changeset
|
5014 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
|
5015 } |
f569bc4e9b8f
* xterm.c (x_set_window_size): Call change_frame_size instead of
Jim Blandy <jimb@redhat.com>
parents:
1841
diff
changeset
|
5016 |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5017 /* 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
|
5018 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
|
5019 #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
|
5020 |
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5021 /* 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
|
5022 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
|
5023 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
|
5024 static int |
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5025 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
|
5026 Display *display; |
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5027 XErrorEvent *error; |
286 | 5028 { |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5029 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
|
5030 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
|
5031 } |
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5032 |
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5033 |
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5034 /* 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
|
5035 |
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5036 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
|
5037 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
|
5038 |
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5039 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
|
5040 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
|
5041 |
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5042 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
|
5043 |
5825
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5044 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
|
5045 |
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5046 void |
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5047 x_catch_errors () |
286 | 5048 { |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5049 /* 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
|
5050 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
|
5051 |
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5052 /* 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
|
5053 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
|
5054 = (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
|
5055 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
|
5056 |
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5057 /* 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
|
5058 XHandleError (x_error_catcher); |
286 | 5059 } |
5060 | |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5061 /* 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
|
5062 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
|
5063 sprintf (a buffer, FORMAT, the x error message text) as the text. */ |
5986 | 5064 |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5065 void |
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5066 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
|
5067 char *format; |
286 | 5068 { |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5069 /* 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
|
5070 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
|
5071 |
3558
f7f187debe2d
(x_caught_error_message): Change type to char* from char*[].
Richard M. Stallman <rms@gnu.org>
parents:
3511
diff
changeset
|
5072 if (x_caught_error_message[0]) |
286 | 5073 { |
3558
f7f187debe2d
(x_caught_error_message): Change type to char* from char*[].
Richard M. Stallman <rms@gnu.org>
parents:
3511
diff
changeset
|
5074 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
|
5075 |
f7f187debe2d
(x_caught_error_message): Change type to char* from char*[].
Richard M. Stallman <rms@gnu.org>
parents:
3511
diff
changeset
|
5076 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
|
5077 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
|
5078 error (buf); |
286 | 5079 } |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5080 } |
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5081 |
6022
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
5082 /* 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
|
5083 |
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
5084 int |
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
5085 x_had_errors_p () |
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
5086 { |
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
5087 /* 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
|
5088 XSync (x_current_display, False); |
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
5089 |
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
5090 return x_caught_error_message[0] != 0; |
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
5091 } |
713d4d840a11
(x_had_errors_p): New function.
Richard M. Stallman <rms@gnu.org>
parents:
6010
diff
changeset
|
5092 |
5986 | 5093 /* Stop catching X protocol errors and let them make Emacs die. */ |
5094 | |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5095 void |
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5096 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
|
5097 { |
2439
b6c62e4abf59
Put interrupt input blocking in a separate file from xterm.h.
Jim Blandy <jimb@redhat.com>
parents:
2353
diff
changeset
|
5098 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
|
5099 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
|
5100 XHandleError (x_error_quitter); |
286 | 5101 } |
5102 | |
5103 #if 0 | |
5104 static unsigned int x_wire_count; | |
5105 x_trace_wire () | |
5106 { | |
5107 fprintf (stderr, "Lib call: %d\n", ++x_wire_count); | |
5108 } | |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5109 #endif /* ! 0 */ |
286 | 5110 |
5111 | |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
5112 /* 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
|
5113 |
771 | 5114 /* Set the font of the x-window specified by frame F |
286 | 5115 to the font named NEWNAME. This is safe to use |
771 | 5116 even before F has an actual x-window. */ |
286 | 5117 |
5118 #ifdef HAVE_X11 | |
5119 | |
4493
d0143beb12f0
(struct font_info): New structure.
Richard M. Stallman <rms@gnu.org>
parents:
4476
diff
changeset
|
5120 struct font_info |
d0143beb12f0
(struct font_info): New structure.
Richard M. Stallman <rms@gnu.org>
parents:
4476
diff
changeset
|
5121 { |
d0143beb12f0
(struct font_info): New structure.
Richard M. Stallman <rms@gnu.org>
parents:
4476
diff
changeset
|
5122 XFontStruct *font; |
d0143beb12f0
(struct font_info): New structure.
Richard M. Stallman <rms@gnu.org>
parents:
4476
diff
changeset
|
5123 char *name; |
8291
9c6ddd14996b
(struct font_info): New field full_name.
Richard M. Stallman <rms@gnu.org>
parents:
8279
diff
changeset
|
5124 char *full_name; |
4493
d0143beb12f0
(struct font_info): New structure.
Richard M. Stallman <rms@gnu.org>
parents:
4476
diff
changeset
|
5125 }; |
d0143beb12f0
(struct font_info): New structure.
Richard M. Stallman <rms@gnu.org>
parents:
4476
diff
changeset
|
5126 |
286 | 5127 /* 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
|
5128 static struct font_info *x_font_table; |
286 | 5129 |
5130 /* The current capacity of x_font_table. */ | |
5131 static int x_font_table_size; | |
5132 | |
5133 /* The number of fonts actually stored in x_font_table. | |
5134 x_font_table[n] is used and valid iff 0 <= n < n_fonts. | |
5135 0 <= n_fonts <= x_font_table_size. */ | |
5136 static int n_fonts; | |
5137 | |
8291
9c6ddd14996b
(struct font_info): New field full_name.
Richard M. Stallman <rms@gnu.org>
parents:
8279
diff
changeset
|
5138 /* Give frame F the font named FONTNAME as its default font, and |
9c6ddd14996b
(struct font_info): New field full_name.
Richard M. Stallman <rms@gnu.org>
parents:
8279
diff
changeset
|
5139 return the full name of that font. FONTNAME may be a wildcard |
9c6ddd14996b
(struct font_info): New field full_name.
Richard M. Stallman <rms@gnu.org>
parents:
8279
diff
changeset
|
5140 pattern; in that case, we choose some font that fits the pattern. |
9c6ddd14996b
(struct font_info): New field full_name.
Richard M. Stallman <rms@gnu.org>
parents:
8279
diff
changeset
|
5141 The return value shows which font we chose. */ |
9c6ddd14996b
(struct font_info): New field full_name.
Richard M. Stallman <rms@gnu.org>
parents:
8279
diff
changeset
|
5142 |
3076
e3b3c67cf203
Arrange for font names to get fully resolved - no wildcards.
Jim Blandy <jimb@redhat.com>
parents:
3066
diff
changeset
|
5143 Lisp_Object |
771 | 5144 x_new_font (f, fontname) |
5145 struct frame *f; | |
286 | 5146 register char *fontname; |
5147 { | |
5148 int already_loaded; | |
5149 int n_matching_fonts; | |
5150 XFontStruct *font_info; | |
5151 char **font_names; | |
5152 | |
5153 /* Get a list of all the fonts that match this name. Once we | |
5154 have a list of matching fonts, we compare them against the fonts | |
5155 we already have by comparing font ids. */ | |
4493
d0143beb12f0
(struct font_info): New structure.
Richard M. Stallman <rms@gnu.org>
parents:
4476
diff
changeset
|
5156 font_names = (char **) XListFonts (x_current_display, fontname, |
d0143beb12f0
(struct font_info): New structure.
Richard M. Stallman <rms@gnu.org>
parents:
4476
diff
changeset
|
5157 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
|
5158 /* 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
|
5159 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
|
5160 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
|
5161 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
|
5162 |
3511
21fae09a3ad2
(x_new_font): Don't give up right away if XListFontsWithInfo
Richard M. Stallman <rms@gnu.org>
parents:
3465
diff
changeset
|
5163 /* 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
|
5164 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
|
5165 fail to find a font, but XLoadQueryFont may still find it. */ |
286 | 5166 |
429 | 5167 /* 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
|
5168 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
|
5169 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
|
5170 { |
21fae09a3ad2
(x_new_font): Don't give up right away if XListFontsWithInfo
Richard M. Stallman <rms@gnu.org>
parents:
3465
diff
changeset
|
5171 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
|
5172 |
21fae09a3ad2
(x_new_font): Don't give up right away if XListFontsWithInfo
Richard M. Stallman <rms@gnu.org>
parents:
3465
diff
changeset
|
5173 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
|
5174 for (j = 0; j < n_matching_fonts; j++) |
8291
9c6ddd14996b
(struct font_info): New field full_name.
Richard M. Stallman <rms@gnu.org>
parents:
8279
diff
changeset
|
5175 if (!strcmp (x_font_table[i].name, font_names[j]) |
9c6ddd14996b
(struct font_info): New field full_name.
Richard M. Stallman <rms@gnu.org>
parents:
8279
diff
changeset
|
5176 || !strcmp (x_font_table[i].full_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
|
5177 { |
21fae09a3ad2
(x_new_font): Don't give up right away if XListFontsWithInfo
Richard M. Stallman <rms@gnu.org>
parents:
3465
diff
changeset
|
5178 already_loaded = i; |
8291
9c6ddd14996b
(struct font_info): New field full_name.
Richard M. Stallman <rms@gnu.org>
parents:
8279
diff
changeset
|
5179 fontname = x_font_table[i].full_name; |
3511
21fae09a3ad2
(x_new_font): Don't give up right away if XListFontsWithInfo
Richard M. Stallman <rms@gnu.org>
parents:
3465
diff
changeset
|
5180 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
|
5181 } |
21fae09a3ad2
(x_new_font): Don't give up right away if XListFontsWithInfo
Richard M. Stallman <rms@gnu.org>
parents:
3465
diff
changeset
|
5182 } |
286 | 5183 found_font: |
5184 | |
5185 /* 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
|
5186 if (already_loaded >= 0) |
d0143beb12f0
(struct font_info): New structure.
Richard M. Stallman <rms@gnu.org>
parents:
4476
diff
changeset
|
5187 f->display.x->font = x_font_table[already_loaded].font; |
429 | 5188 |
286 | 5189 /* Otherwise, load the font and add it to the table. */ |
5190 else | |
5191 { | |
3016
ce9ea90b5848
* xterm.c (x_new_font): Reject fonts with varying spacing. We
Jim Blandy <jimb@redhat.com>
parents:
2982
diff
changeset
|
5192 int i; |
8291
9c6ddd14996b
(struct font_info): New field full_name.
Richard M. Stallman <rms@gnu.org>
parents:
8279
diff
changeset
|
5193 char *full_name; |
286 | 5194 XFontStruct *font; |
5195 | |
3016
ce9ea90b5848
* xterm.c (x_new_font): Reject fonts with varying spacing. We
Jim Blandy <jimb@redhat.com>
parents:
2982
diff
changeset
|
5196 /* 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
|
5197 #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
|
5198 /* 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
|
5199 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
|
5200 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
|
5201 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
|
5202 #else |
039cbddadc51
* xfaces.c (merge_faces): You can't tell if a font is a
Jim Blandy <jimb@redhat.com>
parents:
3045
diff
changeset
|
5203 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
|
5204 #endif |
3016
ce9ea90b5848
* xterm.c (x_new_font): Reject fonts with varying spacing. We
Jim Blandy <jimb@redhat.com>
parents:
2982
diff
changeset
|
5205 |
3511
21fae09a3ad2
(x_new_font): Don't give up right away if XListFontsWithInfo
Richard M. Stallman <rms@gnu.org>
parents:
3465
diff
changeset
|
5206 /* 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
|
5207 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
|
5208 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
|
5209 |
286 | 5210 font = (XFontStruct *) XLoadQueryFont (x_current_display, fontname); |
5211 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
|
5212 { |
4493
d0143beb12f0
(struct font_info): New structure.
Richard M. Stallman <rms@gnu.org>
parents:
4476
diff
changeset
|
5213 /* 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
|
5214 if (n_matching_fonts) |
4493
d0143beb12f0
(struct font_info): New structure.
Richard M. Stallman <rms@gnu.org>
parents:
4476
diff
changeset
|
5215 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
|
5216 return Qnil; |
21fae09a3ad2
(x_new_font): Don't give up right away if XListFontsWithInfo
Richard M. Stallman <rms@gnu.org>
parents:
3465
diff
changeset
|
5217 } |
286 | 5218 |
5219 /* Do we need to create the table? */ | |
5220 if (x_font_table_size == 0) | |
5221 { | |
5222 x_font_table_size = 16; | |
5223 x_font_table | |
4493
d0143beb12f0
(struct font_info): New structure.
Richard M. Stallman <rms@gnu.org>
parents:
4476
diff
changeset
|
5224 = (struct font_info *) xmalloc (x_font_table_size |
d0143beb12f0
(struct font_info): New structure.
Richard M. Stallman <rms@gnu.org>
parents:
4476
diff
changeset
|
5225 * sizeof (x_font_table[0])); |
286 | 5226 } |
5227 /* Do we need to grow the table? */ | |
5228 else if (n_fonts >= x_font_table_size) | |
5229 { | |
429 | 5230 x_font_table_size *= 2; |
286 | 5231 x_font_table |
4493
d0143beb12f0
(struct font_info): New structure.
Richard M. Stallman <rms@gnu.org>
parents:
4476
diff
changeset
|
5232 = (struct font_info *) xrealloc (x_font_table, |
d0143beb12f0
(struct font_info): New structure.
Richard M. Stallman <rms@gnu.org>
parents:
4476
diff
changeset
|
5233 (x_font_table_size |
d0143beb12f0
(struct font_info): New structure.
Richard M. Stallman <rms@gnu.org>
parents:
4476
diff
changeset
|
5234 * sizeof (x_font_table[0]))); |
286 | 5235 } |
5236 | |
8291
9c6ddd14996b
(struct font_info): New field full_name.
Richard M. Stallman <rms@gnu.org>
parents:
8279
diff
changeset
|
5237 /* Try to get the full name of FONT. Put it in full_name. */ |
9c6ddd14996b
(struct font_info): New field full_name.
Richard M. Stallman <rms@gnu.org>
parents:
8279
diff
changeset
|
5238 full_name = 0; |
9c6ddd14996b
(struct font_info): New field full_name.
Richard M. Stallman <rms@gnu.org>
parents:
8279
diff
changeset
|
5239 for (i = 0; i < font->n_properties; i++) |
9c6ddd14996b
(struct font_info): New field full_name.
Richard M. Stallman <rms@gnu.org>
parents:
8279
diff
changeset
|
5240 { |
9c6ddd14996b
(struct font_info): New field full_name.
Richard M. Stallman <rms@gnu.org>
parents:
8279
diff
changeset
|
5241 char *atom |
9c6ddd14996b
(struct font_info): New field full_name.
Richard M. Stallman <rms@gnu.org>
parents:
8279
diff
changeset
|
5242 = XGetAtomName (x_current_display, font->properties[i].name); |
9c6ddd14996b
(struct font_info): New field full_name.
Richard M. Stallman <rms@gnu.org>
parents:
8279
diff
changeset
|
5243 if (!strcmp (atom, "FONT")) |
9c6ddd14996b
(struct font_info): New field full_name.
Richard M. Stallman <rms@gnu.org>
parents:
8279
diff
changeset
|
5244 full_name = XGetAtomName (x_current_display, |
9c6ddd14996b
(struct font_info): New field full_name.
Richard M. Stallman <rms@gnu.org>
parents:
8279
diff
changeset
|
5245 (Atom) (font->properties[i].card32)); |
9c6ddd14996b
(struct font_info): New field full_name.
Richard M. Stallman <rms@gnu.org>
parents:
8279
diff
changeset
|
5246 XFree (atom); |
9c6ddd14996b
(struct font_info): New field full_name.
Richard M. Stallman <rms@gnu.org>
parents:
8279
diff
changeset
|
5247 } |
9c6ddd14996b
(struct font_info): New field full_name.
Richard M. Stallman <rms@gnu.org>
parents:
8279
diff
changeset
|
5248 |
4909
74ae77c7d742
(x_new_font): xmalloc arg was 1 too small.
Richard M. Stallman <rms@gnu.org>
parents:
4777
diff
changeset
|
5249 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
|
5250 bcopy (fontname, x_font_table[n_fonts].name, strlen (fontname) + 1); |
8291
9c6ddd14996b
(struct font_info): New field full_name.
Richard M. Stallman <rms@gnu.org>
parents:
8279
diff
changeset
|
5251 if (full_name != 0) |
9c6ddd14996b
(struct font_info): New field full_name.
Richard M. Stallman <rms@gnu.org>
parents:
8279
diff
changeset
|
5252 x_font_table[n_fonts].full_name = full_name; |
9c6ddd14996b
(struct font_info): New field full_name.
Richard M. Stallman <rms@gnu.org>
parents:
8279
diff
changeset
|
5253 else |
9c6ddd14996b
(struct font_info): New field full_name.
Richard M. Stallman <rms@gnu.org>
parents:
8279
diff
changeset
|
5254 x_font_table[n_fonts].full_name = x_font_table[n_fonts].name; |
4493
d0143beb12f0
(struct font_info): New structure.
Richard M. Stallman <rms@gnu.org>
parents:
4476
diff
changeset
|
5255 f->display.x->font = x_font_table[n_fonts++].font = font; |
8291
9c6ddd14996b
(struct font_info): New field full_name.
Richard M. Stallman <rms@gnu.org>
parents:
8279
diff
changeset
|
5256 |
8528
e52f4cbff616
(x_new_font): Don't set filename = full_name if that's null.
Richard M. Stallman <rms@gnu.org>
parents:
8485
diff
changeset
|
5257 if (full_name) |
e52f4cbff616
(x_new_font): Don't set filename = full_name if that's null.
Richard M. Stallman <rms@gnu.org>
parents:
8485
diff
changeset
|
5258 fontname = full_name; |
286 | 5259 } |
4493
d0143beb12f0
(struct font_info): New structure.
Richard M. Stallman <rms@gnu.org>
parents:
4476
diff
changeset
|
5260 |
771 | 5261 /* 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
|
5262 if (FRAME_X_WINDOW (f) != 0) |
286 | 5263 { |
771 | 5264 XSetFont (x_current_display, f->display.x->normal_gc, |
5265 f->display.x->font->fid); | |
5266 XSetFont (x_current_display, f->display.x->reverse_gc, | |
5267 f->display.x->font->fid); | |
5268 XSetFont (x_current_display, f->display.x->cursor_gc, | |
5269 f->display.x->font->fid); | |
5270 | |
6767
8fbcee1c2059
(stufflines, scraplines, dumprectangle, x_do_pending_expose)
Richard M. Stallman <rms@gnu.org>
parents:
6757
diff
changeset
|
5271 frame_update_line_height (f); |
6883
77ceede38423
(x_make_frame_visible): Don't call XMapSubwindows.
Richard M. Stallman <rms@gnu.org>
parents:
6791
diff
changeset
|
5272 x_set_window_size (f, 0, f->width, f->height); |
286 | 5273 } |
6767
8fbcee1c2059
(stufflines, scraplines, dumprectangle, x_do_pending_expose)
Richard M. Stallman <rms@gnu.org>
parents:
6757
diff
changeset
|
5274 else |
8fbcee1c2059
(stufflines, scraplines, dumprectangle, x_do_pending_expose)
Richard M. Stallman <rms@gnu.org>
parents:
6757
diff
changeset
|
5275 /* If we are setting a new frame's font for the first time, |
8fbcee1c2059
(stufflines, scraplines, dumprectangle, x_do_pending_expose)
Richard M. Stallman <rms@gnu.org>
parents:
6757
diff
changeset
|
5276 there are no faces yet, so this font's height is the line height. */ |
6791
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
5277 f->display.x->line_height = FONT_HEIGHT (f->display.x->font); |
286 | 5278 |
3076
e3b3c67cf203
Arrange for font names to get fully resolved - no wildcards.
Jim Blandy <jimb@redhat.com>
parents:
3066
diff
changeset
|
5279 { |
6521
a975c5944916
(x_window_to_scroll_bar, x_new_font): Use assignment, not initialization.
Karl Heuer <kwzh@gnu.org>
parents:
6413
diff
changeset
|
5280 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
|
5281 |
a975c5944916
(x_window_to_scroll_bar, x_new_font): Use assignment, not initialization.
Karl Heuer <kwzh@gnu.org>
parents:
6413
diff
changeset
|
5282 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
|
5283 |
4493
d0143beb12f0
(struct font_info): New structure.
Richard M. Stallman <rms@gnu.org>
parents:
4476
diff
changeset
|
5284 /* 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
|
5285 we actually retain comes from XLoadQueryFont. */ |
4493
d0143beb12f0
(struct font_info): New structure.
Richard M. Stallman <rms@gnu.org>
parents:
4476
diff
changeset
|
5286 XFreeFontNames (font_names); |
3076
e3b3c67cf203
Arrange for font names to get fully resolved - no wildcards.
Jim Blandy <jimb@redhat.com>
parents:
3066
diff
changeset
|
5287 |
e3b3c67cf203
Arrange for font names to get fully resolved - no wildcards.
Jim Blandy <jimb@redhat.com>
parents:
3066
diff
changeset
|
5288 return lispy_name; |
e3b3c67cf203
Arrange for font names to get fully resolved - no wildcards.
Jim Blandy <jimb@redhat.com>
parents:
3066
diff
changeset
|
5289 } |
286 | 5290 } |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5291 #else /* ! defined (HAVE_X11) */ |
771 | 5292 x_new_font (f, newname) |
5293 struct frame *f; | |
286 | 5294 register char *newname; |
5295 { | |
5296 FONT_TYPE *temp; | |
5297 int mask; | |
5298 | |
5299 temp = XGetFont (newname); | |
5300 if (temp == (FONT_TYPE *) 0) | |
5301 return 1; | |
5302 | |
771 | 5303 if (f->display.x->font) |
5304 XLoseFont (f->display.x->font); | |
5305 | |
5306 f->display.x->font = temp; | |
5307 | |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5308 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
|
5309 x_set_window_size (f, 0, f->width, f->height); |
286 | 5310 |
5311 return 0; | |
5312 } | |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5313 #endif /* ! defined (HAVE_X11) */ |
286 | 5314 |
7264
a701bffa0f9d
(x_calc_absolute_position): Use size_hint_flags.
Richard M. Stallman <rms@gnu.org>
parents:
7262
diff
changeset
|
5315 x_calc_absolute_position (f) |
771 | 5316 struct frame *f; |
286 | 5317 { |
5318 #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
|
5319 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
|
5320 int win_x = 0, win_y = 0; |
7264
a701bffa0f9d
(x_calc_absolute_position): Use size_hint_flags.
Richard M. Stallman <rms@gnu.org>
parents:
7262
diff
changeset
|
5321 int flags = f->display.x->size_hint_flags; |
4630
70247ce8b381
(x_wm_set_size_hint): New args spec_x and spec_y.
Richard M. Stallman <rms@gnu.org>
parents:
4493
diff
changeset
|
5322 |
70247ce8b381
(x_wm_set_size_hint): New args spec_x and spec_y.
Richard M. Stallman <rms@gnu.org>
parents:
4493
diff
changeset
|
5323 /* 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
|
5324 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
|
5325 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
|
5326 { |
70247ce8b381
(x_wm_set_size_hint): New args spec_x and spec_y.
Richard M. Stallman <rms@gnu.org>
parents:
4493
diff
changeset
|
5327 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
|
5328 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
|
5329 |
70247ce8b381
(x_wm_set_size_hint): New args spec_x and spec_y.
Richard M. Stallman <rms@gnu.org>
parents:
4493
diff
changeset
|
5330 /* 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
|
5331 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
|
5332 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
|
5333 |
70247ce8b381
(x_wm_set_size_hint): New args spec_x and spec_y.
Richard M. Stallman <rms@gnu.org>
parents:
4493
diff
changeset
|
5334 /* 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
|
5335 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
|
5336 |
70247ce8b381
(x_wm_set_size_hint): New args spec_x and spec_y.
Richard M. Stallman <rms@gnu.org>
parents:
4493
diff
changeset
|
5337 /* 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
|
5338 &child); |
70247ce8b381
(x_wm_set_size_hint): New args spec_x and spec_y.
Richard M. Stallman <rms@gnu.org>
parents:
4493
diff
changeset
|
5339 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
|
5340 } |
70247ce8b381
(x_wm_set_size_hint): New args spec_x and spec_y.
Richard M. Stallman <rms@gnu.org>
parents:
4493
diff
changeset
|
5341 |
70247ce8b381
(x_wm_set_size_hint): New args spec_x and spec_y.
Richard M. Stallman <rms@gnu.org>
parents:
4493
diff
changeset
|
5342 /* 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
|
5343 position that fits on the screen. */ |
7262
68fc80bf10df
(x_wm_set_size_hint): Don't try to handle negative positions.
Richard M. Stallman <rms@gnu.org>
parents:
7210
diff
changeset
|
5344 if (flags & XNegative) |
3890
ab295012a818
* xterm.c (XTread_socket): Remove #if 0''s around code which tests
Jim Blandy <jimb@redhat.com>
parents:
3883
diff
changeset
|
5345 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
|
5346 - 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
|
5347 - 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
|
5348 + f->display.x->left_pos); |
771 | 5349 |
7262
68fc80bf10df
(x_wm_set_size_hint): Don't try to handle negative positions.
Richard M. Stallman <rms@gnu.org>
parents:
7210
diff
changeset
|
5350 if (flags & YNegative) |
3890
ab295012a818
* xterm.c (XTread_socket): Remove #if 0''s around code which tests
Jim Blandy <jimb@redhat.com>
parents:
3883
diff
changeset
|
5351 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
|
5352 - 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
|
5353 - 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
|
5354 + f->display.x->top_pos); |
7409
fe56a02838ba
(x_set_offset): Set gravity and size hint
Richard M. Stallman <rms@gnu.org>
parents:
7346
diff
changeset
|
5355 /* The left_pos and top_pos |
fe56a02838ba
(x_set_offset): Set gravity and size hint
Richard M. Stallman <rms@gnu.org>
parents:
7346
diff
changeset
|
5356 are now relative to the top and left screen edges, |
fe56a02838ba
(x_set_offset): Set gravity and size hint
Richard M. Stallman <rms@gnu.org>
parents:
7346
diff
changeset
|
5357 so the flags should correspond. */ |
fe56a02838ba
(x_set_offset): Set gravity and size hint
Richard M. Stallman <rms@gnu.org>
parents:
7346
diff
changeset
|
5358 f->display.x->size_hint_flags &= ~ (XNegative | YNegative); |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5359 #else /* ! defined (HAVE_X11) */ |
286 | 5360 WINDOWINFO_TYPE parentinfo; |
5361 | |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5362 XGetWindowInfo (FRAME_X_WINDOW (f), &parentinfo); |
771 | 5363 |
5364 if (f->display.x->left_pos < 0) | |
5365 f->display.x->left_pos = parentinfo.width + (f->display.x->left_pos + 1) | |
5366 - PIXEL_WIDTH (f) - 2 * f->display.x->internal_border_width; | |
5367 | |
5368 if (f->display.x->top_pos < 0) | |
5369 f->display.x->top_pos = parentinfo.height + (f->display.x->top_pos + 1) | |
5370 - 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
|
5371 #endif /* ! defined (HAVE_X11) */ |
286 | 5372 } |
5373 | |
7409
fe56a02838ba
(x_set_offset): Set gravity and size hint
Richard M. Stallman <rms@gnu.org>
parents:
7346
diff
changeset
|
5374 /* CHANGE_GRAVITY is 1 when calling from Fset_frame_position, |
fe56a02838ba
(x_set_offset): Set gravity and size hint
Richard M. Stallman <rms@gnu.org>
parents:
7346
diff
changeset
|
5375 to really change the position, and 0 when calling from |
fe56a02838ba
(x_set_offset): Set gravity and size hint
Richard M. Stallman <rms@gnu.org>
parents:
7346
diff
changeset
|
5376 x_make_frame_visible (in that case, XOFF and YOFF are the current |
fe56a02838ba
(x_set_offset): Set gravity and size hint
Richard M. Stallman <rms@gnu.org>
parents:
7346
diff
changeset
|
5377 position values). */ |
fe56a02838ba
(x_set_offset): Set gravity and size hint
Richard M. Stallman <rms@gnu.org>
parents:
7346
diff
changeset
|
5378 |
6934
e0ab4f59004e
(dumpglyphs): When HL=2, check explicitly for using
Richard M. Stallman <rms@gnu.org>
parents:
6883
diff
changeset
|
5379 x_set_offset (f, xoff, yoff, change_gravity) |
771 | 5380 struct frame *f; |
286 | 5381 register int xoff, yoff; |
6934
e0ab4f59004e
(dumpglyphs): When HL=2, check explicitly for using
Richard M. Stallman <rms@gnu.org>
parents:
6883
diff
changeset
|
5382 int change_gravity; |
286 | 5383 { |
7409
fe56a02838ba
(x_set_offset): Set gravity and size hint
Richard M. Stallman <rms@gnu.org>
parents:
7346
diff
changeset
|
5384 if (change_gravity) |
fe56a02838ba
(x_set_offset): Set gravity and size hint
Richard M. Stallman <rms@gnu.org>
parents:
7346
diff
changeset
|
5385 { |
fe56a02838ba
(x_set_offset): Set gravity and size hint
Richard M. Stallman <rms@gnu.org>
parents:
7346
diff
changeset
|
5386 f->display.x->top_pos = yoff; |
fe56a02838ba
(x_set_offset): Set gravity and size hint
Richard M. Stallman <rms@gnu.org>
parents:
7346
diff
changeset
|
5387 f->display.x->left_pos = xoff; |
fe56a02838ba
(x_set_offset): Set gravity and size hint
Richard M. Stallman <rms@gnu.org>
parents:
7346
diff
changeset
|
5388 f->display.x->size_hint_flags &= ~ (XNegative | YNegative); |
fe56a02838ba
(x_set_offset): Set gravity and size hint
Richard M. Stallman <rms@gnu.org>
parents:
7346
diff
changeset
|
5389 if (xoff < 0) |
fe56a02838ba
(x_set_offset): Set gravity and size hint
Richard M. Stallman <rms@gnu.org>
parents:
7346
diff
changeset
|
5390 f->display.x->size_hint_flags |= XNegative; |
fe56a02838ba
(x_set_offset): Set gravity and size hint
Richard M. Stallman <rms@gnu.org>
parents:
7346
diff
changeset
|
5391 if (yoff < 0) |
fe56a02838ba
(x_set_offset): Set gravity and size hint
Richard M. Stallman <rms@gnu.org>
parents:
7346
diff
changeset
|
5392 f->display.x->size_hint_flags |= YNegative; |
fe56a02838ba
(x_set_offset): Set gravity and size hint
Richard M. Stallman <rms@gnu.org>
parents:
7346
diff
changeset
|
5393 f->display.x->win_gravity = NorthWestGravity; |
fe56a02838ba
(x_set_offset): Set gravity and size hint
Richard M. Stallman <rms@gnu.org>
parents:
7346
diff
changeset
|
5394 } |
7264
a701bffa0f9d
(x_calc_absolute_position): Use size_hint_flags.
Richard M. Stallman <rms@gnu.org>
parents:
7262
diff
changeset
|
5395 x_calc_absolute_position (f); |
286 | 5396 |
5397 BLOCK_INPUT; | |
7409
fe56a02838ba
(x_set_offset): Set gravity and size hint
Richard M. Stallman <rms@gnu.org>
parents:
7346
diff
changeset
|
5398 x_wm_set_size_hint (f, 0, 0); |
fe56a02838ba
(x_set_offset): Set gravity and size hint
Richard M. Stallman <rms@gnu.org>
parents:
7346
diff
changeset
|
5399 |
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5400 #ifdef USE_X_TOOLKIT |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5401 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
|
5402 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
|
5403 #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
|
5404 XMoveWindow (XDISPLAY FRAME_X_WINDOW (f), |
771 | 5405 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
|
5406 #endif /* not USE_X_TOOLKIT */ |
286 | 5407 UNBLOCK_INPUT; |
5408 } | |
5409 | |
5825
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5410 /* 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
|
5411 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
|
5412 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
|
5413 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
|
5414 |
b1f35db748d8
(x_make_frame_invisible): Add USE_X_TOOLKIT conditional.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5753
diff
changeset
|
5415 x_set_window_size (f, change_gravity, cols, rows) |
771 | 5416 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
|
5417 int change_gravity; |
976
cbdfc337ec8f
* xterm.c (x_wm_hints): New variable.
Jim Blandy <jimb@redhat.com>
parents:
786
diff
changeset
|
5418 int cols, rows; |
286 | 5419 { |
5420 int pixelwidth, pixelheight; | |
5421 int mask; | |
5422 | |
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
|
5423 #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
|
5424 BLOCK_INPUT; |
7415
fbea5637a4b4
(x_set_window_size) [USE_X_TOOLKIT]:
Richard M. Stallman <rms@gnu.org>
parents:
7409
diff
changeset
|
5425 { |
fbea5637a4b4
(x_set_window_size) [USE_X_TOOLKIT]:
Richard M. Stallman <rms@gnu.org>
parents:
7409
diff
changeset
|
5426 /* The x and y position of the widget is clobbered by the |
fbea5637a4b4
(x_set_window_size) [USE_X_TOOLKIT]:
Richard M. Stallman <rms@gnu.org>
parents:
7409
diff
changeset
|
5427 call to XtSetValues within EmacsFrameSetCharSize. |
fbea5637a4b4
(x_set_window_size) [USE_X_TOOLKIT]:
Richard M. Stallman <rms@gnu.org>
parents:
7409
diff
changeset
|
5428 This is a real kludge, but I don't understand Xt so I can't |
fbea5637a4b4
(x_set_window_size) [USE_X_TOOLKIT]:
Richard M. Stallman <rms@gnu.org>
parents:
7409
diff
changeset
|
5429 figure out a correct fix. Can anyone else tell me? -- rms. */ |
fbea5637a4b4
(x_set_window_size) [USE_X_TOOLKIT]:
Richard M. Stallman <rms@gnu.org>
parents:
7409
diff
changeset
|
5430 int xpos = f->display.x->widget->core.x; |
fbea5637a4b4
(x_set_window_size) [USE_X_TOOLKIT]:
Richard M. Stallman <rms@gnu.org>
parents:
7409
diff
changeset
|
5431 int ypos = f->display.x->widget->core.y; |
fbea5637a4b4
(x_set_window_size) [USE_X_TOOLKIT]:
Richard M. Stallman <rms@gnu.org>
parents:
7409
diff
changeset
|
5432 EmacsFrameSetCharSize (f->display.x->edit_widget, cols, rows); |
fbea5637a4b4
(x_set_window_size) [USE_X_TOOLKIT]:
Richard M. Stallman <rms@gnu.org>
parents:
7409
diff
changeset
|
5433 f->display.x->widget->core.x = xpos; |
fbea5637a4b4
(x_set_window_size) [USE_X_TOOLKIT]:
Richard M. Stallman <rms@gnu.org>
parents:
7409
diff
changeset
|
5434 f->display.x->widget->core.y = ypos; |
fbea5637a4b4
(x_set_window_size) [USE_X_TOOLKIT]:
Richard M. Stallman <rms@gnu.org>
parents:
7409
diff
changeset
|
5435 } |
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
|
5436 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
|
5437 |
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
|
5438 #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
|
5439 |
286 | 5440 BLOCK_INPUT; |
5441 | |
976
cbdfc337ec8f
* xterm.c (x_wm_hints): New variable.
Jim Blandy <jimb@redhat.com>
parents:
786
diff
changeset
|
5442 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
|
5443 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
|
5444 = (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
|
5445 ? 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
|
5446 : 0); |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
5447 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
|
5448 pixelheight = CHAR_TO_PIXEL_HEIGHT (f, rows); |
286 | 5449 |
5450 #ifdef HAVE_X11 | |
7210
682ff6213c36
(x_wm_set_size_hint): Always set PWinGravity.
Richard M. Stallman <rms@gnu.org>
parents:
7187
diff
changeset
|
5451 f->display.x->win_gravity = NorthWestGravity; |
682ff6213c36
(x_wm_set_size_hint): Always set PWinGravity.
Richard M. Stallman <rms@gnu.org>
parents:
7187
diff
changeset
|
5452 x_wm_set_size_hint (f, 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
|
5453 #endif /* ! defined (HAVE_X11) */ |
6791
7036e4fd549f
(dumpglyphs): Clear any extra pixel rows below the text.
Richard M. Stallman <rms@gnu.org>
parents:
6767
diff
changeset
|
5454 XSync (x_current_display, False); |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5455 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
|
5456 |
cbdfc337ec8f
* xterm.c (x_wm_hints): New variable.
Jim Blandy <jimb@redhat.com>
parents:
786
diff
changeset
|
5457 /* 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
|
5458 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
|
5459 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
|
5460 ConfigureNotify event gets here. |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
5461 |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
5462 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
|
5463 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
|
5464 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
|
5465 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
|
5466 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
|
5467 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
|
5468 PIXEL_WIDTH (f) = pixelwidth; |
cbdfc337ec8f
* xterm.c (x_wm_hints): New variable.
Jim Blandy <jimb@redhat.com>
parents:
786
diff
changeset
|
5469 PIXEL_HEIGHT (f) = pixelheight; |
cbdfc337ec8f
* xterm.c (x_wm_hints): New variable.
Jim Blandy <jimb@redhat.com>
parents:
786
diff
changeset
|
5470 |
7651
1569a13efdcd
(x_set_window_size): If cursor outside new size, mark it off.
Richard M. Stallman <rms@gnu.org>
parents:
7602
diff
changeset
|
5471 /* If cursor was outside the new size, mark it as off. */ |
1569a13efdcd
(x_set_window_size): If cursor outside new size, mark it off.
Richard M. Stallman <rms@gnu.org>
parents:
7602
diff
changeset
|
5472 if (f->phys_cursor_y >= rows |
1569a13efdcd
(x_set_window_size): If cursor outside new size, mark it off.
Richard M. Stallman <rms@gnu.org>
parents:
7602
diff
changeset
|
5473 || f->phys_cursor_x >= cols) |
1569a13efdcd
(x_set_window_size): If cursor outside new size, mark it off.
Richard M. Stallman <rms@gnu.org>
parents:
7602
diff
changeset
|
5474 { |
1569a13efdcd
(x_set_window_size): If cursor outside new size, mark it off.
Richard M. Stallman <rms@gnu.org>
parents:
7602
diff
changeset
|
5475 f->phys_cursor_x = -1; |
1569a13efdcd
(x_set_window_size): If cursor outside new size, mark it off.
Richard M. Stallman <rms@gnu.org>
parents:
7602
diff
changeset
|
5476 f->phys_cursor_y = -1; |
1569a13efdcd
(x_set_window_size): If cursor outside new size, mark it off.
Richard M. Stallman <rms@gnu.org>
parents:
7602
diff
changeset
|
5477 } |
1569a13efdcd
(x_set_window_size): If cursor outside new size, mark it off.
Richard M. Stallman <rms@gnu.org>
parents:
7602
diff
changeset
|
5478 |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
5479 /* 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
|
5480 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
|
5481 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
|
5482 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
|
5483 SET_FRAME_GARBAGED (f); |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
5484 |
286 | 5485 XFlushQueue (); |
5486 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
|
5487 #endif /* not USE_X_TOOLKIT */ |
286 | 5488 } |
5489 | |
5490 #ifndef HAVE_X11 | |
771 | 5491 x_set_resize_hint (f) |
5492 struct frame *f; | |
286 | 5493 { |
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
5494 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
|
5495 2 * f->display.x->internal_border_width, |
771 | 5496 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
|
5497 FONT_WIDTH (f->display.x->font), |
6767
8fbcee1c2059
(stufflines, scraplines, dumprectangle, x_do_pending_expose)
Richard M. Stallman <rms@gnu.org>
parents:
6757
diff
changeset
|
5498 f->display.x->line_height); |
286 | 5499 } |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5500 #endif /* HAVE_X11 */ |
286 | 5501 |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
5502 /* Mouse warping, focus shifting, raising and lowering. */ |
286 | 5503 |
7026
55f9a506180d
(x_set_mouse_pixel_position): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7001
diff
changeset
|
5504 void |
771 | 5505 x_set_mouse_position (f, x, y) |
5506 struct frame *f; | |
286 | 5507 int x, y; |
5508 { | |
5509 int pix_x, pix_y; | |
5510 | |
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
5511 pix_x = CHAR_TO_PIXEL_COL (f, x) + FONT_WIDTH (f->display.x->font) / 2; |
6767
8fbcee1c2059
(stufflines, scraplines, dumprectangle, x_do_pending_expose)
Richard M. Stallman <rms@gnu.org>
parents:
6757
diff
changeset
|
5512 pix_y = CHAR_TO_PIXEL_ROW (f, y) + f->display.x->line_height / 2; |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
5513 |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
5514 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
|
5515 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
|
5516 |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
5517 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
|
5518 if (pix_y > PIXEL_HEIGHT (f)) pix_y = PIXEL_HEIGHT (f); |
286 | 5519 |
5520 BLOCK_INPUT; | |
5521 | |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5522 XWarpMousePointer (FRAME_X_WINDOW (f), pix_x, pix_y); |
286 | 5523 UNBLOCK_INPUT; |
5524 } | |
5525 | |
7026
55f9a506180d
(x_set_mouse_pixel_position): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7001
diff
changeset
|
5526 /* Move the mouse to position pixel PIX_X, PIX_Y relative to frame F. */ |
55f9a506180d
(x_set_mouse_pixel_position): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7001
diff
changeset
|
5527 |
55f9a506180d
(x_set_mouse_pixel_position): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7001
diff
changeset
|
5528 void |
55f9a506180d
(x_set_mouse_pixel_position): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7001
diff
changeset
|
5529 x_set_mouse_pixel_position (f, pix_x, pix_y) |
55f9a506180d
(x_set_mouse_pixel_position): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7001
diff
changeset
|
5530 struct frame *f; |
55f9a506180d
(x_set_mouse_pixel_position): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7001
diff
changeset
|
5531 int pix_x, pix_y; |
55f9a506180d
(x_set_mouse_pixel_position): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7001
diff
changeset
|
5532 { |
55f9a506180d
(x_set_mouse_pixel_position): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7001
diff
changeset
|
5533 BLOCK_INPUT; |
55f9a506180d
(x_set_mouse_pixel_position): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7001
diff
changeset
|
5534 |
55f9a506180d
(x_set_mouse_pixel_position): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7001
diff
changeset
|
5535 XWarpMousePointer (FRAME_X_WINDOW (f), pix_x, pix_y); |
55f9a506180d
(x_set_mouse_pixel_position): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7001
diff
changeset
|
5536 UNBLOCK_INPUT; |
55f9a506180d
(x_set_mouse_pixel_position): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7001
diff
changeset
|
5537 } |
55f9a506180d
(x_set_mouse_pixel_position): New function.
Richard M. Stallman <rms@gnu.org>
parents:
7001
diff
changeset
|
5538 |
286 | 5539 #ifdef HAVE_X11 |
771 | 5540 x_focus_on_frame (f) |
5541 struct frame *f; | |
286 | 5542 { |
5156
fd78458b8c43
(XTread_socket): Really handle Xatom_wm_window_moved events.
Richard M. Stallman <rms@gnu.org>
parents:
5018
diff
changeset
|
5543 #if 0 /* This proves to be unpleasant. */ |
771 | 5544 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
|
5545 #endif |
369 | 5546 #if 0 |
5547 /* I don't think that the ICCCM allows programs to do things like this | |
5548 without the interaction of the window manager. Whatever you end up | |
771 | 5549 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
|
5550 XSetInputFocus (x_current_display, FRAME_X_WINDOW (f), |
286 | 5551 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
|
5552 #endif /* ! 0 */ |
286 | 5553 } |
5554 | |
771 | 5555 x_unfocus_frame (f) |
5556 struct frame *f; | |
286 | 5557 { |
369 | 5558 #if 0 |
771 | 5559 /* Look at the remarks in x_focus_on_frame. */ |
5560 if (x_focus_frame == f) | |
286 | 5561 XSetInputFocus (x_current_display, PointerRoot, |
5562 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
|
5563 #endif /* ! 0 */ |
286 | 5564 } |
5565 | |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5566 #endif /* ! defined (HAVE_X11) */ |
286 | 5567 |
771 | 5568 /* Raise frame F. */ |
5569 | |
5570 x_raise_frame (f) | |
5571 struct frame *f; | |
286 | 5572 { |
1658
452ba03935d7
* xterm.c (XTread_socket): When we get MapNotify, UnmapNotify,
Jim Blandy <jimb@redhat.com>
parents:
1530
diff
changeset
|
5573 if (f->async_visible) |
286 | 5574 { |
5575 BLOCK_INPUT; | |
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5576 #ifdef USE_X_TOOLKIT |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5577 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
|
5578 #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
|
5579 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
|
5580 #endif /* not USE_X_TOOLKIT */ |
286 | 5581 XFlushQueue (); |
5582 UNBLOCK_INPUT; | |
5583 } | |
5584 } | |
5585 | |
771 | 5586 /* Lower frame F. */ |
5587 | |
5588 x_lower_frame (f) | |
5589 struct frame *f; | |
286 | 5590 { |
1658
452ba03935d7
* xterm.c (XTread_socket): When we get MapNotify, UnmapNotify,
Jim Blandy <jimb@redhat.com>
parents:
1530
diff
changeset
|
5591 if (f->async_visible) |
286 | 5592 { |
5593 BLOCK_INPUT; | |
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5594 #ifdef USE_X_TOOLKIT |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5595 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
|
5596 #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
|
5597 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
|
5598 #endif /* not USE_X_TOOLKIT */ |
286 | 5599 XFlushQueue (); |
5600 UNBLOCK_INPUT; | |
5601 } | |
5602 } | |
5603 | |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
5604 static void |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
5605 XTframe_raise_lower (f, raise) |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
5606 FRAME_PTR f; |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
5607 int raise; |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
5608 { |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
5609 if (raise) |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
5610 x_raise_frame (f); |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
5611 else |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
5612 x_lower_frame (f); |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
5613 } |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
5614 |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
5615 |
7738
a810335742bb
(x_iconify_frame): Call x_set_offset,
Richard M. Stallman <rms@gnu.org>
parents:
7706
diff
changeset
|
5616 /* Change from withdrawn state to mapped state, |
a810335742bb
(x_iconify_frame): Call x_set_offset,
Richard M. Stallman <rms@gnu.org>
parents:
7706
diff
changeset
|
5617 or deiconify. */ |
286 | 5618 |
771 | 5619 x_make_frame_visible (f) |
5620 struct frame *f; | |
286 | 5621 { |
5622 int mask; | |
5623 | |
429 | 5624 BLOCK_INPUT; |
5625 | |
771 | 5626 if (! FRAME_VISIBLE_P (f)) |
286 | 5627 { |
5628 #ifdef HAVE_X11 | |
7210
682ff6213c36
(x_wm_set_size_hint): Always set PWinGravity.
Richard M. Stallman <rms@gnu.org>
parents:
7187
diff
changeset
|
5629 #ifndef USE_X_TOOLKIT |
7738
a810335742bb
(x_iconify_frame): Call x_set_offset,
Richard M. Stallman <rms@gnu.org>
parents:
7706
diff
changeset
|
5630 if (! FRAME_ICONIFIED_P (f)) |
a810335742bb
(x_iconify_frame): Call x_set_offset,
Richard M. Stallman <rms@gnu.org>
parents:
7706
diff
changeset
|
5631 x_set_offset (f, f->display.x->left_pos, f->display.x->top_pos, 0); |
7210
682ff6213c36
(x_wm_set_size_hint): Always set PWinGravity.
Richard M. Stallman <rms@gnu.org>
parents:
7187
diff
changeset
|
5632 #endif |
6934
e0ab4f59004e
(dumpglyphs): When HL=2, check explicitly for using
Richard M. Stallman <rms@gnu.org>
parents:
6883
diff
changeset
|
5633 |
429 | 5634 if (! EQ (Vx_no_window_manager, Qt)) |
771 | 5635 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
|
5636 #ifdef USE_X_TOOLKIT |
7167
2fa74c48e4e5
(x_make_frame_visible): Use XtMapWidget, not XtPopup.
Richard M. Stallman <rms@gnu.org>
parents:
7128
diff
changeset
|
5637 /* This was XtPopup, but that did nothing for an iconified frame. */ |
2fa74c48e4e5
(x_make_frame_visible): Use XtMapWidget, not XtPopup.
Richard M. Stallman <rms@gnu.org>
parents:
7128
diff
changeset
|
5638 XtMapWidget (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 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
|
5641 #endif /* not USE_X_TOOLKIT */ |
6883
77ceede38423
(x_make_frame_visible): Don't call XMapSubwindows.
Richard M. Stallman <rms@gnu.org>
parents:
6791
diff
changeset
|
5642 #if 0 /* This seems to bring back scroll bars in the wrong places |
77ceede38423
(x_make_frame_visible): Don't call XMapSubwindows.
Richard M. Stallman <rms@gnu.org>
parents:
6791
diff
changeset
|
5643 if the window configuration has changed. They seem |
77ceede38423
(x_make_frame_visible): Don't call XMapSubwindows.
Richard M. Stallman <rms@gnu.org>
parents:
6791
diff
changeset
|
5644 to come back ok without this. */ |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
5645 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
|
5646 XMapSubwindows (x_current_display, FRAME_X_WINDOW (f)); |
6883
77ceede38423
(x_make_frame_visible): Don't call XMapSubwindows.
Richard M. Stallman <rms@gnu.org>
parents:
6791
diff
changeset
|
5647 #endif |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5648 #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
|
5649 XMapWindow (XDISPLAY FRAME_X_WINDOW (f)); |
771 | 5650 if (f->display.x->icon_desc != 0) |
5651 XUnmapWindow (f->display.x->icon_desc); | |
429 | 5652 |
5653 /* 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
|
5654 f->async_visible = 1; |
452ba03935d7
* xterm.c (XTread_socket): When we get MapNotify, UnmapNotify,
Jim Blandy <jimb@redhat.com>
parents:
1530
diff
changeset
|
5655 f->async_iconified = 0; |
771 | 5656 |
5657 /* NOTE: this may cause problems for the first frame. */ | |
429 | 5658 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
|
5659 #endif /* ! defined (HAVE_X11) */ |
429 | 5660 } |
286 | 5661 |
5662 XFlushQueue (); | |
429 | 5663 |
286 | 5664 UNBLOCK_INPUT; |
7959
224440646fa7
(make_frame_visible): At end, wait till Emacs sees frame is visible.
Richard M. Stallman <rms@gnu.org>
parents:
7935
diff
changeset
|
5665 |
224440646fa7
(make_frame_visible): At end, wait till Emacs sees frame is visible.
Richard M. Stallman <rms@gnu.org>
parents:
7935
diff
changeset
|
5666 /* Synchronize to ensure Emacs knows the frame is visible |
224440646fa7
(make_frame_visible): At end, wait till Emacs sees frame is visible.
Richard M. Stallman <rms@gnu.org>
parents:
7935
diff
changeset
|
5667 before we do anything else. We do this loop with input not blocked |
224440646fa7
(make_frame_visible): At end, wait till Emacs sees frame is visible.
Richard M. Stallman <rms@gnu.org>
parents:
7935
diff
changeset
|
5668 so that incoming events are handled. */ |
224440646fa7
(make_frame_visible): At end, wait till Emacs sees frame is visible.
Richard M. Stallman <rms@gnu.org>
parents:
7935
diff
changeset
|
5669 { |
224440646fa7
(make_frame_visible): At end, wait till Emacs sees frame is visible.
Richard M. Stallman <rms@gnu.org>
parents:
7935
diff
changeset
|
5670 Lisp_Object frame; |
8437
85bcdaceeebc
(x_make_frame_visible): Start one_in_four at 1.
Richard M. Stallman <rms@gnu.org>
parents:
8430
diff
changeset
|
5671 int one_in_four = 1; |
7959
224440646fa7
(make_frame_visible): At end, wait till Emacs sees frame is visible.
Richard M. Stallman <rms@gnu.org>
parents:
7935
diff
changeset
|
5672 XSET (frame, Lisp_Frame, f); |
224440646fa7
(make_frame_visible): At end, wait till Emacs sees frame is visible.
Richard M. Stallman <rms@gnu.org>
parents:
7935
diff
changeset
|
5673 while (! f->async_visible) |
8098
e44c31d682b1
(x_draw_box): Use curs_x and curs_y, not f->cursor_[xy].
Richard M. Stallman <rms@gnu.org>
parents:
8036
diff
changeset
|
5674 { |
e44c31d682b1
(x_draw_box): Use curs_x and curs_y, not f->cursor_[xy].
Richard M. Stallman <rms@gnu.org>
parents:
8036
diff
changeset
|
5675 x_sync (frame); |
e44c31d682b1
(x_draw_box): Use curs_x and curs_y, not f->cursor_[xy].
Richard M. Stallman <rms@gnu.org>
parents:
8036
diff
changeset
|
5676 /* On HPUX on the HP800, the sleep is needed sometimes. */ |
e44c31d682b1
(x_draw_box): Use curs_x and curs_y, not f->cursor_[xy].
Richard M. Stallman <rms@gnu.org>
parents:
8036
diff
changeset
|
5677 if ((one_in_four & 3) == 0) |
e44c31d682b1
(x_draw_box): Use curs_x and curs_y, not f->cursor_[xy].
Richard M. Stallman <rms@gnu.org>
parents:
8036
diff
changeset
|
5678 { |
e44c31d682b1
(x_draw_box): Use curs_x and curs_y, not f->cursor_[xy].
Richard M. Stallman <rms@gnu.org>
parents:
8036
diff
changeset
|
5679 #ifdef EMACS_HAS_USECS |
e44c31d682b1
(x_draw_box): Use curs_x and curs_y, not f->cursor_[xy].
Richard M. Stallman <rms@gnu.org>
parents:
8036
diff
changeset
|
5680 Fsleep_for (make_number (1), make_number (0)); |
e44c31d682b1
(x_draw_box): Use curs_x and curs_y, not f->cursor_[xy].
Richard M. Stallman <rms@gnu.org>
parents:
8036
diff
changeset
|
5681 #else |
e44c31d682b1
(x_draw_box): Use curs_x and curs_y, not f->cursor_[xy].
Richard M. Stallman <rms@gnu.org>
parents:
8036
diff
changeset
|
5682 Fsleep_for (make_number (0), make_number (250)); |
e44c31d682b1
(x_draw_box): Use curs_x and curs_y, not f->cursor_[xy].
Richard M. Stallman <rms@gnu.org>
parents:
8036
diff
changeset
|
5683 #endif |
e44c31d682b1
(x_draw_box): Use curs_x and curs_y, not f->cursor_[xy].
Richard M. Stallman <rms@gnu.org>
parents:
8036
diff
changeset
|
5684 } |
e44c31d682b1
(x_draw_box): Use curs_x and curs_y, not f->cursor_[xy].
Richard M. Stallman <rms@gnu.org>
parents:
8036
diff
changeset
|
5685 one_in_four++; |
e44c31d682b1
(x_draw_box): Use curs_x and curs_y, not f->cursor_[xy].
Richard M. Stallman <rms@gnu.org>
parents:
8036
diff
changeset
|
5686 } |
7959
224440646fa7
(make_frame_visible): At end, wait till Emacs sees frame is visible.
Richard M. Stallman <rms@gnu.org>
parents:
7935
diff
changeset
|
5687 FRAME_SAMPLE_VISIBILITY (f); |
224440646fa7
(make_frame_visible): At end, wait till Emacs sees frame is visible.
Richard M. Stallman <rms@gnu.org>
parents:
7935
diff
changeset
|
5688 } |
286 | 5689 } |
5690 | |
5691 /* Change from mapped state to withdrawn state. */ | |
5692 | |
771 | 5693 x_make_frame_invisible (f) |
5694 struct frame *f; | |
286 | 5695 { |
5696 int mask; | |
7602
136819b017fc
(x_wm_set_window_state) [USE_X_TOOLKIT]: Use XtSetValues.
Richard M. Stallman <rms@gnu.org>
parents:
7508
diff
changeset
|
5697 Window window; |
136819b017fc
(x_wm_set_window_state) [USE_X_TOOLKIT]: Use XtSetValues.
Richard M. Stallman <rms@gnu.org>
parents:
7508
diff
changeset
|
5698 |
136819b017fc
(x_wm_set_window_state) [USE_X_TOOLKIT]: Use XtSetValues.
Richard M. Stallman <rms@gnu.org>
parents:
7508
diff
changeset
|
5699 #ifdef USE_X_TOOLKIT |
136819b017fc
(x_wm_set_window_state) [USE_X_TOOLKIT]: Use XtSetValues.
Richard M. Stallman <rms@gnu.org>
parents:
7508
diff
changeset
|
5700 /* Use the frame's outermost window, not the one we normally draw on. */ |
136819b017fc
(x_wm_set_window_state) [USE_X_TOOLKIT]: Use XtSetValues.
Richard M. Stallman <rms@gnu.org>
parents:
7508
diff
changeset
|
5701 window = XtWindow (f->display.x->widget); |
136819b017fc
(x_wm_set_window_state) [USE_X_TOOLKIT]: Use XtSetValues.
Richard M. Stallman <rms@gnu.org>
parents:
7508
diff
changeset
|
5702 #else /* not USE_X_TOOLKIT */ |
136819b017fc
(x_wm_set_window_state) [USE_X_TOOLKIT]: Use XtSetValues.
Richard M. Stallman <rms@gnu.org>
parents:
7508
diff
changeset
|
5703 window = FRAME_X_WINDOW (f); |
136819b017fc
(x_wm_set_window_state) [USE_X_TOOLKIT]: Use XtSetValues.
Richard M. Stallman <rms@gnu.org>
parents:
7508
diff
changeset
|
5704 #endif /* not USE_X_TOOLKIT */ |
286 | 5705 |
3284
a47979ffad1e
(XTread_socket): For UnmapNotify, if frame was visible,
Richard M. Stallman <rms@gnu.org>
parents:
3282
diff
changeset
|
5706 /* 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
|
5707 if (x_highlight_frame == f) |
a47979ffad1e
(XTread_socket): For UnmapNotify, if frame was visible,
Richard M. Stallman <rms@gnu.org>
parents:
3282
diff
changeset
|
5708 x_highlight_frame = 0; |
a47979ffad1e
(XTread_socket): For UnmapNotify, if frame was visible,
Richard M. Stallman <rms@gnu.org>
parents:
3282
diff
changeset
|
5709 |
6983
b18e5c09d7c3
(XTread_socket, case ClientMessage): Use x_window_to_frame unconditionally.
Richard M. Stallman <rms@gnu.org>
parents:
6941
diff
changeset
|
5710 #if 0/* This might add unreliability; I don't trust it -- rms. */ |
3284
a47979ffad1e
(XTread_socket): For UnmapNotify, if frame was visible,
Richard M. Stallman <rms@gnu.org>
parents:
3282
diff
changeset
|
5711 if (! f->async_visible && ! f->async_iconified) |
286 | 5712 return; |
6983
b18e5c09d7c3
(XTread_socket, case ClientMessage): Use x_window_to_frame unconditionally.
Richard M. Stallman <rms@gnu.org>
parents:
6941
diff
changeset
|
5713 #endif |
286 | 5714 |
5715 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
|
5716 |
7210
682ff6213c36
(x_wm_set_size_hint): Always set PWinGravity.
Richard M. Stallman <rms@gnu.org>
parents:
7187
diff
changeset
|
5717 /* Before unmapping the window, update the WM_SIZE_HINTS property to claim |
682ff6213c36
(x_wm_set_size_hint): Always set PWinGravity.
Richard M. Stallman <rms@gnu.org>
parents:
7187
diff
changeset
|
5718 that the current position of the window is user-specified, rather than |
682ff6213c36
(x_wm_set_size_hint): Always set PWinGravity.
Richard M. Stallman <rms@gnu.org>
parents:
7187
diff
changeset
|
5719 program-specified, so that when the window is mapped again, it will be |
682ff6213c36
(x_wm_set_size_hint): Always set PWinGravity.
Richard M. Stallman <rms@gnu.org>
parents:
7187
diff
changeset
|
5720 placed at the same location, without forcing the user to position it |
682ff6213c36
(x_wm_set_size_hint): Always set PWinGravity.
Richard M. Stallman <rms@gnu.org>
parents:
7187
diff
changeset
|
5721 by hand again (they have already done that once for this window.) */ |
682ff6213c36
(x_wm_set_size_hint): Always set PWinGravity.
Richard M. Stallman <rms@gnu.org>
parents:
7187
diff
changeset
|
5722 x_wm_set_size_hint (f, 0, 1); |
682ff6213c36
(x_wm_set_size_hint): Always set PWinGravity.
Richard M. Stallman <rms@gnu.org>
parents:
7187
diff
changeset
|
5723 |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5724 #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
|
5725 |
7602
136819b017fc
(x_wm_set_window_state) [USE_X_TOOLKIT]: Use XtSetValues.
Richard M. Stallman <rms@gnu.org>
parents:
7508
diff
changeset
|
5726 if (! XWithdrawWindow (x_current_display, window, |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5727 DefaultScreen (x_current_display))) |
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5728 { |
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5729 UNBLOCK_INPUT_RESIGNAL; |
7602
136819b017fc
(x_wm_set_window_state) [USE_X_TOOLKIT]: Use XtSetValues.
Richard M. Stallman <rms@gnu.org>
parents:
7508
diff
changeset
|
5730 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
|
5731 } |
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5732 #else /* ! defined (HAVE_X11R4) */ |
286 | 5733 #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
|
5734 |
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5735 /* Tell the window manager what we're going to do. */ |
286 | 5736 if (! EQ (Vx_no_window_manager, Qt)) |
5737 { | |
1020
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5738 XEvent unmap; |
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5739 |
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5740 unmap.xunmap.type = UnmapNotify; |
7602
136819b017fc
(x_wm_set_window_state) [USE_X_TOOLKIT]: Use XtSetValues.
Richard M. Stallman <rms@gnu.org>
parents:
7508
diff
changeset
|
5741 unmap.xunmap.window = window; |
1020
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5742 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
|
5743 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
|
5744 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
|
5745 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
|
5746 False, |
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5747 SubstructureRedirectMask|SubstructureNotifyMask, |
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5748 &unmap)) |
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5749 { |
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5750 UNBLOCK_INPUT_RESIGNAL; |
7602
136819b017fc
(x_wm_set_window_state) [USE_X_TOOLKIT]: Use XtSetValues.
Richard M. Stallman <rms@gnu.org>
parents:
7508
diff
changeset
|
5751 error ("Can't notify window manager of withdrawal"); |
1020
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5752 } |
286 | 5753 } |
5754 | |
1020
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5755 /* Unmap the window ourselves. Cheeky! */ |
7602
136819b017fc
(x_wm_set_window_state) [USE_X_TOOLKIT]: Use XtSetValues.
Richard M. Stallman <rms@gnu.org>
parents:
7508
diff
changeset
|
5756 XUnmapWindow (x_current_display, window); |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5757 #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
|
5758 |
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5759 XUnmapWindow (FRAME_X_WINDOW (f)); |
771 | 5760 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
|
5761 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
|
5762 |
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5763 #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
|
5764 #endif /* ! defined (HAVE_X11R4) */ |
286 | 5765 |
6983
b18e5c09d7c3
(XTread_socket, case ClientMessage): Use x_window_to_frame unconditionally.
Richard M. Stallman <rms@gnu.org>
parents:
6941
diff
changeset
|
5766 /* We can't distinguish this from iconification |
b18e5c09d7c3
(XTread_socket, case ClientMessage): Use x_window_to_frame unconditionally.
Richard M. Stallman <rms@gnu.org>
parents:
6941
diff
changeset
|
5767 just by the event that we get from the server. |
b18e5c09d7c3
(XTread_socket, case ClientMessage): Use x_window_to_frame unconditionally.
Richard M. Stallman <rms@gnu.org>
parents:
6941
diff
changeset
|
5768 So we can't win using the usual strategy of letting |
b18e5c09d7c3
(XTread_socket, case ClientMessage): Use x_window_to_frame unconditionally.
Richard M. Stallman <rms@gnu.org>
parents:
6941
diff
changeset
|
5769 FRAME_SAMPLE_VISIBILITY set this. So do it by hand, |
b18e5c09d7c3
(XTread_socket, case ClientMessage): Use x_window_to_frame unconditionally.
Richard M. Stallman <rms@gnu.org>
parents:
6941
diff
changeset
|
5770 and synchronize with the server to make sure we agree. */ |
b18e5c09d7c3
(XTread_socket, case ClientMessage): Use x_window_to_frame unconditionally.
Richard M. Stallman <rms@gnu.org>
parents:
6941
diff
changeset
|
5771 f->visible = 0; |
b18e5c09d7c3
(XTread_socket, case ClientMessage): Use x_window_to_frame unconditionally.
Richard M. Stallman <rms@gnu.org>
parents:
6941
diff
changeset
|
5772 FRAME_ICONIFIED_P (f) = 0; |
b18e5c09d7c3
(XTread_socket, case ClientMessage): Use x_window_to_frame unconditionally.
Richard M. Stallman <rms@gnu.org>
parents:
6941
diff
changeset
|
5773 f->async_visible = 0; |
b18e5c09d7c3
(XTread_socket, case ClientMessage): Use x_window_to_frame unconditionally.
Richard M. Stallman <rms@gnu.org>
parents:
6941
diff
changeset
|
5774 f->async_iconified = 0; |
b18e5c09d7c3
(XTread_socket, case ClientMessage): Use x_window_to_frame unconditionally.
Richard M. Stallman <rms@gnu.org>
parents:
6941
diff
changeset
|
5775 |
b18e5c09d7c3
(XTread_socket, case ClientMessage): Use x_window_to_frame unconditionally.
Richard M. Stallman <rms@gnu.org>
parents:
6941
diff
changeset
|
5776 x_sync (); |
b18e5c09d7c3
(XTread_socket, case ClientMessage): Use x_window_to_frame unconditionally.
Richard M. Stallman <rms@gnu.org>
parents:
6941
diff
changeset
|
5777 |
286 | 5778 UNBLOCK_INPUT; |
5779 } | |
5780 | |
5781 /* Change window state from mapped to iconified. */ | |
5782 | |
771 | 5783 x_iconify_frame (f) |
5784 struct frame *f; | |
286 | 5785 { |
5786 int mask; | |
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5787 int result; |
286 | 5788 |
3284
a47979ffad1e
(XTread_socket): For UnmapNotify, if frame was visible,
Richard M. Stallman <rms@gnu.org>
parents:
3282
diff
changeset
|
5789 /* 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
|
5790 if (x_highlight_frame == f) |
a47979ffad1e
(XTread_socket): For UnmapNotify, if frame was visible,
Richard M. Stallman <rms@gnu.org>
parents:
3282
diff
changeset
|
5791 x_highlight_frame = 0; |
a47979ffad1e
(XTread_socket): For UnmapNotify, if frame was visible,
Richard M. Stallman <rms@gnu.org>
parents:
3282
diff
changeset
|
5792 |
1658
452ba03935d7
* xterm.c (XTread_socket): When we get MapNotify, UnmapNotify,
Jim Blandy <jimb@redhat.com>
parents:
1530
diff
changeset
|
5793 if (f->async_iconified) |
286 | 5794 return; |
5795 | |
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5796 #ifdef USE_X_TOOLKIT |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5797 BLOCK_INPUT; |
7602
136819b017fc
(x_wm_set_window_state) [USE_X_TOOLKIT]: Use XtSetValues.
Richard M. Stallman <rms@gnu.org>
parents:
7508
diff
changeset
|
5798 |
136819b017fc
(x_wm_set_window_state) [USE_X_TOOLKIT]: Use XtSetValues.
Richard M. Stallman <rms@gnu.org>
parents:
7508
diff
changeset
|
5799 if (! FRAME_VISIBLE_P (f)) |
136819b017fc
(x_wm_set_window_state) [USE_X_TOOLKIT]: Use XtSetValues.
Richard M. Stallman <rms@gnu.org>
parents:
7508
diff
changeset
|
5800 { |
136819b017fc
(x_wm_set_window_state) [USE_X_TOOLKIT]: Use XtSetValues.
Richard M. Stallman <rms@gnu.org>
parents:
7508
diff
changeset
|
5801 if (! EQ (Vx_no_window_manager, Qt)) |
136819b017fc
(x_wm_set_window_state) [USE_X_TOOLKIT]: Use XtSetValues.
Richard M. Stallman <rms@gnu.org>
parents:
7508
diff
changeset
|
5802 x_wm_set_window_state (f, IconicState); |
136819b017fc
(x_wm_set_window_state) [USE_X_TOOLKIT]: Use XtSetValues.
Richard M. Stallman <rms@gnu.org>
parents:
7508
diff
changeset
|
5803 /* This was XtPopup, but that did nothing for an iconified frame. */ |
136819b017fc
(x_wm_set_window_state) [USE_X_TOOLKIT]: Use XtSetValues.
Richard M. Stallman <rms@gnu.org>
parents:
7508
diff
changeset
|
5804 XtMapWidget (f->display.x->widget); |
136819b017fc
(x_wm_set_window_state) [USE_X_TOOLKIT]: Use XtSetValues.
Richard M. Stallman <rms@gnu.org>
parents:
7508
diff
changeset
|
5805 UNBLOCK_INPUT; |
136819b017fc
(x_wm_set_window_state) [USE_X_TOOLKIT]: Use XtSetValues.
Richard M. Stallman <rms@gnu.org>
parents:
7508
diff
changeset
|
5806 return; |
136819b017fc
(x_wm_set_window_state) [USE_X_TOOLKIT]: Use XtSetValues.
Richard M. Stallman <rms@gnu.org>
parents:
7508
diff
changeset
|
5807 } |
136819b017fc
(x_wm_set_window_state) [USE_X_TOOLKIT]: Use XtSetValues.
Richard M. Stallman <rms@gnu.org>
parents:
7508
diff
changeset
|
5808 |
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5809 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
|
5810 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
|
5811 DefaultScreen (x_current_display)); |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5812 UNBLOCK_INPUT; |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5813 |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5814 if (!result) |
7602
136819b017fc
(x_wm_set_window_state) [USE_X_TOOLKIT]: Use XtSetValues.
Richard M. Stallman <rms@gnu.org>
parents:
7508
diff
changeset
|
5815 error ("Can't notify window manager of iconification"); |
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5816 |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5817 f->async_iconified = 1; |
5740
48da4ed089e9
(x_iconify_frame): Fix misbalanced BLOCK_INPUT/UNBLOCK_INPUT.
Karl Heuer <kwzh@gnu.org>
parents:
5737
diff
changeset
|
5818 |
48da4ed089e9
(x_iconify_frame): Fix misbalanced BLOCK_INPUT/UNBLOCK_INPUT.
Karl Heuer <kwzh@gnu.org>
parents:
5737
diff
changeset
|
5819 BLOCK_INPUT; |
48da4ed089e9
(x_iconify_frame): Fix misbalanced BLOCK_INPUT/UNBLOCK_INPUT.
Karl Heuer <kwzh@gnu.org>
parents:
5737
diff
changeset
|
5820 XFlushQueue (); |
48da4ed089e9
(x_iconify_frame): Fix misbalanced BLOCK_INPUT/UNBLOCK_INPUT.
Karl Heuer <kwzh@gnu.org>
parents:
5737
diff
changeset
|
5821 UNBLOCK_INPUT; |
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5822 #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
|
5823 |
286 | 5824 BLOCK_INPUT; |
5825 | |
5826 #ifdef HAVE_X11 | |
7738
a810335742bb
(x_iconify_frame): Call x_set_offset,
Richard M. Stallman <rms@gnu.org>
parents:
7706
diff
changeset
|
5827 /* Make sure the X server knows where the window should be positioned, |
a810335742bb
(x_iconify_frame): Call x_set_offset,
Richard M. Stallman <rms@gnu.org>
parents:
7706
diff
changeset
|
5828 in case the user deiconifies with the window manager. */ |
a810335742bb
(x_iconify_frame): Call x_set_offset,
Richard M. Stallman <rms@gnu.org>
parents:
7706
diff
changeset
|
5829 if (! FRAME_VISIBLE_P (f) && !FRAME_ICONIFIED_P (f)) |
a810335742bb
(x_iconify_frame): Call x_set_offset,
Richard M. Stallman <rms@gnu.org>
parents:
7706
diff
changeset
|
5830 x_set_offset (f, f->display.x->left_pos, f->display.x->top_pos, 0); |
a810335742bb
(x_iconify_frame): Call x_set_offset,
Richard M. Stallman <rms@gnu.org>
parents:
7706
diff
changeset
|
5831 |
1020
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5832 /* 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
|
5833 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
|
5834 |
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5835 /* 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
|
5836 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
|
5837 { |
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5838 XEvent message; |
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5839 |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5840 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
|
5841 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
|
5842 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
|
5843 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
|
5844 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
|
5845 |
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5846 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
|
5847 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
|
5848 False, |
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5849 SubstructureRedirectMask | SubstructureNotifyMask, |
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5850 &message)) |
286 | 5851 { |
5852 UNBLOCK_INPUT_RESIGNAL; | |
7602
136819b017fc
(x_wm_set_window_state) [USE_X_TOOLKIT]: Use XtSetValues.
Richard M. Stallman <rms@gnu.org>
parents:
7508
diff
changeset
|
5853 error ("Can't notify window manager of iconification"); |
286 | 5854 } |
1020
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5855 } |
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5856 |
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5857 /* 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
|
5858 IconicState. */ |
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
5859 x_wm_set_window_state (f, IconicState); |
286 | 5860 |
4304
b5014da888a8
(x_iconify_frame): Handle case where frame was invisible.
Richard M. Stallman <rms@gnu.org>
parents:
4277
diff
changeset
|
5861 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
|
5862 { |
b5014da888a8
(x_iconify_frame): Handle case where frame was invisible.
Richard M. Stallman <rms@gnu.org>
parents:
4277
diff
changeset
|
5863 /* 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
|
5864 XMapWindow (XDISPLAY FRAME_X_WINDOW (f)); |
6883
77ceede38423
(x_make_frame_visible): Don't call XMapSubwindows.
Richard M. Stallman <rms@gnu.org>
parents:
6791
diff
changeset
|
5865 #if 0 /* We don't have subwindows in the icon. */ |
4304
b5014da888a8
(x_iconify_frame): Handle case where frame was invisible.
Richard M. Stallman <rms@gnu.org>
parents:
4277
diff
changeset
|
5866 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
|
5867 XMapSubwindows (x_current_display, FRAME_X_WINDOW (f)); |
6883
77ceede38423
(x_make_frame_visible): Don't call XMapSubwindows.
Richard M. Stallman <rms@gnu.org>
parents:
6791
diff
changeset
|
5868 #endif |
4304
b5014da888a8
(x_iconify_frame): Handle case where frame was invisible.
Richard M. Stallman <rms@gnu.org>
parents:
4277
diff
changeset
|
5869 } |
b5014da888a8
(x_iconify_frame): Handle case where frame was invisible.
Richard M. Stallman <rms@gnu.org>
parents:
4277
diff
changeset
|
5870 |
1658
452ba03935d7
* xterm.c (XTread_socket): When we get MapNotify, UnmapNotify,
Jim Blandy <jimb@redhat.com>
parents:
1530
diff
changeset
|
5871 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
|
5872 #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
|
5873 XUnmapWindow (XDISPLAY FRAME_X_WINDOW (f)); |
771 | 5874 |
1658
452ba03935d7
* xterm.c (XTread_socket): When we get MapNotify, UnmapNotify,
Jim Blandy <jimb@redhat.com>
parents:
1530
diff
changeset
|
5875 f->async_visible = 0; /* Handled in the UnMap event for X11. */ |
771 | 5876 if (f->display.x->icon_desc != 0) |
286 | 5877 { |
771 | 5878 XMapWindow (XDISPLAY f->display.x->icon_desc); |
5879 refreshicon (f); | |
286 | 5880 } |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5881 #endif /* ! defined (HAVE_X11) */ |
286 | 5882 |
5883 XFlushQueue (); | |
5884 UNBLOCK_INPUT; | |
5740
48da4ed089e9
(x_iconify_frame): Fix misbalanced BLOCK_INPUT/UNBLOCK_INPUT.
Karl Heuer <kwzh@gnu.org>
parents:
5737
diff
changeset
|
5885 #endif /* not USE_X_TOOLKIT */ |
286 | 5886 } |
5887 | |
1810
bf618128d973
* xterm.c (x_scrollbar_create): Set the scrollbars to use
Jim Blandy <jimb@redhat.com>
parents:
1803
diff
changeset
|
5888 /* 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
|
5889 |
bf618128d973
* xterm.c (x_scrollbar_create): Set the scrollbars to use
Jim Blandy <jimb@redhat.com>
parents:
1803
diff
changeset
|
5890 x_destroy_window (f) |
771 | 5891 struct frame *f; |
286 | 5892 { |
5893 BLOCK_INPUT; | |
1810
bf618128d973
* xterm.c (x_scrollbar_create): Set the scrollbars to use
Jim Blandy <jimb@redhat.com>
parents:
1803
diff
changeset
|
5894 |
bf618128d973
* xterm.c (x_scrollbar_create): Set the scrollbars to use
Jim Blandy <jimb@redhat.com>
parents:
1803
diff
changeset
|
5895 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
|
5896 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
|
5897 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
|
5898 #ifdef USE_X_TOOLKIT |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5899 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
|
5900 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
|
5901 #endif /* USE_X_TOOLKIT */ |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
5902 |
2732
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
5903 free_frame_faces (f); |
286 | 5904 XFlushQueue (); |
1810
bf618128d973
* xterm.c (x_scrollbar_create): Set the scrollbars to use
Jim Blandy <jimb@redhat.com>
parents:
1803
diff
changeset
|
5905 |
2439
b6c62e4abf59
Put interrupt input blocking in a separate file from xterm.h.
Jim Blandy <jimb@redhat.com>
parents:
2353
diff
changeset
|
5906 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
|
5907 f->display.x = 0; |
771 | 5908 if (f == x_focus_frame) |
5909 x_focus_frame = 0; | |
5910 if (f == x_highlight_frame) | |
5911 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
|
5912 |
6883
77ceede38423
(x_make_frame_visible): Don't call XMapSubwindows.
Richard M. Stallman <rms@gnu.org>
parents:
6791
diff
changeset
|
5913 if (f == mouse_face_mouse_frame) |
6934
e0ab4f59004e
(dumpglyphs): When HL=2, check explicitly for using
Richard M. Stallman <rms@gnu.org>
parents:
6883
diff
changeset
|
5914 { |
7283
3dc9a9e95d32
(note_mouse_highlight, show_mouse_face, clear_mouse_face, x_destroy_window):
Karl Heuer <kwzh@gnu.org>
parents:
7282
diff
changeset
|
5915 mouse_face_beg_row = mouse_face_beg_col = -1; |
3dc9a9e95d32
(note_mouse_highlight, show_mouse_face, clear_mouse_face, x_destroy_window):
Karl Heuer <kwzh@gnu.org>
parents:
7282
diff
changeset
|
5916 mouse_face_end_row = mouse_face_end_col = -1; |
6934
e0ab4f59004e
(dumpglyphs): When HL=2, check explicitly for using
Richard M. Stallman <rms@gnu.org>
parents:
6883
diff
changeset
|
5917 mouse_face_window = Qnil; |
e0ab4f59004e
(dumpglyphs): When HL=2, check explicitly for using
Richard M. Stallman <rms@gnu.org>
parents:
6883
diff
changeset
|
5918 } |
6883
77ceede38423
(x_make_frame_visible): Don't call XMapSubwindows.
Richard M. Stallman <rms@gnu.org>
parents:
6791
diff
changeset
|
5919 |
1810
bf618128d973
* xterm.c (x_scrollbar_create): Set the scrollbars to use
Jim Blandy <jimb@redhat.com>
parents:
1803
diff
changeset
|
5920 UNBLOCK_INPUT; |
286 | 5921 } |
5922 | |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
5923 /* 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
|
5924 |
286 | 5925 #ifndef HAVE_X11 |
5926 | |
5927 /* Manage event queues. | |
5928 | |
5929 This code is only used by the X10 support. | |
5930 | |
5931 We cannot leave events in the X queue and get them when we are ready | |
5932 because X does not provide a subroutine to get only a certain kind | |
5933 of event but not block if there are no queued events of that kind. | |
5934 | |
5935 Therefore, we must examine events as they come in and copy events | |
5936 of certain kinds into our private queues. | |
5937 | |
5938 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
|
5939 All ButtonPress and ButtonRelease events are put in x_mouse_queue. */ |
286 | 5940 |
5941 | |
5942 /* Write the event *P_XREP into the event queue *QUEUE. | |
5943 If the queue is full, do nothing, but return nonzero. */ | |
5944 | |
5945 int | |
5946 enqueue_event (p_xrep, queue) | |
5947 register XEvent *p_xrep; | |
5948 register struct event_queue *queue; | |
5949 { | |
5950 int newindex = queue->windex + 1; | |
5951 if (newindex == EVENT_BUFFER_SIZE) | |
5952 newindex = 0; | |
5953 if (newindex == queue->rindex) | |
5954 return -1; | |
5955 queue->xrep[queue->windex] = *p_xrep; | |
5956 queue->windex = newindex; | |
5957 return 0; | |
5958 } | |
5959 | |
5960 /* Fetch the next event from queue *QUEUE and store it in *P_XREP. | |
5961 If *QUEUE is empty, do nothing and return 0. */ | |
5962 | |
5963 int | |
5964 dequeue_event (p_xrep, queue) | |
5965 register XEvent *p_xrep; | |
5966 register struct event_queue *queue; | |
5967 { | |
5968 if (queue->windex == queue->rindex) | |
5969 return 0; | |
5970 *p_xrep = queue->xrep[queue->rindex++]; | |
5971 if (queue->rindex == EVENT_BUFFER_SIZE) | |
5972 queue->rindex = 0; | |
5973 return 1; | |
5974 } | |
5975 | |
5976 /* Return the number of events buffered in *QUEUE. */ | |
5977 | |
5978 int | |
5979 queue_event_count (queue) | |
5980 register struct event_queue *queue; | |
5981 { | |
5982 int tem = queue->windex - queue->rindex; | |
5983 if (tem >= 0) | |
5984 return tem; | |
5985 return EVENT_BUFFER_SIZE + tem; | |
5986 } | |
5987 | |
5988 /* Return nonzero if mouse input is pending. */ | |
5989 | |
5990 int | |
5991 mouse_event_pending_p () | |
5992 { | |
5993 return queue_event_count (&x_mouse_queue); | |
5994 } | |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
5995 #endif /* HAVE_X11 */ |
286 | 5996 |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
5997 /* Setting window manager hints. */ |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
5998 |
286 | 5999 #ifdef HAVE_X11 |
6000 | |
7210
682ff6213c36
(x_wm_set_size_hint): Always set PWinGravity.
Richard M. Stallman <rms@gnu.org>
parents:
7187
diff
changeset
|
6001 /* Set the normal size hints for the window manager, for frame F. |
682ff6213c36
(x_wm_set_size_hint): Always set PWinGravity.
Richard M. Stallman <rms@gnu.org>
parents:
7187
diff
changeset
|
6002 FLAGS is the flags word to use--or 0 meaning preserve the flags |
682ff6213c36
(x_wm_set_size_hint): Always set PWinGravity.
Richard M. Stallman <rms@gnu.org>
parents:
7187
diff
changeset
|
6003 that the window now has. |
682ff6213c36
(x_wm_set_size_hint): Always set PWinGravity.
Richard M. Stallman <rms@gnu.org>
parents:
7187
diff
changeset
|
6004 If USER_POSITION is nonzero, we set the USPosition |
682ff6213c36
(x_wm_set_size_hint): Always set PWinGravity.
Richard M. Stallman <rms@gnu.org>
parents:
7187
diff
changeset
|
6005 flag (this is useful when FLAGS is 0). */ |
682ff6213c36
(x_wm_set_size_hint): Always set PWinGravity.
Richard M. Stallman <rms@gnu.org>
parents:
7187
diff
changeset
|
6006 |
682ff6213c36
(x_wm_set_size_hint): Always set PWinGravity.
Richard M. Stallman <rms@gnu.org>
parents:
7187
diff
changeset
|
6007 x_wm_set_size_hint (f, flags, user_position) |
771 | 6008 struct frame *f; |
7210
682ff6213c36
(x_wm_set_size_hint): Always set PWinGravity.
Richard M. Stallman <rms@gnu.org>
parents:
7187
diff
changeset
|
6009 long flags; |
682ff6213c36
(x_wm_set_size_hint): Always set PWinGravity.
Richard M. Stallman <rms@gnu.org>
parents:
7187
diff
changeset
|
6010 int user_position; |
286 | 6011 { |
6012 XSizeHints size_hints; | |
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
6013 |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
6014 #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
|
6015 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
|
6016 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
|
6017 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
|
6018 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
|
6019 #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
|
6020 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
|
6021 #endif /* not USE_X_TOOLKIT */ |
286 | 6022 |
7187
ca0102511d80
(x_wm_set_size_hint): Don't set PMaxSize.
Richard M. Stallman <rms@gnu.org>
parents:
7169
diff
changeset
|
6023 /* Setting PMaxSize caused various problems. */ |
ca0102511d80
(x_wm_set_size_hint): Don't set PMaxSize.
Richard M. Stallman <rms@gnu.org>
parents:
7169
diff
changeset
|
6024 size_hints.flags = PResizeInc | PMinSize /* | PMaxSize */; |
286 | 6025 |
771 | 6026 flexlines = f->height; |
6027 | |
6028 size_hints.x = f->display.x->left_pos; | |
6029 size_hints.y = f->display.x->top_pos; | |
7123
4f2c825cc0f8
(x_wm_set_size_hint): Do set max_height, max_width, and PMaxSize flag.
Richard M. Stallman <rms@gnu.org>
parents:
7122
diff
changeset
|
6030 |
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
|
6031 #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
|
6032 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
|
6033 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
|
6034 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
|
6035 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
|
6036 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
|
6037 #else /* not USE_X_TOOLKIT */ |
771 | 6038 size_hints.height = PIXEL_HEIGHT (f); |
6039 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
|
6040 #endif /* not USE_X_TOOLKIT */ |
7123
4f2c825cc0f8
(x_wm_set_size_hint): Do set max_height, max_width, and PMaxSize flag.
Richard M. Stallman <rms@gnu.org>
parents:
7122
diff
changeset
|
6041 |
771 | 6042 size_hints.width_inc = FONT_WIDTH (f->display.x->font); |
6767
8fbcee1c2059
(stufflines, scraplines, dumprectangle, x_do_pending_expose)
Richard M. Stallman <rms@gnu.org>
parents:
6757
diff
changeset
|
6043 size_hints.height_inc = f->display.x->line_height; |
7123
4f2c825cc0f8
(x_wm_set_size_hint): Do set max_height, max_width, and PMaxSize flag.
Richard M. Stallman <rms@gnu.org>
parents:
7122
diff
changeset
|
6044 size_hints.max_width = x_screen_width - CHAR_TO_PIXEL_WIDTH (f, 0); |
4f2c825cc0f8
(x_wm_set_size_hint): Do set max_height, max_width, and PMaxSize flag.
Richard M. Stallman <rms@gnu.org>
parents:
7122
diff
changeset
|
6045 size_hints.max_height = x_screen_height - CHAR_TO_PIXEL_HEIGHT (f, 0); |
6883
77ceede38423
(x_make_frame_visible): Don't call XMapSubwindows.
Richard M. Stallman <rms@gnu.org>
parents:
6791
diff
changeset
|
6046 |
976
cbdfc337ec8f
* xterm.c (x_wm_hints): New variable.
Jim Blandy <jimb@redhat.com>
parents:
786
diff
changeset
|
6047 { |
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
|
6048 int base_width, base_height; |
6883
77ceede38423
(x_make_frame_visible): Don't call XMapSubwindows.
Richard M. Stallman <rms@gnu.org>
parents:
6791
diff
changeset
|
6049 int min_rows = 0, min_cols = 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
|
6050 |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
6051 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
|
6052 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
|
6053 |
6883
77ceede38423
(x_make_frame_visible): Don't call XMapSubwindows.
Richard M. Stallman <rms@gnu.org>
parents:
6791
diff
changeset
|
6054 check_frame_size (f, &min_rows, &min_cols); |
77ceede38423
(x_make_frame_visible): Don't call XMapSubwindows.
Richard M. Stallman <rms@gnu.org>
parents:
6791
diff
changeset
|
6055 |
77ceede38423
(x_make_frame_visible): Don't call XMapSubwindows.
Richard M. Stallman <rms@gnu.org>
parents:
6791
diff
changeset
|
6056 /* The window manager uses the base width hints to calculate the |
77ceede38423
(x_make_frame_visible): Don't call XMapSubwindows.
Richard M. Stallman <rms@gnu.org>
parents:
6791
diff
changeset
|
6057 current number of rows and columns in the frame while |
77ceede38423
(x_make_frame_visible): Don't call XMapSubwindows.
Richard M. Stallman <rms@gnu.org>
parents:
6791
diff
changeset
|
6058 resizing; min_width and min_height aren't useful for this |
77ceede38423
(x_make_frame_visible): Don't call XMapSubwindows.
Richard M. Stallman <rms@gnu.org>
parents:
6791
diff
changeset
|
6059 purpose, since they might not give the dimensions for a |
77ceede38423
(x_make_frame_visible): Don't call XMapSubwindows.
Richard M. Stallman <rms@gnu.org>
parents:
6791
diff
changeset
|
6060 zero-row, zero-column frame. |
77ceede38423
(x_make_frame_visible): Don't call XMapSubwindows.
Richard M. Stallman <rms@gnu.org>
parents:
6791
diff
changeset
|
6061 |
77ceede38423
(x_make_frame_visible): Don't call XMapSubwindows.
Richard M. Stallman <rms@gnu.org>
parents:
6791
diff
changeset
|
6062 We use the base_width and base_height members if we have |
77ceede38423
(x_make_frame_visible): Don't call XMapSubwindows.
Richard M. Stallman <rms@gnu.org>
parents:
6791
diff
changeset
|
6063 them; otherwise, we set the min_width and min_height members |
77ceede38423
(x_make_frame_visible): Don't call XMapSubwindows.
Richard M. Stallman <rms@gnu.org>
parents:
6791
diff
changeset
|
6064 to the size for a zero x zero frame. */ |
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
|
6065 |
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
6066 #ifdef HAVE_X11R4 |
6883
77ceede38423
(x_make_frame_visible): Don't call XMapSubwindows.
Richard M. Stallman <rms@gnu.org>
parents:
6791
diff
changeset
|
6067 size_hints.flags |= PBaseSize; |
77ceede38423
(x_make_frame_visible): Don't call XMapSubwindows.
Richard M. Stallman <rms@gnu.org>
parents:
6791
diff
changeset
|
6068 size_hints.base_width = base_width; |
77ceede38423
(x_make_frame_visible): Don't call XMapSubwindows.
Richard M. Stallman <rms@gnu.org>
parents:
6791
diff
changeset
|
6069 size_hints.base_height = base_height; |
77ceede38423
(x_make_frame_visible): Don't call XMapSubwindows.
Richard M. Stallman <rms@gnu.org>
parents:
6791
diff
changeset
|
6070 size_hints.min_width = base_width + min_cols * size_hints.width_inc; |
77ceede38423
(x_make_frame_visible): Don't call XMapSubwindows.
Richard M. Stallman <rms@gnu.org>
parents:
6791
diff
changeset
|
6071 size_hints.min_height = base_height + min_rows * size_hints.height_inc; |
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
|
6072 #else |
6883
77ceede38423
(x_make_frame_visible): Don't call XMapSubwindows.
Richard M. Stallman <rms@gnu.org>
parents:
6791
diff
changeset
|
6073 size_hints.min_width = base_width; |
77ceede38423
(x_make_frame_visible): Don't call XMapSubwindows.
Richard M. Stallman <rms@gnu.org>
parents:
6791
diff
changeset
|
6074 size_hints.min_height = base_height; |
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
|
6075 #endif |
976
cbdfc337ec8f
* xterm.c (x_wm_hints): New variable.
Jim Blandy <jimb@redhat.com>
parents:
786
diff
changeset
|
6076 } |
286 | 6077 |
7210
682ff6213c36
(x_wm_set_size_hint): Always set PWinGravity.
Richard M. Stallman <rms@gnu.org>
parents:
7187
diff
changeset
|
6078 if (flags) |
682ff6213c36
(x_wm_set_size_hint): Always set PWinGravity.
Richard M. Stallman <rms@gnu.org>
parents:
7187
diff
changeset
|
6079 size_hints.flags |= flags; |
286 | 6080 else |
6081 { | |
6082 XSizeHints hints; /* Sometimes I hate X Windows... */ | |
7210
682ff6213c36
(x_wm_set_size_hint): Always set PWinGravity.
Richard M. Stallman <rms@gnu.org>
parents:
7187
diff
changeset
|
6083 long supplied_return; |
682ff6213c36
(x_wm_set_size_hint): Always set PWinGravity.
Richard M. Stallman <rms@gnu.org>
parents:
7187
diff
changeset
|
6084 int value; |
682ff6213c36
(x_wm_set_size_hint): Always set PWinGravity.
Richard M. Stallman <rms@gnu.org>
parents:
7187
diff
changeset
|
6085 |
682ff6213c36
(x_wm_set_size_hint): Always set PWinGravity.
Richard M. Stallman <rms@gnu.org>
parents:
7187
diff
changeset
|
6086 #ifdef HAVE_X11R4 |
682ff6213c36
(x_wm_set_size_hint): Always set PWinGravity.
Richard M. Stallman <rms@gnu.org>
parents:
7187
diff
changeset
|
6087 value = XGetWMNormalHints (x_current_display, window, &hints, |
682ff6213c36
(x_wm_set_size_hint): Always set PWinGravity.
Richard M. Stallman <rms@gnu.org>
parents:
7187
diff
changeset
|
6088 &supplied_return); |
682ff6213c36
(x_wm_set_size_hint): Always set PWinGravity.
Richard M. Stallman <rms@gnu.org>
parents:
7187
diff
changeset
|
6089 #else |
682ff6213c36
(x_wm_set_size_hint): Always set PWinGravity.
Richard M. Stallman <rms@gnu.org>
parents:
7187
diff
changeset
|
6090 value = XGetNormalHints (x_current_display, window, &hints); |
682ff6213c36
(x_wm_set_size_hint): Always set PWinGravity.
Richard M. Stallman <rms@gnu.org>
parents:
7187
diff
changeset
|
6091 #endif |
286 | 6092 |
7210
682ff6213c36
(x_wm_set_size_hint): Always set PWinGravity.
Richard M. Stallman <rms@gnu.org>
parents:
7187
diff
changeset
|
6093 if (value == 0) |
3444
2a646c40a4cf
(x_wm_set_size_hint): Handle XGetNormalHints returning 0.
Richard M. Stallman <rms@gnu.org>
parents:
3369
diff
changeset
|
6094 hints.flags = 0; |
286 | 6095 if (hints.flags & PSize) |
6096 size_hints.flags |= PSize; | |
6097 if (hints.flags & PPosition) | |
6098 size_hints.flags |= PPosition; | |
6099 if (hints.flags & USPosition) | |
6100 size_hints.flags |= USPosition; | |
6101 if (hints.flags & USSize) | |
6102 size_hints.flags |= USSize; | |
6103 } | |
6883
77ceede38423
(x_make_frame_visible): Don't call XMapSubwindows.
Richard M. Stallman <rms@gnu.org>
parents:
6791
diff
changeset
|
6104 |
7210
682ff6213c36
(x_wm_set_size_hint): Always set PWinGravity.
Richard M. Stallman <rms@gnu.org>
parents:
7187
diff
changeset
|
6105 #ifdef PWinGravity |
6934
e0ab4f59004e
(dumpglyphs): When HL=2, check explicitly for using
Richard M. Stallman <rms@gnu.org>
parents:
6883
diff
changeset
|
6106 size_hints.win_gravity = f->display.x->win_gravity; |
7210
682ff6213c36
(x_wm_set_size_hint): Always set PWinGravity.
Richard M. Stallman <rms@gnu.org>
parents:
7187
diff
changeset
|
6107 size_hints.flags |= PWinGravity; |
682ff6213c36
(x_wm_set_size_hint): Always set PWinGravity.
Richard M. Stallman <rms@gnu.org>
parents:
7187
diff
changeset
|
6108 |
682ff6213c36
(x_wm_set_size_hint): Always set PWinGravity.
Richard M. Stallman <rms@gnu.org>
parents:
7187
diff
changeset
|
6109 if (user_position) |
4630
70247ce8b381
(x_wm_set_size_hint): New args spec_x and spec_y.
Richard M. Stallman <rms@gnu.org>
parents:
4493
diff
changeset
|
6110 { |
7210
682ff6213c36
(x_wm_set_size_hint): Always set PWinGravity.
Richard M. Stallman <rms@gnu.org>
parents:
7187
diff
changeset
|
6111 size_hints.flags &= ~ PPosition; |
682ff6213c36
(x_wm_set_size_hint): Always set PWinGravity.
Richard M. Stallman <rms@gnu.org>
parents:
7187
diff
changeset
|
6112 size_hints.flags |= USPosition; |
4630
70247ce8b381
(x_wm_set_size_hint): New args spec_x and spec_y.
Richard M. Stallman <rms@gnu.org>
parents:
4493
diff
changeset
|
6113 } |
4777
21ed9c9bb210
(w_wn_set_size_hint): Make recent window gravity addition
Brian Fox <bfox@gnu.org>
parents:
4696
diff
changeset
|
6114 #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
|
6115 |
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
|
6116 #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
|
6117 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
|
6118 #else |
286 | 6119 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
|
6120 #endif |
286 | 6121 } |
6122 | |
6123 /* Used for IconicState or NormalState */ | |
771 | 6124 x_wm_set_window_state (f, state) |
6125 struct frame *f; | |
286 | 6126 int state; |
6127 { | |
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
6128 #ifdef USE_X_TOOLKIT |
7602
136819b017fc
(x_wm_set_window_state) [USE_X_TOOLKIT]: Use XtSetValues.
Richard M. Stallman <rms@gnu.org>
parents:
7508
diff
changeset
|
6129 Arg al[1]; |
136819b017fc
(x_wm_set_window_state) [USE_X_TOOLKIT]: Use XtSetValues.
Richard M. Stallman <rms@gnu.org>
parents:
7508
diff
changeset
|
6130 |
136819b017fc
(x_wm_set_window_state) [USE_X_TOOLKIT]: Use XtSetValues.
Richard M. Stallman <rms@gnu.org>
parents:
7508
diff
changeset
|
6131 XtSetArg (al[0], XtNinitialState, state); |
136819b017fc
(x_wm_set_window_state) [USE_X_TOOLKIT]: Use XtSetValues.
Richard M. Stallman <rms@gnu.org>
parents:
7508
diff
changeset
|
6132 XtSetValues (f->display.x->widget, al, 1); |
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
6133 #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
|
6134 Window window = FRAME_X_WINDOW (f); |
286 | 6135 |
1020
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
6136 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
|
6137 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
|
6138 |
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
6139 XSetWMHints (x_current_display, window, &f->display.x->wm_hints); |
7602
136819b017fc
(x_wm_set_window_state) [USE_X_TOOLKIT]: Use XtSetValues.
Richard M. Stallman <rms@gnu.org>
parents:
7508
diff
changeset
|
6140 #endif /* not USE_X_TOOLKIT */ |
286 | 6141 } |
6142 | |
771 | 6143 x_wm_set_icon_pixmap (f, icon_pixmap) |
6144 struct frame *f; | |
286 | 6145 Pixmap icon_pixmap; |
6146 { | |
7806
ef7a60d59543
(x_wm_set_icon_position, x_wm_set_icon_pixmap):
Richard M. Stallman <rms@gnu.org>
parents:
7801
diff
changeset
|
6147 #ifdef USE_X_TOOLKIT |
ef7a60d59543
(x_wm_set_icon_position, x_wm_set_icon_pixmap):
Richard M. Stallman <rms@gnu.org>
parents:
7801
diff
changeset
|
6148 Window window = XtWindow (f->display.x->widget); |
ef7a60d59543
(x_wm_set_icon_position, x_wm_set_icon_pixmap):
Richard M. Stallman <rms@gnu.org>
parents:
7801
diff
changeset
|
6149 #else |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
6150 Window window = FRAME_X_WINDOW (f); |
7806
ef7a60d59543
(x_wm_set_icon_position, x_wm_set_icon_pixmap):
Richard M. Stallman <rms@gnu.org>
parents:
7801
diff
changeset
|
6151 #endif |
286 | 6152 |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
6153 if (icon_pixmap) |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
6154 { |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
6155 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
|
6156 f->display.x->wm_hints.flags |= IconPixmapHint; |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
6157 } |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
6158 else |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
6159 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
|
6160 |
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
6161 XSetWMHints (x_current_display, window, &f->display.x->wm_hints); |
286 | 6162 } |
6163 | |
771 | 6164 x_wm_set_icon_position (f, icon_x, icon_y) |
6165 struct frame *f; | |
286 | 6166 int icon_x, icon_y; |
6167 { | |
7806
ef7a60d59543
(x_wm_set_icon_position, x_wm_set_icon_pixmap):
Richard M. Stallman <rms@gnu.org>
parents:
7801
diff
changeset
|
6168 #ifdef USE_X_TOOLKIT |
ef7a60d59543
(x_wm_set_icon_position, x_wm_set_icon_pixmap):
Richard M. Stallman <rms@gnu.org>
parents:
7801
diff
changeset
|
6169 Window window = XtWindow (f->display.x->widget); |
ef7a60d59543
(x_wm_set_icon_position, x_wm_set_icon_pixmap):
Richard M. Stallman <rms@gnu.org>
parents:
7801
diff
changeset
|
6170 #else |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
6171 Window window = FRAME_X_WINDOW (f); |
7806
ef7a60d59543
(x_wm_set_icon_position, x_wm_set_icon_pixmap):
Richard M. Stallman <rms@gnu.org>
parents:
7801
diff
changeset
|
6172 #endif |
286 | 6173 |
1020
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
6174 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
|
6175 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
|
6176 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
|
6177 |
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
6178 XSetWMHints (x_current_display, window, &f->display.x->wm_hints); |
286 | 6179 } |
6180 | |
6181 | |
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
6182 /* Initialization. */ |
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
6183 |
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
6184 #ifdef USE_X_TOOLKIT |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
6185 static XrmOptionDescRec emacs_options[] = { |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
6186 {"-geometry", ".geometry", XrmoptionSepArg, NULL}, |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
6187 {"-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
|
6188 |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
6189 {"-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
|
6190 XrmoptionSepArg, NULL}, |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
6191 {"-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
|
6192 |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
6193 {"-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
|
6194 {"-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
|
6195 {"-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
|
6196 {"-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
|
6197 {"-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
|
6198 {"-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
|
6199 {"-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
|
6200 }; |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
6201 #endif /* USE_X_TOOLKIT */ |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
6202 |
286 | 6203 void |
7801
10e818a0248a
(x_term_init): New args xrm_option and resource_string.
Richard M. Stallman <rms@gnu.org>
parents:
7738
diff
changeset
|
6204 x_term_init (display_name, xrm_option, resource_name) |
286 | 6205 char *display_name; |
7801
10e818a0248a
(x_term_init): New args xrm_option and resource_string.
Richard M. Stallman <rms@gnu.org>
parents:
7738
diff
changeset
|
6206 char *xrm_option; |
10e818a0248a
(x_term_init): New args xrm_option and resource_string.
Richard M. Stallman <rms@gnu.org>
parents:
7738
diff
changeset
|
6207 char *resource_name; |
286 | 6208 { |
771 | 6209 Lisp_Object frame; |
286 | 6210 char *defaultvalue; |
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
6211 int argc = 0; |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
6212 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
|
6213 #ifndef F_SETOWN_BUG |
286 | 6214 #ifdef F_SETOWN |
6215 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
|
6216 #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
|
6217 #endif /* F_SETOWN_BUG */ |
369 | 6218 |
7916
50e9e0c8806a
(x_noop_count): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7905
diff
changeset
|
6219 x_noop_count = 0; |
50e9e0c8806a
(x_noop_count): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
7905
diff
changeset
|
6220 |
771 | 6221 x_focus_frame = x_highlight_frame = 0; |
286 | 6222 |
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
6223 #ifdef USE_X_TOOLKIT |
7801
10e818a0248a
(x_term_init): New args xrm_option and resource_string.
Richard M. Stallman <rms@gnu.org>
parents:
7738
diff
changeset
|
6224 argv = (char **) XtMalloc (7 * sizeof (char *)); |
10e818a0248a
(x_term_init): New args xrm_option and resource_string.
Richard M. Stallman <rms@gnu.org>
parents:
7738
diff
changeset
|
6225 argv[0] = ""; |
10e818a0248a
(x_term_init): New args xrm_option and resource_string.
Richard M. Stallman <rms@gnu.org>
parents:
7738
diff
changeset
|
6226 argv[1] = "-display"; |
10e818a0248a
(x_term_init): New args xrm_option and resource_string.
Richard M. Stallman <rms@gnu.org>
parents:
7738
diff
changeset
|
6227 argv[2] = display_name; |
10e818a0248a
(x_term_init): New args xrm_option and resource_string.
Richard M. Stallman <rms@gnu.org>
parents:
7738
diff
changeset
|
6228 argv[3] = "-name"; |
10e818a0248a
(x_term_init): New args xrm_option and resource_string.
Richard M. Stallman <rms@gnu.org>
parents:
7738
diff
changeset
|
6229 /* Usually `emacs', but not always. */ |
10e818a0248a
(x_term_init): New args xrm_option and resource_string.
Richard M. Stallman <rms@gnu.org>
parents:
7738
diff
changeset
|
6230 argv[4] = resource_name; |
6941
a914781ef58a
(Xatom_editres_name): Variable defined.
Richard M. Stallman <rms@gnu.org>
parents:
6934
diff
changeset
|
6231 argc = 5; |
7801
10e818a0248a
(x_term_init): New args xrm_option and resource_string.
Richard M. Stallman <rms@gnu.org>
parents:
7738
diff
changeset
|
6232 if (xrm_option) |
10e818a0248a
(x_term_init): New args xrm_option and resource_string.
Richard M. Stallman <rms@gnu.org>
parents:
7738
diff
changeset
|
6233 { |
10e818a0248a
(x_term_init): New args xrm_option and resource_string.
Richard M. Stallman <rms@gnu.org>
parents:
7738
diff
changeset
|
6234 argv[argc++] = "-xrm"; |
10e818a0248a
(x_term_init): New args xrm_option and resource_string.
Richard M. Stallman <rms@gnu.org>
parents:
7738
diff
changeset
|
6235 argv[argc++] = xrm_option; |
10e818a0248a
(x_term_init): New args xrm_option and resource_string.
Richard M. Stallman <rms@gnu.org>
parents:
7738
diff
changeset
|
6236 } |
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
6237 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
|
6238 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
|
6239 &argc, argv, |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
6240 NULL, NULL, 0); |
7100
3aaa031a8fe4
(x_term_init): Add explicit cast.
Karl Heuer <kwzh@gnu.org>
parents:
7093
diff
changeset
|
6241 XtFree ((char *)argv); |
5672
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
6242 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
|
6243 |
cbc4229c1f90
(x_wm_set_size_hint): Swap southeast and northwest.
Richard M. Stallman <rms@gnu.org>
parents:
5362
diff
changeset
|
6244 #else /* not USE_X_TOOLKIT */ |
286 | 6245 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
|
6246 #endif /* not USE_X_TOOLKIT */ |
286 | 6247 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
|
6248 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
|
6249 Check the DISPLAY environment variable or use \"-d\"\n", |
286 | 6250 display_name); |
6251 | |
6252 #ifdef HAVE_X11 | |
6253 { | |
6254 #if 0 | |
6255 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
|
6256 #endif /* ! 0 */ |
2279
012b04efa234
* emacs.c (Finvocation_name): New function.
Jim Blandy <jimb@redhat.com>
parents:
2235
diff
changeset
|
6257 x_id_name = (char *) xmalloc (XSTRING (Vinvocation_name)->size |
7905
cbc288be9c89
(x_term_init): Don't call get_system_name.
Karl Heuer <kwzh@gnu.org>
parents:
7902
diff
changeset
|
6258 + XSTRING (Vsystem_name)->size |
398 | 6259 + 2); |
7905
cbc288be9c89
(x_term_init): Don't call get_system_name.
Karl Heuer <kwzh@gnu.org>
parents:
7902
diff
changeset
|
6260 sprintf (x_id_name, "%s@%s", |
cbc288be9c89
(x_term_init): Don't call get_system_name.
Karl Heuer <kwzh@gnu.org>
parents:
7902
diff
changeset
|
6261 XSTRING (Vinvocation_name)->data, XSTRING (Vsystem_name)->data); |
286 | 6262 } |
1279
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
6263 |
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
6264 /* 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
|
6265 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
|
6266 |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
6267 /* Get the scroll bar cursor. */ |
2195
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
6268 x_vertical_scroll_bar_cursor |
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
6269 = 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
|
6270 |
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
6271 #if 0 |
1279
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
6272 /* 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
|
6273 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
|
6274 x_watch_cut_buffer_cache (); |
2195
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
6275 #endif |
1279
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
6276 |
2285
f0a979beceab
* xterm.c (x_term_init): If the X connection is already in file
Jim Blandy <jimb@redhat.com>
parents:
2279
diff
changeset
|
6277 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
|
6278 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
|
6279 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
|
6280 |
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
6281 #endif /* ! defined (HAVE_X11) */ |
286 | 6282 |
4147
c6657758fb6f
* xterm.c (x_term_init): Adjust message printed when we can't
Jim Blandy <jimb@redhat.com>
parents:
3951
diff
changeset
|
6283 #ifndef F_SETOWN_BUG |
286 | 6284 #ifdef F_SETOWN |
4683
6a5197116086
(x_term_init): Call change_keyboard_wait_descriptor,
Richard M. Stallman <rms@gnu.org>
parents:
4630
diff
changeset
|
6285 old_fcntl_owner = fcntl (ConnectionNumber (x_current_display), F_GETOWN, 0); |
286 | 6286 #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
|
6287 /* stdin is a socket here */ |
6a5197116086
(x_term_init): Call change_keyboard_wait_descriptor,
Richard M. Stallman <rms@gnu.org>
parents:
4630
diff
changeset
|
6288 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
|
6289 #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
|
6290 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
|
6291 #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
|
6292 #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
|
6293 #endif /* F_SETOWN_BUG */ |
286 | 6294 |
6295 #ifdef SIGIO | |
6296 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
|
6297 #endif /* ! defined (SIGIO) */ |
286 | 6298 |
6299 expose_all_windows = 0; | |
6300 | |
771 | 6301 clear_frame_hook = XTclear_frame; |
286 | 6302 clear_end_of_line_hook = XTclear_end_of_line; |
6303 ins_del_lines_hook = XTins_del_lines; | |
6304 change_line_highlight_hook = XTchange_line_highlight; | |
6305 insert_glyphs_hook = XTinsert_glyphs; | |
6306 write_glyphs_hook = XTwrite_glyphs; | |
6307 delete_glyphs_hook = XTdelete_glyphs; | |
6308 ring_bell_hook = XTring_bell; | |
6309 reset_terminal_modes_hook = XTreset_terminal_modes; | |
6310 set_terminal_modes_hook = XTset_terminal_modes; | |
6311 update_begin_hook = XTupdate_begin; | |
6312 update_end_hook = XTupdate_end; | |
6313 set_terminal_window_hook = XTset_terminal_window; | |
6314 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
|
6315 frame_up_to_date_hook = XTframe_up_to_date; |
286 | 6316 cursor_to_hook = XTcursor_to; |
6317 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
|
6318 mouse_position_hook = XTmouse_position; |
771 | 6319 frame_rehighlight_hook = XTframe_rehighlight; |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
6320 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
|
6321 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
|
6322 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
|
6323 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
|
6324 judge_scroll_bars_hook = XTjudge_scroll_bars; |
286 | 6325 |
771 | 6326 scroll_region_ok = 1; /* we'll scroll partial frames */ |
286 | 6327 char_ins_del_ok = 0; /* just as fast to write the line */ |
6328 line_ins_del_ok = 1; /* we'll just blt 'em */ | |
6329 fast_clear_end_of_line = 1; /* X does this well */ | |
771 | 6330 memory_below_frame = 0; /* we don't remember what scrolls |
286 | 6331 off the bottom */ |
6332 baud_rate = 19200; | |
6333 | |
4476
e7de1b007447
(x_term_init): Set the hooks before we call Fset_input_mode.
Richard M. Stallman <rms@gnu.org>
parents:
4304
diff
changeset
|
6334 /* 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
|
6335 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
|
6336 |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
6337 /* 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
|
6338 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
|
6339 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
|
6340 XHandleIOError (x_io_error_quitter); |
286 | 6341 |
6342 /* Disable Window Change signals; they are handled by X events. */ | |
6343 #ifdef SIGWINCH | |
6344 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
|
6345 #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
|
6346 |
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
6347 signal (SIGPIPE, x_connection_closed); |
286 | 6348 } |
395 | 6349 |
6350 void | |
6351 syms_of_xterm () | |
6352 { | |
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
6353 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
|
6354 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
|
6355 staticpro (&mouse_face_window); |
951c8941b931
[INCLUDED_FCNTL]: Don't include fcntl.h again.
Richard M. Stallman <rms@gnu.org>
parents:
6560
diff
changeset
|
6356 mouse_face_window = Qnil; |
395 | 6357 } |
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
6358 #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
|
6359 #endif /* ! defined (HAVE_X_WINDOWS) */ |