Mercurial > hg > xemacs-beta
comparison src/frame.c @ 282:c42ec1d1cded r21-0b39
Import from CVS: tag r21-0b39
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:33:18 +0200 |
parents | 7df0dd720c89 |
children | 558f606b08ae |
comparison
equal
deleted
inserted
replaced
281:090b52736db2 | 282:c42ec1d1cded |
---|---|
52 Lisp_Object Vmouse_enter_frame_hook, Qmouse_enter_frame_hook; | 52 Lisp_Object Vmouse_enter_frame_hook, Qmouse_enter_frame_hook; |
53 Lisp_Object Vmouse_leave_frame_hook, Qmouse_leave_frame_hook; | 53 Lisp_Object Vmouse_leave_frame_hook, Qmouse_leave_frame_hook; |
54 Lisp_Object Vmap_frame_hook, Qmap_frame_hook; | 54 Lisp_Object Vmap_frame_hook, Qmap_frame_hook; |
55 Lisp_Object Vunmap_frame_hook, Qunmap_frame_hook; | 55 Lisp_Object Vunmap_frame_hook, Qunmap_frame_hook; |
56 int allow_deletion_of_last_visible_frame; | 56 int allow_deletion_of_last_visible_frame; |
57 #if defined (HAVE_CDE) || defined (HAVE_OFFIX_DND) || defined(HAVE_MS_WINDOWS) | 57 Lisp_Object Vadjust_frame_function; |
58 Lisp_Object Vdrag_and_drop_functions, Qdrag_and_drop_functions; | |
59 #endif | |
60 Lisp_Object Vmouse_motion_handler; | 58 Lisp_Object Vmouse_motion_handler; |
61 Lisp_Object Vsynchronize_minibuffers; | 59 Lisp_Object Vsynchronize_minibuffers; |
62 Lisp_Object Qsynchronize_minibuffers; | 60 Lisp_Object Qsynchronize_minibuffers; |
63 Lisp_Object Qbuffer_predicate; | 61 Lisp_Object Qbuffer_predicate; |
64 Lisp_Object Qmake_initial_minibuffer_frame; | 62 Lisp_Object Qmake_initial_minibuffer_frame; |
615 Lisp_Object frmcons, devcons, concons; | 613 Lisp_Object frmcons, devcons, concons; |
616 | 614 |
617 FRAME_LOOP_NO_BREAK (frmcons, devcons, concons) | 615 FRAME_LOOP_NO_BREAK (frmcons, devcons, concons) |
618 unhold_one_frame_size_changes (XFRAME (XCAR (frmcons))); | 616 unhold_one_frame_size_changes (XFRAME (XCAR (frmcons))); |
619 } | 617 } |
620 | 618 |
621 | 619 /* |
620 * Frame size may change due to changes in scrollbars, toolbars, | |
621 * default font etc. These changes are applied early in redisplay | |
622 * frame. | |
623 */ | |
624 void | |
625 adjust_frame_size (struct frame *f) | |
626 { | |
627 int keep_char_size = 0; | |
628 Lisp_Object frame; | |
629 XSETFRAME (frame, f); | |
630 | |
631 if (!f->size_slipped) | |
632 return; | |
633 | |
634 /* Don't adjust tty frames. #### May break when TTY have menubars. | |
635 Then, write an Vadjust_frame_function which will return t for TTY | |
636 frames. Another solution is frame_size_fixed_p method for TTYs, | |
637 which always returned yes it's fixed. | |
638 */ | |
639 if (!FRAME_WIN_P (f)) | |
640 { | |
641 CLEAR_FRAME_SIZE_SLIPPED (f); | |
642 return; | |
643 } | |
644 | |
645 /* frame_size_fixed_p tells that frame size cannot currently | |
646 be changed change due to external conditions */ | |
647 if (!FRAMEMETH_OR_GIVEN (f, frame_size_fixed_p, (f), 0)) | |
648 { | |
649 if (NILP (Vadjust_frame_function)) | |
650 keep_char_size = 1; | |
651 else if (EQ (Vadjust_frame_function, Qt)) | |
652 keep_char_size = 0; | |
653 else | |
654 keep_char_size = | |
655 NILP (call1_trapping_errors ("Error in adjust-frame-function", | |
656 Vadjust_frame_function, frame)); | |
657 | |
658 if (keep_char_size) | |
659 Fset_frame_size (frame, make_int (FRAME_CHARWIDTH(f)), | |
660 make_int (FRAME_CHARHEIGHT(f)), Qnil); | |
661 } | |
662 | |
663 if (!keep_char_size) | |
664 { | |
665 int height, width; | |
666 pixel_to_char_size (f, FRAME_PIXWIDTH(f), FRAME_PIXHEIGHT(f), | |
667 &width, &height); | |
668 change_frame_size (f, height, width, 0); | |
669 CLEAR_FRAME_SIZE_SLIPPED (f); | |
670 } | |
671 } | |
672 | |
673 /* | |
674 * This is a "specifier changed in frame" handler for various specifiers | |
675 * changing which causes frame size adjustment | |
676 */ | |
677 void | |
678 frame_size_slipped (Lisp_Object specifier, struct frame *f, | |
679 Lisp_Object oldval) | |
680 { | |
681 MARK_FRAME_SIZE_SLIPPED(f); | |
682 } | |
622 | 683 |
623 DEFUN ("framep", Fframep, 1, 1, 0, /* | 684 DEFUN ("framep", Fframep, 1, 1, 0, /* |
624 Return non-nil if OBJECT is a frame. | 685 Return non-nil if OBJECT is a frame. |
625 Also see `frame-live-p'. | 686 Also see `frame-live-p'. |
626 Note that FSF Emacs kludgily returns a value indicating what type of | 687 Note that FSF Emacs kludgily returns a value indicating what type of |
679 { | 740 { |
680 CHECK_LIVE_FRAME (frame); | 741 CHECK_LIVE_FRAME (frame); |
681 | 742 |
682 /* select the frame's selected window. This will call | 743 /* select the frame's selected window. This will call |
683 selected_frame_1(). */ | 744 selected_frame_1(). */ |
684 Fselect_window (FRAME_SELECTED_WINDOW (XFRAME (frame))); | 745 Fselect_window (FRAME_SELECTED_WINDOW (XFRAME (frame)), Qnil); |
685 | 746 |
686 /* Nothing should be depending on the return value of this function. | 747 /* Nothing should be depending on the return value of this function. |
687 But, of course, there is stuff out there which is. */ | 748 But, of course, there is stuff out there which is. */ |
688 return frame; | 749 return frame; |
689 } | 750 } |
858 | 919 |
859 if (! EQ (frame, WINDOW_FRAME (XWINDOW (window)))) | 920 if (! EQ (frame, WINDOW_FRAME (XWINDOW (window)))) |
860 error ("In `set-frame-selected-window', WINDOW is not on FRAME"); | 921 error ("In `set-frame-selected-window', WINDOW is not on FRAME"); |
861 | 922 |
862 if (XFRAME (frame) == selected_frame ()) | 923 if (XFRAME (frame) == selected_frame ()) |
863 return Fselect_window (window); | 924 return Fselect_window (window, Qnil); |
864 | 925 |
865 set_frame_selected_window (XFRAME (frame), window); | 926 set_frame_selected_window (XFRAME (frame), window); |
866 return window; | 927 return window; |
867 } | 928 } |
868 | 929 |
1457 minibuf_window = sel_frame->minibuffer_window; | 1518 minibuf_window = sel_frame->minibuffer_window; |
1458 | 1519 |
1459 /* If the dying minibuffer window was selected, | 1520 /* If the dying minibuffer window was selected, |
1460 select the new one. */ | 1521 select the new one. */ |
1461 if (minibuffer_selected) | 1522 if (minibuffer_selected) |
1462 Fselect_window (minibuf_window); | 1523 Fselect_window (minibuf_window, Qnil); |
1463 } | 1524 } |
1464 | 1525 |
1465 /* After this point, no errors must be allowed to occur. */ | 1526 /* After this point, no errors must be allowed to occur. */ |
1466 | 1527 |
1467 #ifdef HAVE_MENUBARS | 1528 #ifdef HAVE_MENUBARS |
2478 } | 2539 } |
2479 | 2540 |
2480 static void | 2541 static void |
2481 internal_set_frame_size (struct frame *f, int cols, int rows, int pretend) | 2542 internal_set_frame_size (struct frame *f, int cols, int rows, int pretend) |
2482 { | 2543 { |
2544 /* An explicit size change cancels any pending frame size adjustment */ | |
2545 CLEAR_FRAME_SIZE_SLIPPED(f); | |
2546 | |
2483 if (pretend || !HAS_FRAMEMETH_P (f, set_frame_size)) | 2547 if (pretend || !HAS_FRAMEMETH_P (f, set_frame_size)) |
2484 change_frame_size (f, rows, cols, 0); | 2548 change_frame_size (f, rows, cols, 0); |
2485 else | 2549 else |
2486 FRAMEMETH (f, set_frame_size, (f, cols, rows)); | 2550 FRAMEMETH (f, set_frame_size, (f, cols, rows)); |
2487 } | 2551 } |
2854 FRAME_WIDTH (f) = newwidth; | 2918 FRAME_WIDTH (f) = newwidth; |
2855 if (FRAME_TTY_P (f)) | 2919 if (FRAME_TTY_P (f)) |
2856 f->pixwidth = newwidth; | 2920 f->pixwidth = newwidth; |
2857 } | 2921 } |
2858 | 2922 |
2923 if (window_system_pixelated_geometry (frame)) | |
2924 pixel_to_real_char_size (f, FRAME_PIXWIDTH (f), FRAME_PIXHEIGHT (f), | |
2925 &FRAME_CHARWIDTH (f), &FRAME_CHARHEIGHT (f)); | |
2926 else | |
2927 { | |
2928 FRAME_CHARWIDTH (f) = FRAME_WIDTH (f); | |
2929 FRAME_CHARHEIGHT (f) = FRAME_HEIGHT (f); | |
2930 } | |
2931 | |
2859 MARK_FRAME_TOOLBARS_CHANGED (f); | 2932 MARK_FRAME_TOOLBARS_CHANGED (f); |
2860 MARK_FRAME_CHANGED (f); | 2933 MARK_FRAME_CHANGED (f); |
2861 f->echo_area_garbaged = 1; | 2934 f->echo_area_garbaged = 1; |
2862 } | 2935 } |
2863 | 2936 |
2997 defsymbol (&Qcustom_initialize_frame, "custom-initialize-frame"); | 3070 defsymbol (&Qcustom_initialize_frame, "custom-initialize-frame"); |
2998 defsymbol (&Qmouse_enter_frame_hook, "mouse-enter-frame-hook"); | 3071 defsymbol (&Qmouse_enter_frame_hook, "mouse-enter-frame-hook"); |
2999 defsymbol (&Qmouse_leave_frame_hook, "mouse-leave-frame-hook"); | 3072 defsymbol (&Qmouse_leave_frame_hook, "mouse-leave-frame-hook"); |
3000 defsymbol (&Qmap_frame_hook, "map-frame-hook"); | 3073 defsymbol (&Qmap_frame_hook, "map-frame-hook"); |
3001 defsymbol (&Qunmap_frame_hook, "unmap-frame-hook"); | 3074 defsymbol (&Qunmap_frame_hook, "unmap-frame-hook"); |
3002 #if defined (HAVE_CDE) || defined (HAVE_OFFIX_DND) || defined(HAVE_MS_WINDOWS) | |
3003 defsymbol (&Qdrag_and_drop_functions, "drag-and-drop-functions"); | |
3004 #endif | |
3005 | 3075 |
3006 defsymbol (&Qframep, "framep"); | 3076 defsymbol (&Qframep, "framep"); |
3007 defsymbol (&Qframe_live_p, "frame-live-p"); | 3077 defsymbol (&Qframe_live_p, "frame-live-p"); |
3008 defsymbol (&Qframe_x_p, "frame-x-p"); | 3078 defsymbol (&Qframe_x_p, "frame-x-p"); |
3009 defsymbol (&Qframe_tty_p, "frame-tty-p"); | 3079 defsymbol (&Qframe_tty_p, "frame-tty-p"); |
3187 &allow_deletion_of_last_visible_frame /* | 3257 &allow_deletion_of_last_visible_frame /* |
3188 *Non-nil means to assume the force option to delete-frame. | 3258 *Non-nil means to assume the force option to delete-frame. |
3189 */ ); | 3259 */ ); |
3190 allow_deletion_of_last_visible_frame = 0; | 3260 allow_deletion_of_last_visible_frame = 0; |
3191 | 3261 |
3192 #if defined (HAVE_CDE) || defined (HAVE_OFFIX_DND) || defined(HAVE_MS_WINDOWS) | 3262 DEFVAR_LISP ("adjust-frame-function", &Vadjust_frame_function /* |
3193 DEFVAR_LISP ("drag-and-drop-functions", &Vdrag_and_drop_functions /* | 3263 Function or constant controlling adjustment of frame. |
3194 Function or functions to run when an object is dropped on a frame. | 3264 When scrollbars, toolbars, default font etc. change in frame, the frame |
3195 Each function is called with either two or three args. If called with | 3265 needs to be adjusted. The adjustment is controlled by this variable. |
3196 two args, the args are a frame and a pathname. If with three, the | 3266 Legal values are: |
3197 args are a frame, a pathname (which will be either a string or nil) | 3267 nil to keep character frame size unchanged when possible (resize) |
3198 and the textual representation of the dragged object. | 3268 t to keep pixel size unchanged (never resize) |
3269 function symbol or lambda form. This function must return boolean | |
3270 value which is treated as above. Function is passed one parameter, | |
3271 the frame being adjusted. It function should not modify or delete | |
3272 the frame. | |
3199 */ ); | 3273 */ ); |
3200 Vdrag_and_drop_functions = Qnil; | 3274 Vadjust_frame_function = Qnil; |
3201 #endif /* HAVE_CDE || HAVE_OFFIX_DND || HAVE_MS_WINDOWS */ | |
3202 | 3275 |
3203 DEFVAR_LISP ("mouse-motion-handler", &Vmouse_motion_handler /* | 3276 DEFVAR_LISP ("mouse-motion-handler", &Vmouse_motion_handler /* |
3204 Handler for motion events. One arg, the event. | 3277 Handler for motion events. One arg, the event. |
3205 For most applications, you should use `mode-motion-hook' instead of this. | 3278 For most applications, you should use `mode-motion-hook' instead of this. |
3206 */ ); | 3279 */ ); |