Mercurial > hg > xemacs-beta
comparison src/EmacsFrame.c @ 282:c42ec1d1cded r21-0b39
Import from CVS: tag r21-0b39
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:33:18 +0200 |
parents | c5d627a313b1 |
children | 57709be46d1b |
comparison
equal
deleted
inserted
replaced
281:090b52736db2 | 282:c42ec1d1cded |
---|---|
252 static void | 252 static void |
253 update_various_frame_slots (EmacsFrame ew) | 253 update_various_frame_slots (EmacsFrame ew) |
254 { | 254 { |
255 ew->emacs_frame.frame->pixheight = ew->core.height; | 255 ew->emacs_frame.frame->pixheight = ew->core.height; |
256 ew->emacs_frame.frame->pixwidth = ew->core.width; | 256 ew->emacs_frame.frame->pixwidth = ew->core.width; |
257 ew->emacs_frame.frame->internal_border_width = | |
258 ew->emacs_frame.internal_border_width; | |
259 } | 257 } |
260 | 258 |
261 static void | 259 static void |
262 EmacsFrameInitialize (Widget request, Widget new, | 260 EmacsFrameInitialize (Widget request, Widget new, |
263 ArgList dum1, Cardinal *dum2) | 261 ArgList dum1, Cardinal *dum2) |
265 EmacsFrame ew = (EmacsFrame)new; | 263 EmacsFrame ew = (EmacsFrame)new; |
266 struct frame *f = ew->emacs_frame.frame; | 264 struct frame *f = ew->emacs_frame.frame; |
267 | 265 |
268 if (!f) | 266 if (!f) |
269 fatal ("can't create an emacs frame widget without a frame."); | 267 fatal ("can't create an emacs frame widget without a frame."); |
268 | |
269 ew->emacs_frame.frame->internal_border_width = | |
270 ew->emacs_frame.internal_border_width; | |
270 } | 271 } |
271 | 272 |
272 void emacs_Xt_event_handler (Widget wid /* unused */, | 273 void emacs_Xt_event_handler (Widget wid /* unused */, |
273 XtPointer closure /* unused */, | 274 XtPointer closure /* unused */, |
274 XEvent *event, | 275 XEvent *event, |
348 struct frame *f = ew->emacs_frame.frame; | 349 struct frame *f = ew->emacs_frame.frame; |
349 int columns; | 350 int columns; |
350 int rows; | 351 int rows; |
351 XtWidgetGeometry req, repl; | 352 XtWidgetGeometry req, repl; |
352 | 353 |
354 update_various_frame_slots (ew); | |
355 | |
353 pixel_to_char_size (f, ew->core.width, ew->core.height, &columns, &rows); | 356 pixel_to_char_size (f, ew->core.width, ew->core.height, &columns, &rows); |
354 update_various_frame_slots (ew); | |
355 change_frame_size (f, rows, columns, 0); | 357 change_frame_size (f, rows, columns, 0); |
356 | 358 |
357 /* Now we tell the EmacsShell that we've changed the size of the non-fixed | 359 /* Now we tell the EmacsShell that we've changed the size of the non-fixed |
358 portion of the frame. Note that, if we the resize occurred as a result | 360 portion of the frame. Note that, if we the resize occurred as a result |
359 of EmacsFrameSetCharSize(), this information will be stored twice. | 361 of EmacsFrameSetCharSize(), this information will be stored twice. |
369 repl.height); | 371 repl.height); |
370 } | 372 } |
371 | 373 |
372 static Boolean | 374 static Boolean |
373 EmacsFrameSetValues (Widget cur_widget, Widget req_widget, Widget new_widget, | 375 EmacsFrameSetValues (Widget cur_widget, Widget req_widget, Widget new_widget, |
374 ArgList dum1, Cardinal *dum2) | 376 ArgList argv, Cardinal *argc) |
375 { | 377 { |
376 EmacsFrame cur = (EmacsFrame) cur_widget; | 378 EmacsFrame cur = (EmacsFrame) cur_widget; |
377 EmacsFrame new = (EmacsFrame) new_widget; | 379 EmacsFrame new = (EmacsFrame) new_widget; |
380 struct frame *f = new->emacs_frame.frame; | |
378 Lisp_Object frame; | 381 Lisp_Object frame; |
379 | 382 |
380 XSETFRAME (frame, new->emacs_frame.frame); | 383 XSETFRAME (frame, f); |
381 in_resource_setting++; | 384 in_resource_setting++; |
382 /* This function does not need to do much. Pretty much everything | 385 /* This function does not need to do much. Pretty much everything |
383 interesting will get done in the resize method, which will | 386 interesting will get done in the resize method, which will |
384 (if necessary) get called by Xt when this function returns | 387 (if necessary) get called by Xt when this function returns |
385 (see below). | 388 (see below). |
395 if (cur->emacs_frame.iconic != new->emacs_frame.iconic && | 398 if (cur->emacs_frame.iconic != new->emacs_frame.iconic && |
396 FRAME_X_TOP_LEVEL_FRAME_P (new->emacs_frame.frame)) | 399 FRAME_X_TOP_LEVEL_FRAME_P (new->emacs_frame.frame)) |
397 x_wm_set_shell_iconic_p (FRAME_X_SHELL_WIDGET (new->emacs_frame.frame), | 400 x_wm_set_shell_iconic_p (FRAME_X_SHELL_WIDGET (new->emacs_frame.frame), |
398 new->emacs_frame.iconic); | 401 new->emacs_frame.iconic); |
399 | 402 |
400 if (!in_specifier_change_function) | |
401 { | |
402 /* If we got here, then we were likely called as a result of | 403 /* If we got here, then we were likely called as a result of |
403 the EditRes protocol, so go ahead and change scrollbar-width | 404 the EditRes protocol, so go ahead and change scrollbar-width |
404 and scrollbar-height. Otherwise, we're merely mirroring | 405 and scrollbar-height. Otherwise, we're merely mirroring |
405 a change made to scrollbar-width etc. so don't do anything | 406 a change made to scrollbar-width etc. so don't do anything |
406 special. */ | 407 special. */ |
408 if (cur->emacs_frame.internal_border_width != | |
409 new->emacs_frame.internal_border_width) | |
410 { | |
411 f->internal_border_width = new->emacs_frame.internal_border_width; | |
412 MARK_FRAME_SIZE_SLIPPED (f); | |
413 } | |
414 | |
407 #ifdef HAVE_SCROLLBARS | 415 #ifdef HAVE_SCROLLBARS |
408 if (cur->emacs_frame.scrollbar_width != | 416 if (cur->emacs_frame.scrollbar_width != |
409 new->emacs_frame.scrollbar_width) | 417 new->emacs_frame.scrollbar_width) |
410 Fadd_spec_to_specifier | 418 Fadd_spec_to_specifier |
411 (Vscrollbar_width, | 419 (Vscrollbar_width, |
466 Fadd_spec_to_specifier | 474 Fadd_spec_to_specifier |
467 (Vtoolbar_border_width[RIGHT_TOOLBAR], | 475 (Vtoolbar_border_width[RIGHT_TOOLBAR], |
468 make_int (new->emacs_frame.right_toolbar_border_width), | 476 make_int (new->emacs_frame.right_toolbar_border_width), |
469 frame, Qnil, Qnil); | 477 frame, Qnil, Qnil); |
470 #endif /* HAVE_TOOLBARS */ | 478 #endif /* HAVE_TOOLBARS */ |
479 | |
480 in_resource_setting--; | |
481 | |
482 /* If the request was to resize us, but the size has not changed, Xt | |
483 will do nothing, and won't call our resize callback. Since such a | |
484 request might be issued as a result of hiding/showing menubar or | |
485 changing toolbar placement, where we rely on relayout made by the | |
486 callback, we go ahead and simulate such a call */ | |
487 if (cur->core.width == new->core.width | |
488 && cur->core.height == new->core.height) | |
489 { | |
490 int i; | |
491 for (i=0; i<*argc; i++) | |
492 if (strcmp (argv[i].name, XtNwidth) == 0 | |
493 || strcmp (argv[i].name, XtNheight) == 0) | |
494 { | |
495 EmacsFrameResize (new_widget); | |
496 break; | |
497 } | |
471 } | 498 } |
472 in_resource_setting--; | |
473 | 499 |
474 return False; | 500 return False; |
475 | 501 |
476 /* Note that if either (a) we return True, or (b) the width or | 502 /* Note that if either (a) we return True, or (b) the width or |
477 height has changed, an Expose event will be generated. The Xt | 503 height has changed, an Expose event will be generated. The Xt |