Mercurial > hg > xemacs-beta
annotate src/frame-msw.c @ 5124:623d57b7fbe8 ben-lisp-object
separate regular and disksave finalization, print method fixes.
Create separate disksave method and make the finalize method only be for
actual object finalization, not disksave finalization.
Fix places where 0 was given in place of a printer -- print methods are
mandatory, and internal objects formerly without a print method now must
explicitly specify internal_object_printer().
Change the defn of CONSOLE_LIVE_P to avoid problems in some weird situations.
-------------------- ChangeLog entries follow: --------------------
src/ChangeLog addition:
2010-01-20 Ben Wing <ben@xemacs.org>
* alloc.c:
* alloc.c (very_old_free_lcrecord):
* alloc.c (disksave_object_finalization_1):
* alloc.c (make_lcrecord_list):
* alloc.c (alloc_managed_lcrecord):
* alloc.c (free_managed_lcrecord):
* alloc.c (sweep_lcrecords_1):
* buffer.c:
* bytecode.c:
* bytecode.c (Fcompiled_function_p):
* chartab.c:
* console-impl.h:
* console-impl.h (CONSOLE_TYPE_P):
* console.c:
* console.c (set_quit_events):
* data.c:
* data.c (Fmake_ephemeron):
* database.c:
* database.c (finalize_database):
* database.c (Fclose_database):
* device-msw.c:
* device-msw.c (finalize_devmode):
* device-msw.c (allocate_devmode):
* device.c:
* elhash.c:
* elhash.c (finalize_hash_table):
* eval.c:
* eval.c (bind_multiple_value_limits):
* event-stream.c:
* event-stream.c (finalize_command_builder):
* events.c:
* events.c (mark_event):
* extents.c:
* extents.c (finalize_extent_info):
* extents.c (uninit_buffer_extents):
* faces.c:
* file-coding.c:
* file-coding.c (finalize_coding_system):
* file-coding.h:
* file-coding.h (struct coding_system_methods):
* file-coding.h (struct detector):
* floatfns.c:
* floatfns.c (extract_float):
* fns.c:
* fns.c (Fidentity):
* font-mgr.c (finalize_fc_pattern):
* font-mgr.c (finalize_fc_config):
* frame.c:
* glyphs.c:
* glyphs.c (finalize_image_instance):
* glyphs.c (unmap_subwindow_instance_cache_mapper):
* gui.c:
* gui.c (gui_error):
* keymap.c:
* lisp.h (struct Lisp_Symbol):
* lrecord.h:
* lrecord.h (struct lrecord_implementation):
* lrecord.h (MC_ALLOC_CALL_FINALIZER):
* lrecord.h (MC_ALLOC_CALL_FINALIZER_FOR_DISKSAVE):
* lrecord.h (DEFINE_DUMPABLE_LISP_OBJECT):
* lrecord.h (DEFINE_DUMPABLE_GENERAL_LISP_OBJECT):
* lrecord.h (DEFINE_DUMPABLE_SIZABLE_LISP_OBJECT):
* lrecord.h (DEFINE_DUMPABLE_SIZABLE_GENERAL_LISP_OBJECT):
* lrecord.h (DEFINE_DUMPABLE_FROB_BLOCK_LISP_OBJECT):
* lrecord.h (DEFINE_DUMPABLE_FROB_BLOCK_GENERAL_LISP_OBJECT):
* lrecord.h (DEFINE_DUMPABLE_FROB_BLOCK_SIZABLE_LISP_OBJECT):
* lrecord.h (DEFINE_DUMPABLE_INTERNAL_LISP_OBJECT):
* lrecord.h (DEFINE_DUMPABLE_SIZABLE_INTERNAL_LISP_OBJECT):
* lrecord.h (DEFINE_NODUMP_LISP_OBJECT):
* lrecord.h (DEFINE_NODUMP_GENERAL_LISP_OBJECT):
* lrecord.h (DEFINE_NODUMP_SIZABLE_LISP_OBJECT):
* lrecord.h (DEFINE_NODUMP_SIZABLE_GENERAL_LISP_OBJECT):
* lrecord.h (DEFINE_NODUMP_FROB_BLOCK_LISP_OBJECT):
* lrecord.h (DEFINE_NODUMP_FROB_BLOCK_GENERAL_LISP_OBJECT):
* lrecord.h (DEFINE_NODUMP_FROB_BLOCK_SIZABLE_LISP_OBJECT):
* lrecord.h (DEFINE_NODUMP_INTERNAL_LISP_OBJECT):
* lrecord.h (DEFINE_NODUMP_SIZABLE_INTERNAL_LISP_OBJECT):
* lrecord.h (MAKE_LISP_OBJECT):
* lrecord.h (DEFINE_DUMPABLE_MODULE_LISP_OBJECT):
* lrecord.h (DEFINE_DUMPABLE_MODULE_GENERAL_LISP_OBJECT):
* lrecord.h (DEFINE_DUMPABLE_MODULE_SIZABLE_LISP_OBJECT):
* lrecord.h (DEFINE_DUMPABLE_MODULE_SIZABLE_GENERAL_LISP_OBJECT):
* lrecord.h (DEFINE_NODUMP_MODULE_LISP_OBJECT):
* lrecord.h (DEFINE_NODUMP_MODULE_GENERAL_LISP_OBJECT):
* lrecord.h (DEFINE_NODUMP_MODULE_SIZABLE_LISP_OBJECT):
* lrecord.h (DEFINE_NODUMP_MODULE_SIZABLE_GENERAL_LISP_OBJECT):
* lrecord.h (MAKE_MODULE_LISP_OBJECT):
* lstream.c:
* lstream.c (finalize_lstream):
* lstream.c (disksave_lstream):
* marker.c:
* marker.c (finalize_marker):
* mule-charset.c (make_charset):
* number.c:
* objects.c:
* objects.c (finalize_color_instance):
* objects.c (finalize_font_instance):
* opaque.c:
* opaque.c (make_opaque_ptr):
* process-nt.c:
* process-nt.c (nt_finalize_process_data):
* process-nt.c (nt_deactivate_process):
* process.c:
* process.c (finalize_process):
* procimpl.h (struct process_methods):
* scrollbar.c:
* scrollbar.c (free_scrollbar_instance):
* specifier.c (finalize_specifier):
* symbols.c:
* toolbar.c:
* toolbar.c (Ftoolbar_button_p):
* tooltalk.c:
* ui-gtk.c:
* ui-gtk.c (emacs_gtk_object_finalizer):
* ui-gtk.c (allocate_emacs_gtk_boxed_data):
* window.c:
* window.c (finalize_window):
* window.c (mark_window_as_deleted):
Separate out regular and disksave finalization. Instead of a
FOR_DISKSAVE argument to the finalizer, create a separate object
method `disksaver'. Make `finalizer' have only one argument.
Go through and separate out all finalize methods into finalize
and disksave. Delete lots of thereby redundant disksave checking.
Delete places that signal an error if we attempt to disksave --
all of these objects are non-dumpable and we will get an error
from pdump anyway if we attempt to dump them. After this is done,
only one object remains that has a disksave method -- lstream.
Change DEFINE_*_LISP_OBJECT_WITH_PROPS to DEFINE_*_GENERAL_LISP_OBJECT,
which is used for specifying either property methods or disksave
methods (or in the future, any other less-used methods).
Remove the for_disksave argument to finalize_process_data. Don't
provide a disksaver for processes because no one currently needs
it.
Clean up various places where objects didn't provide a print method.
It was made mandatory in previous changes, and all methods now
either provide their own print method or use internal_object_printer
or external_object_printer.
Change the definition of CONSOLE_LIVE_P to use the contype enum
rather than looking into the conmeths structure -- in some weird
situations with dead objects, the conmeths structure is NULL,
and printing such objects from debug_print() will crash if we try
to look into the conmeths structure.
| author | Ben Wing <ben@xemacs.org> |
|---|---|
| date | Wed, 20 Jan 2010 07:05:57 -0600 |
| parents | d1247f3cc363 |
| children | b5df3737028a |
| rev | line source |
|---|---|
| 428 | 1 /* Functions for the mswindows window system. |
| 2 Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. | |
| 771 | 3 Copyright (C) 1995, 1996, 2001, 2002 Ben Wing. |
| 428 | 4 |
| 5 This file is part of XEmacs. | |
| 6 | |
| 7 XEmacs is free software; you can redistribute it and/or modify it | |
| 8 under the terms of the GNU General Public License as published by the | |
| 9 Free Software Foundation; either version 2, or (at your option) any | |
| 10 later version. | |
| 11 | |
| 12 XEmacs is distributed in the hope that it will be useful, but WITHOUT | |
| 13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
| 14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
| 15 for more details. | |
| 16 | |
| 17 You should have received a copy of the GNU General Public License | |
| 18 along with XEmacs; see the file COPYING. If not, write to | |
| 19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
| 20 Boston, MA 02111-1307, USA. */ | |
| 21 | |
| 22 /* Synched up with: Not synched with FSF. */ | |
| 23 | |
| 771 | 24 /* This file Mule-ized, 8-14-2000. */ |
| 25 | |
| 428 | 26 /* Authorship: |
| 27 | |
| 28 Ultimately based on FSF. | |
| 29 Substantially rewritten for XEmacs by Ben Wing. | |
| 30 Rewritten for mswindows by Jonathan Harris, November 1997 for 21.0. | |
| 31 Graphics features added and frame resizing fiddled with by Andy Piper. | |
| 32 */ | |
| 33 | |
| 34 #include <config.h> | |
| 35 #include "lisp.h" | |
| 36 | |
| 37 #include "buffer.h" | |
| 872 | 38 #include "device-impl.h" |
| 428 | 39 #include "elhash.h" |
| 40 #include "events.h" | |
| 41 #include "faces.h" | |
| 872 | 42 #include "frame-impl.h" |
| 428 | 43 #include "redisplay.h" |
| 44 #include "window.h" | |
| 45 | |
| 872 | 46 #include "console-msw-impl.h" |
| 800 | 47 #include "glyphs-msw.h" |
| 48 | |
| 428 | 49 #define MSWINDOWS_FRAME_STYLE (WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_OVERLAPPEDWINDOW) |
| 50 #define MSWINDOWS_POPUP_STYLE (WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_POPUP \ | |
| 51 | WS_CAPTION | WS_BORDER | WS_SYSMENU | WS_MINIMIZEBOX) | |
| 52 | |
| 53 #define MSWINDOWS_FRAME_EXSTYLE WS_EX_OVERLAPPEDWINDOW | |
| 54 #define MSWINDOWS_POPUP_EXSTYLE WS_EX_PALETTEWINDOW | |
| 55 | |
| 56 /* Default popup left top corner offset from the same | |
| 57 corner of the parent frame, in pixel */ | |
| 58 #define POPUP_OFFSET 30 | |
| 59 | |
| 60 /* Default popup size, in characters */ | |
| 61 #define POPUP_WIDTH 30 | |
| 62 #define POPUP_HEIGHT 10 | |
| 63 | |
| 793 | 64 /* Default regular frame size, in characters; if too big, it will get |
| 65 shrunk to the workspace size */ | |
| 428 | 66 #define DEFAULT_FRAME_WIDTH 80 |
| 793 | 67 #define DEFAULT_FRAME_HEIGHT 50 |
| 428 | 68 |
| 69 #ifdef HAVE_MENUBARS | |
| 70 #define ADJR_MENUFLAG TRUE | |
| 71 #else | |
| 72 #define ADJR_MENUFLAG FALSE | |
| 73 #endif | |
| 74 | |
| 75 /* Default properties to use when creating frames. */ | |
| 76 Lisp_Object Vdefault_mswindows_frame_plist; | |
| 440 | 77 Lisp_Object Vdefault_msprinter_frame_plist; |
| 428 | 78 Lisp_Object Vmswindows_use_system_frame_size_defaults; |
| 79 | |
| 80 /* This does not need to be GC protected, as it holds a | |
| 81 frame Lisp_Object already protected by Fmake_frame */ | |
| 82 Lisp_Object Vmswindows_frame_being_created; | |
| 83 | |
| 1204 | 84 static const struct memory_description mswindows_frame_data_description_1 [] = { |
| 85 #ifdef HAVE_TOOLBARS | |
| 86 { XD_LISP_OBJECT, offsetof (struct mswindows_frame, toolbar_hash_table) }, | |
| 87 #endif | |
| 88 { XD_LISP_OBJECT, offsetof (struct mswindows_frame, menu_hash_table) }, | |
| 89 { XD_LISP_OBJECT, offsetof (struct mswindows_frame, widget_hash_table1) }, | |
| 90 { XD_LISP_OBJECT, offsetof (struct mswindows_frame, widget_hash_table2) }, | |
| 91 { XD_LISP_OBJECT, offsetof (struct mswindows_frame, widget_hash_table3) }, | |
| 92 { XD_END } | |
| 93 }; | |
| 94 | |
| 3092 | 95 #ifdef NEW_GC |
|
5118
e0db3c197671
merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents:
4139
diff
changeset
|
96 DEFINE_DUMPABLE_INTERNAL_LISP_OBJECT ("mswindows-frame", mswindows_frame, |
|
e0db3c197671
merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents:
4139
diff
changeset
|
97 0, mswindows_frame_data_description_1, |
|
e0db3c197671
merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents:
4139
diff
changeset
|
98 Lisp_Mswindows_Frame); |
| 3092 | 99 #else /* not NEW_GC */ |
| 1204 | 100 extern const struct sized_memory_description mswindows_frame_data_description; |
| 101 | |
| 102 const struct sized_memory_description mswindows_frame_data_description = { | |
| 103 sizeof (struct mswindows_frame), mswindows_frame_data_description_1 | |
| 104 }; | |
| 3092 | 105 #endif /* not NEW_GC */ |
| 1204 | 106 |
| 440 | 107 /*---------------------------------------------------------------------*/ |
| 108 /*----- DISPLAY FRAME -----*/ | |
| 109 /*---------------------------------------------------------------------*/ | |
| 110 | |
| 3022 | 111 static struct frame * |
| 112 decode_mswindows_frame (Lisp_Object frame) | |
| 113 { | |
| 114 if (NILP (frame)) | |
| 115 frame = wrap_frame (selected_frame ()); | |
| 116 CHECK_LIVE_FRAME (frame); | |
| 117 /* this will also catch dead frames, but putting in the above check | |
| 118 results in a more useful error */ | |
| 119 CHECK_MSWINDOWS_FRAME (frame); | |
| 120 return XFRAME (frame); | |
| 121 } | |
| 122 | |
| 442 | 123 HWND |
| 124 mswindows_get_selected_frame_hwnd (void) | |
| 125 { | |
| 126 Lisp_Object frame, device; | |
| 127 | |
| 128 device = Ffind_device (Qnil, Qmswindows); | |
| 129 if (NILP (device)) | |
| 130 return NULL; | |
| 131 frame = DEVICE_SELECTED_FRAME (XDEVICE (device)); | |
| 132 if (NILP (frame)) | |
| 133 return NULL; | |
| 134 | |
| 135 return FRAME_MSWINDOWS_HANDLE (XFRAME (frame)); | |
| 136 } | |
| 137 | |
| 428 | 138 static void |
| 771 | 139 mswindows_init_frame_1 (struct frame *f, Lisp_Object props, |
| 2286 | 140 int UNUSED (frame_name_is_defaulted)) |
| 428 | 141 { |
| 142 Lisp_Object initially_unmapped; | |
| 143 Lisp_Object name, height, width, popup, top, left; | |
| 144 Lisp_Object frame_obj = Qnil; | |
| 145 RECT rect; | |
| 146 XEMACS_RECT_WH rect_default; | |
| 147 DWORD style, exstyle; | |
| 148 HWND hwnd, hwnd_parent; | |
| 149 | |
| 150 /* Pick up relevant properties */ | |
| 151 initially_unmapped = Fplist_get (props, Qinitially_unmapped, Qnil); | |
| 152 name = Fplist_get (props, Qname, Qnil); | |
| 442 | 153 |
| 428 | 154 popup = Fplist_get (props, Qpopup, Qnil); |
| 155 if (EQ (popup, Qt)) | |
| 156 popup = Fselected_frame (Qnil); | |
| 157 | |
| 158 left = Fplist_get (props, Qleft, Qnil); | |
| 159 if (!NILP (left)) | |
| 160 CHECK_INT (left); | |
| 161 | |
| 162 top = Fplist_get (props, Qtop, Qnil); | |
| 163 if (!NILP (top)) | |
| 164 CHECK_INT (top); | |
| 165 | |
| 166 width = Fplist_get (props, Qwidth, Qnil); | |
| 167 if (!NILP (width)) | |
| 168 CHECK_INT (width); | |
| 169 | |
| 170 height = Fplist_get (props, Qheight, Qnil); | |
| 171 if (!NILP (height)) | |
| 172 CHECK_INT (height); | |
| 173 | |
| 3092 | 174 #ifdef NEW_GC |
|
5120
d1247f3cc363
latest work on lisp-object workspace;
Ben Wing <ben@xemacs.org>
parents:
5118
diff
changeset
|
175 f->frame_data = XMSWINDOWS_FRAME (ALLOC_LISP_OBJECT (mswindows_frame)); |
| 3092 | 176 #else /* not NEW_GC */ |
| 428 | 177 f->frame_data = xnew_and_zero (struct mswindows_frame); |
| 3092 | 178 #endif /* not NEW_GC */ |
| 428 | 179 FRAME_MSWINDOWS_TARGET_RECT (f) = xnew_and_zero (XEMACS_RECT_WH); |
| 180 | |
| 181 FRAME_MSWINDOWS_TARGET_RECT (f)->left = NILP (left) ? -1 : abs (XINT (left)); | |
| 182 FRAME_MSWINDOWS_TARGET_RECT (f)->top = NILP (top) ? -1 : abs (XINT (top)); | |
| 442 | 183 FRAME_MSWINDOWS_TARGET_RECT (f)->width = NILP (width) ? -1 : |
| 428 | 184 abs (XINT (width)); |
| 442 | 185 FRAME_MSWINDOWS_TARGET_RECT (f)->height = NILP (height) ? -1 : |
| 428 | 186 abs (XINT (height)); |
| 442 | 187 |
| 428 | 188 /* Misc frame stuff */ |
| 771 | 189 FRAME_MSWINDOWS_MENU_HASH_TABLE (f) = Qnil; |
| 428 | 190 #ifdef HAVE_TOOLBARS |
| 1130 | 191 /* EQ not EQUAL or we will get QUIT crashes, see below. */ |
| 771 | 192 FRAME_MSWINDOWS_TOOLBAR_HASH_TABLE (f) = |
| 1130 | 193 make_lisp_hash_table (50, HASH_TABLE_NON_WEAK, HASH_TABLE_EQ); |
| 428 | 194 #endif |
| 1123 | 195 /* hashtable of instantiated glyphs on the frame. Make them EQ because |
| 196 we only use ints as keys. Otherwise we run into stickiness in | |
| 197 redisplay because internal_equal() can QUIT. See | |
| 198 enter_redisplay_critical_section(). */ | |
| 442 | 199 FRAME_MSWINDOWS_WIDGET_HASH_TABLE1 (f) = |
| 853 | 200 make_lisp_hash_table (50, HASH_TABLE_VALUE_WEAK, HASH_TABLE_EQ); |
| 442 | 201 FRAME_MSWINDOWS_WIDGET_HASH_TABLE2 (f) = |
| 853 | 202 make_lisp_hash_table (50, HASH_TABLE_VALUE_WEAK, HASH_TABLE_EQ); |
| 442 | 203 FRAME_MSWINDOWS_WIDGET_HASH_TABLE3 (f) = |
| 853 | 204 make_lisp_hash_table (50, HASH_TABLE_VALUE_WEAK, HASH_TABLE_EQ); |
| 428 | 205 /* Will initialize these in WM_SIZE handler. We cannot do it now, |
| 206 because we do not know what is CW_USEDEFAULT height and width */ | |
| 207 FRAME_WIDTH (f) = 0; | |
| 208 FRAME_HEIGHT (f) = 0; | |
| 209 FRAME_PIXWIDTH (f) = 0; | |
| 210 FRAME_PIXHEIGHT (f) = 0; | |
| 211 | |
| 212 if (NILP (popup)) | |
| 213 { | |
| 214 style = MSWINDOWS_FRAME_STYLE; | |
| 215 exstyle = MSWINDOWS_FRAME_EXSTYLE; | |
| 216 hwnd_parent = NULL; | |
| 217 | |
| 218 rect_default.left = rect_default.top = CW_USEDEFAULT; | |
| 219 rect_default.width = rect_default.height = CW_USEDEFAULT; | |
| 220 } | |
| 221 else | |
| 222 { | |
| 223 style = MSWINDOWS_POPUP_STYLE; | |
| 224 exstyle = MSWINDOWS_POPUP_EXSTYLE; | |
| 225 | |
| 226 CHECK_MSWINDOWS_FRAME (popup); | |
| 227 hwnd_parent = FRAME_MSWINDOWS_HANDLE (XFRAME (popup)); | |
| 228 assert (IsWindow (hwnd_parent)); | |
| 229 | |
| 230 /* We cannot use CW_USEDEFAULT when creating a popup window. | |
| 231 So by default, we offset the new popup 30 pixels right | |
| 232 and down from its parent, and give it size of 30x10 characters. | |
| 233 These dimensions look adequate on both high and low res monitors */ | |
| 234 GetWindowRect (hwnd_parent, &rect); | |
| 235 rect_default.left = rect.left + POPUP_OFFSET; | |
| 236 rect_default.top = rect.top + POPUP_OFFSET; | |
| 237 char_to_real_pixel_size (f, POPUP_WIDTH, POPUP_HEIGHT, | |
| 238 &rect_default.width, &rect_default.height); | |
| 442 | 239 FRAME_MSWINDOWS_POPUP (f) = 1; |
| 428 | 240 } |
| 241 | |
| 771 | 242 AdjustWindowRectEx (&rect, style, ADJR_MENUFLAG, exstyle); |
| 428 | 243 |
| 793 | 244 frame_obj = wrap_frame (f); |
| 428 | 245 |
| 246 Vmswindows_frame_being_created = frame_obj; | |
| 771 | 247 { |
| 248 const Extbyte *nameext = 0; | |
| 428 | 249 |
| 771 | 250 if (STRINGP (f->name)) |
| 251 LISP_STRING_TO_TSTR (f->name, nameext); | |
| 252 else if (STRINGP (name)) | |
| 253 LISP_STRING_TO_TSTR (name, nameext); | |
| 254 else | |
| 255 nameext = XETEXT (XEMACS_CLASS); | |
| 256 hwnd = qxeCreateWindowEx (exstyle, | |
| 257 XETEXT (XEMACS_CLASS), | |
| 258 nameext, | |
| 259 style, | |
| 260 rect_default.left, rect_default.top, | |
| 261 rect_default.width, rect_default.height, | |
| 262 hwnd_parent, NULL, NULL, NULL); | |
| 263 } | |
| 428 | 264 |
| 265 Vmswindows_frame_being_created = Qnil; | |
| 266 | |
| 267 if (hwnd == NULL) | |
| 442 | 268 invalid_operation ("System call to create frame failed", |
| 269 STRINGP (f->name) ? f->name : | |
| 270 STRINGP (name) ? name : | |
| 271 Qunbound); | |
| 771 | 272 |
| 273 FRAME_MSWINDOWS_HANDLE (f) = hwnd; | |
| 428 | 274 |
| 771 | 275 qxeSetWindowLong (hwnd, XWL_FRAMEOBJ, (LONG)LISP_TO_VOID (frame_obj)); |
| 276 FRAME_MSWINDOWS_DC (f) = GetDC (hwnd); | |
| 277 SetTextAlign (FRAME_MSWINDOWS_DC (f), TA_BASELINE | TA_LEFT | TA_NOUPDATECP); | |
| 442 | 278 |
| 771 | 279 #ifdef HAVE_DIALOGS |
| 442 | 280 if (FRAME_MSWINDOWS_POPUP (f)) |
| 281 mswindows_register_popup_frame (frame_obj); | |
| 771 | 282 #endif /* HAVE_DIALOGS */ |
| 428 | 283 } |
| 284 | |
| 285 static void | |
| 2286 | 286 mswindows_init_frame_2 (struct frame *f, Lisp_Object UNUSED (props)) |
| 428 | 287 { |
| 288 if (NILP (Vmswindows_use_system_frame_size_defaults)) | |
| 289 { | |
| 290 /* I don't think anything can set the frame size before this | |
| 291 since we don't have X resources. This may change if we look | |
| 292 at the registry. Even so these values can get overridden | |
| 293 later.*/ | |
| 442 | 294 XEMACS_RECT_WH dest = { -1, -1, DEFAULT_FRAME_WIDTH, |
| 428 | 295 DEFAULT_FRAME_HEIGHT }; |
| 296 mswindows_size_frame_internal (f, &dest); | |
| 297 } | |
| 298 } | |
| 299 | |
| 300 /* Called after frame's properties are set */ | |
| 301 static void | |
| 302 mswindows_init_frame_3 (struct frame *f) | |
| 303 { | |
| 4139 | 304 /* Don't do this earlier or we get a WM_PAINT before the frame is ready. */ |
| 305 ShowWindow (FRAME_MSWINDOWS_HANDLE(f), SW_SHOWNORMAL); | |
| 306 #ifdef CYGWIN | |
| 307 /* The SW_x parameter in the first call that an app makes to ShowWindow is | |
| 308 * ignored, and the parameter specified in the caller's STARTUPINFO is | |
| 309 * substituted instead. That parameter is SW_HIDE if we were started by | |
| 310 * runemacs, so call this twice. #### runemacs is evil. To see why this | |
| 311 * second call was restored, see the threads referenced by | |
| 312 * 20a807210611011157j57ea2b22ue892f4dfcb6aade8@mail.gmail.com and | |
| 313 * 20a807210708181345m7ac94ff2m43337be71e853d95@mail.gmail.com . */ | |
| 314 ShowWindow (FRAME_MSWINDOWS_HANDLE(f), SW_SHOWNORMAL); | |
| 315 #endif | |
| 316 SetForegroundWindow (FRAME_MSWINDOWS_HANDLE(f)); | |
| 317 DragAcceptFiles (FRAME_MSWINDOWS_HANDLE(f), TRUE); | |
| 428 | 318 } |
| 319 | |
| 320 static void | |
| 2286 | 321 mswindows_after_init_frame (struct frame *UNUSED (f), |
| 322 int UNUSED (first_on_device), int first_on_console) | |
| 428 | 323 { |
| 324 /* Windows, unlike X, is very synchronous. After the initial | |
| 442 | 325 frame is created, it will never be displayed, except for |
| 428 | 326 hollow border, unless we start pumping messages. Load progress |
| 327 messages show in the bottom of the hollow frame, which is ugly. | |
| 328 We redisplay the initial frame here, so modeline and root window | |
| 329 background show. | |
| 330 */ | |
| 331 if (first_on_console) | |
| 332 redisplay (); | |
| 333 } | |
| 334 | |
| 335 static void | |
| 336 mswindows_mark_frame (struct frame *f) | |
| 337 { | |
| 338 mark_object (FRAME_MSWINDOWS_MENU_HASH_TABLE (f)); | |
| 339 #ifdef HAVE_TOOLBARS | |
| 340 mark_object (FRAME_MSWINDOWS_TOOLBAR_HASH_TABLE (f)); | |
| 341 #endif | |
| 442 | 342 mark_object (FRAME_MSWINDOWS_WIDGET_HASH_TABLE1 (f)); |
| 343 mark_object (FRAME_MSWINDOWS_WIDGET_HASH_TABLE2 (f)); | |
| 344 mark_object (FRAME_MSWINDOWS_WIDGET_HASH_TABLE3 (f)); | |
| 428 | 345 } |
| 346 | |
| 347 static void | |
| 348 mswindows_focus_on_frame (struct frame *f) | |
| 349 { | |
| 771 | 350 SetForegroundWindow (FRAME_MSWINDOWS_HANDLE (f)); |
| 428 | 351 } |
| 352 | |
| 353 static void | |
| 354 mswindows_delete_frame (struct frame *f) | |
| 355 { | |
| 356 if (f->frame_data) | |
| 357 { | |
| 771 | 358 #ifdef HAVE_DIALOGS |
| 359 mswindows_unregister_popup_frame (wrap_frame (f)); | |
| 360 #endif | |
| 361 ReleaseDC (FRAME_MSWINDOWS_HANDLE (f), FRAME_MSWINDOWS_DC (f)); | |
| 362 DestroyWindow (FRAME_MSWINDOWS_HANDLE (f)); | |
| 4117 | 363 #ifndef NEW_GC |
| 1726 | 364 xfree (f->frame_data, void *); |
| 3092 | 365 #endif /* not NEW_GC */ |
| 428 | 366 } |
| 367 f->frame_data = 0; | |
| 368 } | |
| 369 | |
| 370 static void | |
| 371 mswindows_set_frame_size (struct frame *f, int width, int height) | |
| 372 { | |
| 373 RECT rect; | |
| 1395 | 374 int columns, rows; |
| 375 | |
| 428 | 376 rect.left = rect.top = 0; |
| 377 rect.right = width; | |
| 378 rect.bottom = height; | |
| 379 | |
| 1395 | 380 pixel_to_char_size (f, rect.right, rect.bottom, &columns, &rows); |
| 381 change_frame_size (f, rows, columns, 0); | |
| 382 | |
| 1318 | 383 /* This can call Lisp, because it runs the window procedure, which can |
| 384 call redisplay() */ | |
| 428 | 385 AdjustWindowRectEx (&rect, |
| 771 | 386 qxeGetWindowLong (FRAME_MSWINDOWS_HANDLE (f), GWL_STYLE), |
| 387 GetMenu (FRAME_MSWINDOWS_HANDLE (f)) != NULL, | |
| 388 qxeGetWindowLong (FRAME_MSWINDOWS_HANDLE (f), GWL_EXSTYLE)); | |
| 428 | 389 |
| 2872 | 390 if (IsIconic (FRAME_MSWINDOWS_HANDLE (f))) |
| 771 | 391 ShowWindow (FRAME_MSWINDOWS_HANDLE (f), SW_RESTORE); |
| 428 | 392 |
| 771 | 393 SetWindowPos (FRAME_MSWINDOWS_HANDLE (f), NULL, |
| 428 | 394 0, 0, rect.right-rect.left, rect.bottom-rect.top, |
| 395 SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOSENDCHANGING | SWP_NOMOVE); | |
| 396 } | |
| 397 | |
| 398 static void | |
| 399 mswindows_set_frame_position (struct frame *f, int xoff, int yoff) | |
| 400 { | |
| 771 | 401 SetWindowPos (FRAME_MSWINDOWS_HANDLE (f), NULL, |
| 428 | 402 xoff, yoff, 0, 0, |
| 403 SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOSENDCHANGING | SWP_NOSIZE); | |
| 404 } | |
| 405 | |
| 406 static void | |
| 442 | 407 mswindows_make_frame_visible (struct frame *f) |
| 428 | 408 { |
| 771 | 409 if (!FRAME_VISIBLE_P (f)) |
| 410 ShowWindow (FRAME_MSWINDOWS_HANDLE (f), SW_RESTORE); | |
| 428 | 411 else |
| 771 | 412 ShowWindow (FRAME_MSWINDOWS_HANDLE (f), SW_SHOW); |
| 413 SetActiveWindow (FRAME_MSWINDOWS_HANDLE (f)); | |
| 428 | 414 f->visible = 1; |
| 415 f->iconified = 0; | |
| 416 } | |
| 417 | |
| 418 static void | |
| 442 | 419 mswindows_make_frame_invisible (struct frame *f) |
| 428 | 420 { |
| 771 | 421 if (!FRAME_VISIBLE_P (f)) |
| 428 | 422 return; |
| 423 | |
| 771 | 424 ShowWindow (FRAME_MSWINDOWS_HANDLE (f), SW_HIDE); |
| 428 | 425 f->visible = 0; |
| 426 } | |
| 427 | |
| 428 static int | |
| 429 mswindows_frame_totally_visible_p (struct frame *f) | |
| 430 { | |
| 431 RECT rc_me, rc_other, rc_temp; | |
| 771 | 432 HWND hwnd = FRAME_MSWINDOWS_HANDLE (f); |
| 428 | 433 |
| 434 /* We test against not a whole window rectangle, only against its | |
| 435 client part. So, if non-client are is covered and client area is | |
| 436 not, we return true. */ | |
| 437 GetClientRect (hwnd, &rc_me); | |
| 2367 | 438 MapWindowPoints (hwnd, HWND_DESKTOP, (LPPOINT) (void *) (&rc_me), 2); |
| 428 | 439 |
| 440 /* First see if we're off the desktop */ | |
| 771 | 441 GetWindowRect (GetDesktopWindow (), &rc_other); |
| 442 UnionRect (&rc_temp, &rc_me, &rc_other); | |
| 428 | 443 if (!EqualRect (&rc_temp, &rc_other)) |
| 444 return 0; | |
| 442 | 445 |
| 428 | 446 /* Then see if any window above us obscures us */ |
| 447 while ((hwnd = GetWindow (hwnd, GW_HWNDPREV)) != NULL) | |
| 448 if (IsWindowVisible (hwnd)) | |
| 449 { | |
| 450 GetWindowRect (hwnd, &rc_other); | |
| 771 | 451 if (IntersectRect (&rc_temp, &rc_me, &rc_other)) |
| 428 | 452 return 0; |
| 453 } | |
| 454 | |
| 455 return 1; | |
| 456 } | |
| 457 | |
| 458 static int | |
| 459 mswindows_frame_visible_p (struct frame *f) | |
| 460 { | |
| 771 | 461 return IsWindowVisible (FRAME_MSWINDOWS_HANDLE (f)) |
| 462 && !IsIconic (FRAME_MSWINDOWS_HANDLE (f)); | |
| 428 | 463 } |
| 464 | |
| 465 | |
| 466 static void | |
| 467 mswindows_iconify_frame (struct frame *f) | |
| 468 { | |
| 771 | 469 ShowWindow (FRAME_MSWINDOWS_HANDLE (f), SW_MINIMIZE); |
| 428 | 470 f->visible = 0; |
| 471 f->iconified = 1; | |
| 472 } | |
| 473 | |
| 474 static int | |
| 475 mswindows_frame_iconified_p (struct frame *f) | |
| 476 { | |
| 771 | 477 return IsIconic (FRAME_MSWINDOWS_HANDLE (f)); |
| 428 | 478 } |
| 479 | |
| 480 static void | |
| 481 mswindows_set_frame_icon (struct frame *f) | |
| 482 { | |
| 483 if (IMAGE_INSTANCEP (f->icon) | |
| 484 && IMAGE_INSTANCE_PIXMAP_TYPE_P (XIMAGE_INSTANCE (f->icon))) | |
| 485 { | |
| 486 if (!XIMAGE_INSTANCE_MSWINDOWS_ICON (f->icon)) | |
| 487 { | |
| 442 | 488 mswindows_initialize_image_instance_icon (XIMAGE_INSTANCE (f->icon), |
| 428 | 489 FALSE); |
| 490 } | |
| 442 | 491 |
| 771 | 492 qxeSetClassLong (FRAME_MSWINDOWS_HANDLE (f), GCL_HICON, |
| 493 (LONG) XIMAGE_INSTANCE_MSWINDOWS_ICON (f->icon)); | |
| 428 | 494 } |
| 495 } | |
| 496 | |
| 497 static void | |
| 498 mswindows_set_frame_pointer (struct frame *f) | |
| 499 { | |
| 500 if (IMAGE_INSTANCEP (f->pointer) | |
| 501 && IMAGE_INSTANCE_TYPE (XIMAGE_INSTANCE (f->pointer)) == IMAGE_POINTER) | |
| 502 { | |
| 771 | 503 qxeSetClassLong (FRAME_MSWINDOWS_HANDLE (f), GCL_HCURSOR, |
| 504 (LONG) XIMAGE_INSTANCE_MSWINDOWS_ICON (f->pointer)); | |
| 428 | 505 /* we only have to do this because GC doesn't cause a mouse |
| 506 event and doesn't give time to event processing even if it | |
| 507 did. */ | |
| 508 SetCursor (XIMAGE_INSTANCE_MSWINDOWS_ICON (f->pointer)); | |
| 509 } | |
| 510 } | |
| 511 | |
| 512 static void | |
| 513 mswindows_set_mouse_position (struct window *w, int x, int y) | |
| 514 { | |
| 515 struct frame *f = XFRAME (w->frame); | |
| 516 POINT pt; | |
| 517 | |
| 518 pt.x = w->pixel_left + x; | |
| 519 pt.y = w->pixel_top + y; | |
| 771 | 520 ClientToScreen (FRAME_MSWINDOWS_HANDLE (f), &pt); |
| 428 | 521 SetCursorPos (pt.x, pt.y); |
| 522 } | |
| 523 | |
| 524 static int | |
| 2286 | 525 mswindows_get_mouse_position (struct device *UNUSED (d), Lisp_Object *frame, |
| 526 int *x, int *y) | |
| 428 | 527 { |
| 528 POINT pt; | |
| 529 HWND hwnd; | |
| 530 | |
| 531 GetCursorPos (&pt); | |
| 532 | |
| 533 /* What's under cursor? */ | |
| 534 hwnd = WindowFromPoint (pt); | |
| 535 if (hwnd == NULL) | |
| 536 return 0; | |
| 537 | |
| 538 /* Get grandest parent of the window */ | |
| 539 { | |
| 540 HWND hwnd_parent; | |
| 541 while ((hwnd_parent = GetParent (hwnd)) != NULL) | |
| 542 hwnd = hwnd_parent; | |
| 543 } | |
| 544 | |
| 545 /* Make sure it belongs to us */ | |
| 546 if (GetWindowThreadProcessId (hwnd, NULL) != GetCurrentThreadId ()) | |
| 547 return 0; | |
| 548 | |
| 549 /* And that the window is an XEmacs frame */ | |
| 771 | 550 if (!mswindows_window_is_xemacs (hwnd)) |
| 551 return 0; | |
| 428 | 552 |
| 553 /* Yippie! */ | |
| 554 ScreenToClient (hwnd, &pt); | |
| 826 | 555 *frame = VOID_TO_LISP ((void *) qxeGetWindowLong (hwnd, XWL_FRAMEOBJ)); |
| 428 | 556 *x = pt.x; |
| 557 *y = pt.y; | |
| 558 return 1; | |
| 559 } | |
| 560 | |
| 561 static void | |
| 562 mswindows_raise_frame (struct frame *f) | |
| 563 { | |
| 771 | 564 BringWindowToTop (FRAME_MSWINDOWS_HANDLE (f)); |
| 428 | 565 } |
| 566 | |
| 567 static void | |
| 568 mswindows_lower_frame (struct frame *f) | |
| 569 { | |
| 771 | 570 SetWindowPos (FRAME_MSWINDOWS_HANDLE (f), HWND_BOTTOM, 0, 0, 0, 0, |
| 428 | 571 SWP_NOSIZE | SWP_NOMOVE | SWP_NOSENDCHANGING); |
| 572 } | |
| 573 | |
| 574 static void | |
| 442 | 575 mswindows_enable_frame (struct frame *f) |
| 576 { | |
| 577 EnableWindow (FRAME_MSWINDOWS_HANDLE (f), TRUE); | |
| 578 } | |
| 579 | |
| 580 static void | |
| 581 mswindows_disable_frame (struct frame *f) | |
| 582 { | |
| 583 EnableWindow (FRAME_MSWINDOWS_HANDLE (f), FALSE); | |
| 584 } | |
| 585 | |
| 586 static void | |
| 867 | 587 mswindows_set_title_from_ibyte (struct frame *f, Ibyte *title) |
| 428 | 588 { |
| 771 | 589 unsigned int new_checksum = hash_string (title, qxestrlen (title)); |
| 593 | 590 if (new_checksum != FRAME_MSWINDOWS_TITLE_CHECKSUM (f)) |
| 428 | 591 { |
| 593 | 592 Extbyte *title_ext; |
| 593 | |
| 594 FRAME_MSWINDOWS_TITLE_CHECKSUM (f) = new_checksum; | |
| 771 | 595 C_STRING_TO_TSTR (title, title_ext); |
| 596 qxeSetWindowText (FRAME_MSWINDOWS_HANDLE (f), title_ext); | |
| 428 | 597 } |
| 598 } | |
| 599 | |
| 600 static Lisp_Object | |
| 3022 | 601 mswindows_window_id (Lisp_Object frame) |
| 602 { | |
| 603 Ibyte str[255]; | |
| 604 struct frame *f = decode_mswindows_frame (frame); | |
| 605 | |
| 3023 | 606 qxesprintf (str, "%lu", (unsigned long) FRAME_MSWINDOWS_HANDLE (f)); |
| 3022 | 607 return build_intstring (str); |
| 608 } | |
| 609 | |
| 610 static Lisp_Object | |
| 428 | 611 mswindows_frame_property (struct frame *f, Lisp_Object property) |
| 612 { | |
| 613 if (EQ (Qleft, property) || EQ (Qtop, property)) | |
| 614 { | |
| 615 RECT rc; | |
| 771 | 616 GetWindowRect (FRAME_MSWINDOWS_HANDLE (f), &rc); |
| 428 | 617 return make_int (EQ (Qtop, property) ? rc.top : rc.left); |
| 618 } | |
| 3022 | 619 if (EQ (Qwindow_id, property)) |
| 620 return mswindows_window_id (wrap_frame (f)); | |
| 621 | |
| 428 | 622 return Qunbound; |
| 623 } | |
| 624 | |
| 625 static int | |
| 2286 | 626 mswindows_internal_frame_property_p (struct frame *UNUSED (f), |
| 627 Lisp_Object property) | |
| 428 | 628 { |
| 629 return EQ (property, Qleft) | |
| 3022 | 630 || EQ (property, Qtop) |
| 631 || EQ (property, Qwindow_id); | |
| 428 | 632 /* #### frame-x.c has also this. Why? |
| 633 || STRINGP (property); | |
| 634 */ | |
| 635 } | |
| 636 | |
| 637 static Lisp_Object | |
| 638 mswindows_frame_properties (struct frame *f) | |
| 639 { | |
| 640 Lisp_Object props = Qnil; | |
| 641 RECT rc; | |
| 771 | 642 GetWindowRect (FRAME_MSWINDOWS_HANDLE (f), &rc); |
| 428 | 643 |
| 644 props = cons3 (Qtop, make_int (rc.top), props); | |
| 645 props = cons3 (Qleft, make_int (rc.left), props); | |
| 3022 | 646 props = cons3 (Qwindow_id, mswindows_window_id (wrap_frame (f)), props); |
| 428 | 647 |
| 648 return props; | |
| 649 } | |
| 650 | |
| 651 static void | |
| 652 mswindows_set_frame_properties (struct frame *f, Lisp_Object plist) | |
| 653 { | |
| 654 int x=-1, y=-1; | |
| 655 int width = -1, height = -1; | |
| 656 BOOL width_specified_p = FALSE; | |
| 657 BOOL height_specified_p = FALSE; | |
| 658 BOOL x_specified_p = FALSE; | |
| 659 BOOL y_specified_p = FALSE; | |
| 660 Lisp_Object tail; | |
| 661 | |
| 662 /* Extract the properties from plist */ | |
| 663 for (tail = plist; !NILP (tail); tail = Fcdr (Fcdr (tail))) | |
| 664 { | |
| 665 Lisp_Object prop = Fcar (tail); | |
| 666 Lisp_Object val = Fcar (Fcdr (tail)); | |
| 667 | |
| 668 if (SYMBOLP (prop)) | |
| 669 { | |
| 670 /* Kludge to handle the font property. */ | |
| 671 if (EQ (prop, Qfont)) | |
| 672 { | |
| 673 /* If the value is not a string we silently ignore it. */ | |
| 674 if (STRINGP (val)) | |
| 675 { | |
| 676 Lisp_Object frm, font_spec; | |
| 442 | 677 |
| 793 | 678 frm = wrap_frame (f); |
| 428 | 679 font_spec = Fget (Fget_face (Qdefault), Qfont, Qnil); |
| 680 | |
| 681 Fadd_spec_to_specifier (font_spec, val, frm, Qnil, Qnil); | |
| 682 update_frame_face_values (f); | |
| 683 } | |
| 684 } | |
| 685 else if (EQ (prop, Qwidth)) | |
| 686 { | |
| 687 CHECK_INT (val); | |
| 688 width = XINT (val); | |
| 689 width_specified_p = TRUE; | |
| 690 } | |
| 691 else if (EQ (prop, Qheight)) | |
| 692 { | |
| 693 CHECK_INT (val); | |
| 694 height = XINT (val); | |
| 695 height_specified_p = TRUE; | |
| 696 } | |
| 697 else if (EQ (prop, Qleft)) | |
| 698 { | |
| 699 CHECK_INT (val); | |
| 700 x = XINT (val); | |
| 701 x_specified_p = TRUE; | |
| 702 } | |
| 703 else if (EQ (prop, Qtop)) | |
| 704 { | |
| 705 CHECK_INT (val); | |
| 706 y = XINT (val); | |
| 707 y_specified_p = TRUE; | |
| 708 } | |
| 709 } | |
| 710 } | |
| 711 | |
| 712 /* Now we've extracted the properties, apply them. | |
| 713 Do not apply geometric properties during frame creation. This | |
| 442 | 714 is excessive anyways, and this loses because WM_SIZE has not |
| 428 | 715 been sent yet, so frame width and height fields are not initialized. |
| 442 | 716 |
| 428 | 717 unfortunately WM_SIZE loses as well since the resize is only |
| 718 applied once and the first time WM_SIZE is applied not everything | |
| 719 is initialised in the frame (toolbars for instance). enabling | |
| 720 this always makes no visible difference and fixes a whole host of | |
| 721 bugs (and is more consistent with X) so I am going to reenable it. | |
| 722 --andyp */ | |
| 723 if ( FRAME_PIXWIDTH (f) && FRAME_PIXHEIGHT (f) | |
| 440 | 724 && (width_specified_p || height_specified_p |
| 725 || x_specified_p || y_specified_p)) | |
| 428 | 726 { |
| 727 XEMACS_RECT_WH dest = { x, y, width, height }; | |
| 728 | |
| 729 mswindows_size_frame_internal (f, &dest); | |
| 730 } | |
| 731 } | |
| 732 | |
| 506 | 733 void |
| 771 | 734 mswindows_size_frame_internal (struct frame *f, XEMACS_RECT_WH *dest) |
| 428 | 735 { |
| 442 | 736 RECT rect, ws_rect; |
| 428 | 737 int pixel_width, pixel_height; |
| 738 int size_p = (dest->width >=0 || dest->height >=0); | |
| 739 int move_p = (dest->top >=0 || dest->left >=0); | |
| 506 | 740 char_to_real_pixel_size (f, dest->width, dest->height, &pixel_width, |
| 741 &pixel_height); | |
| 442 | 742 |
| 428 | 743 if (dest->width < 0) |
| 744 pixel_width = FRAME_PIXWIDTH (f); | |
| 745 if (dest->height < 0) | |
| 746 pixel_height = FRAME_PIXHEIGHT (f); | |
| 747 | |
| 771 | 748 GetWindowRect (FRAME_MSWINDOWS_HANDLE (f), &rect); |
| 428 | 749 if (dest->left < 0) |
| 750 dest->left = rect.left; | |
| 751 if (dest->top < 0) | |
| 752 dest->top = rect.top; | |
| 442 | 753 |
| 428 | 754 rect.left = rect.top = 0; |
| 755 rect.right = pixel_width; | |
| 756 rect.bottom = pixel_height; | |
| 757 | |
| 758 AdjustWindowRectEx (&rect, | |
| 771 | 759 qxeGetWindowLong (FRAME_MSWINDOWS_HANDLE (f), GWL_STYLE), |
| 760 GetMenu (FRAME_MSWINDOWS_HANDLE (f)) != NULL, | |
| 761 qxeGetWindowLong (FRAME_MSWINDOWS_HANDLE (f), GWL_EXSTYLE)); | |
| 428 | 762 |
| 442 | 763 /* resize and move the window so that it fits in the workspace. This is |
| 428 | 764 not restrictive since this will happen later anyway in WM_SIZE. We |
| 765 have to do this after adjusting the rect to account for menubar | |
| 766 etc. */ | |
| 442 | 767 mswindows_get_workspace_coords (&ws_rect); |
| 428 | 768 pixel_width = rect.right - rect.left; |
| 769 pixel_height = rect.bottom - rect.top; | |
| 442 | 770 if (pixel_width > ws_rect.right - ws_rect.left) |
| 428 | 771 { |
| 442 | 772 pixel_width = ws_rect.right - ws_rect.left; |
| 428 | 773 size_p=1; |
| 774 } | |
| 442 | 775 if (pixel_height > ws_rect.bottom - ws_rect.top) |
| 428 | 776 { |
| 442 | 777 pixel_height = ws_rect.bottom - ws_rect.top; |
| 428 | 778 size_p=1; |
| 779 } | |
| 780 | |
| 442 | 781 /* adjust position so window is in workspace */ |
| 782 if (dest->left + pixel_width > ws_rect.right) | |
| 428 | 783 { |
| 442 | 784 dest->left = ws_rect.right - pixel_width; |
| 428 | 785 move_p=1; |
| 786 } | |
| 442 | 787 if (dest->left < ws_rect.left) |
| 428 | 788 { |
| 442 | 789 dest->left = ws_rect.left; |
| 428 | 790 move_p=1; |
| 791 } | |
| 792 | |
| 442 | 793 if (dest->top + pixel_height > ws_rect.bottom) |
| 794 { | |
| 795 dest->top = ws_rect.bottom - pixel_height; | |
| 796 move_p=1; | |
| 797 } | |
| 798 if (dest->top < ws_rect.top) | |
| 799 { | |
| 800 dest->top = ws_rect.top; | |
| 801 move_p=1; | |
| 802 } | |
| 803 | |
| 771 | 804 if (IsIconic (FRAME_MSWINDOWS_HANDLE (f)) |
| 805 || IsZoomed (FRAME_MSWINDOWS_HANDLE (f))) | |
| 806 ShowWindow (FRAME_MSWINDOWS_HANDLE (f), SW_RESTORE); | |
| 428 | 807 |
| 771 | 808 SetWindowPos (FRAME_MSWINDOWS_HANDLE (f), NULL, |
| 428 | 809 dest->left, dest->top, pixel_width, pixel_height, |
| 810 SWP_NOACTIVATE | SWP_NOZORDER | SWP_NOSENDCHANGING | |
| 811 | (size_p ? 0 : SWP_NOSIZE) | |
| 812 | (move_p ? 0 : SWP_NOMOVE)); | |
| 813 } | |
| 814 | |
| 815 static Lisp_Object | |
| 816 mswindows_get_frame_parent (struct frame *f) | |
| 817 { | |
| 771 | 818 HWND hwnd = FRAME_MSWINDOWS_HANDLE (f); |
| 428 | 819 hwnd = GetParent (hwnd); |
| 820 if (hwnd) | |
| 821 { | |
| 822 Lisp_Object parent; | |
| 826 | 823 parent = VOID_TO_LISP ((void *) qxeGetWindowLong (hwnd, XWL_FRAMEOBJ)); |
| 428 | 824 assert (FRAME_MSWINDOWS_P (XFRAME (parent))); |
| 825 return parent; | |
| 826 } | |
| 827 else | |
| 828 return Qnil; | |
| 829 } | |
| 830 | |
| 831 static void | |
| 2286 | 832 mswindows_update_frame_external_traits (struct frame *UNUSED (frm), |
| 833 Lisp_Object UNUSED (name)) | |
| 428 | 834 { |
| 835 } | |
| 836 | |
| 837 static int | |
| 838 mswindows_frame_size_fixed_p (struct frame *f) | |
| 839 { | |
| 840 /* Frame size cannot change if the frame is maximized */ | |
| 841 return IsZoomed (FRAME_MSWINDOWS_HANDLE (f)); | |
| 842 } | |
| 843 | |
| 440 | 844 /*---------------------------------------------------------------------*/ |
| 845 /*----- PRINTER FRAME -----*/ | |
| 846 /*---------------------------------------------------------------------*/ | |
| 847 | |
| 442 | 848 /* |
| 849 * With some driver/os combination (I discovered this with HP drivers | |
| 850 * under W2K), DC geometry is reset upon StartDoc and EndPage | |
| 851 * calls. This is called every time one of these calls is made. | |
| 852 */ | |
| 853 static void | |
| 854 apply_dc_geometry (struct frame* f) | |
| 855 { | |
| 856 HDC hdc = DEVICE_MSPRINTER_HDC (XDEVICE (FRAME_DEVICE (f))); | |
| 857 SetTextAlign (hdc, TA_BASELINE | TA_LEFT | TA_NOUPDATECP); | |
| 858 SetViewportOrgEx (hdc, FRAME_MSPRINTER_PIXLEFT(f), | |
| 859 FRAME_MSPRINTER_PIXTOP(f), NULL); | |
| 860 } | |
| 861 | |
| 862 void | |
| 863 msprinter_start_page (struct frame *f) | |
| 864 { | |
| 865 if (!FRAME_MSPRINTER_PAGE_STARTED (f)) | |
| 866 { | |
| 867 FRAME_MSPRINTER_PAGE_STARTED (f) = 1; | |
| 868 StartPage (DEVICE_MSPRINTER_HDC (XDEVICE (FRAME_DEVICE (f)))); | |
| 869 apply_dc_geometry (f); | |
| 870 } | |
| 871 } | |
| 440 | 872 |
| 873 static void | |
| 874 error_frame_unsizable (struct frame *f) | |
| 875 { | |
| 793 | 876 Lisp_Object frame = wrap_frame (f); |
| 877 | |
| 442 | 878 invalid_change ("Cannot resize frame (margins) after print job has started.", |
| 879 frame); | |
| 440 | 880 } |
| 881 | |
| 882 static void | |
| 883 maybe_error_if_job_active (struct frame *f) | |
| 884 { | |
| 885 if (FRAME_MSPRINTER_JOB_STARTED (f)) | |
| 886 error_frame_unsizable (f); | |
| 887 } | |
| 888 | |
| 889 static void | |
| 2286 | 890 msprinter_init_frame_1 (struct frame *f, Lisp_Object UNUSED (props), |
| 891 int UNUSED (frame_name_is_defaulted)) | |
| 440 | 892 { |
| 893 /* Make sure this is the only frame on device. Windows printer can | |
| 894 handle only one job at a time. */ | |
| 895 if (!NILP (DEVICE_FRAME_LIST (XDEVICE (FRAME_DEVICE (f))))) | |
| 442 | 896 invalid_operation ("Only one frame (print job) at a time is allowed on " |
| 897 "this printer device", FRAME_DEVICE (f)); | |
| 440 | 898 |
| 899 f->frame_data = xnew_and_zero (struct msprinter_frame); | |
| 900 | |
| 506 | 901 FRAME_MSPRINTER_TOP_MARGIN (f) = |
| 902 mswindows_get_default_margin (Qtop_margin); | |
| 903 FRAME_MSPRINTER_BOTTOM_MARGIN (f) = | |
| 904 mswindows_get_default_margin (Qbottom_margin); | |
| 905 FRAME_MSPRINTER_LEFT_MARGIN (f) = | |
| 906 mswindows_get_default_margin (Qleft_margin); | |
| 907 FRAME_MSPRINTER_RIGHT_MARGIN (f) = | |
| 908 mswindows_get_default_margin (Qright_margin); | |
| 440 | 909 |
| 910 /* Negative for "uinspecified" */ | |
| 506 | 911 FRAME_MSPRINTER_CHARWIDTH (f) = -1; |
| 912 FRAME_MSPRINTER_CHARHEIGHT (f) = -1; | |
| 440 | 913 } |
| 914 | |
| 915 static void | |
| 916 msprinter_init_frame_3 (struct frame *f) | |
| 917 { | |
| 771 | 918 DOCINFOW di; |
| 440 | 919 struct device *device = XDEVICE (FRAME_DEVICE (f)); |
| 920 int frame_left, frame_top, frame_width, frame_height; | |
| 903 | 921 |
| 442 | 922 /* DC might be recreated in msprinter_apply_devmode, |
| 923 so do not initialize until now */ | |
| 903 | 924 HDC hdc = DEVICE_MSPRINTER_HDC (device); |
| 925 int logpixelsx = GetDeviceCaps (hdc, LOGPIXELSX); | |
| 926 int logpixelsy = GetDeviceCaps (hdc, LOGPIXELSY); | |
| 927 int physicaloffsetx = GetDeviceCaps (hdc, PHYSICALOFFSETX); | |
| 928 int physicaloffsety = GetDeviceCaps (hdc, PHYSICALOFFSETY); | |
| 929 int physicalheight = GetDeviceCaps (hdc, PHYSICALHEIGHT); | |
| 930 int physicalwidth = GetDeviceCaps (hdc, PHYSICALWIDTH); | |
| 440 | 931 |
| 903 | 932 /* Compute geometry properties. |
| 933 Conversion is from TWIPS -> inches -> pixels. */ | |
| 934 frame_left = MulDiv (logpixelsx, FRAME_MSPRINTER_LEFT_MARGIN(f), 1440) | |
| 935 - physicaloffsetx; | |
| 936 | |
| 771 | 937 if (FRAME_MSPRINTER_CHARWIDTH (f) > 0) |
| 440 | 938 { |
| 771 | 939 char_to_real_pixel_size (f, FRAME_MSPRINTER_CHARWIDTH (f), 0, |
| 440 | 940 &frame_width, NULL); |
| 903 | 941 FRAME_MSPRINTER_RIGHT_MARGIN(f) = |
| 942 MulDiv (physicalwidth - (frame_left + frame_width), 1440, | |
| 943 logpixelsx); | |
| 442 | 944 } |
| 440 | 945 else |
| 903 | 946 frame_width = physicalwidth - frame_left |
| 947 - MulDiv (logpixelsx, FRAME_MSPRINTER_RIGHT_MARGIN(f), 1440) | |
| 948 - physicaloffsetx; | |
| 440 | 949 |
| 903 | 950 frame_top = MulDiv (logpixelsy, FRAME_MSPRINTER_TOP_MARGIN(f), 1440) |
| 951 - physicaloffsety; | |
| 440 | 952 |
| 771 | 953 if (FRAME_MSPRINTER_CHARHEIGHT (f) > 0) |
| 440 | 954 { |
| 771 | 955 char_to_real_pixel_size (f, 0, FRAME_MSPRINTER_CHARHEIGHT (f), |
| 440 | 956 NULL, &frame_height); |
| 957 | |
| 903 | 958 FRAME_MSPRINTER_BOTTOM_MARGIN(f) = |
| 959 MulDiv (physicalheight - (frame_top + frame_height), 1440, | |
| 960 logpixelsy); | |
| 442 | 961 } |
| 440 | 962 else |
| 903 | 963 frame_height = physicalheight - frame_top |
| 964 - MulDiv (logpixelsy, FRAME_MSPRINTER_BOTTOM_MARGIN(f), 1440) | |
| 965 - physicaloffsety; | |
| 440 | 966 |
| 967 /* Geometry sanity checks */ | |
| 968 if (!frame_pixsize_valid_p (f, frame_width, frame_height)) | |
| 442 | 969 invalid_operation ("Area inside print margins has shrunk to naught", |
| 970 STRINGP (f->name) ? f->name : Qunbound); | |
| 440 | 971 |
| 972 if (frame_left < 0 | |
| 973 || frame_top < 0 | |
| 974 || frame_left + frame_width > GetDeviceCaps (hdc, HORZRES) | |
| 975 || frame_top + frame_height > GetDeviceCaps (hdc, VERTRES)) | |
| 546 | 976 invalid_operation ("Print area is outside of the printer's " |
| 442 | 977 "hardware printable area", |
| 978 STRINGP (f->name) ? f->name : Qunbound); | |
| 440 | 979 |
| 980 /* Apply XEmacs frame geometry and layout windows */ | |
| 981 { | |
| 982 int rows, columns; | |
| 771 | 983 FRAME_PIXWIDTH (f) = frame_width; |
| 984 FRAME_PIXHEIGHT (f) = frame_height; | |
| 440 | 985 pixel_to_char_size (f, frame_width, frame_height, &columns, &rows); |
| 986 change_frame_size (f, rows, columns, 0); | |
| 987 } | |
| 988 | |
| 442 | 989 FRAME_MSPRINTER_PIXLEFT(f) = frame_left; |
| 990 FRAME_MSPRINTER_PIXTOP(f) = frame_top; | |
| 440 | 991 |
| 992 /* Start print job */ | |
| 993 di.cbSize = sizeof (di); | |
| 771 | 994 { |
| 995 const Extbyte *nameext; | |
| 996 | |
| 997 if (STRINGP (f->name)) | |
| 998 LISP_STRING_TO_TSTR (f->name, nameext); | |
| 999 else | |
| 1000 nameext = XETEXT ("XEmacs print document"); | |
| 1001 di.lpszDocName = (XELPTSTR) nameext; | |
| 1002 } | |
| 440 | 1003 di.lpszOutput = NULL; |
| 1004 di.lpszDatatype = NULL; | |
| 1005 di.fwType = 0; | |
| 1006 | |
| 771 | 1007 if (qxeStartDoc (hdc, &di) <= 0) |
| 442 | 1008 invalid_operation ("Cannot start print job", |
| 1009 STRINGP (f->name) ? f->name : Qunbound); | |
| 1010 | |
| 1011 apply_dc_geometry (f); | |
| 440 | 1012 |
| 1013 /* Finish frame setup */ | |
| 1014 FRAME_MSPRINTER_JOB_STARTED (f) = 1; | |
| 771 | 1015 FRAME_VISIBLE_P (f) = 0; |
| 440 | 1016 } |
| 1017 | |
| 1018 static void | |
| 2286 | 1019 msprinter_mark_frame (struct frame *UNUSED (f)) |
| 440 | 1020 { |
| 1021 } | |
| 1022 | |
| 1023 static void | |
| 1024 msprinter_delete_frame (struct frame *f) | |
| 1025 { | |
| 1026 if (f->frame_data) | |
| 1027 { | |
| 442 | 1028 HDC hdc = DEVICE_MSPRINTER_HDC (XDEVICE (FRAME_DEVICE (f))); |
| 1029 if (FRAME_MSPRINTER_PAGE_STARTED (f)) | |
| 1030 EndPage (hdc); | |
| 440 | 1031 if (FRAME_MSPRINTER_JOB_STARTED (f)) |
| 442 | 1032 EndDoc (hdc); |
| 1726 | 1033 xfree (f->frame_data, void *); |
| 440 | 1034 } |
| 1035 | |
| 1036 f->frame_data = 0; | |
| 1037 } | |
| 1038 | |
| 1039 static Lisp_Object | |
| 1040 msprinter_frame_property (struct frame *f, Lisp_Object property) | |
| 1041 { | |
| 1042 if (EQ (Qleft_margin, property)) | |
| 771 | 1043 return make_int (FRAME_MSPRINTER_LEFT_MARGIN (f)); |
| 440 | 1044 else if (EQ (Qtop_margin, property)) |
| 771 | 1045 return make_int (FRAME_MSPRINTER_TOP_MARGIN (f)); |
| 440 | 1046 if (EQ (Qright_margin, property)) |
| 771 | 1047 return make_int (FRAME_MSPRINTER_RIGHT_MARGIN (f)); |
| 440 | 1048 else if (EQ (Qbottom_margin, property)) |
| 771 | 1049 return make_int (FRAME_MSPRINTER_BOTTOM_MARGIN (f)); |
| 440 | 1050 else |
| 1051 return Qunbound; | |
| 1052 } | |
| 1053 | |
| 1054 static int | |
| 2286 | 1055 msprinter_internal_frame_property_p (struct frame *UNUSED (f), |
| 1056 Lisp_Object property) | |
| 440 | 1057 { |
| 1058 return (EQ (Qleft_margin, property) || EQ (Qtop_margin, property) || | |
| 442 | 1059 EQ (Qright_margin, property) || EQ (Qbottom_margin, property)); |
| 440 | 1060 } |
| 1061 | |
| 1062 static Lisp_Object | |
| 1063 msprinter_frame_properties (struct frame *f) | |
| 1064 { | |
| 1065 Lisp_Object props = Qnil; | |
| 1066 props = cons3 (Qbottom_margin, | |
| 771 | 1067 make_int (FRAME_MSPRINTER_BOTTOM_MARGIN (f)), props); |
| 440 | 1068 props = cons3 (Qright_margin, |
| 771 | 1069 make_int (FRAME_MSPRINTER_RIGHT_MARGIN (f)), props); |
| 440 | 1070 props = cons3 (Qtop_margin, |
| 771 | 1071 make_int (FRAME_MSPRINTER_TOP_MARGIN (f)), props); |
| 440 | 1072 props = cons3 (Qleft_margin, |
| 771 | 1073 make_int (FRAME_MSPRINTER_LEFT_MARGIN (f)), props); |
| 440 | 1074 return props; |
| 1075 } | |
| 1076 | |
| 1077 static void | |
| 1078 msprinter_set_frame_properties (struct frame *f, Lisp_Object plist) | |
| 1079 { | |
| 1080 Lisp_Object tail; | |
| 1081 | |
| 1082 /* Extract the properties from plist */ | |
| 1083 for (tail = plist; !NILP (tail); tail = Fcdr (Fcdr (tail))) | |
| 1084 { | |
| 1085 Lisp_Object prop = Fcar (tail); | |
| 1086 Lisp_Object val = Fcar (Fcdr (tail)); | |
| 1087 | |
| 1088 if (SYMBOLP (prop)) | |
| 1089 { | |
| 1090 if (EQ (prop, Qwidth)) | |
| 1091 { | |
| 1092 maybe_error_if_job_active (f); | |
| 1093 if (!NILP (val)) | |
| 1094 { | |
| 1095 CHECK_NATNUM (val); | |
| 771 | 1096 FRAME_MSPRINTER_CHARWIDTH (f) = XINT (val); |
| 440 | 1097 } |
| 1098 } | |
| 1099 if (EQ (prop, Qheight)) | |
| 1100 { | |
| 1101 maybe_error_if_job_active (f); | |
| 1102 if (!NILP (val)) | |
| 1103 { | |
| 1104 CHECK_NATNUM (val); | |
| 771 | 1105 FRAME_MSPRINTER_CHARHEIGHT (f) = XINT (val); |
| 440 | 1106 } |
| 1107 } | |
| 1108 else if (EQ (prop, Qleft_margin)) | |
| 1109 { | |
| 1110 maybe_error_if_job_active (f); | |
| 1111 CHECK_NATNUM (val); | |
| 771 | 1112 FRAME_MSPRINTER_LEFT_MARGIN (f) = XINT (val); |
| 440 | 1113 } |
| 1114 else if (EQ (prop, Qtop_margin)) | |
| 1115 { | |
| 1116 maybe_error_if_job_active (f); | |
| 1117 CHECK_NATNUM (val); | |
| 771 | 1118 FRAME_MSPRINTER_TOP_MARGIN (f) = XINT (val); |
| 440 | 1119 } |
| 1120 else if (EQ (prop, Qright_margin)) | |
| 1121 { | |
| 1122 maybe_error_if_job_active (f); | |
| 1123 CHECK_NATNUM (val); | |
| 771 | 1124 FRAME_MSPRINTER_RIGHT_MARGIN (f) = XINT (val); |
| 440 | 1125 } |
| 1126 else if (EQ (prop, Qbottom_margin)) | |
| 1127 { | |
| 1128 maybe_error_if_job_active (f); | |
| 1129 CHECK_NATNUM (val); | |
| 771 | 1130 FRAME_MSPRINTER_BOTTOM_MARGIN (f) = XINT (val); |
| 440 | 1131 } |
| 1132 } | |
| 1133 } | |
| 1134 } | |
| 1135 | |
| 1136 static void | |
| 2286 | 1137 msprinter_set_frame_size (struct frame *f, int UNUSED (width), |
| 1138 int UNUSED (height)) | |
| 440 | 1139 { |
| 1140 /* We're absolutely unsizeable */ | |
| 1141 error_frame_unsizable (f); | |
| 1142 } | |
| 1143 | |
| 442 | 1144 static void |
| 1145 msprinter_eject_page (struct frame *f) | |
| 1146 { | |
| 1147 /* #### Should we eject empty pages? */ | |
| 1148 if (FRAME_MSPRINTER_PAGE_STARTED (f)) | |
| 1149 { | |
| 1150 FRAME_MSPRINTER_PAGE_STARTED (f) = 0; | |
| 1151 EndPage (DEVICE_MSPRINTER_HDC (XDEVICE (FRAME_DEVICE (f)))); | |
| 1152 apply_dc_geometry (f); | |
| 1153 } | |
| 1154 } | |
| 1155 | |
| 1156 | |
| 428 | 1157 void |
| 1158 console_type_create_frame_mswindows (void) | |
| 1159 { | |
| 440 | 1160 /* Display frames */ |
| 428 | 1161 CONSOLE_HAS_METHOD (mswindows, init_frame_1); |
| 442 | 1162 CONSOLE_HAS_METHOD (mswindows, init_frame_2); |
| 428 | 1163 CONSOLE_HAS_METHOD (mswindows, init_frame_3); |
| 1164 CONSOLE_HAS_METHOD (mswindows, after_init_frame); | |
| 1165 CONSOLE_HAS_METHOD (mswindows, mark_frame); | |
| 1166 CONSOLE_HAS_METHOD (mswindows, focus_on_frame); | |
| 1167 CONSOLE_HAS_METHOD (mswindows, delete_frame); | |
| 1168 CONSOLE_HAS_METHOD (mswindows, get_mouse_position); | |
| 1169 CONSOLE_HAS_METHOD (mswindows, set_mouse_position); | |
| 1170 CONSOLE_HAS_METHOD (mswindows, raise_frame); | |
| 1171 CONSOLE_HAS_METHOD (mswindows, lower_frame); | |
| 442 | 1172 CONSOLE_HAS_METHOD (mswindows, enable_frame); |
| 1173 CONSOLE_HAS_METHOD (mswindows, disable_frame); | |
| 428 | 1174 CONSOLE_HAS_METHOD (mswindows, make_frame_visible); |
| 1175 CONSOLE_HAS_METHOD (mswindows, make_frame_invisible); | |
| 1176 CONSOLE_HAS_METHOD (mswindows, iconify_frame); | |
| 1177 CONSOLE_HAS_METHOD (mswindows, set_frame_size); | |
| 1178 CONSOLE_HAS_METHOD (mswindows, set_frame_position); | |
| 1179 CONSOLE_HAS_METHOD (mswindows, frame_property); | |
| 1180 CONSOLE_HAS_METHOD (mswindows, internal_frame_property_p); | |
| 1181 CONSOLE_HAS_METHOD (mswindows, frame_properties); | |
| 1182 CONSOLE_HAS_METHOD (mswindows, set_frame_properties); | |
| 867 | 1183 CONSOLE_HAS_METHOD (mswindows, set_title_from_ibyte); |
| 1184 /* CONSOLE_HAS_METHOD (mswindows, set_icon_name_from_ibyte); */ | |
| 428 | 1185 CONSOLE_HAS_METHOD (mswindows, frame_visible_p); |
| 1186 CONSOLE_HAS_METHOD (mswindows, frame_totally_visible_p); | |
| 1187 CONSOLE_HAS_METHOD (mswindows, frame_iconified_p); | |
| 442 | 1188 CONSOLE_HAS_METHOD (mswindows, set_frame_pointer); |
| 1189 CONSOLE_HAS_METHOD (mswindows, set_frame_icon); | |
| 428 | 1190 CONSOLE_HAS_METHOD (mswindows, get_frame_parent); |
| 1191 CONSOLE_HAS_METHOD (mswindows, update_frame_external_traits); | |
| 1192 CONSOLE_HAS_METHOD (mswindows, frame_size_fixed_p); | |
| 440 | 1193 |
| 1194 /* Printer frames, aka print jobs */ | |
| 1195 CONSOLE_HAS_METHOD (msprinter, init_frame_1); | |
| 1196 CONSOLE_HAS_METHOD (msprinter, init_frame_3); | |
| 1197 CONSOLE_HAS_METHOD (msprinter, mark_frame); | |
| 1198 CONSOLE_HAS_METHOD (msprinter, delete_frame); | |
| 1199 CONSOLE_HAS_METHOD (msprinter, frame_property); | |
| 1200 CONSOLE_HAS_METHOD (msprinter, internal_frame_property_p); | |
| 1201 CONSOLE_HAS_METHOD (msprinter, frame_properties); | |
| 1202 CONSOLE_HAS_METHOD (msprinter, set_frame_properties); | |
| 1203 CONSOLE_HAS_METHOD (msprinter, set_frame_size); | |
| 442 | 1204 CONSOLE_HAS_METHOD (msprinter, eject_page); |
| 428 | 1205 } |
| 1206 | |
| 1207 void | |
| 1208 syms_of_frame_mswindows (void) | |
| 1209 { | |
| 3092 | 1210 #ifdef NEW_GC |
|
5118
e0db3c197671
merge up to latest default branch, doesn't compile yet
Ben Wing <ben@xemacs.org>
parents:
4139
diff
changeset
|
1211 INIT_LISP_OBJECT (mswindows_frame); |
| 3092 | 1212 #endif /* NEW_GC */ |
| 428 | 1213 } |
| 1214 | |
| 1215 void | |
| 1216 reinit_vars_of_frame_mswindows (void) | |
| 1217 { | |
| 1218 /* Needn't staticpro -- see comment above. */ | |
| 1219 Vmswindows_frame_being_created = Qnil; | |
| 1220 } | |
| 1221 | |
| 1222 void | |
| 1223 vars_of_frame_mswindows (void) | |
| 1224 { | |
| 1225 DEFVAR_LISP ("mswindows-use-system-frame-size-defaults", &Vmswindows_use_system_frame_size_defaults /* | |
| 1226 Controls whether to use system or XEmacs defaults for frame size. | |
| 442 | 1227 If nil then reasonable defaults are used for initial frame sizes. If t |
| 428 | 1228 then the system will choose default sizes for the frame. |
| 1229 */ ); | |
| 1230 Vmswindows_use_system_frame_size_defaults = Qnil; | |
| 442 | 1231 |
| 428 | 1232 DEFVAR_LISP ("default-mswindows-frame-plist", &Vdefault_mswindows_frame_plist /* |
| 1233 Plist of default frame-creation properties for mswindows frames. | |
| 1234 These override what is specified in `default-frame-plist', but are | |
| 1235 overridden by the arguments to the particular call to `make-frame'. | |
| 1236 | |
| 1237 Note: In many cases, properties of a frame are available as specifiers | |
| 1238 instead of through the frame-properties mechanism. | |
| 1239 | |
| 1240 Here is a list of recognized frame properties, other than those | |
| 1241 documented in `set-frame-properties' (they can be queried and | |
| 1242 set at any time, except as otherwise noted): | |
| 1243 | |
| 1244 initially-unmapped If non-nil, the frame will not be visible | |
| 1245 when it is created. In this case, you | |
| 1246 need to call `make-frame-visible' to make | |
| 1247 the frame appear. | |
| 1248 popup If non-nil, it should be a frame, and this | |
| 1249 frame will be created as a "popup" frame | |
| 1250 whose parent is the given frame. This | |
| 1251 will make the window manager treat the | |
| 1252 frame as a dialog box, which may entail | |
| 1253 doing different things (e.g. not asking | |
| 1254 for positioning, and not iconifying | |
| 1255 separate from its parent). | |
| 1256 top Y position (in pixels) of the upper-left | |
| 1257 outermost corner of the frame (i.e. the | |
| 1258 upper-left of the window-manager | |
| 1259 decorations). | |
| 1260 left X position (in pixels) of the upper-left | |
| 1261 outermost corner of the frame (i.e. the | |
| 1262 upper-left of the window-manager | |
| 1263 decorations). | |
| 3022 | 1264 window-id Window handle (HWND) of the frame. |
| 1265 Cannot be set. | |
| 428 | 1266 |
| 1267 See also `default-frame-plist', which specifies properties which apply | |
| 1268 to all frames, not just mswindows frames. | |
| 1269 */ ); | |
| 1270 Vdefault_mswindows_frame_plist = Qnil; | |
| 1271 | |
| 1272 mswindows_console_methods->device_specific_frame_props = | |
| 1273 &Vdefault_mswindows_frame_plist; | |
| 440 | 1274 |
| 1275 DEFVAR_LISP ("default-msprinter-frame-plist", &Vdefault_msprinter_frame_plist /* | |
| 1276 Plist of default frame-creation properties for msprinter print job frames. | |
| 1277 These override what is specified in `default-frame-plist', but are | |
| 1278 overridden by the arguments to the particular call to `make-frame'. | |
| 1279 | |
| 1280 Note: In many cases, properties of a frame are available as specifiers | |
| 1281 instead of through the frame-properties mechanism. | |
| 1282 | |
| 1283 Here is a list of recognized frame properties, other than those | |
| 1284 documented in `set-frame-properties' (they can be queried and | |
| 1285 set at any time, except as otherwise noted): | |
| 1286 | |
| 1287 left-margin Margin of the page, in twips. Twip is a | |
| 1288 top-margin typographical unit of measurement, | |
| 1289 right-margin equal to 1/1440 of an inch, or 1/20 of a | |
| 1290 bottom-margin point, and roughly equal to 7/400 of a | |
| 506 | 1291 millimeter. If not specified, the left |
| 1292 and right margins default to 1 inch | |
| 1293 (25.4 mm) and the top and bottom margins | |
| 1294 to 0.5 inch (12.7 mm). | |
| 440 | 1295 |
| 1296 MARGINS NOTE. right-margin and bottom-margin are overridden by | |
| 1297 the height and width properties. If you want to specify size | |
| 1298 of the printable area in character, as with the rest of XEmacs, | |
| 1299 use these properties. If height and/or width are nil, then | |
| 1300 corresponding margin setting is taken into account. If you | |
| 1301 specify height and/or width in `default-frame-plist', but still | |
| 1302 want to specify right/bottom margins, set height/width in this | |
| 1303 plist to nil, as in this example: | |
| 1304 | |
| 506 | 1305 (setq default-frame-plist '(height 55 width 80) |
| 1306 default-msprinter-frame-plist '(height nil width nil)) | |
| 440 | 1307 |
| 1308 See also `default-frame-plist', which specifies properties which apply | |
| 1309 to all frames, not just mswindows frames. | |
| 1310 */ ); | |
| 1311 Vdefault_msprinter_frame_plist = Qnil; | |
| 1312 | |
| 1313 msprinter_console_methods->device_specific_frame_props = | |
| 1314 &Vdefault_msprinter_frame_plist; | |
| 428 | 1315 } |
