comparison src/frame-msw.c @ 269:b2472a1930f2 r20-5b33

Import from CVS: tag r20-5b33
author cvs
date Mon, 13 Aug 2007 10:27:19 +0200
parents 83b3d10dcba9
children c5d627a313b1
comparison
equal deleted inserted replaced
268:6ced69ccd85f 269:b2472a1930f2
29 */ 29 */
30 30
31 #include <config.h> 31 #include <config.h>
32 #include "lisp.h" 32 #include "lisp.h"
33 33
34 #include "buffer.h"
34 #include "console-msw.h" 35 #include "console-msw.h"
35 36 #include "events.h"
36 #include "buffer.h"
37 #include "faces.h" 37 #include "faces.h"
38 #include "frame.h" 38 #include "frame.h"
39 #include "events.h" 39 #include "redisplay.h"
40 40
41 #define MSWINDOWS_FRAME_STYLE WS_CLIPCHILDREN|WS_CLIPSIBLINGS|WS_OVERLAPPEDWINDOW 41 #define MSWINDOWS_FRAME_STYLE (WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_OVERLAPPEDWINDOW)
42 #define MSWINDOWS_POPUP_STYLE WS_CLIPCHILDREN|WS_CLIPSIBLINGS|WS_CAPTION|WS_POPUP 42 #define MSWINDOWS_POPUP_STYLE (WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_POPUP \
43 | WS_CAPTION | WS_BORDER | WS_SYSMENU | WS_MINIMIZEBOX)
43 44
44 #define MSWINDOWS_FRAME_EXSTYLE WS_EX_OVERLAPPEDWINDOW 45 #define MSWINDOWS_FRAME_EXSTYLE WS_EX_OVERLAPPEDWINDOW
45 #define MSWINDOWS_POPUP_EXSTYLE WS_EX_OVERLAPPEDWINDOW 46 #define MSWINDOWS_POPUP_EXSTYLE WS_EX_PALETTEWINDOW
47
48 /* Default popup left top corner offset from the same
49 corner of the parent frame, in pixel */
50 #define POPUP_OFFSET 30
51
52 /* Default popup size, in characters */
53 #define POPUP_WIDTH 30
54 #define POPUP_HEIGHT 10
46 55
47 #ifdef HAVE_MENUBARS 56 #ifdef HAVE_MENUBARS
48 #define ADJR_MENUFLAG TRUE 57 #define ADJR_MENUFLAG TRUE
49 #else 58 #else
50 #define ADJR_MENUFLAG FALSE 59 #define ADJR_MENUFLAG FALSE
51 #endif 60 #endif
52 61
53 /* Default properties to use when creating frames. */ 62 /* Default properties to use when creating frames. */
54 Lisp_Object Vdefault_mswindows_frame_plist; 63 Lisp_Object Vdefault_mswindows_frame_plist;
64
55 /* Lisp_Object Qname, Qheight, Qwidth, Qinitially_unmapped, Qpopup, Qtop, Qleft; */ 65 /* Lisp_Object Qname, Qheight, Qwidth, Qinitially_unmapped, Qpopup, Qtop, Qleft; */
56 Lisp_Object Qinitially_unmapped, Qpopup; 66 Lisp_Object Qinitially_unmapped, Qpopup;
67
68 /* This does not need to be GC protected, as it holds a
69 frame Lisp_Object already protected by Fmake_frame */
70 Lisp_Object mswindows_frame_being_created;
71
72 /* Geometry, in characters, as specified by proplist during frame
73 creation. Memebers are set to -1 for unspecified */
74 XEMACS_RECT_WH mswindows_frame_target_rect;
57 75
58 static void 76 static void
59 mswindows_init_frame_1 (struct frame *f, Lisp_Object props) 77 mswindows_init_frame_1 (struct frame *f, Lisp_Object props)
60 { 78 {
61 Lisp_Object device = FRAME_DEVICE (f); 79 Lisp_Object device = FRAME_DEVICE (f);
62 Lisp_Object initially_unmapped; 80 Lisp_Object initially_unmapped;
63 Lisp_Object name, height, width, popup, top, left; 81 Lisp_Object name, height, width, popup, top, left;
64 Lisp_Object frame_obj; 82 Lisp_Object frame_obj = Qnil;
65 RECT rect; 83 RECT rect;
84 XEMACS_RECT_WH rect_default;
66 DWORD style, exstyle; 85 DWORD style, exstyle;
67 86 HWND hwnd, hwnd_parent;
87
88 /* Pick up relevant properties */
68 initially_unmapped = Fplist_get (props, Qinitially_unmapped, Qnil); 89 initially_unmapped = Fplist_get (props, Qinitially_unmapped, Qnil);
69 name = Fplist_get (props, Qname, Qnil); 90 name = Fplist_get (props, Qname, Qnil);
91
92 popup = Fplist_get (props, Qpopup, Qnil);
93 if (EQ (popup, Qt))
94 popup = Fselected_frame (Qnil);
95
96 left = Fplist_get (props, Qleft, Qnil);
97 if (!NILP (left))
98 CHECK_INT (left);
99
100 top = Fplist_get (props, Qtop, Qnil);
101 if (!NILP (top))
102 CHECK_INT (top);
103
104 width = Fplist_get (props, Qwidth, Qnil);
105 if (!NILP (width))
106 CHECK_INT (width);
107
70 height = Fplist_get (props, Qheight, Qnil); 108 height = Fplist_get (props, Qheight, Qnil);
71 width = Fplist_get (props, Qwidth, Qnil); 109 if (!NILP (height))
72 popup = Fplist_get (props, Qpopup, Qnil); 110 CHECK_INT (height);
73 top = Fplist_get (props, Qtop, Qnil); 111
74 left = Fplist_get (props, Qleft, Qnil); 112 mswindows_frame_target_rect.left = NILP (left) ? -1 : abs (XINT (left));
113 mswindows_frame_target_rect.top = NILP (top) ? -1 : abs (XINT (top));
114 mswindows_frame_target_rect.width = NILP (width) ? -1 : abs (XINT (width));
115 mswindows_frame_target_rect.height = NILP (height) ? -1 : abs (XINT (height));
75 116
76 /* These shouldn't be here, but the window is created too early. 117 /* These shouldn't be here, but the window is created too early.
77 The initialization of scrollbar resources is done between 118 The initialization of scrollbar resources is done between
78 init_frame_1 and init_frame_2 in make_frame. jsparkes */ 119 init_frame_1 and init_frame_2 in make_frame. jsparkes */
79 f->scrollbar_width = make_int (15); 120 f->scrollbar_width = make_int (15);
80 f->scrollbar_height = make_int (15); 121 f->scrollbar_height = make_int (15);
81 122
82 f->frame_data = xnew_and_zero (struct mswindows_frame); 123 f->frame_data = xnew_and_zero (struct mswindows_frame);
83 FRAME_WIDTH (f) = INTP(width) ? XINT(width) : 80; 124
84 FRAME_HEIGHT (f) = INTP(height) ? XINT(height) : 30; 125 /* Misc frame stuff */
85 char_to_pixel_size (f, FRAME_WIDTH(f), FRAME_HEIGHT (f),
86 &FRAME_PIXWIDTH (f), &FRAME_PIXHEIGHT (f));
87
88 style = (NILP(popup)) ? MSWINDOWS_FRAME_STYLE : MSWINDOWS_POPUP_STYLE;
89 exstyle = (NILP(popup)) ? MSWINDOWS_FRAME_EXSTYLE : MSWINDOWS_POPUP_EXSTYLE;
90 rect.left = rect.top = 0;
91 rect.right = FRAME_PIXWIDTH (f);
92 rect.bottom = FRAME_PIXHEIGHT (f);
93
94 FRAME_MSWINDOWS_DATA(f)->button2_need_lbutton = 0; 126 FRAME_MSWINDOWS_DATA(f)->button2_need_lbutton = 0;
95 FRAME_MSWINDOWS_DATA(f)->button2_need_rbutton = 0; 127 FRAME_MSWINDOWS_DATA(f)->button2_need_rbutton = 0;
96 FRAME_MSWINDOWS_DATA(f)->button2_is_down = 0; 128 FRAME_MSWINDOWS_DATA(f)->button2_is_down = 0;
97 FRAME_MSWINDOWS_DATA(f)->ignore_next_lbutton_up = 0; 129 FRAME_MSWINDOWS_DATA(f)->ignore_next_lbutton_up = 0;
98 FRAME_MSWINDOWS_DATA(f)->ignore_next_rbutton_up = 0; 130 FRAME_MSWINDOWS_DATA(f)->ignore_next_rbutton_up = 0;
99 FRAME_MSWINDOWS_DATA(f)->sizing = 0; 131 FRAME_MSWINDOWS_DATA(f)->sizing = 0;
100 132
101 FRAME_MSWINDOWS_MENU_HASHTABLE(f) = Qnil; 133 FRAME_MSWINDOWS_MENU_HASHTABLE(f) = Qnil;
102 134
135 /* Will initialize these in WM_SIZE handler. We cannot do it now,
136 because we do not know what is CW_USEDEFAULT height and width */
137 FRAME_WIDTH (f) = 0;
138 FRAME_HEIGHT (f) = 0;
139 FRAME_PIXWIDTH (f) = 0;
140 FRAME_PIXHEIGHT (f) = 0;
141
142 if (NILP (popup))
143 {
144 style = MSWINDOWS_FRAME_STYLE;
145 exstyle = MSWINDOWS_FRAME_EXSTYLE;
146 hwnd_parent = NULL;
147
148 /* We always create am overlapped frame with default size,
149 and later adjust only requested geometry parameters. */
150 rect_default.left = rect_default.top = CW_USEDEFAULT;
151 rect_default.width = rect_default.height = CW_USEDEFAULT;
152 }
153 else
154 {
155 style = MSWINDOWS_POPUP_STYLE;
156 exstyle = MSWINDOWS_POPUP_EXSTYLE;
157
158 CHECK_MSWINDOWS_FRAME (popup);
159 hwnd_parent = FRAME_MSWINDOWS_HANDLE (XFRAME (popup));
160 assert (IsWindow (hwnd_parent));
161
162 /* We cannot use CW_USEDEFAULT when creating a popup window.
163 So by default, we offset the new popup 30 pixels right
164 and down from its parent, and give it size of 30x10 characters.
165 These dimensions look adequate on both high and low res monitors */
166 GetWindowRect (hwnd_parent, &rect);
167 rect_default.left = rect.left + POPUP_OFFSET;
168 rect_default.top = rect.top + POPUP_OFFSET;
169 char_to_real_pixel_size (f, POPUP_WIDTH, POPUP_HEIGHT,
170 &rect_default.width, &rect_default.height);
171 }
172
103 AdjustWindowRectEx(&rect, style, ADJR_MENUFLAG, exstyle); 173 AdjustWindowRectEx(&rect, style, ADJR_MENUFLAG, exstyle);
104 174
105 FRAME_MSWINDOWS_HANDLE(f) =
106 CreateWindowEx (exstyle,
107 XEMACS_CLASS,
108 STRINGP(f->name) ? XSTRING_DATA(f->name) :
109 (STRINGP(name) ? XSTRING_DATA(name) : XEMACS_CLASS),
110 style,
111 INTP(left) ? XINT(left) : CW_USEDEFAULT,
112 INTP(top) ? XINT(top) : CW_USEDEFAULT,
113 rect.right-rect.left, rect.bottom-rect.top,
114 NULL, NULL, NULL, NULL);
115 XSETFRAME (frame_obj, f); 175 XSETFRAME (frame_obj, f);
116 SetWindowLong (FRAME_MSWINDOWS_HANDLE(f), XWL_FRAMEOBJ, (LONG)frame_obj); 176
117 FRAME_MSWINDOWS_DC(f) = GetDC(FRAME_MSWINDOWS_HANDLE(f)); 177 mswindows_frame_being_created = frame_obj;
118 SetTextAlign(FRAME_MSWINDOWS_DC(f), TA_BASELINE|TA_LEFT|TA_NOUPDATECP); 178
119 } 179 hwnd = CreateWindowEx (exstyle,
120 180 XEMACS_CLASS,
121 /* Called just before frame's properties are set, size is 10x10 or something */ 181 STRINGP(f->name) ? XSTRING_DATA(f->name) :
182 (STRINGP(name) ? XSTRING_DATA(name) : XEMACS_CLASS),
183 style,
184 rect_default.left, rect_default.top,
185 rect_default.width, rect_default.height,
186 hwnd_parent, NULL, NULL, NULL);
187
188 mswindows_frame_being_created = Qnil;
189
190 if (hwnd == NULL)
191 error ("System call to create frame failed");
192
193 FRAME_MSWINDOWS_HANDLE(f) = hwnd;
194
195 SetWindowLong (hwnd, XWL_FRAMEOBJ, (LONG)LISP_TO_VOID(frame_obj));
196 FRAME_MSWINDOWS_DC(f) = GetDC (hwnd);
197 FRAME_MSWINDOWS_CDC(f) = CreateCompatibleDC (FRAME_MSWINDOWS_CDC(f));
198 SetTextAlign (FRAME_MSWINDOWS_DC(f), TA_BASELINE | TA_LEFT | TA_NOUPDATECP);
199 }
200
201 #if 0 /* #### unused */
122 static void 202 static void
123 mswindows_init_frame_2 (struct frame *f, Lisp_Object props) 203 mswindows_init_frame_2 (struct frame *f, Lisp_Object props)
124 { 204 {
125 } 205 }
206 #endif
126 207
127 /* Called after frame's properties are set */ 208 /* Called after frame's properties are set */
128 static void 209 static void
129 mswindows_init_frame_3 (struct frame *f) 210 mswindows_init_frame_3 (struct frame *f)
130 { 211 {
131 /* Don't do this earlier or we get a WM_PAINT before the frame is ready*/ 212 /* Don't do this earlier or we get a WM_PAINT before the frame is ready */
132 ShowWindow (FRAME_MSWINDOWS_HANDLE(f), SW_SHOWNORMAL); 213 ShowWindow (FRAME_MSWINDOWS_HANDLE(f), SW_SHOWNORMAL);
133 SetForegroundWindow (FRAME_MSWINDOWS_HANDLE(f)); 214 SetForegroundWindow (FRAME_MSWINDOWS_HANDLE(f));
134 DragAcceptFiles (FRAME_MSWINDOWS_HANDLE(f), TRUE); 215 DragAcceptFiles (FRAME_MSWINDOWS_HANDLE(f), TRUE);
135 } 216 }
136 217
137 static void 218 static void
219 mswindows_after_init_frame (struct frame *f, int first_on_device,
220 int first_on_console)
221 {
222 /* Windows, unlike X, is very synchronous. After the initial
223 frame is created, it will never be displayed, except for
224 hollow border, unless we start pumping messages. Load progress
225 messages show in the bottom of the hollow frame, which is ugly.
226 We redipsplay the initial frame here, so modeline and root window
227 backgorund show.
228 */
229 if (first_on_console)
230 redisplay ();
231 }
232
233 static void
138 mswindows_mark_frame (struct frame *f, void (*markobj) (Lisp_Object)) 234 mswindows_mark_frame (struct frame *f, void (*markobj) (Lisp_Object))
139 { 235 {
140 ((markobj) (FRAME_MSWINDOWS_MENU_HASHTABLE (f))); 236 ((markobj) (FRAME_MSWINDOWS_MENU_HASHTABLE (f)));
141 } 237 }
142 238
143 static void 239 static void
144 mswindows_focus_on_frame (struct frame *f) 240 mswindows_focus_on_frame (struct frame *f)
145 { 241 {
146 SetForegroundWindow (FRAME_MSWINDOWS_HANDLE(f)); 242 SetForegroundWindow (FRAME_MSWINDOWS_HANDLE(f));
147 } 243 }
148 244
149 static void 245 static void
150 mswindows_delete_frame (struct frame *f) 246 mswindows_delete_frame (struct frame *f)
151 { 247 {
152 if (f->frame_data) 248 if (f->frame_data)
153 { 249 {
250 DeleteDC(FRAME_MSWINDOWS_CDC(f));
154 ReleaseDC(FRAME_MSWINDOWS_HANDLE(f), FRAME_MSWINDOWS_DC(f)); 251 ReleaseDC(FRAME_MSWINDOWS_HANDLE(f), FRAME_MSWINDOWS_DC(f));
155 DestroyWindow(FRAME_MSWINDOWS_HANDLE(f)); 252 DestroyWindow(FRAME_MSWINDOWS_HANDLE(f));
253 xfree (f->frame_data);
156 } 254 }
255 f->frame_data = 0;
157 } 256 }
158 257
159 static void 258 static void
160 mswindows_set_frame_size (struct frame *f, int cols, int rows) 259 mswindows_set_frame_size (struct frame *f, int cols, int rows)
161 { 260 {
162 RECT rect1, rect2; 261 RECT rect;
163 262 rect.left = rect.top = 0;
164 GetWindowRect (FRAME_MSWINDOWS_HANDLE(f), &rect1); 263 rect.right = cols;
165 rect2.left = rect2.top = 0; 264 rect.bottom = rows;
166 char_to_pixel_size (f, cols, rows, &rect2.right, &rect2.bottom); 265
167 266 AdjustWindowRectEx (&rect,
168 AdjustWindowRectEx (&rect2,
169 GetWindowLong (FRAME_MSWINDOWS_HANDLE(f), GWL_STYLE), 267 GetWindowLong (FRAME_MSWINDOWS_HANDLE(f), GWL_STYLE),
170 GetMenu (FRAME_MSWINDOWS_HANDLE(f)) != NULL, 268 GetMenu (FRAME_MSWINDOWS_HANDLE(f)) != NULL,
171 GetWindowLong (FRAME_MSWINDOWS_HANDLE(f), GWL_EXSTYLE)); 269 GetWindowLong (FRAME_MSWINDOWS_HANDLE(f), GWL_EXSTYLE));
172 270
173 MoveWindow (FRAME_MSWINDOWS_HANDLE(f), rect1.left, rect1.top, 271 if (IsIconic (FRAME_MSWINDOWS_HANDLE(f)) || IsZoomed (FRAME_MSWINDOWS_HANDLE(f)))
174 rect2.right-rect2.left, rect2.bottom-rect2.top, TRUE); 272 ShowWindow (FRAME_MSWINDOWS_HANDLE(f), SW_RESTORE);
273
274 SetWindowPos (FRAME_MSWINDOWS_HANDLE(f), NULL,
275 0, 0, rect.right-rect.left, rect.bottom-rect.top,
276 SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOSENDCHANGING | SWP_NOMOVE);
175 } 277 }
176 278
177 static void 279 static void
178 mswindows_set_frame_position (struct frame *f, int xoff, int yoff) 280 mswindows_set_frame_position (struct frame *f, int xoff, int yoff)
179 { 281 {
180 RECT rect; 282 SetWindowPos (FRAME_MSWINDOWS_HANDLE(f), NULL,
181 283 xoff, yoff, 0, 0,
182 GetWindowRect (FRAME_MSWINDOWS_HANDLE(f), &rect); 284 SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOSENDCHANGING | SWP_NOSIZE);
183 MoveWindow (FRAME_MSWINDOWS_HANDLE(f), xoff, yoff,
184 rect.right-rect.left, rect.bottom-rect.top, TRUE);
185 } 285 }
186 286
187 static void 287 static void
188 mswindows_make_frame_visible (struct frame *f) 288 mswindows_make_frame_visible (struct frame *f)
189 { 289 {
232 } 332 }
233 333
234 static void 334 static void
235 mswindows_lower_frame (struct frame *f) 335 mswindows_lower_frame (struct frame *f)
236 { 336 {
237 RECT rect; 337 SetWindowPos (FRAME_MSWINDOWS_HANDLE(f), HWND_BOTTOM, 0, 0, 0, 0,
238 338 SWP_NOSIZE | SWP_NOMOVE | SWP_NOSENDCHANGING);
239 GetWindowRect (FRAME_MSWINDOWS_HANDLE(f), &rect);
240 SetWindowPos (FRAME_MSWINDOWS_HANDLE(f), HWND_BOTTOM, rect.top, rect.left,
241 rect.right-rect.left, rect.bottom-rect.top, 0);
242 } 339 }
243 340
244 static void 341 static void
245 mswindows_set_title_from_bufbyte (struct frame *f, Bufbyte *title) 342 mswindows_set_title_from_bufbyte (struct frame *f, Bufbyte *title)
246 { 343 {
306 y_specified_p = TRUE; 403 y_specified_p = TRUE;
307 } 404 }
308 } 405 }
309 } 406 }
310 407
311 /* Now we've extracted the properties, apply them */ 408 /* Now we've extracted the properties, apply them.
312 if (width_specified_p || height_specified_p || x_specified_p || y_specified_p) 409 Do not apply geometric properties during frame creation. This
313 { 410 is excessive anyways, and this loses becuase WM_SIZE has not
314 Lisp_Object frame; 411 been sent yet, so frame width and height fields are not initialized
412 */
413 if (f->init_finished
414 && (width_specified_p || height_specified_p || x_specified_p || y_specified_p))
415 {
416 Lisp_Object frame = Qnil;
315 RECT rect; 417 RECT rect;
316 int pixel_width, pixel_height; 418 int pixel_width, pixel_height;
317 XSETFRAME (frame, f); 419 XSETFRAME (frame, f);
318 420
421 char_to_real_pixel_size (f, width, height, &pixel_width, &pixel_height);
319 if (!width_specified_p) 422 if (!width_specified_p)
320 width = FRAME_WIDTH (f); 423 pixel_width = FRAME_PIXWIDTH (f);
321 if (!height_specified_p) 424 if (!height_specified_p)
322 height = FRAME_HEIGHT (f); 425 pixel_height = FRAME_PIXHEIGHT (f);
323 char_to_pixel_size (f, width, height, &pixel_width, &pixel_height);
324 426
325 GetWindowRect (FRAME_MSWINDOWS_HANDLE(f), &rect); 427 GetWindowRect (FRAME_MSWINDOWS_HANDLE(f), &rect);
326 if (!x_specified_p) 428 if (!x_specified_p)
327 x = rect.left; 429 x = rect.left;
328 if (!y_specified_p) 430 if (!y_specified_p)
329 y = rect.top; 431 y = rect.top;
330 432
433 rect.left = rect.top = 0;
434 rect.right = pixel_width;
435 rect.bottom = pixel_height;
331 AdjustWindowRectEx (&rect, 436 AdjustWindowRectEx (&rect,
332 GetWindowLong (FRAME_MSWINDOWS_HANDLE(f), GWL_STYLE), 437 GetWindowLong (FRAME_MSWINDOWS_HANDLE(f), GWL_STYLE),
333 GetMenu (FRAME_MSWINDOWS_HANDLE(f)) != NULL, 438 GetMenu (FRAME_MSWINDOWS_HANDLE(f)) != NULL,
334 GetWindowLong (FRAME_MSWINDOWS_HANDLE(f), GWL_EXSTYLE)); 439 GetWindowLong (FRAME_MSWINDOWS_HANDLE(f), GWL_EXSTYLE));
335 440
336 MoveWindow (FRAME_MSWINDOWS_HANDLE(f), x, y, pixel_width, pixel_height, 441
337 (width_specified_p || height_specified_p)); 442 if (IsIconic (FRAME_MSWINDOWS_HANDLE(f)) || IsZoomed (FRAME_MSWINDOWS_HANDLE(f)))
443 ShowWindow (FRAME_MSWINDOWS_HANDLE(f), SW_RESTORE);
444
445 SetWindowPos (FRAME_MSWINDOWS_HANDLE(f), NULL,
446 x, y, rect.right - rect.left, rect.bottom - rect.top,
447 SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOSENDCHANGING
448 | ((width_specified_p || height_specified_p) ? 0 : SWP_NOSIZE)
449 | ((x_specified_p || y_specified_p) ? 0 : SWP_NOMOVE));
338 } 450 }
339 } 451 }
340 452
453 static Lisp_Object
454 mswindows_get_frame_parent (struct frame *f)
455 {
456 HWND hwnd = FRAME_MSWINDOWS_HANDLE(f);
457 hwnd = GetParent (hwnd);
458 if (hwnd)
459 {
460 Lisp_Object parent;
461 VOID_TO_LISP (parent, GetWindowLong (hwnd, XWL_FRAMEOBJ));
462 assert (FRAME_MSWINDOWS_P (XFRAME (parent)));
463 return parent;
464 }
465 else
466 return Qnil;
467 }
468
469 static void
470 mswindows_update_frame_external_traits (struct frame* frm, Lisp_Object name)
471 {
472 if (EQ (name, Qfont))
473 {
474 /* We resize the frame along with the font if user preference
475 of MS style compliance is turned off, and if font size has
476 really changed
477 */
478 /* #### Frame gets resized after font here */
479 if (1)
480 {
481 int new_char_height, new_char_width;
482 pixel_to_real_char_size (frm, FRAME_PIXWIDTH(frm), FRAME_PIXHEIGHT(frm),
483 &new_char_width, &new_char_height);
484 if (new_char_width != MSWINDOWS_FRAME_CHARWIDTH (frm)
485 || new_char_height != MSWINDOWS_FRAME_CHARHEIGHT (frm))
486 {
487 Lisp_Object frame;
488 XSETFRAME (frame, frm);
489 Fset_frame_size (frame, MSWINDOWS_FRAME_CHARWIDTH (frm),
490 MSWINDOWS_FRAME_CHARHEIGHT (frm), Qnil);
491 }
492 }
493
494 /* This resizes minibuffer and redraws modeline. */
495 {
496 int width, height;
497 pixel_to_char_size (frm, FRAME_PIXWIDTH(frm), FRAME_PIXHEIGHT(frm),
498 &width, &height);
499 change_frame_size (frm, height, width, 1);
500 }
501 }
502 }
341 503
342 void 504 void
343 console_type_create_frame_mswindows (void) 505 console_type_create_frame_mswindows (void)
344 { 506 {
345 /* frame methods */ 507 /* frame methods */
346 CONSOLE_HAS_METHOD (mswindows, init_frame_1); 508 CONSOLE_HAS_METHOD (mswindows, init_frame_1);
347 CONSOLE_HAS_METHOD (mswindows, init_frame_2); 509 /* CONSOLE_HAS_METHOD (mswindows, init_frame_2); */
348 CONSOLE_HAS_METHOD (mswindows, init_frame_3); 510 CONSOLE_HAS_METHOD (mswindows, init_frame_3);
511 CONSOLE_HAS_METHOD (mswindows, after_init_frame);
349 CONSOLE_HAS_METHOD (mswindows, mark_frame); 512 CONSOLE_HAS_METHOD (mswindows, mark_frame);
350 CONSOLE_HAS_METHOD (mswindows, focus_on_frame); 513 CONSOLE_HAS_METHOD (mswindows, focus_on_frame);
351 CONSOLE_HAS_METHOD (mswindows, delete_frame); 514 CONSOLE_HAS_METHOD (mswindows, delete_frame);
352 /* CONSOLE_HAS_METHOD (mswindows, get_mouse_position); */ 515 /* CONSOLE_HAS_METHOD (mswindows, get_mouse_position); */
353 /* CONSOLE_HAS_METHOD (mswindows, set_mouse_position); */ 516 /* CONSOLE_HAS_METHOD (mswindows, set_mouse_position); */
367 CONSOLE_HAS_METHOD (mswindows, frame_visible_p); 530 CONSOLE_HAS_METHOD (mswindows, frame_visible_p);
368 /* CONSOLE_HAS_METHOD (mswindows, frame_totally_visible_p); */ 531 /* CONSOLE_HAS_METHOD (mswindows, frame_totally_visible_p); */
369 CONSOLE_HAS_METHOD (mswindows, frame_iconified_p); 532 CONSOLE_HAS_METHOD (mswindows, frame_iconified_p);
370 /* CONSOLE_HAS_METHOD (mswindows, set_frame_pointer); */ 533 /* CONSOLE_HAS_METHOD (mswindows, set_frame_pointer); */
371 /* CONSOLE_HAS_METHOD (mswindows, set_frame_icon); */ 534 /* CONSOLE_HAS_METHOD (mswindows, set_frame_icon); */
372 /* CONSOLE_HAS_METHOD (mswindows, get_frame_parent); */ 535 CONSOLE_HAS_METHOD (mswindows, get_frame_parent);
536 CONSOLE_HAS_METHOD (mswindows, update_frame_external_traits);
373 } 537 }
374 538
375 void 539 void
376 syms_of_frame_mswindows (void) 540 syms_of_frame_mswindows (void)
377 { 541 {
387 } 551 }
388 552
389 void 553 void
390 vars_of_frame_mswindows (void) 554 vars_of_frame_mswindows (void)
391 { 555 {
556 mswindows_frame_being_created = Qnil;
557 staticpro (&mswindows_frame_being_created);
558
392 DEFVAR_LISP ("default-mswindows-frame-plist", &Vdefault_mswindows_frame_plist /* 559 DEFVAR_LISP ("default-mswindows-frame-plist", &Vdefault_mswindows_frame_plist /*
393 Plist of default frame-creation properties for mswindows frames. 560 Plist of default frame-creation properties for mswindows frames.
394 These override what is specified in `default-frame-plist', but are 561 These override what is specified in `default-frame-plist', but are
395 overridden by the arguments to the particular call to `make-frame'. 562 overridden by the arguments to the particular call to `make-frame'.
396 563