comparison src/xterm.h @ 88155:d7ddb3e565de

sync with trunk
author Henrik Enberg <henrik.enberg@telia.com>
date Mon, 16 Jan 2006 00:03:54 +0000
parents 23a1cea22d13
children
comparison
equal deleted inserted replaced
88154:8ce476d3ba36 88155:d7ddb3e565de
1 /* Definitions and headers for communication with X protocol. 1 /* Definitions and headers for communication with X protocol.
2 Copyright (C) 1989, 1993, 1994, 1998, 1999, 2000, 2001, 2001 2 Copyright (C) 1989, 1993, 1994, 1998, 1999, 2000, 2001, 2002, 2003,
3 Free Software Foundation, Inc. 3 2004, 2005 Free Software Foundation, Inc.
4 4
5 This file is part of GNU Emacs. 5 This file is part of GNU Emacs.
6 6
7 GNU Emacs is free software; you can redistribute it and/or modify 7 GNU Emacs is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 8 it under the terms of the GNU General Public License as published by
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details. 15 GNU General Public License for more details.
16 16
17 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
18 along with GNU Emacs; see the file COPYING. If not, write to 18 along with GNU Emacs; see the file COPYING. If not, write to
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 Boston, MA 02111-1307, USA. */ 20 Boston, MA 02110-1301, USA. */
21 21
22 #include <X11/Xlib.h> 22 #include <X11/Xlib.h>
23 #include <X11/cursorfont.h> 23 #include <X11/cursorfont.h>
24
25 /* Include Xutil.h after keysym.h to work around a bug that prevents
26 correct recognition of AltGr key in some X versions. */
27
28 #include <X11/keysym.h>
24 #include <X11/Xutil.h> 29 #include <X11/Xutil.h>
25 #include <X11/keysym.h> 30
26 #include <X11/Xatom.h> 31 #include <X11/Xatom.h>
27 #include <X11/Xresource.h> 32 #include <X11/Xresource.h>
28 33
29 #ifdef USE_X_TOOLKIT 34 #ifdef USE_X_TOOLKIT
30 #include <X11/StringDefs.h> 35 #include <X11/StringDefs.h>
42 #include <gdk/gdkx.h> 47 #include <gdk/gdkx.h>
43 48
44 /* Some definitions to reduce conditionals. */ 49 /* Some definitions to reduce conditionals. */
45 typedef GtkWidget *xt_or_gtk_widget; 50 typedef GtkWidget *xt_or_gtk_widget;
46 #define XtParent(x) (gtk_widget_get_parent (x)) 51 #define XtParent(x) (gtk_widget_get_parent (x))
47 52 #undef XSync
48 #endif 53 #define XSync(d, b) do { gdk_window_process_all_updates (); \
49 54 XSync (d, b); } while (0)
50 /* The class of this X application. */ 55
51 #define EMACS_CLASS "Emacs" 56
57 #endif /* USE_GTK */
58
52 59
53 /* Bookkeeping to distinguish X versions. */ 60 /* Bookkeeping to distinguish X versions. */
54 61
55 /* HAVE_X11R4 is defined if we have the features of X11R4. It should 62 /* HAVE_X11R4 is defined if we have the features of X11R4. It should
56 be defined when we're using X11R5, since X11R5 has the features of 63 be defined when we're using X11R5, since X11R5 has the features of
100 XScreenNumberOfScreen (FRAME_X_SCREEN (f))) 107 XScreenNumberOfScreen (FRAME_X_SCREEN (f)))
101 108
102 #define FONT_WIDTH(f) ((f)->max_bounds.width) 109 #define FONT_WIDTH(f) ((f)->max_bounds.width)
103 #define FONT_HEIGHT(f) ((f)->ascent + (f)->descent) 110 #define FONT_HEIGHT(f) ((f)->ascent + (f)->descent)
104 #define FONT_BASE(f) ((f)->ascent) 111 #define FONT_BASE(f) ((f)->ascent)
112 #define FONT_DESCENT(f) ((f)->descent)
105 113
106 /* The mask of events that text windows always want to receive. This 114 /* The mask of events that text windows always want to receive. This
107 includes mouse movement events, since handling the mouse-font text property 115 includes mouse movement events, since handling the mouse-font text property
108 means that we must track mouse motion all the time. */ 116 means that we must track mouse motion all the time. */
109 117
123 If REFCOUNT is 0 then this record is free to be reused. */ 131 If REFCOUNT is 0 then this record is free to be reused. */
124 132
125 struct x_bitmap_record 133 struct x_bitmap_record
126 { 134 {
127 Pixmap pixmap; 135 Pixmap pixmap;
136 int have_mask;
137 Pixmap mask;
128 char *file; 138 char *file;
129 int refcount; 139 int refcount;
130 /* Record some info about this pixmap. */ 140 /* Record some info about this pixmap. */
131 int height, width, depth; 141 int height, width, depth;
132 }; 142 };
162 Visual *visual; 172 Visual *visual;
163 173
164 /* The colormap being used. */ 174 /* The colormap being used. */
165 Colormap cmap; 175 Colormap cmap;
166 176
167 /* Number of panes on this screen. */ 177 /* Number of planes on this screen. */
168 int n_planes; 178 int n_planes;
169 179
170 /* Dimensions of this screen. */ 180 /* Dimensions of this screen. */
171 int height, width; 181 int height, width;
172 182
178 int icon_bitmap_id; 188 int icon_bitmap_id;
179 189
180 /* The root window of this screen. */ 190 /* The root window of this screen. */
181 Window root_window; 191 Window root_window;
182 192
193 /* Client leader window. */
194 Window client_leader_window;
195
183 /* The cursor to use for vertical scroll bars. */ 196 /* The cursor to use for vertical scroll bars. */
184 Cursor vertical_scroll_bar_cursor; 197 Cursor vertical_scroll_bar_cursor;
198
199 #ifdef USE_GTK
200 /* The GDK cursor for scroll bars and popup menus. */
201 GdkCursor *xg_cursor;
202 #endif
185 203
186 /* X Resource data base */ 204 /* X Resource data base */
187 XrmDatabase xrdb; 205 XrmDatabase xrdb;
188 206
189 /* A table of all the fonts we have already loaded. */ 207 /* A table of all the fonts we have already loaded. */
284 Atom Xatom_wm_change_state; 302 Atom Xatom_wm_change_state;
285 303
286 /* Other WM communication */ 304 /* Other WM communication */
287 Atom Xatom_wm_configure_denied; /* When our config request is denied */ 305 Atom Xatom_wm_configure_denied; /* When our config request is denied */
288 Atom Xatom_wm_window_moved; /* When the WM moves us. */ 306 Atom Xatom_wm_window_moved; /* When the WM moves us. */
307 Atom Xatom_wm_client_leader; /* Id of client leader window. */
289 308
290 /* EditRes protocol */ 309 /* EditRes protocol */
291 Atom Xatom_editres; 310 Atom Xatom_editres;
292 311
293 /* More atoms, which are selection types. */ 312 /* More atoms, which are selection types. */
296 Xatom_MULTIPLE, Xatom_INCR, Xatom_EMACS_TMP, Xatom_TARGETS, Xatom_NULL, 315 Xatom_MULTIPLE, Xatom_INCR, Xatom_EMACS_TMP, Xatom_TARGETS, Xatom_NULL,
297 Xatom_ATOM_PAIR; 316 Xatom_ATOM_PAIR;
298 317
299 /* More atoms for font properties. The last three are private 318 /* More atoms for font properties. The last three are private
300 properties, see the comments in src/fontset.h. */ 319 properties, see the comments in src/fontset.h. */
301 Atom Xatom_PIXEL_SIZE, 320 Atom Xatom_PIXEL_SIZE, Xatom_AVERAGE_WIDTH,
302 Xatom_MULE_BASELINE_OFFSET, Xatom_MULE_RELATIVE_COMPOSE, 321 Xatom_MULE_BASELINE_OFFSET, Xatom_MULE_RELATIVE_COMPOSE,
303 Xatom_MULE_DEFAULT_ASCENT; 322 Xatom_MULE_DEFAULT_ASCENT;
304 323
305 /* More atoms for Ghostscript support. */ 324 /* More atoms for Ghostscript support. */
306 Atom Xatom_DONE, Xatom_PAGE; 325 Atom Xatom_DONE, Xatom_PAGE;
351 370
352 /* If non-null, a cache of the colors in the color map. Don't 371 /* If non-null, a cache of the colors in the color map. Don't
353 use this directly, call x_color_cells instead. */ 372 use this directly, call x_color_cells instead. */
354 XColor *color_cells; 373 XColor *color_cells;
355 int ncolor_cells; 374 int ncolor_cells;
375
376 /* Bits and shifts to use to compose pixel values on TrueColor visuals. */
377 int red_bits, blue_bits, green_bits;
378 int red_offset, blue_offset, green_offset;
379
380 /* The type of window manager we have. If we move FRAME_OUTER_WINDOW
381 to x/y 0/0, some window managers (type A) puts the window manager
382 decorations outside the screen and FRAME_OUTER_WINDOW exactly at 0/0.
383 Other window managers (type B) puts the window including decorations
384 at 0/0, so FRAME_OUTER_WINDOW is a bit below 0/0.
385 Record the type of WM in use so we can compensate for type A WMs. */
386 enum
387 {
388 X_WMTYPE_UNKNOWN,
389 X_WMTYPE_A,
390 X_WMTYPE_B
391 } wm_type;
356 }; 392 };
393
394 #ifdef HAVE_X_I18N
395 /* Whether or not to use XIM if we have it. */
396 extern int use_xim;
397 #endif
357 398
358 /* This checks to make sure we have a display. */ 399 /* This checks to make sure we have a display. */
359 extern void check_x P_ ((void)); 400 extern void check_x P_ ((void));
360 401
361 extern struct frame *x_window_to_frame P_ ((struct x_display_info *, int)); 402 extern struct frame *x_window_to_frame P_ ((struct x_display_info *, int));
397 in the output_data.x field. The x_output structure contains 438 in the output_data.x field. The x_output structure contains
398 the information that is specific to X windows. */ 439 the information that is specific to X windows. */
399 440
400 struct x_output 441 struct x_output
401 { 442 {
402 /* Position of the X window (x and y offsets in root window). */
403 int left_pos;
404 int top_pos;
405
406 /* Border width of the X window as known by the X window system. */
407 int border_width;
408
409 /* Size of the X window in pixels. */
410 int pixel_height, pixel_width;
411
412 /* Height of menu bar widget, in pixels. 443 /* Height of menu bar widget, in pixels.
413 Zero if not using the X toolkit. 444 Zero if not using the X toolkit.
414 When using the toolkit, this value is not meaningful 445 When using the toolkit, this value is not meaningful
415 if the menubar is turned off. */ 446 if the menubar is turned off. */
416 int menubar_height; 447 int menubar_height;
417 448
418 /* Height of tool bar widget, in pixels. 449 /* Height of tool bar widget, in pixels.
419 Zero if not using an external tool bar. */ 450 Zero if not using an external tool bar. */
420 int toolbar_height; 451 int toolbar_height;
421 452
422 /* Height of a line, in pixels. */
423 int line_height;
424
425 /* The tiled border used when the mouse is out of the frame. */ 453 /* The tiled border used when the mouse is out of the frame. */
426 Pixmap border_tile; 454 Pixmap border_tile;
427 455
428 /* Here are the Graphics Contexts for the default font. */ 456 /* Here are the Graphics Contexts for the default font. */
429 GC normal_gc; /* Normal video */ 457 GC normal_gc; /* Normal video */
430 GC reverse_gc; /* Reverse video */ 458 GC reverse_gc; /* Reverse video */
431 GC cursor_gc; /* cursor drawing */ 459 GC cursor_gc; /* cursor drawing */
432
433 /* Width of the internal border. This is a line of background color
434 just inside the window's border. When the frame is selected,
435 a highlighting is displayed inside the internal border. */
436 int internal_border_width;
437 460
438 /* The X window used for this frame. 461 /* The X window used for this frame.
439 May be zero while the frame object is being created 462 May be zero while the frame object is being created
440 and the X window has not yet been created. */ 463 and the X window has not yet been created. */
441 Window window_desc; 464 Window window_desc;
474 GtkWidget *menubar_widget; 497 GtkWidget *menubar_widget;
475 /* The tool bar in this frame */ 498 /* The tool bar in this frame */
476 GtkWidget *toolbar_widget; 499 GtkWidget *toolbar_widget;
477 /* The handle box that makes the tool bar detachable. */ 500 /* The handle box that makes the tool bar detachable. */
478 GtkWidget *handlebox_widget; 501 GtkWidget *handlebox_widget;
502 /* Non-zero if the tool bar is detached. */
503 int toolbar_detached;
479 504
480 /* The last size hints set. */ 505 /* The last size hints set. */
481 GdkGeometry size_hints; 506 GdkGeometry size_hints;
482 long hint_flags; 507 long hint_flags;
483 #endif 508 #endif
521 546
522 /* Descriptor for the cursor in use for this window. */ 547 /* Descriptor for the cursor in use for this window. */
523 Cursor text_cursor; 548 Cursor text_cursor;
524 Cursor nontext_cursor; 549 Cursor nontext_cursor;
525 Cursor modeline_cursor; 550 Cursor modeline_cursor;
526 Cursor cross_cursor; 551 Cursor hand_cursor;
527 Cursor hourglass_cursor; 552 Cursor hourglass_cursor;
528 Cursor horizontal_drag_cursor; 553 Cursor horizontal_drag_cursor;
529 554
530 /* Window whose cursor is hourglass_cursor. This window is temporarily 555 /* Window whose cursor is hourglass_cursor. This window is temporarily
531 mapped to display an hourglass cursor. */ 556 mapped to display an hourglass cursor. */
548 the same throughout the execution of Emacs. So, we keep this 573 the same throughout the execution of Emacs. So, we keep this
549 structure around, just leaving values in it and adding new bits 574 structure around, just leaving values in it and adding new bits
550 to the mask as we go. */ 575 to the mask as we go. */
551 XWMHints wm_hints; 576 XWMHints wm_hints;
552 577
553 /* The size of the extra width currently allotted for vertical
554 scroll bars, in pixels. */
555 int vertical_scroll_bar_extra;
556
557 /* The extra width currently allotted for the areas in which
558 truncation marks, continuation marks, and overlay arrows are
559 displayed. */
560 int left_fringe_width, right_fringe_width;
561 int fringe_cols, fringes_extra;
562
563 /* This is the gravity value for the specified window position. */
564 int win_gravity;
565
566 /* The geometry flags for this window. */
567 int size_hint_flags;
568
569 /* This is the Emacs structure for the X display this frame is on. */ 578 /* This is the Emacs structure for the X display this frame is on. */
570 struct x_display_info *display_info; 579 struct x_display_info *display_info;
571 580
572 /* This is a button event that wants to activate the menubar. 581 /* This is a button event that wants to activate the menubar.
573 We save it here until the command loop gets to think about it. */ 582 We save it here until the command loop gets to think about it. */
591 #ifdef HAVE_X_I18N 600 #ifdef HAVE_X_I18N
592 /* Input context (currently, this means Compose key handler setup). */ 601 /* Input context (currently, this means Compose key handler setup). */
593 XIC xic; 602 XIC xic;
594 XIMStyle xic_style; 603 XIMStyle xic_style;
595 XFontSet xic_xfs; 604 XFontSet xic_xfs;
605 char *xic_base_fontname;
596 #endif 606 #endif
597 607
598 /* Relief GCs, colors etc. */ 608 /* Relief GCs, colors etc. */
599 struct relief 609 struct relief
600 { 610 {
613 window managers like fvwm2 2.2.5 and KDE 2.1 this event doesn't 623 window managers like fvwm2 2.2.5 and KDE 2.1 this event doesn't
614 arrive for an unknown reason and Emacs hangs in Xt. If this is 624 arrive for an unknown reason and Emacs hangs in Xt. If this is
615 zero, tell Xt not to wait. */ 625 zero, tell Xt not to wait. */
616 int wait_for_wm; 626 int wait_for_wm;
617 627
618 /* See enum below */
619 int want_fullscreen;
620
621 /* This many pixels are the difference between the outer window (i.e. the
622 left of the window manager decoration) and FRAME_X_WINDOW. */
623 int x_pixels_diff;
624
625 /* This many pixels are the difference between the outer window (i.e. the
626 top of the window manager titlebar) and FRAME_X_WINDOW. */
627 int y_pixels_diff;
628
629 /* As x_pixels_diff, but to FRAME_OUTER_WINDOW. For some reason the 628 /* As x_pixels_diff, but to FRAME_OUTER_WINDOW. For some reason the
630 two might differ by a pixel, depending on WM */ 629 two might differ by a pixel, depending on WM */
631 int x_pixels_outer_diff; 630 int x_pixels_outer_diff;
632 631
633 /* As y_pixels_diff, but to FRAME_OUTER_WINDOW. In the toolkit version, 632 /* As y_pixels_diff, but to FRAME_OUTER_WINDOW. In the toolkit version,
637 636
638 /* Keep track of focus. May be EXPLICIT if we received a FocusIn for this 637 /* Keep track of focus. May be EXPLICIT if we received a FocusIn for this
639 frame, or IMPLICIT if we received an EnterNotify. 638 frame, or IMPLICIT if we received an EnterNotify.
640 FocusOut and LeaveNotify clears EXPLICIT/IMPLICIT. */ 639 FocusOut and LeaveNotify clears EXPLICIT/IMPLICIT. */
641 int focus_state; 640 int focus_state;
641
642 /* The latest move we made to FRAME_OUTER_WINDOW. Saved so we can
643 compensate for type A WMs (see wm_type in dpyinfo above). */
644 int expected_top;
645 int expected_left;
646
647 /* The offset we need to add to compensate for type A WMs. */
648 int move_offset_top;
649 int move_offset_left;
650
651 /* Nonzero if we have made a move and needs to check if the WM placed us
652 at the right position. */
653 int check_expected_move;
642 }; 654 };
643 655
644 enum 656 #define No_Cursor (None)
645 {
646 /* Values used as a bit mask, BOTH == WIDTH | HEIGHT. */
647 FULLSCREEN_NONE = 0,
648 FULLSCREEN_WIDTH = 1,
649 FULLSCREEN_HEIGHT = 2,
650 FULLSCREEN_BOTH = 3,
651 FULLSCREEN_WAIT = 4,
652 FULLSCREEN_MOVE_WAIT = 8,
653 };
654 657
655 enum 658 enum
656 { 659 {
657 /* Values for focus_state, used as bit mask. 660 /* Values for focus_state, used as bit mask.
658 EXPLICIT means we received a FocusIn for the frame and know it has 661 EXPLICIT means we received a FocusIn for the frame and know it has
663 FOCUS_IMPLICIT = 1, 666 FOCUS_IMPLICIT = 1,
664 FOCUS_EXPLICIT = 2 667 FOCUS_EXPLICIT = 2
665 }; 668 };
666 669
667 670
671 /* Return the X output data for frame F. */
672 #define FRAME_X_OUTPUT(f) ((f)->output_data.x)
673
668 /* Return the X window used for displaying data in frame F. */ 674 /* Return the X window used for displaying data in frame F. */
669 #define FRAME_X_WINDOW(f) ((f)->output_data.x->window_desc) 675 #define FRAME_X_WINDOW(f) ((f)->output_data.x->window_desc)
670 676
671 /* Return the outermost X window associated with the frame F. */ 677 /* Return the outermost X window associated with the frame F. */
672 #ifdef USE_X_TOOLKIT 678 #ifdef USE_X_TOOLKIT
691 #endif 697 #endif
692 698
693 699
694 #define FRAME_FONT(f) ((f)->output_data.x->font) 700 #define FRAME_FONT(f) ((f)->output_data.x->font)
695 #define FRAME_FONTSET(f) ((f)->output_data.x->fontset) 701 #define FRAME_FONTSET(f) ((f)->output_data.x->fontset)
696 #define FRAME_INTERNAL_BORDER_WIDTH(f) ((f)->output_data.x->internal_border_width)
697 #define FRAME_MENUBAR_HEIGHT(f) ((f)->output_data.x->menubar_height) 702 #define FRAME_MENUBAR_HEIGHT(f) ((f)->output_data.x->menubar_height)
698 #define FRAME_TOOLBAR_HEIGHT(f) ((f)->output_data.x->toolbar_height) 703 #define FRAME_TOOLBAR_HEIGHT(f) ((f)->output_data.x->toolbar_height)
699 #define FRAME_LINE_HEIGHT(f) ((f)->output_data.x->line_height) 704 #define FRAME_BASELINE_OFFSET(f) ((f)->output_data.x->baseline_offset)
700
701 /* Width of the default font of frame F. Must be defined by each
702 terminal specific header. */
703 #define FRAME_DEFAULT_FONT_WIDTH(F) FONT_WIDTH (FRAME_FONT (F))
704 705
705 /* This gives the x_display_info structure for the display F is on. */ 706 /* This gives the x_display_info structure for the display F is on. */
706 #define FRAME_X_DISPLAY_INFO(f) ((f)->output_data.x->display_info) 707 #define FRAME_X_DISPLAY_INFO(f) ((f)->output_data.x->display_info)
707 708
708 /* This is the `Display *' which frame F is on. */ 709 /* This is the `Display *' which frame F is on. */
718 /* This is the Colormap which frame F uses. */ 719 /* This is the Colormap which frame F uses. */
719 #define FRAME_X_COLORMAP(f) FRAME_X_DISPLAY_INFO (f)->cmap 720 #define FRAME_X_COLORMAP(f) FRAME_X_DISPLAY_INFO (f)->cmap
720 721
721 /* This is the 'font_info *' which frame F has. */ 722 /* This is the 'font_info *' which frame F has. */
722 #define FRAME_X_FONT_TABLE(f) (FRAME_X_DISPLAY_INFO (f)->font_table) 723 #define FRAME_X_FONT_TABLE(f) (FRAME_X_DISPLAY_INFO (f)->font_table)
723
724 /* These two really ought to be called FRAME_PIXEL_{WIDTH,HEIGHT}. */
725 #define PIXEL_WIDTH(f) ((f)->output_data.x->pixel_width)
726 #define PIXEL_HEIGHT(f) ((f)->output_data.x->pixel_height)
727 724
728 /* The difference in pixels between the top left corner of the 725 /* The difference in pixels between the top left corner of the
729 Emacs window (including possible window manager decorations) 726 Emacs window (including possible window manager decorations)
730 and FRAME_X_WINDOW (f). */ 727 and FRAME_X_WINDOW (f). */
731 #define FRAME_OUTER_TO_INNER_DIFF_X(f) \ 728 #define FRAME_OUTER_TO_INNER_DIFF_X(f) \
738 #define FRAME_XIC(f) ((f)->output_data.x->xic) 735 #define FRAME_XIC(f) ((f)->output_data.x->xic)
739 #define FRAME_X_XIM(f) (FRAME_X_DISPLAY_INFO (f)->xim) 736 #define FRAME_X_XIM(f) (FRAME_X_DISPLAY_INFO (f)->xim)
740 #define FRAME_X_XIM_STYLES(f) (FRAME_X_DISPLAY_INFO (f)->xim_styles) 737 #define FRAME_X_XIM_STYLES(f) (FRAME_X_DISPLAY_INFO (f)->xim_styles)
741 #define FRAME_XIC_STYLE(f) ((f)->output_data.x->xic_style) 738 #define FRAME_XIC_STYLE(f) ((f)->output_data.x->xic_style)
742 #define FRAME_XIC_FONTSET(f) ((f)->output_data.x->xic_xfs) 739 #define FRAME_XIC_FONTSET(f) ((f)->output_data.x->xic_xfs)
740 #define FRAME_XIC_BASE_FONTNAME(f) ((f)->output_data.x->xic_base_fontname)
743 741
744 /* Value is the smallest width of any character in any font on frame F. */ 742 /* Value is the smallest width of any character in any font on frame F. */
745 743
746 #define FRAME_SMALLEST_CHAR_WIDTH(F) \ 744 #define FRAME_SMALLEST_CHAR_WIDTH(F) \
747 FRAME_X_DISPLAY_INFO(F)->smallest_char_width 745 FRAME_X_DISPLAY_INFO(F)->smallest_char_width
752 FRAME_X_DISPLAY_INFO(F)->smallest_font_height 750 FRAME_X_DISPLAY_INFO(F)->smallest_font_height
753 751
754 /* Return a pointer to the image cache of frame F. */ 752 /* Return a pointer to the image cache of frame F. */
755 753
756 #define FRAME_X_IMAGE_CACHE(F) FRAME_X_DISPLAY_INFO ((F))->image_cache 754 #define FRAME_X_IMAGE_CACHE(F) FRAME_X_DISPLAY_INFO ((F))->image_cache
757
758
759 /* Total width of fringes reserved for drawing truncation bitmaps,
760 continuation bitmaps and alike. The width is in canonical char
761 units of the frame. This must currently be the case because window
762 sizes aren't pixel values. If it weren't the case, we wouldn't be
763 able to split windows horizontally nicely. */
764
765 #define FRAME_X_FRINGE_COLS(F) ((F)->output_data.x->fringe_cols)
766
767 /* Total width of fringes in pixels. */
768
769 #define FRAME_X_FRINGE_WIDTH(F) ((F)->output_data.x->fringes_extra)
770
771 /* Pixel-width of the left and right fringe. */
772
773 #define FRAME_X_LEFT_FRINGE_WIDTH(F) ((F)->output_data.x->left_fringe_width)
774 #define FRAME_X_RIGHT_FRINGE_WIDTH(F) ((F)->output_data.x->right_fringe_width)
775
776 755
777 756
778 /* X-specific scroll bar stuff. */ 757 /* X-specific scroll bar stuff. */
779 758
780 /* We represent scroll bars as lisp vectors. This allows us to place 759 /* We represent scroll bars as lisp vectors. This allows us to place
912 #define VERTICAL_SCROLL_BAR_MIN_HANDLE (5) 891 #define VERTICAL_SCROLL_BAR_MIN_HANDLE (5)
913 892
914 /* Trimming off a few pixels from each side prevents 893 /* Trimming off a few pixels from each side prevents
915 text from glomming up against the scroll bar */ 894 text from glomming up against the scroll bar */
916 #define VERTICAL_SCROLL_BAR_WIDTH_TRIM (0) 895 #define VERTICAL_SCROLL_BAR_WIDTH_TRIM (0)
917
918
919 /* Manipulating pixel sizes and character sizes.
920 Knowledge of which factors affect the overall size of the window should
921 be hidden in these macros, if that's possible.
922
923 Return the upper/left pixel position of the character cell on frame F
924 at ROW/COL. */
925 #define CHAR_TO_PIXEL_ROW(f, row) \
926 ((f)->output_data.x->internal_border_width \
927 + (row) * (f)->output_data.x->line_height)
928 #define CHAR_TO_PIXEL_COL(f, col) \
929 ((f)->output_data.x->internal_border_width \
930 + (col) * FONT_WIDTH ((f)->output_data.x->font))
931
932 /* Return the pixel width/height of frame F if it has
933 WIDTH columns/HEIGHT rows. */
934 #define CHAR_TO_PIXEL_WIDTH(f, width) \
935 (CHAR_TO_PIXEL_COL (f, width) \
936 + (f)->output_data.x->vertical_scroll_bar_extra \
937 + (f)->output_data.x->fringes_extra \
938 + (f)->output_data.x->internal_border_width)
939 #define CHAR_TO_PIXEL_HEIGHT(f, height) \
940 (CHAR_TO_PIXEL_ROW (f, height) \
941 + (f)->output_data.x->internal_border_width)
942
943
944 /* Return the row/column (zero-based) of the character cell containing
945 the pixel on FRAME at ROW/COL. */
946 #define PIXEL_TO_CHAR_ROW(f, row) \
947 (((row) - (f)->output_data.x->internal_border_width) \
948 / (f)->output_data.x->line_height)
949 #define PIXEL_TO_CHAR_COL(f, col) \
950 (((col) - (f)->output_data.x->internal_border_width) \
951 / FONT_WIDTH ((f)->output_data.x->font))
952
953 /* How many columns/rows of text can we fit in WIDTH/HEIGHT pixels on
954 frame F? */
955 #define PIXEL_TO_CHAR_WIDTH(f, width) \
956 (PIXEL_TO_CHAR_COL (f, ((width) \
957 - (f)->output_data.x->internal_border_width \
958 - (f)->output_data.x->fringes_extra \
959 - (f)->output_data.x->vertical_scroll_bar_extra)))
960 #define PIXEL_TO_CHAR_HEIGHT(f, height) \
961 (PIXEL_TO_CHAR_ROW (f, ((height) \
962 - (f)->output_data.x->internal_border_width)))
963 896
964 897
965 /* If a struct input_event has a kind which is SELECTION_REQUEST_EVENT 898 /* If a struct input_event has a kind which is SELECTION_REQUEST_EVENT
966 or SELECTION_CLEAR_EVENT, then its contents are really described 899 or SELECTION_CLEAR_EVENT, then its contents are really described
967 by this structure. */ 900 by this structure. */
1014 Lisp_Object, Lisp_Object, 947 Lisp_Object, Lisp_Object,
1015 Lisp_Object, Lisp_Object)); 948 Lisp_Object, Lisp_Object));
1016 struct frame *check_x_frame P_ ((Lisp_Object)); 949 struct frame *check_x_frame P_ ((Lisp_Object));
1017 EXFUN (Fx_display_color_p, 1); 950 EXFUN (Fx_display_color_p, 1);
1018 EXFUN (Fx_display_grayscale_p, 1); 951 EXFUN (Fx_display_grayscale_p, 1);
1019 int image_ascent P_ ((struct image *, struct face *));
1020 extern void x_free_gcs P_ ((struct frame *)); 952 extern void x_free_gcs P_ ((struct frame *));
1021 953
1022 /* From xrdb.c. */ 954 /* From xrdb.c. */
1023 955
1024 char *x_get_string_resource P_ ((XrmDatabase, char *, char *));
1025 char *x_get_customization_string P_ ((XrmDatabase, char *, char *)); 956 char *x_get_customization_string P_ ((XrmDatabase, char *, char *));
1026 XrmDatabase x_load_resources P_ ((Display *, char *, char *, char *)); 957 XrmDatabase x_load_resources P_ ((Display *, char *, char *, char *));
1027 int x_get_resource P_ ((XrmDatabase, char *, char *, 958 int x_get_resource P_ ((XrmDatabase, char *, char *,
1028 XrmRepresentation, XrmValue *)); 959 XrmRepresentation, XrmValue *));
1029 void x_delete_display P_ ((struct x_display_info *)); 960 void x_delete_display P_ ((struct x_display_info *));
1030 void x_make_frame_visible P_ ((struct frame *)); 961 void x_make_frame_visible P_ ((struct frame *));
1031 void x_iconify_frame P_ ((struct frame *)); 962 void x_iconify_frame P_ ((struct frame *));
1032 void x_wm_set_size_hint P_ ((struct frame *, long, int)); 963 void x_wm_set_size_hint P_ ((struct frame *, long, int));
1033 void x_set_offset P_ ((struct frame *, int, int, int));
1034 void x_wm_set_icon_position P_ ((struct frame *, int, int));
1035 int x_catch_errors P_ ((Display *)); 964 int x_catch_errors P_ ((Display *));
1036 int x_had_errors_p P_ ((Display *)); 965 int x_had_errors_p P_ ((Display *));
1037 void x_uncatch_errors P_ ((Display *, int)); 966 void x_uncatch_errors P_ ((Display *, int));
1038 void x_check_errors P_ ((Display *, char *)); 967 void x_check_errors P_ ((Display *, char *));
1039 int x_text_icon P_ ((struct frame *, char *)); 968 int x_text_icon P_ ((struct frame *, char *));
1040 int x_bitmap_icon P_ ((struct frame *, Lisp_Object)); 969 int x_bitmap_icon P_ ((struct frame *, Lisp_Object));
1041 void x_set_window_size P_ ((struct frame *, int, int, int)); 970 void x_set_window_size P_ ((struct frame *, int, int, int));
1042 void x_wm_set_window_state P_ ((struct frame *, int)); 971 void x_wm_set_window_state P_ ((struct frame *, int));
1043 int x_alloc_nearest_color P_ ((struct frame *, Colormap, XColor *)); 972 int x_alloc_nearest_color P_ ((struct frame *, Colormap, XColor *));
1044 973
1045 extern void pixel_to_glyph_coords P_ ((struct frame *, int, int,
1046 int *, int *, XRectangle *, int));
1047
1048 /* Defined in xterm.c */ 974 /* Defined in xterm.c */
1049 975
1050 extern void cancel_mouse_face P_ ((struct frame *)); 976 extern void cancel_mouse_face P_ ((struct frame *));
1051 extern void x_scroll_bar_clear P_ ((struct frame *)); 977 extern void x_scroll_bar_clear P_ ((struct frame *));
1052 extern void x_start_queuing_selection_requests P_ ((Display *));
1053 extern void x_stop_queuing_selection_requests P_ ((Display *));
1054 extern void x_update_cursor P_ ((struct frame *, int));
1055 extern int x_text_icon P_ ((struct frame *, char *)); 978 extern int x_text_icon P_ ((struct frame *, char *));
1056 extern int x_bitmap_icon P_ ((struct frame *, Lisp_Object)); 979 extern int x_bitmap_icon P_ ((struct frame *, Lisp_Object));
1057 extern int x_catch_errors P_ ((Display *)); 980 extern int x_catch_errors P_ ((Display *));
1058 extern void x_check_errors P_ ((Display *, char *)); 981 extern void x_check_errors P_ ((Display *, char *));
1059 extern int x_had_errors_p P_ ((Display *)); 982 extern int x_had_errors_p P_ ((Display *));
1060 extern void x_uncatch_errors P_ ((Display *, int)); 983 extern void x_uncatch_errors P_ ((Display *, int));
1061 extern Lisp_Object x_new_font P_ ((struct frame *, char *));
1062 extern Lisp_Object x_new_fontset P_ ((struct frame *, char *));
1063 extern void x_compute_fringe_widths P_ ((struct frame *, int));
1064 extern void x_set_offset P_ ((struct frame *, int, int, int));
1065 extern void x_set_window_size P_ ((struct frame *, int, int, int)); 984 extern void x_set_window_size P_ ((struct frame *, int, int, int));
1066 extern void x_set_mouse_position P_ ((struct frame *, int, int)); 985 extern void x_set_mouse_position P_ ((struct frame *, int, int));
1067 extern void x_set_mouse_pixel_position P_ ((struct frame *, int, int)); 986 extern void x_set_mouse_pixel_position P_ ((struct frame *, int, int));
1068 extern void x_raise_frame P_ ((struct frame *)); 987 extern void x_raise_frame P_ ((struct frame *));
1069 extern void x_lower_frame P_ ((struct frame *)); 988 extern void x_lower_frame P_ ((struct frame *));
1073 extern void x_free_frame_resources P_ ((struct frame *)); 992 extern void x_free_frame_resources P_ ((struct frame *));
1074 extern void x_destroy_window P_ ((struct frame *)); 993 extern void x_destroy_window P_ ((struct frame *));
1075 extern void x_wm_set_size_hint P_ ((struct frame *, long, int)); 994 extern void x_wm_set_size_hint P_ ((struct frame *, long, int));
1076 extern void x_wm_set_window_state P_ ((struct frame *, int)); 995 extern void x_wm_set_window_state P_ ((struct frame *, int));
1077 extern void x_wm_set_icon_pixmap P_ ((struct frame *, int)); 996 extern void x_wm_set_icon_pixmap P_ ((struct frame *, int));
1078 extern void x_wm_set_icon_position P_ ((struct frame *, int, int));
1079 extern void x_delete_display P_ ((struct x_display_info *)); 997 extern void x_delete_display P_ ((struct x_display_info *));
1080 extern void x_initialize P_ ((void)); 998 extern void x_initialize P_ ((void));
1081 extern void x_display_cursor P_ ((struct window *, int, int, int, int, int));
1082 extern unsigned long x_copy_color P_ ((struct frame *, unsigned long)); 999 extern unsigned long x_copy_color P_ ((struct frame *, unsigned long));
1083 #ifdef USE_X_TOOLKIT 1000 #ifdef USE_X_TOOLKIT
1084 extern XtAppContext Xt_app_con; 1001 extern XtAppContext Xt_app_con;
1085 #endif 1002 #endif
1086 extern void x_query_colors P_ ((struct frame *f, XColor *, int)); 1003 extern void x_query_colors P_ ((struct frame *f, XColor *, int));
1087 extern void x_query_color P_ ((struct frame *f, XColor *)); 1004 extern void x_query_color P_ ((struct frame *f, XColor *));
1088 extern void x_clear_area P_ ((Display *, Window, int, int, int, int, int)); 1005 extern void x_clear_area P_ ((Display *, Window, int, int, int, int, int));
1089 1006 extern void set_vertical_scroll_bar P_ ((struct window *));
1090 extern void x_fullscreen_adjust P_ ((struct frame *f, int *, int *,
1091 int *, int *));
1092 1007
1093 extern int x_dispatch_event P_ ((XEvent *, Display *)); 1008 extern int x_dispatch_event P_ ((XEvent *, Display *));
1094 1009
1095 /* Defined in xselect.c */ 1010 /* Defined in xselect.c */
1096 1011
1097 extern void x_handle_property_notify P_ ((XPropertyEvent *)); 1012 extern void x_handle_property_notify P_ ((XPropertyEvent *));
1098 extern void x_handle_selection_notify P_ ((XSelectionEvent *)); 1013 extern void x_handle_selection_notify P_ ((XSelectionEvent *));
1099 extern void x_handle_selection_request P_ ((struct input_event *)); 1014 extern void x_handle_selection_event P_ ((struct input_event *));
1100 extern void x_handle_selection_clear P_ ((struct input_event *));
1101 extern void x_clear_frame_selections P_ ((struct frame *)); 1015 extern void x_clear_frame_selections P_ ((struct frame *));
1102 1016
1017 extern int x_handle_dnd_message P_ ((struct frame *,
1018 XClientMessageEvent *,
1019 struct x_display_info *,
1020 struct input_event *bufp));
1021 extern int x_check_property_data P_ ((Lisp_Object));
1022 extern void x_fill_property_data P_ ((Display *,
1023 Lisp_Object,
1024 void *,
1025 int));
1026 extern Lisp_Object x_property_data_to_lisp P_ ((struct frame *,
1027 unsigned char *,
1028 Atom,
1029 int,
1030 unsigned long));
1031
1103 /* Defined in xfns.c */ 1032 /* Defined in xfns.c */
1104 1033
1034 extern struct x_display_info * check_x_display_info P_ ((Lisp_Object frame));
1105 extern int have_menus_p P_ ((void)); 1035 extern int have_menus_p P_ ((void));
1106 extern int x_bitmap_height P_ ((struct frame *, int)); 1036
1107 extern int x_bitmap_width P_ ((struct frame *, int)); 1037 #ifdef USE_GTK
1108 extern int x_bitmap_pixmap P_ ((struct frame *, int)); 1038 extern int xg_set_icon P_ ((struct frame *, Lisp_Object));
1109 extern void x_reference_bitmap P_ ((struct frame *, int)); 1039 extern int xg_set_icon_from_xpm_data P_ ((struct frame *, char**));
1110 extern int x_create_bitmap_from_data P_ ((struct frame *, char *, 1040 #endif /* USE_GTK */
1111 unsigned int, unsigned int)); 1041
1112 extern int x_create_bitmap_from_file P_ ((struct frame *, Lisp_Object));
1113 extern void x_destroy_bitmap P_ ((struct frame *, int));
1114 extern void x_set_frame_parameters P_ ((struct frame *, Lisp_Object));
1115 extern void x_real_positions P_ ((struct frame *, int *, int *)); 1042 extern void x_real_positions P_ ((struct frame *, int *, int *));
1116 extern void x_report_frame_params P_ ((struct frame *, Lisp_Object *));
1117 extern int defined_color P_ ((struct frame *, char *, XColor *, int)); 1043 extern int defined_color P_ ((struct frame *, char *, XColor *, int));
1118 extern void x_set_border_pixel P_ ((struct frame *, int)); 1044 extern void x_set_border_pixel P_ ((struct frame *, int));
1119 extern void x_set_menu_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object)); 1045 extern void x_set_menu_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object));
1120 extern unsigned char * x_encode_text P_ ((Lisp_Object, Lisp_Object, int,
1121 int *, int *));
1122 extern void x_implicitly_set_name P_ ((struct frame *, Lisp_Object, Lisp_Object)); 1046 extern void x_implicitly_set_name P_ ((struct frame *, Lisp_Object, Lisp_Object));
1047 extern void xic_free_xfontset P_ ((struct frame *));
1123 extern void create_frame_xic P_ ((struct frame *)); 1048 extern void create_frame_xic P_ ((struct frame *));
1124 extern void destroy_frame_xic P_ ((struct frame *)); 1049 extern void destroy_frame_xic P_ ((struct frame *));
1125 extern void xic_set_preeditarea P_ ((struct window *, int, int)); 1050 extern void xic_set_preeditarea P_ ((struct window *, int, int));
1126 extern void xic_set_statusarea P_ ((struct frame *)); 1051 extern void xic_set_statusarea P_ ((struct frame *));
1127 extern void xic_set_xfontset P_ ((struct frame *, char *)); 1052 extern void xic_set_xfontset P_ ((struct frame *, char *));
1137 #endif 1062 #endif
1138 extern void x_set_tool_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object)); 1063 extern void x_set_tool_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object));
1139 1064
1140 /* Defined in xfaces.c */ 1065 /* Defined in xfaces.c */
1141 1066
1142 extern int frame_update_line_height P_ ((struct frame *));
1143 extern int compute_glyph_face P_ ((struct frame *, int, int)); 1067 extern int compute_glyph_face P_ ((struct frame *, int, int));
1144 extern int compute_glyph_face_1 P_ ((struct frame *, Lisp_Object, int)); 1068 extern int compute_glyph_face_1 P_ ((struct frame *, Lisp_Object, int));
1145 extern void x_free_dpy_colors P_ ((Display *, Screen *, Colormap, 1069 extern void x_free_dpy_colors P_ ((Display *, Screen *, Colormap,
1146 unsigned long *, int)); 1070 unsigned long *, int));
1147 1071
1148 /* Defined in xmenu.c */ 1072 /* Defined in xmenu.c */
1149 1073
1074 extern void x_menu_set_in_use P_ ((int));
1075 extern void x_menu_wait_for_event P_ ((void *data));
1150 extern void x_activate_menubar P_ ((struct frame *)); 1076 extern void x_activate_menubar P_ ((struct frame *));
1151 extern int popup_activated P_ ((void)); 1077 extern int popup_activated P_ ((void));
1152 extern void initialize_frame_menubar P_ ((struct frame *)); 1078 extern void initialize_frame_menubar P_ ((struct frame *));
1079 extern void free_frame_menubar P_ ((struct frame *));
1153 1080
1154 /* Defined in widget.c */ 1081 /* Defined in widget.c */
1155 1082
1156 #ifdef USE_X_TOOLKIT 1083 #ifdef USE_X_TOOLKIT
1157 extern void widget_store_internal_border P_ ((Widget)); 1084 extern void widget_store_internal_border P_ ((Widget));
1158 #endif 1085 #endif
1159 1086
1160 /* Defined in xsmfns.c */ 1087 /* Defined in xsmfns.c */
1161 #ifdef HAVE_X_SM 1088 #ifdef HAVE_X_SM
1162 extern void x_session_initialize P_ ((void)); 1089 extern void x_session_initialize P_ ((struct x_display_info *dpyinfo));
1163 extern int x_session_check_input P_ ((struct input_event *bufp, 1090 extern int x_session_check_input P_ ((struct input_event *bufp));
1164 int *numchars));
1165 extern int x_session_have_connection P_ ((void)); 1091 extern int x_session_have_connection P_ ((void));
1166 #endif 1092 #endif
1093
1094 #define FONT_TYPE_FOR_UNIBYTE(font, ch) 0
1095 #define FONT_TYPE_FOR_MULTIBYTE(font, ch) 0
1096
1097 #define STORE_XCHAR2B(chp, b1, b2) \
1098 ((chp)->byte1 = (b1), (chp)->byte2 = (b2))
1099
1100 #define XCHAR2B_BYTE1(chp) \
1101 ((chp)->byte1)
1102
1103 #define XCHAR2B_BYTE2(chp) \
1104 ((chp)->byte2)
1105
1106
1107 #define STORE_NATIVE_RECT(nr,rx,ry,rwidth,rheight) \
1108 ((nr).x = (rx), \
1109 (nr).y = (ry), \
1110 (nr).width = (rwidth), \
1111 (nr).height = (rheight))
1112
1113 /* arch-tag: 78a7972a-b18f-4694-861a-0780c4b3090e
1114 (do not change this comment) */