Mercurial > emacs
annotate src/widget.c @ 111651:dbffbd2b89b9
Use \uNNNN, \UNNNNNN, or \xNNNNNN for hex-code display on a TTY.
term.c (produce_glyphless_glyph): Use \uNNNN, \UNNNNNN, or
\xNNNNNN for hex-code display of glyphless characters.
| author | Eli Zaretskii <eliz@gnu.org> |
|---|---|
| date | Sat, 20 Nov 2010 17:04:50 +0200 |
| parents | dd04c65fb401 |
| children | 417b1e4d63cd |
| rev | line source |
|---|---|
| 5626 | 1 /* The emacs frame widget. |
|
75227
e90d04cd455a
Update copyright for years from Emacs 21 to present (mainly adding
Glenn Morris <rgm@gnu.org>
parents:
68651
diff
changeset
|
2 Copyright (C) 1992, 1993, 2000, 2001, 2002, 2003, 2004, |
| 106815 | 3 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. |
| 5626 | 4 |
| 5 This file is part of GNU Emacs. | |
| 6 | |
|
94963
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
7 GNU Emacs is free software: you can redistribute it and/or modify |
| 5626 | 8 it under the terms of the GNU General Public License as published by |
|
94963
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
9 the Free Software Foundation, either version 3 of the License, or |
|
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
10 (at your option) any later version. |
| 5626 | 11 |
| 12 GNU Emacs is distributed in the hope that it will be useful, | |
| 13 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 15 GNU General Public License for more details. | |
| 16 | |
| 17 You should have received a copy of the GNU General Public License | |
|
94963
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
87649
diff
changeset
|
18 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ |
| 5626 | 19 |
| 20 /* Emacs 19 face widget ported by Fred Pierresteguy */ | |
| 21 | |
| 14620 | 22 /* This file has been censored by the Communications Decency Act. |
| 23 That law was passed under the guise of a ban on pornography, but | |
| 24 it bans far more than that. This file did not contain pornography, | |
| 25 but it was censored nonetheless. | |
| 26 | |
| 27 For information on US government censorship of the Internet, and | |
| 28 what you can do to bring back freedom of the press, see the web | |
| 29 site http://www.vtw.org/ | |
| 30 */ | |
| 31 | |
|
7900
60795e826dad
Put stdio.h after config.h.
Richard M. Stallman <rms@gnu.org>
parents:
7579
diff
changeset
|
32 #include <config.h> |
| 5626 | 33 #include <stdio.h> |
|
105669
68dd71358159
* alloc.c: Do not define struct catchtag.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
100951
diff
changeset
|
34 #include <setjmp.h> |
| 5626 | 35 #include "lisp.h" |
| 36 #include "xterm.h" | |
| 37 | |
|
37699
a76348c096b4
Include keyboard.h before frame.h.
Eli Zaretskii <eliz@gnu.org>
parents:
36769
diff
changeset
|
38 #include "keyboard.h" |
| 5626 | 39 #include "frame.h" |
| 21514 | 40 #include "window.h" |
| 5626 | 41 |
| 42 #include "dispextern.h" | |
|
12052
942ad27b8e10
(EmacsFrameDestroy): Block and unblock input.
Karl Heuer <kwzh@gnu.org>
parents:
11895
diff
changeset
|
43 #include "blockinput.h" |
| 5626 | 44 |
| 45 #include <X11/StringDefs.h> | |
| 46 #include <X11/IntrinsicP.h> | |
| 47 #include <X11/cursorfont.h> | |
| 48 #include "widgetprv.h" | |
|
5655
3929b3fb37ee
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5626
diff
changeset
|
49 #include <X11/ObjectP.h> |
| 5626 | 50 #include <X11/Shell.h> |
| 51 #include <X11/ShellP.h> | |
|
9230
786a658d3687
(EmacsFrameSetCharSize): Use lw_refigure_widget() for widget set
Paul Reilly <pmr@pajato.com>
parents:
9165
diff
changeset
|
52 #include "../lwlib/lwlib.h" |
| 5626 | 53 |
|
38219
f70ea2b09e46
(EmacsFrameSetCharSize): Turn off atimers and block
Gerd Moellmann <gerd@gnu.org>
parents:
38182
diff
changeset
|
54 #include <signal.h> |
|
f70ea2b09e46
(EmacsFrameSetCharSize): Turn off atimers and block
Gerd Moellmann <gerd@gnu.org>
parents:
38182
diff
changeset
|
55 #include "syssignal.h" |
|
f70ea2b09e46
(EmacsFrameSetCharSize): Turn off atimers and block
Gerd Moellmann <gerd@gnu.org>
parents:
38182
diff
changeset
|
56 |
|
97731
90335c3336b0
Include character.h and font.h for XSETFONT.
Chong Yidong <cyd@stupidchicken.com>
parents:
94963
diff
changeset
|
57 #include "character.h" |
|
90335c3336b0
Include character.h and font.h for XSETFONT.
Chong Yidong <cyd@stupidchicken.com>
parents:
94963
diff
changeset
|
58 #include "font.h" |
|
90335c3336b0
Include character.h and font.h for XSETFONT.
Chong Yidong <cyd@stupidchicken.com>
parents:
94963
diff
changeset
|
59 |
| 5626 | 60 /* This sucks: this is the first default that x-faces.el tries. This won't |
| 61 be used unless neither the "Emacs.EmacsFrame" resource nor the | |
| 62 "Emacs.EmacsFrame" resource is set; the frame | |
| 63 may have the wrong default size if this font doesn't exist, but some other | |
| 64 font that x-faces.el does. The workaround is to specify some font in the | |
| 65 resource database; I don't know a solution other than duplicating the font- | |
| 66 searching code from x-faces.el in this file. | |
| 67 | |
| 68 This also means that if "Emacs.EmacsFrame" is specified as a non- | |
| 69 existent font, then Xt is going to substitute "XtDefaultFont" for it, | |
| 70 which is a different size than this one. The solution for this is to | |
| 71 make x-faces.el try to use XtDefaultFont. The problem with that is that | |
| 72 XtDefaultFont is almost certainly variable-width. | |
| 73 | |
| 74 #### Perhaps we could have this code explicitly set XtDefaultFont to this? | |
| 75 */ | |
| 76 #define DEFAULT_FACE_FONT "-*-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-*" | |
| 77 | |
| 78 | |
|
109372
dd04c65fb401
Convert function definitions to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106815
diff
changeset
|
79 static void EmacsFrameInitialize (Widget request, Widget new, ArgList dum1, Cardinal *dum2); |
|
dd04c65fb401
Convert function definitions to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106815
diff
changeset
|
80 static void EmacsFrameDestroy (Widget widget); |
|
dd04c65fb401
Convert function definitions to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106815
diff
changeset
|
81 static void EmacsFrameRealize (Widget widget, XtValueMask *mask, XSetWindowAttributes *attrs); |
|
dd04c65fb401
Convert function definitions to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106815
diff
changeset
|
82 void EmacsFrameResize (Widget widget); |
|
dd04c65fb401
Convert function definitions to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106815
diff
changeset
|
83 static Boolean EmacsFrameSetValues (Widget cur_widget, Widget req_widget, Widget new_widget, ArgList dum1, Cardinal *dum2); |
|
dd04c65fb401
Convert function definitions to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106815
diff
changeset
|
84 static XtGeometryResult EmacsFrameQueryGeometry (Widget widget, XtWidgetGeometry *request, XtWidgetGeometry *result); |
| 5626 | 85 |
| 86 | |
| 87 #undef XtOffset | |
| 88 #define XtOffset(p_type,field) \ | |
| 89 ((Cardinal) (((char *) (&(((p_type)0)->field))) - ((char *)0))) | |
| 90 #define offset(field) XtOffset(EmacsFrame, emacs_frame.field) | |
| 91 | |
| 92 static XtResource resources[] = { | |
| 93 {XtNgeometry, XtCGeometry, XtRString, sizeof(String), | |
| 94 offset (geometry), XtRString, (XtPointer) 0}, | |
| 95 {XtNiconic, XtCIconic, XtRBoolean, sizeof(Boolean), | |
| 96 offset (iconic), XtRImmediate, (XtPointer) False}, | |
| 97 | |
| 98 {XtNemacsFrame, XtCEmacsFrame, XtRPointer, sizeof (XtPointer), | |
| 99 offset (frame), XtRImmediate, 0}, | |
| 100 | |
| 101 {XtNminibuffer, XtCMinibuffer, XtRInt, sizeof (int), | |
| 102 offset (minibuffer), XtRImmediate, (XtPointer)0}, | |
| 103 {XtNunsplittable, XtCUnsplittable, XtRBoolean, sizeof (Boolean), | |
| 104 offset (unsplittable), XtRImmediate, (XtPointer)0}, | |
| 105 {XtNinternalBorderWidth, XtCInternalBorderWidth, XtRInt, sizeof (int), | |
| 106 offset (internal_border_width), XtRImmediate, (XtPointer)4}, | |
| 107 {XtNinterline, XtCInterline, XtRInt, sizeof (int), | |
| 108 offset (interline), XtRImmediate, (XtPointer)0}, | |
|
97731
90335c3336b0
Include character.h and font.h for XSETFONT.
Chong Yidong <cyd@stupidchicken.com>
parents:
94963
diff
changeset
|
109 {XtNfont, XtCFont, XtRFontStruct, sizeof(struct font *), |
| 5626 | 110 offset(font),XtRString, DEFAULT_FACE_FONT}, |
| 111 {XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel), | |
| 112 offset(foreground_pixel), XtRString, "XtDefaultForeground"}, | |
| 113 {XtNcursorColor, XtCForeground, XtRPixel, sizeof(Pixel), | |
| 114 offset(cursor_color), XtRString, "XtDefaultForeground"}, | |
| 115 {XtNbarCursor, XtCBarCursor, XtRBoolean, sizeof (Boolean), | |
| 116 offset (bar_cursor), XtRImmediate, (XtPointer)0}, | |
| 117 {XtNvisualBell, XtCVisualBell, XtRBoolean, sizeof (Boolean), | |
| 118 offset (visual_bell), XtRImmediate, (XtPointer)0}, | |
| 119 {XtNbellVolume, XtCBellVolume, XtRInt, sizeof (int), | |
| 120 offset (bell_volume), XtRImmediate, (XtPointer)0}, | |
| 121 }; | |
| 122 | |
| 123 #undef offset | |
| 124 | |
| 125 /* | |
| 126 static XtActionsRec | |
| 127 emacsFrameActionsTable [] = { | |
| 128 {"keypress", key_press}, | |
| 129 {"focus_in", emacs_frame_focus_handler}, | |
| 130 {"focus_out", emacs_frame_focus_handler}, | |
| 131 }; | |
| 132 | |
| 133 static char | |
| 134 emacsFrameTranslations [] = "\ | |
| 135 <KeyPress>: keypress()\n\ | |
| 136 <FocusIn>: focus_in()\n\ | |
| 137 <FocusOut>: focus_out()\n\ | |
| 138 "; | |
| 139 */ | |
| 140 | |
| 141 EmacsFrameClassRec emacsFrameClassRec = { | |
| 142 { /* core fields */ | |
| 143 /* superclass */ &widgetClassRec, | |
| 144 /* class_name */ "EmacsFrame", | |
| 145 /* widget_size */ sizeof(EmacsFrameRec), | |
| 146 /* class_initialize */ 0, | |
| 147 /* class_part_initialize */ 0, | |
| 148 /* class_inited */ FALSE, | |
| 149 /* initialize */ EmacsFrameInitialize, | |
| 150 /* initialize_hook */ 0, | |
| 151 /* realize */ EmacsFrameRealize, | |
| 152 /* actions */ 0, /*emacsFrameActionsTable*/ | |
| 153 /* num_actions */ 0, /*XtNumber (emacsFrameActionsTable)*/ | |
| 154 /* resources */ resources, | |
| 155 /* resource_count */ XtNumber(resources), | |
| 156 /* xrm_class */ NULLQUARK, | |
| 157 /* compress_motion */ TRUE, | |
| 158 /* compress_exposure */ TRUE, | |
| 159 /* compress_enterleave */ TRUE, | |
| 160 /* visible_interest */ FALSE, | |
| 161 /* destroy */ EmacsFrameDestroy, | |
| 162 /* resize */ EmacsFrameResize, | |
| 163 /* expose */ XtInheritExpose, | |
| 164 /* set_values */ EmacsFrameSetValues, | |
| 165 /* set_values_hook */ 0, | |
| 166 /* set_values_almost */ XtInheritSetValuesAlmost, | |
| 167 /* get_values_hook */ 0, | |
| 168 /* accept_focus */ XtInheritAcceptFocus, | |
| 169 /* version */ XtVersion, | |
| 170 /* callback_private */ 0, | |
| 171 /* tm_table */ 0, /*emacsFrameTranslations*/ | |
| 172 /* query_geometry */ EmacsFrameQueryGeometry, | |
| 173 /* display_accelerator */ XtInheritDisplayAccelerator, | |
| 174 /* extension */ 0 | |
| 175 } | |
| 176 }; | |
| 177 | |
| 178 WidgetClass emacsFrameClass = (WidgetClass) &emacsFrameClassRec; | |
| 179 | |
| 180 static void | |
|
109372
dd04c65fb401
Convert function definitions to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106815
diff
changeset
|
181 get_default_char_pixel_size (EmacsFrame ew, int *pixel_width, int *pixel_height) |
| 5626 | 182 { |
| 183 struct frame* f = ew->emacs_frame.frame; | |
|
51206
22a5614b558f
Make (few) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents:
50099
diff
changeset
|
184 *pixel_width = FRAME_COLUMN_WIDTH (f); |
|
22a5614b558f
Make (few) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents:
50099
diff
changeset
|
185 *pixel_height = FRAME_LINE_HEIGHT (f); |
| 5626 | 186 } |
| 187 | |
| 188 static void | |
|
109372
dd04c65fb401
Convert function definitions to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106815
diff
changeset
|
189 pixel_to_char_size (EmacsFrame ew, Dimension pixel_width, Dimension pixel_height, int *char_width, int *char_height) |
| 5626 | 190 { |
| 191 struct frame* f = ew->emacs_frame.frame; | |
|
51206
22a5614b558f
Make (few) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents:
50099
diff
changeset
|
192 *char_width = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, (int) pixel_width); |
|
22a5614b558f
Make (few) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents:
50099
diff
changeset
|
193 *char_height = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, (int) pixel_height); |
| 5626 | 194 } |
| 195 | |
| 196 static void | |
|
109372
dd04c65fb401
Convert function definitions to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106815
diff
changeset
|
197 char_to_pixel_size (EmacsFrame ew, int char_width, int char_height, Dimension *pixel_width, Dimension *pixel_height) |
| 5626 | 198 { |
| 199 struct frame* f = ew->emacs_frame.frame; | |
|
51206
22a5614b558f
Make (few) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents:
50099
diff
changeset
|
200 *pixel_width = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, char_width); |
|
22a5614b558f
Make (few) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents:
50099
diff
changeset
|
201 *pixel_height = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, char_height); |
| 5626 | 202 } |
| 203 | |
| 204 static void | |
|
109372
dd04c65fb401
Convert function definitions to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106815
diff
changeset
|
205 round_size_to_char (EmacsFrame ew, Dimension in_width, Dimension in_height, Dimension *out_width, Dimension *out_height) |
| 5626 | 206 { |
| 207 int char_width; | |
| 208 int char_height; | |
| 209 pixel_to_char_size (ew, in_width, in_height, &char_width, &char_height); | |
| 210 char_to_pixel_size (ew, char_width, char_height, out_width, out_height); | |
| 211 } | |
| 212 | |
| 213 static Widget | |
|
109372
dd04c65fb401
Convert function definitions to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106815
diff
changeset
|
214 get_wm_shell (Widget w) |
| 5626 | 215 { |
| 216 Widget wmshell; | |
| 217 | |
| 218 for (wmshell = XtParent (w); | |
| 219 wmshell && !XtIsWMShell (wmshell); | |
| 220 wmshell = XtParent (wmshell)); | |
| 221 | |
| 222 return wmshell; | |
| 223 } | |
| 224 | |
|
25728
342027dc53c2
(set_frame_size, EmacsFrameSetCharSize): Remove
Gerd Moellmann <gerd@gnu.org>
parents:
25461
diff
changeset
|
225 #if 0 /* Currently not used. */ |
|
342027dc53c2
(set_frame_size, EmacsFrameSetCharSize): Remove
Gerd Moellmann <gerd@gnu.org>
parents:
25461
diff
changeset
|
226 |
| 5626 | 227 static void |
|
5708
4870efc489ea
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
228 mark_shell_size_user_specified (wmshell) |
|
4870efc489ea
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
229 Widget wmshell; |
| 5626 | 230 { |
| 231 if (! XtIsWMShell (wmshell)) abort (); | |
| 232 /* This is kind of sleazy, but I can't see how else to tell it to make it | |
| 233 mark the WM_SIZE_HINTS size as user specified when appropriate. */ | |
| 234 ((WMShellWidget) wmshell)->wm.size_hints.flags |= USSize; | |
| 235 } | |
| 236 | |
|
25728
342027dc53c2
(set_frame_size, EmacsFrameSetCharSize): Remove
Gerd Moellmann <gerd@gnu.org>
parents:
25461
diff
changeset
|
237 #endif |
|
342027dc53c2
(set_frame_size, EmacsFrameSetCharSize): Remove
Gerd Moellmann <gerd@gnu.org>
parents:
25461
diff
changeset
|
238 |
| 5626 | 239 |
| 240 /* Can't have static frame locals because of some broken compilers. | |
| 241 Normally, initializing a variable like this doesn't work in emacs, | |
| 242 but it's ok in this file because it must come after lastfile (and | |
| 243 thus have its data not go into text space) because Xt needs to | |
| 244 write to initialized data objects too. | |
| 245 */ | |
|
25728
342027dc53c2
(set_frame_size, EmacsFrameSetCharSize): Remove
Gerd Moellmann <gerd@gnu.org>
parents:
25461
diff
changeset
|
246 #if 0 |
| 5626 | 247 static Boolean first_frame_p = True; |
|
25728
342027dc53c2
(set_frame_size, EmacsFrameSetCharSize): Remove
Gerd Moellmann <gerd@gnu.org>
parents:
25461
diff
changeset
|
248 #endif |
| 5626 | 249 |
| 250 static void | |
|
109372
dd04c65fb401
Convert function definitions to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106815
diff
changeset
|
251 set_frame_size (EmacsFrame ew) |
| 5626 | 252 { |
| 253 /* The widget hierarchy is | |
| 254 | |
| 255 argv[0] emacsShell pane Frame-NAME | |
| 256 ApplicationShell EmacsShell Paned EmacsFrame | |
| 257 | |
| 258 We accept geometry specs in this order: | |
| 259 | |
| 260 *Frame-NAME.geometry | |
| 261 *EmacsFrame.geometry | |
| 262 Emacs.geometry | |
| 263 | |
| 264 Other possibilities for widget hierarchies might be | |
| 265 | |
| 266 argv[0] frame pane Frame-NAME | |
| 267 ApplicationShell EmacsShell Paned EmacsFrame | |
| 268 or | |
| 269 argv[0] Frame-NAME pane Frame-NAME | |
| 270 ApplicationShell EmacsShell Paned EmacsFrame | |
| 271 or | |
| 272 argv[0] Frame-NAME pane emacsTextPane | |
| 273 ApplicationShell EmacsFrame Paned EmacsTextPane | |
| 274 | |
| 275 With the current setup, the text-display-area is the part which is | |
| 276 an emacs "frame", since that's the only part managed by emacs proper | |
| 277 (the menubar and the parent of the menubar and all that sort of thing | |
| 278 are managed by lwlib.) | |
| 279 | |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
44671
diff
changeset
|
280 The EmacsShell widget is simply a replacement for the Shell widget |
| 5626 | 281 which is able to deal with using an externally-supplied window instead |
| 282 of always creating its own. It is not actually emacs specific, and | |
| 283 should possibly have class "Shell" instead of "EmacsShell" to simplify | |
| 284 the resources. | |
| 285 | |
| 286 */ | |
| 287 | |
| 288 /* Hairily merged geometry */ | |
|
51206
22a5614b558f
Make (few) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents:
50099
diff
changeset
|
289 unsigned int w = FRAME_COLS (ew->emacs_frame.frame); |
|
22a5614b558f
Make (few) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents:
50099
diff
changeset
|
290 unsigned int h = FRAME_LINES (ew->emacs_frame.frame); |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
44671
diff
changeset
|
291 |
| 5626 | 292 Widget wmshell = get_wm_shell ((Widget) ew); |
|
9708
33dcf295f62a
(set_frame_size): Set app_shell and wmshell the same.
Richard M. Stallman <rms@gnu.org>
parents:
9230
diff
changeset
|
293 /* Each Emacs shell is now independent and top-level. */ |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
44671
diff
changeset
|
294 |
| 5626 | 295 if (! XtIsSubclass (wmshell, shellWidgetClass)) abort (); |
| 296 | |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
44671
diff
changeset
|
297 /* We don't need this for the moment. The geometry is computed in |
|
6464
7f93299356e2
(set_frame_size): Put #if 0 around a lot of useless code.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6331
diff
changeset
|
298 xfns.c. */ |
|
7f93299356e2
(set_frame_size): Put #if 0 around a lot of useless code.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6331
diff
changeset
|
299 #if 0 |
| 5626 | 300 /* If the EmacsFrame doesn't have a geometry but the shell does, |
| 301 treat that as the geometry of the frame. (Is this bogus? | |
| 302 I'm not sure.) */ | |
| 303 if (ew->emacs_frame.geometry == 0) | |
|
30575
e8bd810181fb
(set_frame_size, update_wm_hints, EmacsFrameSetValues):
Gerd Moellmann <gerd@gnu.org>
parents:
29863
diff
changeset
|
304 XtVaGetValues (wmshell, XtNgeometry, &ew->emacs_frame.geometry, NULL); |
| 5626 | 305 |
| 306 /* If the Shell is iconic, then the EmacsFrame is iconic. (Is | |
| 307 this bogus? I'm not sure.) */ | |
| 308 if (!ew->emacs_frame.iconic) | |
|
30575
e8bd810181fb
(set_frame_size, update_wm_hints, EmacsFrameSetValues):
Gerd Moellmann <gerd@gnu.org>
parents:
29863
diff
changeset
|
309 XtVaGetValues (wmshell, XtNiconic, &ew->emacs_frame.iconic, NULL); |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
44671
diff
changeset
|
310 |
|
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
44671
diff
changeset
|
311 |
| 5626 | 312 { |
| 313 char *geom = 0; | |
|
30575
e8bd810181fb
(set_frame_size, update_wm_hints, EmacsFrameSetValues):
Gerd Moellmann <gerd@gnu.org>
parents:
29863
diff
changeset
|
314 XtVaGetValues (app_shell, XtNgeometry, &geom, NULL); |
| 5626 | 315 if (geom) |
| 316 app_flags = XParseGeometry (geom, &app_x, &app_y, &app_w, &app_h); | |
| 317 } | |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
44671
diff
changeset
|
318 |
| 5626 | 319 if (ew->emacs_frame.geometry) |
| 320 frame_flags = XParseGeometry (ew->emacs_frame.geometry, | |
| 321 &frame_x, &frame_y, | |
| 322 &frame_w, &frame_h); | |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
44671
diff
changeset
|
323 |
| 5626 | 324 if (first_frame_p) |
| 325 { | |
| 326 /* If this is the first frame created: | |
| 327 ==================================== | |
| 328 | |
| 329 - Use the ApplicationShell's size/position, if specified. | |
| 330 (This is "Emacs.geometry", or the "-geometry" command line arg.) | |
| 331 - Else use the EmacsFrame's size/position. | |
| 332 (This is "*Frame-NAME.geometry") | |
| 333 | |
| 334 - If the AppShell is iconic, the frame should be iconic. | |
| 335 | |
| 336 AppShell comes first so that -geometry always applies to the first | |
| 337 frame created, even if there is an "every frame" entry in the | |
| 338 resource database. | |
| 339 */ | |
| 340 if (app_flags & (XValue | YValue)) | |
| 341 { | |
| 342 x = app_x; y = app_y; | |
| 343 flags |= (app_flags & (XValue | YValue | XNegative | YNegative)); | |
| 344 } | |
| 345 else if (frame_flags & (XValue | YValue)) | |
| 346 { | |
| 347 x = frame_x; y = frame_y; | |
| 348 flags |= (frame_flags & (XValue | YValue | XNegative | YNegative)); | |
| 349 } | |
| 350 | |
| 351 if (app_flags & (WidthValue | HeightValue)) | |
| 352 { | |
| 353 w = app_w; h = app_h; | |
| 354 flags |= (app_flags & (WidthValue | HeightValue)); | |
| 355 } | |
| 356 else if (frame_flags & (WidthValue | HeightValue)) | |
| 357 { | |
| 358 w = frame_w; h = frame_h; | |
| 359 flags |= (frame_flags & (WidthValue | HeightValue)); | |
| 360 } | |
| 361 | |
| 362 /* If the AppShell is iconic, then the EmacsFrame is iconic. */ | |
| 363 if (!ew->emacs_frame.iconic) | |
|
30575
e8bd810181fb
(set_frame_size, update_wm_hints, EmacsFrameSetValues):
Gerd Moellmann <gerd@gnu.org>
parents:
29863
diff
changeset
|
364 XtVaGetValues (app_shell, XtNiconic, &ew->emacs_frame.iconic, NULL); |
| 5626 | 365 |
| 366 first_frame_p = False; | |
| 367 } | |
| 368 else | |
| 369 { | |
| 370 /* If this is not the first frame created: | |
| 371 ======================================== | |
| 372 | |
| 373 - use the EmacsFrame's size/position if specified | |
| 374 - Otherwise, use the ApplicationShell's size, but not position. | |
| 375 | |
| 376 So that means that one can specify the position of the first frame | |
| 377 with "Emacs.geometry" or `-geometry'; but can only specify the | |
| 378 position of subsequent frames with "*Frame-NAME.geometry". | |
| 379 | |
| 380 AppShell comes second so that -geometry does not apply to subsequent | |
| 381 frames when there is an "every frame" entry in the resource db, | |
| 382 but does apply to the first frame. | |
| 383 */ | |
| 384 if (frame_flags & (XValue | YValue)) | |
| 385 { | |
| 386 x = frame_x; y = frame_y; | |
| 387 flags |= (frame_flags & (XValue | YValue | XNegative | YNegative)); | |
| 388 } | |
| 389 | |
| 390 if (frame_flags & (WidthValue | HeightValue)) | |
| 391 { | |
| 392 w = frame_w; h = frame_h; | |
| 393 flags |= (frame_flags & (WidthValue | HeightValue)); | |
| 394 } | |
| 395 else if (app_flags & (WidthValue | HeightValue)) | |
| 396 { | |
| 397 w = app_w; | |
| 398 h = app_h; | |
| 399 flags |= (app_flags & (WidthValue | HeightValue)); | |
| 400 } | |
| 401 } | |
|
6464
7f93299356e2
(set_frame_size): Put #if 0 around a lot of useless code.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6331
diff
changeset
|
402 #endif /* 0 */ |
| 5626 | 403 { |
|
51206
22a5614b558f
Make (few) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents:
50099
diff
changeset
|
404 struct frame *f = ew->emacs_frame.frame; |
| 5626 | 405 Dimension pixel_width, pixel_height; |
| 406 | |
|
24999
bd6d15dc5a10
(EmacsFrameSetCharSize): Take widget's border width
Gerd Moellmann <gerd@gnu.org>
parents:
21514
diff
changeset
|
407 /* Take into account the size of the scrollbar. Always use the |
|
bd6d15dc5a10
(EmacsFrameSetCharSize): Take widget's border width
Gerd Moellmann <gerd@gnu.org>
parents:
21514
diff
changeset
|
408 number of columns occupied by the scroll bar here otherwise we |
|
bd6d15dc5a10
(EmacsFrameSetCharSize): Take widget's border width
Gerd Moellmann <gerd@gnu.org>
parents:
21514
diff
changeset
|
409 might end up with a frame width that is not a multiple of the |
|
bd6d15dc5a10
(EmacsFrameSetCharSize): Take widget's border width
Gerd Moellmann <gerd@gnu.org>
parents:
21514
diff
changeset
|
410 frame's character width which is bad for vertically split |
|
bd6d15dc5a10
(EmacsFrameSetCharSize): Take widget's border width
Gerd Moellmann <gerd@gnu.org>
parents:
21514
diff
changeset
|
411 windows. */ |
|
51206
22a5614b558f
Make (few) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents:
50099
diff
changeset
|
412 f->scroll_bar_actual_width |
|
22a5614b558f
Make (few) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents:
50099
diff
changeset
|
413 = FRAME_SCROLL_BAR_COLS (f) * FRAME_COLUMN_WIDTH (f); |
| 5626 | 414 |
|
51206
22a5614b558f
Make (few) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents:
50099
diff
changeset
|
415 compute_fringe_widths (f, 0); |
|
24999
bd6d15dc5a10
(EmacsFrameSetCharSize): Take widget's border width
Gerd Moellmann <gerd@gnu.org>
parents:
21514
diff
changeset
|
416 |
|
44263
13c043393136
(set_frame_size): Don't call change_frame_size.
Richard M. Stallman <rms@gnu.org>
parents:
41723
diff
changeset
|
417 #if 0 /* This can run Lisp code, and it is dangerous to give |
|
13c043393136
(set_frame_size): Don't call change_frame_size.
Richard M. Stallman <rms@gnu.org>
parents:
41723
diff
changeset
|
418 out the frame to Lisp code before it officially exists. |
|
13c043393136
(set_frame_size): Don't call change_frame_size.
Richard M. Stallman <rms@gnu.org>
parents:
41723
diff
changeset
|
419 This is handled in Fx_create_frame so not needed here. */ |
|
51206
22a5614b558f
Make (few) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents:
50099
diff
changeset
|
420 change_frame_size (f, h, w, 1, 0, 0); |
|
44263
13c043393136
(set_frame_size): Don't call change_frame_size.
Richard M. Stallman <rms@gnu.org>
parents:
41723
diff
changeset
|
421 #endif |
| 5626 | 422 char_to_pixel_size (ew, w, h, &pixel_width, &pixel_height); |
| 423 ew->core.width = pixel_width; | |
| 424 ew->core.height = pixel_height; | |
| 425 | |
|
6789
67bb36e8e602
(EmacsFrameSetCharSize): Do not attempt to preserve the window position.
Richard M. Stallman <rms@gnu.org>
parents:
6766
diff
changeset
|
426 #if 0 /* xfns.c takes care of this now. */ |
| 5626 | 427 /* If a position was specified, assign it to the shell widget. |
| 428 (Else WM won't do anything with it.) | |
| 429 */ | |
| 430 if (flags & (XValue | YValue)) | |
| 431 { | |
| 432 /* the tricky things with the sign is to make sure that | |
| 433 -0 is printed -0. */ | |
| 434 int len; | |
| 435 char *tem; | |
| 436 sprintf (shell_position, "=%c%d%c%d", | |
| 437 flags & XNegative ? '-' : '+', x < 0 ? -x : x, | |
| 438 flags & YNegative ? '-' : '+', y < 0 ? -y : y); | |
| 439 len = strlen (shell_position) + 1; | |
| 440 tem = (char *) xmalloc (len); | |
| 441 strncpy (tem, shell_position, len); | |
|
30575
e8bd810181fb
(set_frame_size, update_wm_hints, EmacsFrameSetValues):
Gerd Moellmann <gerd@gnu.org>
parents:
29863
diff
changeset
|
442 XtVaSetValues (wmshell, XtNgeometry, tem, NULL); |
| 5626 | 443 } |
| 444 else if (flags & (WidthValue | HeightValue)) | |
| 445 { | |
| 446 int len; | |
| 447 char *tem; | |
| 448 sprintf (shell_position, "=%dx%d", pixel_width, pixel_height); | |
| 449 len = strlen (shell_position) + 1; | |
| 450 tem = (char *) xmalloc (len); | |
| 451 strncpy (tem, shell_position, len); | |
|
30575
e8bd810181fb
(set_frame_size, update_wm_hints, EmacsFrameSetValues):
Gerd Moellmann <gerd@gnu.org>
parents:
29863
diff
changeset
|
452 XtVaSetValues (wmshell, XtNgeometry, tem, NULL); |
| 5626 | 453 } |
| 454 | |
| 455 /* If the geometry spec we're using has W/H components, mark the size | |
| 456 in the WM_SIZE_HINTS as user specified. */ | |
| 457 if (flags & (WidthValue | HeightValue)) | |
| 458 mark_shell_size_user_specified (wmshell); | |
| 459 | |
| 460 /* Also assign the iconic status of the frame to the Shell, so that | |
| 461 the WM sees it. */ | |
|
30575
e8bd810181fb
(set_frame_size, update_wm_hints, EmacsFrameSetValues):
Gerd Moellmann <gerd@gnu.org>
parents:
29863
diff
changeset
|
462 XtVaSetValues (wmshell, XtNiconic, ew->emacs_frame.iconic, NULL); |
|
6464
7f93299356e2
(set_frame_size): Put #if 0 around a lot of useless code.
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
6331
diff
changeset
|
463 #endif /* 0 */ |
| 5626 | 464 } |
| 465 } | |
| 466 | |
|
12188
06ef0aabc2bb
(EmacsFrameSetCharSize): Manually alter the height
Karl Heuer <kwzh@gnu.org>
parents:
12052
diff
changeset
|
467 /* Nonzero tells update_wm_hints not to do anything |
|
06ef0aabc2bb
(EmacsFrameSetCharSize): Manually alter the height
Karl Heuer <kwzh@gnu.org>
parents:
12052
diff
changeset
|
468 (the caller should call update_wm_hints explicitly later.) */ |
|
06ef0aabc2bb
(EmacsFrameSetCharSize): Manually alter the height
Karl Heuer <kwzh@gnu.org>
parents:
12052
diff
changeset
|
469 int update_hints_inhibit; |
| 5626 | 470 |
| 471 static void | |
|
109372
dd04c65fb401
Convert function definitions to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106815
diff
changeset
|
472 update_wm_hints (EmacsFrame ew) |
| 5626 | 473 { |
| 474 Widget wmshell = get_wm_shell ((Widget)ew); | |
| 475 int cw; | |
| 476 int ch; | |
| 477 Dimension rounded_width; | |
| 478 Dimension rounded_height; | |
| 479 int char_width; | |
| 480 int char_height; | |
| 481 int base_width; | |
| 482 int base_height; | |
| 483 int min_rows = 0, min_cols = 0; | |
| 484 | |
|
12188
06ef0aabc2bb
(EmacsFrameSetCharSize): Manually alter the height
Karl Heuer <kwzh@gnu.org>
parents:
12052
diff
changeset
|
485 if (update_hints_inhibit) |
|
06ef0aabc2bb
(EmacsFrameSetCharSize): Manually alter the height
Karl Heuer <kwzh@gnu.org>
parents:
12052
diff
changeset
|
486 return; |
|
06ef0aabc2bb
(EmacsFrameSetCharSize): Manually alter the height
Karl Heuer <kwzh@gnu.org>
parents:
12052
diff
changeset
|
487 |
|
06ef0aabc2bb
(EmacsFrameSetCharSize): Manually alter the height
Karl Heuer <kwzh@gnu.org>
parents:
12052
diff
changeset
|
488 #if 0 |
| 5626 | 489 check_frame_size (ew->emacs_frame.frame, &min_rows, &min_cols); |
|
12188
06ef0aabc2bb
(EmacsFrameSetCharSize): Manually alter the height
Karl Heuer <kwzh@gnu.org>
parents:
12052
diff
changeset
|
490 #endif |
| 5626 | 491 |
| 492 pixel_to_char_size (ew, ew->core.width, ew->core.height, | |
| 493 &char_width, &char_height); | |
| 494 char_to_pixel_size (ew, char_width, char_height, | |
| 495 &rounded_width, &rounded_height); | |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
44671
diff
changeset
|
496 get_default_char_pixel_size (ew, &cw, &ch); |
| 5626 | 497 |
| 498 base_width = (wmshell->core.width - ew->core.width | |
| 499 + (rounded_width - (char_width * cw))); | |
| 500 base_height = (wmshell->core.height - ew->core.height | |
| 501 + (rounded_height - (char_height * ch))); | |
| 502 | |
| 503 /* This is kind of sleazy, but I can't see how else to tell it to | |
| 504 make it mark the WM_SIZE_HINTS size as user specified. | |
| 505 */ | |
| 506 /* ((WMShellWidget) wmshell)->wm.size_hints.flags |= USSize;*/ | |
| 507 | |
| 508 XtVaSetValues (wmshell, | |
|
38182
fd45b8013008
(EmacsFrameSetCharSize): Set XtNwaitForWm depending
Gerd Moellmann <gerd@gnu.org>
parents:
37699
diff
changeset
|
509 XtNbaseWidth, (XtArgVal) base_width, |
|
fd45b8013008
(EmacsFrameSetCharSize): Set XtNwaitForWm depending
Gerd Moellmann <gerd@gnu.org>
parents:
37699
diff
changeset
|
510 XtNbaseHeight, (XtArgVal) base_height, |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
44671
diff
changeset
|
511 XtNwidthInc, (XtArgVal) cw, |
|
38182
fd45b8013008
(EmacsFrameSetCharSize): Set XtNwaitForWm depending
Gerd Moellmann <gerd@gnu.org>
parents:
37699
diff
changeset
|
512 XtNheightInc, (XtArgVal) ch, |
|
fd45b8013008
(EmacsFrameSetCharSize): Set XtNwaitForWm depending
Gerd Moellmann <gerd@gnu.org>
parents:
37699
diff
changeset
|
513 XtNminWidth, (XtArgVal) (base_width + min_cols * cw), |
|
fd45b8013008
(EmacsFrameSetCharSize): Set XtNwaitForWm depending
Gerd Moellmann <gerd@gnu.org>
parents:
37699
diff
changeset
|
514 XtNminHeight, (XtArgVal) (base_height + min_rows * ch), |
|
30575
e8bd810181fb
(set_frame_size, update_wm_hints, EmacsFrameSetValues):
Gerd Moellmann <gerd@gnu.org>
parents:
29863
diff
changeset
|
515 NULL); |
| 5626 | 516 } |
| 517 | |
|
25728
342027dc53c2
(set_frame_size, EmacsFrameSetCharSize): Remove
Gerd Moellmann <gerd@gnu.org>
parents:
25461
diff
changeset
|
518 #if 0 |
|
342027dc53c2
(set_frame_size, EmacsFrameSetCharSize): Remove
Gerd Moellmann <gerd@gnu.org>
parents:
25461
diff
changeset
|
519 |
| 5626 | 520 static void |
|
5708
4870efc489ea
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
521 create_frame_gcs (ew) |
|
4870efc489ea
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
5706
diff
changeset
|
522 EmacsFrame ew; |
| 5626 | 523 { |
|
11884
13f0227c7c56
(create_frame_gcs): Cast args of XCreateGC.
Karl Heuer <kwzh@gnu.org>
parents:
9708
diff
changeset
|
524 struct frame *s = ew->emacs_frame.frame; |
| 5626 | 525 |
| 12671 | 526 s->output_data.x->normal_gc |
|
11895
81f2806578ed
(create_frame_gcs, setup_frame_gcs): Reformat long statements.
Karl Heuer <kwzh@gnu.org>
parents:
11884
diff
changeset
|
527 = XCreateGC (XtDisplay (ew), RootWindowOfScreen (XtScreen (ew)), |
|
81f2806578ed
(create_frame_gcs, setup_frame_gcs): Reformat long statements.
Karl Heuer <kwzh@gnu.org>
parents:
11884
diff
changeset
|
528 (unsigned long)0, (XGCValues *)0); |
| 12671 | 529 s->output_data.x->reverse_gc |
|
11895
81f2806578ed
(create_frame_gcs, setup_frame_gcs): Reformat long statements.
Karl Heuer <kwzh@gnu.org>
parents:
11884
diff
changeset
|
530 = XCreateGC (XtDisplay (ew), RootWindowOfScreen (XtScreen (ew)), |
|
81f2806578ed
(create_frame_gcs, setup_frame_gcs): Reformat long statements.
Karl Heuer <kwzh@gnu.org>
parents:
11884
diff
changeset
|
531 (unsigned long)0, (XGCValues *)0); |
| 12671 | 532 s->output_data.x->cursor_gc |
|
11895
81f2806578ed
(create_frame_gcs, setup_frame_gcs): Reformat long statements.
Karl Heuer <kwzh@gnu.org>
parents:
11884
diff
changeset
|
533 = XCreateGC (XtDisplay (ew), RootWindowOfScreen (XtScreen (ew)), |
|
81f2806578ed
(create_frame_gcs, setup_frame_gcs): Reformat long statements.
Karl Heuer <kwzh@gnu.org>
parents:
11884
diff
changeset
|
534 (unsigned long)0, (XGCValues *)0); |
|
24999
bd6d15dc5a10
(EmacsFrameSetCharSize): Take widget's border width
Gerd Moellmann <gerd@gnu.org>
parents:
21514
diff
changeset
|
535 s->output_data.x->black_relief.gc = 0; |
|
bd6d15dc5a10
(EmacsFrameSetCharSize): Take widget's border width
Gerd Moellmann <gerd@gnu.org>
parents:
21514
diff
changeset
|
536 s->output_data.x->white_relief.gc = 0; |
| 5626 | 537 } |
| 538 | |
|
25728
342027dc53c2
(set_frame_size, EmacsFrameSetCharSize): Remove
Gerd Moellmann <gerd@gnu.org>
parents:
25461
diff
changeset
|
539 #endif /* 0 */ |
|
342027dc53c2
(set_frame_size, EmacsFrameSetCharSize): Remove
Gerd Moellmann <gerd@gnu.org>
parents:
25461
diff
changeset
|
540 |
|
7557
889a8cd345b2
(setup_frame_gcs): Move cursor_bits variable out of
Richard M. Stallman <rms@gnu.org>
parents:
6789
diff
changeset
|
541 static char setup_frame_cursor_bits[] = |
|
889a8cd345b2
(setup_frame_gcs): Move cursor_bits variable out of
Richard M. Stallman <rms@gnu.org>
parents:
6789
diff
changeset
|
542 { |
|
889a8cd345b2
(setup_frame_gcs): Move cursor_bits variable out of
Richard M. Stallman <rms@gnu.org>
parents:
6789
diff
changeset
|
543 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|
889a8cd345b2
(setup_frame_gcs): Move cursor_bits variable out of
Richard M. Stallman <rms@gnu.org>
parents:
6789
diff
changeset
|
544 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|
889a8cd345b2
(setup_frame_gcs): Move cursor_bits variable out of
Richard M. Stallman <rms@gnu.org>
parents:
6789
diff
changeset
|
545 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
|
889a8cd345b2
(setup_frame_gcs): Move cursor_bits variable out of
Richard M. Stallman <rms@gnu.org>
parents:
6789
diff
changeset
|
546 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 |
|
889a8cd345b2
(setup_frame_gcs): Move cursor_bits variable out of
Richard M. Stallman <rms@gnu.org>
parents:
6789
diff
changeset
|
547 }; |
|
889a8cd345b2
(setup_frame_gcs): Move cursor_bits variable out of
Richard M. Stallman <rms@gnu.org>
parents:
6789
diff
changeset
|
548 |
| 5626 | 549 static void |
|
109372
dd04c65fb401
Convert function definitions to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106815
diff
changeset
|
550 setup_frame_gcs (EmacsFrame ew) |
| 5626 | 551 { |
| 552 XGCValues gc_values; | |
| 553 struct frame* s = ew->emacs_frame.frame; | |
| 554 Pixmap blank_stipple, blank_tile; | |
|
97731
90335c3336b0
Include character.h and font.h for XSETFONT.
Chong Yidong <cyd@stupidchicken.com>
parents:
94963
diff
changeset
|
555 unsigned long valuemask = (GCForeground | GCBackground | GCGraphicsExposures |
|
90335c3336b0
Include character.h and font.h for XSETFONT.
Chong Yidong <cyd@stupidchicken.com>
parents:
94963
diff
changeset
|
556 | GCStipple | GCTile); |
|
90335c3336b0
Include character.h and font.h for XSETFONT.
Chong Yidong <cyd@stupidchicken.com>
parents:
94963
diff
changeset
|
557 Lisp_Object font; |
|
90335c3336b0
Include character.h and font.h for XSETFONT.
Chong Yidong <cyd@stupidchicken.com>
parents:
94963
diff
changeset
|
558 |
|
90335c3336b0
Include character.h and font.h for XSETFONT.
Chong Yidong <cyd@stupidchicken.com>
parents:
94963
diff
changeset
|
559 XSETFONT (font, ew->emacs_frame.font); |
|
90335c3336b0
Include character.h and font.h for XSETFONT.
Chong Yidong <cyd@stupidchicken.com>
parents:
94963
diff
changeset
|
560 font = Ffont_xlfd_name (font, Qnil); |
|
90335c3336b0
Include character.h and font.h for XSETFONT.
Chong Yidong <cyd@stupidchicken.com>
parents:
94963
diff
changeset
|
561 if (STRINGP (font)) |
|
90335c3336b0
Include character.h and font.h for XSETFONT.
Chong Yidong <cyd@stupidchicken.com>
parents:
94963
diff
changeset
|
562 { |
|
90335c3336b0
Include character.h and font.h for XSETFONT.
Chong Yidong <cyd@stupidchicken.com>
parents:
94963
diff
changeset
|
563 XFontStruct *xfont = XLoadQueryFont (FRAME_X_DISPLAY_INFO (s)->display, |
|
90335c3336b0
Include character.h and font.h for XSETFONT.
Chong Yidong <cyd@stupidchicken.com>
parents:
94963
diff
changeset
|
564 SDATA (font)); |
|
90335c3336b0
Include character.h and font.h for XSETFONT.
Chong Yidong <cyd@stupidchicken.com>
parents:
94963
diff
changeset
|
565 if (xfont) |
|
90335c3336b0
Include character.h and font.h for XSETFONT.
Chong Yidong <cyd@stupidchicken.com>
parents:
94963
diff
changeset
|
566 { |
|
90335c3336b0
Include character.h and font.h for XSETFONT.
Chong Yidong <cyd@stupidchicken.com>
parents:
94963
diff
changeset
|
567 gc_values.font = xfont->fid; |
|
90335c3336b0
Include character.h and font.h for XSETFONT.
Chong Yidong <cyd@stupidchicken.com>
parents:
94963
diff
changeset
|
568 valuemask |= GCFont; |
|
90335c3336b0
Include character.h and font.h for XSETFONT.
Chong Yidong <cyd@stupidchicken.com>
parents:
94963
diff
changeset
|
569 } |
|
90335c3336b0
Include character.h and font.h for XSETFONT.
Chong Yidong <cyd@stupidchicken.com>
parents:
94963
diff
changeset
|
570 } |
| 5626 | 571 |
| 572 /* We have to initialize all of our GCs to have a stipple/tile, otherwise | |
| 573 XGetGCValues returns uninitialized data when we query the stipple | |
| 574 (instead of None or something sensible) and it makes things hard. | |
| 575 | |
| 576 This should be fixed for real by not querying the GCs but instead having | |
| 577 some GC-based cache instead of the current face-based cache which doesn't | |
| 578 effectively cache all of the GC settings we need to use. | |
| 579 */ | |
| 580 | |
|
11895
81f2806578ed
(create_frame_gcs, setup_frame_gcs): Reformat long statements.
Karl Heuer <kwzh@gnu.org>
parents:
11884
diff
changeset
|
581 blank_stipple |
|
81f2806578ed
(create_frame_gcs, setup_frame_gcs): Reformat long statements.
Karl Heuer <kwzh@gnu.org>
parents:
11884
diff
changeset
|
582 = XCreateBitmapFromData (XtDisplay (ew), |
|
81f2806578ed
(create_frame_gcs, setup_frame_gcs): Reformat long statements.
Karl Heuer <kwzh@gnu.org>
parents:
11884
diff
changeset
|
583 RootWindowOfScreen (XtScreen (ew)), |
|
81f2806578ed
(create_frame_gcs, setup_frame_gcs): Reformat long statements.
Karl Heuer <kwzh@gnu.org>
parents:
11884
diff
changeset
|
584 setup_frame_cursor_bits, 2, 2); |
| 5626 | 585 |
| 586 /* use fg = 0, bg = 1 below, but it's irrelevant since this pixmap should | |
| 587 never actually get used as a background tile! | |
| 588 */ | |
|
11895
81f2806578ed
(create_frame_gcs, setup_frame_gcs): Reformat long statements.
Karl Heuer <kwzh@gnu.org>
parents:
11884
diff
changeset
|
589 blank_tile |
|
81f2806578ed
(create_frame_gcs, setup_frame_gcs): Reformat long statements.
Karl Heuer <kwzh@gnu.org>
parents:
11884
diff
changeset
|
590 = XCreatePixmapFromBitmapData (XtDisplay(ew), |
|
81f2806578ed
(create_frame_gcs, setup_frame_gcs): Reformat long statements.
Karl Heuer <kwzh@gnu.org>
parents:
11884
diff
changeset
|
591 RootWindowOfScreen (XtScreen (ew)), |
|
81f2806578ed
(create_frame_gcs, setup_frame_gcs): Reformat long statements.
Karl Heuer <kwzh@gnu.org>
parents:
11884
diff
changeset
|
592 setup_frame_cursor_bits, 2, 2, |
|
81f2806578ed
(create_frame_gcs, setup_frame_gcs): Reformat long statements.
Karl Heuer <kwzh@gnu.org>
parents:
11884
diff
changeset
|
593 (unsigned long)0, (unsigned long)1, |
|
81f2806578ed
(create_frame_gcs, setup_frame_gcs): Reformat long statements.
Karl Heuer <kwzh@gnu.org>
parents:
11884
diff
changeset
|
594 ew->core.depth); |
| 5626 | 595 |
| 596 /* Normal video */ | |
| 597 gc_values.foreground = ew->emacs_frame.foreground_pixel; | |
| 598 gc_values.background = ew->core.background_pixel; | |
| 599 gc_values.graphics_exposures = False; | |
| 600 gc_values.stipple = blank_stipple; | |
| 601 gc_values.tile = blank_tile; | |
| 12671 | 602 XChangeGC (XtDisplay (ew), s->output_data.x->normal_gc, |
|
97731
90335c3336b0
Include character.h and font.h for XSETFONT.
Chong Yidong <cyd@stupidchicken.com>
parents:
94963
diff
changeset
|
603 valuemask, &gc_values); |
| 5626 | 604 |
| 605 /* Reverse video style. */ | |
| 606 gc_values.foreground = ew->core.background_pixel; | |
| 607 gc_values.background = ew->emacs_frame.foreground_pixel; | |
| 608 gc_values.graphics_exposures = False; | |
| 609 gc_values.stipple = blank_stipple; | |
| 610 gc_values.tile = blank_tile; | |
| 12671 | 611 XChangeGC (XtDisplay (ew), s->output_data.x->reverse_gc, |
|
97731
90335c3336b0
Include character.h and font.h for XSETFONT.
Chong Yidong <cyd@stupidchicken.com>
parents:
94963
diff
changeset
|
612 valuemask, &gc_values); |
| 5626 | 613 |
| 614 /* Cursor has to have an empty stipple. */ | |
| 615 gc_values.foreground = ew->core.background_pixel; | |
| 616 gc_values.background = ew->emacs_frame.cursor_color; | |
| 617 gc_values.graphics_exposures = False; | |
| 618 gc_values.tile = blank_tile; | |
|
11895
81f2806578ed
(create_frame_gcs, setup_frame_gcs): Reformat long statements.
Karl Heuer <kwzh@gnu.org>
parents:
11884
diff
changeset
|
619 gc_values.stipple |
|
81f2806578ed
(create_frame_gcs, setup_frame_gcs): Reformat long statements.
Karl Heuer <kwzh@gnu.org>
parents:
11884
diff
changeset
|
620 = XCreateBitmapFromData (XtDisplay (ew), |
|
81f2806578ed
(create_frame_gcs, setup_frame_gcs): Reformat long statements.
Karl Heuer <kwzh@gnu.org>
parents:
11884
diff
changeset
|
621 RootWindowOfScreen (XtScreen (ew)), |
|
81f2806578ed
(create_frame_gcs, setup_frame_gcs): Reformat long statements.
Karl Heuer <kwzh@gnu.org>
parents:
11884
diff
changeset
|
622 setup_frame_cursor_bits, 16, 16); |
| 12671 | 623 XChangeGC (XtDisplay (ew), s->output_data.x->cursor_gc, |
|
97731
90335c3336b0
Include character.h and font.h for XSETFONT.
Chong Yidong <cyd@stupidchicken.com>
parents:
94963
diff
changeset
|
624 valuemask, &gc_values); |
| 5626 | 625 } |
| 626 | |
| 627 static void | |
|
109372
dd04c65fb401
Convert function definitions to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106815
diff
changeset
|
628 update_various_frame_slots (EmacsFrame ew) |
| 5626 | 629 { |
|
51206
22a5614b558f
Make (few) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents:
50099
diff
changeset
|
630 struct frame *f = ew->emacs_frame.frame; |
|
22a5614b558f
Make (few) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents:
50099
diff
changeset
|
631 struct x_output *x = f->output_data.x; |
|
22a5614b558f
Make (few) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents:
50099
diff
changeset
|
632 FRAME_PIXEL_HEIGHT (f) = ew->core.height + x->menubar_height; |
|
22a5614b558f
Make (few) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents:
50099
diff
changeset
|
633 FRAME_PIXEL_WIDTH (f) = ew->core.width; |
|
22a5614b558f
Make (few) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents:
50099
diff
changeset
|
634 f->internal_border_width = ew->emacs_frame.internal_border_width; |
| 5626 | 635 |
| 636 } | |
| 637 | |
| 638 static void | |
|
109372
dd04c65fb401
Convert function definitions to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106815
diff
changeset
|
639 update_from_various_frame_slots (EmacsFrame ew) |
| 5626 | 640 { |
|
51206
22a5614b558f
Make (few) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents:
50099
diff
changeset
|
641 struct frame *f = ew->emacs_frame.frame; |
|
22a5614b558f
Make (few) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents:
50099
diff
changeset
|
642 struct x_output *x = f->output_data.x; |
|
22a5614b558f
Make (few) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents:
50099
diff
changeset
|
643 ew->core.height = FRAME_PIXEL_HEIGHT (f) - x->menubar_height; |
|
22a5614b558f
Make (few) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents:
50099
diff
changeset
|
644 ew->core.width = FRAME_PIXEL_WIDTH (f); |
|
83504
7aa43f830ce4
Fix tooltip border color.
Karoly Lorentey <lorentey@elte.hu>
parents:
68651
diff
changeset
|
645 ew->core.background_pixel = FRAME_BACKGROUND_PIXEL (f); |
|
51206
22a5614b558f
Make (few) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents:
50099
diff
changeset
|
646 ew->emacs_frame.internal_border_width = f->internal_border_width; |
| 5626 | 647 ew->emacs_frame.font = x->font; |
|
83504
7aa43f830ce4
Fix tooltip border color.
Karoly Lorentey <lorentey@elte.hu>
parents:
68651
diff
changeset
|
648 ew->emacs_frame.foreground_pixel = FRAME_FOREGROUND_PIXEL (f); |
| 5626 | 649 ew->emacs_frame.cursor_color = x->cursor_pixel; |
| 650 ew->core.border_pixel = x->border_pixel; | |
| 651 } | |
| 652 | |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
44671
diff
changeset
|
653 static void |
|
109372
dd04c65fb401
Convert function definitions to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106815
diff
changeset
|
654 EmacsFrameInitialize (Widget request, Widget new, ArgList dum1, Cardinal *dum2) |
| 5626 | 655 { |
| 656 EmacsFrame ew = (EmacsFrame)new; | |
| 657 | |
| 658 if (!ew->emacs_frame.frame) | |
| 659 { | |
| 660 fprintf (stderr, | |
| 661 "can't create an emacs frame widget without a frame\n"); | |
| 662 exit (1); | |
| 663 } | |
| 664 | |
| 665 update_from_various_frame_slots (ew); | |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
44671
diff
changeset
|
666 set_frame_size (ew); |
| 5626 | 667 } |
| 668 | |
| 669 | |
| 670 static void | |
|
109372
dd04c65fb401
Convert function definitions to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106815
diff
changeset
|
671 EmacsFrameRealize (Widget widget, XtValueMask *mask, XSetWindowAttributes *attrs) |
| 5626 | 672 { |
| 673 EmacsFrame ew = (EmacsFrame)widget; | |
| 674 | |
|
29861
09d316feea21
(EmacsFrameRealize): Remove SubstructureRedirectMask.
Gerd Moellmann <gerd@gnu.org>
parents:
27342
diff
changeset
|
675 /* This used to contain SubstructureRedirectMask, but this turns out |
|
09d316feea21
(EmacsFrameRealize): Remove SubstructureRedirectMask.
Gerd Moellmann <gerd@gnu.org>
parents:
27342
diff
changeset
|
676 to be a problem with XIM on Solaris, and events from that mask |
|
29863
bd4f71c0f33b
(EmacsFrameRealize): Fix typo.
Gerd Moellmann <gerd@gnu.org>
parents:
29861
diff
changeset
|
677 don't seem to be used. Let's check that. */ |
|
29861
09d316feea21
(EmacsFrameRealize): Remove SubstructureRedirectMask.
Gerd Moellmann <gerd@gnu.org>
parents:
27342
diff
changeset
|
678 attrs->event_mask = (STANDARD_EVENT_SET |
|
09d316feea21
(EmacsFrameRealize): Remove SubstructureRedirectMask.
Gerd Moellmann <gerd@gnu.org>
parents:
27342
diff
changeset
|
679 | PropertyChangeMask |
|
09d316feea21
(EmacsFrameRealize): Remove SubstructureRedirectMask.
Gerd Moellmann <gerd@gnu.org>
parents:
27342
diff
changeset
|
680 | SubstructureNotifyMask); |
| 5626 | 681 *mask |= CWEventMask; |
| 682 XtCreateWindow (widget, InputOutput, (Visual *)CopyFromParent, *mask, | |
| 683 attrs); | |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
44671
diff
changeset
|
684 update_wm_hints (ew); |
| 5626 | 685 } |
| 686 | |
|
109372
dd04c65fb401
Convert function definitions to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106815
diff
changeset
|
687 extern void free_frame_faces (struct frame *); |
| 5626 | 688 |
| 689 static void | |
|
109372
dd04c65fb401
Convert function definitions to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106815
diff
changeset
|
690 EmacsFrameDestroy (Widget widget) |
| 5626 | 691 { |
| 692 EmacsFrame ew = (EmacsFrame) widget; | |
| 693 struct frame* s = ew->emacs_frame.frame; | |
| 694 | |
| 695 if (! s) abort (); | |
| 12671 | 696 if (! s->output_data.x) abort (); |
| 5626 | 697 |
|
12052
942ad27b8e10
(EmacsFrameDestroy): Block and unblock input.
Karl Heuer <kwzh@gnu.org>
parents:
11895
diff
changeset
|
698 BLOCK_INPUT; |
|
34319
d446a08a996e
(EmacsFrameDestroy): Call x_free_gcs instead of
Gerd Moellmann <gerd@gnu.org>
parents:
30575
diff
changeset
|
699 x_free_gcs (s); |
|
24999
bd6d15dc5a10
(EmacsFrameSetCharSize): Take widget's border width
Gerd Moellmann <gerd@gnu.org>
parents:
21514
diff
changeset
|
700 if (s->output_data.x->white_relief.gc) |
|
bd6d15dc5a10
(EmacsFrameSetCharSize): Take widget's border width
Gerd Moellmann <gerd@gnu.org>
parents:
21514
diff
changeset
|
701 XFreeGC (XtDisplay (widget), s->output_data.x->white_relief.gc); |
|
bd6d15dc5a10
(EmacsFrameSetCharSize): Take widget's border width
Gerd Moellmann <gerd@gnu.org>
parents:
21514
diff
changeset
|
702 if (s->output_data.x->black_relief.gc) |
|
bd6d15dc5a10
(EmacsFrameSetCharSize): Take widget's border width
Gerd Moellmann <gerd@gnu.org>
parents:
21514
diff
changeset
|
703 XFreeGC (XtDisplay (widget), s->output_data.x->black_relief.gc); |
|
12052
942ad27b8e10
(EmacsFrameDestroy): Block and unblock input.
Karl Heuer <kwzh@gnu.org>
parents:
11895
diff
changeset
|
704 UNBLOCK_INPUT; |
| 5626 | 705 } |
| 706 | |
| 707 void | |
|
109372
dd04c65fb401
Convert function definitions to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106815
diff
changeset
|
708 EmacsFrameResize (Widget widget) |
| 5626 | 709 { |
| 710 EmacsFrame ew = (EmacsFrame)widget; | |
| 711 struct frame *f = ew->emacs_frame.frame; | |
| 712 int columns; | |
| 713 int rows; | |
| 714 | |
| 715 pixel_to_char_size (ew, ew->core.width, ew->core.height, &columns, &rows); | |
|
25356
5db69f7aadca
Call change_frame_size and do_pending_window_change with
Gerd Moellmann <gerd@gnu.org>
parents:
25151
diff
changeset
|
716 change_frame_size (f, rows, columns, 0, 1, 0); |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
44671
diff
changeset
|
717 update_wm_hints (ew); |
| 5626 | 718 update_various_frame_slots (ew); |
|
16492
2ddccd78c6b0
(EmacsFrameResize): Use cancel_mouse_face.
Richard M. Stallman <rms@gnu.org>
parents:
16350
diff
changeset
|
719 |
|
2ddccd78c6b0
(EmacsFrameResize): Use cancel_mouse_face.
Richard M. Stallman <rms@gnu.org>
parents:
16350
diff
changeset
|
720 cancel_mouse_face (f); |
| 5626 | 721 } |
| 722 | |
| 723 static Boolean | |
|
109372
dd04c65fb401
Convert function definitions to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106815
diff
changeset
|
724 EmacsFrameSetValues (Widget cur_widget, Widget req_widget, Widget new_widget, ArgList dum1, Cardinal *dum2) |
| 5626 | 725 { |
| 726 EmacsFrame cur = (EmacsFrame)cur_widget; | |
| 727 EmacsFrame new = (EmacsFrame)new_widget; | |
| 728 | |
| 729 Boolean needs_a_refresh = False; | |
| 730 Boolean has_to_recompute_size; | |
| 731 Boolean has_to_recompute_gcs; | |
| 732 Boolean has_to_update_hints; | |
| 733 | |
| 734 int char_width, char_height; | |
| 735 Dimension pixel_width; | |
| 736 Dimension pixel_height; | |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
44671
diff
changeset
|
737 |
|
105693
964ff7cbc8a6
Fix resize due to font change on a maximized/xmonad-controlled frame.
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
738 /* AFAIK, this function is never called. -- Jan D, Oct 2009. */ |
| 5626 | 739 has_to_recompute_gcs = (cur->emacs_frame.font != new->emacs_frame.font |
| 740 || (cur->emacs_frame.foreground_pixel | |
| 741 != new->emacs_frame.foreground_pixel) | |
| 742 || (cur->core.background_pixel | |
| 743 != new->core.background_pixel) | |
| 744 ); | |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
44671
diff
changeset
|
745 |
| 5626 | 746 has_to_recompute_size = (cur->emacs_frame.font != new->emacs_frame.font |
| 747 && cur->core.width == new->core.width | |
| 748 && cur->core.height == new->core.height); | |
| 749 | |
| 750 has_to_update_hints = (cur->emacs_frame.font != new->emacs_frame.font); | |
| 751 | |
| 752 if (has_to_recompute_gcs) | |
| 753 { | |
| 754 setup_frame_gcs (new); | |
| 755 needs_a_refresh = True; | |
| 756 } | |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
44671
diff
changeset
|
757 |
| 5626 | 758 if (has_to_recompute_size) |
| 759 { | |
| 760 pixel_width = new->core.width; | |
| 761 pixel_height = new->core.height; | |
| 762 pixel_to_char_size (new, pixel_width, pixel_height, &char_width, | |
| 763 &char_height); | |
| 764 char_to_pixel_size (new, char_width, char_height, &pixel_width, | |
| 765 &pixel_height); | |
| 766 new->core.width = pixel_width; | |
| 767 new->core.height = pixel_height; | |
| 768 | |
| 769 change_frame_size (new->emacs_frame.frame, char_height, char_width, | |
|
25356
5db69f7aadca
Call change_frame_size and do_pending_window_change with
Gerd Moellmann <gerd@gnu.org>
parents:
25151
diff
changeset
|
770 1, 0, 0); |
| 5626 | 771 needs_a_refresh = True; |
| 772 } | |
| 773 | |
| 774 if (has_to_update_hints) | |
| 775 update_wm_hints (new); | |
| 776 | |
| 777 update_various_frame_slots (new); | |
| 778 | |
| 779 /* #### This doesn't work, I haven't been able to find ANY kludge that | |
| 780 will let (x-create-frame '((iconic . t))) work. It seems that changes | |
| 781 to wm_shell's iconic slot have no effect after it has been realized, | |
| 17166 | 782 and calling XIconifyWindow doesn't work either (even though the window |
| 5626 | 783 has been created.) Perhaps there is some property we could smash |
| 14620 | 784 directly, but I'm sick of this for now. |
| 5626 | 785 */ |
| 786 if (cur->emacs_frame.iconic != new->emacs_frame.iconic) | |
| 787 { | |
| 788 Widget wmshell = get_wm_shell ((Widget) cur); | |
|
38182
fd45b8013008
(EmacsFrameSetCharSize): Set XtNwaitForWm depending
Gerd Moellmann <gerd@gnu.org>
parents:
37699
diff
changeset
|
789 XtVaSetValues (wmshell, XtNiconic, |
|
fd45b8013008
(EmacsFrameSetCharSize): Set XtNwaitForWm depending
Gerd Moellmann <gerd@gnu.org>
parents:
37699
diff
changeset
|
790 (XtArgVal) new->emacs_frame.iconic, NULL); |
| 5626 | 791 } |
| 792 | |
| 793 return needs_a_refresh; | |
| 794 } | |
| 795 | |
| 796 static XtGeometryResult | |
|
109372
dd04c65fb401
Convert function definitions to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106815
diff
changeset
|
797 EmacsFrameQueryGeometry (Widget widget, XtWidgetGeometry *request, XtWidgetGeometry *result) |
| 5626 | 798 { |
| 799 EmacsFrame ew = (EmacsFrame)widget; | |
| 800 | |
| 801 int mask = request->request_mode; | |
| 802 Dimension ok_width, ok_height; | |
| 803 | |
| 804 if (mask & (CWWidth | CWHeight)) | |
| 805 { | |
| 806 round_size_to_char (ew, | |
| 807 (mask & CWWidth) ? request->width : ew->core.width, | |
| 808 ((mask & CWHeight) ? request->height | |
| 809 : ew->core.height), | |
| 810 &ok_width, &ok_height); | |
| 811 if ((mask & CWWidth) && (ok_width != request->width)) | |
| 812 { | |
| 813 result->request_mode |= CWWidth; | |
| 814 result->width = ok_width; | |
| 815 } | |
| 816 if ((mask & CWHeight) && (ok_height != request->height)) | |
| 817 { | |
| 818 result->request_mode |= CWHeight; | |
| 819 result->height = ok_height; | |
| 820 } | |
| 821 } | |
| 822 return result->request_mode ? XtGeometryAlmost : XtGeometryYes; | |
| 823 } | |
| 824 | |
| 825 /* Special entrypoints */ | |
| 826 void | |
|
109372
dd04c65fb401
Convert function definitions to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106815
diff
changeset
|
827 EmacsFrameSetCharSize (Widget widget, int columns, int rows) |
| 5626 | 828 { |
| 829 EmacsFrame ew = (EmacsFrame) widget; | |
|
6087
00fbbb620f36
(EmacsFrameSetCharSize): Call check_frame_size and update
Fred Pierresteguy <F.Pierresteguy@frcl.bull.fr>
parents:
5994
diff
changeset
|
830 struct frame *f = ew->emacs_frame.frame; |
|
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
44671
diff
changeset
|
831 |
|
105693
964ff7cbc8a6
Fix resize due to font change on a maximized/xmonad-controlled frame.
Jan Dj?rv <jan.h.d@swipnet.se>
parents:
105669
diff
changeset
|
832 x_set_window_size (f, 0, columns, rows); |
| 5626 | 833 } |
|
24999
bd6d15dc5a10
(EmacsFrameSetCharSize): Take widget's border width
Gerd Moellmann <gerd@gnu.org>
parents:
21514
diff
changeset
|
834 |
|
16350
773a9eb73ce9
(widget_store_internal_border): New function.
Richard M. Stallman <rms@gnu.org>
parents:
16300
diff
changeset
|
835 |
| 21514 | 836 void |
|
109372
dd04c65fb401
Convert function definitions to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
106815
diff
changeset
|
837 widget_store_internal_border (Widget widget) |
|
16350
773a9eb73ce9
(widget_store_internal_border): New function.
Richard M. Stallman <rms@gnu.org>
parents:
16300
diff
changeset
|
838 { |
|
773a9eb73ce9
(widget_store_internal_border): New function.
Richard M. Stallman <rms@gnu.org>
parents:
16300
diff
changeset
|
839 EmacsFrame ew = (EmacsFrame) widget; |
|
773a9eb73ce9
(widget_store_internal_border): New function.
Richard M. Stallman <rms@gnu.org>
parents:
16300
diff
changeset
|
840 FRAME_PTR f = ew->emacs_frame.frame; |
|
773a9eb73ce9
(widget_store_internal_border): New function.
Richard M. Stallman <rms@gnu.org>
parents:
16300
diff
changeset
|
841 |
|
51206
22a5614b558f
Make (few) trivial substitutions for renamed and
Kim F. Storm <storm@cua.dk>
parents:
50099
diff
changeset
|
842 ew->emacs_frame.internal_border_width = f->internal_border_width; |
|
16350
773a9eb73ce9
(widget_store_internal_border): New function.
Richard M. Stallman <rms@gnu.org>
parents:
16300
diff
changeset
|
843 } |
| 52401 | 844 |
| 845 /* arch-tag: 931d28e5-0d59-405a-8325-7d475d0a13d9 | |
| 846 (do not change this comment) */ |
