annotate src/EmacsFrameP.h @ 5043:d0c14ea98592

various frame-geometry fixes -------------------- ChangeLog entries follow: -------------------- src/ChangeLog addition: 2010-02-15 Ben Wing <ben@xemacs.org> * EmacsFrame.c: * EmacsFrame.c (EmacsFrameResize): * console-msw-impl.h: * console-msw-impl.h (struct mswindows_frame): * console-msw-impl.h (FRAME_MSWINDOWS_TARGET_RECT): * device-tty.c: * device-tty.c (tty_asynch_device_change): * event-msw.c: * event-msw.c (mswindows_wnd_proc): * faces.c (Fface_list): * faces.h: * frame-gtk.c: * frame-gtk.c (gtk_set_initial_frame_size): * frame-gtk.c (gtk_set_frame_size): * frame-msw.c: * frame-msw.c (mswindows_init_frame_1): * frame-msw.c (mswindows_set_frame_size): * frame-msw.c (mswindows_size_frame_internal): * frame-msw.c (msprinter_init_frame_3): * frame.c: * frame.c (enum): * frame.c (Fmake_frame): * frame.c (adjust_frame_size): * frame.c (store_minibuf_frame_prop): * frame.c (Fframe_property): * frame.c (Fframe_properties): * frame.c (Fframe_displayable_pixel_height): * frame.c (Fframe_displayable_pixel_width): * frame.c (internal_set_frame_size): * frame.c (Fset_frame_height): * frame.c (Fset_frame_pixel_height): * frame.c (Fset_frame_displayable_pixel_height): * frame.c (Fset_frame_width): * frame.c (Fset_frame_pixel_width): * frame.c (Fset_frame_displayable_pixel_width): * frame.c (Fset_frame_size): * frame.c (Fset_frame_pixel_size): * frame.c (Fset_frame_displayable_pixel_size): * frame.c (frame_conversion_internal_1): * frame.c (get_frame_displayable_pixel_size): * frame.c (change_frame_size_1): * frame.c (change_frame_size): * frame.c (generate_title_string): * frame.h: * gtk-xemacs.c: * gtk-xemacs.c (gtk_xemacs_size_request): * gtk-xemacs.c (gtk_xemacs_size_allocate): * gtk-xemacs.c (gtk_xemacs_paint): * gutter.c: * gutter.c (update_gutter_geometry): * redisplay.c (end_hold_frame_size_changes): * redisplay.c (redisplay_frame): * toolbar.c: * toolbar.c (update_frame_toolbars_geometry): * window.c: * window.c (frame_pixsize_valid_p): * window.c (check_frame_size): Various fixes to frame geometry to make it a bit easier to understand and fix some bugs. 1. IMPORTANT: Some renamings. Will need to be applied carefully to the carbon repository, in the following order: -- pixel_to_char_size -> pixel_to_frame_unit_size -- char_to_pixel_size -> frame_unit_to_pixel_size -- pixel_to_real_char_size -> pixel_to_char_size -- char_to_real_pixel_size -> char_to_pixel_size -- Reverse second and third arguments of change_frame_size() and change_frame_size_1() to try to make functions consistent in putting width before height. -- Eliminate old round_size_to_char, because it didn't really do anything differently from round_size_to_real_char() -- round_size_to_real_char -> round_size_to_char; any places that called the old round_size_to_char should just call the new one. 2. IMPORTANT FOR CARBON: The set_frame_size() method is now passed sizes in "frame units", like all other frame-sizing functions, rather than some hacked-up combination of char-cell units and total pixel size. This only affects window systems that use "pixelated geometry", and I'm not sure if Carbon is one of them. MS Windows is pixelated, X and GTK are not. For pixelated-geometry systems, the size in set_frame_size() is in displayable pixels rather than total pixels and needs to be converted appropriately; take a look at the changes made to mswindows_set_frame_size() method if necessary. 3. Add a big long comment in frame.c describing how frame geometry works. 4. Remove MS Windows-specific character height and width fields, duplicative and unused. 5. frame-displayable-pixel-* and set-frame-displayable-pixel-* didn't use to work on MS Windows, but they do now. 6. In general, clean up the handling of "pixelated geometry" so that fewer functions have to worry about this. This is really an abomination that should be removed entirely but that will have to happen later. Fix some buggy code in frame_conversion_internal() that happened to "work" because it was countered by oppositely buggy code in change_frame_size(). 7. Clean up some frame-size code in toolbar.c and use functions already provided in frame.c instead of rolling its own. 8. Fix check_frame_size() in window.c, which formerly didn't take pixelated geometry into account.
author Ben Wing <ben@xemacs.org>
date Mon, 15 Feb 2010 22:14:11 -0600
parents 374186f156d5
children 308d34e9f07d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 /* Private header for the Emacs frame widget.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2 Copyright (C) 1993-1995 Sun Microsystems, Inc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3 Copyright (C) 1995 Ben Wing.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5 This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7 XEmacs is free software; you can redistribute it and/or modify it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9 Free Software Foundation; either version 2, or (at your option) any
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10 later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15 for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 along with XEmacs; see the file COPYING. If not, write to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 Boston, MA 02111-1307, USA. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22 /* Synched up with: Not in FSF. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
24 #ifndef INCLUDED_EmacsFrameP_h_
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
25 #define INCLUDED_EmacsFrameP_h_
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27 #include "xintrinsicp.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28 #include <X11/CoreP.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29 #ifdef LWLIB_USES_MOTIF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30 #include "xmprimitivep.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32 #include "EmacsFrame.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34 typedef struct {
1455
449cf6dc2025 [xemacs-hg @ 2003-05-04 02:34:34 by youngs]
youngs
parents: 869
diff changeset
35
449cf6dc2025 [xemacs-hg @ 2003-05-04 02:34:34 by youngs]
youngs
parents: 869
diff changeset
36 #ifdef LWLIB_USES_MOTIF
449cf6dc2025 [xemacs-hg @ 2003-05-04 02:34:34 by youngs]
youngs
parents: 869
diff changeset
37 #if XmVERSION < 2
449cf6dc2025 [xemacs-hg @ 2003-05-04 02:34:34 by youngs]
youngs
parents: 869
diff changeset
38 /* It's easy to erroneously compile with Motif 1 headers, but link
449cf6dc2025 [xemacs-hg @ 2003-05-04 02:34:34 by youngs]
youngs
parents: 869
diff changeset
39 with Motif 2 libraries.
449cf6dc2025 [xemacs-hg @ 2003-05-04 02:34:34 by youngs]
youngs
parents: 869
diff changeset
40
449cf6dc2025 [xemacs-hg @ 2003-05-04 02:34:34 by youngs]
youngs
parents: 869
diff changeset
41 For example, AIX stupidly provides Motif headers in
449cf6dc2025 [xemacs-hg @ 2003-05-04 02:34:34 by youngs]
youngs
parents: 869
diff changeset
42 /usr/dt/include, but fails to provide the corresponding libraries
449cf6dc2025 [xemacs-hg @ 2003-05-04 02:34:34 by youngs]
youngs
parents: 869
diff changeset
43 in /usr/dt/lib.
449cf6dc2025 [xemacs-hg @ 2003-05-04 02:34:34 by youngs]
youngs
parents: 869
diff changeset
44
449cf6dc2025 [xemacs-hg @ 2003-05-04 02:34:34 by youngs]
youngs
parents: 869
diff changeset
45 We actually try to survive such a version mismatch, since Motif 2
449cf6dc2025 [xemacs-hg @ 2003-05-04 02:34:34 by youngs]
youngs
parents: 869
diff changeset
46 is _almost_ binary compatible with Motif 1. Motif 2's
449cf6dc2025 [xemacs-hg @ 2003-05-04 02:34:34 by youngs]
youngs
parents: 869
diff changeset
47 XmPrimitivePart has some trailing data members which overlay the
449cf6dc2025 [xemacs-hg @ 2003-05-04 02:34:34 by youngs]
youngs
parents: 869
diff changeset
48 start of this struct. We create dummy members to make space for
449cf6dc2025 [xemacs-hg @ 2003-05-04 02:34:34 by youngs]
youngs
parents: 869
diff changeset
49 XmPrimitivePart's added members. These must, of course, be at
449cf6dc2025 [xemacs-hg @ 2003-05-04 02:34:34 by youngs]
youngs
parents: 869
diff changeset
50 the beginning of this struct.
449cf6dc2025 [xemacs-hg @ 2003-05-04 02:34:34 by youngs]
youngs
parents: 869
diff changeset
51
449cf6dc2025 [xemacs-hg @ 2003-05-04 02:34:34 by youngs]
youngs
parents: 869
diff changeset
52 Delete this kludge when no one has Motif1 on their system anymore,
449cf6dc2025 [xemacs-hg @ 2003-05-04 02:34:34 by youngs]
youngs
parents: 869
diff changeset
53 perhaps in 2010. */
449cf6dc2025 [xemacs-hg @ 2003-05-04 02:34:34 by youngs]
youngs
parents: 869
diff changeset
54 XtCallbackList Motif2_dummy_convert_callback;
449cf6dc2025 [xemacs-hg @ 2003-05-04 02:34:34 by youngs]
youngs
parents: 869
diff changeset
55 XtCallbackList Motif2_dummy_popup_handler_callback;
449cf6dc2025 [xemacs-hg @ 2003-05-04 02:34:34 by youngs]
youngs
parents: 869
diff changeset
56 long Motif2_dummy_layout_direction;
449cf6dc2025 [xemacs-hg @ 2003-05-04 02:34:34 by youngs]
youngs
parents: 869
diff changeset
57 #endif
449cf6dc2025 [xemacs-hg @ 2003-05-04 02:34:34 by youngs]
youngs
parents: 869
diff changeset
58 #endif
449cf6dc2025 [xemacs-hg @ 2003-05-04 02:34:34 by youngs]
youngs
parents: 869
diff changeset
59
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
60 struct frame* frame; /* the *emacs* frame object */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62 /* Resources that can't be done from lisp.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64 char* geometry; /* geometry spec of this frame */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65 Boolean iconic; /* whether this frame is iconic */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 /* The rest of this is crap and should be deleted.
3381
374186f156d5 [xemacs-hg @ 2006-05-06 17:55:58 by stephent]
stephent
parents: 1455
diff changeset
68 #### Comments that start with + are fields that actually get referred
374186f156d5 [xemacs-hg @ 2006-05-06 17:55:58 by stephent]
stephent
parents: 1455
diff changeset
69 to somewhere aside from the init function.
374186f156d5 [xemacs-hg @ 2006-05-06 17:55:58 by stephent]
stephent
parents: 1455
diff changeset
70 I guess the "crap" has mostly moved to specifiers?
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 Boolean minibuffer; /* 0: normal frames with minibuffers.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73 * 1: frames without minibuffers
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74 * 2: minibuffer only. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75 Boolean unsplittable; /* frame can only have one window */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76
3381
374186f156d5 [xemacs-hg @ 2006-05-06 17:55:58 by stephent]
stephent
parents: 1455
diff changeset
77 int internal_border_width; /* + internal borders */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78 int scrollbar_width; /* width of frame vertical sb's */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79 int scrollbar_height; /* height of frame horizontal sb's */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80 int top_toolbar_height; /* height of top toolbar */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81 int bottom_toolbar_height; /* height of bottom toolbar */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82 int left_toolbar_width; /* width of left toolbar */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83 int right_toolbar_width; /* width of right toolbar */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84 int top_toolbar_border_width; /* border width */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85 int bottom_toolbar_border_width; /* ... of bottom toolbar */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86 int left_toolbar_border_width; /* ... of left toolbar */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87 int right_toolbar_border_width; /* ... of right toolbar */
3381
374186f156d5 [xemacs-hg @ 2006-05-06 17:55:58 by stephent]
stephent
parents: 1455
diff changeset
88 Dimension toolbar_shadow_thickness; /* + of shadows */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 unsigned char scrollbar_placement;
3381
374186f156d5 [xemacs-hg @ 2006-05-06 17:55:58 by stephent]
stephent
parents: 1455
diff changeset
90 int interline; /* + skips between lines */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92 XFontStruct* font; /* font */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93 Pixel foreground_pixel; /* foreground */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94 Pixel background_pixel; /* background */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96 Pixel cursor_color; /* text cursor color */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97 Boolean bar_cursor; /* 1 if bar, 0 if block */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 Boolean visual_bell; /* flash instead of beep */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100 int bell_volume; /* how loud is beep */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102 Boolean menubar_p; /* initially show a menubar? */
3381
374186f156d5 [xemacs-hg @ 2006-05-06 17:55:58 by stephent]
stephent
parents: 1455
diff changeset
103 Boolean initially_unmapped; /* + inhibit initial window mapping */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104 Boolean use_backing_store; /* backing store for menubar & ew? */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106 Dimension preferred_width; /* if non-zero, preferred size for */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107 Dimension preferred_height; /* QueryGeometry() */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 /* private state */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110 } EmacsFramePart;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
111
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
112 typedef struct _EmacsFrameRec { /* full instance record */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113 CorePart core;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114 #ifdef LWLIB_USES_MOTIF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115 XmPrimitivePart primitive;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
116 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
117 EmacsFramePart emacs_frame;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118 } EmacsFrameRec;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
119
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120 typedef struct { /* new fields for EmacsFrame class */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
121 int dummy;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122 } EmacsFrameClassPart;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
124 typedef struct _EmacsFrameClassRec { /* full class record declaration */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125 CoreClassPart core_class;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126 #ifdef LWLIB_USES_MOTIF
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
127 XmPrimitiveClassPart primitive_class;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
128 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
129 EmacsFrameClassPart emacs_frame_class;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
130 } EmacsFrameClassRec;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
131
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
132 extern EmacsFrameClassRec emacsFrameClassRec; /* class pointer */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
133
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
134 #endif /* INCLUDED_EmacsFrameP_h_ */