Mercurial > hg > xemacs-beta
view lisp/device.el @ 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 | aa5ed11f473b |
children | 0d43872986b6 |
line wrap: on
line source
;;; device.el --- miscellaneous device functions not written in C ;; Copyright (C) 1994-5, 1997 Free Software Foundation, Inc. ;; Copyright (C) 1995, 1996 Ben Wing ;; Maintainer: XEmacs Development Team ;; Keywords: internal, dumped ;; This file is part of XEmacs. ;; XEmacs is free software; you can redistribute it and/or modify it ;; under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; XEmacs is distributed in the hope that it will be useful, but ;; WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;; General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with XEmacs; see the file COPYING. If not, write to the ;; Free Software Foundation, 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. ;;; Synched up with: Not in FSF. ;;; Commentary: ;; This file is dumped with XEmacs. ;;; Code: ;;; Initialization ; Specifier tag 'printer which matches printers (define-specifier-tag 'printer (function device-printer-p)) ; Specifier tag 'display which matches displays (define-specifier-tag 'display (function (lambda (device) (not (device-printer-p device))))) ;;; Functions (defun device-list () "Return a list of all devices." (apply 'nconc (mapcar 'console-device-list (console-list)))) (defun device-type (&optional device) "Return the type of the specified device (e.g. `x' or `tty'). This is equivalent to the type of the device's console. Value is `tty' for a tty device (a character-only terminal), `x' for a device that is a screen on an X display, `gtk' for a device that is a GTK connection. `mswindows' for a device that is a MS Windows workstation, `msprinter' for a device that is a MS Windows printer connection, `stream' for a stream device (which acts like a stdio stream), and `dead' for a deleted device." (or device (setq device (selected-device))) (if (not (device-live-p device)) 'dead (console-type (device-console device)))) (defun make-tty-device (&optional tty terminal-type controlling-process) "Create a new device on TTY. TTY should be the name of a tty device file (e.g. \"/dev/ttyp3\" under SunOS et al.), as returned by the `tty' command. A value of nil means use the stdin and stdout as passed to XEmacs from the shell. If TERMINAL-TYPE is non-nil, it should be a string specifying the type of the terminal attached to the specified tty. If it is nil, the terminal type will be inferred from the TERM environment variable. If CONTROLLING-PROCESS is non-nil, it should be an integer specifying the process id of the process in control of the specified tty. If it is nil, it is assumes to be the value returned by emacs-pid." (make-device 'tty tty (list 'terminal-type terminal-type 'controlling-process controlling-process))) (defun device-pixel-width (&optional device) "Return the width in pixels of DEVICE, or nil if unknown." (let ((ds (device-system-metric device 'size-device))) (and ds (car ds)))) (defun device-pixel-height (&optional device) "Return the height in pixels of DEVICE, or nil if unknown." (let ((ds (device-system-metric device 'size-device))) (and ds (cdr ds)))) (defun device-mm-width (&optional device) "Return the width in millimeters of DEVICE, or nil if unknown." (let ((ds (device-system-metric device 'size-device-mm))) (and ds (car ds)))) (defun device-mm-height (&optional device) "Return the height in millimeters of DEVICE, or nil if unknown." (let ((ds (device-system-metric device 'size-device-mm))) (and ds (cdr ds)))) (defun device-bitplanes (&optional device) "Return the number of bitplanes of DEVICE, or nil if unknown." (device-system-metric device 'num-bit-planes)) (defun device-color-cells (&optional device) "Return the number of color cells of DEVICE, or nil if unknown." (device-system-metric device 'num-color-cells)) (defun device-num-screens (&optional device) "Return the number of display screens available on DEVICE, or 1 if unknown." (device-system-metric device 'num-screens 1)) (defun device-backing-store (&optional device) "Return the backing store capability of DEVICE. The value may be `always', `when-mapped', `not-useful', or nil if the question is inapplicable to a certain kind of display." (device-system-metric device 'backing-store)) (defun device-save-under (&optional device) "Return non-nil if DEVICE supports the SaveUnder feature." (device-system-metric device 'save-under)) (defun make-gtk-device () "Create a new GTK device." (make-device 'gtk nil)) (defun make-x-device (&optional display) "Create a new device connected to DISPLAY." (make-device 'x display)) (defun make-mswindows-device () "Create a new mswindows device." (make-device 'mswindows nil)) (defun device-on-window-system-p (&optional device) "Return non-nil if DEVICE is on a window system. This generally means that there is support for the mouse, the menubar, the toolbar, glyphs, etc." (or device (setq device (selected-device))) (console-on-window-system-p (device-console device))) (defun call-device-method (name device &rest args) "Call a DEVICE-specific function with the generic name NAME. If DEVICE is not provided then the selected device is used." (or device (setq device (selected-device))) (or (symbolp name) (error "function name must be a symbol")) (let ((devmeth (intern (concat (symbol-name (device-type device)) "-" (symbol-name name))))) (if (functionp devmeth) (if args (apply devmeth args) (funcall devmeth)) nil))) (defmacro define-device-method (name &optional docstring) "Define NAME to be a device method." `(defun ,name (&rest arglist) ,docstring (apply 'call-device-method (quote ,name) nil arglist))) (defmacro define-device-method* (name &optional docstring) "Define NAME to be a device method." `(defun* ,name (&rest arglist) ,docstring (apply 'call-device-method (quote ,name) nil arglist))) (defalias 'valid-device-type-p 'valid-console-type-p) (defalias 'device-type-list 'console-type-list) (defalias 'device-pixel-depth 'device-bitplanes) ;;; device.el ends here