annotate src/EmacsFrame.c @ 930:eaedf30d9d76

[xemacs-hg @ 2002-07-23 08:34:59 by youngs] 2002-07-15 Jerry James <james@xemacs.org> * make-docfile.c: Change whitespace and organization to reduce the size of the diff against FSF Emacs sources and synch to Emacs 21.2. Remove unused DO_REALLOC. Mark XEmacs changes and additions more clearly. Reintroduce previously deleted Emacs code inside #if 0 ... #endif. * make-docfile.c (next_extra_elc): Replace goto with do-while. * make-docfile.c (main): Put XEmacs-only args in one place. * make-docfile.c (write_c_args): Change buff to buf to match Emacs. Replace pointer arithmetic with simpler array syntax. * make-docfile.c (scan_c_file): Note that DEFSIMPLE and DEFPRED no longer exist. Correct the "name too long" test (off by one). Die with message if a DEFUN has no docstring instead of hanging. * make-docfile.c (scan_lisp_file): Introduce while loops used in Emacs sources to skip consecutive blank lines. 2002-07-21 John Paul Wallington <jpw@xemacs.org> * process.el (substitute-env-vars): New function; sync with GNU Emacs 21.1.50. (setenv): Add optional arg SUBSTITUTE-ENV-VARS; sync with GNU Emacs 21.1.50. 2002-07-20 Mike Sperber <mike@xemacs.org> * eval.c (run_post_gc_hook): Use more correct flags when running post-gc-hook. 2002-07-20 Mike Sperber <mike@xemacs.org> * process-unix.c (child_setup): Don't try to close file descriptors for chid process once again---it's already being done in close_process_descs. (unix_create_process): Call begin_dont_check_for_quit to inhibit unwanted interaction (and thus breaking of X event synchronicity) in the child. 2002-07-15 Jerry James <james@xemacs.org> * lisp.h: Make Qdll_error visible globally. * symbols.c (check_sane_subr): Revert 2002-06-26 change. Check only if !initialized. * symbols.c (check_module_subr): Add parameter. Duplicate check_sane_subr checks, but signal an error instead of asserting. * symbols.c (defsubr): Use check_module_subr parameter. * symbols.c (defsubr_macro): Ditto.
author youngs
date Tue, 23 Jul 2002 08:35:11 +0000
parents 79c6ff3eef26
children 04bc9d2f42c7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 /* The emacs frame widget.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2 Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3 Copyright (C) 1993-1995 Sun Microsystems, Inc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4 Copyright (C) 1995 Ben Wing.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6 This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 XEmacs is free software; you can redistribute it and/or modify it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9 under the terms of the GNU General Public License as published by the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10 Free Software Foundation; either version 2, or (at your option) any
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11 later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 XEmacs is distributed in the hope that it will be useful, but WITHOUT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16 for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 You should have received a copy of the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 along with XEmacs; see the file COPYING. If not, write to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21 Boston, MA 02111-1307, USA. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23 /* Synched up with: Not in FSF. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25 /* #### Note to potential hackers: Don't mess with this unless you're
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26 sure you know what you're doing! Xt is a lot more subtle than
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27 you may think. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29 #include <config.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30 #include "lisp.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 869
diff changeset
32 #include "device-impl.h"
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
33 #include "faces.h"
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 869
diff changeset
34 #include "frame-impl.h"
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
35 #include "toolbar.h"
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
36 #include "window.h"
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
37
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 869
diff changeset
38 #include "console-x-impl.h"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39 #include "glyphs-x.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 #include "objects-x.h"
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
41
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42 #include <X11/Shell.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43 #include "EmacsFrameP.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44 #include "EmacsManager.h" /* for EmacsManagerChangeSize */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 #include "xmu.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47 static void EmacsFrameClassInitialize (void);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 static void EmacsFrameInitialize (Widget, Widget, ArgList, Cardinal *);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49 static void EmacsFrameRealize (Widget, XtValueMask*, XSetWindowAttributes*);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50 static void EmacsFrameResize (Widget widget);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 static Boolean EmacsFrameSetValues (Widget, Widget, Widget,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52 ArgList, Cardinal *);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53 static XtGeometryResult EmacsFrameQueryGeometry (Widget, XtWidgetGeometry*,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54 XtWidgetGeometry*);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56 extern void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57 emacs_Xt_mapping_action (Widget w, XEvent* event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59 #undef XtOffset
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
60 #define XtOffset(p_type,field) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61 ((Cardinal) (((char *) (&(((p_type)0)->field))) - ((char *)0)))
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
62 #define offset(field) XtOffset (EmacsFrame, emacs_frame.field)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64 static XtResource resources[] = {
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
65 { XtNgeometry, XtCGeometry,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
66 XtRString, sizeof (String),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
67 offset (geometry), XtRString, (XtPointer) 0 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
68 { XtNiconic, XtCIconic,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
69 XtRBoolean, sizeof (Boolean),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
70 offset (iconic), XtRImmediate, (XtPointer) False },
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
72 { XtNemacsFrame, XtCEmacsFrame,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
73 XtRPointer, sizeof (XtPointer),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
74 offset (frame), XtRImmediate, 0 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
75 { XtNmenubar, XtCMenubar,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
76 XtRBoolean, sizeof (Boolean),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
77 offset (menubar_p), XtRImmediate, (XtPointer) True },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
78 { XtNinitiallyUnmapped, XtCInitiallyUnmapped,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
79 XtRBoolean, sizeof (Boolean),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
80 offset (initially_unmapped), XtRImmediate, (XtPointer) False },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
81 { XtNminibuffer, XtCMinibuffer,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
82 XtRBoolean, sizeof (Boolean),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
83 offset (minibuffer), XtRImmediate, (XtPointer) True },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
84 { XtNunsplittable, XtCUnsplittable,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
85 XtRBoolean, sizeof (Boolean),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
86 offset (unsplittable), XtRImmediate, (XtPointer) False },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
87 { XtNinternalBorderWidth, XtCInternalBorderWidth,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
88 XtRInt, sizeof (int),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
89 offset (internal_border_width), XtRImmediate, (XtPointer)4 },
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90 #ifdef HAVE_SCROLLBARS
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
91 { XtNscrollBarWidth, XtCScrollBarWidth,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
92 XtRInt, sizeof (int),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
93 offset (scrollbar_width), XtRImmediate, (XtPointer)-1 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
94 { XtNscrollBarHeight, XtCScrollBarHeight,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
95 XtRInt, sizeof (int),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
96 offset (scrollbar_height), XtRImmediate, (XtPointer)-1 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
97 { XtNscrollBarPlacement, XtCScrollBarPlacement,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
98 XtRScrollBarPlacement, sizeof (unsigned char),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
99 offset (scrollbar_placement), XtRImmediate,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100 #if defined (LWLIB_SCROLLBARS_MOTIF) || defined (LWLIB_SCROLLBARS_LUCID) || \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101 defined (LWLIB_SCROLLBARS_ATHENA3D)
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
102 (XtPointer) XtBOTTOM_RIGHT
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 #else
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
104 (XtPointer) XtBOTTOM_LEFT
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106 },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107 #endif /* HAVE_SCROLLBARS */
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
108
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109 #ifdef HAVE_TOOLBARS
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
110 { XtNtopToolBarHeight, XtCTopToolBarHeight,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
111 XtRInt, sizeof (int),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
112 offset (top_toolbar_height), XtRImmediate, (XtPointer)-1 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
113 { XtNbottomToolBarHeight, XtCBottomToolBarHeight,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
114 XtRInt, sizeof (int),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
115 offset (bottom_toolbar_height), XtRImmediate, (XtPointer)-1 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
116 { XtNleftToolBarWidth, XtCLeftToolBarWidth,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
117 XtRInt, sizeof (int),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
118 offset (left_toolbar_width), XtRImmediate, (XtPointer)-1 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
119 { XtNrightToolBarWidth, XtCRightToolBarWidth,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
120 XtRInt, sizeof (int),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
121 offset (right_toolbar_width), XtRImmediate, (XtPointer)-1 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
122 { XtNtopToolBarBorderWidth, XtCTopToolBarBorderWidth,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
123 XtRInt, sizeof (int),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
124 offset (top_toolbar_border_width), XtRImmediate, (XtPointer)-1 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
125 { XtNbottomToolBarBorderWidth, XtCBottomToolBarBorderWidth,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
126 XtRInt, sizeof (int),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
127 offset (bottom_toolbar_border_width), XtRImmediate, (XtPointer)-1 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
128 { XtNleftToolBarBorderWidth, XtCLeftToolBarBorderWidth,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
129 XtRInt, sizeof (int),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
130 offset (left_toolbar_border_width), XtRImmediate, (XtPointer)-1 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
131 { XtNrightToolBarBorderWidth, XtCRightToolBarBorderWidth,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
132 XtRInt, sizeof (int),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
133 offset (right_toolbar_border_width), XtRImmediate, (XtPointer)-1 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
134 { XtNtoolBarShadowThickness, XtCToolBarShadowThickness,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
135 XtRDimension, sizeof (Dimension),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
136 offset (toolbar_shadow_thickness), XtRImmediate, (XtPointer)2 },
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
137 #endif /* HAVE_TOOLBARS */
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
138
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
139 { XtNinterline, XtCInterline,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
140 XtRInt, sizeof (int),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
141 offset (interline), XtRImmediate, (XtPointer)0 },
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
142 {
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
143 XtNfont, XtCFont,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
144 XtRFontStruct, sizeof (XFontStruct *),
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
145 offset(font), XtRImmediate, (XtPointer)0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
146 },
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
147 { XtNforeground, XtCForeground,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
148 XtRPixel, sizeof (Pixel),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
149 offset(foreground_pixel), XtRString, (XtPointer) "Black" },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
150 { XtNbackground, XtCBackground,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
151 XtRPixel, sizeof (Pixel),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
152 offset(background_pixel), XtRString, (XtPointer) "Gray80" },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
153 { XtNcursorColor, XtCForeground,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
154 XtRPixel, sizeof (Pixel),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
155 offset(cursor_color), XtRString, (XtPointer) "XtDefaultForeground" },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
156 { XtNbarCursor, XtCBarCursor,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
157 XtRBoolean, sizeof (Boolean),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
158 offset (bar_cursor), XtRImmediate, (XtPointer)0 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
159 { XtNvisualBell, XtCVisualBell,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
160 XtRBoolean, sizeof (Boolean),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
161 offset (visual_bell), XtRImmediate, (XtPointer)0 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
162 { XtNbellVolume, XtCBellVolume,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
163 XtRInt, sizeof (int),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
164 offset (bell_volume), XtRImmediate, (XtPointer)0 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
165 { XtNuseBackingStore, XtCUseBackingStore,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
166 XtRBoolean, sizeof (Boolean),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
167 offset (use_backing_store), XtRImmediate, (XtPointer)0 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
168 { XtNpreferredWidth, XtCPreferredWidth,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
169 XtRDimension, sizeof (Dimension),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
170 offset (preferred_width), XtRImmediate, (XtPointer)0 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
171 { XtNpreferredHeight, XtCPreferredHeight,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
172 XtRDimension, sizeof (Dimension),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
173 offset (preferred_height), XtRImmediate, (XtPointer)0 },
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
174 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
175
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
176 #undef offset
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
177
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
178 /* Xt is stupid and dumb.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
179 Xt is stupid and dumb.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
180 Xt is stupid and dumb. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
181
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
182 static XtActionsRec
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
183 emacsFrameActionsTable [] = {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
184 {"mapping", (XtActionProc) emacs_Xt_mapping_action},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
185 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
186
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
187 static char
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
188 emacsFrameTranslations [] = "\
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
189 <Mapping>: mapping()\n\
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
190 ";
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
191
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
192 /* If we're running under Motif, make this widget a subclass
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
193 of XmPrimitive. It's not clear this is necessary, but it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
194 may make focus behavior work better. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
195
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
196 EmacsFrameClassRec emacsFrameClassRec = {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
197 { /* core fields */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
198 #ifdef LWLIB_USES_MOTIF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
199 /* superclass */ (WidgetClass) &xmPrimitiveClassRec,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
200 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
201 /* superclass */ &widgetClassRec,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
202 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
203 /* class_name */ "EmacsFrame",
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
204 /* widget_size */ sizeof (EmacsFrameRec),
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
205 /* class_initialize */ EmacsFrameClassInitialize,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
206 /* class_part_initialize */ 0,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
207 /* class_inited */ FALSE,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
208 /* initialize */ EmacsFrameInitialize,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
209 /* initialize_hook */ 0,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
210 /* realize */ EmacsFrameRealize,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
211 /* actions */ emacsFrameActionsTable,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
212 /* num_actions */ XtNumber (emacsFrameActionsTable),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
213 /* resources */ resources,
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
214 /* resource_count */ XtNumber (resources),
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
215 /* xrm_class */ NULLQUARK,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
216 /* compress_motion */ TRUE,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
217 /* compress_exposure */ TRUE,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
218 /* compress_enterleave */ TRUE,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
219 /* visible_interest */ FALSE,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
220 /* destroy */ NULL,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
221 /* resize */ EmacsFrameResize,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
222 /* expose */ XtInheritExpose,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
223 /* set_values */ EmacsFrameSetValues,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
224 /* set_values_hook */ 0,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
225 /* set_values_almost */ XtInheritSetValuesAlmost,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
226 /* get_values_hook */ 0,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
227 /* accept_focus */ XtInheritAcceptFocus,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
228 /* version */ XtVersion,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
229 /* callback_private */ 0,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
230 /* tm_table */ emacsFrameTranslations,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
231 /* query_geometry */ EmacsFrameQueryGeometry,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
232 /* display_accelerator */ XtInheritDisplayAccelerator,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
233 /* extension */ 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
234 },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
235 #ifdef LWLIB_USES_MOTIF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
236 { /* XmPrimitiveClassPart
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
237 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
238 (XtWidgetProc) _XtInherit, /* border_highlight */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
239 (XtWidgetProc) _XtInherit, /* border_unhighlight */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
240 /* Setting the following to NULL causes PrimitiveInitialize()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
241 not to add traversal (TAB etc. to switch focus) and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
242 focus-in/out (border highlight/unhighlight) translations.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
243 If you want those translations, use the value XtInheritTranslations
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
244 instead. Doing this, however, will interfere with Emacs
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
245 focus handling (which highlights/unhighlights the text cursor),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
246 and will lead to strange display results around the border of the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
247 widget. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
248 NULL, /* translations */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
249 NULL, /* arm_and_activate */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
250 NULL, /* get resources */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
251 0, /* num get_resources */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
252 NULL, /* extension */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
253 },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
254 #endif /* LWLIB_USES_MOTIF */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
255 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
256 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
257 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
258 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
259 WidgetClass emacsFrameClass = (WidgetClass) &emacsFrameClassRec;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
260
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
261 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
262 update_various_frame_slots (EmacsFrame ew)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
263 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
264 ew->emacs_frame.frame->pixheight = ew->core.height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
265 ew->emacs_frame.frame->pixwidth = ew->core.width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
266 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
267
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
268 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
269 EmacsFrameInitialize (Widget request, Widget new,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
270 ArgList dum1, Cardinal *dum2)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
271 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
272 EmacsFrame ew = (EmacsFrame)new;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
273 struct frame *f = ew->emacs_frame.frame;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
274
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
275 if (!f)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
276 fatal ("can't create an emacs frame widget without a frame.");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
277
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
278 ew->emacs_frame.frame->internal_border_width =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
279 ew->emacs_frame.internal_border_width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
280 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
281
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
282 void emacs_Xt_event_handler (Widget wid /* unused */,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
283 XtPointer closure /* unused */,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
284 XEvent *event,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
285 Boolean *continue_to_dispatch /* unused */);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
286
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
287 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
288 EmacsFrameRealize (Widget widget, XtValueMask *mask,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
289 XSetWindowAttributes *attrs)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
290 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
291 EmacsFrame ew = (EmacsFrame) widget;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
292 struct frame *f = ew->emacs_frame.frame;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
293 Widget shell_widget = FRAME_X_SHELL_WIDGET (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
294
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
295 attrs->event_mask =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
296 ExposureMask |
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
297 VisibilityChangeMask |
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
298 PropertyChangeMask |
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
299 StructureNotifyMask |
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
300 SubstructureNotifyMask |
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
301 /*SubstructureRedirectMask |*/ /* Only for WMs! */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
302 KeyPressMask |
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
303 KeyReleaseMask |
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
304 ButtonPressMask |
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
305 ButtonReleaseMask |
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
306 FocusChangeMask |
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
307 PointerMotionHintMask |
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
308 PointerMotionMask |
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
309 LeaveWindowMask |
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
310 EnterWindowMask;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
311
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
312
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
313 *mask |= CWEventMask;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
314
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
315 if (ew->emacs_frame.use_backing_store)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
316 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
317 attrs->backing_store = Always;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
318 *mask |= CWBackingStore;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
319 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
320 XtCreateWindow (widget, InputOutput, (Visual *)CopyFromParent, *mask,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
321 attrs);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
322
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
323 /* snarf the events we want. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
324 XtInsertEventHandler (widget, attrs->event_mask, TRUE,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
325 emacs_Xt_event_handler, NULL, XtListHead);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
326 /* some events (e.g. map-notify and WM_DELETE_WINDOW) get sent
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
327 directly to the shell, and the above event handler won't see
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
328 them. So add a handler to get them. These events don't
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
329 propagate, so there's no danger of them being seen twice. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
330 XtInsertEventHandler (shell_widget,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
331 EnterWindowMask | LeaveWindowMask |
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
332 VisibilityChangeMask | StructureNotifyMask |
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
333 KeyPressMask,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
334 TRUE, emacs_Xt_event_handler, NULL, XtListHead);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
335
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
336 #ifdef EXTERNAL_WIDGET
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
337 /* #### Not sure if this special case is necessary */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
338 if (!FRAME_X_EXTERNAL_WINDOW_P (f))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
339 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
340 /* This is necessary under Motif in order to make it possible to click in
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
341 a buffer and move focus out of a dialog box or control panel and back
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
342 into emacs-land; also necessary so that you can still type chars
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
343 if the cursor is over the menubar or scrollbar. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
344 lw_set_keyboard_focus (shell_widget, FRAME_X_TEXT_WIDGET (f));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
345 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
346
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
347 /* DO NOT CALL THIS FUNCTION! Only Xt is supposed to do this. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
348
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
349 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
350 EmacsFrameResize (Widget widget)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
351 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
352 EmacsFrame ew = (EmacsFrame)widget;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
353 struct frame *f = ew->emacs_frame.frame;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
354 int columns;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
355 int rows;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
356 XtWidgetGeometry req, repl;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
357
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
358 update_various_frame_slots (ew);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
359
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
360 pixel_to_char_size (f, ew->core.width, ew->core.height, &columns, &rows);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
361 change_frame_size (f, rows, columns, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
362
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
363 /* Now we tell the EmacsShell that we've changed the size of the non-fixed
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
364 portion of the frame. Note that, if we the resize occurred as a result
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
365 of EmacsFrameSetCharSize(), this information will be stored twice.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
366 This is not a big deal, as storing this information doesn't actually
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
367 do anything until the next resize. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
368 if (FRAME_X_TOP_LEVEL_FRAME_P (f))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
369 x_wm_set_variable_size (FRAME_X_SHELL_WIDGET (f), columns, rows);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
370
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
371 /* Kick the manager so that it knows we've changed size. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
372 req.request_mode = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
373 XtQueryGeometry (FRAME_X_CONTAINER_WIDGET (f), &req, &repl);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
374 EmacsManagerChangeSize (FRAME_X_CONTAINER_WIDGET (f), repl.width,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
375 repl.height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
376 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
377
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
378 static Boolean
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
379 EmacsFrameSetValues (Widget cur_widget, Widget req_widget, Widget new_widget,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
380 ArgList argv, Cardinal *argc)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
381 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
382 EmacsFrame cur = (EmacsFrame) cur_widget;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
383 EmacsFrame new = (EmacsFrame) new_widget;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
384 struct frame *f = new->emacs_frame.frame;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
385 in_resource_setting++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
386 /* This function does not need to do much. Pretty much everything
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
387 interesting will get done in the resize method, which will
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
388 (if necessary) get called by Xt when this function returns
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
389 (see below).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
390 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
391
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
392 /* #### This function will not work if it is not called from
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
393 update_EmacsFrame(), called from SET_FACE_PROPERTY().
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
394 The code located there should be moved inside of here instead,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
395 so that things work if either SET_FACE_PROPERTY() is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
396 called or XtSetValues() is called.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
397 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
398
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
399 if (cur->emacs_frame.iconic != new->emacs_frame.iconic &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
400 FRAME_X_TOP_LEVEL_FRAME_P (new->emacs_frame.frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
401 x_wm_set_shell_iconic_p (FRAME_X_SHELL_WIDGET (new->emacs_frame.frame),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
402 new->emacs_frame.iconic);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
403
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
404 /* If we got here, then we were likely called as a result of
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
405 the EditRes protocol, so go ahead and change scrollbar-width
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
406 and scrollbar-height. Otherwise, we're merely mirroring
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
407 a change made to scrollbar-width etc. so don't do anything
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
408 special. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
409 if (cur->emacs_frame.internal_border_width !=
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
410 new->emacs_frame.internal_border_width)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
411 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
412 f->internal_border_width = new->emacs_frame.internal_border_width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
413 MARK_FRAME_SIZE_SLIPPED (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
414 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
415
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
416 #ifdef HAVE_SCROLLBARS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
417 if (cur->emacs_frame.scrollbar_width !=
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
418 new->emacs_frame.scrollbar_width)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
419 Fadd_spec_to_specifier
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
420 (Vscrollbar_width,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
421 make_int (new->emacs_frame.scrollbar_width),
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 869
diff changeset
422 wrap_frame (f), Qnil, Qnil);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
423 if (cur->emacs_frame.scrollbar_height !=
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
424 new->emacs_frame.scrollbar_height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
425 Fadd_spec_to_specifier
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
426 (Vscrollbar_height,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
427 make_int (new->emacs_frame.scrollbar_height),
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 869
diff changeset
428 wrap_frame (f), Qnil, Qnil);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
429 #endif /* HAVE_SCROLLBARS */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
430 #ifdef HAVE_TOOLBARS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
431 if (cur->emacs_frame.top_toolbar_height !=
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
432 new->emacs_frame.top_toolbar_height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
433 Fadd_spec_to_specifier
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
434 (Vtoolbar_size[TOP_TOOLBAR],
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
435 make_int (new->emacs_frame.top_toolbar_height),
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 869
diff changeset
436 wrap_frame (f), Qnil, Qnil);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
437 if (cur->emacs_frame.bottom_toolbar_height !=
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
438 new->emacs_frame.bottom_toolbar_height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
439 Fadd_spec_to_specifier
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
440 (Vtoolbar_size[BOTTOM_TOOLBAR],
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
441 make_int (new->emacs_frame.bottom_toolbar_height),
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 869
diff changeset
442 wrap_frame (f), Qnil, Qnil);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
443 if (cur->emacs_frame.left_toolbar_width !=
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
444 new->emacs_frame.left_toolbar_width)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
445 Fadd_spec_to_specifier
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
446 (Vtoolbar_size[LEFT_TOOLBAR],
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
447 make_int (new->emacs_frame.left_toolbar_width),
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 869
diff changeset
448 wrap_frame (f), Qnil, Qnil);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
449 if (cur->emacs_frame.right_toolbar_width !=
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
450 new->emacs_frame.right_toolbar_width)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
451 Fadd_spec_to_specifier
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
452 (Vtoolbar_size[RIGHT_TOOLBAR],
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
453 make_int (new->emacs_frame.right_toolbar_width),
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 869
diff changeset
454 wrap_frame (f), Qnil, Qnil);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
455 if (cur->emacs_frame.top_toolbar_border_width !=
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
456 new->emacs_frame.top_toolbar_border_width)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
457 Fadd_spec_to_specifier
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
458 (Vtoolbar_border_width[TOP_TOOLBAR],
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
459 make_int (new->emacs_frame.top_toolbar_border_width),
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 869
diff changeset
460 wrap_frame (f), Qnil, Qnil);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
461 if (cur->emacs_frame.bottom_toolbar_border_width !=
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
462 new->emacs_frame.bottom_toolbar_border_width)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
463 Fadd_spec_to_specifier
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
464 (Vtoolbar_border_width[BOTTOM_TOOLBAR],
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
465 make_int (new->emacs_frame.bottom_toolbar_border_width),
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 869
diff changeset
466 wrap_frame (f), Qnil, Qnil);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
467 if (cur->emacs_frame.left_toolbar_border_width !=
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
468 new->emacs_frame.left_toolbar_border_width)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
469 Fadd_spec_to_specifier
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
470 (Vtoolbar_border_width[LEFT_TOOLBAR],
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
471 make_int (new->emacs_frame.left_toolbar_border_width),
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 869
diff changeset
472 wrap_frame (f), Qnil, Qnil);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
473 if (cur->emacs_frame.right_toolbar_border_width !=
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
474 new->emacs_frame.right_toolbar_border_width)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
475 Fadd_spec_to_specifier
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
476 (Vtoolbar_border_width[RIGHT_TOOLBAR],
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
477 make_int (new->emacs_frame.right_toolbar_border_width),
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 869
diff changeset
478 wrap_frame (f), Qnil, Qnil);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
479 #endif /* HAVE_TOOLBARS */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
480
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
481 in_resource_setting--;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
482
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
483 /* If the request was to resize us, but the size has not changed, Xt
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
484 will do nothing, and won't call our resize callback. Since such a
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
485 request might be issued as a result of hiding/showing menubar or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
486 changing toolbar placement, where we rely on relayout made by the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
487 callback, we go ahead and simulate such a call */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
488 if (cur->core.width == new->core.width
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
489 && cur->core.height == new->core.height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
490 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
491 int i;
647
b39c14581166 [xemacs-hg @ 2001-08-13 04:45:47 by ben]
ben
parents: 440
diff changeset
492 for (i = 0; i < (int) *argc; i++)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
493 if (strcmp (argv[i].name, XtNwidth) == 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
494 || strcmp (argv[i].name, XtNheight) == 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
495 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
496 EmacsFrameResize (new_widget);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
497 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
498 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
499 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
500
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
501 return False;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
502
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
503 /* Note that if either (a) we return True, or (b) the width or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
504 height has changed, an Expose event will be generated. The Xt
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
505 manual says you should not return True if the width or height has
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
506 changed, because then two Expose events will be generated.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
507
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
508 In any case, there is no need to return True because
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
509 SET_FACE_PROPERTY(), which does the resource
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
510 setting, automatically forces a redisplay as necessary. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
511 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
512
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
513 static XtGeometryResult
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
514 EmacsFrameQueryGeometry (Widget widget, XtWidgetGeometry *request,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
515 XtWidgetGeometry *result)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
516 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
517 EmacsFrame ew = (EmacsFrame) widget;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
518 int mask = request->request_mode;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
519 Dimension width, height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
520 int ok_width_int, ok_height_int;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
521 Dimension ok_width, ok_height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
522
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
523 /* We have a definite preference for what size we would like
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
524 to be.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
525
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
526 1) If a preferred size was specified for us, use it.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
527 (This is not currently used)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
528 2) If a proposed size was given, round it to the nearest
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
529 multiple of the default char size and return it.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
530 3) Otherwise, take our current size and round it to the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
531 nearest multiple of the default char size. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
532
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
533 width = mask & CWWidth ? request->width : ew->core.width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
534 height = mask & CWHeight ? request->height : ew->core.height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
535 round_size_to_char (ew->emacs_frame.frame, width, height,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
536 &ok_width_int, &ok_height_int);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
537 ok_width = (Dimension) ok_width_int;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
538 ok_height = (Dimension) ok_height_int;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
539 if (ew->emacs_frame.preferred_width)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
540 ok_width = ew->emacs_frame.preferred_width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
541 if (ew->emacs_frame.preferred_height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
542 ok_height = ew->emacs_frame.preferred_height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
543 result->request_mode |= CWWidth | CWHeight;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
544 result->width = ok_width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
545 result->height = ok_height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
546 if (((mask & CWWidth) && ok_width != request->width)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
547 || ((mask & CWHeight) && ok_height != request->height))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
548 return XtGeometryAlmost;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
549 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
550 return XtGeometryYes;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
551 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
552
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
553 /* Xt string-to-scrollbar-placement converter */
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
554 /* #### Convert this to a `new-style' converter (See XtAddTypeConverter) */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
555
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
556 /* This variable cannot be a stack variable. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
557 static unsigned char cvt_string_scrollbar_placement;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
558
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
559 /* ARGSUSED */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
560 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
561 Xt_StringToScrollBarPlacement (XrmValuePtr args, /* unused */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
562 Cardinal *num_args, /* unused */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
563 XrmValuePtr fromVal,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
564 XrmValuePtr toVal)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
565 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
566 XrmQuark q;
851
e7ee5f8bde58 [xemacs-hg @ 2002-05-23 11:46:08 by ben]
ben
parents: 800
diff changeset
567 char *lowerName = (char *) ALLOCA (strlen ((char *) fromVal->addr) + 1);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
568
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
569 XmuCopyISOLatin1Lowered (lowerName, (char *) fromVal->addr);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
570 q = XrmStringToQuark (lowerName);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
571
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
572 toVal->size = sizeof (cvt_string_scrollbar_placement);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
573 toVal->addr = (XPointer) &cvt_string_scrollbar_placement;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
574
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
575 if (q == XrmStringToQuark ("top-left")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
576 || q == XrmStringToQuark ("top_left"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
577 cvt_string_scrollbar_placement = XtTOP_LEFT;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
578 else if (q == XrmStringToQuark ("bottom-left")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
579 || q == XrmStringToQuark ("bottom_left"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
580 cvt_string_scrollbar_placement = XtBOTTOM_LEFT;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
581 else if (q == XrmStringToQuark ("top-right")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
582 || q == XrmStringToQuark ("top_right"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
583 cvt_string_scrollbar_placement = XtTOP_RIGHT;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
584 else if (q == XrmStringToQuark ("bottom-right")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
585 || q == XrmStringToQuark ("bottom_right"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
586 cvt_string_scrollbar_placement = XtBOTTOM_RIGHT;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
587 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
588 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
589 XtStringConversionWarning (fromVal->addr, "scrollBarPlacement");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
590 toVal->addr = NULL;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
591 toVal->size = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
592 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
593 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
594
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
595 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
596 EmacsFrameClassInitialize (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
597 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
598 XtAddConverter (XtRString, XtRScrollBarPlacement,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
599 Xt_StringToScrollBarPlacement, NULL, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
600 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
601
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
602 /********************* Special entrypoints *******************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
603
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
604 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
605 EmacsFrameRecomputeCellSize (Widget w)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
606 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
607 EmacsFrame ew = (EmacsFrame) w;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
608 int cw, ch;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
609 struct frame *f = ew->emacs_frame.frame;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
610
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
611 if (! XtIsSubclass (w, emacsFrameClass))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
612 abort ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
613
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 647
diff changeset
614 default_face_height_and_width (wrap_frame (f), &ch, &cw);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
615 if (FRAME_X_TOP_LEVEL_FRAME_P (f))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
616 x_wm_set_cell_size (FRAME_X_SHELL_WIDGET (f), cw, ch);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
617 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
618
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
619 /* Set the size of the widget to have the number of rows and columns
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
620 specified. This both causes the X window to change and the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
621 internal frame structures to get modified to match. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
622
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
623 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
624 EmacsFrameSetCharSize (Widget widget, int columns, int rows)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
625 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
626 EmacsFrame ew = (EmacsFrame) widget;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
627 int pixel_width, pixel_height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
628 struct frame *f = ew->emacs_frame.frame;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
629
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
630 if (columns < 3)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
631 columns = 3; /* no way buddy */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
632 if (rows < 1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
633 rows = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
634
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
635 char_to_pixel_size (f, columns, rows, &pixel_width, &pixel_height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
636
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
637 if (FRAME_X_TOP_LEVEL_FRAME_P (f))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
638 x_wm_set_variable_size (FRAME_X_SHELL_WIDGET (f), columns, rows);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
639
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
640 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
641 Arg al [2];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
642 XtSetArg (al [0], XtNwidth, pixel_width);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
643 XtSetArg (al [1], XtNheight, pixel_height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
644 XtSetValues ((Widget) ew, al, countof (al));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
645 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
646 }