annotate src/EmacsFrame.c @ 733:b1f74adcc1ff

[xemacs-hg @ 2002-01-22 20:40:00 by janv] Fix disabled-command-hook
author janv
date Tue, 22 Jan 2002 20:40:03 +0000
parents b39c14581166
children 943eaba38521
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
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32 #include "console-x.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33 #include "glyphs-x.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34 #include "objects-x.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35 #include <X11/Shell.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36 #include "EmacsFrameP.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37 #include "EmacsManager.h" /* for EmacsManagerChangeSize */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38 #include "xmu.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 #include "faces.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 #include "frame.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42 #include "toolbar.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43 #include "window.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 static void EmacsFrameClassInitialize (void);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 static void EmacsFrameInitialize (Widget, Widget, ArgList, Cardinal *);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47 static void EmacsFrameRealize (Widget, XtValueMask*, XSetWindowAttributes*);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 static void EmacsFrameResize (Widget widget);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49 static Boolean EmacsFrameSetValues (Widget, Widget, Widget,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50 ArgList, Cardinal *);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 static XtGeometryResult EmacsFrameQueryGeometry (Widget, XtWidgetGeometry*,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52 XtWidgetGeometry*);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54 extern void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55 emacs_Xt_mapping_action (Widget w, XEvent* event);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57 #undef XtOffset
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58 #define XtOffset(p_type,field) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59 ((Cardinal) (((char *) (&(((p_type)0)->field))) - ((char *)0)))
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
60 #define offset(field) XtOffset (EmacsFrame, emacs_frame.field)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62 static XtResource resources[] = {
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
63 { XtNgeometry, XtCGeometry,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
64 XtRString, sizeof (String),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
65 offset (geometry), XtRString, (XtPointer) 0 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
66 { XtNiconic, XtCIconic,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
67 XtRBoolean, sizeof (Boolean),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
68 offset (iconic), XtRImmediate, (XtPointer) False },
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
70 { XtNemacsFrame, XtCEmacsFrame,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
71 XtRPointer, sizeof (XtPointer),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
72 offset (frame), XtRImmediate, 0 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
73 { XtNmenubar, XtCMenubar,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
74 XtRBoolean, sizeof (Boolean),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
75 offset (menubar_p), XtRImmediate, (XtPointer) True },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
76 { XtNinitiallyUnmapped, XtCInitiallyUnmapped,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
77 XtRBoolean, sizeof (Boolean),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
78 offset (initially_unmapped), XtRImmediate, (XtPointer) False },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
79 { XtNminibuffer, XtCMinibuffer,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
80 XtRBoolean, sizeof (Boolean),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
81 offset (minibuffer), XtRImmediate, (XtPointer) True },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
82 { XtNunsplittable, XtCUnsplittable,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
83 XtRBoolean, sizeof (Boolean),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
84 offset (unsplittable), XtRImmediate, (XtPointer) False },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
85 { XtNinternalBorderWidth, XtCInternalBorderWidth,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
86 XtRInt, sizeof (int),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
87 offset (internal_border_width), XtRImmediate, (XtPointer)4 },
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 #ifdef HAVE_SCROLLBARS
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
89 { XtNscrollBarWidth, XtCScrollBarWidth,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
90 XtRInt, sizeof (int),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
91 offset (scrollbar_width), XtRImmediate, (XtPointer)-1 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
92 { XtNscrollBarHeight, XtCScrollBarHeight,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
93 XtRInt, sizeof (int),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
94 offset (scrollbar_height), XtRImmediate, (XtPointer)-1 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
95 { XtNscrollBarPlacement, XtCScrollBarPlacement,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
96 XtRScrollBarPlacement, sizeof (unsigned char),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
97 offset (scrollbar_placement), XtRImmediate,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98 #if defined (LWLIB_SCROLLBARS_MOTIF) || defined (LWLIB_SCROLLBARS_LUCID) || \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 defined (LWLIB_SCROLLBARS_ATHENA3D)
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
100 (XtPointer) XtBOTTOM_RIGHT
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101 #else
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
102 (XtPointer) XtBOTTOM_LEFT
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104 },
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105 #endif /* HAVE_SCROLLBARS */
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
106
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107 #ifdef HAVE_TOOLBARS
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
108 { XtNtopToolBarHeight, XtCTopToolBarHeight,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
109 XtRInt, sizeof (int),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
110 offset (top_toolbar_height), XtRImmediate, (XtPointer)-1 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
111 { XtNbottomToolBarHeight, XtCBottomToolBarHeight,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
112 XtRInt, sizeof (int),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
113 offset (bottom_toolbar_height), XtRImmediate, (XtPointer)-1 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
114 { XtNleftToolBarWidth, XtCLeftToolBarWidth,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
115 XtRInt, sizeof (int),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
116 offset (left_toolbar_width), XtRImmediate, (XtPointer)-1 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
117 { XtNrightToolBarWidth, XtCRightToolBarWidth,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
118 XtRInt, sizeof (int),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
119 offset (right_toolbar_width), XtRImmediate, (XtPointer)-1 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
120 { XtNtopToolBarBorderWidth, XtCTopToolBarBorderWidth,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
121 XtRInt, sizeof (int),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
122 offset (top_toolbar_border_width), XtRImmediate, (XtPointer)-1 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
123 { XtNbottomToolBarBorderWidth, XtCBottomToolBarBorderWidth,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
124 XtRInt, sizeof (int),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
125 offset (bottom_toolbar_border_width), XtRImmediate, (XtPointer)-1 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
126 { XtNleftToolBarBorderWidth, XtCLeftToolBarBorderWidth,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
127 XtRInt, sizeof (int),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
128 offset (left_toolbar_border_width), XtRImmediate, (XtPointer)-1 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
129 { XtNrightToolBarBorderWidth, XtCRightToolBarBorderWidth,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
130 XtRInt, sizeof (int),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
131 offset (right_toolbar_border_width), XtRImmediate, (XtPointer)-1 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
132 { XtNtopToolBarShadowColor, XtCTopToolBarShadowColor,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
133 XtRPixel, sizeof (Pixel),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
134 offset(top_toolbar_shadow_pixel), XtRString, (XtPointer) "#000000" },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
135 { XtNbottomToolBarShadowColor, XtCBottomToolBarShadowColor,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
136 XtRPixel, sizeof (Pixel),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
137 offset (bottom_toolbar_shadow_pixel), XtRString, (XtPointer) "#000000" },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
138 { XtNbackgroundToolBarColor, XtCBackgroundToolBarColor,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
139 XtRPixel, sizeof (Pixel),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
140 offset (background_toolbar_pixel), XtRImmediate, (XtPointer)-1 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
141 { XtNforegroundToolBarColor, XtCForegroundToolBarColor,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
142 XtRPixel, sizeof (Pixel),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
143 offset (foreground_toolbar_pixel), XtRImmediate, (XtPointer)-1 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
144 { XtNtopToolBarShadowPixmap, XtCTopToolBarShadowPixmap,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
145 XtRPixmap, sizeof (Pixmap),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
146 offset (top_toolbar_shadow_pixmap), XtRImmediate, (XtPointer)None },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
147 { XtNbottomToolBarShadowPixmap, XtCBottomToolBarShadowPixmap,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
148 XtRPixmap, sizeof (Pixmap),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
149 offset (bottom_toolbar_shadow_pixmap), XtRImmediate, (XtPointer)None },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
150 { XtNtoolBarShadowThickness, XtCToolBarShadowThickness,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
151 XtRDimension, sizeof (Dimension),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
152 offset (toolbar_shadow_thickness), XtRImmediate, (XtPointer)2 },
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
153 #endif /* HAVE_TOOLBARS */
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
154
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
155 { XtNinterline, XtCInterline,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
156 XtRInt, sizeof (int),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
157 offset (interline), XtRImmediate, (XtPointer)0 },
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
158 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
159 #ifdef I18N4
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
160 XtNfontSet, XtCFontSet,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
161 XtRFontSet, sizeof (XFontSet),
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
162 #else
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
163 XtNfont, XtCFont,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
164 XtRFontStruct, sizeof (XFontStruct *),
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
165 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
166 offset(font), XtRImmediate, (XtPointer)0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
167 },
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
168 { XtNforeground, XtCForeground,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
169 XtRPixel, sizeof (Pixel),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
170 offset(foreground_pixel), XtRString, (XtPointer) "Black" },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
171 { XtNbackground, XtCBackground,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
172 XtRPixel, sizeof (Pixel),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
173 offset(background_pixel), XtRString, (XtPointer) "Gray80" },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
174 { XtNcursorColor, XtCForeground,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
175 XtRPixel, sizeof (Pixel),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
176 offset(cursor_color), XtRString, (XtPointer) "XtDefaultForeground" },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
177 { XtNbarCursor, XtCBarCursor,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
178 XtRBoolean, sizeof (Boolean),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
179 offset (bar_cursor), XtRImmediate, (XtPointer)0 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
180 { XtNvisualBell, XtCVisualBell,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
181 XtRBoolean, sizeof (Boolean),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
182 offset (visual_bell), XtRImmediate, (XtPointer)0 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
183 { XtNbellVolume, XtCBellVolume,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
184 XtRInt, sizeof (int),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
185 offset (bell_volume), XtRImmediate, (XtPointer)0 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
186 { XtNuseBackingStore, XtCUseBackingStore,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
187 XtRBoolean, sizeof (Boolean),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
188 offset (use_backing_store), XtRImmediate, (XtPointer)0 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
189 { XtNpreferredWidth, XtCPreferredWidth,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
190 XtRDimension, sizeof (Dimension),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
191 offset (preferred_width), XtRImmediate, (XtPointer)0 },
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
192 { XtNpreferredHeight, XtCPreferredHeight,
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
193 XtRDimension, sizeof (Dimension),
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
194 offset (preferred_height), XtRImmediate, (XtPointer)0 },
428
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
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
197 #undef offset
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
198
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
199 /* Xt is stupid and dumb.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
200 Xt is stupid and dumb.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
201 Xt is stupid and dumb. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
202
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
203 static XtActionsRec
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
204 emacsFrameActionsTable [] = {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
205 {"mapping", (XtActionProc) emacs_Xt_mapping_action},
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
206 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
207
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
208 static char
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
209 emacsFrameTranslations [] = "\
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
210 <Mapping>: mapping()\n\
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
211 ";
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
212
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
213 /* If we're running under Motif, make this widget a subclass
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
214 of XmPrimitive. It's not clear this is necessary, but it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
215 may make focus behavior work better. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
216
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
217 EmacsFrameClassRec emacsFrameClassRec = {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
218 { /* core fields */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
219 #ifdef LWLIB_USES_MOTIF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
220 /* superclass */ (WidgetClass) &xmPrimitiveClassRec,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
221 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
222 /* superclass */ &widgetClassRec,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
223 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
224 /* class_name */ "EmacsFrame",
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
225 /* widget_size */ sizeof (EmacsFrameRec),
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
226 /* class_initialize */ EmacsFrameClassInitialize,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
227 /* class_part_initialize */ 0,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
228 /* class_inited */ FALSE,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
229 /* initialize */ EmacsFrameInitialize,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
230 /* initialize_hook */ 0,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
231 /* realize */ EmacsFrameRealize,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
232 /* actions */ emacsFrameActionsTable,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
233 /* num_actions */ XtNumber (emacsFrameActionsTable),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
234 /* resources */ resources,
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
235 /* resource_count */ XtNumber (resources),
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
236 /* xrm_class */ NULLQUARK,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
237 /* compress_motion */ TRUE,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
238 /* compress_exposure */ TRUE,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
239 /* compress_enterleave */ TRUE,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
240 /* visible_interest */ FALSE,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
241 /* destroy */ NULL,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
242 /* resize */ EmacsFrameResize,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
243 /* expose */ XtInheritExpose,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
244 /* set_values */ EmacsFrameSetValues,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
245 /* set_values_hook */ 0,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
246 /* set_values_almost */ XtInheritSetValuesAlmost,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
247 /* get_values_hook */ 0,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
248 /* accept_focus */ XtInheritAcceptFocus,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
249 /* version */ XtVersion,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
250 /* callback_private */ 0,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
251 /* tm_table */ emacsFrameTranslations,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
252 /* query_geometry */ EmacsFrameQueryGeometry,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
253 /* display_accelerator */ XtInheritDisplayAccelerator,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
254 /* extension */ 0
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 #ifdef LWLIB_USES_MOTIF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
257 { /* XmPrimitiveClassPart
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 (XtWidgetProc) _XtInherit, /* border_highlight */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
260 (XtWidgetProc) _XtInherit, /* border_unhighlight */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
261 /* Setting the following to NULL causes PrimitiveInitialize()
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
262 not to add traversal (TAB etc. to switch focus) and
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
263 focus-in/out (border highlight/unhighlight) translations.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
264 If you want those translations, use the value XtInheritTranslations
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
265 instead. Doing this, however, will interfere with Emacs
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
266 focus handling (which highlights/unhighlights the text cursor),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
267 and will lead to strange display results around the border of the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
268 widget. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
269 NULL, /* translations */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
270 NULL, /* arm_and_activate */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
271 NULL, /* get resources */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
272 0, /* num get_resources */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
273 NULL, /* extension */
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 #endif /* LWLIB_USES_MOTIF */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
276 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
277 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
278 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
279 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
280 WidgetClass emacsFrameClass = (WidgetClass) &emacsFrameClassRec;
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 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
283 update_various_frame_slots (EmacsFrame ew)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
284 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
285 ew->emacs_frame.frame->pixheight = ew->core.height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
286 ew->emacs_frame.frame->pixwidth = ew->core.width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
287 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
288
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
289 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
290 EmacsFrameInitialize (Widget request, Widget new,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
291 ArgList dum1, Cardinal *dum2)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
292 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
293 EmacsFrame ew = (EmacsFrame)new;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
294 struct frame *f = ew->emacs_frame.frame;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
295
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
296 if (!f)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
297 fatal ("can't create an emacs frame widget without a frame.");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
298
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
299 ew->emacs_frame.frame->internal_border_width =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
300 ew->emacs_frame.internal_border_width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
301 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
302
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
303 void emacs_Xt_event_handler (Widget wid /* unused */,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
304 XtPointer closure /* unused */,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
305 XEvent *event,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
306 Boolean *continue_to_dispatch /* unused */);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
307
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
308 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
309 EmacsFrameRealize (Widget widget, XtValueMask *mask,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
310 XSetWindowAttributes *attrs)
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 EmacsFrame ew = (EmacsFrame) widget;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
313 struct frame *f = ew->emacs_frame.frame;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
314 Widget shell_widget = FRAME_X_SHELL_WIDGET (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
315
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
316 attrs->event_mask =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
317 ExposureMask |
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
318 VisibilityChangeMask |
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
319 PropertyChangeMask |
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
320 StructureNotifyMask |
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
321 SubstructureNotifyMask |
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
322 /*SubstructureRedirectMask |*/ /* Only for WMs! */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
323 KeyPressMask |
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
324 KeyReleaseMask |
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
325 ButtonPressMask |
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
326 ButtonReleaseMask |
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
327 FocusChangeMask |
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
328 PointerMotionHintMask |
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
329 PointerMotionMask |
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
330 LeaveWindowMask |
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
331 EnterWindowMask;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
332
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
333
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
334 #ifdef I18N4
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
335 /* Make sure that events wanted by the input method are selected. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
336 attrs->event_mask |= input_method_event_mask;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
337 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
338
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
339 *mask |= CWEventMask;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
340
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
341 if (ew->emacs_frame.use_backing_store)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
342 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
343 attrs->backing_store = Always;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
344 *mask |= CWBackingStore;
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 XtCreateWindow (widget, InputOutput, (Visual *)CopyFromParent, *mask,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
347 attrs);
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 /* snarf the events we want. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
350 XtInsertEventHandler (widget, attrs->event_mask, TRUE,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
351 emacs_Xt_event_handler, NULL, XtListHead);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
352 /* some events (e.g. map-notify and WM_DELETE_WINDOW) get sent
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
353 directly to the shell, and the above event handler won't see
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
354 them. So add a handler to get them. These events don't
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
355 propagate, so there's no danger of them being seen twice. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
356 XtInsertEventHandler (shell_widget,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
357 EnterWindowMask | LeaveWindowMask |
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
358 VisibilityChangeMask | StructureNotifyMask |
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
359 KeyPressMask,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
360 TRUE, emacs_Xt_event_handler, NULL, XtListHead);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
361
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
362 #ifdef EXTERNAL_WIDGET
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
363 /* #### Not sure if this special case is necessary */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
364 if (!FRAME_X_EXTERNAL_WINDOW_P (f))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
365 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
366 /* 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
367 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
368 into emacs-land; also necessary so that you can still type chars
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
369 if the cursor is over the menubar or scrollbar. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
370 lw_set_keyboard_focus (shell_widget, FRAME_X_TEXT_WIDGET (f));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
371 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
372
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
373 /* DO NOT CALL THIS FUNCTION! Only Xt is supposed to do this. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
374
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
375 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
376 EmacsFrameResize (Widget widget)
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 EmacsFrame ew = (EmacsFrame)widget;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
379 struct frame *f = ew->emacs_frame.frame;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
380 int columns;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
381 int rows;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
382 XtWidgetGeometry req, repl;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
383
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
384 update_various_frame_slots (ew);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
385
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
386 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
387 change_frame_size (f, rows, columns, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
388
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
389 /* 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
390 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
391 of EmacsFrameSetCharSize(), this information will be stored twice.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
392 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
393 do anything until the next resize. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
394 if (FRAME_X_TOP_LEVEL_FRAME_P (f))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
395 x_wm_set_variable_size (FRAME_X_SHELL_WIDGET (f), columns, rows);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
396
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
397 /* Kick the manager so that it knows we've changed size. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
398 req.request_mode = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
399 XtQueryGeometry (FRAME_X_CONTAINER_WIDGET (f), &req, &repl);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
400 EmacsManagerChangeSize (FRAME_X_CONTAINER_WIDGET (f), repl.width,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
401 repl.height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
402 }
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 static Boolean
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
405 EmacsFrameSetValues (Widget cur_widget, Widget req_widget, Widget new_widget,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
406 ArgList argv, Cardinal *argc)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
407 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
408 EmacsFrame cur = (EmacsFrame) cur_widget;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
409 EmacsFrame new = (EmacsFrame) new_widget;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
410 struct frame *f = new->emacs_frame.frame;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
411 Lisp_Object frame;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
412
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
413 XSETFRAME (frame, f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
414 in_resource_setting++;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
415 /* This function does not need to do much. Pretty much everything
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
416 interesting will get done in the resize method, which will
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
417 (if necessary) get called by Xt when this function returns
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
418 (see below).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
419 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
420
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
421 /* #### This function will not work if it is not called from
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
422 update_EmacsFrame(), called from SET_FACE_PROPERTY().
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
423 The code located there should be moved inside of here instead,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
424 so that things work if either SET_FACE_PROPERTY() is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
425 called or XtSetValues() is called.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
426 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
427
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
428 if (cur->emacs_frame.iconic != new->emacs_frame.iconic &&
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
429 FRAME_X_TOP_LEVEL_FRAME_P (new->emacs_frame.frame))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
430 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
431 new->emacs_frame.iconic);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
432
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
433 /* 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
434 the EditRes protocol, so go ahead and change scrollbar-width
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
435 and scrollbar-height. Otherwise, we're merely mirroring
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
436 a change made to scrollbar-width etc. so don't do anything
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
437 special. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
438 if (cur->emacs_frame.internal_border_width !=
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
439 new->emacs_frame.internal_border_width)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
440 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
441 f->internal_border_width = new->emacs_frame.internal_border_width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
442 MARK_FRAME_SIZE_SLIPPED (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
443 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
444
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
445 #ifdef HAVE_SCROLLBARS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
446 if (cur->emacs_frame.scrollbar_width !=
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
447 new->emacs_frame.scrollbar_width)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
448 Fadd_spec_to_specifier
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
449 (Vscrollbar_width,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
450 make_int (new->emacs_frame.scrollbar_width),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
451 frame, Qnil, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
452 if (cur->emacs_frame.scrollbar_height !=
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
453 new->emacs_frame.scrollbar_height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
454 Fadd_spec_to_specifier
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
455 (Vscrollbar_height,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
456 make_int (new->emacs_frame.scrollbar_height),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
457 frame, Qnil, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
458 #endif /* HAVE_SCROLLBARS */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
459 #ifdef HAVE_TOOLBARS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
460 if (cur->emacs_frame.top_toolbar_height !=
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
461 new->emacs_frame.top_toolbar_height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
462 Fadd_spec_to_specifier
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
463 (Vtoolbar_size[TOP_TOOLBAR],
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
464 make_int (new->emacs_frame.top_toolbar_height),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
465 frame, Qnil, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
466 if (cur->emacs_frame.bottom_toolbar_height !=
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
467 new->emacs_frame.bottom_toolbar_height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
468 Fadd_spec_to_specifier
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
469 (Vtoolbar_size[BOTTOM_TOOLBAR],
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
470 make_int (new->emacs_frame.bottom_toolbar_height),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
471 frame, Qnil, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
472 if (cur->emacs_frame.left_toolbar_width !=
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
473 new->emacs_frame.left_toolbar_width)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
474 Fadd_spec_to_specifier
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
475 (Vtoolbar_size[LEFT_TOOLBAR],
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
476 make_int (new->emacs_frame.left_toolbar_width),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
477 frame, Qnil, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
478 if (cur->emacs_frame.right_toolbar_width !=
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
479 new->emacs_frame.right_toolbar_width)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
480 Fadd_spec_to_specifier
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
481 (Vtoolbar_size[RIGHT_TOOLBAR],
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
482 make_int (new->emacs_frame.right_toolbar_width),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
483 frame, Qnil, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
484 if (cur->emacs_frame.top_toolbar_border_width !=
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
485 new->emacs_frame.top_toolbar_border_width)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
486 Fadd_spec_to_specifier
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
487 (Vtoolbar_border_width[TOP_TOOLBAR],
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
488 make_int (new->emacs_frame.top_toolbar_border_width),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
489 frame, Qnil, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
490 if (cur->emacs_frame.bottom_toolbar_border_width !=
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
491 new->emacs_frame.bottom_toolbar_border_width)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
492 Fadd_spec_to_specifier
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
493 (Vtoolbar_border_width[BOTTOM_TOOLBAR],
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
494 make_int (new->emacs_frame.bottom_toolbar_border_width),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
495 frame, Qnil, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
496 if (cur->emacs_frame.left_toolbar_border_width !=
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
497 new->emacs_frame.left_toolbar_border_width)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
498 Fadd_spec_to_specifier
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
499 (Vtoolbar_border_width[LEFT_TOOLBAR],
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
500 make_int (new->emacs_frame.left_toolbar_border_width),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
501 frame, Qnil, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
502 if (cur->emacs_frame.right_toolbar_border_width !=
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
503 new->emacs_frame.right_toolbar_border_width)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
504 Fadd_spec_to_specifier
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
505 (Vtoolbar_border_width[RIGHT_TOOLBAR],
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
506 make_int (new->emacs_frame.right_toolbar_border_width),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
507 frame, Qnil, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
508 #endif /* HAVE_TOOLBARS */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
509
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
510 in_resource_setting--;
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 /* 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
513 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
514 request might be issued as a result of hiding/showing menubar or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
515 changing toolbar placement, where we rely on relayout made by the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
516 callback, we go ahead and simulate such a call */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
517 if (cur->core.width == new->core.width
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
518 && cur->core.height == new->core.height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
519 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
520 int i;
647
b39c14581166 [xemacs-hg @ 2001-08-13 04:45:47 by ben]
ben
parents: 440
diff changeset
521 for (i = 0; i < (int) *argc; i++)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
522 if (strcmp (argv[i].name, XtNwidth) == 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
523 || strcmp (argv[i].name, XtNheight) == 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
524 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
525 EmacsFrameResize (new_widget);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
526 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
527 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
528 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
529
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
530 return False;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
531
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
532 /* 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
533 height has changed, an Expose event will be generated. The Xt
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
534 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
535 changed, because then two Expose events will be generated.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
536
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
537 In any case, there is no need to return True because
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
538 SET_FACE_PROPERTY(), which does the resource
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
539 setting, automatically forces a redisplay as necessary. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
540 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
541
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
542 static XtGeometryResult
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
543 EmacsFrameQueryGeometry (Widget widget, XtWidgetGeometry *request,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
544 XtWidgetGeometry *result)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
545 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
546 EmacsFrame ew = (EmacsFrame) widget;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
547 int mask = request->request_mode;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
548 Dimension width, height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
549 int ok_width_int, ok_height_int;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
550 Dimension ok_width, ok_height;
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 /* We have a definite preference for what size we would like
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
553 to be.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
554
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
555 1) If a preferred size was specified for us, use it.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
556 (This is not currently used)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
557 2) If a proposed size was given, round it to the nearest
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
558 multiple of the default char size and return it.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
559 3) Otherwise, take our current size and round it to the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
560 nearest multiple of the default char size. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
561
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
562 width = mask & CWWidth ? request->width : ew->core.width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
563 height = mask & CWHeight ? request->height : ew->core.height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
564 round_size_to_char (ew->emacs_frame.frame, width, height,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
565 &ok_width_int, &ok_height_int);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
566 ok_width = (Dimension) ok_width_int;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
567 ok_height = (Dimension) ok_height_int;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
568 if (ew->emacs_frame.preferred_width)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
569 ok_width = ew->emacs_frame.preferred_width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
570 if (ew->emacs_frame.preferred_height)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
571 ok_height = ew->emacs_frame.preferred_height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
572 result->request_mode |= CWWidth | CWHeight;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
573 result->width = ok_width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
574 result->height = ok_height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
575 if (((mask & CWWidth) && ok_width != request->width)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
576 || ((mask & CWHeight) && ok_height != request->height))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
577 return XtGeometryAlmost;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
578 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
579 return XtGeometryYes;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
580 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
581
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
582 /* Xt string-to-scrollbar-placement converter */
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
583 /* #### Convert this to a `new-style' converter (See XtAddTypeConverter) */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
584
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
585 /* This variable cannot be a stack variable. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
586 static unsigned char cvt_string_scrollbar_placement;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
587
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
588 /* ARGSUSED */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
589 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
590 Xt_StringToScrollBarPlacement (XrmValuePtr args, /* unused */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
591 Cardinal *num_args, /* unused */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
592 XrmValuePtr fromVal,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
593 XrmValuePtr toVal)
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 XrmQuark q;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
596 char *lowerName = (char *) alloca (strlen ((char *) fromVal->addr) + 1);
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 XmuCopyISOLatin1Lowered (lowerName, (char *) fromVal->addr);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
599 q = XrmStringToQuark (lowerName);
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 toVal->size = sizeof (cvt_string_scrollbar_placement);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
602 toVal->addr = (XPointer) &cvt_string_scrollbar_placement;
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 if (q == XrmStringToQuark ("top-left")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
605 || q == XrmStringToQuark ("top_left"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
606 cvt_string_scrollbar_placement = XtTOP_LEFT;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
607 else if (q == XrmStringToQuark ("bottom-left")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
608 || q == XrmStringToQuark ("bottom_left"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
609 cvt_string_scrollbar_placement = XtBOTTOM_LEFT;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
610 else if (q == XrmStringToQuark ("top-right")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
611 || q == XrmStringToQuark ("top_right"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
612 cvt_string_scrollbar_placement = XtTOP_RIGHT;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
613 else if (q == XrmStringToQuark ("bottom-right")
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
614 || q == XrmStringToQuark ("bottom_right"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
615 cvt_string_scrollbar_placement = XtBOTTOM_RIGHT;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
616 else
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 XtStringConversionWarning (fromVal->addr, "scrollBarPlacement");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
619 toVal->addr = NULL;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
620 toVal->size = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
621 }
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
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
624 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
625 EmacsFrameClassInitialize (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
626 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
627 XtAddConverter (XtRString, XtRScrollBarPlacement,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
628 Xt_StringToScrollBarPlacement, NULL, 0);
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
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
631 /********************* Special entrypoints *******************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
632
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
633 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
634 EmacsFrameRecomputeCellSize (Widget w)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
635 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
636 EmacsFrame ew = (EmacsFrame) w;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
637 int cw, ch;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
638 struct frame *f = ew->emacs_frame.frame;
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 if (! XtIsSubclass (w, emacsFrameClass))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
641 abort ();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
642
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
643 default_face_height_and_width (make_frame (f), &ch, &cw);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
644 if (FRAME_X_TOP_LEVEL_FRAME_P (f))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
645 x_wm_set_cell_size (FRAME_X_SHELL_WIDGET (f), cw, ch);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
646 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
647
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
648 /* 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
649 specified. This both causes the X window to change and the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
650 internal frame structures to get modified to match. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
651
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
652 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
653 EmacsFrameSetCharSize (Widget widget, int columns, int rows)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
654 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
655 EmacsFrame ew = (EmacsFrame) widget;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
656 int pixel_width, pixel_height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
657 struct frame *f = ew->emacs_frame.frame;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
658
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
659 if (columns < 3)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
660 columns = 3; /* no way buddy */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
661 if (rows < 1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
662 rows = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
663
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
664 char_to_pixel_size (f, columns, rows, &pixel_width, &pixel_height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
665
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
666 if (FRAME_X_TOP_LEVEL_FRAME_P (f))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
667 x_wm_set_variable_size (FRAME_X_SHELL_WIDGET (f), columns, rows);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
668
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
669 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
670 Arg al [2];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
671 XtSetArg (al [0], XtNwidth, pixel_width);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
672 XtSetArg (al [1], XtNheight, pixel_height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
673 XtSetValues ((Widget) ew, al, countof (al));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
674 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
675 }