annotate src/libinterface.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 1cecc3e9f0a0
children 308d34e9f07d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
870
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
1 /* Define prototypes for graphics library interface functions.
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
2 Copyright (C) 2002 Ben Wing.
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
3
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
4 This file is part of XEmacs.
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
5
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
6 XEmacs is free software; you can redistribute it and/or modify it
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
7 under the terms of the GNU General Public License as published by the
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
8 Free Software Foundation; either version 2, or (at your option) any
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
9 later version.
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
10
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
14 for more details.
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
15
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
17 along with XEmacs; see the file COPYING. If not, write to
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
19 Boston, MA 02111-1307, USA. */
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
20
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
21 /* Synched up with: Not in FSF. */
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
22
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
23 #ifndef INCLUDED_libinterface_h_
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
24 #define INCLUDED_libinterface_h_
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
25
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
26 #ifdef HAVE_GIF
4708
1cecc3e9f0a0 Use giflib or libungif to provide GIF support, instead of using internal
Jerry James <james@xemacs.org>
parents: 1743
diff changeset
27 #include <gif_lib.h>
870
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
28 #endif /* HAVE_GIF */
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
29
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
30 #ifdef HAVE_PNG
1743
543769b89fed [xemacs-hg @ 2003-10-14 05:02:57 by james]
james
parents: 870
diff changeset
31 BEGIN_C_DECLS
870
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
32 #define message message_ /* Yuck */
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
33 /* See comment in libinterface.c for the following */
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
34 #define PNG_EXPORT(type, symbol) type XCDECL symbol
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
35 #define ZEXPORT XCDECL
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
36 #define ZEXPORTVA XCDECL
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
37 #include <png.h>
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
38 #undef message
1743
543769b89fed [xemacs-hg @ 2003-10-14 05:02:57 by james]
james
parents: 870
diff changeset
39 END_C_DECLS
870
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
40 #endif /* HAVE_PNG */
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
41
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
42 /* #### WARNING: Utterly random magic here to prevent namespace conflicts
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
43 when no one bothers to be the least bit namespace-clean. Potential
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
44 problems: INT32, FAR. DONT_NEED_JPEG avoids the problem with FAR in
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
45 glyphs-msw.c. For some reason, putting the XPM code after this fixes
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
46 other problems; don't move it before. --ben */
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
47 #if defined (HAVE_JPEG) && !defined (DONT_NEED_JPEG)
1743
543769b89fed [xemacs-hg @ 2003-10-14 05:02:57 by james]
james
parents: 870
diff changeset
48 BEGIN_C_DECLS
870
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
49 #ifdef _MSC_VER
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
50 # ifndef XMD_H
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
51 /* Yuck! This tricks jpeglib.h into not defining INT32, which is defined
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
52 in VC98/INCLUDE/basetsd.h */
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
53 # define UNDEF_XMD_H_ME_HARDER
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
54 # define XMD_H
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
55 # endif
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
56 #endif /* _MSC_VER */
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
57 #include <jpeglib.h>
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
58 #ifdef UNDEF_XMD_H_ME_HARDER
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
59 # undef XMD_H
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
60 #endif
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
61 #include <jerror.h>
1743
543769b89fed [xemacs-hg @ 2003-10-14 05:02:57 by james]
james
parents: 870
diff changeset
62 END_C_DECLS
870
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
63
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
64 boolean XCDECL qxe_jpeg_finish_decompress (j_decompress_ptr cinfo);
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
65 boolean XCDECL qxe_jpeg_start_decompress (j_decompress_ptr cinfo);
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
66 JDIMENSION XCDECL qxe_jpeg_read_scanlines (j_decompress_ptr cinfo,
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
67 JSAMPARRAY scanlines,
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
68 JDIMENSION max_lines);
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
69 int XCDECL qxe_jpeg_read_header (j_decompress_ptr cinfo, boolean require_image);
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
70 #define qxe_jpeg_create_decompress(cinfo) \
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
71 qxe_jpeg_CreateDecompress((cinfo), JPEG_LIB_VERSION, \
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
72 (size_t) sizeof(struct jpeg_decompress_struct))
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
73 void XCDECL qxe_jpeg_CreateDecompress (j_decompress_ptr cinfo, int version,
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
74 size_t structsize);
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
75 struct jpeg_error_mgr * XCDECL qxe_jpeg_std_error (struct jpeg_error_mgr *err);
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
76 void XCDECL qxe_jpeg_destroy_decompress (j_decompress_ptr cinfo);
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
77 boolean XCDECL qxe_jpeg_resync_to_restart (j_decompress_ptr cinfo, int desired);
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
78
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
79 #endif /* defined (HAVE_JPEG) && !defined (DONT_NEED_JPEG) */
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
80
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
81 #ifdef HAVE_XPM
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
82
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
83 #ifndef HAVE_GTK /* #### ????????????????????? No comprendo ni un poco.
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
84 This was here before, in a different file. --ben */
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
85 #include <X11/xpm.h>
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
86 #endif
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
87
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
88 void XCDECL qxe_XpmFreeXpmImage (XpmImage *image);
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
89 void XCDECL qxe_XpmFreeXpmInfo (XpmInfo *info);
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
90 int XCDECL qxe_XpmCreateXpmImageFromBuffer (char *buffer, XpmImage *image,
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
91 XpmInfo *info);
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
92 void XCDECL qxe_XpmFree (void *ptr);
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
93 int XCDECL qxe_XpmReadFileToData (char *filename, char ***data_return);
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
94
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
95 #endif /* HAVE_XPM */
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
96
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
97 #ifdef HAVE_TIFF
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
98 #include "tiffio.h"
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
99
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
100 tdata_t XCDECL qxe_TIFFmalloc (tsize_t x1);
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
101 void XCDECL qxe_TIFFfree (tdata_t x1);
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
102 void XCDECL qxe_TIFFClose (TIFF *x1);
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
103 int XCDECL qxe_TIFFGetField (TIFF *x1, ttag_t x2, uint32 *x3);
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
104 TIFF * XCDECL qxe_TIFFClientOpen (const char *x1, const char *x2,
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
105 thandle_t x3, TIFFReadWriteProc x4,
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
106 TIFFReadWriteProc x5, TIFFSeekProc x6,
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
107 TIFFCloseProc x7, TIFFSizeProc x8,
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
108 TIFFMapFileProc x9, TIFFUnmapFileProc x10);
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
109 TIFFErrorHandler XCDECL qxe_TIFFSetErrorHandler (TIFFErrorHandler x1);
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
110 TIFFErrorHandler XCDECL qxe_TIFFSetWarningHandler (TIFFErrorHandler x1);
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
111 int XCDECL qxe_TIFFReadRGBAImage (TIFF *x1, uint32 x2, uint32 x3, uint32 *x4,
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
112 int x5);
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
113
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
114 #endif /* HAVE_TIFF */
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
115
26a2f3423141 [xemacs-hg @ 2002-06-10 12:43:41 by ben]
ben
parents:
diff changeset
116 #endif /* INCLUDED_libinterface_h_ */