Mercurial > hg > xemacs-beta
annotate src/EmacsFrame.c @ 4539:061e030e3270
Fix some bugs in load-history construction, built-in symbol file names.
lib-src/ChangeLog addition:
2008-12-27 Aidan Kehoe <kehoea@parhasard.net>
* make-docfile.c (main): Allow more than one -d argument, followed
by a directory to change to.
(put_filename): Don't strip directory information; with previous
change, allows retrieval of Lisp function and variable origin
files from #'built-in-symbol-file relative to lisp-directory.
(scan_lisp_file): Don't add an extraneous newline after the file
name, put_filename has added the newline already.
lisp/ChangeLog addition:
2008-12-27 Aidan Kehoe <kehoea@parhasard.net>
* loadup.el (load-history):
Add the contents of current-load-list to load-history before
clearing it. Move the variable declarations earlier in the file to
a format understood by make-docfile.c.
* custom.el (custom-declare-variable): Add the variable's symbol
to the current file's load history entry correctly, don't use a
cons. Eliminate a comment that we don't need to worry about, we
don't need to check the `initialized' C variable in Lisp.
* bytecomp.el (byte-compile-output-file-form):
Merge Andreas Schwab's pre-GPLv3 GNU change of 19970831 here;
treat #'custom-declare-variable correctly, generating the
docstrings in a format understood by make-docfile.c.
* loadhist.el (symbol-file): Correct behaviour for checking
autoloaded macros and functions when supplied with a TYPE
argument. Accept fully-qualified paths from
#'built-in-symbol-file; if a path is not fully-qualified, return
it relative to lisp-directory if the filename corresponds to a
Lisp file, and relative to (concat source-directory "/src/")
otherwise.
* make-docfile.el (preloaded-file-list):
Rationalise some let bindings a little. Use the "-d" argument to
make-docfile.c to supply Lisp paths relative to lisp-directory,
not absolutely. Add in loadup.el explicitly to the list of files
to be processed by make-docfile.c--it doesn't make sense to add it
to preloaded-file-list, since that is used for purposes of
byte-compilation too.
src/ChangeLog addition:
2008-12-27 Aidan Kehoe <kehoea@parhasard.net>
* doc.c (Fbuilt_in_symbol_file):
Return a subr's filename immediately if we've found it. Check for
compiled function and compiled macro docstrings in DOC too, and
return them if they exist.
The branch of the if statement focused on functions may have
executed, but we may still want to check variable bindings; an
else clause isn't appropriate.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Sat, 27 Dec 2008 14:05:50 +0000 |
parents | 726060ee587c |
children | 5460287a3327 |
rev | line source |
---|---|
428 | 1 /* The emacs frame widget. |
2 Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation, Inc. | |
3 Copyright (C) 1993-1995 Sun Microsystems, Inc. | |
4 Copyright (C) 1995 Ben Wing. | |
5 | |
6 This file is part of XEmacs. | |
7 | |
8 XEmacs is free software; you can redistribute it and/or modify it | |
9 under the terms of the GNU General Public License as published by the | |
10 Free Software Foundation; either version 2, or (at your option) any | |
11 later version. | |
12 | |
13 XEmacs is distributed in the hope that it will be useful, but WITHOUT | |
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
19 along with XEmacs; see the file COPYING. If not, write to | |
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
21 Boston, MA 02111-1307, USA. */ | |
22 | |
23 /* Synched up with: Not in FSF. */ | |
24 | |
25 /* #### Note to potential hackers: Don't mess with this unless you're | |
26 sure you know what you're doing! Xt is a lot more subtle than | |
27 you may think. */ | |
28 | |
29 #include <config.h> | |
30 #include "lisp.h" | |
31 | |
872 | 32 #include "device-impl.h" |
800 | 33 #include "faces.h" |
872 | 34 #include "frame-impl.h" |
800 | 35 #include "toolbar.h" |
36 #include "window.h" | |
37 | |
872 | 38 #include "console-x-impl.h" |
428 | 39 #include "glyphs-x.h" |
40 #include "objects-x.h" | |
800 | 41 |
428 | 42 #include <X11/Shell.h> |
43 #include "EmacsFrameP.h" | |
44 #include "EmacsManager.h" /* for EmacsManagerChangeSize */ | |
45 #include "xmu.h" | |
4528
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
46 #include "../lwlib/xt-wrappers.h" |
428 | 47 |
48 static void EmacsFrameClassInitialize (void); | |
49 static void EmacsFrameInitialize (Widget, Widget, ArgList, Cardinal *); | |
50 static void EmacsFrameRealize (Widget, XtValueMask*, XSetWindowAttributes*); | |
51 static void EmacsFrameResize (Widget widget); | |
52 static Boolean EmacsFrameSetValues (Widget, Widget, Widget, | |
53 ArgList, Cardinal *); | |
54 static XtGeometryResult EmacsFrameQueryGeometry (Widget, XtWidgetGeometry*, | |
55 XtWidgetGeometry*); | |
56 | |
57 extern void | |
58 emacs_Xt_mapping_action (Widget w, XEvent* event); | |
59 | |
60 #undef XtOffset | |
61 #define XtOffset(p_type,field) \ | |
62 ((Cardinal) (((char *) (&(((p_type)0)->field))) - ((char *)0))) | |
440 | 63 #define offset(field) XtOffset (EmacsFrame, emacs_frame.field) |
4528
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
64 #define res(name,_class,intrepr,type,member,extrepr,value) \ |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
65 Xt_RESOURCE (name, _class, intrepr, type, offset(member), extrepr, value) |
428 | 66 static XtResource resources[] = { |
4528
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
67 res (XtNgeometry, XtCGeometry, XtRString, String, geometry, XtRString, 0), |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
68 res (XtNiconic, XtCIconic, XtRBoolean, Boolean, iconic, XtRImmediate, False), |
428 | 69 |
4528
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
70 res (XtNemacsFrame, XtCEmacsFrame, XtRPointer, XtPointer, |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
71 frame, XtRImmediate, 0), |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
72 res (XtNmenubar, XtCMenubar, XtRBoolean, Boolean, |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
73 menubar_p, XtRImmediate, True), |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
74 res (XtNinitiallyUnmapped, XtCInitiallyUnmapped, XtRBoolean, Boolean, |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
75 initially_unmapped, XtRImmediate, False), |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
76 res (XtNminibuffer, XtCMinibuffer, XtRBoolean, Boolean, |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
77 minibuffer, XtRImmediate, True), |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
78 res (XtNunsplittable, XtCUnsplittable, XtRBoolean, Boolean, |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
79 unsplittable, XtRImmediate, False), |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
80 res (XtNinternalBorderWidth, XtCInternalBorderWidth, XtRInt, int, |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
81 internal_border_width, XtRImmediate, 4), |
428 | 82 #ifdef HAVE_SCROLLBARS |
4528
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
83 res (XtNscrollBarWidth, XtCScrollBarWidth, XtRInt, int, |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
84 scrollbar_width, XtRImmediate, -1), |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
85 res (XtNscrollBarHeight, XtCScrollBarHeight, XtRInt, int, |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
86 scrollbar_height, XtRImmediate, -1), |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
87 res (XtNscrollBarPlacement, XtCScrollBarPlacement, XtRScrollBarPlacement, |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
88 unsigned char, scrollbar_placement, XtRImmediate, |
428 | 89 #if defined (LWLIB_SCROLLBARS_MOTIF) || defined (LWLIB_SCROLLBARS_LUCID) || \ |
90 defined (LWLIB_SCROLLBARS_ATHENA3D) | |
4528
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
91 XtBOTTOM_RIGHT |
428 | 92 #else |
4528
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
93 XtBOTTOM_LEFT |
428 | 94 #endif |
4528
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
95 ), |
428 | 96 #endif /* HAVE_SCROLLBARS */ |
440 | 97 |
428 | 98 #ifdef HAVE_TOOLBARS |
4528
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
99 res (XtNtopToolBarHeight, XtCTopToolBarHeight, XtRInt, int, |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
100 top_toolbar_height, XtRImmediate, -1), |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
101 res (XtNbottomToolBarHeight, XtCBottomToolBarHeight, XtRInt, int, |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
102 bottom_toolbar_height, XtRImmediate, -1), |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
103 res (XtNleftToolBarWidth, XtCLeftToolBarWidth, XtRInt, int, |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
104 left_toolbar_width, XtRImmediate, -1), |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
105 res (XtNrightToolBarWidth, XtCRightToolBarWidth, XtRInt, int, |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
106 right_toolbar_width, XtRImmediate, -1), |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
107 res (XtNtopToolBarBorderWidth, XtCTopToolBarBorderWidth, XtRInt, int, |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
108 top_toolbar_border_width, XtRImmediate, -1), |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
109 res (XtNbottomToolBarBorderWidth, XtCBottomToolBarBorderWidth, XtRInt, int, |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
110 bottom_toolbar_border_width, XtRImmediate, -1), |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
111 res (XtNleftToolBarBorderWidth, XtCLeftToolBarBorderWidth, XtRInt, |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
112 int, left_toolbar_border_width, XtRImmediate, -1), |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
113 res (XtNrightToolBarBorderWidth, XtCRightToolBarBorderWidth, XtRInt, |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
114 int, right_toolbar_border_width, XtRImmediate, -1), |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
115 res (XtNtoolBarShadowThickness, XtCToolBarShadowThickness, XtRDimension, |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
116 Dimension, toolbar_shadow_thickness, XtRImmediate, 2), |
428 | 117 #endif /* HAVE_TOOLBARS */ |
440 | 118 |
4528
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
119 res (XtNinterline, XtCInterline, XtRInt, int, |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
120 interline, XtRImmediate, 0), |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
121 res (XtNfont, XtCFont, XtRFontStruct, XFontStruct *, |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
122 font, XtRImmediate, 0), |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
123 res (XtNforeground, XtCForeground, XtRPixel, Pixel, |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
124 foreground_pixel, XtRString, "Black"), |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
125 res (XtNbackground, XtCBackground, XtRPixel, Pixel, |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
126 background_pixel, XtRString, "Gray80"), |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
127 res (XtNcursorColor, XtCForeground, XtRPixel, Pixel, |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
128 cursor_color, XtRString, "XtDefaultForeground"), |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
129 res (XtNbarCursor, XtCBarCursor, XtRBoolean, Boolean, |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
130 bar_cursor, XtRImmediate, 0), |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
131 res (XtNvisualBell, XtCVisualBell, XtRBoolean, Boolean, |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
132 visual_bell, XtRImmediate, 0), |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
133 res (XtNbellVolume, XtCBellVolume, XtRInt, int, |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
134 bell_volume, XtRImmediate, 0), |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
135 res (XtNuseBackingStore, XtCUseBackingStore, XtRBoolean, Boolean, |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
136 use_backing_store, XtRImmediate, 0), |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
137 res (XtNpreferredWidth, XtCPreferredWidth, XtRDimension, Dimension, |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
138 preferred_width, XtRImmediate, 0), |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
139 res (XtNpreferredHeight, XtCPreferredHeight, XtRDimension, Dimension, |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
140 preferred_height, XtRImmediate, 0), |
428 | 141 }; |
142 | |
143 #undef offset | |
144 | |
145 /* Xt is stupid and dumb. | |
146 Xt is stupid and dumb. | |
147 Xt is stupid and dumb. */ | |
148 | |
149 static XtActionsRec | |
150 emacsFrameActionsTable [] = { | |
4528
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
151 { (String) "mapping", (XtActionProc) emacs_Xt_mapping_action}, |
428 | 152 }; |
153 | |
154 static char | |
155 emacsFrameTranslations [] = "\ | |
156 <Mapping>: mapping()\n\ | |
157 "; | |
158 | |
159 /* If we're running under Motif, make this widget a subclass | |
160 of XmPrimitive. It's not clear this is necessary, but it | |
161 may make focus behavior work better. */ | |
162 | |
163 EmacsFrameClassRec emacsFrameClassRec = { | |
164 { /* core fields */ | |
165 #ifdef LWLIB_USES_MOTIF | |
166 /* superclass */ (WidgetClass) &xmPrimitiveClassRec, | |
167 #else | |
168 /* superclass */ &widgetClassRec, | |
169 #endif | |
4528
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
170 /* class_name */ (String) "EmacsFrame", |
440 | 171 /* widget_size */ sizeof (EmacsFrameRec), |
428 | 172 /* class_initialize */ EmacsFrameClassInitialize, |
173 /* class_part_initialize */ 0, | |
174 /* class_inited */ FALSE, | |
175 /* initialize */ EmacsFrameInitialize, | |
176 /* initialize_hook */ 0, | |
177 /* realize */ EmacsFrameRealize, | |
178 /* actions */ emacsFrameActionsTable, | |
179 /* num_actions */ XtNumber (emacsFrameActionsTable), | |
180 /* resources */ resources, | |
440 | 181 /* resource_count */ XtNumber (resources), |
428 | 182 /* xrm_class */ NULLQUARK, |
183 /* compress_motion */ TRUE, | |
184 /* compress_exposure */ TRUE, | |
185 /* compress_enterleave */ TRUE, | |
186 /* visible_interest */ FALSE, | |
187 /* destroy */ NULL, | |
188 /* resize */ EmacsFrameResize, | |
189 /* expose */ XtInheritExpose, | |
190 /* set_values */ EmacsFrameSetValues, | |
191 /* set_values_hook */ 0, | |
192 /* set_values_almost */ XtInheritSetValuesAlmost, | |
193 /* get_values_hook */ 0, | |
194 /* accept_focus */ XtInheritAcceptFocus, | |
195 /* version */ XtVersion, | |
196 /* callback_private */ 0, | |
197 /* tm_table */ emacsFrameTranslations, | |
198 /* query_geometry */ EmacsFrameQueryGeometry, | |
199 /* display_accelerator */ XtInheritDisplayAccelerator, | |
200 /* extension */ 0 | |
201 }, | |
202 #ifdef LWLIB_USES_MOTIF | |
203 { /* XmPrimitiveClassPart | |
204 */ | |
205 (XtWidgetProc) _XtInherit, /* border_highlight */ | |
206 (XtWidgetProc) _XtInherit, /* border_unhighlight */ | |
207 /* Setting the following to NULL causes PrimitiveInitialize() | |
208 not to add traversal (TAB etc. to switch focus) and | |
209 focus-in/out (border highlight/unhighlight) translations. | |
210 If you want those translations, use the value XtInheritTranslations | |
211 instead. Doing this, however, will interfere with Emacs | |
212 focus handling (which highlights/unhighlights the text cursor), | |
213 and will lead to strange display results around the border of the | |
214 widget. */ | |
215 NULL, /* translations */ | |
216 NULL, /* arm_and_activate */ | |
217 NULL, /* get resources */ | |
218 0, /* num get_resources */ | |
219 NULL, /* extension */ | |
220 }, | |
221 #endif /* LWLIB_USES_MOTIF */ | |
222 { | |
223 0 | |
224 } | |
225 }; | |
226 WidgetClass emacsFrameClass = (WidgetClass) &emacsFrameClassRec; | |
227 | |
228 static void | |
229 update_various_frame_slots (EmacsFrame ew) | |
230 { | |
231 ew->emacs_frame.frame->pixheight = ew->core.height; | |
232 ew->emacs_frame.frame->pixwidth = ew->core.width; | |
233 } | |
234 | |
235 static void | |
3025 | 236 EmacsFrameInitialize (Widget UNUSED (request), Widget new_, |
2286 | 237 ArgList UNUSED (unused1), Cardinal *UNUSED (unused2)) |
428 | 238 { |
3025 | 239 EmacsFrame ew = (EmacsFrame)new_; |
428 | 240 struct frame *f = ew->emacs_frame.frame; |
241 | |
242 if (!f) | |
243 fatal ("can't create an emacs frame widget without a frame."); | |
244 | |
245 ew->emacs_frame.frame->internal_border_width = | |
246 ew->emacs_frame.internal_border_width; | |
247 } | |
248 | |
249 void emacs_Xt_event_handler (Widget wid /* unused */, | |
250 XtPointer closure /* unused */, | |
251 XEvent *event, | |
252 Boolean *continue_to_dispatch /* unused */); | |
253 | |
254 static void | |
255 EmacsFrameRealize (Widget widget, XtValueMask *mask, | |
256 XSetWindowAttributes *attrs) | |
257 { | |
258 EmacsFrame ew = (EmacsFrame) widget; | |
259 struct frame *f = ew->emacs_frame.frame; | |
260 Widget shell_widget = FRAME_X_SHELL_WIDGET (f); | |
261 | |
262 attrs->event_mask = | |
263 ExposureMask | | |
264 VisibilityChangeMask | | |
265 PropertyChangeMask | | |
266 StructureNotifyMask | | |
267 SubstructureNotifyMask | | |
268 /*SubstructureRedirectMask |*/ /* Only for WMs! */ | |
269 KeyPressMask | | |
270 KeyReleaseMask | | |
271 ButtonPressMask | | |
272 ButtonReleaseMask | | |
273 FocusChangeMask | | |
274 PointerMotionHintMask | | |
275 PointerMotionMask | | |
276 LeaveWindowMask | | |
277 EnterWindowMask; | |
278 | |
279 | |
280 *mask |= CWEventMask; | |
281 | |
282 if (ew->emacs_frame.use_backing_store) | |
283 { | |
284 attrs->backing_store = Always; | |
285 *mask |= CWBackingStore; | |
286 } | |
287 XtCreateWindow (widget, InputOutput, (Visual *)CopyFromParent, *mask, | |
288 attrs); | |
289 | |
290 /* snarf the events we want. */ | |
291 XtInsertEventHandler (widget, attrs->event_mask, TRUE, | |
292 emacs_Xt_event_handler, NULL, XtListHead); | |
293 /* some events (e.g. map-notify and WM_DELETE_WINDOW) get sent | |
294 directly to the shell, and the above event handler won't see | |
295 them. So add a handler to get them. These events don't | |
296 propagate, so there's no danger of them being seen twice. */ | |
297 XtInsertEventHandler (shell_widget, | |
298 EnterWindowMask | LeaveWindowMask | | |
299 VisibilityChangeMask | StructureNotifyMask | | |
300 KeyPressMask, | |
301 TRUE, emacs_Xt_event_handler, NULL, XtListHead); | |
302 | |
303 #ifdef EXTERNAL_WIDGET | |
304 /* #### Not sure if this special case is necessary */ | |
305 if (!FRAME_X_EXTERNAL_WINDOW_P (f)) | |
306 #endif | |
307 /* This is necessary under Motif in order to make it possible to click in | |
308 a buffer and move focus out of a dialog box or control panel and back | |
309 into emacs-land; also necessary so that you can still type chars | |
310 if the cursor is over the menubar or scrollbar. */ | |
311 lw_set_keyboard_focus (shell_widget, FRAME_X_TEXT_WIDGET (f)); | |
312 } | |
313 | |
314 /* DO NOT CALL THIS FUNCTION! Only Xt is supposed to do this. */ | |
315 | |
316 static void | |
317 EmacsFrameResize (Widget widget) | |
318 { | |
319 EmacsFrame ew = (EmacsFrame)widget; | |
320 struct frame *f = ew->emacs_frame.frame; | |
321 int columns; | |
322 int rows; | |
323 XtWidgetGeometry req, repl; | |
324 | |
325 update_various_frame_slots (ew); | |
326 | |
327 pixel_to_char_size (f, ew->core.width, ew->core.height, &columns, &rows); | |
328 change_frame_size (f, rows, columns, 0); | |
329 | |
3381 | 330 /* The code below is just plain wrong. If the EmacsShell or EmacsManager |
331 needs to know, they should just ask. If needed information is being | |
332 updated here, then we should set a dirty flag and have it updated on an | |
333 as-needed basis. | |
334 For now, conditionalize so people can get work done if this breaks | |
335 something. */ | |
336 if (wedge_metacity) /* cf. x_set_frame_size */ | |
337 { | |
338 /* Now we tell the EmacsShell that we've changed the size of the | |
339 non-fixed portion of the frame. Note that, if the resize occurred | |
340 as a result of EmacsFrameSetCharSize(), this information will be | |
341 stored twice. This is not a big deal, as storing this information | |
342 doesn't actually do anything until the next resize. */ | |
343 if (FRAME_X_TOP_LEVEL_FRAME_P (f)) | |
344 x_wm_set_variable_size (FRAME_X_SHELL_WIDGET (f), columns, rows); | |
428 | 345 |
3381 | 346 /* Kick the manager so that it knows we've changed size. |
347 #### No, no, no! If this does anything at all, it will involve | |
348 changing the manager's size. That's not something that a child | |
349 widget should initialize as part of a purely informational | |
350 method!! */ | |
351 req.request_mode = 0; | |
352 XtQueryGeometry (FRAME_X_CONTAINER_WIDGET (f), &req, &repl); | |
353 EmacsManagerChangeSize (FRAME_X_CONTAINER_WIDGET (f), | |
354 repl.width, repl.height); | |
355 } | |
428 | 356 } |
357 | |
358 static Boolean | |
2286 | 359 EmacsFrameSetValues (Widget cur_widget, Widget UNUSED (req_widget), |
360 Widget new_widget, ArgList argv, Cardinal *argc) | |
428 | 361 { |
362 EmacsFrame cur = (EmacsFrame) cur_widget; | |
3025 | 363 EmacsFrame new_ = (EmacsFrame) new_widget; |
364 struct frame *f = new_->emacs_frame.frame; | |
428 | 365 in_resource_setting++; |
366 /* This function does not need to do much. Pretty much everything | |
367 interesting will get done in the resize method, which will | |
368 (if necessary) get called by Xt when this function returns | |
369 (see below). | |
370 */ | |
371 | |
372 /* #### This function will not work if it is not called from | |
373 update_EmacsFrame(), called from SET_FACE_PROPERTY(). | |
374 The code located there should be moved inside of here instead, | |
375 so that things work if either SET_FACE_PROPERTY() is | |
376 called or XtSetValues() is called. | |
377 */ | |
378 | |
3025 | 379 if (cur->emacs_frame.iconic != new_->emacs_frame.iconic && |
380 FRAME_X_TOP_LEVEL_FRAME_P (new_->emacs_frame.frame)) | |
381 x_wm_set_shell_iconic_p (FRAME_X_SHELL_WIDGET (new_->emacs_frame.frame), | |
382 new_->emacs_frame.iconic); | |
428 | 383 |
384 /* If we got here, then we were likely called as a result of | |
385 the EditRes protocol, so go ahead and change scrollbar-width | |
386 and scrollbar-height. Otherwise, we're merely mirroring | |
387 a change made to scrollbar-width etc. so don't do anything | |
388 special. */ | |
389 if (cur->emacs_frame.internal_border_width != | |
3025 | 390 new_->emacs_frame.internal_border_width) |
428 | 391 { |
3025 | 392 f->internal_border_width = new_->emacs_frame.internal_border_width; |
428 | 393 MARK_FRAME_SIZE_SLIPPED (f); |
394 } | |
395 | |
396 #ifdef HAVE_SCROLLBARS | |
397 if (cur->emacs_frame.scrollbar_width != | |
3025 | 398 new_->emacs_frame.scrollbar_width) |
428 | 399 Fadd_spec_to_specifier |
400 (Vscrollbar_width, | |
3025 | 401 make_int (new_->emacs_frame.scrollbar_width), |
872 | 402 wrap_frame (f), Qnil, Qnil); |
428 | 403 if (cur->emacs_frame.scrollbar_height != |
3025 | 404 new_->emacs_frame.scrollbar_height) |
428 | 405 Fadd_spec_to_specifier |
406 (Vscrollbar_height, | |
3025 | 407 make_int (new_->emacs_frame.scrollbar_height), |
872 | 408 wrap_frame (f), Qnil, Qnil); |
428 | 409 #endif /* HAVE_SCROLLBARS */ |
410 #ifdef HAVE_TOOLBARS | |
411 if (cur->emacs_frame.top_toolbar_height != | |
3025 | 412 new_->emacs_frame.top_toolbar_height) |
428 | 413 Fadd_spec_to_specifier |
414 (Vtoolbar_size[TOP_TOOLBAR], | |
3025 | 415 make_int (new_->emacs_frame.top_toolbar_height), |
872 | 416 wrap_frame (f), Qnil, Qnil); |
428 | 417 if (cur->emacs_frame.bottom_toolbar_height != |
3025 | 418 new_->emacs_frame.bottom_toolbar_height) |
428 | 419 Fadd_spec_to_specifier |
420 (Vtoolbar_size[BOTTOM_TOOLBAR], | |
3025 | 421 make_int (new_->emacs_frame.bottom_toolbar_height), |
872 | 422 wrap_frame (f), Qnil, Qnil); |
428 | 423 if (cur->emacs_frame.left_toolbar_width != |
3025 | 424 new_->emacs_frame.left_toolbar_width) |
428 | 425 Fadd_spec_to_specifier |
426 (Vtoolbar_size[LEFT_TOOLBAR], | |
3025 | 427 make_int (new_->emacs_frame.left_toolbar_width), |
872 | 428 wrap_frame (f), Qnil, Qnil); |
428 | 429 if (cur->emacs_frame.right_toolbar_width != |
3025 | 430 new_->emacs_frame.right_toolbar_width) |
428 | 431 Fadd_spec_to_specifier |
432 (Vtoolbar_size[RIGHT_TOOLBAR], | |
3025 | 433 make_int (new_->emacs_frame.right_toolbar_width), |
872 | 434 wrap_frame (f), Qnil, Qnil); |
428 | 435 if (cur->emacs_frame.top_toolbar_border_width != |
3025 | 436 new_->emacs_frame.top_toolbar_border_width) |
428 | 437 Fadd_spec_to_specifier |
438 (Vtoolbar_border_width[TOP_TOOLBAR], | |
3025 | 439 make_int (new_->emacs_frame.top_toolbar_border_width), |
872 | 440 wrap_frame (f), Qnil, Qnil); |
428 | 441 if (cur->emacs_frame.bottom_toolbar_border_width != |
3025 | 442 new_->emacs_frame.bottom_toolbar_border_width) |
428 | 443 Fadd_spec_to_specifier |
444 (Vtoolbar_border_width[BOTTOM_TOOLBAR], | |
3025 | 445 make_int (new_->emacs_frame.bottom_toolbar_border_width), |
872 | 446 wrap_frame (f), Qnil, Qnil); |
428 | 447 if (cur->emacs_frame.left_toolbar_border_width != |
3025 | 448 new_->emacs_frame.left_toolbar_border_width) |
428 | 449 Fadd_spec_to_specifier |
450 (Vtoolbar_border_width[LEFT_TOOLBAR], | |
3025 | 451 make_int (new_->emacs_frame.left_toolbar_border_width), |
872 | 452 wrap_frame (f), Qnil, Qnil); |
428 | 453 if (cur->emacs_frame.right_toolbar_border_width != |
3025 | 454 new_->emacs_frame.right_toolbar_border_width) |
428 | 455 Fadd_spec_to_specifier |
456 (Vtoolbar_border_width[RIGHT_TOOLBAR], | |
3025 | 457 make_int (new_->emacs_frame.right_toolbar_border_width), |
872 | 458 wrap_frame (f), Qnil, Qnil); |
428 | 459 #endif /* HAVE_TOOLBARS */ |
460 | |
461 in_resource_setting--; | |
462 | |
463 /* If the request was to resize us, but the size has not changed, Xt | |
464 will do nothing, and won't call our resize callback. Since such a | |
465 request might be issued as a result of hiding/showing menubar or | |
466 changing toolbar placement, where we rely on relayout made by the | |
467 callback, we go ahead and simulate such a call */ | |
3025 | 468 if (cur->core.width == new_->core.width |
469 && cur->core.height == new_->core.height) | |
428 | 470 { |
471 int i; | |
647 | 472 for (i = 0; i < (int) *argc; i++) |
428 | 473 if (strcmp (argv[i].name, XtNwidth) == 0 |
474 || strcmp (argv[i].name, XtNheight) == 0) | |
475 { | |
476 EmacsFrameResize (new_widget); | |
477 break; | |
478 } | |
479 } | |
480 | |
481 return False; | |
482 | |
483 /* Note that if either (a) we return True, or (b) the width or | |
484 height has changed, an Expose event will be generated. The Xt | |
485 manual says you should not return True if the width or height has | |
486 changed, because then two Expose events will be generated. | |
487 | |
488 In any case, there is no need to return True because | |
489 SET_FACE_PROPERTY(), which does the resource | |
490 setting, automatically forces a redisplay as necessary. */ | |
491 } | |
492 | |
493 static XtGeometryResult | |
494 EmacsFrameQueryGeometry (Widget widget, XtWidgetGeometry *request, | |
495 XtWidgetGeometry *result) | |
496 { | |
497 EmacsFrame ew = (EmacsFrame) widget; | |
498 int mask = request->request_mode; | |
499 Dimension width, height; | |
500 int ok_width_int, ok_height_int; | |
501 Dimension ok_width, ok_height; | |
502 | |
503 /* We have a definite preference for what size we would like | |
504 to be. | |
505 | |
506 1) If a preferred size was specified for us, use it. | |
507 (This is not currently used) | |
508 2) If a proposed size was given, round it to the nearest | |
509 multiple of the default char size and return it. | |
510 3) Otherwise, take our current size and round it to the | |
511 nearest multiple of the default char size. */ | |
512 | |
513 width = mask & CWWidth ? request->width : ew->core.width; | |
514 height = mask & CWHeight ? request->height : ew->core.height; | |
515 round_size_to_char (ew->emacs_frame.frame, width, height, | |
516 &ok_width_int, &ok_height_int); | |
517 ok_width = (Dimension) ok_width_int; | |
518 ok_height = (Dimension) ok_height_int; | |
519 if (ew->emacs_frame.preferred_width) | |
520 ok_width = ew->emacs_frame.preferred_width; | |
521 if (ew->emacs_frame.preferred_height) | |
522 ok_height = ew->emacs_frame.preferred_height; | |
523 result->request_mode |= CWWidth | CWHeight; | |
524 result->width = ok_width; | |
525 result->height = ok_height; | |
526 if (((mask & CWWidth) && ok_width != request->width) | |
527 || ((mask & CWHeight) && ok_height != request->height)) | |
528 return XtGeometryAlmost; | |
529 else | |
530 return XtGeometryYes; | |
531 } | |
532 | |
533 /* Xt string-to-scrollbar-placement converter */ | |
440 | 534 /* #### Convert this to a `new-style' converter (See XtAddTypeConverter) */ |
428 | 535 |
536 /* This variable cannot be a stack variable. */ | |
537 static unsigned char cvt_string_scrollbar_placement; | |
538 | |
539 /* ARGSUSED */ | |
540 static void | |
2286 | 541 Xt_StringToScrollBarPlacement (XrmValuePtr UNUSED (args), |
542 Cardinal *UNUSED (num_args), | |
543 XrmValuePtr fromVal, | |
544 XrmValuePtr toVal) | |
428 | 545 { |
2367 | 546 /* !!#### needs work */ |
428 | 547 XrmQuark q; |
851 | 548 char *lowerName = (char *) ALLOCA (strlen ((char *) fromVal->addr) + 1); |
428 | 549 |
550 XmuCopyISOLatin1Lowered (lowerName, (char *) fromVal->addr); | |
551 q = XrmStringToQuark (lowerName); | |
552 | |
553 toVal->size = sizeof (cvt_string_scrollbar_placement); | |
554 toVal->addr = (XPointer) &cvt_string_scrollbar_placement; | |
555 | |
556 if (q == XrmStringToQuark ("top-left") | |
557 || q == XrmStringToQuark ("top_left")) | |
558 cvt_string_scrollbar_placement = XtTOP_LEFT; | |
559 else if (q == XrmStringToQuark ("bottom-left") | |
560 || q == XrmStringToQuark ("bottom_left")) | |
561 cvt_string_scrollbar_placement = XtBOTTOM_LEFT; | |
562 else if (q == XrmStringToQuark ("top-right") | |
563 || q == XrmStringToQuark ("top_right")) | |
564 cvt_string_scrollbar_placement = XtTOP_RIGHT; | |
565 else if (q == XrmStringToQuark ("bottom-right") | |
566 || q == XrmStringToQuark ("bottom_right")) | |
567 cvt_string_scrollbar_placement = XtBOTTOM_RIGHT; | |
568 else | |
569 { | |
570 XtStringConversionWarning (fromVal->addr, "scrollBarPlacement"); | |
571 toVal->addr = NULL; | |
572 toVal->size = 0; | |
573 } | |
574 } | |
575 | |
576 static void | |
577 EmacsFrameClassInitialize (void) | |
578 { | |
579 XtAddConverter (XtRString, XtRScrollBarPlacement, | |
580 Xt_StringToScrollBarPlacement, NULL, 0); | |
581 } | |
582 | |
583 /********************* Special entrypoints *******************/ | |
584 | |
585 void | |
586 EmacsFrameRecomputeCellSize (Widget w) | |
587 { | |
588 EmacsFrame ew = (EmacsFrame) w; | |
589 int cw, ch; | |
590 struct frame *f = ew->emacs_frame.frame; | |
591 | |
592 if (! XtIsSubclass (w, emacsFrameClass)) | |
2500 | 593 ABORT (); |
428 | 594 |
771 | 595 default_face_height_and_width (wrap_frame (f), &ch, &cw); |
428 | 596 if (FRAME_X_TOP_LEVEL_FRAME_P (f)) |
597 x_wm_set_cell_size (FRAME_X_SHELL_WIDGET (f), cw, ch); | |
598 } | |
599 | |
600 /* Set the size of the widget to have the number of rows and columns | |
601 specified. This both causes the X window to change and the | |
602 internal frame structures to get modified to match. */ | |
603 | |
604 void | |
605 EmacsFrameSetCharSize (Widget widget, int columns, int rows) | |
606 { | |
607 EmacsFrame ew = (EmacsFrame) widget; | |
608 int pixel_width, pixel_height; | |
609 struct frame *f = ew->emacs_frame.frame; | |
610 | |
611 if (columns < 3) | |
612 columns = 3; /* no way buddy */ | |
613 if (rows < 1) | |
614 rows = 1; | |
615 | |
616 char_to_pixel_size (f, columns, rows, &pixel_width, &pixel_height); | |
617 | |
618 if (FRAME_X_TOP_LEVEL_FRAME_P (f)) | |
619 x_wm_set_variable_size (FRAME_X_SHELL_WIDGET (f), columns, rows); | |
620 | |
621 { | |
622 Arg al [2]; | |
4528
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
623 Xt_SET_ARG (al [0], XtNwidth, pixel_width); |
726060ee587c
First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4522
diff
changeset
|
624 Xt_SET_ARG (al [1], XtNheight, pixel_height); |
428 | 625 XtSetValues ((Widget) ew, al, countof (al)); |
626 } | |
627 } |