Mercurial > emacs
annotate src/xterm.c @ 2809:8d00a436bfcc
original log message lost to overeager RCS user -JimB
| author | Jim Blandy <jimb@redhat.com> |
|---|---|
| date | Sat, 15 May 1993 21:38:29 +0000 |
| parents | 55e9c556bbf8 |
| children | 12299f73584e |
| rev | line source |
|---|---|
| 286 | 1 /* X Communication module for terminals which understand the X protocol. |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2 Copyright (C) 1989, 1992, 1993 Free Software Foundation, Inc. |
| 286 | 3 |
| 4 This file is part of GNU Emacs. | |
| 5 | |
| 6 GNU Emacs is free software; you can redistribute it and/or modify | |
| 7 it under the terms of the GNU General Public License as published by | |
| 621 | 8 the Free Software Foundation; either version 2, or (at your option) |
| 286 | 9 any later version. |
| 10 | |
| 11 GNU Emacs is distributed in the hope that it will be useful, | |
| 12 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 14 GNU General Public License for more details. | |
| 15 | |
| 16 You should have received a copy of the GNU General Public License | |
| 17 along with GNU Emacs; see the file COPYING. If not, write to | |
| 18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
| 19 | |
| 20 /* Serious problems: | |
| 21 | |
| 22 Kludge: dup2 is used to put the X-connection socket into desc # 0 | |
| 23 so that wait_reading_process_input will wait for it in place of | |
| 24 actual terminal input. | |
| 25 | |
| 26 */ | |
| 27 | |
|
2195
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
28 #define NEW_SELECTIONS |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
29 |
| 286 | 30 #include "config.h" |
| 31 | |
| 32 #ifdef HAVE_X_WINDOWS | |
| 33 | |
| 34 #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
|
35 #include "blockinput.h" |
| 286 | 36 |
|
1389
517c3893ec5b
* xterm.c, xrdb.c: #include <stdio.h> before "xterm.h", to avoid
Jim Blandy <jimb@redhat.com>
parents:
1324
diff
changeset
|
37 /* On 4.3 these lose if they come after xterm.h. */ |
|
517c3893ec5b
* xterm.c, xrdb.c: #include <stdio.h> before "xterm.h", to avoid
Jim Blandy <jimb@redhat.com>
parents:
1324
diff
changeset
|
38 #include <stdio.h> |
| 286 | 39 #include <signal.h> |
| 40 | |
| 41 /* This may include sys/types.h, and that somehow loses | |
| 42 if this is not done before the other system files. */ | |
| 43 #include "xterm.h" | |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
44 #include <X11/cursorfont.h> |
| 286 | 45 |
|
1020
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
46 #ifndef USG |
| 286 | 47 /* Load sys/types.h if not already loaded. |
| 48 In some systems loading it twice is suicidal. */ | |
| 49 #ifndef makedev | |
| 50 #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
|
51 #endif /* makedev */ |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
52 #endif /* USG */ |
| 286 | 53 |
| 54 #ifdef BSD | |
| 55 #include <sys/ioctl.h> | |
| 56 #include <strings.h> | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
57 #else /* ! defined (BSD) */ |
|
2353
ec8d40776ff1
* xterm.c [VMS]: Don't #include <sys/termio.h> and <string.h>.
Jim Blandy <jimb@redhat.com>
parents:
2285
diff
changeset
|
58 #ifndef VMS |
| 286 | 59 #include <sys/termio.h> |
| 60 #include <string.h> | |
|
2353
ec8d40776ff1
* xterm.c [VMS]: Don't #include <sys/termio.h> and <string.h>.
Jim Blandy <jimb@redhat.com>
parents:
2285
diff
changeset
|
61 #endif |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
62 #endif /* ! defined (BSD) */ |
| 286 | 63 |
| 64 /* Allow m- file to inhibit use of FIONREAD. */ | |
| 65 #ifdef BROKEN_FIONREAD | |
| 66 #undef FIONREAD | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
67 #endif /* ! defined (BROKEN_FIONREAD) */ |
| 286 | 68 |
| 69 /* We are unable to use interrupts if FIONREAD is not available, | |
| 70 so flush SIGIO so we won't try. */ | |
| 71 #ifndef FIONREAD | |
| 72 #ifdef SIGIO | |
| 73 #undef SIGIO | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
74 #endif /* ! defined (SIGIO) */ |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
75 #endif /* FIONREAD */ |
| 286 | 76 |
| 555 | 77 #include "systime.h" |
| 286 | 78 |
| 79 #include <fcntl.h> | |
| 80 #include <ctype.h> | |
| 81 #include <errno.h> | |
| 82 #include <setjmp.h> | |
| 83 #include <sys/stat.h> | |
| 84 #include <sys/param.h> | |
| 85 | |
| 86 #include "dispextern.h" | |
| 87 #include "termhooks.h" | |
| 88 #include "termopts.h" | |
| 89 #include "termchar.h" | |
| 90 #if 0 | |
| 91 #include "sink.h" | |
| 92 #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
|
93 #endif /* ! 0 */ |
| 286 | 94 #include "gnu.h" |
| 771 | 95 #include "frame.h" |
| 286 | 96 #include "disptab.h" |
| 97 #include "buffer.h" | |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
98 #include "window.h" |
| 286 | 99 |
| 100 #ifdef HAVE_X11 | |
| 101 #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
|
102 #else /* ! defined (HAVE_X11) */ |
| 286 | 103 #include <X/Xkeyboard.h> |
| 104 /*#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
|
105 #endif /* ! defined (HAVE_X11) */ |
| 286 | 106 |
| 107 /* For sending Meta-characters. Do we need this? */ | |
| 108 #define METABIT 0200 | |
| 109 | |
| 110 #define min(a,b) ((a)<(b) ? (a) : (b)) | |
| 111 #define max(a,b) ((a)>(b) ? (a) : (b)) | |
| 112 | |
| 113 /* Nonzero means we must reprint all windows | |
| 114 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
|
115 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
|
116 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
117 This is never needed under X11. */ |
| 286 | 118 static int expose_all_windows; |
| 119 | |
| 120 /* Nonzero means we must reprint all icon windows. */ | |
| 121 | |
| 122 static int expose_all_icons; | |
| 123 | |
| 124 #ifndef HAVE_X11 | |
| 125 /* ExposeRegion events, when received, are copied into this queue | |
| 126 for later processing. */ | |
| 127 | |
| 128 static struct event_queue x_expose_queue; | |
| 129 | |
| 130 /* ButtonPressed and ButtonReleased events, when received, | |
| 131 are copied into this queue for later processing. */ | |
| 132 | |
| 133 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
|
134 #endif /* HAVE_X11 */ |
| 286 | 135 |
| 136 #if defined (SIGIO) && defined (FIONREAD) | |
| 137 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
|
138 #endif /* ! defined (SIGIO) && defined (FIONREAD) */ |
| 286 | 139 |
| 140 /* The id of a bitmap used for icon windows. | |
| 141 One such map is shared by all Emacs icon windows. | |
| 142 This is zero if we have not yet had a need to create the bitmap. */ | |
| 143 | |
| 144 static Bitmap icon_bitmap; | |
| 145 | |
| 146 /* Font used for text icons. */ | |
| 147 | |
| 148 static FONT_TYPE *icon_font_info; | |
| 149 | |
| 150 /* Stuff for dealing with the main icon title. */ | |
| 151 | |
| 152 extern Lisp_Object Vcommand_line_args; | |
| 398 | 153 char *hostname, *x_id_name; |
| 286 | 154 |
| 155 /* This is the X connection that we are using. */ | |
| 156 | |
| 157 Display *x_current_display; | |
| 158 | |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
159 /* 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
|
160 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
|
161 |
|
2474
86c8a6e08fd4
Fix typo in comment delimiter.
Richard M. Stallman <rms@gnu.org>
parents:
2468
diff
changeset
|
162 /* 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
|
163 This is set by update_begin and looked at by all the |
| 286 | 164 XT functions. It is zero while not inside an update. |
| 771 | 165 In that case, the XT functions assume that `selected_frame' |
| 166 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
|
167 extern struct frame *updating_frame; |
| 771 | 168 |
| 169 /* 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
|
170 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
|
171 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
|
172 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
|
173 x_focus_event_frame. */ |
| 771 | 174 struct frame *x_focus_frame; |
| 175 | |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
176 /* 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
|
177 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
|
178 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
|
179 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
|
180 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
|
181 |
| 771 | 182 /* The frame which currently has the visual highlight, and should get |
| 183 keyboard input (other sorts of input have the frame encoded in the | |
| 184 event). It points to the X focus frame's selected window's | |
| 185 frame. It differs from x_focus_frame when we're using a global | |
| 369 | 186 minibuffer. */ |
| 771 | 187 static struct frame *x_highlight_frame; |
| 369 | 188 |
| 286 | 189 /* From .Xdefaults, the value of "emacs.WarpMouse". If non-zero, |
| 771 | 190 mouse is moved to inside of frame when frame is de-iconified. */ |
| 286 | 191 |
| 192 static int warp_mouse_on_deiconify; | |
| 193 | |
| 194 /* During an update, maximum vpos for ins/del line operations to affect. */ | |
| 195 | |
| 196 static int flexlines; | |
| 197 | |
| 198 /* During an update, nonzero if chars output now should be highlighted. */ | |
| 199 | |
| 200 static int highlight; | |
| 201 | |
| 202 /* Nominal cursor position -- where to draw output. | |
| 203 During an update, these are different from the cursor-box position. */ | |
| 204 | |
| 205 static int curs_x; | |
| 206 static int curs_y; | |
| 207 | |
| 208 #ifdef HAVE_X11 | |
| 209 /* `t' if a mouse button is depressed. */ | |
| 210 | |
| 211 extern Lisp_Object Vmouse_depressed; | |
| 212 | |
| 213 /* Tells if a window manager is present or not. */ | |
| 214 | |
| 215 extern Lisp_Object Vx_no_window_manager; | |
| 216 | |
| 217 /* Timestamp that we requested selection data was made. */ | |
| 218 extern Time requestor_time; | |
| 219 | |
| 220 /* ID of the window requesting selection data. */ | |
| 221 extern Window requestor_window; | |
| 222 | |
| 223 /* Nonzero enables some debugging for the X interface code. */ | |
| 224 extern int _Xdebug; | |
| 225 | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
226 #else /* ! defined (HAVE_X11) */ |
| 286 | 227 |
| 228 /* Bit patterns for the mouse cursor. */ | |
| 229 | |
| 230 short MouseCursor[] = { | |
| 231 0x0000, 0x0008, 0x0018, 0x0038, | |
| 232 0x0078, 0x00f8, 0x01f8, 0x03f8, | |
| 233 0x07f8, 0x00f8, 0x00d8, 0x0188, | |
| 234 0x0180, 0x0300, 0x0300, 0x0000}; | |
| 235 | |
| 236 short MouseMask[] = { | |
| 237 0x000c, 0x001c, 0x003c, 0x007c, | |
| 238 0x00fc, 0x01fc, 0x03fc, 0x07fc, | |
| 239 0x0ffc, 0x0ffc, 0x01fc, 0x03dc, | |
| 240 0x03cc, 0x0780, 0x0780, 0x0300}; | |
| 241 | |
| 242 static short grey_bits[] = { | |
| 243 0x0005, 0x000a, 0x0005, 0x000a}; | |
| 244 | |
| 245 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
|
246 #endif /* ! defined (HAVE_X11) */ |
| 286 | 247 |
| 248 /* From time to time we get info on an Emacs window, here. */ | |
| 249 | |
| 250 static WINDOWINFO_TYPE windowinfo; | |
| 251 | |
| 252 extern int errno; | |
| 253 | |
|
2661
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
254 /* 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
|
255 extern int extra_keyboard_modifiers; |
|
338e4ffdb54b
(XTread_socket): Support extra_keyboard_modifiers.
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
256 |
| 286 | 257 extern Display *XOpenDisplay (); |
| 258 extern Window XCreateWindow (); | |
| 259 | |
| 260 extern Cursor XCreateCursor (); | |
| 261 extern FONT_TYPE *XOpenFont (); | |
| 262 | |
| 263 static void flashback (); | |
| 264 | |
| 265 #ifndef HAVE_X11 | |
| 266 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
|
267 #endif /* HAVE_X11 */ |
| 286 | 268 |
| 269 void dumpborder (); | |
| 621 | 270 static int XTcursor_to (); |
| 271 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
|
272 |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
273 |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
274 /* Starting and ending updates. |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
275 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
276 These hooks are called by update_frame at the beginning and end |
| 771 | 277 of a frame update. We record in `updating_frame' the identity |
| 278 of the frame being updated, so that the XT... functions do not | |
| 279 need to take a frame as argument. Most of the XT... functions | |
| 286 | 280 should never be called except during an update, the only exceptions |
| 281 being XTcursor_to, XTwrite_char and XTreassert_line_highlight. */ | |
| 282 | |
| 283 extern int mouse_track_top, mouse_track_left, mouse_track_width; | |
| 284 | |
| 285 static | |
| 771 | 286 XTupdate_begin (f) |
| 287 struct frame *f; | |
| 286 | 288 { |
| 289 int mask; | |
| 290 | |
| 771 | 291 if (f == 0) |
| 286 | 292 abort (); |
| 293 | |
| 771 | 294 flexlines = f->height; |
| 286 | 295 highlight = 0; |
| 296 | |
| 297 BLOCK_INPUT; | |
| 298 #ifndef HAVE_X11 | |
| 299 dumpqueue (); | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
300 #endif /* HAVE_X11 */ |
| 286 | 301 UNBLOCK_INPUT; |
| 302 } | |
| 303 | |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
304 #ifndef HAVE_X11 |
| 286 | 305 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
|
306 #endif |
| 286 | 307 |
| 308 static | |
| 771 | 309 XTupdate_end (f) |
| 310 struct frame *f; | |
| 286 | 311 { |
| 312 int mask; | |
| 313 | |
| 771 | 314 if (updating_frame == 0 |
| 315 || updating_frame != f) | |
| 286 | 316 abort (); |
| 317 | |
| 318 BLOCK_INPUT; | |
| 319 #ifndef HAVE_X11 | |
| 320 dumpqueue (); | |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
321 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
|
322 #endif /* HAVE_X11 */ |
| 286 | 323 |
| 771 | 324 x_display_cursor (f, 1); |
| 325 | |
| 286 | 326 XFlushQueue (); |
| 327 UNBLOCK_INPUT; | |
| 328 } | |
| 329 | |
| 330 /* External interface to control of standout mode. | |
| 331 Call this when about to modify line at position VPOS | |
| 332 and not change whether it is highlighted. */ | |
| 333 | |
| 334 XTreassert_line_highlight (new, vpos) | |
| 335 int new, vpos; | |
| 336 { | |
| 337 highlight = new; | |
| 338 } | |
| 339 | |
| 340 /* Call this when about to modify line at position VPOS | |
| 341 and change whether it is highlighted. */ | |
| 342 | |
| 343 static | |
| 344 XTchange_line_highlight (new_highlight, vpos, first_unused_hpos) | |
| 345 int new_highlight, vpos, first_unused_hpos; | |
| 346 { | |
| 347 highlight = new_highlight; | |
| 348 XTcursor_to (vpos, 0); | |
| 771 | 349 XTclear_end_of_line (updating_frame->width); |
| 286 | 350 } |
| 351 | |
| 352 /* This is used when starting Emacs and when restarting after suspend. | |
| 353 When starting Emacs, no X window is mapped. And nothing must be done | |
| 354 to Emacs's own window if it is suspended (though that rarely happens). */ | |
| 355 | |
| 356 static | |
| 357 XTset_terminal_modes () | |
| 358 { | |
| 359 } | |
| 360 | |
| 361 /* This is called when exiting or suspending Emacs. | |
| 362 Exiting will make the X-windows go away, and suspending | |
| 363 requires no action. */ | |
| 364 | |
| 365 static | |
| 366 XTreset_terminal_modes () | |
| 367 { | |
| 771 | 368 /* XTclear_frame (); */ |
| 286 | 369 } |
| 370 | |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
371 /* 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
|
372 This is where display update commands will take effect. |
| 286 | 373 This does not affect the place where the cursor-box is displayed. */ |
| 374 | |
| 621 | 375 static int |
| 286 | 376 XTcursor_to (row, col) |
| 377 register int row, col; | |
| 378 { | |
| 379 int mask; | |
| 380 int orow = row; | |
| 381 | |
| 382 curs_x = col; | |
| 383 curs_y = row; | |
| 384 | |
| 771 | 385 if (updating_frame == 0) |
| 286 | 386 { |
| 387 BLOCK_INPUT; | |
| 771 | 388 x_display_cursor (selected_frame, 1); |
| 286 | 389 XFlushQueue (); |
| 390 UNBLOCK_INPUT; | |
| 391 } | |
| 392 } | |
| 393 | |
| 394 /* Display a sequence of N glyphs found at GP. | |
| 395 WINDOW is the x-window to output to. LEFT and TOP are starting coords. | |
| 396 HL is 1 if this text is highlighted, 2 if the cursor is on it. | |
| 397 | |
|
2732
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
398 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
|
399 |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
400 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
|
401 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
|
402 the display structure, we can assume that the face code on each |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
403 glyph is a valid index into FRAME_FACES (f), and the one to which |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
404 we can actually apply intern_face. */ |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
405 |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
406 #if 1 |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
407 /* 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
|
408 |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
409 static void |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
410 dumpglyphs (f, left, top, gp, n, hl) |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
411 struct frame *f; |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
412 int left, top; |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
413 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
|
414 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
|
415 int hl; |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
416 { |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
417 /* Holds characters to be displayed. */ |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
418 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
|
419 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
|
420 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
|
421 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
|
422 Window window = FRAME_X_WINDOW (f); |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
423 |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
424 extern struct face *intern_face (/* FRAME_PTR, struct face * */); |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
425 |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
426 while (n > 0) |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
427 { |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
428 /* 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
|
429 int cf, len; |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
430 int g = *gp; |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
431 |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
432 GLYPH_FOLLOW_ALIASES (tbase, tlen, g); |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
433 cf = GLYPH_FACE (g); |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
434 |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
435 /* 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
|
436 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
|
437 cp = buf; |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
438 while (n > 0) |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
439 { |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
440 g = *gp; |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
441 GLYPH_FOLLOW_ALIASES (tbase, tlen, g); |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
442 if (GLYPH_FACE (g) != cf) |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
443 break; |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
444 |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
445 *cp++ = GLYPH_CHAR (g); |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
446 --n; |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
447 ++gp; |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
448 } |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
449 |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
450 /* 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
|
451 len = cp - buf; |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
452 |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
453 /* 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
|
454 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
|
455 { |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
456 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
|
457 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
|
458 GC gc = FACE_GC (face); |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
459 |
|
2785
55e9c556bbf8
* xterm.c (dumpglyphs): Give the cursor higher priority than the
Jim Blandy <jimb@redhat.com>
parents:
2732
diff
changeset
|
460 /* Cursor display take full precidence. */ |
|
55e9c556bbf8
* xterm.c (dumpglyphs): Give the cursor higher priority than the
Jim Blandy <jimb@redhat.com>
parents:
2732
diff
changeset
|
461 if (hl == 2) |
|
55e9c556bbf8
* xterm.c (dumpglyphs): Give the cursor higher priority than the
Jim Blandy <jimb@redhat.com>
parents:
2732
diff
changeset
|
462 { |
|
55e9c556bbf8
* xterm.c (dumpglyphs): Give the cursor higher priority than the
Jim Blandy <jimb@redhat.com>
parents:
2732
diff
changeset
|
463 gc = (f->display.x->cursor_gc); |
|
55e9c556bbf8
* xterm.c (dumpglyphs): Give the cursor higher priority than the
Jim Blandy <jimb@redhat.com>
parents:
2732
diff
changeset
|
464 } |
|
55e9c556bbf8
* xterm.c (dumpglyphs): Give the cursor higher priority than the
Jim Blandy <jimb@redhat.com>
parents:
2732
diff
changeset
|
465 |
|
55e9c556bbf8
* xterm.c (dumpglyphs): Give the cursor higher priority than the
Jim Blandy <jimb@redhat.com>
parents:
2732
diff
changeset
|
466 /* Then comes faces of the text itself. */ |
|
55e9c556bbf8
* xterm.c (dumpglyphs): Give the cursor higher priority than the
Jim Blandy <jimb@redhat.com>
parents:
2732
diff
changeset
|
467 else if (cf != 0) |
|
2732
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
468 { |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
469 /* The face codes on the glyphs must be valid indices into the |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
470 frame's face table. */ |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
471 if (cf < 0 || cf >= FRAME_N_FACES (f)) |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
472 abort (); |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
473 |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
474 if (cf == 1) |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
475 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
|
476 else |
|
2785
55e9c556bbf8
* xterm.c (dumpglyphs): Give the cursor higher priority than the
Jim Blandy <jimb@redhat.com>
parents:
2732
diff
changeset
|
477 face = intern_face (f, FRAME_FACES (f) [cf]); |
|
2732
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
478 font = FACE_FONT (face); |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
479 gc = FACE_GC (face); |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
480 } |
|
2785
55e9c556bbf8
* xterm.c (dumpglyphs): Give the cursor higher priority than the
Jim Blandy <jimb@redhat.com>
parents:
2732
diff
changeset
|
481 |
|
55e9c556bbf8
* xterm.c (dumpglyphs): Give the cursor higher priority than the
Jim Blandy <jimb@redhat.com>
parents:
2732
diff
changeset
|
482 /* 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
|
483 else if (hl == 0) |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
484 ; |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
485 else if (hl == 1) |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
486 { |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
487 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
|
488 font = FACE_FONT (face); |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
489 gc = FACE_GC (face); |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
490 } |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
491 |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
492 XDrawImageString (x_current_display, window, gc, |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
493 left, top + FONT_BASE (font), buf, len); |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
494 |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
495 /* 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
|
496 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
|
497 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
|
498 { |
|
2785
55e9c556bbf8
* xterm.c (dumpglyphs): Give the cursor higher priority than the
Jim Blandy <jimb@redhat.com>
parents:
2732
diff
changeset
|
499 int underline_position = 1; |
|
55e9c556bbf8
* xterm.c (dumpglyphs): Give the cursor higher priority than the
Jim Blandy <jimb@redhat.com>
parents:
2732
diff
changeset
|
500 |
|
55e9c556bbf8
* xterm.c (dumpglyphs): Give the cursor higher priority than the
Jim Blandy <jimb@redhat.com>
parents:
2732
diff
changeset
|
501 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
|
502 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
|
503 |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
504 if (face->underline) |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
505 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
|
506 FACE_GC (face), |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
507 left, (top |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
508 + FONT_BASE (font) |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
509 + underline_position), |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
510 len * FONT_WIDTH (font), 1); |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
511 } |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
512 |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
513 left += len * FONT_WIDTH (font); |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
514 } |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
515 } |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
516 } |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
517 #endif /* 1 */ |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
518 |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
519 #if 0 |
|
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
520 /* This is the old single-face code. */ |
| 286 | 521 |
| 522 static void | |
| 771 | 523 dumpglyphs (f, left, top, gp, n, hl, font) |
| 524 struct frame *f; | |
| 286 | 525 int left, top; |
| 526 register GLYPH *gp; /* Points to first GLYPH. */ | |
| 527 register int n; /* Number of glyphs to display. */ | |
| 528 int hl; | |
| 529 FONT_TYPE *font; | |
| 530 { | |
| 531 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
|
532 Window window = FRAME_X_WINDOW (f); |
| 771 | 533 GC drawing_gc = (hl == 2 ? f->display.x->cursor_gc |
| 534 : (hl ? f->display.x->reverse_gc | |
| 535 : f->display.x->normal_gc)); | |
| 286 | 536 |
| 313 | 537 if (sizeof (GLYPH) == sizeof (XChar2b)) |
| 538 XDrawImageString16 (x_current_display, window, drawing_gc, | |
| 539 left, top + FONT_BASE (font), (XChar2b *) gp, n); | |
| 540 else if (sizeof (GLYPH) == sizeof (unsigned char)) | |
| 541 XDrawImageString (x_current_display, window, drawing_gc, | |
| 542 left, top + FONT_BASE (font), (char *) gp, n); | |
| 543 else | |
| 544 /* What size of glyph ARE you using? And does X have a function to | |
| 545 draw them? */ | |
| 546 abort (); | |
| 286 | 547 } |
|
2732
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
548 #endif |
| 286 | 549 |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
550 /* 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
|
551 Advance the cursor over the text. |
| 286 | 552 Output LEN glyphs at START. |
| 553 | |
| 554 `highlight', set up by XTreassert_line_highlight or XTchange_line_highlight, | |
| 555 controls the pixel values used for foreground and background. */ | |
| 556 | |
| 557 static | |
| 558 XTwrite_glyphs (start, len) | |
| 559 register GLYPH *start; | |
| 560 int len; | |
| 561 { | |
| 562 register int temp_length; | |
| 563 int mask; | |
| 771 | 564 struct frame *f; |
| 286 | 565 |
| 566 BLOCK_INPUT; | |
| 567 | |
| 771 | 568 f = updating_frame; |
| 569 if (f == 0) | |
| 286 | 570 { |
| 771 | 571 f = selected_frame; |
| 286 | 572 /* If not within an update, |
| 771 | 573 output at the frame's visible cursor. */ |
| 574 curs_x = f->cursor_x; | |
| 575 curs_y = f->cursor_y; | |
| 286 | 576 } |
| 577 | |
| 771 | 578 dumpglyphs (f, |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
579 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
|
580 CHAR_TO_PIXEL_ROW (f, curs_y), |
|
2732
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
581 start, len, highlight); |
| 429 | 582 |
| 583 /* If we drew on top of the cursor, note that it is turned off. */ | |
| 771 | 584 if (curs_y == f->phys_cursor_y |
| 585 && curs_x <= f->phys_cursor_x | |
| 586 && curs_x + len > f->phys_cursor_x) | |
| 587 f->phys_cursor_x = -1; | |
| 286 | 588 |
| 771 | 589 if (updating_frame == 0) |
| 286 | 590 { |
| 771 | 591 f->cursor_x += len; |
| 592 x_display_cursor (f, 1); | |
| 593 f->cursor_x -= len; | |
| 286 | 594 } |
| 595 else | |
| 596 curs_x += len; | |
| 597 | |
| 598 UNBLOCK_INPUT; | |
| 599 } | |
| 600 | |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
601 /* 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
|
602 Erase the current text line from the nominal cursor position (inclusive) |
| 286 | 603 to column FIRST_UNUSED (exclusive). The idea is that everything |
| 604 from FIRST_UNUSED onward is already erased. */ | |
| 605 | |
| 621 | 606 static int |
| 286 | 607 XTclear_end_of_line (first_unused) |
| 608 register int first_unused; | |
| 609 { | |
| 771 | 610 struct frame *f = updating_frame; |
| 286 | 611 int mask; |
| 612 | |
| 771 | 613 if (f == 0) |
| 286 | 614 abort (); |
| 615 | |
| 771 | 616 if (curs_y < 0 || curs_y >= f->height) |
| 286 | 617 return; |
| 618 if (first_unused <= 0) | |
| 619 return; | |
| 620 | |
| 771 | 621 if (first_unused >= f->width) |
| 622 first_unused = f->width; | |
| 286 | 623 |
| 624 BLOCK_INPUT; | |
| 625 | |
| 429 | 626 /* Notice if the cursor will be cleared by this operation. */ |
| 771 | 627 if (curs_y == f->phys_cursor_y |
| 628 && curs_x <= f->phys_cursor_x | |
| 629 && f->phys_cursor_x < first_unused) | |
| 630 f->phys_cursor_x = -1; | |
| 286 | 631 |
| 632 #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
|
633 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
|
634 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
|
635 CHAR_TO_PIXEL_ROW (f, curs_y), |
| 771 | 636 FONT_WIDTH (f->display.x->font) * (first_unused - curs_x), |
| 637 FONT_HEIGHT (f->display.x->font), False); | |
| 286 | 638 |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
639 #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
|
640 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
|
641 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
|
642 CHAR_TO_PIXEL_ROW (f, curs_y), |
| 771 | 643 FONT_WIDTH (f->display.x->font) * (first_unused - curs_x), |
| 644 FONT_HEIGHT (f->display.x->font), | |
| 645 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
|
646 #endif /* ! defined (HAVE_X11) */ |
| 286 | 647 |
| 648 UNBLOCK_INPUT; | |
| 649 } | |
| 650 | |
| 651 static | |
| 771 | 652 XTclear_frame () |
| 286 | 653 { |
| 654 int mask; | |
| 771 | 655 struct frame *f = updating_frame; |
| 656 | |
| 657 if (f == 0) | |
| 658 f = selected_frame; | |
| 659 | |
| 660 f->phys_cursor_x = -1; /* Cursor not visible. */ | |
| 286 | 661 curs_x = 0; /* Nominal cursor position is top left. */ |
| 662 curs_y = 0; | |
| 663 | |
| 664 BLOCK_INPUT; | |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
665 |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
666 XClear (FRAME_X_WINDOW (f)); |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
667 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
668 /* 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
|
669 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
|
670 x_scroll_bar_clear (f); |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
671 |
| 286 | 672 #ifndef HAVE_X11 |
| 771 | 673 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
|
674 #endif /* HAVE_X11 */ |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
675 |
| 286 | 676 XFlushQueue (); |
| 677 UNBLOCK_INPUT; | |
| 678 } | |
| 679 | |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
680 /* 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
|
681 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
682 /* We use the select system call to do the waiting, so we have to make sure |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
683 it's avaliable. If it isn't, we just won't do visual bells. */ |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
684 #if defined (HAVE_TIMEVAL) && defined (HAVE_SELECT) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
685 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
686 /* Subtract the `struct timeval' values X and Y, |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
687 storing the result in RESULT. |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
688 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
|
689 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
690 static int |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
691 timeval_subtract (result, x, y) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
692 struct timeval *result, x, y; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
693 { |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
694 /* 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
|
695 This is safer because on some systems |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
696 the tv_sec member is unsigned. */ |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
697 if (x.tv_usec < y.tv_usec) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
698 { |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
699 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
|
700 y.tv_usec -= 1000000 * nsec; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
701 y.tv_sec += nsec; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
702 } |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
703 if (x.tv_usec - y.tv_usec > 1000000) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
704 { |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
705 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
|
706 y.tv_usec += 1000000 * nsec; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
707 y.tv_sec -= nsec; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
708 } |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
709 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
710 /* 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
|
711 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
|
712 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
|
713 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
714 /* 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
|
715 return x.tv_sec < y.tv_sec; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
716 } |
| 286 | 717 |
| 771 | 718 XTflash (f) |
| 719 struct frame *f; | |
| 286 | 720 { |
| 721 BLOCK_INPUT; | |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
722 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
723 { |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
724 GC gc; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
725 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
726 /* 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
|
727 into background pixels. */ |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
728 { |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
729 XGCValues values; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
730 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
731 values.function = GXxor; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
732 values.foreground = (f->display.x->foreground_pixel |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
733 ^ f->display.x->background_pixel); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
734 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
735 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
|
736 GCFunction | GCForeground, &values); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
737 } |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
738 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
739 { |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
740 int width = PIXEL_WIDTH (f); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
741 int height = PIXEL_HEIGHT (f); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
742 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
743 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
|
744 width/4, height/4, width/2, height/2); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
745 XFlush (x_current_display); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
746 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
747 { |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
748 struct timeval wakeup, now; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
749 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
750 gettimeofday (&wakeup, (struct timezone *) 0); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
751 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
752 /* 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
|
753 wakeup.tv_usec += 150000; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
754 wakeup.tv_sec += (wakeup.tv_usec / 1000000); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
755 wakeup.tv_usec %= 1000000; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
756 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
757 /* Keep waiting until past the time wakeup. */ |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
758 while (1) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
759 { |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
760 struct timeval timeout; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
761 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
762 gettimeofday (&timeout, (struct timezone *)0); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
763 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
764 /* In effect, timeout = wakeup - timeout. |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
765 Break if result would be negative. */ |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
766 if (timeval_subtract (&timeout, wakeup, timeout)) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
767 break; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
768 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
769 /* 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
|
770 select (0, 0, 0, 0, &timeout); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
771 } |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
772 } |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
773 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
774 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
|
775 width/4, height/4, width/2, height/2); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
776 XFreeGC (x_current_display, gc); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
777 XFlush (x_current_display); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
778 } |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
779 } |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
780 |
| 286 | 781 UNBLOCK_INPUT; |
| 782 } | |
| 783 | |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
784 #endif |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
785 |
| 286 | 786 |
| 787 /* Make audible bell. */ | |
| 788 | |
| 789 #ifdef HAVE_X11 | |
| 790 #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
|
791 #else /* ! defined (HAVE_X11) */ |
| 286 | 792 #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
|
793 #endif /* ! defined (HAVE_X11) */ |
| 286 | 794 |
| 795 XTring_bell () | |
| 796 { | |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
797 #if defined (HAVE_TIMEVAL) && defined (HAVE_SELECT) |
| 286 | 798 if (visible_bell) |
| 771 | 799 XTflash (selected_frame); |
| 286 | 800 else |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
801 #endif |
| 286 | 802 { |
| 803 BLOCK_INPUT; | |
| 804 XRINGBELL; | |
| 805 XFlushQueue (); | |
| 806 UNBLOCK_INPUT; | |
| 807 } | |
| 808 } | |
| 809 | |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
810 /* Insert and delete character. |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
811 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
|
812 off the feature of using them. */ |
| 286 | 813 |
| 814 static | |
| 815 XTinsert_glyphs (start, len) | |
| 816 register char *start; | |
| 817 register int len; | |
| 818 { | |
| 819 abort (); | |
| 820 } | |
| 821 | |
| 822 static | |
| 823 XTdelete_glyphs (n) | |
| 824 register int n; | |
| 825 { | |
| 826 abort (); | |
| 827 } | |
| 828 | |
| 829 /* Specify how many text lines, from the top of the window, | |
| 830 should be affected by insert-lines and delete-lines operations. | |
| 831 This, and those operations, are used only within an update | |
| 832 that is bounded by calls to XTupdate_begin and XTupdate_end. */ | |
| 833 | |
| 834 static | |
| 835 XTset_terminal_window (n) | |
| 836 register int n; | |
| 837 { | |
| 771 | 838 if (updating_frame == 0) |
| 286 | 839 abort (); |
| 840 | |
| 771 | 841 if ((n <= 0) || (n > updating_frame->height)) |
| 842 flexlines = updating_frame->height; | |
| 286 | 843 else |
| 844 flexlines = n; | |
| 845 } | |
| 846 | |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
847 /* 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
|
848 Insert N lines at a vertical position curs_y. */ |
| 286 | 849 |
| 850 static void | |
| 851 stufflines (n) | |
| 852 register int n; | |
| 853 { | |
| 854 register int topregion, bottomregion; | |
| 855 register int length, newtop, mask; | |
| 771 | 856 register struct frame *f = updating_frame; |
| 857 int intborder = f->display.x->internal_border_width; | |
| 286 | 858 |
| 859 if (curs_y >= flexlines) | |
| 860 return; | |
| 861 | |
| 862 topregion = curs_y; | |
| 863 bottomregion = flexlines - (n + 1); | |
| 864 newtop = topregion + n; | |
| 865 length = (bottomregion - topregion) + 1; | |
| 866 | |
| 867 #ifndef HAVE_X11 | |
| 868 dumpqueue (); | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
869 #endif /* HAVE_X11 */ |
| 286 | 870 |
| 871 if ((length > 0) && (newtop <= flexlines)) | |
| 872 { | |
| 873 #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
|
874 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
|
875 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
|
876 intborder, CHAR_TO_PIXEL_ROW (f, topregion), |
| 771 | 877 f->width * FONT_WIDTH (f->display.x->font), |
| 878 length * FONT_HEIGHT (f->display.x->font), intborder, | |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
879 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
|
880 #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
|
881 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
|
882 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
|
883 intborder, CHAR_TO_PIXEL_ROW (f, newtop), |
| 771 | 884 f->width * FONT_WIDTH (f->display.x->font), |
| 885 length * FONT_HEIGHT (f->display.x->font)); | |
| 286 | 886 /* Now we must process any ExposeRegion events that occur |
| 887 if the area being copied from is obscured. | |
| 888 We can't let it wait because further i/d operations | |
| 889 may want to copy this area to another area. */ | |
| 890 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
|
891 #endif /* ! defined (HAVE_X11) */ |
| 286 | 892 } |
| 893 | |
| 894 newtop = min (newtop, (flexlines - 1)); | |
| 895 length = newtop - topregion; | |
| 896 if (length > 0) | |
| 897 { | |
| 898 #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
|
899 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
|
900 CHAR_TO_PIXEL_ROW (f, topregion), |
| 771 | 901 f->width * FONT_WIDTH (f->display.x->font), |
| 902 n * FONT_HEIGHT (f->display.x->font), False); | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
903 #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
|
904 XPixSet (FRAME_X_WINDOW (f), |
| 286 | 905 intborder, |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
906 CHAR_TO_PIXEL_ROW (f, topregion), |
| 771 | 907 f->width * FONT_WIDTH (f->display.x->font), |
| 908 n * FONT_HEIGHT (f->display.x->font), | |
| 909 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
|
910 #endif /* ! defined (HAVE_X11) */ |
| 286 | 911 } |
| 912 } | |
| 913 | |
| 914 /* Perform a delete-lines operation, deleting N lines | |
| 915 at a vertical position curs_y. */ | |
| 916 | |
| 917 static void | |
| 918 scraplines (n) | |
| 919 register int n; | |
| 920 { | |
| 921 int mask; | |
| 771 | 922 register struct frame *f = updating_frame; |
| 923 int intborder = f->display.x->internal_border_width; | |
| 286 | 924 |
| 925 if (curs_y >= flexlines) | |
| 926 return; | |
| 927 | |
| 928 #ifndef HAVE_X11 | |
| 929 dumpqueue (); | |
|
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 */ |
| 286 | 931 |
| 932 if ((curs_y + n) >= flexlines) | |
| 933 { | |
| 934 if (flexlines >= (curs_y + 1)) | |
| 935 { | |
| 936 #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
|
937 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
|
938 CHAR_TO_PIXEL_ROW (f, curs_y), |
| 771 | 939 f->width * FONT_WIDTH (f->display.x->font), |
| 940 (flexlines - curs_y) * FONT_HEIGHT (f->display.x->font), False); | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
941 #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
|
942 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
|
943 intborder, CHAR_TO_PIXEL_ROW (f, curs_y), |
| 771 | 944 f->width * FONT_WIDTH (f->display.x->font), |
| 945 (flexlines - curs_y) * FONT_HEIGHT (f->display.x->font), | |
| 946 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
|
947 #endif /* ! defined (HAVE_X11) */ |
| 286 | 948 } |
| 949 } | |
| 950 else | |
| 951 { | |
| 952 #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
|
953 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
|
954 FRAME_X_WINDOW (f), f->display.x->normal_gc, |
| 286 | 955 intborder, |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
956 CHAR_TO_PIXEL_ROW (f, curs_y + n), |
| 771 | 957 f->width * FONT_WIDTH (f->display.x->font), |
| 958 (flexlines - (curs_y + n)) * FONT_HEIGHT (f->display.x->font), | |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
959 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
|
960 XClearArea (x_current_display, FRAME_X_WINDOW (f), |
| 286 | 961 intborder, |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
962 CHAR_TO_PIXEL_ROW (f, flexlines - n), |
| 771 | 963 f->width * FONT_WIDTH (f->display.x->font), |
| 964 n * FONT_HEIGHT (f->display.x->font), False); | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
965 #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
|
966 XMoveArea (FRAME_X_WINDOW (f), |
| 286 | 967 intborder, |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
968 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
|
969 intborder, CHAR_TO_PIXEL_ROW (f, curs_y), |
| 771 | 970 f->width * FONT_WIDTH (f->display.x->font), |
| 971 (flexlines - (curs_y + n)) * FONT_HEIGHT (f->display.x->font)); | |
| 286 | 972 /* Now we must process any ExposeRegion events that occur |
| 973 if the area being copied from is obscured. | |
| 974 We can't let it wait because further i/d operations | |
| 975 may want to copy this area to another area. */ | |
| 976 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
|
977 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
|
978 CHAR_TO_PIXEL_ROW (f, flexlines - n), |
| 771 | 979 f->width * FONT_WIDTH (f->display.x->font), |
| 980 n * FONT_HEIGHT (f->display.x->font), f->display.x->background_pixel); | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
981 #endif /* ! defined (HAVE_X11) */ |
| 286 | 982 } |
| 983 } | |
| 984 | |
| 985 /* Perform an insert-lines or delete-lines operation, | |
| 986 inserting N lines or deleting -N lines at vertical position VPOS. */ | |
| 987 | |
| 988 XTins_del_lines (vpos, n) | |
| 989 int vpos, n; | |
| 990 { | |
| 771 | 991 if (updating_frame == 0) |
| 286 | 992 abort (); |
| 993 | |
| 429 | 994 /* Hide the cursor. */ |
| 771 | 995 x_display_cursor (updating_frame, 0); |
| 286 | 996 |
| 997 XTcursor_to (vpos, 0); | |
| 998 | |
| 999 BLOCK_INPUT; | |
| 1000 if (n >= 0) | |
| 1001 stufflines (n); | |
| 1002 else | |
| 1003 scraplines (-n); | |
| 1004 XFlushQueue (); | |
| 1005 UNBLOCK_INPUT; | |
| 1006 } | |
| 1007 | |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1008 /* Support routines for exposure events. */ |
| 286 | 1009 static void clear_cursor (); |
| 1010 | |
| 771 | 1011 /* Output into a rectangle of an X-window (for frame F) |
| 1012 the characters in f->phys_lines that overlap that rectangle. | |
| 286 | 1013 TOP and LEFT are the position of the upper left corner of the rectangle. |
| 1014 ROWS and COLS are the size of the rectangle. */ | |
| 1015 | |
| 1016 static void | |
| 771 | 1017 dumprectangle (f, left, top, cols, rows) |
| 1018 struct frame *f; | |
| 286 | 1019 register int left, top, cols, rows; |
| 1020 { | |
| 771 | 1021 register struct frame_glyphs *active_frame = FRAME_CURRENT_GLYPHS (f); |
| 286 | 1022 int cursor_cleared = 0; |
| 1023 int bottom, right; | |
| 1024 register int y; | |
| 1025 | |
| 771 | 1026 if (FRAME_GARBAGED_P (f)) |
| 286 | 1027 return; |
| 1028 | |
| 1029 /* Express rectangle as four edges, instead of position-and-size. */ | |
| 1030 bottom = top + rows; | |
| 1031 right = left + cols; | |
| 1032 | |
| 1033 #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
|
1034 { |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1035 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
|
1036 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1037 /* 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
|
1038 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
|
1039 if (top < intborder || left < intborder |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1040 || bottom > intborder + f->height * FONT_HEIGHT (f->display.x->font) |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1041 || right > intborder + f->width * FONT_WIDTH (f->display.x->font)) |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1042 dumpborder (f, 0); |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1043 } |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1044 #endif /* HAVE_X11 /* Window manger does this for X11. */ */ |
| 286 | 1045 |
| 1046 /* Convert rectangle edges in pixels to edges in chars. | |
| 1047 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
|
1048 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
|
1049 left = PIXEL_TO_CHAR_COL (f, left); |
| 771 | 1050 bottom += (FONT_HEIGHT (f->display.x->font) - 1); |
| 1051 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
|
1052 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
|
1053 right = PIXEL_TO_CHAR_COL (f, right); |
| 286 | 1054 |
| 1055 /* Clip the rectangle to what can be visible. */ | |
| 1056 if (left < 0) | |
| 1057 left = 0; | |
| 1058 if (top < 0) | |
| 1059 top = 0; | |
| 771 | 1060 if (right > f->width) |
| 1061 right = f->width; | |
| 1062 if (bottom > f->height) | |
| 1063 bottom = f->height; | |
| 286 | 1064 |
| 1065 /* Get size in chars of the rectangle. */ | |
| 1066 cols = right - left; | |
| 1067 rows = bottom - top; | |
| 1068 | |
| 1069 /* If rectangle has zero area, return. */ | |
| 1070 if (rows <= 0) return; | |
| 1071 if (cols <= 0) return; | |
| 1072 | |
| 1073 /* Turn off the cursor if it is in the rectangle. | |
| 1074 We will turn it back on afterward. */ | |
| 771 | 1075 if ((f->phys_cursor_x >= left) && (f->phys_cursor_x < right) |
| 1076 && (f->phys_cursor_y >= top) && (f->phys_cursor_y < bottom)) | |
| 286 | 1077 { |
| 771 | 1078 clear_cursor (f); |
| 286 | 1079 cursor_cleared = 1; |
| 1080 } | |
| 1081 | |
| 1082 /* Display the text in the rectangle, one text line at a time. */ | |
| 1083 | |
| 1084 for (y = top; y < bottom; y++) | |
| 1085 { | |
| 771 | 1086 GLYPH *line = &active_frame->glyphs[y][left]; |
| 1087 | |
| 1088 if (! active_frame->enable[y] || left > active_frame->used[y]) | |
| 286 | 1089 continue; |
| 1090 | |
| 771 | 1091 dumpglyphs (f, |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1092 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
|
1093 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
|
1094 line, min (cols, active_frame->used[y] - left), |
|
2732
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
1095 active_frame->highlight[y]); |
| 286 | 1096 } |
| 1097 | |
| 1098 /* Turn the cursor on if we turned it off. */ | |
| 1099 | |
| 1100 if (cursor_cleared) | |
| 771 | 1101 x_display_cursor (f, 1); |
| 286 | 1102 } |
| 1103 | |
| 1104 #ifndef HAVE_X11 | |
| 1105 /* Process all queued ExposeRegion events. */ | |
| 1106 | |
| 1107 static void | |
| 1108 dumpqueue () | |
| 1109 { | |
| 1110 register int i; | |
| 1111 XExposeRegionEvent r; | |
| 1112 | |
| 1113 while (dequeue_event (&r, &x_expose_queue)) | |
| 1114 { | |
| 771 | 1115 struct frame *f = x_window_to_frame (r.window); |
| 1116 if (f->display.x->icon_desc == r.window) | |
| 1117 refreshicon (f); | |
| 286 | 1118 else |
| 771 | 1119 dumprectangle (f, r.x, r.y, r.width, r.height); |
| 286 | 1120 } |
| 1121 XFlushQueue (); | |
| 1122 } | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1123 #endif /* HAVE_X11 */ |
| 286 | 1124 |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1125 /* Process all expose events that are pending, for X10. |
| 771 | 1126 Redraws the cursor if necessary on any frame that |
| 1127 is not in the process of being updated with update_frame. */ | |
| 286 | 1128 |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1129 #ifndef HAVE_X11 |
| 286 | 1130 static void |
| 1131 x_do_pending_expose () | |
| 1132 { | |
| 1133 int mask; | |
| 771 | 1134 struct frame *f; |
| 1135 Lisp_Object tail, frame; | |
| 286 | 1136 |
| 1137 if (expose_all_windows) | |
| 1138 { | |
| 1139 expose_all_windows = 0; | |
| 771 | 1140 for (tail = Vframe_list; CONSP (tail); tail = XCONS (tail)->cdr) |
| 286 | 1141 { |
| 1142 register int temp_width, temp_height; | |
| 1143 int intborder; | |
| 1144 | |
| 771 | 1145 frame = XCONS (tail)->car; |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1146 if (XGCTYPE (frame) != Lisp_Frame) |
| 286 | 1147 continue; |
| 771 | 1148 f = XFRAME (frame); |
|
976
cbdfc337ec8f
* xterm.c (x_wm_hints): New variable.
Jim Blandy <jimb@redhat.com>
parents:
786
diff
changeset
|
1149 if (! FRAME_X_P (f)) |
| 286 | 1150 continue; |
|
1658
452ba03935d7
* xterm.c (XTread_socket): When we get MapNotify, UnmapNotify,
Jim Blandy <jimb@redhat.com>
parents:
1530
diff
changeset
|
1151 if (!f->async_visible) |
| 286 | 1152 continue; |
| 771 | 1153 if (!f->display.x->needs_exposure) |
| 286 | 1154 continue; |
| 1155 | |
| 771 | 1156 intborder = f->display.x->internal_border_width; |
| 1157 | |
| 1158 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
|
1159 XGetWindowInfo (FRAME_X_WINDOW (f), &windowinfo); |
| 286 | 1160 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
|
1161 - f->display.x->v_scroll_bar_width) |
| 771 | 1162 / FONT_WIDTH (f->display.x->font)); |
| 286 | 1163 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
|
1164 - f->display.x->h_scroll_bar_height) |
| 771 | 1165 / FONT_HEIGHT (f->display.x->font)); |
| 1166 if (temp_width != f->width || temp_height != f->height) | |
| 286 | 1167 { |
| 771 | 1168 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
|
1169 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
|
1170 x_resize_scroll_bars (f); |
| 286 | 1171 } |
| 771 | 1172 f->display.x->left_pos = windowinfo.x; |
| 1173 f->display.x->top_pos = windowinfo.y; | |
| 1174 dumprectangle (f, 0, 0, PIXEL_WIDTH (f), PIXEL_HEIGHT (f)); | |
| 286 | 1175 #if 0 |
| 771 | 1176 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
|
1177 #endif /* ! 0 */ |
| 771 | 1178 f->display.x->needs_exposure = 0; |
| 1179 if (updating_frame != f) | |
| 1180 x_display_cursor (f, 1); | |
| 286 | 1181 XFlushQueue (); |
| 1182 } | |
| 1183 } | |
| 1184 else | |
| 1185 /* Handle any individual-rectangle expose events queued | |
| 1186 for various windows. */ | |
| 1187 #ifdef HAVE_X11 | |
| 1188 ; | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1189 #else /* ! defined (HAVE_X11) */ |
| 286 | 1190 dumpqueue (); |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1191 #endif /* ! defined (HAVE_X11) */ |
| 286 | 1192 } |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1193 #endif |
| 286 | 1194 |
| 1195 #ifdef HAVE_X11 | |
| 1196 static void | |
| 771 | 1197 frame_highlight (frame) |
| 1198 struct frame *frame; | |
| 286 | 1199 { |
| 1200 if (! EQ (Vx_no_window_manager, Qnil)) | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1201 XSetWindowBorder (x_current_display, FRAME_X_WINDOW (frame), |
| 771 | 1202 frame->display.x->border_pixel); |
| 1203 x_display_cursor (frame, 1); | |
| 286 | 1204 } |
| 1205 | |
| 1206 static void | |
| 771 | 1207 frame_unhighlight (frame) |
| 1208 struct frame *frame; | |
| 286 | 1209 { |
| 1210 if (! EQ (Vx_no_window_manager, Qnil)) | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1211 XSetWindowBorderPixmap (x_current_display, FRAME_X_WINDOW (frame), |
| 771 | 1212 frame->display.x->border_tile); |
| 1213 x_display_cursor (frame, 1); | |
| 286 | 1214 } |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1215 #else /* ! defined (HAVE_X11) */ |
| 771 | 1216 /* Dump the border-emphasis of frame F. |
| 1217 If F is selected, this is a lining of the same color as the border, | |
| 286 | 1218 just within the border, occupying a portion of the internal border. |
| 771 | 1219 If F is not selected, it is background in the same place. |
| 286 | 1220 If ALWAYS is 0, don't bother explicitly drawing if it's background. |
| 1221 | |
| 771 | 1222 ALWAYS = 1 is used when a frame becomes selected or deselected. |
| 286 | 1223 In that case, we also turn the cursor off and on again |
| 1224 so it will appear in the proper shape (solid if selected; else hollow.) */ | |
| 1225 | |
| 1226 static void | |
| 771 | 1227 dumpborder (f, always) |
| 1228 struct frame *f; | |
| 286 | 1229 int always; |
| 1230 { | |
| 771 | 1231 int thickness = f->display.x->internal_border_width / 2; |
| 1232 int width = PIXEL_WIDTH (f); | |
| 1233 int height = PIXEL_HEIGHT (f); | |
| 286 | 1234 int pixel; |
| 1235 | |
| 771 | 1236 if (f != selected_frame) |
| 286 | 1237 { |
| 1238 if (!always) | |
| 1239 return; | |
| 1240 | |
| 771 | 1241 pixel = f->display.x->background_pixel; |
| 286 | 1242 } |
| 1243 else | |
| 1244 { | |
| 771 | 1245 pixel = f->display.x->border_pixel; |
| 286 | 1246 } |
| 1247 | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1248 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
|
1249 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
|
1250 XPixSet (FRAME_X_WINDOW (f), 0, height - thickness, width, |
| 286 | 1251 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
|
1252 XPixSet (FRAME_X_WINDOW (f), width - thickness, 0, thickness, |
| 286 | 1253 height, pixel); |
| 1254 | |
| 1255 if (always) | |
| 771 | 1256 x_display_cursor (f, 1); |
| 286 | 1257 } |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1258 #endif /* ! defined (HAVE_X11) */ |
| 286 | 1259 |
| 771 | 1260 static void XTframe_rehighlight (); |
| 1261 | |
| 1262 /* The focus has changed. Update the frames as necessary to reflect | |
| 1263 the new situation. Note that we can't change the selected frame | |
| 286 | 1264 here, because the lisp code we are interrupting might become confused. |
| 771 | 1265 Each event gets marked with the frame in which it occured, so the |
| 369 | 1266 lisp code can tell when the switch took place by examining the events. */ |
| 1267 | |
| 1268 static void | |
| 771 | 1269 x_new_focus_frame (frame) |
| 1270 struct frame *frame; | |
| 286 | 1271 { |
| 771 | 1272 struct frame *old_focus = x_focus_frame; |
| 286 | 1273 int events_enqueued = 0; |
| 1274 | |
| 771 | 1275 if (frame != x_focus_frame) |
| 286 | 1276 { |
| 369 | 1277 /* Set this before calling other routines, so that they see |
| 771 | 1278 the correct value of x_focus_frame. */ |
| 1279 x_focus_frame = frame; | |
| 369 | 1280 |
| 1281 if (old_focus && old_focus->auto_lower) | |
| 771 | 1282 x_lower_frame (old_focus); |
| 286 | 1283 |
| 1284 #if 0 | |
| 771 | 1285 selected_frame = frame; |
| 1286 XSET (XWINDOW (selected_frame->selected_window)->frame, | |
| 1287 Lisp_Frame, selected_frame); | |
| 1288 Fselect_window (selected_frame->selected_window); | |
| 1289 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
|
1290 #endif /* ! 0 */ |
| 286 | 1291 |
| 771 | 1292 if (x_focus_frame && x_focus_frame->auto_raise) |
| 1293 x_raise_frame (x_focus_frame); | |
| 369 | 1294 } |
| 1295 | |
| 771 | 1296 XTframe_rehighlight (); |
| 369 | 1297 } |
| 1298 | |
| 1299 | |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1300 /* 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
|
1301 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
|
1302 minibuffer frame). Shift the highlight as appropriate. */ |
| 369 | 1303 static void |
| 771 | 1304 XTframe_rehighlight () |
| 369 | 1305 { |
| 771 | 1306 struct frame *old_highlight = x_highlight_frame; |
| 1307 | |
| 1308 if (x_focus_frame) | |
| 286 | 1309 { |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1310 x_highlight_frame = |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1311 ((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
|
1312 ? 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
|
1313 : x_focus_frame); |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1314 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
|
1315 { |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1316 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
|
1317 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
|
1318 } |
| 286 | 1319 } |
| 369 | 1320 else |
| 771 | 1321 x_highlight_frame = 0; |
| 1322 | |
| 1323 if (x_highlight_frame != old_highlight) | |
| 369 | 1324 { |
| 1325 if (old_highlight) | |
| 771 | 1326 frame_unhighlight (old_highlight); |
| 1327 if (x_highlight_frame) | |
| 1328 frame_highlight (x_highlight_frame); | |
| 369 | 1329 } |
| 286 | 1330 } |
| 1331 | |
| 429 | 1332 /* Mouse clicks and mouse movement. Rah. */ |
| 1333 #ifdef HAVE_X11 | |
| 1334 | |
| 771 | 1335 /* Given a pixel position (PIX_X, PIX_Y) on the frame F, return |
| 429 | 1336 glyph co-ordinates in (*X, *Y). Set *BOUNDS to the rectangle |
| 1337 that the glyph at X, Y occupies, if BOUNDS != 0. */ | |
| 1338 static void | |
| 771 | 1339 pixel_to_glyph_coords (f, pix_x, pix_y, x, y, bounds) |
| 1340 FRAME_PTR f; | |
| 286 | 1341 register unsigned int pix_x, pix_y; |
| 1342 register int *x, *y; | |
| 429 | 1343 XRectangle *bounds; |
| 286 | 1344 { |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1345 pix_x = PIXEL_TO_CHAR_COL (f, pix_x); |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1346 pix_y = PIXEL_TO_CHAR_ROW (f, pix_y); |
| 429 | 1347 |
| 1348 if (bounds) | |
| 1349 { | |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1350 bounds->width = FONT_WIDTH (f->display.x->font); |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1351 bounds->height = FONT_HEIGHT (f->display.x->font); |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1352 bounds->x = CHAR_TO_PIXEL_COL (f, pix_x); |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1353 bounds->y = CHAR_TO_PIXEL_ROW (f, pix_y); |
| 429 | 1354 } |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1355 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1356 if (pix_x < 0) pix_x = 0; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1357 else if (pix_x > f->width) pix_x = f->width; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1358 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1359 if (pix_y < 0) pix_y = 0; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1360 else if (pix_y > f->height) pix_y = f->height; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1361 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1362 *x = pix_x; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1363 *y = pix_y; |
| 286 | 1364 } |
| 1365 | |
| 1366 /* Any buttons grabbed. */ | |
| 1367 unsigned int x_mouse_grabbed; | |
| 1368 | |
|
1279
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1369 /* 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
|
1370 |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1371 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
|
1372 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
|
1373 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
|
1374 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
|
1375 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
|
1376 |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1377 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
|
1378 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
|
1379 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
|
1380 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
|
1381 |
|
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
1382 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
|
1383 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
|
1384 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
|
1385 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
|
1386 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
|
1387 (EVENT.state & x_shift_lock_mask) != 0. */ |
|
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
1388 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
|
1389 |
|
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
|
1390 /* 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
|
1391 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
|
1392 |
|
1279
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1393 /* 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
|
1394 static void |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1395 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
|
1396 { |
|
1324
44215417cf6e
* xterm.c (x_find_modifier_meanings): If there are no
Jim Blandy <jimb@redhat.com>
parents:
1279
diff
changeset
|
1397 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
|
1398 KeySym *syms; |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1399 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
|
1400 XModifierKeymap *mods; |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1401 |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1402 x_meta_mod_mask = 0; |
|
1436
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
1403 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
|
1404 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
|
1405 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
|
1406 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
|
1407 |
|
2127
adaf588e32a6
* xterm.c (x_find_modifier_meanings): XDisplayKeycodes only
Jim Blandy <jimb@redhat.com>
parents:
2064
diff
changeset
|
1408 #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
|
1409 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
|
1410 #else |
|
adaf588e32a6
* xterm.c (x_find_modifier_meanings): XDisplayKeycodes only
Jim Blandy <jimb@redhat.com>
parents:
2064
diff
changeset
|
1411 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
|
1412 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
|
1413 #endif |
|
adaf588e32a6
* xterm.c (x_find_modifier_meanings): XDisplayKeycodes only
Jim Blandy <jimb@redhat.com>
parents:
2064
diff
changeset
|
1414 |
|
1279
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1415 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
|
1416 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
|
1417 &syms_per_code); |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1418 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
|
1419 |
|
1436
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
1420 /* 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
|
1421 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
|
1422 { |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1423 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
|
1424 |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1425 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
|
1426 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
|
1427 { |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1428 KeyCode code = |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1429 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
|
1430 |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1431 /* 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
|
1432 { |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1433 int code_col; |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1434 |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1435 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
|
1436 { |
|
1324
44215417cf6e
* xterm.c (x_find_modifier_meanings): If there are no
Jim Blandy <jimb@redhat.com>
parents:
1279
diff
changeset
|
1437 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
|
1438 |
|
44215417cf6e
* xterm.c (x_find_modifier_meanings): If there are no
Jim Blandy <jimb@redhat.com>
parents:
1279
diff
changeset
|
1439 switch (sym) |
|
1279
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1440 { |
|
1324
44215417cf6e
* xterm.c (x_find_modifier_meanings): If there are no
Jim Blandy <jimb@redhat.com>
parents:
1279
diff
changeset
|
1441 case XK_Meta_L: |
|
44215417cf6e
* xterm.c (x_find_modifier_meanings): If there are no
Jim Blandy <jimb@redhat.com>
parents:
1279
diff
changeset
|
1442 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
|
1443 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
|
1444 break; |
|
1324
44215417cf6e
* xterm.c (x_find_modifier_meanings): If there are no
Jim Blandy <jimb@redhat.com>
parents:
1279
diff
changeset
|
1445 |
|
44215417cf6e
* xterm.c (x_find_modifier_meanings): If there are no
Jim Blandy <jimb@redhat.com>
parents:
1279
diff
changeset
|
1446 case XK_Alt_L: |
|
44215417cf6e
* xterm.c (x_find_modifier_meanings): If there are no
Jim Blandy <jimb@redhat.com>
parents:
1279
diff
changeset
|
1447 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
|
1448 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
|
1449 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
|
1450 |
|
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
|
1451 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
|
1452 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
|
1453 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
|
1454 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
|
1455 |
|
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
|
1456 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
|
1457 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
|
1458 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
|
1459 break; |
|
1436
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
1460 |
|
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
1461 case XK_Shift_Lock: |
|
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
1462 /* 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
|
1463 if ((1 << row) == LockMask) |
|
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
1464 x_shift_lock_mask = LockMask; |
|
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
1465 break; |
|
1279
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1466 } |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1467 } |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1468 } |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1469 } |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1470 } |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1471 |
|
1324
44215417cf6e
* xterm.c (x_find_modifier_meanings): If there are no
Jim Blandy <jimb@redhat.com>
parents:
1279
diff
changeset
|
1472 /* 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
|
1473 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
|
1474 { |
|
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
|
1475 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
|
1476 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
|
1477 } |
|
1324
44215417cf6e
* xterm.c (x_find_modifier_meanings): If there are no
Jim Blandy <jimb@redhat.com>
parents:
1279
diff
changeset
|
1478 |
|
1279
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1479 XFree ((char *) syms); |
|
1324
44215417cf6e
* xterm.c (x_find_modifier_meanings): If there are no
Jim Blandy <jimb@redhat.com>
parents:
1279
diff
changeset
|
1480 XFreeModifiermap (mods); |
|
1279
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1481 } |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1482 |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
1483 |
|
2661
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
1484 /* 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
|
1485 Emacs uses. */ |
|
1530
a7f8a1fe258e
* xterm.c (x_convert_modifiers): Declare this to return an
Jim Blandy <jimb@redhat.com>
parents:
1436
diff
changeset
|
1486 static unsigned int |
|
2661
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
1487 x_x_to_emacs_modifiers (state) |
| 286 | 1488 unsigned int state; |
| 1489 { | |
|
1436
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
1490 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
|
1491 | ((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
|
1492 | ((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
|
1493 | ((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
|
1494 | ((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
|
1495 | ((state & x_hyper_mod_mask) ? hyper_modifier : 0)); |
| 286 | 1496 } |
| 1497 | |
|
2661
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
1498 static unsigned int |
|
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
1499 x_emacs_to_x_modifiers (state) |
|
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
1500 unsigned int state; |
|
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
1501 { |
|
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
1502 return ( ((state & alt_modifier) ? x_alt_mod_mask : 0) |
|
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
1503 | ((state & super_modifier) ? x_super_mod_mask : 0) |
|
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
1504 | ((state & hyper_modifier) ? x_hyper_mod_mask : 0) |
|
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
1505 | ((state & shift_modifier) ? ShiftMask : 0) |
|
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
1506 | ((state & ctrl_modifier) ? ControlMask : 0) |
|
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
1507 | ((state & meta_modifier) ? x_meta_mod_mask : 0)); |
|
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
1508 } |
|
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
1509 |
| 286 | 1510 /* Prepare a mouse-event in *RESULT for placement in the input queue. |
| 1511 | |
| 1512 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
|
1513 the mouse. */ |
| 286 | 1514 |
| 1515 static Lisp_Object | |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1516 construct_mouse_click (result, event, f) |
| 286 | 1517 struct input_event *result; |
| 1518 XButtonEvent *event; | |
| 771 | 1519 struct frame *f; |
| 286 | 1520 { |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1521 /* Make the event type no_event; we'll change that when we decide |
| 286 | 1522 otherwise. */ |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1523 result->kind = mouse_click; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1524 XSET (result->code, Lisp_Int, event->button - Button1); |
| 708 | 1525 result->timestamp = event->time; |
|
2661
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
1526 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
|
1527 | (event->type == ButtonRelease |
|
44215417cf6e
* xterm.c (x_find_modifier_meanings): If there are no
Jim Blandy <jimb@redhat.com>
parents:
1279
diff
changeset
|
1528 ? up_modifier |
|
44215417cf6e
* xterm.c (x_find_modifier_meanings): If there are no
Jim Blandy <jimb@redhat.com>
parents:
1279
diff
changeset
|
1529 : down_modifier)); |
| 286 | 1530 |
| 1531 /* Notice if the mouse is still grabbed. */ | |
| 1532 if (event->type == ButtonPress) | |
| 1533 { | |
| 1534 if (! x_mouse_grabbed) | |
| 1535 Vmouse_depressed = Qt; | |
| 429 | 1536 x_mouse_grabbed |= (1 << event->button); |
| 286 | 1537 } |
| 1538 else if (event->type == ButtonRelease) | |
| 1539 { | |
| 429 | 1540 x_mouse_grabbed &= ~(1 << event->button); |
| 286 | 1541 if (!x_mouse_grabbed) |
| 1542 Vmouse_depressed = Qnil; | |
| 1543 } | |
| 1544 | |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1545 { |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1546 int row, column; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1547 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1548 pixel_to_glyph_coords (f, event->x, event->y, &column, &row, NULL); |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1549 XFASTINT (result->x) = column; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1550 XFASTINT (result->y) = row; |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1551 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
|
1552 } |
| 286 | 1553 } |
| 1554 | |
| 1555 | |
| 429 | 1556 /* Mouse movement. Rah. |
| 1557 | |
| 1558 In order to avoid asking for motion events and then throwing most | |
| 1559 of them away or busy-polling the server for mouse positions, we ask | |
| 1560 the server for pointer motion hints. This means that we get only | |
| 1561 one event per group of mouse movements. "Groups" are delimited by | |
| 1562 other kinds of events (focus changes and button clicks, for | |
| 1563 example), or by XQueryPointer calls; when one of these happens, we | |
| 1564 get another MotionNotify event the next time the mouse moves. This | |
| 732 | 1565 is at least as efficient as getting motion events when mouse |
| 429 | 1566 tracking is on, and I suspect only negligibly worse when tracking |
| 1567 is off. | |
| 1568 | |
| 1569 The silly O'Reilly & Associates Nutshell guides barely document | |
| 1570 pointer motion hints at all (I think you have to infer how they | |
| 1571 work from an example), and the description of XQueryPointer doesn't | |
| 1572 mention that calling it causes you to get another motion hint from | |
| 1573 the server, which is very important. */ | |
| 1574 | |
| 1575 /* Where the mouse was last time we reported a mouse event. */ | |
| 771 | 1576 static FRAME_PTR last_mouse_frame; |
| 429 | 1577 static XRectangle last_mouse_glyph; |
| 1578 | |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1579 /* The scroll bar in which the last X motion event occurred. |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1580 |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1581 If the last X motion event occured in a scroll bar, we set this |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1582 so XTmouse_position can know whether to report a scroll bar motion or |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1583 an ordinary motion. |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1584 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1585 If the last X motion event didn't occur in a scroll bar, we set this |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1586 to Qnil, to tell XTmouse_position to return an ordinary motion event. */ |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1587 static Lisp_Object last_mouse_scroll_bar; |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1588 |
| 732 | 1589 /* This is a hack. We would really prefer that XTmouse_position would |
| 1590 return the time associated with the position it returns, but there | |
| 1591 doesn't seem to be any way to wrest the timestamp from the server | |
| 1592 along with the position query. So, we just keep track of the time | |
| 1593 of the last movement we received, and return that in hopes that | |
| 1594 it's somewhat accurate. */ | |
| 1595 static Time last_mouse_movement_time; | |
| 1596 | |
| 429 | 1597 /* Function to report a mouse movement to the mainstream Emacs code. |
| 1598 The input handler calls this. | |
| 1599 | |
| 1600 We have received a mouse movement event, which is given in *event. | |
| 1601 If the mouse is over a different glyph than it was last time, tell | |
| 1602 the mainstream emacs code by setting mouse_moved. If not, ask for | |
| 1603 another motion event, so we can check again the next time it moves. */ | |
| 1604 static void | |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1605 note_mouse_movement (frame, event) |
| 771 | 1606 FRAME_PTR frame; |
| 429 | 1607 XMotionEvent *event; |
| 1608 | |
| 1609 { | |
| 732 | 1610 last_mouse_movement_time = event->time; |
| 1611 | |
| 429 | 1612 /* Has the mouse moved off the glyph it was on at the last sighting? */ |
| 1613 if (event->x < last_mouse_glyph.x | |
| 1614 || event->x >= last_mouse_glyph.x + last_mouse_glyph.width | |
| 1615 || event->y < last_mouse_glyph.y | |
| 1616 || 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
|
1617 { |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1618 mouse_moved = 1; |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1619 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
|
1620 } |
| 429 | 1621 else |
| 1622 { | |
| 1623 /* It's on the same glyph. Call XQueryPointer so we'll get an | |
| 1624 event the next time the mouse moves and we can see if it's | |
| 1625 *still* on the same glyph. */ | |
| 1626 int dummy; | |
| 1627 | |
| 1628 XQueryPointer (event->display, event->window, | |
| 1629 (Window *) &dummy, (Window *) &dummy, | |
| 1630 &dummy, &dummy, &dummy, &dummy, | |
| 1631 (unsigned int *) &dummy); | |
| 1632 } | |
| 1633 } | |
| 1634 | |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1635 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
|
1636 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
|
1637 |
| 429 | 1638 /* Return the current position of the mouse. |
| 1639 | |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1640 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
|
1641 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
|
1642 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
|
1643 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
|
1644 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1645 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
|
1646 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
|
1647 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
|
1648 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1649 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
|
1650 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
|
1651 |
| 429 | 1652 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
|
1653 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
|
1654 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
|
1655 again. */ |
| 429 | 1656 |
| 1657 static void | |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1658 XTmouse_position (f, bar_window, part, x, y, time) |
| 771 | 1659 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
|
1660 Lisp_Object *bar_window; |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1661 enum scroll_bar_part *part; |
| 429 | 1662 Lisp_Object *x, *y; |
| 732 | 1663 unsigned long *time; |
| 429 | 1664 { |
| 1665 BLOCK_INPUT; | |
| 1666 | |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1667 if (! NILP (last_mouse_scroll_bar)) |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1668 x_scroll_bar_report_motion (f, bar_window, part, x, y, time); |
| 429 | 1669 else |
| 1670 { | |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1671 Window root; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1672 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
|
1673 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1674 Window dummy_window; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1675 int dummy; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1676 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1677 mouse_moved = 0; |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1678 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
|
1679 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1680 /* 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
|
1681 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
|
1682 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
|
1683 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1684 /* 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
|
1685 &root, |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1686 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1687 /* 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
|
1688 a different screen. */ |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1689 &dummy_window, |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1690 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1691 /* 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
|
1692 &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
|
1693 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1694 /* 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
|
1695 &dummy, &dummy, |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1696 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1697 /* 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
|
1698 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
|
1699 (unsigned int *) &dummy); |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1700 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1701 /* 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
|
1702 containing the pointer. */ |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1703 { |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1704 Window win, child; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1705 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
|
1706 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
|
1707 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1708 win = root; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1709 for (;;) |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1710 { |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1711 XTranslateCoordinates (x_current_display, |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1712 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1713 /* From-window, to-window. */ |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1714 root, win, |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1715 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1716 /* 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
|
1717 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
|
1718 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1719 /* Child of win. */ |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1720 &child); |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1721 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1722 if (child == None) |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1723 break; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1724 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1725 win = child; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1726 parent_x = win_x; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1727 parent_y = win_y; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1728 } |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1729 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1730 /* Now we know that: |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1731 win is the innermost window containing the pointer |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1732 (XTC says it has no child containing the pointer), |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1733 win_x and win_y are the pointer's position in it |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1734 (XTC did this the last time through), and |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1735 parent_x and parent_y are the pointer's position in win's parent. |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1736 (They are what win_x and win_y were when win was child. |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1737 If win is the root window, it has no parent, and |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1738 parent_{x,y} are invalid, but that's okay, because we'll |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1739 never use them in that case.) */ |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1740 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1741 /* Is win one of our frames? */ |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1742 *f = x_window_to_frame (win); |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1743 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1744 /* If not, is it one of our scroll bars? */ |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1745 if (! *f) |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1746 { |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1747 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
|
1748 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1749 if (bar) |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1750 { |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1751 *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
|
1752 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
|
1753 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
|
1754 } |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1755 } |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1756 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1757 if (*f) |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1758 { |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1759 pixel_to_glyph_coords (*f, win_x, win_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
|
1760 &last_mouse_glyph); |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1761 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1762 *bar_window = Qnil; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1763 *part = 0; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1764 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
|
1765 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
|
1766 *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
|
1767 } |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1768 } |
| 429 | 1769 } |
| 1770 | |
| 1771 UNBLOCK_INPUT; | |
| 1772 } | |
| 1773 | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
1774 #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
|
1775 #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
|
1776 #endif /* ! defined (HAVE_X11) */ |
| 429 | 1777 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1778 /* Scroll bar support. */ |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1779 |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1780 /* 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
|
1781 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
|
1782 bits. */ |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1783 static struct scroll_bar * |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1784 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
|
1785 Window window_id; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1786 { |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1787 Lisp_Object tail, frame; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1788 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1789 for (tail = Vframe_list; |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1790 XGCTYPE (tail) == Lisp_Cons; |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1791 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
|
1792 { |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1793 Lisp_Object frame = XCONS (tail)->car; |
|
1803
5752a95053f2
* xterm.c (x_window_to_scrollbar): Search frames'
Jim Blandy <jimb@redhat.com>
parents:
1793
diff
changeset
|
1794 Lisp_Object bar, condemned; |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1795 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1796 /* 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
|
1797 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
|
1798 abort (); |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1799 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1800 /* 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
|
1801 right window ID. */ |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1802 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
|
1803 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
|
1804 /* 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
|
1805 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
|
1806 ! GC_NILP (bar) || (bar = condemned, |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1807 condemned = Qnil, |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1808 ! GC_NILP (bar)); |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1809 bar = XSCROLL_BAR(bar)->next) |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1810 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
|
1811 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
|
1812 } |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1813 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1814 return 0; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1815 } |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1816 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1817 /* 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
|
1818 scroll bar vector for it. */ |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1819 static struct scroll_bar * |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1820 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
|
1821 struct window *window; |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1822 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
|
1823 { |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1824 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
|
1825 struct scroll_bar *bar = |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1826 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
|
1827 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1828 BLOCK_INPUT; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1829 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1830 { |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1831 XSetWindowAttributes a; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1832 unsigned long mask; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1833 |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1834 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
|
1835 a.event_mask = (ButtonPressMask | ButtonReleaseMask |
|
1793
cf4c3f01ddb9
* xterm.c (x_scrollbar_create): Include PointerMotionHintMask in
Jim Blandy <jimb@redhat.com>
parents:
1787
diff
changeset
|
1836 | ButtonMotionMask | PointerMotionHintMask |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1837 | ExposureMask); |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1838 a.cursor = x_vertical_scroll_bar_cursor; |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1839 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
1840 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
|
1841 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1842 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
|
1843 (bar, |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1844 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
|
1845 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1846 /* 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
|
1847 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
|
1848 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1849 /* 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
|
1850 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
|
1851 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1852 /* Attributes. */ |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1853 mask, &a)); |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1854 } |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1855 |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1856 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
|
1857 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
|
1858 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
|
1859 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
|
1860 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
|
1861 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
|
1862 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
|
1863 bar->dragging = Qnil; |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1864 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1865 /* 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
|
1866 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
|
1867 bar->prev = Qnil; |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1868 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
|
1869 if (! NILP (bar->next)) |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1870 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
|
1871 |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1872 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
|
1873 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1874 UNBLOCK_INPUT; |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1875 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1876 return bar; |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1877 } |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1878 |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1879 /* 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
|
1880 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
|
1881 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
|
1882 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
|
1883 events.) |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1884 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1885 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
|
1886 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
|
1887 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
|
1888 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
|
1889 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
|
1890 static void |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1891 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
|
1892 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
|
1893 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
|
1894 int rebuild; |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1895 { |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1896 int dragging = ! NILP (bar->dragging); |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1897 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
|
1898 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
|
1899 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1900 /* 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
|
1901 if (! rebuild |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1902 && 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
|
1903 && 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
|
1904 return; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1905 |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1906 BLOCK_INPUT; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1907 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1908 { |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1909 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
|
1910 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
|
1911 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
|
1912 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1913 /* 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
|
1914 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
|
1915 { |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1916 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
|
1917 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1918 if (start < 0) |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1919 start = 0; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1920 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
|
1921 start = top_range; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1922 end = start + length; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1923 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1924 if (end < start) |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1925 end = start; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1926 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
|
1927 end = top_range; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1928 } |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1929 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1930 /* 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
|
1931 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
|
1932 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
|
1933 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1934 /* 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
|
1935 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
|
1936 end = top_range; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1937 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1938 /* 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
|
1939 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
|
1940 that many pixels tall. */ |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1941 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
|
1942 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1943 /* 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
|
1944 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
|
1945 if (0 < start) |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1946 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
|
1947 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1948 /* 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
|
1949 VERTICAL_SCROLL_BAR_LEFT_BORDER, |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1950 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
|
1951 inside_width, start, |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1952 False); |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1953 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1954 /* 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
|
1955 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
|
1956 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1957 /* x, y, width, height */ |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1958 VERTICAL_SCROLL_BAR_LEFT_BORDER, |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1959 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
|
1960 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
|
1961 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1962 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1963 /* 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
|
1964 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
|
1965 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
|
1966 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
|
1967 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1968 /* 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
|
1969 VERTICAL_SCROLL_BAR_LEFT_BORDER, |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1970 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
|
1971 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
|
1972 False); |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1973 |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1974 } |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1975 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1976 UNBLOCK_INPUT; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1977 } |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1978 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1979 /* Move a scroll bar around on the screen, to accomodate changing |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1980 window configurations. */ |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1981 static void |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
1982 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
|
1983 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
|
1984 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
|
1985 { |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1986 BLOCK_INPUT; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1987 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1988 { |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1989 XWindowChanges wc; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1990 unsigned int mask = 0; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1991 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1992 wc.x = left; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1993 wc.y = top; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1994 wc.width = width; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1995 wc.height = height; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
1996 |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
1997 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
|
1998 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
|
1999 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
|
2000 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
|
2001 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2002 if (mask) |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2003 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
|
2004 mask, &wc); |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2005 } |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2006 |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2007 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
|
2008 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
|
2009 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
|
2010 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
|
2011 |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2012 UNBLOCK_INPUT; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2013 } |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2014 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2015 /* 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
|
2016 to nil. */ |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2017 static void |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2018 x_scroll_bar_remove (bar) |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2019 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
|
2020 { |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2021 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
|
2022 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2023 BLOCK_INPUT; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2024 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2025 /* Destroy the window. */ |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2026 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
|
2027 |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2028 /* 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
|
2029 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
|
2030 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2031 UNBLOCK_INPUT; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2032 } |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2033 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2034 /* 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
|
2035 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
|
2036 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
|
2037 create one. */ |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2038 static void |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2039 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
|
2040 struct window *window; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2041 int portion, whole, position; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2042 { |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2043 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
|
2044 int top = XINT (window->top); |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2045 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
|
2046 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
|
2047 |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2048 /* 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
|
2049 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
|
2050 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
|
2051 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
|
2052 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
|
2053 |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2054 struct scroll_bar *bar; |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2055 |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2056 /* Does the scroll bar exist yet? */ |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2057 if (NILP (window->vertical_scroll_bar)) |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2058 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
|
2059 pixel_top, pixel_left, |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2060 pixel_width, pixel_height); |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2061 else |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2062 { |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2063 /* 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
|
2064 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
|
2065 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
|
2066 } |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2067 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2068 /* 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
|
2069 dragged. */ |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2070 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
|
2071 { |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2072 int top_range = |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2073 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
|
2074 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2075 if (whole == 0) |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2076 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
|
2077 else |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2078 { |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2079 int start = (position * top_range) / whole; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2080 int end = ((position + portion) * top_range) / whole; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2081 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2082 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
|
2083 } |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2084 } |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2085 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2086 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
|
2087 } |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2088 |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2089 |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2090 /* 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
|
2091 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
|
2092 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
|
2093 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
|
2094 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
|
2095 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
|
2096 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
|
2097 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2098 /* 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
|
2099 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
|
2100 `*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
|
2101 static void |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2102 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
|
2103 FRAME_PTR frame; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
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 /* 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
|
2106 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
|
2107 protocol correctly. */ |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2108 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
|
2109 abort (); |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2110 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2111 /* 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
|
2112 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
|
2113 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
|
2114 } |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2115 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2116 /* 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
|
2117 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
|
2118 static void |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2119 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
|
2120 struct window *window; |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2121 { |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2122 struct scroll_bar *bar; |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2123 |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2124 /* 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
|
2125 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
|
2126 abort (); |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2127 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2128 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
|
2129 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2130 /* 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
|
2131 { |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2132 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
|
2133 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2134 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
|
2135 { |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2136 /* 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
|
2137 the lists. */ |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2138 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
|
2139 /* 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
|
2140 return; |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2141 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
|
2142 window->vertical_scroll_bar)) |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2143 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
|
2144 else |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2145 /* 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
|
2146 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
|
2147 abort (); |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2148 } |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2149 else |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2150 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
|
2151 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2152 if (! NILP (bar->next)) |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2153 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
|
2154 |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2155 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
|
2156 bar->prev = Qnil; |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2157 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
|
2158 if (! NILP (bar->next)) |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2159 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
|
2160 } |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2161 } |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2162 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2163 /* 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
|
2164 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
|
2165 static void |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2166 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
|
2167 FRAME_PTR f; |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2168 { |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2169 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
|
2170 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2171 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
|
2172 |
|
5752a95053f2
* xterm.c (x_window_to_scrollbar): Search frames'
Jim Blandy <jimb@redhat.com>
parents:
1793
diff
changeset
|
2173 /* 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
|
2174 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
|
2175 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
|
2176 |
|
5752a95053f2
* xterm.c (x_window_to_scrollbar): Search frames'
Jim Blandy <jimb@redhat.com>
parents:
1793
diff
changeset
|
2177 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
|
2178 { |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2179 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
|
2180 |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2181 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
|
2182 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2183 next = b->next; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2184 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
|
2185 } |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2186 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2187 /* 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
|
2188 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
|
2189 } |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2190 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2191 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2192 /* 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
|
2193 |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2194 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
|
2195 mark bits. */ |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2196 static void |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2197 x_scroll_bar_expose (bar, event) |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2198 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
|
2199 XEvent *event; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2200 { |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2201 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
|
2202 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
|
2203 |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2204 BLOCK_INPUT; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2205 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2206 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
|
2207 |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2208 /* 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
|
2209 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
|
2210 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2211 /* 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
|
2212 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
|
2213 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2214 /* Draw another line to make the extra-thick border on the right. */ |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2215 XFillRectangle (x_current_display, w, gc, |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2216 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2217 /* x, y, width, height */ |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2218 XINT (bar->width) - 2, 1, 1, XINT (bar->height) - 2); |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2219 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2220 UNBLOCK_INPUT; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2221 } |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2222 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2223 /* 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
|
2224 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
|
2225 |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2226 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
|
2227 mark bits. */ |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2228 static void |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2229 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
|
2230 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
|
2231 XEvent *event; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2232 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
|
2233 { |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2234 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
|
2235 abort (); |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2236 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2237 emacs_event->kind = scroll_bar_click; |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2238 XSET (emacs_event->code, Lisp_Int, 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
|
2239 emacs_event->modifiers = |
|
2661
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
2240 (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
|
2241 | (event->type == ButtonRelease |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2242 ? up_modifier |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2243 : down_modifier)); |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2244 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
|
2245 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
|
2246 { |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2247 int internal_height = |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2248 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
|
2249 int top_range = |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2250 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
|
2251 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
|
2252 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2253 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
|
2254 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
|
2255 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2256 if (y < XINT (bar->start)) |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2257 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
|
2258 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
|
2259 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
|
2260 else |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2261 emacs_event->part = scroll_bar_below_handle; |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2262 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2263 /* 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
|
2264 holding it. */ |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2265 if (event->type == ButtonPress |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2266 && 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
|
2267 XSET (bar->dragging, Lisp_Int, y - XINT (bar->start)); |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2268 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2269 /* 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
|
2270 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
|
2271 && ! NILP (bar->dragging)) |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2272 { |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2273 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
|
2274 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
|
2275 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2276 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
|
2277 bar->dragging = Qnil; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2278 } |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2279 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2280 /* Clicks on the handle are always reported as occuring at the top of |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2281 the handle. */ |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2282 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
|
2283 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
|
2284 else |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2285 XSET (emacs_event->x, Lisp_Int, y); |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2286 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2287 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
|
2288 } |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2289 } |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2290 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2291 /* 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
|
2292 |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2293 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
|
2294 mark bits. */ |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2295 static void |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2296 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
|
2297 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
|
2298 XEvent *event; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2299 { |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2300 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
|
2301 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2302 mouse_moved = 1; |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2303 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
|
2304 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2305 /* 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
|
2306 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
|
2307 { |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2308 /* 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
|
2309 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
|
2310 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2311 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
|
2312 { |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2313 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
|
2314 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2315 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
|
2316 } |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2317 } |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2318 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2319 /* 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
|
2320 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
|
2321 { |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2322 int dummy; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2323 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2324 XQueryPointer (event->xmotion.display, event->xmotion.window, |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2325 (Window *) &dummy, (Window *) &dummy, |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2326 &dummy, &dummy, &dummy, &dummy, |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2327 (unsigned int *) &dummy); |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2328 } |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2329 } |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2330 |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2331 /* 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
|
2332 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
|
2333 static void |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2334 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
|
2335 FRAME_PTR *f; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2336 Lisp_Object *bar_window; |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2337 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
|
2338 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
|
2339 unsigned long *time; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2340 { |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2341 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
|
2342 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
|
2343 |
|
1803
5752a95053f2
* xterm.c (x_window_to_scrollbar): Search frames'
Jim Blandy <jimb@redhat.com>
parents:
1793
diff
changeset
|
2344 BLOCK_INPUT; |
|
5752a95053f2
* xterm.c (x_window_to_scrollbar): Search frames'
Jim Blandy <jimb@redhat.com>
parents:
1793
diff
changeset
|
2345 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2346 /* 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
|
2347 report that. */ |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2348 { |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2349 Window dummy_window; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2350 int dummy_coord; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2351 unsigned int dummy_mask; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2352 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2353 if (! XQueryPointer (x_current_display, |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2354 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
|
2355 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2356 /* Root, child, root x and root y. */ |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2357 &dummy_window, &dummy_window, |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2358 &dummy_coord, &dummy_coord, |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2359 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2360 /* Position relative to scroll bar. */ |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2361 &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
|
2362 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2363 /* Mouse buttons and modifier keys. */ |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2364 &dummy_mask)) |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2365 { |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2366 *f = 0; |
|
1803
5752a95053f2
* xterm.c (x_window_to_scrollbar): Search frames'
Jim Blandy <jimb@redhat.com>
parents:
1793
diff
changeset
|
2367 goto done; |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2368 } |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2369 } |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2370 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2371 { |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2372 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
|
2373 int top_range = 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
|
2374 |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2375 win_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
|
2376 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2377 if (! NILP (bar->dragging)) |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2378 win_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
|
2379 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2380 if (win_y < 0) |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2381 win_y = 0; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2382 if (win_y > top_range) |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2383 win_y = top_range; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2384 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2385 *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
|
2386 *bar_window = bar->window; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2387 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2388 if (! NILP (bar->dragging)) |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2389 *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
|
2390 else if (win_y < XINT (bar->start)) |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2391 *part = scroll_bar_above_handle; |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2392 else if (win_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
|
2393 *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
|
2394 else |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2395 *part = scroll_bar_below_handle; |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2396 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2397 XSET (*x, 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
|
2398 XSET (*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
|
2399 *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
|
2400 } |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2401 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2402 mouse_moved = 0; |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2403 last_mouse_scroll_bar = Qnil; |
|
1803
5752a95053f2
* xterm.c (x_window_to_scrollbar): Search frames'
Jim Blandy <jimb@redhat.com>
parents:
1793
diff
changeset
|
2404 |
|
5752a95053f2
* xterm.c (x_window_to_scrollbar): Search frames'
Jim Blandy <jimb@redhat.com>
parents:
1793
diff
changeset
|
2405 done: |
|
5752a95053f2
* xterm.c (x_window_to_scrollbar): Search frames'
Jim Blandy <jimb@redhat.com>
parents:
1793
diff
changeset
|
2406 UNBLOCK_INPUT; |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2407 } |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2408 |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2409 |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
2410 /* 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
|
2411 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
|
2412 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
|
2413 redraw them. */ |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
2414 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2415 x_scroll_bar_clear (f) |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
2416 FRAME_PTR f; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
2417 { |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
2418 Lisp_Object bar; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
2419 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2420 for (bar = FRAME_SCROLL_BARS (f); |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
2421 XTYPE (bar) == Lisp_Vector; |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2422 bar = XSCROLL_BAR (bar)->next) |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2423 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
|
2424 0, 0, 0, 0, True); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
2425 } |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
2426 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
2427 |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2428 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2429 /* The main X event-reading loop - XTread_socket. */ |
| 286 | 2430 |
| 2431 /* Timestamp of enter window event. This is only used by XTread_socket, | |
| 2432 but we have to put it out here, since static variables within functions | |
| 2433 sometimes don't work. */ | |
| 2434 static Time enter_timestamp; | |
| 2435 | |
|
1436
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
2436 /* 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
|
2437 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
|
2438 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
|
2439 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
|
2440 |
|
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
2441 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
|
2442 given for enter_timestamp, above. */ |
|
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
2443 static XComposeStatus compose_status; |
|
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
2444 |
| 642 | 2445 /* Communication with window managers. */ |
| 2446 Atom Xatom_wm_protocols; | |
| 2447 | |
| 2448 /* Kinds of protocol things we may receive. */ | |
| 2449 Atom Xatom_wm_take_focus; | |
| 2450 Atom Xatom_wm_save_yourself; | |
| 2451 Atom Xatom_wm_delete_window; | |
| 2452 | |
| 2453 /* Other WM communication */ | |
| 2454 Atom Xatom_wm_configure_denied; /* When our config request is denied */ | |
| 2455 Atom Xatom_wm_window_moved; /* When the WM moves us. */ | |
| 2456 | |
|
2195
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
2457 /* Window manager communication. */ |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
2458 Atom Xatom_wm_change_state; |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
2459 |
| 2064 | 2460 /* Record the last 100 characters stored |
| 2461 to help debug the loss-of-chars-during-GC problem. */ | |
| 2462 int temp_index; | |
| 2463 short temp_buffer[100]; | |
| 2464 | |
| 286 | 2465 /* Read events coming from the X server. |
| 2466 This routine is called by the SIGIO handler. | |
| 2467 We return as soon as there are no more events to be read. | |
| 2468 | |
| 2469 Events representing keys are stored in buffer BUFP, | |
| 2470 which can hold up to NUMCHARS characters. | |
| 2471 We return the number of characters stored into the buffer, | |
| 2472 thus pretending to be `read'. | |
| 2473 | |
| 2474 WAITP is nonzero if we should block until input arrives. | |
| 2475 EXPECTED is nonzero if the caller knows input is available. */ | |
| 2476 | |
|
1530
a7f8a1fe258e
* xterm.c (x_convert_modifiers): Declare this to return an
Jim Blandy <jimb@redhat.com>
parents:
1436
diff
changeset
|
2477 int |
| 286 | 2478 XTread_socket (sd, bufp, numchars, waitp, expected) |
| 2479 register int sd; | |
| 2480 register struct input_event *bufp; | |
| 2481 register int numchars; | |
| 2482 int waitp; | |
| 2483 int expected; | |
| 2484 { | |
| 2485 int count = 0; | |
| 2486 int nbytes = 0; | |
| 2487 int mask; | |
| 2488 int items_pending; /* How many items are in the X queue. */ | |
| 2489 XEvent event; | |
| 771 | 2490 struct frame *f; |
| 286 | 2491 int event_found; |
| 2492 int prefix; | |
| 2493 Lisp_Object part; | |
| 2494 | |
|
2439
b6c62e4abf59
Put interrupt input blocking in a separate file from xterm.h.
Jim Blandy <jimb@redhat.com>
parents:
2353
diff
changeset
|
2495 if (interrupt_input_blocked) |
| 286 | 2496 { |
|
2439
b6c62e4abf59
Put interrupt input blocking in a separate file from xterm.h.
Jim Blandy <jimb@redhat.com>
parents:
2353
diff
changeset
|
2497 interrupt_input_pending = 1; |
| 286 | 2498 return -1; |
| 2499 } | |
| 2500 | |
|
2439
b6c62e4abf59
Put interrupt input blocking in a separate file from xterm.h.
Jim Blandy <jimb@redhat.com>
parents:
2353
diff
changeset
|
2501 interrupt_input_pending = 0; |
| 286 | 2502 BLOCK_INPUT; |
| 2503 | |
| 2504 if (numchars <= 0) | |
| 2505 abort (); /* Don't think this happens. */ | |
| 2506 | |
| 2507 #ifdef FIOSNBIO | |
| 2508 /* If available, Xlib uses FIOSNBIO to make the socket | |
| 2509 non-blocking, and then looks for EWOULDBLOCK. If O_NDELAY is set, | |
| 2510 FIOSNBIO is ignored, and instead of signalling EWOULDBLOCK, | |
| 2511 a read returns 0, which Xlib interprets as equivalent to EPIPE. */ | |
| 2512 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
|
2513 #endif /* ! defined (FIOSNBIO) */ |
| 286 | 2514 |
| 2515 #ifndef SIGIO | |
| 2516 #ifndef HAVE_SELECT | |
| 2517 if (! (fcntl (fileno (stdin), F_GETFL, 0) & O_NDELAY)) | |
| 2518 { | |
| 2519 extern int read_alarm_should_throw; | |
| 2520 read_alarm_should_throw = 1; | |
| 2521 XPeekEvent (XDISPLAY &event); | |
| 2522 read_alarm_should_throw = 0; | |
| 2523 } | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
2524 #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
|
2525 #endif /* SIGIO */ |
| 286 | 2526 |
| 2527 while (XStuffPending () != 0) | |
| 2528 { | |
| 2529 XNextEvent (XDISPLAY &event); | |
| 2530 event_found = 1; | |
| 2531 | |
| 2532 switch (event.type) | |
| 2533 { | |
| 2534 #ifdef HAVE_X11 | |
| 642 | 2535 case ClientMessage: |
| 2536 { | |
| 2537 if (event.xclient.message_type == Xatom_wm_protocols | |
| 2538 && event.xclient.format == 32) | |
| 2539 { | |
| 2540 if (event.xclient.data.l[0] == Xatom_wm_take_focus) | |
| 2541 { | |
| 771 | 2542 f = x_window_to_frame (event.xclient.window); |
| 2543 if (f) | |
| 2544 x_focus_on_frame (f); | |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2545 /* Not certain about handling scroll bars here */ |
| 642 | 2546 } |
| 2547 else if (event.xclient.data.l[0] == Xatom_wm_save_yourself) | |
| 2548 { | |
| 2549 /* Save state modify the WM_COMMAND property to | |
| 2550 something which can reinstate us. This notifies | |
| 2551 the session manager, who's looking for such a | |
| 2552 PropertyNotify. Can restart processing when | |
| 2553 a keyboard or mouse event arrives. */ | |
| 2554 if (numchars > 0) | |
| 2555 { | |
| 2556 } | |
| 2557 } | |
| 2558 else if (event.xclient.data.l[0] == Xatom_wm_delete_window) | |
| 2559 { | |
| 771 | 2560 struct frame *f = x_window_to_frame (event.xclient.window); |
| 2561 | |
| 2562 if (f) | |
| 642 | 2563 if (numchars > 0) |
| 2564 { | |
| 2565 } | |
| 2566 } | |
| 2567 } | |
| 2568 else if (event.xclient.message_type == Xatom_wm_configure_denied) | |
| 2569 { | |
| 2570 } | |
| 2571 else if (event.xclient.message_type == Xatom_wm_window_moved) | |
| 2572 { | |
| 2573 int new_x, new_y; | |
| 2574 | |
| 786 | 2575 new_x = event.xclient.data.s[0]; |
| 2576 new_y = event.xclient.data.s[1]; | |
| 642 | 2577 } |
| 2578 } | |
| 2579 break; | |
| 286 | 2580 |
|
2195
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
2581 #ifdef NEW_SELECTIONS |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
2582 case SelectionNotify: |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
2583 x_handle_selection_notify (&event); |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
2584 break; |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
2585 #endif |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
2586 |
| 286 | 2587 case SelectionClear: /* Someone has grabbed ownership. */ |
|
2195
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
2588 #ifdef NEW_SELECTIONS |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
2589 { |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
2590 XSelectionClearEvent *eventp = (XSelectionClearEvent *) &event; |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
2591 |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
2592 if (numchars == 0) |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
2593 abort (); |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
2594 |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
2595 bufp->kind = selection_clear_event; |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
2596 SELECTION_EVENT_DISPLAY (bufp) = eventp->display; |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
2597 SELECTION_EVENT_SELECTION (bufp) = eventp->selection; |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
2598 SELECTION_EVENT_TIME (bufp) = eventp->time; |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
2599 bufp++; |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
2600 |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
2601 count += 1; |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
2602 numchars -= 1; |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
2603 } |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
2604 #else |
| 286 | 2605 x_disown_selection (event.xselectionclear.window, |
| 2606 event.xselectionclear.selection, | |
| 2607 event.xselectionclear.time); | |
|
2195
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
2608 #endif |
| 286 | 2609 break; |
| 2610 | |
| 2611 case SelectionRequest: /* Someone wants our selection. */ | |
|
2195
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
2612 #ifdef NEW_SELECTIONS |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
2613 { |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
2614 XSelectionRequestEvent *eventp = (XSelectionRequestEvent *) &event; |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
2615 |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
2616 if (numchars == 0) |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
2617 abort (); |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
2618 |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
2619 bufp->kind = selection_request_event; |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
2620 SELECTION_EVENT_DISPLAY (bufp) = eventp->display; |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
2621 SELECTION_EVENT_REQUESTOR (bufp) = eventp->requestor; |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
2622 SELECTION_EVENT_SELECTION (bufp) = eventp->selection; |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
2623 SELECTION_EVENT_TARGET (bufp) = eventp->target; |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
2624 SELECTION_EVENT_PROPERTY (bufp) = eventp->property; |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
2625 SELECTION_EVENT_TIME (bufp) = eventp->time; |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
2626 bufp++; |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
2627 |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
2628 count += 1; |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
2629 numchars -= 1; |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
2630 } |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
2631 #else |
| 286 | 2632 x_answer_selection_request (event); |
|
2195
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
2633 #endif |
| 286 | 2634 break; |
| 2635 | |
| 2636 case PropertyNotify: | |
|
2195
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
2637 #ifdef NEW_SELECTIONS |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
2638 x_handle_property_notify (&event); |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
2639 #else |
|
1279
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
2640 /* If we're being told about a root window property, then it's |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
2641 a cut buffer change. */ |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
2642 if (event.xproperty.window == ROOT_WINDOW) |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
2643 x_invalidate_cut_buffer_cache (&event.xproperty); |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
2644 |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
2645 /* Otherwise, we're probably handling an incremental |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
2646 selection transmission. */ |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
2647 else |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
2648 { |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
2649 /* If we were to do this synchronously, there'd be no worry |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
2650 about re-selecting. */ |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
2651 x_send_incremental (event); |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
2652 } |
|
2195
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
2653 #endif |
| 286 | 2654 break; |
| 2655 | |
| 2656 case Expose: | |
| 771 | 2657 f = x_window_to_frame (event.xexpose.window); |
| 2658 if (f) | |
| 286 | 2659 { |
|
1658
452ba03935d7
* xterm.c (XTread_socket): When we get MapNotify, UnmapNotify,
Jim Blandy <jimb@redhat.com>
parents:
1530
diff
changeset
|
2660 if (f->async_visible == 0) |
| 286 | 2661 { |
|
1658
452ba03935d7
* xterm.c (XTread_socket): When we get MapNotify, UnmapNotify,
Jim Blandy <jimb@redhat.com>
parents:
1530
diff
changeset
|
2662 f->async_visible = 1; |
|
452ba03935d7
* xterm.c (XTread_socket): When we get MapNotify, UnmapNotify,
Jim Blandy <jimb@redhat.com>
parents:
1530
diff
changeset
|
2663 f->async_iconified = 0; |
| 771 | 2664 SET_FRAME_GARBAGED (f); |
| 286 | 2665 } |
| 2666 else | |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2667 { |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2668 dumprectangle (x_window_to_frame (event.xexpose.window), |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2669 event.xexpose.x, event.xexpose.y, |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2670 event.xexpose.width, event.xexpose.height); |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2671 } |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2672 } |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2673 else |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2674 { |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2675 struct scroll_bar *bar |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2676 = x_window_to_scroll_bar (event.xexpose.window); |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2677 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2678 if (bar) |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
2679 x_scroll_bar_expose (bar, &event); |
| 286 | 2680 } |
| 2681 break; | |
| 2682 | |
| 2683 case GraphicsExpose: /* This occurs when an XCopyArea's | |
| 2684 source area was obscured or not | |
| 2685 available.*/ | |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2686 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
|
2687 if (f) |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2688 { |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2689 dumprectangle (f, |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2690 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
|
2691 event.xgraphicsexpose.width, |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2692 event.xgraphicsexpose.height); |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2693 } |
| 286 | 2694 break; |
| 2695 | |
| 2696 case NoExpose: /* This occurs when an XCopyArea's | |
| 2697 source area was completely | |
| 2698 available */ | |
| 2699 break; | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
2700 #else /* ! defined (HAVE_X11) */ |
| 286 | 2701 case ExposeWindow: |
| 2702 if (event.subwindow != 0) | |
| 2703 break; /* duplicate event */ | |
| 771 | 2704 f = x_window_to_frame (event.window); |
| 2705 if (event.window == f->display.x->icon_desc) | |
| 286 | 2706 { |
| 771 | 2707 refreshicon (f); |
|
1658
452ba03935d7
* xterm.c (XTread_socket): When we get MapNotify, UnmapNotify,
Jim Blandy <jimb@redhat.com>
parents:
1530
diff
changeset
|
2708 f->async_iconified = 1; |
| 286 | 2709 } |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
2710 if (event.window == FRAME_X_WINDOW (f)) |
| 286 | 2711 { |
| 2712 /* Say must check all windows' needs_exposure flags. */ | |
| 2713 expose_all_windows = 1; | |
| 771 | 2714 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
|
2715 f->async_visible = 1; |
| 286 | 2716 } |
| 2717 break; | |
| 2718 | |
| 2719 case ExposeRegion: | |
| 2720 if (event.subwindow != 0) | |
| 2721 break; /* duplicate event */ | |
| 771 | 2722 f = x_window_to_frame (event.window); |
| 2723 if (event.window == f->display.x->icon_desc) | |
| 286 | 2724 { |
| 771 | 2725 refreshicon (f); |
| 286 | 2726 break; |
| 2727 } | |
| 2728 /* If window already needs full redraw, ignore this rectangle. */ | |
| 771 | 2729 if (expose_all_windows && f->display.x->needs_exposure) |
| 286 | 2730 break; |
| 2731 /* Put the event on the queue of rectangles to redraw. */ | |
| 2732 if (enqueue_event (&event, &x_expose_queue)) | |
| 2733 /* If it is full, we can't record the rectangle, | |
| 2734 so redraw this entire window. */ | |
| 2735 { | |
| 2736 /* Say must check all windows' needs_exposure flags. */ | |
| 2737 expose_all_windows = 1; | |
| 771 | 2738 f->display.x->needs_exposure = 1; |
| 286 | 2739 } |
| 2740 break; | |
| 2741 | |
| 2742 case ExposeCopy: | |
| 2743 /* This should happen only when we are expecting it, | |
| 2744 in x_read_exposes. */ | |
| 2745 abort (); | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
2746 #endif /* ! defined (HAVE_X11) */ |
| 286 | 2747 |
| 2748 #ifdef HAVE_X11 | |
| 2749 case UnmapNotify: | |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2750 f = x_window_to_frame (event.xunmap.window); |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2751 if (f) /* F may no longer exist if |
| 771 | 2752 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
|
2753 { |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2754 /* 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
|
2755 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
|
2756 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
|
2757 f->async_visible = 0; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2758 } |
| 286 | 2759 break; |
| 2760 | |
| 2761 case MapNotify: | |
| 771 | 2762 f = x_window_to_frame (event.xmap.window); |
| 2763 if (f) | |
| 286 | 2764 { |
|
1658
452ba03935d7
* xterm.c (XTread_socket): When we get MapNotify, UnmapNotify,
Jim Blandy <jimb@redhat.com>
parents:
1530
diff
changeset
|
2765 f->async_visible = 1; |
|
452ba03935d7
* xterm.c (XTread_socket): When we get MapNotify, UnmapNotify,
Jim Blandy <jimb@redhat.com>
parents:
1530
diff
changeset
|
2766 f->async_iconified = 0; |
| 286 | 2767 |
| 2768 /* wait_reading_process_input will notice this and update | |
| 771 | 2769 the frame's display structures. */ |
| 2770 SET_FRAME_GARBAGED (f); | |
| 286 | 2771 } |
| 2772 break; | |
| 2773 | |
| 2774 /* Turn off processing if we become fully obscured. */ | |
| 2775 case VisibilityNotify: | |
| 2776 break; | |
| 2777 | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
2778 #else /* ! defined (HAVE_X11) */ |
| 286 | 2779 case UnmapWindow: |
| 771 | 2780 f = x_window_to_frame (event.window); |
| 2781 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
|
2782 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
|
2783 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
|
2784 f->async_visible = 0; |
| 286 | 2785 break; |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
2786 #endif /* ! defined (HAVE_X11) */ |
| 286 | 2787 |
| 2788 #ifdef HAVE_X11 | |
| 2789 case KeyPress: | |
| 771 | 2790 f = x_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
|
2791 |
| 771 | 2792 if (f != 0) |
| 286 | 2793 { |
| 2794 KeySym keysym; | |
| 2795 char copy_buffer[80]; | |
|
1841
338e4ffdb54b
(XTread_socket): Support extra_keyboard_modifiers.
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
2796 int modifiers; |
|
338e4ffdb54b
(XTread_socket): Support extra_keyboard_modifiers.
Richard M. Stallman <rms@gnu.org>
parents:
1821
diff
changeset
|
2797 |
|
2661
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
2798 event.xkey.state |
|
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
2799 |= 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
|
2800 modifiers = event.xkey.state; |
| 555 | 2801 |
|
1436
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
2802 /* This will have to go some day... */ |
|
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
2803 nbytes = |
|
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
2804 XLookupString (&event.xkey, copy_buffer, 80, &keysym, |
|
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
2805 &compose_status); |
| 286 | 2806 |
| 395 | 2807 /* Strip off the vendor-specific keysym bit, and take a shot |
| 2808 at recognizing the codes. HP servers have extra keysyms | |
| 2809 that fit into the MiscFunctionKey category. */ | |
| 2810 keysym &= ~(1<<28); | |
| 2811 | |
| 286 | 2812 if (numchars > 1) |
| 2813 { | |
|
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
|
2814 if ((keysym >= XK_BackSpace && keysym <= XK_Escape) |
|
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
|
2815 || keysym == XK_Delete |
|
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
|
2816 || IsCursorKey (keysym) /* 0xff50 <= x < 0xff60 */ |
| 395 | 2817 || IsMiscFunctionKey (keysym) /* 0xff60 <= x < 0xff80 */ |
| 2818 || IsKeypadKey (keysym) /* 0xff80 <= x < 0xffbe */ | |
| 2819 || IsFunctionKey (keysym)) /* 0xffbe <= x < 0xffe1 */ | |
| 286 | 2820 { |
| 2064 | 2821 if (temp_index == sizeof temp_buffer / sizeof (short)) |
| 2822 temp_index = 0; | |
| 2823 temp_buffer[temp_index++] = keysym; | |
| 286 | 2824 bufp->kind = non_ascii_keystroke; |
|
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
|
2825 XSET (bufp->code, Lisp_Int, (unsigned) keysym - 0xff00); |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
2826 XSET (bufp->frame_or_window, Lisp_Frame, f); |
|
2661
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
2827 bufp->modifiers = x_x_to_emacs_modifiers (modifiers); |
| 708 | 2828 bufp->timestamp = event.xkey.time; |
| 286 | 2829 bufp++; |
| 2830 count++; | |
| 2831 numchars--; | |
| 2832 } | |
| 2833 else if (numchars > nbytes) | |
| 2834 { | |
| 2835 register int i; | |
| 2836 | |
| 2064 | 2837 for (i = 0; i < nbytes; i++) |
| 286 | 2838 { |
| 2064 | 2839 if (temp_index == sizeof temp_buffer / sizeof (short)) |
| 2840 temp_index = 0; | |
| 2841 temp_buffer[temp_index++] = copy_buffer[i]; | |
| 286 | 2842 bufp->kind = ascii_keystroke; |
| 2064 | 2843 XSET (bufp->code, Lisp_Int, 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
|
2844 XSET (bufp->frame_or_window, Lisp_Frame, f); |
|
2661
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
2845 bufp->modifiers = x_x_to_emacs_modifiers (modifiers); |
| 708 | 2846 bufp->timestamp = event.xkey.time; |
| 286 | 2847 bufp++; |
| 2848 } | |
| 2849 | |
| 2850 count += nbytes; | |
| 2851 numchars -= nbytes; | |
| 2852 } | |
| 2064 | 2853 else |
| 2854 abort (); | |
| 286 | 2855 } |
| 2064 | 2856 else |
| 2857 abort (); | |
| 286 | 2858 } |
| 2859 break; | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
2860 #else /* ! defined (HAVE_X11) */ |
| 286 | 2861 case KeyPressed: |
| 2862 { | |
| 2863 register char *where_mapping; | |
| 2864 | |
| 771 | 2865 f = x_window_to_frame (event.window); |
| 286 | 2866 /* Ignore keys typed on icon windows. */ |
| 771 | 2867 if (f != 0 && event.window == f->display.x->icon_desc) |
| 286 | 2868 break; |
| 2869 where_mapping = XLookupMapping (&event, &nbytes); | |
| 2870 /* Nasty fix for arrow keys */ | |
| 2871 if (!nbytes && IsCursorKey (event.detail & 0xff)) | |
| 2872 { | |
| 2873 switch (event.detail & 0xff) | |
| 2874 { | |
| 2875 case KC_CURSOR_LEFT: | |
| 2876 where_mapping = "\002"; | |
| 2877 break; | |
| 2878 case KC_CURSOR_RIGHT: | |
| 2879 where_mapping = "\006"; | |
| 2880 break; | |
| 2881 case KC_CURSOR_UP: | |
| 2882 where_mapping = "\020"; | |
| 2883 break; | |
| 2884 case KC_CURSOR_DOWN: | |
| 2885 where_mapping = "\016"; | |
| 2886 break; | |
| 2887 } | |
| 2888 nbytes = 1; | |
| 2889 } | |
| 2890 if (numchars - nbytes > 0) | |
| 2891 { | |
| 2892 register int i; | |
| 2893 | |
| 2894 for (i = 0; i < nbytes; i++) | |
| 2895 { | |
| 2896 bufp->kind = ascii_keystroke; | |
| 2897 XSET (bufp->code, Lisp_Int, where_mapping[i]); | |
| 429 | 2898 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
|
2899 XSET (bufp->frame_or_window, Lisp_Frame, f); |
| 286 | 2900 bufp++; |
| 2901 } | |
| 2902 count += nbytes; | |
| 2903 numchars -= nbytes; | |
| 2904 } | |
| 2905 } | |
| 2906 break; | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
2907 #endif /* ! defined (HAVE_X11) */ |
| 286 | 2908 |
| 2909 #ifdef HAVE_X11 | |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2910 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2911 /* 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
|
2912 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
|
2913 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
|
2914 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
|
2915 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
|
2916 |
| 286 | 2917 case EnterNotify: |
| 771 | 2918 f = x_window_to_frame (event.xcrossing.window); |
| 369 | 2919 |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2920 if (event.xcrossing.focus) /* Entered Window */ |
| 286 | 2921 { |
| 2922 /* Avoid nasty pop/raise loops. */ | |
| 771 | 2923 if (f && (!(f->auto_raise) |
| 2924 || !(f->auto_lower) | |
| 286 | 2925 || (event.xcrossing.time - enter_timestamp) > 500)) |
| 2926 { | |
| 771 | 2927 x_new_focus_frame (f); |
| 286 | 2928 enter_timestamp = event.xcrossing.time; |
| 2929 } | |
| 2930 } | |
| 771 | 2931 else if (f == x_focus_frame) |
| 2932 x_new_focus_frame (0); | |
| 286 | 2933 |
| 2934 break; | |
| 2935 | |
| 2936 case FocusIn: | |
| 771 | 2937 f = x_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
|
2938 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
|
2939 x_focus_event_frame = f; |
| 771 | 2940 if (f) |
| 2941 x_new_focus_frame (f); | |
| 286 | 2942 break; |
| 2943 | |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2944 |
| 286 | 2945 case LeaveNotify: |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2946 f = x_window_to_frame (event.xcrossing.window); |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2947 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2948 if (event.xcrossing.focus) |
| 286 | 2949 { |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2950 if (! x_focus_event_frame) |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2951 x_new_focus_frame (0); |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2952 else |
| 771 | 2953 x_new_focus_frame (f); |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2954 } |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2955 else |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2956 { |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2957 if (f == x_focus_event_frame) |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2958 x_focus_event_frame = 0; |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
2959 if (f == x_focus_frame) |
| 771 | 2960 x_new_focus_frame (0); |
| 286 | 2961 } |
| 2962 break; | |
| 2963 | |
| 2964 case FocusOut: | |
| 771 | 2965 f = x_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
|
2966 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
|
2967 && 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
|
2968 x_focus_event_frame = 0; |
| 771 | 2969 if (f && f == x_focus_frame) |
| 2970 x_new_focus_frame (0); | |
| 286 | 2971 break; |
| 2972 | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
2973 #else /* ! defined (HAVE_X11) */ |
| 286 | 2974 |
| 2975 case EnterWindow: | |
| 2976 if ((event.detail & 0xFF) == 1) | |
| 2977 break; /* Coming from our own subwindow */ | |
| 2978 if (event.subwindow != 0) | |
| 2979 break; /* Entering our own subwindow. */ | |
| 2980 | |
| 2981 { | |
| 771 | 2982 f = x_window_to_frame (event.window); |
| 2983 x_mouse_frame = f; | |
| 2984 | |
| 2985 x_new_focus_frame (f); | |
| 286 | 2986 } |
| 2987 break; | |
| 2988 | |
| 2989 case LeaveWindow: | |
| 2990 if ((event.detail & 0xFF) == 1) | |
| 2991 break; /* Entering our own subwindow */ | |
| 2992 if (event.subwindow != 0) | |
| 2993 break; /* Leaving our own subwindow. */ | |
| 2994 | |
| 771 | 2995 x_mouse_frame = 0; |
| 2996 if (x_focus_frame == 0 | |
| 2997 && x_input_frame != 0 | |
| 2998 && 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
|
2999 && event.window == FRAME_X_WINDOW (x_input_frame)) |
| 286 | 3000 { |
| 771 | 3001 f = x_input_frame; |
| 3002 x_input_frame = 0; | |
| 3003 if (f) | |
| 3004 frame_unhighlight (f); | |
| 286 | 3005 } |
| 3006 break; | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3007 #endif /* ! defined (HAVE_X11) */ |
| 286 | 3008 |
| 3009 #ifdef HAVE_X11 | |
| 3010 case MotionNotify: | |
| 3011 { | |
| 771 | 3012 f = x_window_to_frame (event.xmotion.window); |
| 3013 if (f) | |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
3014 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
|
3015 else |
| 286 | 3016 { |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3017 struct scroll_bar *bar = |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3018 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
|
3019 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3020 if (bar) |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3021 x_scroll_bar_note_movement (bar, &event); |
| 286 | 3022 } |
| 3023 } | |
| 3024 break; | |
| 3025 | |
| 3026 case ConfigureNotify: | |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3027 f = x_window_to_frame (event.xconfigure.window); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3028 if (f) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3029 { |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3030 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
|
3031 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
|
3032 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3033 /* 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
|
3034 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
|
3035 to check the pixel dimensions as well. */ |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3036 if (columns != f->width |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3037 || rows != f->height |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3038 || event.xconfigure.width != f->display.x->pixel_width |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3039 || event.xconfigure.height != f->display.x->pixel_height) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3040 { |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3041 change_frame_size (f, rows, columns, 0, 1); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3042 SET_FRAME_GARBAGED (f); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3043 } |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3044 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3045 f->display.x->pixel_width = event.xconfigure.width; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3046 f->display.x->pixel_height = event.xconfigure.height; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3047 f->display.x->left_pos = event.xconfigure.x; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3048 f->display.x->top_pos = event.xconfigure.y; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3049 } |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3050 break; |
| 286 | 3051 |
| 3052 case ButtonPress: | |
| 3053 case ButtonRelease: | |
| 3054 { | |
| 3055 /* If we decide we want to generate an event to be seen | |
| 3056 by the rest of Emacs, we put it here. */ | |
| 3057 struct input_event emacs_event; | |
| 3058 emacs_event.kind = no_event; | |
| 3059 | |
| 771 | 3060 f = x_window_to_frame (event.xbutton.window); |
| 3061 if (f) | |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3062 { |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3063 if (!x_focus_frame || (f == x_focus_frame)) |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3064 construct_mouse_click (&emacs_event, |
|
1935
047e196658fa
* xterm.c (XTread_socket): Pass the proper number of arguments to
Jim Blandy <jimb@redhat.com>
parents:
1875
diff
changeset
|
3065 &event, f); |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3066 } |
| 286 | 3067 else |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3068 { |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3069 struct scroll_bar *bar = |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3070 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
|
3071 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3072 if (bar) |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3073 x_scroll_bar_handle_click (bar, &event, &emacs_event); |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3074 } |
| 286 | 3075 |
| 3076 if (numchars >= 1 && emacs_event.kind != no_event) | |
| 3077 { | |
| 3078 bcopy (&emacs_event, bufp, sizeof (struct input_event)); | |
| 3079 bufp++; | |
| 3080 count++; | |
| 3081 numchars--; | |
| 3082 } | |
| 3083 } | |
| 3084 break; | |
| 3085 | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3086 #else /* ! defined (HAVE_X11) */ |
| 286 | 3087 case ButtonPressed: |
| 3088 case ButtonReleased: | |
| 771 | 3089 f = x_window_to_frame (event.window); |
| 3090 if (f) | |
| 286 | 3091 { |
| 771 | 3092 if (event.window == f->display.x->icon_desc) |
| 286 | 3093 { |
| 771 | 3094 x_make_frame_visible (f); |
| 286 | 3095 |
| 3096 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
|
3097 XWarpMouse (FRAME_X_WINDOW (f), 10, 10); |
| 286 | 3098 break; |
| 3099 } | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3100 if (event.window == FRAME_X_WINDOW (f)) |
| 286 | 3101 { |
| 771 | 3102 if (f->auto_raise) |
| 3103 x_raise_frame (f); | |
| 286 | 3104 } |
| 3105 } | |
| 3106 enqueue_event (&event, &x_mouse_queue); | |
| 3107 if (numchars >= 2) | |
| 3108 { | |
| 3109 bufp->kind = ascii_keystroke; | |
| 3110 bufp->code = (char) '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
|
3111 XSET (bufp->frame_or_window, Lisp_Frame, f); |
| 429 | 3112 XSET (bufp->time, Lisp_Int, event.xkey.time); |
| 286 | 3113 bufp++; |
| 3114 | |
| 3115 bufp->kind = ascii_keystroke; | |
| 3116 bufp->code = (char) 0; /* C-@ */ | |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
3117 XSET (bufp->frame_or_window, Lisp_Frame, f); |
| 429 | 3118 XSET (bufp->time, Lisp_Int, event.xkey.time); |
| 286 | 3119 bufp++; |
| 3120 | |
| 3121 count += 2; | |
| 3122 numchars -= 2; | |
| 3123 } | |
| 3124 break; | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3125 #endif /* ! defined (HAVE_X11) */ |
| 286 | 3126 |
| 3127 #ifdef HAVE_X11 | |
| 3128 | |
| 3129 case CirculateNotify: | |
| 3130 break; | |
| 3131 case CirculateRequest: | |
| 3132 break; | |
| 3133 | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3134 #endif /* ! defined (HAVE_X11) */ |
| 286 | 3135 |
| 3136 case MappingNotify: | |
|
1436
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
3137 /* Someone has changed the keyboard mapping - update the |
|
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
3138 local cache. */ |
|
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
3139 switch (event.xmapping.request) |
|
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
3140 { |
|
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
3141 case MappingModifier: |
|
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
3142 x_find_modifier_meanings (); |
|
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
3143 /* This is meant to fall through. */ |
|
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
3144 case MappingKeyboard: |
|
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
3145 XRefreshKeyboardMapping (&event.xmapping); |
|
e7c5faab6571
* xterm.c (compose_status): New variable.
Jim Blandy <jimb@redhat.com>
parents:
1389
diff
changeset
|
3146 } |
| 286 | 3147 break; |
| 3148 | |
| 3149 default: | |
| 3150 break; | |
| 3151 } | |
| 3152 } | |
| 3153 | |
| 3154 #if 0 | |
| 3155 #ifdef HAVE_SELECT | |
| 3156 if (expected && ! event_found) | |
| 3157 { | |
| 3158 /* AOJ 880406: if select returns true but XPending doesn't, it means that | |
| 3159 there is an EOF condition; in other words, that X has died. | |
| 3160 Act as if there had been a hangup. */ | |
| 3161 | |
| 3162 int fd = ConnectionNumber (x_current_display); | |
| 3163 int mask = 1 << fd; | |
| 3164 | |
| 3165 if (0 != select (fd + 1, &mask, (long *) 0, (long *) 0, | |
| 555 | 3166 (EMACS_TIME) 0) |
| 286 | 3167 && !XStuffPending ()) |
| 3168 kill (getpid (), SIGHUP); | |
| 3169 } | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3170 #endif /* ! defined (HAVE_SELECT) */ |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3171 #endif /* ! 0 */ |
| 286 | 3172 |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3173 #ifndef HAVE_X11 |
| 771 | 3174 if (updating_frame == 0) |
| 286 | 3175 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
|
3176 #endif |
| 286 | 3177 |
| 3178 UNBLOCK_INPUT; | |
| 3179 return count; | |
| 3180 } | |
| 3181 | |
| 3182 #ifndef HAVE_X11 | |
| 3183 /* Read and process only Expose events | |
| 3184 until we get an ExposeCopy event; then return. | |
| 3185 This is used in insert/delete line. | |
| 3186 We assume input is already blocked. */ | |
| 3187 | |
| 3188 static void | |
| 3189 x_read_exposes () | |
| 3190 { | |
| 771 | 3191 struct frame *f; |
| 286 | 3192 XKeyPressedEvent event; |
| 3193 | |
| 3194 while (1) | |
| 3195 { | |
| 3196 /* while there are more events*/ | |
| 3197 XMaskEvent (ExposeWindow | ExposeRegion | ExposeCopy, &event); | |
| 3198 switch (event.type) | |
| 3199 { | |
| 3200 case ExposeWindow: | |
| 3201 if (event.subwindow != 0) | |
| 3202 break; /* duplicate event */ | |
| 771 | 3203 f = x_window_to_frame (event.window); |
| 3204 if (event.window == f->display.x->icon_desc) | |
| 286 | 3205 { |
| 771 | 3206 refreshicon (f); |
| 286 | 3207 break; |
| 3208 } | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3209 if (event.window == FRAME_X_WINDOW (f)) |
| 286 | 3210 { |
| 3211 expose_all_windows = 1; | |
| 771 | 3212 f->display.x->needs_exposure = 1; |
| 286 | 3213 break; |
| 3214 } | |
| 3215 break; | |
| 3216 | |
| 3217 case ExposeRegion: | |
| 3218 if (event.subwindow != 0) | |
| 3219 break; /* duplicate event */ | |
| 771 | 3220 f = x_window_to_frame (event.window); |
| 3221 if (event.window == f->display.x->icon_desc) | |
| 286 | 3222 { |
| 771 | 3223 refreshicon (f); |
| 286 | 3224 break; |
| 3225 } | |
| 3226 /* If window already needs full redraw, ignore this rectangle. */ | |
| 771 | 3227 if (expose_all_windows && f->display.x->needs_exposure) |
| 286 | 3228 break; |
| 3229 /* Put the event on the queue of rectangles to redraw. */ | |
| 3230 if (enqueue_event (&event, &x_expose_queue)) | |
| 3231 /* If it is full, we can't record the rectangle, | |
| 3232 so redraw this entire window. */ | |
| 3233 { | |
| 3234 /* Say must check all windows' needs_exposure flags. */ | |
| 3235 expose_all_windows = 1; | |
| 771 | 3236 f->display.x->needs_exposure = 1; |
| 286 | 3237 } |
| 3238 break; | |
| 3239 | |
| 3240 case ExposeCopy: | |
| 3241 return; | |
| 3242 } | |
| 3243 } | |
| 3244 } | |
| 3245 #endif /* HAVE_X11 */ | |
| 3246 | |
| 3247 | |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3248 /* Drawing the cursor. */ |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3249 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3250 |
| 286 | 3251 /* Draw a hollow box cursor. Don't change the inside of the box. */ |
| 3252 | |
| 3253 static void | |
| 771 | 3254 x_draw_box (f) |
| 3255 struct frame *f; | |
| 286 | 3256 { |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
3257 int left = CHAR_TO_PIXEL_COL (f, f->cursor_x); |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
3258 int top = CHAR_TO_PIXEL_ROW (f, f->cursor_y); |
| 771 | 3259 int width = FONT_WIDTH (f->display.x->font); |
| 3260 int height = FONT_HEIGHT (f->display.x->font); | |
| 286 | 3261 |
| 3262 #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
|
3263 XDrawRectangle (x_current_display, FRAME_X_WINDOW (f), |
| 771 | 3264 f->display.x->cursor_gc, |
| 286 | 3265 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
|
3266 #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
|
3267 XPixSet (FRAME_X_WINDOW (f), |
| 286 | 3268 left, top, width, 1, |
| 771 | 3269 f->display.x->cursor_pixel); |
| 3270 | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3271 XPixSet (FRAME_X_WINDOW (f), |
| 286 | 3272 left, top, 1, height, |
| 771 | 3273 f->display.x->cursor_pixel); |
| 3274 | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3275 XPixSet (FRAME_X_WINDOW (f), |
| 286 | 3276 left+width-1, top, 1, height, |
| 771 | 3277 f->display.x->cursor_pixel); |
| 3278 | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3279 XPixSet (FRAME_X_WINDOW (f), |
| 286 | 3280 left, top+height-1, width, 1, |
| 771 | 3281 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
|
3282 #endif /* ! defined (HAVE_X11) */ |
| 286 | 3283 } |
| 3284 | |
| 771 | 3285 /* Clear the cursor of frame F to background color, |
| 286 | 3286 and mark the cursor as not shown. |
| 3287 This is used when the text where the cursor is | |
| 3288 is about to be rewritten. */ | |
| 3289 | |
| 3290 static void | |
| 771 | 3291 clear_cursor (f) |
| 3292 struct frame *f; | |
| 286 | 3293 { |
| 3294 int mask; | |
| 3295 | |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3296 if (! FRAME_VISIBLE_P (f) |
| 771 | 3297 || f->phys_cursor_x < 0) |
| 286 | 3298 return; |
| 3299 | |
| 3300 #ifdef HAVE_X11 | |
| 771 | 3301 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
|
3302 #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
|
3303 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
|
3304 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
|
3305 CHAR_TO_PIXEL_ROW (f, f->phys_cursor_y), |
| 771 | 3306 FONT_WIDTH (f->display.x->font), FONT_HEIGHT (f->display.x->font), |
| 3307 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
|
3308 #endif /* ! defined (HAVE_X11) */ |
| 771 | 3309 f->phys_cursor_x = -1; |
| 286 | 3310 } |
| 3311 | |
| 771 | 3312 /* Redraw the glyph at ROW, COLUMN on frame F, in the style |
| 429 | 3313 HIGHLIGHT. HIGHLIGHT is as defined for dumpglyphs. Return the |
| 3314 glyph drawn. */ | |
| 286 | 3315 |
| 3316 static void | |
| 771 | 3317 x_draw_single_glyph (f, row, column, glyph, highlight) |
| 3318 struct frame *f; | |
| 286 | 3319 int row, column; |
| 429 | 3320 GLYPH glyph; |
| 286 | 3321 int highlight; |
| 3322 { | |
| 771 | 3323 dumpglyphs (f, |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
3324 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
|
3325 CHAR_TO_PIXEL_ROW (f, row), |
|
2732
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
3326 &glyph, 1, highlight); |
| 286 | 3327 } |
| 3328 | |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3329 static void |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3330 x_display_bar_cursor (f, on) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3331 struct frame *f; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3332 int on; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3333 { |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3334 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
|
3335 |
|
2235
80e0d36bbb77
* xterm.c (x_display_box_cursor, x_display_bar_cursor): Don't
Jim Blandy <jimb@redhat.com>
parents:
2195
diff
changeset
|
3336 /* 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
|
3337 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
|
3338 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
|
3339 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
|
3340 return; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3341 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3342 if (! on && f->phys_cursor_x < 0) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3343 return; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3344 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3345 /* 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
|
3346 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
|
3347 if (f != updating_frame) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3348 { |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3349 curs_x = FRAME_CURSOR_X (f); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3350 curs_y = FRAME_CURSOR_Y (f); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3351 } |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3352 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3353 /* 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
|
3354 if (f->phys_cursor_x >= 0 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3355 && (!on |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3356 || f->phys_cursor_x != curs_x |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3357 || f->phys_cursor_y != curs_y |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3358 || f->display.x->current_cursor != bar_cursor)) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3359 { |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3360 /* 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
|
3361 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
|
3362 f->phys_cursor_glyph, |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3363 current_glyphs->highlight[f->phys_cursor_y]); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3364 f->phys_cursor_x = -1; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3365 } |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3366 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3367 /* 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
|
3368 if (on |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3369 && (f->phys_cursor_x < 0 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3370 || (f->display.x->current_cursor != bar_cursor))) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3371 { |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3372 f->phys_cursor_glyph |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3373 = ((current_glyphs->enable[curs_y] |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3374 && curs_x < current_glyphs->used[curs_y]) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3375 ? current_glyphs->glyphs[curs_y][curs_x] |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3376 : SPACEGLYPH); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3377 XFillRectangle (x_current_display, FRAME_X_WINDOW (f), |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3378 f->display.x->cursor_gc, |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3379 CHAR_TO_PIXEL_COL (f, curs_x), |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3380 CHAR_TO_PIXEL_ROW (f, curs_y), |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3381 1, FONT_HEIGHT (f->display.x->font)); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3382 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3383 f->phys_cursor_x = curs_x; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3384 f->phys_cursor_y = curs_y; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3385 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3386 f->display.x->current_cursor = bar_cursor; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3387 } |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3388 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3389 if (updating_frame != f) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3390 XFlushQueue (); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3391 } |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3392 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3393 |
| 771 | 3394 /* Turn the displayed cursor of frame F on or off according to ON. |
| 286 | 3395 If ON is nonzero, where to put the cursor is specified |
| 771 | 3396 by F->cursor_x and F->cursor_y. */ |
| 286 | 3397 |
| 3398 static void | |
| 771 | 3399 x_display_box_cursor (f, on) |
| 3400 struct frame *f; | |
| 286 | 3401 int on; |
| 3402 { | |
| 771 | 3403 struct frame_glyphs *current_glyphs = FRAME_CURRENT_GLYPHS (f); |
| 3404 | |
|
2235
80e0d36bbb77
* xterm.c (x_display_box_cursor, x_display_bar_cursor): Don't
Jim Blandy <jimb@redhat.com>
parents:
2195
diff
changeset
|
3405 /* 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
|
3406 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
|
3407 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
|
3408 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
|
3409 return; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3410 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3411 /* 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
|
3412 if (!on && f->phys_cursor_x < 0) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3413 return; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3414 |
| 771 | 3415 /* If we're not updating, then we want to use the current frame's |
| 708 | 3416 cursor position, not our local idea of where the cursor ought to be. */ |
| 771 | 3417 if (f != updating_frame) |
| 708 | 3418 { |
| 771 | 3419 curs_x = FRAME_CURSOR_X (f); |
| 3420 curs_y = FRAME_CURSOR_Y (f); | |
| 708 | 3421 } |
| 3422 | |
| 286 | 3423 /* If cursor is currently being shown and we don't want it to be |
| 3424 or it is in the wrong place, | |
| 3425 or we want a hollow box and it's not so, (pout!) | |
| 3426 erase it. */ | |
| 771 | 3427 if (f->phys_cursor_x >= 0 |
| 286 | 3428 && (!on |
| 771 | 3429 || f->phys_cursor_x != curs_x |
| 3430 || f->phys_cursor_y != curs_y | |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3431 || (f->display.x->current_cursor != hollow_box_cursor |
| 771 | 3432 && (f != x_highlight_frame)))) |
| 286 | 3433 { |
| 3434 /* Erase the cursor by redrawing the character underneath it. */ | |
| 771 | 3435 x_draw_single_glyph (f, f->phys_cursor_y, f->phys_cursor_x, |
| 3436 f->phys_cursor_glyph, | |
| 3437 current_glyphs->highlight[f->phys_cursor_y]); | |
| 3438 f->phys_cursor_x = -1; | |
| 286 | 3439 } |
| 3440 | |
| 3441 /* If we want to show a cursor, | |
| 3442 or we want a box cursor and it's not so, | |
| 3443 write it in the right place. */ | |
| 3444 if (on | |
| 771 | 3445 && (f->phys_cursor_x < 0 |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3446 || (f->display.x->current_cursor != filled_box_cursor |
| 771 | 3447 && f == x_highlight_frame))) |
| 286 | 3448 { |
| 771 | 3449 f->phys_cursor_glyph |
| 708 | 3450 = ((current_glyphs->enable[curs_y] |
| 3451 && curs_x < current_glyphs->used[curs_y]) | |
| 3452 ? current_glyphs->glyphs[curs_y][curs_x] | |
| 429 | 3453 : SPACEGLYPH); |
| 771 | 3454 if (f != x_highlight_frame) |
| 286 | 3455 { |
| 771 | 3456 x_draw_box (f); |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3457 f->display.x->current_cursor = hollow_box_cursor; |
| 286 | 3458 } |
| 3459 else | |
| 3460 { | |
| 771 | 3461 x_draw_single_glyph (f, curs_y, curs_x, |
| 3462 f->phys_cursor_glyph, 2); | |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3463 f->display.x->current_cursor = filled_box_cursor; |
| 286 | 3464 } |
| 3465 | |
| 771 | 3466 f->phys_cursor_x = curs_x; |
| 3467 f->phys_cursor_y = curs_y; | |
| 286 | 3468 } |
| 3469 | |
| 771 | 3470 if (updating_frame != f) |
| 286 | 3471 XFlushQueue (); |
| 3472 } | |
| 3473 | |
| 771 | 3474 x_display_cursor (f, on) |
| 3475 struct frame *f; | |
| 286 | 3476 int on; |
| 3477 { | |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3478 if (FRAME_DESIRED_CURSOR (f) == filled_box_cursor) |
| 771 | 3479 x_display_box_cursor (f, on); |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3480 else if (FRAME_DESIRED_CURSOR (f) == bar_cursor) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3481 x_display_bar_cursor (f, on); |
| 286 | 3482 else |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3483 /* Those are the only two we have implemented! */ |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3484 abort (); |
| 286 | 3485 } |
| 3486 | |
| 3487 /* Icons. */ | |
| 3488 | |
| 771 | 3489 /* Refresh bitmap kitchen sink icon for frame F |
| 286 | 3490 when we get an expose event for it. */ |
| 3491 | |
| 771 | 3492 refreshicon (f) |
| 3493 struct frame *f; | |
| 286 | 3494 { |
| 3495 #ifdef HAVE_X11 | |
| 3496 /* 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
|
3497 #else /* ! defined (HAVE_X11) */ |
| 286 | 3498 int mask; |
| 3499 | |
| 771 | 3500 if (f->display.x->icon_bitmap_flag) |
| 3501 XBitmapBitsPut (f->display.x->icon_desc, 0, 0, sink_width, sink_height, | |
| 286 | 3502 sink_bits, BlackPixel, WHITE_PIX_DEFAULT, |
| 3503 icon_bitmap, GXcopy, AllPlanes); | |
| 3504 else | |
| 3505 { | |
| 771 | 3506 extern struct frame *selected_frame; |
| 286 | 3507 struct Lisp_String *str; |
| 3508 unsigned char *string; | |
| 3509 | |
| 3510 string | |
| 771 | 3511 = XSTRING (XBUFFER (XWINDOW (f->selected_window)->buffer)->name)->data; |
| 3512 | |
| 3513 if (f->display.x->icon_label != string) | |
| 286 | 3514 { |
| 771 | 3515 f->display.x->icon_label = string; |
| 3516 XChangeWindow (f->display.x->icon_desc, | |
| 286 | 3517 XQueryWidth (string, icon_font_info->id) + 10, |
| 3518 icon_font_info->height + 10); | |
| 3519 } | |
| 3520 | |
| 771 | 3521 XText (f->display.x->icon_desc, 5, 5, string, |
| 286 | 3522 str->size, icon_font_info->id, |
| 3523 BLACK_PIX_DEFAULT, WHITE_PIX_DEFAULT); | |
| 3524 } | |
| 3525 XFlushQueue (); | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3526 #endif /* ! defined (HAVE_X11) */ |
| 286 | 3527 } |
| 3528 | |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3529 /* Make the x-window of frame F use the gnu icon bitmap. */ |
| 286 | 3530 |
| 3531 int | |
| 771 | 3532 x_bitmap_icon (f) |
| 3533 struct frame *f; | |
| 286 | 3534 { |
| 3535 int mask; | |
| 3536 Window icon_window; | |
| 3537 | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3538 if (FRAME_X_WINDOW (f) == 0) |
| 286 | 3539 return 1; |
| 3540 | |
| 3541 #ifdef HAVE_X11 | |
| 3542 if (icon_bitmap) | |
| 3543 XFreePixmap (x_current_display, icon_bitmap); | |
| 3544 | |
| 3545 icon_bitmap = | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3546 XCreateBitmapFromData (x_current_display, FRAME_X_WINDOW (f), |
| 286 | 3547 gnu_bits, gnu_width, gnu_height); |
| 771 | 3548 x_wm_set_icon_pixmap (f, icon_bitmap); |
| 3549 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
|
3550 #else /* ! defined (HAVE_X11) */ |
| 771 | 3551 if (f->display.x->icon_desc) |
| 286 | 3552 { |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3553 XClearIconWindow (FRAME_X_WINDOW (f)); |
| 771 | 3554 XDestroyWindow (f->display.x->icon_desc); |
| 286 | 3555 } |
| 3556 | |
| 771 | 3557 icon_window = XCreateWindow (f->display.x->parent_desc, |
| 286 | 3558 0, 0, sink_width, sink_height, |
| 3559 2, WhitePixmap, (Pixmap) NULL); | |
| 3560 | |
| 3561 if (icon_window == 0) | |
| 3562 return 1; | |
| 3563 | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3564 XSetIconWindow (FRAME_X_WINDOW (f), icon_window); |
| 286 | 3565 XSelectInput (icon_window, ExposeWindow | UnmapWindow); |
| 3566 | |
| 771 | 3567 f->display.x->icon_desc = icon_window; |
| 3568 f->display.x->icon_bitmap_flag = 1; | |
| 286 | 3569 |
| 3570 if (icon_bitmap == 0) | |
| 3571 icon_bitmap | |
| 3572 = 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
|
3573 #endif /* ! defined (HAVE_X11) */ |
| 286 | 3574 |
| 3575 return 0; | |
| 3576 } | |
| 3577 | |
| 3578 | |
| 771 | 3579 /* Make the x-window of frame F use a rectangle with text. */ |
| 286 | 3580 |
| 3581 int | |
| 771 | 3582 x_text_icon (f, icon_name) |
| 3583 struct frame *f; | |
| 286 | 3584 char *icon_name; |
| 3585 { | |
| 3586 #ifndef HAVE_X11 | |
| 3587 int mask; | |
| 3588 int width; | |
| 3589 Window icon_window; | |
| 3590 char *X_DefaultValue; | |
| 3591 Bitmap b1; | |
| 3592 | |
| 3593 #ifndef WhitePixel | |
| 3594 #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
|
3595 #endif /* WhitePixel */ |
| 286 | 3596 |
| 3597 #ifndef BlackPixel | |
| 3598 #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
|
3599 #endif /* BlackPixel */ |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3600 #endif /* HAVE_X11 */ |
| 286 | 3601 |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3602 if (FRAME_X_WINDOW (f) == 0) |
| 286 | 3603 return 1; |
| 3604 | |
| 3605 #ifdef HAVE_X11 | |
| 3606 if (icon_name) | |
| 771 | 3607 f->display.x->icon_label = icon_name; |
| 286 | 3608 else |
| 771 | 3609 if (! f->display.x->icon_label) |
| 3610 f->display.x->icon_label = " *emacs* "; | |
| 286 | 3611 |
|
2661
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
3612 #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
|
3613 XSetIconName (x_current_display, FRAME_X_WINDOW (f), |
| 771 | 3614 (char *) f->display.x->icon_label); |
|
2661
77f1457d000e
Implement extra_keyboard_modifiers properly.
Jim Blandy <jimb@redhat.com>
parents:
2474
diff
changeset
|
3615 #endif |
| 286 | 3616 |
| 771 | 3617 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
|
3618 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
|
3619 #else /* ! defined (HAVE_X11) */ |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3620 if (icon_font_info == 0) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3621 icon_font_info |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3622 = XGetFont (XGetDefault (XDISPLAY |
|
2279
012b04efa234
* emacs.c (Finvocation_name): New function.
Jim Blandy <jimb@redhat.com>
parents:
2235
diff
changeset
|
3623 (char *) XSTRING (Vinvocation_name)->data, |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3624 "BodyFont")); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
3625 |
| 771 | 3626 if (f->display.x->icon_desc) |
| 286 | 3627 { |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3628 XClearIconWindow (XDISPLAY FRAME_X_WINDOW (f)); |
| 771 | 3629 XDestroyWindow (XDISPLAY f->display.x->icon_desc); |
| 286 | 3630 } |
| 3631 | |
| 3632 if (icon_name) | |
| 771 | 3633 f->display.x->icon_label = (unsigned char *) icon_name; |
| 286 | 3634 else |
| 771 | 3635 if (! f->display.x->icon_label) |
| 3636 f->display.x->icon_label = XSTRING (f->name)->data; | |
| 3637 | |
| 3638 width = XStringWidth (f->display.x->icon_label, icon_font_info, 0, 0); | |
| 3639 icon_window = XCreateWindow (f->display.x->parent_desc, | |
| 3640 f->display.x->left_pos, | |
| 3641 f->display.x->top_pos, | |
| 286 | 3642 width + 10, icon_font_info->height + 10, |
| 3643 2, BlackPixmap, WhitePixmap); | |
| 3644 | |
| 3645 if (icon_window == 0) | |
| 3646 return 1; | |
| 3647 | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3648 XSetIconWindow (FRAME_X_WINDOW (f), icon_window); |
| 286 | 3649 XSelectInput (icon_window, ExposeWindow | ExposeRegion | UnmapWindow | ButtonPressed); |
| 3650 | |
| 771 | 3651 f->display.x->icon_desc = icon_window; |
| 3652 f->display.x->icon_bitmap_flag = 0; | |
| 3653 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
|
3654 #endif /* ! defined (HAVE_X11) */ |
| 286 | 3655 |
| 3656 return 0; | |
| 3657 } | |
| 3658 | |
| 621 | 3659 /* Handling X errors. */ |
| 3660 | |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
3661 /* 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
|
3662 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
|
3663 |
| 621 | 3664 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
|
3665 x_connection_closed () |
| 621 | 3666 { |
| 3667 if (_Xdebug) | |
| 3668 abort (); | |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
3669 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
3670 shut_down_emacs (0); |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
3671 |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
3672 exit (70); |
| 621 | 3673 } |
| 3674 | |
|
1875
f569bc4e9b8f
* xterm.c (x_set_window_size): Call change_frame_size instead of
Jim Blandy <jimb@redhat.com>
parents:
1841
diff
changeset
|
3675 /* 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
|
3676 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
|
3677 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
|
3678 static int |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3679 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
|
3680 Display *display; |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3681 XErrorEvent *error; |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3682 { |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3683 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
|
3684 |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3685 /* 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
|
3686 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
|
3687 |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3688 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
|
3689 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
|
3690 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
|
3691 |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
3692 /* 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
|
3693 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
|
3694 abort (); |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
3695 |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3696 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
|
3697 } |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3698 |
|
1875
f569bc4e9b8f
* xterm.c (x_set_window_size): Call change_frame_size instead of
Jim Blandy <jimb@redhat.com>
parents:
1841
diff
changeset
|
3699 /* 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
|
3700 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
|
3701 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
|
3702 static int |
|
f569bc4e9b8f
* xterm.c (x_set_window_size): Call change_frame_size instead of
Jim Blandy <jimb@redhat.com>
parents:
1841
diff
changeset
|
3703 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
|
3704 Display *display; |
|
f569bc4e9b8f
* xterm.c (x_set_window_size): Call change_frame_size instead of
Jim Blandy <jimb@redhat.com>
parents:
1841
diff
changeset
|
3705 { |
|
f569bc4e9b8f
* xterm.c (x_set_window_size): Call change_frame_size instead of
Jim Blandy <jimb@redhat.com>
parents:
1841
diff
changeset
|
3706 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
|
3707 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
|
3708 |
|
f569bc4e9b8f
* xterm.c (x_set_window_size): Call change_frame_size instead of
Jim Blandy <jimb@redhat.com>
parents:
1841
diff
changeset
|
3709 /* 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
|
3710 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
|
3711 abort (); |
|
f569bc4e9b8f
* xterm.c (x_set_window_size): Call change_frame_size instead of
Jim Blandy <jimb@redhat.com>
parents:
1841
diff
changeset
|
3712 |
|
f569bc4e9b8f
* xterm.c (x_set_window_size): Call change_frame_size instead of
Jim Blandy <jimb@redhat.com>
parents:
1841
diff
changeset
|
3713 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
|
3714 } |
|
f569bc4e9b8f
* xterm.c (x_set_window_size): Call change_frame_size instead of
Jim Blandy <jimb@redhat.com>
parents:
1841
diff
changeset
|
3715 |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3716 /* A buffer for storing X error messages. */ |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3717 static char (*x_caught_error_message)[200]; |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3718 |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3719 /* 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
|
3720 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
|
3721 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
|
3722 static int |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3723 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
|
3724 Display *display; |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3725 XErrorEvent *error; |
| 286 | 3726 { |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3727 XGetErrorText (display, error->error_code, |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3728 *x_caught_error_message, sizeof (*x_caught_error_message)); |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3729 } |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3730 |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3731 |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3732 /* 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
|
3733 |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3734 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
|
3735 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
|
3736 |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3737 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
|
3738 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
|
3739 |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3740 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
|
3741 |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3742 void x_catch_errors(), x_check_errors (), 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
|
3743 |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3744 void |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3745 x_catch_errors () |
| 286 | 3746 { |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3747 /* 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
|
3748 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
|
3749 |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3750 /* Set up the error buffer. */ |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3751 x_caught_error_message = |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3752 (char (*)[]) xmalloc (sizeof (*x_caught_error_message)); |
|
1077
d6ee6ff7562d
* xterm.c (x_catch_errors): Don't forget to initialize
Jim Blandy <jimb@redhat.com>
parents:
1052
diff
changeset
|
3753 (*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
|
3754 |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3755 /* 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
|
3756 XHandleError (x_error_catcher); |
| 286 | 3757 } |
| 3758 | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3759 /* 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
|
3760 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
|
3761 sprintf (a buffer, FORMAT, the x error message text) as the text. */ |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3762 void |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3763 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
|
3764 char *format; |
| 286 | 3765 { |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3766 /* 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
|
3767 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
|
3768 |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3769 if ((*x_caught_error_message)[0]) |
| 286 | 3770 { |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3771 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
|
3772 |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3773 sprintf (buf, format, *x_caught_error_message); |
|
2439
b6c62e4abf59
Put interrupt input blocking in a separate file from xterm.h.
Jim Blandy <jimb@redhat.com>
parents:
2353
diff
changeset
|
3774 xfree (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
|
3775 |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3776 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
|
3777 error (buf); |
| 286 | 3778 } |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3779 } |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3780 |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3781 void |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3782 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
|
3783 { |
|
2439
b6c62e4abf59
Put interrupt input blocking in a separate file from xterm.h.
Jim Blandy <jimb@redhat.com>
parents:
2353
diff
changeset
|
3784 xfree (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
|
3785 XHandleError (x_error_quitter); |
| 286 | 3786 } |
| 3787 | |
| 3788 #if 0 | |
| 3789 static unsigned int x_wire_count; | |
| 3790 x_trace_wire () | |
| 3791 { | |
| 3792 fprintf (stderr, "Lib call: %d\n", ++x_wire_count); | |
| 3793 } | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3794 #endif /* ! 0 */ |
| 286 | 3795 |
| 3796 | |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3797 /* 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
|
3798 |
| 771 | 3799 /* Set the font of the x-window specified by frame F |
| 286 | 3800 to the font named NEWNAME. This is safe to use |
| 771 | 3801 even before F has an actual x-window. */ |
| 286 | 3802 |
| 3803 #ifdef HAVE_X11 | |
| 3804 | |
| 3805 /* A table of all the fonts we have already loaded. */ | |
| 3806 static XFontStruct **x_font_table; | |
| 3807 | |
| 3808 /* The current capacity of x_font_table. */ | |
| 3809 static int x_font_table_size; | |
| 3810 | |
| 3811 /* The number of fonts actually stored in x_font_table. | |
| 3812 x_font_table[n] is used and valid iff 0 <= n < n_fonts. | |
| 3813 0 <= n_fonts <= x_font_table_size. */ | |
| 3814 static int n_fonts; | |
| 3815 | |
| 771 | 3816 x_new_font (f, fontname) |
| 3817 struct frame *f; | |
| 286 | 3818 register char *fontname; |
| 3819 { | |
| 3820 XFontStruct *temp; | |
| 3821 int already_loaded; | |
| 3822 int n_matching_fonts; | |
| 3823 XFontStruct *font_info; | |
| 3824 char **font_names; | |
| 3825 | |
| 3826 /* Get a list of all the fonts that match this name. Once we | |
| 3827 have a list of matching fonts, we compare them against the fonts | |
| 3828 we already have by comparing font ids. */ | |
| 3829 font_names = (char **) XListFontsWithInfo (x_current_display, fontname, | |
| 3830 1024, &n_matching_fonts, | |
| 3831 &font_info); | |
| 3832 /* If the server couldn't find any fonts whose named matched fontname, | |
| 3833 return an error code. */ | |
| 3834 if (n_matching_fonts == 0) | |
| 3835 return 1; | |
| 3836 | |
| 429 | 3837 /* See if we've already loaded a matching font. */ |
| 286 | 3838 { |
| 3839 int i, j; | |
| 3840 | |
| 3841 already_loaded = 0; | |
| 3842 for (i = 0; i < n_fonts; i++) | |
| 3843 for (j = 0; j < n_matching_fonts; j++) | |
| 3844 if (x_font_table[i]->fid == font_info[j].fid) | |
| 3845 { | |
| 3846 already_loaded = i; | |
| 3847 goto found_font; | |
| 3848 } | |
| 3849 } | |
| 3850 found_font: | |
| 3851 | |
| 3852 /* If we have, just return it from the table. */ | |
| 3853 if (already_loaded) | |
| 771 | 3854 f->display.x->font = x_font_table[already_loaded]; |
| 429 | 3855 |
| 286 | 3856 /* Otherwise, load the font and add it to the table. */ |
| 3857 else | |
| 3858 { | |
| 3859 XFontStruct *font; | |
| 3860 | |
| 3861 font = (XFontStruct *) XLoadQueryFont (x_current_display, fontname); | |
| 3862 if (! font) | |
| 3863 return 1; | |
| 3864 | |
| 3865 /* Do we need to create the table? */ | |
| 3866 if (x_font_table_size == 0) | |
| 3867 { | |
| 3868 x_font_table_size = 16; | |
| 3869 x_font_table | |
| 3870 = (XFontStruct **) xmalloc (x_font_table_size | |
| 3871 * sizeof (x_font_table[0])); | |
| 3872 } | |
| 3873 /* Do we need to grow the table? */ | |
| 3874 else if (n_fonts >= x_font_table_size) | |
| 3875 { | |
| 429 | 3876 x_font_table_size *= 2; |
| 286 | 3877 x_font_table |
| 3878 = (XFontStruct **) xrealloc (x_font_table, | |
| 3879 (x_font_table_size | |
| 3880 * sizeof (x_font_table[0]))); | |
| 3881 } | |
| 3882 | |
| 771 | 3883 f->display.x->font = x_font_table[n_fonts++] = font; |
| 286 | 3884 } |
| 3885 | |
| 3886 /* Free the information from XListFontsWithInfo. The data | |
| 3887 we actually retain comes from XLoadQueryFont. */ | |
| 3888 XFreeFontInfo (font_names, font_info, n_matching_fonts); | |
| 3889 | |
| 771 | 3890 /* 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
|
3891 if (FRAME_X_WINDOW (f) != 0) |
| 286 | 3892 { |
| 771 | 3893 XSetFont (x_current_display, f->display.x->normal_gc, |
| 3894 f->display.x->font->fid); | |
| 3895 XSetFont (x_current_display, f->display.x->reverse_gc, | |
| 3896 f->display.x->font->fid); | |
| 3897 XSetFont (x_current_display, f->display.x->cursor_gc, | |
| 3898 f->display.x->font->fid); | |
| 3899 | |
| 3900 x_set_window_size (f, f->width, f->height); | |
| 286 | 3901 } |
| 3902 | |
| 3903 return 0; | |
| 3904 } | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3905 #else /* ! defined (HAVE_X11) */ |
| 771 | 3906 x_new_font (f, newname) |
| 3907 struct frame *f; | |
| 286 | 3908 register char *newname; |
| 3909 { | |
| 3910 FONT_TYPE *temp; | |
| 3911 int mask; | |
| 3912 | |
| 3913 temp = XGetFont (newname); | |
| 3914 if (temp == (FONT_TYPE *) 0) | |
| 3915 return 1; | |
| 3916 | |
| 771 | 3917 if (f->display.x->font) |
| 3918 XLoseFont (f->display.x->font); | |
| 3919 | |
| 3920 f->display.x->font = temp; | |
| 3921 | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3922 if (FRAME_X_WINDOW (f) != 0) |
| 771 | 3923 x_set_window_size (f, f->width, f->height); |
| 286 | 3924 |
| 3925 return 0; | |
| 3926 } | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3927 #endif /* ! defined (HAVE_X11) */ |
| 286 | 3928 |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3929 /* X Window sizes and positions. */ |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3930 |
| 771 | 3931 x_calc_absolute_position (f) |
| 3932 struct frame *f; | |
| 286 | 3933 { |
| 3934 #ifdef HAVE_X11 | |
| 771 | 3935 if (f->display.x->left_pos < 0) |
| 3936 f->display.x->left_pos | |
|
1530
a7f8a1fe258e
* xterm.c (x_convert_modifiers): Declare this to return an
Jim Blandy <jimb@redhat.com>
parents:
1436
diff
changeset
|
3937 = x_screen_width - PIXEL_WIDTH (f) + f->display.x->left_pos; |
| 771 | 3938 |
| 3939 if (f->display.x->top_pos < 0) | |
| 3940 f->display.x->top_pos | |
|
1530
a7f8a1fe258e
* xterm.c (x_convert_modifiers): Declare this to return an
Jim Blandy <jimb@redhat.com>
parents:
1436
diff
changeset
|
3941 = x_screen_height - PIXEL_HEIGHT (f) + f->display.x->top_pos; |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3942 #else /* ! defined (HAVE_X11) */ |
| 286 | 3943 WINDOWINFO_TYPE parentinfo; |
| 3944 | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
3945 XGetWindowInfo (FRAME_X_WINDOW (f), &parentinfo); |
| 771 | 3946 |
| 3947 if (f->display.x->left_pos < 0) | |
| 3948 f->display.x->left_pos = parentinfo.width + (f->display.x->left_pos + 1) | |
| 3949 - PIXEL_WIDTH (f) - 2 * f->display.x->internal_border_width; | |
| 3950 | |
| 3951 if (f->display.x->top_pos < 0) | |
| 3952 f->display.x->top_pos = parentinfo.height + (f->display.x->top_pos + 1) | |
| 3953 - 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
|
3954 #endif /* ! defined (HAVE_X11) */ |
| 286 | 3955 } |
| 3956 | |
| 771 | 3957 x_set_offset (f, xoff, yoff) |
| 3958 struct frame *f; | |
| 286 | 3959 register int xoff, yoff; |
| 3960 { | |
| 771 | 3961 f->display.x->top_pos = yoff; |
| 3962 f->display.x->left_pos = xoff; | |
| 3963 x_calc_absolute_position (f); | |
| 286 | 3964 |
| 3965 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
|
3966 XMoveWindow (XDISPLAY FRAME_X_WINDOW (f), |
| 771 | 3967 f->display.x->left_pos, f->display.x->top_pos); |
| 286 | 3968 #ifdef HAVE_X11 |
| 771 | 3969 x_wm_set_size_hint (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
|
3970 #endif /* ! defined (HAVE_X11) */ |
| 286 | 3971 UNBLOCK_INPUT; |
| 3972 } | |
| 3973 | |
| 771 | 3974 /* Call this to change the size of frame F's x-window. */ |
| 3975 | |
| 3976 x_set_window_size (f, cols, rows) | |
| 3977 struct frame *f; | |
|
976
cbdfc337ec8f
* xterm.c (x_wm_hints): New variable.
Jim Blandy <jimb@redhat.com>
parents:
786
diff
changeset
|
3978 int cols, rows; |
| 286 | 3979 { |
| 3980 int pixelwidth, pixelheight; | |
| 3981 int mask; | |
| 3982 | |
| 3983 BLOCK_INPUT; | |
| 3984 | |
|
976
cbdfc337ec8f
* xterm.c (x_wm_hints): New variable.
Jim Blandy <jimb@redhat.com>
parents:
786
diff
changeset
|
3985 check_frame_size (f, &rows, &cols); |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3986 f->display.x->vertical_scroll_bar_extra = |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3987 (FRAME_HAS_VERTICAL_SCROLL_BARS (f) |
|
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
3988 ? VERTICAL_SCROLL_BAR_PIXEL_WIDTH (f) |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3989 : 0); |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
3990 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
|
3991 pixelheight = CHAR_TO_PIXEL_HEIGHT (f, rows); |
| 286 | 3992 |
| 3993 #ifdef HAVE_X11 | |
| 771 | 3994 x_wm_set_size_hint (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
|
3995 #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
|
3996 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
|
3997 |
|
cbdfc337ec8f
* xterm.c (x_wm_hints): New variable.
Jim Blandy <jimb@redhat.com>
parents:
786
diff
changeset
|
3998 /* 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
|
3999 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
|
4000 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
|
4001 ConfigureNotify event gets here. |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4002 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4003 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
|
4004 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
|
4005 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
|
4006 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
|
4007 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
|
4008 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
|
4009 PIXEL_WIDTH (f) = pixelwidth; |
|
cbdfc337ec8f
* xterm.c (x_wm_hints): New variable.
Jim Blandy <jimb@redhat.com>
parents:
786
diff
changeset
|
4010 PIXEL_HEIGHT (f) = pixelheight; |
|
cbdfc337ec8f
* xterm.c (x_wm_hints): New variable.
Jim Blandy <jimb@redhat.com>
parents:
786
diff
changeset
|
4011 |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4012 /* 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
|
4013 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
|
4014 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
|
4015 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
|
4016 SET_FRAME_GARBAGED (f); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4017 |
| 286 | 4018 XFlushQueue (); |
| 4019 UNBLOCK_INPUT; | |
| 4020 } | |
| 4021 | |
| 4022 #ifndef HAVE_X11 | |
| 771 | 4023 x_set_resize_hint (f) |
| 4024 struct frame *f; | |
| 286 | 4025 { |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
4026 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
|
4027 2 * f->display.x->internal_border_width, |
| 771 | 4028 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
|
4029 FONT_WIDTH (f->display.x->font), |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
4030 FONT_HEIGHT (f->display.x->font)); |
| 286 | 4031 } |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4032 #endif /* HAVE_X11 */ |
| 286 | 4033 |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
4034 /* Mouse warping, focus shifting, raising and lowering. */ |
| 286 | 4035 |
| 771 | 4036 x_set_mouse_position (f, x, y) |
| 4037 struct frame *f; | |
| 286 | 4038 int x, y; |
| 4039 { | |
| 4040 int pix_x, pix_y; | |
| 4041 | |
| 771 | 4042 x_raise_frame (f); |
| 286 | 4043 |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
4044 pix_x = CHAR_TO_PIXEL_COL (f, x) + FONT_WIDTH (f->display.x->font) / 2; |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
4045 pix_y = CHAR_TO_PIXEL_ROW (f, y) + FONT_HEIGHT (f->display.x->font) / 2; |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
4046 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
4047 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
|
4048 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
|
4049 |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
4050 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
|
4051 if (pix_y > PIXEL_HEIGHT (f)) pix_y = PIXEL_HEIGHT (f); |
| 286 | 4052 |
| 4053 BLOCK_INPUT; | |
| 4054 | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4055 XWarpMousePointer (FRAME_X_WINDOW (f), pix_x, pix_y); |
| 286 | 4056 UNBLOCK_INPUT; |
| 4057 } | |
| 4058 | |
| 4059 #ifdef HAVE_X11 | |
| 771 | 4060 x_focus_on_frame (f) |
| 4061 struct frame *f; | |
| 286 | 4062 { |
| 771 | 4063 x_raise_frame (f); |
| 369 | 4064 #if 0 |
| 4065 /* I don't think that the ICCCM allows programs to do things like this | |
| 4066 without the interaction of the window manager. Whatever you end up | |
| 771 | 4067 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
|
4068 XSetInputFocus (x_current_display, FRAME_X_WINDOW (f), |
| 286 | 4069 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
|
4070 #endif /* ! 0 */ |
| 286 | 4071 } |
| 4072 | |
| 771 | 4073 x_unfocus_frame (f) |
| 4074 struct frame *f; | |
| 286 | 4075 { |
| 369 | 4076 #if 0 |
| 771 | 4077 /* Look at the remarks in x_focus_on_frame. */ |
| 4078 if (x_focus_frame == f) | |
| 286 | 4079 XSetInputFocus (x_current_display, PointerRoot, |
| 4080 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
|
4081 #endif /* ! 0 */ |
| 286 | 4082 } |
| 4083 | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4084 #endif /* ! defined (HAVE_X11) */ |
| 286 | 4085 |
| 771 | 4086 /* Raise frame F. */ |
| 4087 | |
| 4088 x_raise_frame (f) | |
| 4089 struct frame *f; | |
| 286 | 4090 { |
|
1658
452ba03935d7
* xterm.c (XTread_socket): When we get MapNotify, UnmapNotify,
Jim Blandy <jimb@redhat.com>
parents:
1530
diff
changeset
|
4091 if (f->async_visible) |
| 286 | 4092 { |
| 4093 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
|
4094 XRaiseWindow (XDISPLAY FRAME_X_WINDOW (f)); |
| 286 | 4095 XFlushQueue (); |
| 4096 UNBLOCK_INPUT; | |
| 4097 } | |
| 4098 } | |
| 4099 | |
| 771 | 4100 /* Lower frame F. */ |
| 4101 | |
| 4102 x_lower_frame (f) | |
| 4103 struct frame *f; | |
| 286 | 4104 { |
|
1658
452ba03935d7
* xterm.c (XTread_socket): When we get MapNotify, UnmapNotify,
Jim Blandy <jimb@redhat.com>
parents:
1530
diff
changeset
|
4105 if (f->async_visible) |
| 286 | 4106 { |
| 4107 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
|
4108 XLowerWindow (XDISPLAY FRAME_X_WINDOW (f)); |
| 286 | 4109 XFlushQueue (); |
| 4110 UNBLOCK_INPUT; | |
| 4111 } | |
| 4112 } | |
| 4113 | |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4114 static void |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4115 XTframe_raise_lower (f, raise) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4116 FRAME_PTR f; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4117 int raise; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4118 { |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4119 if (raise) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4120 x_raise_frame (f); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4121 else |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4122 x_lower_frame (f); |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4123 } |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4124 |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4125 |
| 286 | 4126 /* Change from withdrawn state to mapped state. */ |
| 4127 | |
| 771 | 4128 x_make_frame_visible (f) |
| 4129 struct frame *f; | |
| 286 | 4130 { |
| 4131 int mask; | |
| 4132 | |
| 429 | 4133 BLOCK_INPUT; |
| 4134 | |
| 771 | 4135 if (! FRAME_VISIBLE_P (f)) |
| 286 | 4136 { |
| 4137 #ifdef HAVE_X11 | |
| 429 | 4138 if (! EQ (Vx_no_window_manager, Qt)) |
| 771 | 4139 x_wm_set_window_state (f, NormalState); |
| 4140 | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4141 XMapWindow (XDISPLAY FRAME_X_WINDOW (f)); |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
4142 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
|
4143 XMapSubwindows (x_current_display, FRAME_X_WINDOW (f)); |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4144 #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
|
4145 XMapWindow (XDISPLAY FRAME_X_WINDOW (f)); |
| 771 | 4146 if (f->display.x->icon_desc != 0) |
| 4147 XUnmapWindow (f->display.x->icon_desc); | |
| 429 | 4148 |
| 4149 /* 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
|
4150 f->async_visible = 1; |
|
452ba03935d7
* xterm.c (XTread_socket): When we get MapNotify, UnmapNotify,
Jim Blandy <jimb@redhat.com>
parents:
1530
diff
changeset
|
4151 f->async_iconified = 0; |
| 771 | 4152 |
| 4153 /* NOTE: this may cause problems for the first frame. */ | |
| 429 | 4154 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
|
4155 #endif /* ! defined (HAVE_X11) */ |
| 429 | 4156 } |
| 286 | 4157 |
| 4158 XFlushQueue (); | |
| 429 | 4159 |
| 286 | 4160 UNBLOCK_INPUT; |
| 4161 } | |
| 4162 | |
| 4163 /* Change from mapped state to withdrawn state. */ | |
| 4164 | |
| 771 | 4165 x_make_frame_invisible (f) |
| 4166 struct frame *f; | |
| 286 | 4167 { |
| 4168 int mask; | |
| 4169 | |
|
1658
452ba03935d7
* xterm.c (XTread_socket): When we get MapNotify, UnmapNotify,
Jim Blandy <jimb@redhat.com>
parents:
1530
diff
changeset
|
4170 if (! f->async_visible) |
| 286 | 4171 return; |
| 4172 | |
| 4173 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
|
4174 |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4175 #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
|
4176 |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4177 if (! XWithdrawWindow (x_current_display, FRAME_X_WINDOW (f), |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4178 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
|
4179 { |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4180 UNBLOCK_INPUT_RESIGNAL; |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4181 error ("can't notify window manager of window withdrawl"); |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4182 } |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4183 |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4184 #else /* ! defined (HAVE_X11R4) */ |
| 286 | 4185 #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
|
4186 |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4187 /* Tell the window manager what we're going to do. */ |
| 286 | 4188 if (! EQ (Vx_no_window_manager, Qt)) |
| 4189 { | |
|
1020
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
4190 XEvent unmap; |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
4191 |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
4192 unmap.xunmap.type = UnmapNotify; |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4193 unmap.xunmap.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
|
4194 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
|
4195 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
|
4196 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
|
4197 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
|
4198 False, |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
4199 SubstructureRedirectMask|SubstructureNotifyMask, |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
4200 &unmap)) |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
4201 { |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
4202 UNBLOCK_INPUT_RESIGNAL; |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
4203 error ("can't notify window manager of withdrawal"); |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
4204 } |
| 286 | 4205 } |
| 4206 | |
|
1020
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
4207 /* Unmap the window ourselves. Cheeky! */ |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4208 XUnmapWindow (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
|
4209 |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4210 #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
|
4211 |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4212 XUnmapWindow (FRAME_X_WINDOW (f)); |
|
1658
452ba03935d7
* xterm.c (XTread_socket): When we get MapNotify, UnmapNotify,
Jim Blandy <jimb@redhat.com>
parents:
1530
diff
changeset
|
4213 f->async_visible = 0; /* Handled by the UnMap event for X11 */ |
| 771 | 4214 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
|
4215 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
|
4216 |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4217 #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
|
4218 #endif /* ! defined (HAVE_X11R4) */ |
| 286 | 4219 |
| 4220 XFlushQueue (); | |
| 4221 UNBLOCK_INPUT; | |
| 4222 } | |
| 4223 | |
| 4224 /* Change window state from mapped to iconified. */ | |
| 4225 | |
| 771 | 4226 x_iconify_frame (f) |
| 4227 struct frame *f; | |
| 286 | 4228 { |
| 4229 int mask; | |
| 4230 | |
|
1658
452ba03935d7
* xterm.c (XTread_socket): When we get MapNotify, UnmapNotify,
Jim Blandy <jimb@redhat.com>
parents:
1530
diff
changeset
|
4231 if (f->async_iconified) |
| 286 | 4232 return; |
| 4233 | |
| 4234 BLOCK_INPUT; | |
| 4235 | |
| 4236 #ifdef HAVE_X11 | |
|
1020
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
4237 /* 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
|
4238 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
|
4239 |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
4240 /* 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
|
4241 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
|
4242 { |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
4243 XEvent message; |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
4244 |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4245 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
|
4246 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
|
4247 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
|
4248 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
|
4249 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
|
4250 |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
4251 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
|
4252 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
|
4253 False, |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
4254 SubstructureRedirectMask | SubstructureNotifyMask, |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
4255 &message)) |
| 286 | 4256 { |
| 4257 UNBLOCK_INPUT_RESIGNAL; | |
| 4258 error ("Can't notify window manager of iconification."); | |
| 4259 } | |
|
1020
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
4260 } |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
4261 |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
4262 /* 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
|
4263 IconicState. */ |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
4264 x_wm_set_window_state (f, IconicState); |
| 286 | 4265 |
|
1658
452ba03935d7
* xterm.c (XTread_socket): When we get MapNotify, UnmapNotify,
Jim Blandy <jimb@redhat.com>
parents:
1530
diff
changeset
|
4266 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
|
4267 #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
|
4268 XUnmapWindow (XDISPLAY FRAME_X_WINDOW (f)); |
| 771 | 4269 |
|
1658
452ba03935d7
* xterm.c (XTread_socket): When we get MapNotify, UnmapNotify,
Jim Blandy <jimb@redhat.com>
parents:
1530
diff
changeset
|
4270 f->async_visible = 0; /* Handled in the UnMap event for X11. */ |
| 771 | 4271 if (f->display.x->icon_desc != 0) |
| 286 | 4272 { |
| 771 | 4273 XMapWindow (XDISPLAY f->display.x->icon_desc); |
| 4274 refreshicon (f); | |
| 286 | 4275 } |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4276 #endif /* ! defined (HAVE_X11) */ |
| 286 | 4277 |
| 4278 XFlushQueue (); | |
| 4279 UNBLOCK_INPUT; | |
| 4280 } | |
| 4281 | |
|
1810
bf618128d973
* xterm.c (x_scrollbar_create): Set the scrollbars to use
Jim Blandy <jimb@redhat.com>
parents:
1803
diff
changeset
|
4282 /* 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
|
4283 |
|
bf618128d973
* xterm.c (x_scrollbar_create): Set the scrollbars to use
Jim Blandy <jimb@redhat.com>
parents:
1803
diff
changeset
|
4284 x_destroy_window (f) |
| 771 | 4285 struct frame *f; |
| 286 | 4286 { |
| 4287 BLOCK_INPUT; | |
|
1810
bf618128d973
* xterm.c (x_scrollbar_create): Set the scrollbars to use
Jim Blandy <jimb@redhat.com>
parents:
1803
diff
changeset
|
4288 |
|
bf618128d973
* xterm.c (x_scrollbar_create): Set the scrollbars to use
Jim Blandy <jimb@redhat.com>
parents:
1803
diff
changeset
|
4289 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
|
4290 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
|
4291 XDestroyWindow (XDISPLAY f->display.x->window_desc); |
|
2732
8b55aa587d3c
* xdisp.c (display_text_line): Apply faces to characters
Jim Blandy <jimb@redhat.com>
parents:
2661
diff
changeset
|
4292 free_frame_faces (f); |
| 286 | 4293 XFlushQueue (); |
|
1810
bf618128d973
* xterm.c (x_scrollbar_create): Set the scrollbars to use
Jim Blandy <jimb@redhat.com>
parents:
1803
diff
changeset
|
4294 |
|
2439
b6c62e4abf59
Put interrupt input blocking in a separate file from xterm.h.
Jim Blandy <jimb@redhat.com>
parents:
2353
diff
changeset
|
4295 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
|
4296 f->display.x = 0; |
| 771 | 4297 if (f == x_focus_frame) |
| 4298 x_focus_frame = 0; | |
| 4299 if (f == x_highlight_frame) | |
| 4300 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
|
4301 |
|
bf618128d973
* xterm.c (x_scrollbar_create): Set the scrollbars to use
Jim Blandy <jimb@redhat.com>
parents:
1803
diff
changeset
|
4302 UNBLOCK_INPUT; |
| 286 | 4303 } |
| 4304 | |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
4305 /* 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
|
4306 |
| 286 | 4307 #ifndef HAVE_X11 |
| 4308 | |
| 4309 /* Manage event queues. | |
| 4310 | |
| 4311 This code is only used by the X10 support. | |
| 4312 | |
| 4313 We cannot leave events in the X queue and get them when we are ready | |
| 4314 because X does not provide a subroutine to get only a certain kind | |
| 4315 of event but not block if there are no queued events of that kind. | |
| 4316 | |
| 4317 Therefore, we must examine events as they come in and copy events | |
| 4318 of certain kinds into our private queues. | |
| 4319 | |
| 4320 All ExposeRegion events are put in x_expose_queue. | |
| 4321 All ButtonPressed and ButtonReleased events are put in x_mouse_queue. */ | |
| 4322 | |
| 4323 | |
| 4324 /* Write the event *P_XREP into the event queue *QUEUE. | |
| 4325 If the queue is full, do nothing, but return nonzero. */ | |
| 4326 | |
| 4327 int | |
| 4328 enqueue_event (p_xrep, queue) | |
| 4329 register XEvent *p_xrep; | |
| 4330 register struct event_queue *queue; | |
| 4331 { | |
| 4332 int newindex = queue->windex + 1; | |
| 4333 if (newindex == EVENT_BUFFER_SIZE) | |
| 4334 newindex = 0; | |
| 4335 if (newindex == queue->rindex) | |
| 4336 return -1; | |
| 4337 queue->xrep[queue->windex] = *p_xrep; | |
| 4338 queue->windex = newindex; | |
| 4339 return 0; | |
| 4340 } | |
| 4341 | |
| 4342 /* Fetch the next event from queue *QUEUE and store it in *P_XREP. | |
| 4343 If *QUEUE is empty, do nothing and return 0. */ | |
| 4344 | |
| 4345 int | |
| 4346 dequeue_event (p_xrep, queue) | |
| 4347 register XEvent *p_xrep; | |
| 4348 register struct event_queue *queue; | |
| 4349 { | |
| 4350 if (queue->windex == queue->rindex) | |
| 4351 return 0; | |
| 4352 *p_xrep = queue->xrep[queue->rindex++]; | |
| 4353 if (queue->rindex == EVENT_BUFFER_SIZE) | |
| 4354 queue->rindex = 0; | |
| 4355 return 1; | |
| 4356 } | |
| 4357 | |
| 4358 /* Return the number of events buffered in *QUEUE. */ | |
| 4359 | |
| 4360 int | |
| 4361 queue_event_count (queue) | |
| 4362 register struct event_queue *queue; | |
| 4363 { | |
| 4364 int tem = queue->windex - queue->rindex; | |
| 4365 if (tem >= 0) | |
| 4366 return tem; | |
| 4367 return EVENT_BUFFER_SIZE + tem; | |
| 4368 } | |
| 4369 | |
| 4370 /* Return nonzero if mouse input is pending. */ | |
| 4371 | |
| 4372 int | |
| 4373 mouse_event_pending_p () | |
| 4374 { | |
| 4375 return queue_event_count (&x_mouse_queue); | |
| 4376 } | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4377 #endif /* HAVE_X11 */ |
| 286 | 4378 |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
4379 /* Setting window manager hints. */ |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
4380 |
| 286 | 4381 #ifdef HAVE_X11 |
| 4382 | |
| 771 | 4383 x_wm_set_size_hint (f, prompting) |
| 4384 struct frame *f; | |
| 286 | 4385 long prompting; |
| 4386 { | |
| 4387 XSizeHints size_hints; | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4388 Window window = FRAME_X_WINDOW (f); |
| 286 | 4389 |
| 4390 size_hints.flags = PResizeInc | PMinSize | PMaxSize; | |
| 4391 | |
| 771 | 4392 flexlines = f->height; |
| 4393 | |
| 4394 size_hints.x = f->display.x->left_pos; | |
| 4395 size_hints.y = f->display.x->top_pos; | |
| 4396 size_hints.height = PIXEL_HEIGHT (f); | |
| 4397 size_hints.width = PIXEL_WIDTH (f); | |
| 4398 size_hints.width_inc = FONT_WIDTH (f->display.x->font); | |
| 4399 size_hints.height_inc = FONT_HEIGHT (f->display.x->font); | |
|
1787
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
4400 size_hints.max_width = x_screen_width - CHAR_TO_PIXEL_WIDTH (f, 0); |
|
5e245540d06f
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1739
diff
changeset
|
4401 size_hints.max_height = x_screen_height - CHAR_TO_PIXEL_HEIGHT (f, 0); |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
4402 |
|
976
cbdfc337ec8f
* xterm.c (x_wm_hints): New variable.
Jim Blandy <jimb@redhat.com>
parents:
786
diff
changeset
|
4403 { |
|
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
|
4404 int base_width, base_height; |
|
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
4405 |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
4406 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
|
4407 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
|
4408 |
|
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
4409 { |
|
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
4410 int min_rows = 0, min_cols = 0; |
|
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
4411 check_frame_size (f, &min_rows, &min_cols); |
|
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
4412 |
|
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
4413 /* The window manager uses the base width hints to calculate the |
|
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
4414 current number of rows and columns in the frame while |
|
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
4415 resizing; min_width and min_height aren't useful for this |
|
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
4416 purpose, since they might not give the dimensions for a |
|
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
4417 zero-row, zero-column frame. |
|
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
4418 |
|
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
4419 We use the base_width and base_height members if we have |
|
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
4420 them; otherwise, we set the min_width and min_height members |
|
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
4421 to the size for a zero x zero frame. */ |
|
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
4422 |
|
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
4423 #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
|
4424 size_hints.flags |= PBaseSize; |
|
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
4425 size_hints.base_width = base_width; |
|
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
4426 size_hints.base_height = base_height; |
|
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
4427 size_hints.min_width = base_width + min_cols * size_hints.width_inc; |
|
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
4428 size_hints.min_height = base_height + min_rows * size_hints.height_inc; |
|
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
4429 #else |
|
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
4430 size_hints.min_width = base_width; |
|
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
4431 size_hints.min_height = base_height; |
|
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
4432 #endif |
|
cd3d59155bf7
* xterm.c (x_wm_set_size_hint): Set the base_width and base_height
Jim Blandy <jimb@redhat.com>
parents:
1077
diff
changeset
|
4433 } |
|
1020
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
4434 |
|
976
cbdfc337ec8f
* xterm.c (x_wm_hints): New variable.
Jim Blandy <jimb@redhat.com>
parents:
786
diff
changeset
|
4435 } |
| 286 | 4436 |
| 4437 if (prompting) | |
| 4438 size_hints.flags |= prompting; | |
| 4439 else | |
| 4440 { | |
| 4441 XSizeHints hints; /* Sometimes I hate X Windows... */ | |
| 4442 | |
| 4443 XGetNormalHints (x_current_display, window, &hints); | |
| 4444 if (hints.flags & PSize) | |
| 4445 size_hints.flags |= PSize; | |
| 4446 if (hints.flags & PPosition) | |
| 4447 size_hints.flags |= PPosition; | |
| 4448 if (hints.flags & USPosition) | |
| 4449 size_hints.flags |= USPosition; | |
| 4450 if (hints.flags & USSize) | |
| 4451 size_hints.flags |= USSize; | |
| 4452 } | |
|
1020
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
4453 |
|
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
|
4454 #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
|
4455 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
|
4456 #else |
| 286 | 4457 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
|
4458 #endif |
| 286 | 4459 } |
| 4460 | |
| 4461 /* Used for IconicState or NormalState */ | |
| 771 | 4462 x_wm_set_window_state (f, state) |
| 4463 struct frame *f; | |
| 286 | 4464 int state; |
| 4465 { | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4466 Window window = FRAME_X_WINDOW (f); |
| 286 | 4467 |
|
1020
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
4468 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
|
4469 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
|
4470 |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
4471 XSetWMHints (x_current_display, window, &f->display.x->wm_hints); |
| 286 | 4472 } |
| 4473 | |
| 771 | 4474 x_wm_set_icon_pixmap (f, icon_pixmap) |
| 4475 struct frame *f; | |
| 286 | 4476 Pixmap icon_pixmap; |
| 4477 { | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4478 Window window = FRAME_X_WINDOW (f); |
| 286 | 4479 |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4480 if (icon_pixmap) |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4481 { |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4482 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
|
4483 f->display.x->wm_hints.flags |= IconPixmapHint; |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4484 } |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4485 else |
|
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4486 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
|
4487 |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
4488 XSetWMHints (x_current_display, window, &f->display.x->wm_hints); |
| 286 | 4489 } |
| 4490 | |
| 771 | 4491 x_wm_set_icon_position (f, icon_x, icon_y) |
| 4492 struct frame *f; | |
| 286 | 4493 int icon_x, icon_y; |
| 4494 { | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4495 Window window = FRAME_X_WINDOW (f); |
| 286 | 4496 |
|
1020
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
4497 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
|
4498 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
|
4499 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
|
4500 |
|
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
4501 XSetWMHints (x_current_display, window, &f->display.x->wm_hints); |
| 286 | 4502 } |
| 4503 | |
| 4504 | |
|
1720
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
4505 /* Initialization. */ |
|
4f5e3ac5d822
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1658
diff
changeset
|
4506 |
| 286 | 4507 void |
| 4508 x_term_init (display_name) | |
| 4509 char *display_name; | |
| 4510 { | |
| 771 | 4511 Lisp_Object frame; |
| 286 | 4512 char *defaultvalue; |
| 4513 #ifdef F_SETOWN | |
| 4514 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
|
4515 #endif /* ! defined (F_SETOWN) */ |
| 369 | 4516 |
| 771 | 4517 x_focus_frame = x_highlight_frame = 0; |
| 286 | 4518 |
| 4519 x_current_display = XOpenDisplay (display_name); | |
| 4520 if (x_current_display == 0) | |
| 4521 fatal ("X server %s not responding; check the DISPLAY environment variable or use \"-d\"\n", | |
| 4522 display_name); | |
| 4523 | |
| 4524 #ifdef HAVE_X11 | |
| 4525 { | |
|
1020
7c2565dd644c
* xterm.c (x_wm_hints): Variable deleted. This has to be
Jim Blandy <jimb@redhat.com>
parents:
976
diff
changeset
|
4526 int hostname_size = 256; |
| 398 | 4527 |
| 4528 hostname = (char *) xmalloc (hostname_size); | |
| 4529 | |
| 286 | 4530 #if 0 |
| 4531 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
|
4532 #endif /* ! 0 */ |
| 286 | 4533 |
| 398 | 4534 /* Try to get the host name; if the buffer is too short, try |
| 4535 again. Apparently, the only indication gethostname gives of | |
| 4536 whether the buffer was large enough is the presence or absence | |
| 4537 of a '\0' in the string. Eech. */ | |
| 4538 for (;;) | |
| 4539 { | |
| 4540 gethostname (hostname, hostname_size - 1); | |
| 4541 hostname[hostname_size - 1] = '\0'; | |
| 4542 | |
| 4543 /* Was the buffer large enough for gethostname to store the '\0'? */ | |
| 4544 if (strlen (hostname) < hostname_size - 1) | |
| 4545 break; | |
| 4546 | |
| 4547 hostname_size <<= 1; | |
| 4548 hostname = (char *) xrealloc (hostname, hostname_size); | |
| 4549 } | |
|
2279
012b04efa234
* emacs.c (Finvocation_name): New function.
Jim Blandy <jimb@redhat.com>
parents:
2235
diff
changeset
|
4550 x_id_name = (char *) xmalloc (XSTRING (Vinvocation_name)->size |
| 398 | 4551 + strlen (hostname) |
| 4552 + 2); | |
|
2279
012b04efa234
* emacs.c (Finvocation_name): New function.
Jim Blandy <jimb@redhat.com>
parents:
2235
diff
changeset
|
4553 sprintf (x_id_name, "%s@%s", XSTRING (Vinvocation_name)->data, hostname); |
| 286 | 4554 } |
|
1279
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
4555 |
|
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
4556 /* 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
|
4557 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
|
4558 |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
4559 /* Get the scroll bar cursor. */ |
|
2195
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
4560 x_vertical_scroll_bar_cursor |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
4561 = 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
|
4562 |
|
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
4563 #if 0 |
|
1279
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
4564 /* 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
|
4565 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
|
4566 x_watch_cut_buffer_cache (); |
|
2195
b20bb441f47f
(Xatom_wm_change_state): Define here.
Richard M. Stallman <rms@gnu.org>
parents:
2127
diff
changeset
|
4567 #endif |
|
1279
74ae34a80f94
* xterm.c (x_meta_mod_mask): New variable, indicating which X
Jim Blandy <jimb@redhat.com>
parents:
1127
diff
changeset
|
4568 |
|
2285
f0a979beceab
* xterm.c (x_term_init): If the X connection is already in file
Jim Blandy <jimb@redhat.com>
parents:
2279
diff
changeset
|
4569 if (ConnectionNumber (x_current_display) != 0) |
|
f0a979beceab
* xterm.c (x_term_init): If the X connection is already in file
Jim Blandy <jimb@redhat.com>
parents:
2279
diff
changeset
|
4570 { |
|
f0a979beceab
* xterm.c (x_term_init): If the X connection is already in file
Jim Blandy <jimb@redhat.com>
parents:
2279
diff
changeset
|
4571 dup2 (ConnectionNumber (x_current_display), 0); |
| 369 | 4572 |
| 4573 #ifndef SYSV_STREAMS | |
|
2285
f0a979beceab
* xterm.c (x_term_init): If the X connection is already in file
Jim Blandy <jimb@redhat.com>
parents:
2279
diff
changeset
|
4574 /* Streams somehow keeps track of which descriptor number |
|
f0a979beceab
* xterm.c (x_term_init): If the X connection is already in file
Jim Blandy <jimb@redhat.com>
parents:
2279
diff
changeset
|
4575 is being used to talk to X. So it is not safe to substitute |
|
f0a979beceab
* xterm.c (x_term_init): If the X connection is already in file
Jim Blandy <jimb@redhat.com>
parents:
2279
diff
changeset
|
4576 descriptor 0. But it is safe to make descriptor 0 a copy of it. */ |
|
f0a979beceab
* xterm.c (x_term_init): If the X connection is already in file
Jim Blandy <jimb@redhat.com>
parents:
2279
diff
changeset
|
4577 close (ConnectionNumber (x_current_display)); |
|
f0a979beceab
* xterm.c (x_term_init): If the X connection is already in file
Jim Blandy <jimb@redhat.com>
parents:
2279
diff
changeset
|
4578 ConnectionNumber (x_current_display) = 0; /* Looks a little strange? |
| 369 | 4579 * check the def of the macro; |
| 4580 * it is a genuine lvalue */ | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4581 #endif /* SYSV_STREAMS */ |
|
2285
f0a979beceab
* xterm.c (x_term_init): If the X connection is already in file
Jim Blandy <jimb@redhat.com>
parents:
2279
diff
changeset
|
4582 } |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4583 |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4584 #endif /* ! defined (HAVE_X11) */ |
| 286 | 4585 |
| 4586 #ifdef F_SETOWN | |
| 4587 old_fcntl_owner = fcntl (0, F_GETOWN, 0); | |
| 4588 #ifdef F_SETOWN_SOCK_NEG | |
| 4589 fcntl (0, F_SETOWN, -getpid ()); /* stdin is a socket here */ | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4590 #else /* ! defined (F_SETOWN_SOCK_NEG) */ |
| 286 | 4591 fcntl (0, 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
|
4592 #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
|
4593 #endif /* ! defined (F_SETOWN) */ |
| 286 | 4594 |
| 4595 #ifdef SIGIO | |
| 4596 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
|
4597 #endif /* ! defined (SIGIO) */ |
| 286 | 4598 |
| 4599 /* Must use interrupt input because we cannot otherwise | |
| 4600 arrange for C-g to be noticed immediately. | |
| 4601 We cannot connect it to SIGINT. */ | |
| 4602 Fset_input_mode (Qt, Qnil, Qt, Qnil); | |
| 4603 | |
| 4604 expose_all_windows = 0; | |
| 4605 | |
| 771 | 4606 clear_frame_hook = XTclear_frame; |
| 286 | 4607 clear_end_of_line_hook = XTclear_end_of_line; |
| 4608 ins_del_lines_hook = XTins_del_lines; | |
| 4609 change_line_highlight_hook = XTchange_line_highlight; | |
| 4610 insert_glyphs_hook = XTinsert_glyphs; | |
| 4611 write_glyphs_hook = XTwrite_glyphs; | |
| 4612 delete_glyphs_hook = XTdelete_glyphs; | |
| 4613 ring_bell_hook = XTring_bell; | |
| 4614 reset_terminal_modes_hook = XTreset_terminal_modes; | |
| 4615 set_terminal_modes_hook = XTset_terminal_modes; | |
| 4616 update_begin_hook = XTupdate_begin; | |
| 4617 update_end_hook = XTupdate_end; | |
| 4618 set_terminal_window_hook = XTset_terminal_window; | |
| 4619 read_socket_hook = XTread_socket; | |
| 4620 cursor_to_hook = XTcursor_to; | |
| 4621 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
|
4622 mouse_position_hook = XTmouse_position; |
| 771 | 4623 frame_rehighlight_hook = XTframe_rehighlight; |
|
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1810
diff
changeset
|
4624 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
|
4625 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
|
4626 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
|
4627 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
|
4628 judge_scroll_bars_hook = XTjudge_scroll_bars; |
| 286 | 4629 |
| 771 | 4630 scroll_region_ok = 1; /* we'll scroll partial frames */ |
| 286 | 4631 char_ins_del_ok = 0; /* just as fast to write the line */ |
| 4632 line_ins_del_ok = 1; /* we'll just blt 'em */ | |
| 4633 fast_clear_end_of_line = 1; /* X does this well */ | |
| 771 | 4634 memory_below_frame = 0; /* we don't remember what scrolls |
| 286 | 4635 off the bottom */ |
| 4636 baud_rate = 19200; | |
| 4637 | |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4638 /* 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
|
4639 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
|
4640 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
|
4641 XHandleIOError (x_io_error_quitter); |
| 286 | 4642 |
| 4643 /* Disable Window Change signals; they are handled by X events. */ | |
| 4644 #ifdef SIGWINCH | |
| 4645 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
|
4646 #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
|
4647 |
|
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4648 signal (SIGPIPE, x_connection_closed); |
| 286 | 4649 } |
| 395 | 4650 |
| 4651 void | |
| 4652 syms_of_xterm () | |
| 4653 { | |
|
1993
645d96bd3daf
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1935
diff
changeset
|
4654 staticpro (&last_mouse_scroll_bar); |
| 395 | 4655 } |
|
1052
b8defcaf1b61
* xterm.c (x_make_frame_invisible): Don't forget to check the
Jim Blandy <jimb@redhat.com>
parents:
1020
diff
changeset
|
4656 #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
|
4657 #endif /* ! defined (HAVE_X_WINDOWS) */ |
