Index: etc/Emacs.ad =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/etc/Emacs.ad,v retrieving revision 1.8.2.1 diff -u -r1.8.2.1 Emacs.ad --- etc/Emacs.ad 2000/04/14 16:15:29 1.8.2.1 +++ etc/Emacs.ad 2000/05/03 14:39:26 @@ -267,7 +267,7 @@ ! Native Widget translations ! ======================= Emacs*Text*translations: #override\n\ - : widget-focus-in()\n + : widget-focus-in() select-start()\n ! XIM input method style ! ======================= Index: lisp/gutter-items.el =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/lisp/Attic/gutter-items.el,v retrieving revision 1.1.2.48 diff -u -r1.1.2.48 gutter-items.el --- lisp/gutter-items.el 2000/04/28 15:17:12 1.1.2.48 +++ lisp/gutter-items.el 2000/05/03 14:39:39 @@ -382,8 +382,8 @@ :type 'boolean :group 'gutter) -(defvar progress-glyph-height 32 - "Height of the gutter area for progress messages.") +(defvar progress-glyph-height 24 + "Height of the progress gauge glyph.") (defvar progress-display-popup-period 0.5 "The time that the progress gauge should remain up after completion") @@ -396,7 +396,7 @@ (defvar progress-gauge-glyph (make-glyph `[progress-gauge - :pixel-height (- progress-glyph-height 8) + :pixel-height (eval progress-glyph-height) :pixel-width 250 :descriptor "Progress"])) @@ -407,30 +407,31 @@ and text are arranged side-by-side." (cond ((eq style 'small) - (setq progress-glyph-height 24) + (setq progress-glyph-height 16) (setq progress-layout-glyph (make-glyph `[layout :orientation horizontal + :margin-width 4 :items (,progress-gauge-glyph [button - :pixel-height (- progress-glyph-height 8) + :pixel-height (eval progress-glyph-height) ;; 'quit is special and acts "asynchronously". :descriptor "Stop" :callback 'quit] ,progress-text-glyph)]))) (t - (setq progress-glyph-height 32) + (setq progress-glyph-height 24) (setq progress-layout-glyph (make-glyph `[layout :orientation vertical :justify left + :margin-width 4 :items (,progress-text-glyph [layout - :pixel-height (eval progress-glyph-height) :orientation horizontal :items (,progress-gauge-glyph [button - :pixel-height (- progress-glyph-height 8) + :pixel-height (eval progress-glyph-height) :descriptor " Stop " ;; 'quit is special and acts "asynchronously". :callback 'quit])])]))))) @@ -457,6 +458,7 @@ `[layout :orientation vertical :justify left :items (,progress-text-glyph [layout + :margin-width 4 :pixel-height progress-glyph-height :orientation horizontal])])) Index: src/console-msw.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/console-msw.c,v retrieving revision 1.4.2.7 diff -u -r1.4.2.7 console-msw.c --- src/console-msw.c 2000/03/13 07:27:51 1.4.2.7 +++ src/console-msw.c 2000/05/03 14:39:44 @@ -28,10 +28,9 @@ #include #include "lisp.h" +#include "console-msw.h" #include "events.h" #include "opaque.h" - -#include "console-msw.h" DEFINE_CONSOLE_TYPE (mswindows); DEFINE_CONSOLE_TYPE (msprinter); Index: src/console-msw.h =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/console-msw.h,v retrieving revision 1.22.2.20 diff -u -r1.22.2.20 console-msw.h --- src/console-msw.h 2000/04/28 15:17:17 1.22.2.20 +++ src/console-msw.h 2000/05/03 14:39:44 @@ -33,13 +33,8 @@ #define INCLUDED_console_msw_h_ #include "console.h" -#include -#include /* DDE management library */ -#if !defined(__CYGWIN32__) && !defined(__MINGW32__) \ - || CYGWIN_VERSION_DLL_MAJOR > 20 -#include /* FileManager/Explorer drag and drop */ -#include -#endif +#include "syswindows.h" +#include "syscommctrl.h" #ifdef HAVE_XPM #include Index: src/device-msw.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/device-msw.c,v retrieving revision 1.20.2.16 diff -u -r1.20.2.16 device-msw.c --- src/device-msw.c 2000/03/13 07:27:52 1.20.2.16 +++ src/device-msw.c 2000/05/03 14:39:44 @@ -40,13 +40,6 @@ #include "frame.h" #include "sysdep.h" -#if (defined (__CYGWIN32__) || defined(__MINGW32__)) && \ - CYGWIN_VERSION_DLL_MAJOR < 21 -extern BOOL WINAPI DdeFreeStringHandle(DWORD,HSZ); -#else -#include -#endif - #if !(defined (__CYGWIN32__) || defined(__MINGW32__)) # include /* For CoInitialize */ #endif Index: src/event-msw.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/event-msw.c,v retrieving revision 1.38.2.43 diff -u -r1.38.2.43 event-msw.c --- src/event-msw.c 2000/04/28 15:17:18 1.38.2.43 +++ src/event-msw.c 2000/05/03 14:39:44 @@ -58,6 +58,7 @@ #include "process.h" #include "redisplay.h" #include "select.h" +#include "window.h" #include "sysproc.h" #include "syswait.h" #include "systime.h" @@ -78,10 +79,6 @@ # include /* For IShellLink */ #endif -#if defined (__CYGWIN32__) && (CYGWIN_VERSION_DLL_MAJOR < 20) -typedef NMHDR *LPNMHDR; -#endif - #ifdef HAVE_MENUBARS #define ADJR_MENUFLAG TRUE #else @@ -2389,7 +2386,7 @@ (XCOLOR_INSTANCE (FACE_BACKGROUND (XIMAGE_INSTANCE_WIDGET_FACE (image_instance), - XIMAGE_INSTANCE_SUBWINDOW_FRAME (image_instance))))); + XIMAGE_INSTANCE_FRAME (image_instance))))); } last_widget_brushed = ii; SetTextColor @@ -2398,7 +2395,7 @@ (XCOLOR_INSTANCE (FACE_FOREGROUND (XIMAGE_INSTANCE_WIDGET_FACE (image_instance), - XIMAGE_INSTANCE_SUBWINDOW_FRAME (image_instance))))); + XIMAGE_INSTANCE_FRAME (image_instance))))); SetBkMode (hdc, OPAQUE); SetBkColor (hdc, @@ -2406,7 +2403,7 @@ (XCOLOR_INSTANCE (FACE_BACKGROUND (XIMAGE_INSTANCE_WIDGET_FACE (image_instance), - XIMAGE_INSTANCE_SUBWINDOW_FRAME (image_instance))))); + XIMAGE_INSTANCE_FRAME (image_instance))))); return (LRESULT)widget_brush; } } Index: src/frame.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/frame.c,v retrieving revision 1.37.2.30 diff -u -r1.37.2.30 frame.c --- src/frame.c 2000/04/03 11:44:24 1.37.2.30 +++ src/frame.c 2000/05/03 14:39:45 @@ -130,8 +130,6 @@ #define MARKED_SLOT(x) mark_object (f->x) #include "frameslots.h" - mark_subwindow_cachels (f->subwindow_cachels); - if (FRAME_LIVE_P (f)) /* device is nil for a dead frame */ MAYBE_FRAMEMETH (f, mark_frame, (f)); @@ -208,7 +206,7 @@ f->last_nonminibuf_window = root_window; /* cache of subwindows visible on frame */ - f->subwindow_cachels = Dynarr_new (subwindow_cachel); + f->subwindow_instance_cache = make_weak_list (WEAK_LIST_SIMPLE); /* associated exposure ignore list */ f->subwindow_exposures = 0; @@ -466,7 +464,6 @@ #endif reset_face_cachels (XWINDOW (FRAME_SELECTED_WINDOW (f))); reset_glyph_cachels (XWINDOW (FRAME_SELECTED_WINDOW (f))); - reset_subwindow_cachels (f); change_frame_size (f, f->height, f->width, 0); } @@ -1553,6 +1550,12 @@ free_frame_toolbars (f); #endif free_frame_gutters (f); + /* Unfortunately deleting the frame will also delete the parent of + all of the subwindow instances current on the frame. I think this + can lead to bad things when trying to finalize the + instances. Thus we loop over the instance cache calling the + finalize method for each instance. */ + free_frame_subwindow_instance_cache (f); /* This must be done before the window and window_mirror structures are freed. The scrollbar information is attached to them. */ @@ -1564,11 +1567,7 @@ f->root_window = Qnil; /* clear out the cached glyph information */ - if (f->subwindow_cachels) - { - Dynarr_free (f->subwindow_cachels); - f->subwindow_cachels = 0; - } + f->subwindow_instance_cache = Qnil; /* Remove the frame now from the list. This way, any events generated on this frame by the maneuvers below will disperse themselves. */ Index: src/frame.h =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/frame.h,v retrieving revision 1.18.2.14 diff -u -r1.18.2.14 frame.h --- src/frame.h 2000/03/04 16:53:33 1.18.2.14 +++ src/frame.h 2000/05/03 14:39:46 @@ -94,9 +94,6 @@ int modiff; - /* subwindow cache elements for this frame */ - subwindow_cachel_dynarr *subwindow_cachels; - struct expose_ignore* subwindow_exposures; struct expose_ignore* subwindow_exposures_tail; @@ -547,7 +544,7 @@ NON_LVALUE ((f)->last_nonminibuf_window) #define FRAME_SB_VCACHE(f) ((f)->sb_vcache) #define FRAME_SB_HCACHE(f) ((f)->sb_hcache) -#define FRAME_SUBWINDOW_CACHE(f) ((f)->subwindow_cachels) +#define FRAME_SUBWINDOW_CACHE(f) ((f)->subwindow_instance_cache) #if 0 /* FSFmacs */ Index: src/frameslots.h =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/frameslots.h,v retrieving revision 1.4.2.1 diff -u -r1.4.2.1 frameslots.h --- src/frameslots.h 2000/04/28 09:25:22 1.4.2.1 +++ src/frameslots.h 2000/05/03 14:39:46 @@ -145,6 +145,9 @@ MARKED_SLOT_ARRAY (toolbar_border_width, 4); #endif +/* Cache of subwindow instances for this frame */ + MARKED_SLOT (subwindow_instance_cache); + /* Possible frame-local default for outside margin widths. */ MARKED_SLOT (left_margin_width); MARKED_SLOT (right_margin_width); Index: src/glyphs-eimage.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/glyphs-eimage.c,v retrieving revision 1.3.2.16 diff -u -r1.3.2.16 glyphs-eimage.c --- src/glyphs-eimage.c 2000/03/13 07:27:58 1.3.2.16 +++ src/glyphs-eimage.c 2000/05/03 14:39:46 @@ -56,6 +56,7 @@ #include "buffer.h" #include "frame.h" #include "opaque.h" +#include "window.h" #include "sysfile.h" @@ -480,7 +481,7 @@ /* Step 6.5: Create the pixmap and set up the image instance */ /* now instantiate */ - MAYBE_DEVMETH (XDEVICE (ii->device), + MAYBE_DEVMETH (DOMAIN_XDEVICE (ii->domain), init_image_instance_from_eimage, (ii, cinfo.output_width, cinfo.output_height, 1, unwind.eimage, dest_mask, @@ -706,7 +707,7 @@ } /* now instantiate */ - MAYBE_DEVMETH (XDEVICE (ii->device), + MAYBE_DEVMETH (DOMAIN_XDEVICE (ii->domain), init_image_instance_from_eimage, (ii, width, height, unwind.giffile->ImageCount, unwind.eimage, dest_mask, instantiator, domain)); @@ -1017,7 +1018,7 @@ } /* now instantiate */ - MAYBE_DEVMETH (XDEVICE (ii->device), + MAYBE_DEVMETH (DOMAIN_XDEVICE (ii->domain), init_image_instance_from_eimage, (ii, width, height, 1, unwind.eimage, dest_mask, instantiator, domain)); @@ -1299,7 +1300,7 @@ } /* now instantiate */ - MAYBE_DEVMETH (XDEVICE (ii->device), + MAYBE_DEVMETH (DOMAIN_XDEVICE (ii->domain), init_image_instance_from_eimage, (ii, width, height, 1, unwind.eimage, dest_mask, instantiator, domain)); Index: src/glyphs-msw.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/glyphs-msw.c,v retrieving revision 1.21.2.56 diff -u -r1.21.2.56 glyphs-msw.c --- src/glyphs-msw.c 2000/04/28 15:17:19 1.21.2.56 +++ src/glyphs-msw.c 2000/05/03 14:39:47 @@ -57,7 +57,6 @@ DECLARE_IMAGE_INSTANTIATOR_FORMAT (string); DECLARE_IMAGE_INSTANTIATOR_FORMAT (formatted_string); DECLARE_IMAGE_INSTANTIATOR_FORMAT (inherit); -DECLARE_IMAGE_INSTANTIATOR_FORMAT (layout); #ifdef HAVE_JPEG DECLARE_IMAGE_INSTANTIATOR_FORMAT (jpeg); #endif @@ -80,6 +79,8 @@ DEFINE_DEVICE_IIFORMAT (mswindows, xface); DEFINE_DEVICE_IIFORMAT (msprinter, xface); #endif +DECLARE_IMAGE_INSTANTIATOR_FORMAT (layout); +DEFINE_DEVICE_IIFORMAT (mswindows, native_layout); DEFINE_DEVICE_IIFORMAT (mswindows, button); DEFINE_DEVICE_IIFORMAT (mswindows, edit_field); DEFINE_DEVICE_IIFORMAT (mswindows, subwindow); @@ -132,8 +133,7 @@ */ static void init_image_instance_geometry (Lisp_Image_Instance *ii) { - Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii); - struct device *d = XDEVICE (device); + struct device *d = DOMAIN_XDEVICE (ii->domain); if (/* #### Scaleable && */ DEVICE_MSPRINTER_P (d)) { @@ -349,8 +349,7 @@ int x_hot, int y_hot, int create_mask) { - Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii); - struct device *d = XDEVICE (device); + struct device *d = XDEVICE (IMAGE_INSTANCE_DEVICE (ii)); void* bmp_buf=0; enum image_instance_type type; HBITMAP bitmap; @@ -2072,11 +2071,13 @@ static void mswindows_finalize_image_instance (Lisp_Image_Instance *p) { - if (DEVICE_LIVE_P (XDEVICE (p->device))) + if (!p->data) + return; + + if (DEVICE_LIVE_P (XDEVICE (IMAGE_INSTANCE_DEVICE (p)))) { - if (IMAGE_INSTANCE_TYPE (p) == IMAGE_WIDGET - || - IMAGE_INSTANCE_TYPE (p) == IMAGE_SUBWINDOW) + if (image_instance_type_to_mask (IMAGE_INSTANCE_TYPE (p)) + & (IMAGE_WIDGET_MASK | IMAGE_SUBWINDOW_MASK)) { #ifdef DEBUG_WIDGETS debug_widget_instances--; @@ -2210,17 +2211,16 @@ mswindows_update_widget (Lisp_Image_Instance *p) { /* Possibly update the face font and colors. */ - if (IMAGE_INSTANCE_WIDGET_FACE_CHANGED (p) - || - XFRAME (IMAGE_INSTANCE_SUBWINDOW_FRAME (p))->faces_changed - || - IMAGE_INSTANCE_WIDGET_ITEMS_CHANGED (p)) + if (!NILP (IMAGE_INSTANCE_WIDGET_TEXT (p)) + && (IMAGE_INSTANCE_WIDGET_FACE_CHANGED (p) + || XFRAME (IMAGE_INSTANCE_FRAME (p))->faces_changed + || IMAGE_INSTANCE_WIDGET_ITEMS_CHANGED (p))) { /* set the widget font from the widget face */ SendMessage (WIDGET_INSTANCE_MSWINDOWS_HANDLE (p), WM_SETFONT, (WPARAM) mswindows_widget_hfont - (p, IMAGE_INSTANCE_SUBWINDOW_FRAME (p)), + (p, IMAGE_INSTANCE_FRAME (p)), MAKELPARAM (TRUE, 0)); } /* Possibly update the dimensions. */ @@ -2231,7 +2231,8 @@ IMAGE_INSTANCE_HEIGHT (p)); } /* Possibly update the text in the widget. */ - if (IMAGE_INSTANCE_TEXT_CHANGED (p)) + if (IMAGE_INSTANCE_TEXT_CHANGED (p) + && !NILP (IMAGE_INSTANCE_WIDGET_TEXT (p))) { Extbyte* lparam=0; TO_EXTERNAL_FORMAT (LISP_STRING, IMAGE_INSTANCE_WIDGET_TEXT (p), @@ -2249,7 +2250,7 @@ mswindows_register_gui_item (Lisp_Object image_instance, Lisp_Object gui, Lisp_Object domain) { - Lisp_Object frame = FW_FRAME (domain); + Lisp_Object frame = DOMAIN_FRAME (domain); struct frame* f = XFRAME (frame); int id = gui_item_id_hash (FRAME_MSWINDOWS_WIDGET_HASH_TABLE2 (f), gui, @@ -2278,7 +2279,7 @@ { Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii); - Lisp_Object frame = FW_FRAME (domain); + Lisp_Object frame = DOMAIN_FRAME (domain); HWND wnd; CHECK_MSWINDOWS_DEVICE (device); @@ -2400,7 +2401,7 @@ /* this function can call lisp */ Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii), style; - Lisp_Object frame = FW_FRAME (domain); + Lisp_Object frame = DOMAIN_FRAME (domain); Extbyte* nm=0; HWND wnd; int id = 0xffff; @@ -2438,7 +2439,7 @@ IMAGE_INSTANCE_WIDGET_WIDTH (ii), IMAGE_INSTANCE_WIDGET_HEIGHT (ii), /* parent window */ - FRAME_MSWINDOWS_HANDLE (XFRAME (frame)), + DOMAIN_MSWINDOWS_HANDLE (domain), (HMENU)id, /* No menu */ NULL, /* must be null for this class */ NULL)) == NULL) @@ -2468,9 +2469,32 @@ IMAGE_INSTANCE_SUBWINDOW_ID (ii) = wnd; SetWindowLong (wnd, GWL_USERDATA, (LONG)LISP_TO_VOID(image_instance)); /* set the widget font from the widget face */ - SendMessage (wnd, WM_SETFONT, - (WPARAM) mswindows_widget_hfont (ii, domain), - MAKELPARAM (TRUE, 0)); + if (!NILP (IMAGE_INSTANCE_WIDGET_TEXT (ii))) + SendMessage (wnd, WM_SETFONT, + (WPARAM) mswindows_widget_hfont (ii, domain), + MAKELPARAM (TRUE, 0)); +} + +/* Instantiate a native layout widget. */ +static void +mswindows_native_layout_instantiate (Lisp_Object image_instance, + Lisp_Object instantiator, + Lisp_Object pointer_fg, Lisp_Object pointer_bg, + int dest_mask, Lisp_Object domain) +{ + Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); + + mswindows_widget_instantiate (image_instance, instantiator, pointer_fg, + pointer_bg, dest_mask, domain, "STATIC", + /* Approximation to styles available with + an XEmacs layout. */ + EQ (IMAGE_INSTANCE_LAYOUT_BORDER (ii), + Qetched_in) || + EQ (IMAGE_INSTANCE_LAYOUT_BORDER (ii), + Qetched_out) || + GLYPHP (IMAGE_INSTANCE_LAYOUT_BORDER (ii)) + ? SS_ETCHEDFRAME : SS_SUNKEN, + 0); } /* Instantiate a button widget. Unfortunately instantiated widgets are @@ -2593,7 +2617,7 @@ (XCOLOR_INSTANCE (FACE_BACKGROUND (XIMAGE_INSTANCE_WIDGET_FACE (ii), - XIMAGE_INSTANCE_SUBWINDOW_FRAME (ii)))))); + XIMAGE_INSTANCE_FRAME (ii)))))); #endif #ifdef PBS_SETBARCOLOR SendMessage (wnd, PBS_SETBARCOLOR, 0, @@ -2601,7 +2625,7 @@ (XCOLOR_INSTANCE (FACE_FOREGROUND (XIMAGE_INSTANCE_WIDGET_FACE (ii), - XIMAGE_INSTANCE_SUBWINDOW_FRAME (ii)))))); + XIMAGE_INSTANCE_FRAME (ii)))))); #endif } @@ -2785,7 +2809,7 @@ LIST_LOOP (rest, XCDR (IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (ii))) { add_tab_item (image_instance, wnd, XCAR (rest), - IMAGE_INSTANCE_SUBWINDOW_FRAME (ii), i); + IMAGE_INSTANCE_FRAME (ii), i); if (gui_item_selected_p (XCAR (rest))) selected = i; i++; @@ -3013,7 +3037,6 @@ { IIFORMAT_VALID_CONSOLE2 (mswindows, msprinter, nothing); IIFORMAT_VALID_CONSOLE2 (mswindows, msprinter, string); - IIFORMAT_VALID_CONSOLE2 (mswindows, msprinter, layout); IIFORMAT_VALID_CONSOLE2 (mswindows, msprinter, formatted_string); IIFORMAT_VALID_CONSOLE2 (mswindows, msprinter, inherit); /* image-instantiator types */ @@ -3046,44 +3069,41 @@ IIFORMAT_VALID_CONSOLE2 (mswindows, msprinter, gif); #endif #ifdef HAVE_WIDGETS + INITIALIZE_DEVICE_IIFORMAT (mswindows, widget); + IIFORMAT_HAS_DEVMETHOD (mswindows, widget, property); + /* layout widget */ + IIFORMAT_VALID_CONSOLE (mswindows, layout); + INITIALIZE_DEVICE_IIFORMAT (mswindows, native_layout); + IIFORMAT_HAS_DEVMETHOD (mswindows, native_layout, instantiate); /* button widget */ INITIALIZE_DEVICE_IIFORMAT (mswindows, button); IIFORMAT_HAS_DEVMETHOD (mswindows, button, property); IIFORMAT_HAS_DEVMETHOD (mswindows, button, instantiate); IIFORMAT_HAS_DEVMETHOD (mswindows, button, update); - + /* edit-field widget */ INITIALIZE_DEVICE_IIFORMAT (mswindows, edit_field); IIFORMAT_HAS_DEVMETHOD (mswindows, edit_field, instantiate); - + /* subwindow */ INITIALIZE_DEVICE_IIFORMAT (mswindows, subwindow); IIFORMAT_HAS_DEVMETHOD (mswindows, subwindow, instantiate); - - INITIALIZE_DEVICE_IIFORMAT (mswindows, widget); - IIFORMAT_HAS_DEVMETHOD (mswindows, widget, property); - /* label */ INITIALIZE_DEVICE_IIFORMAT (mswindows, label); IIFORMAT_HAS_DEVMETHOD (mswindows, label, instantiate); - /* combo box */ INITIALIZE_DEVICE_IIFORMAT (mswindows, combo_box); IIFORMAT_HAS_DEVMETHOD (mswindows, combo_box, property); IIFORMAT_HAS_DEVMETHOD (mswindows, combo_box, instantiate); - /* scrollbar */ INITIALIZE_DEVICE_IIFORMAT (mswindows, scrollbar); IIFORMAT_HAS_DEVMETHOD (mswindows, scrollbar, instantiate); - /* progress gauge */ INITIALIZE_DEVICE_IIFORMAT (mswindows, progress_gauge); IIFORMAT_HAS_DEVMETHOD (mswindows, progress_gauge, update); IIFORMAT_HAS_DEVMETHOD (mswindows, progress_gauge, instantiate); - /* tree view widget */ INITIALIZE_DEVICE_IIFORMAT (mswindows, tree_view); /* IIFORMAT_HAS_DEVMETHOD (mswindows, progress, set_property);*/ IIFORMAT_HAS_DEVMETHOD (mswindows, tree_view, instantiate); - /* tab control widget */ INITIALIZE_DEVICE_IIFORMAT (mswindows, tab_control); IIFORMAT_HAS_DEVMETHOD (mswindows, tab_control, instantiate); Index: src/glyphs-msw.h =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/glyphs-msw.h,v retrieving revision 1.7.2.8 diff -u -r1.7.2.8 glyphs-msw.h --- src/glyphs-msw.h 2000/04/13 02:37:09 1.7.2.8 +++ src/glyphs-msw.h 2000/05/03 14:39:47 @@ -96,13 +96,20 @@ }; #define MSWINDOWS_SUBWINDOW_DATA(i) \ -((struct mswindows_subwindow_data *) (i)->data) - + ((struct mswindows_subwindow_data *) (i)->data) #define IMAGE_INSTANCE_MSWINDOWS_CLIPWINDOW(i) \ (MSWINDOWS_SUBWINDOW_DATA (i)->clip_window) +#define XIMAGE_INSTANCE_MSWINDOWS_SUBWINDOW_DATA(i) \ + MSWINDOWS_SUBWINDOW_DATA (XIMAGE_INSTANCE (i)) #define XIMAGE_INSTANCE_MSWINDOWS_CLIPWINDOW(i) \ IMAGE_INSTANCE_MSWINDOWS_CLIPWINDOW (XIMAGE_INSTANCE (i)) + +#define DOMAIN_MSWINDOWS_HANDLE(domain) \ + ((IMAGE_INSTANCEP (domain) && \ + XIMAGE_INSTANCE_MSWINDOWS_SUBWINDOW_DATA (domain)) ? \ + XWIDGET_INSTANCE_MSWINDOWS_HANDLE (domain) : \ + FRAME_MSWINDOWS_HANDLE (DOMAIN_XFRAME (domain))) #endif /* HAVE_MS_WINDOWS */ Index: src/glyphs-widget.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/Attic/glyphs-widget.c,v retrieving revision 1.1.2.39 diff -u -r1.1.2.39 glyphs-widget.c --- src/glyphs-widget.c 2000/04/28 15:17:20 1.1.2.39 +++ src/glyphs-widget.c 2000/05/03 14:39:47 @@ -55,12 +55,13 @@ Lisp_Object Qtab_control; DEFINE_IMAGE_INSTANTIATOR_FORMAT (layout); Lisp_Object Qlayout; +DEFINE_IMAGE_INSTANTIATOR_FORMAT (native_layout); +Lisp_Object Qnative_layout; Lisp_Object Q_descriptor, Q_height, Q_width, Q_properties, Q_items; Lisp_Object Q_image, Q_text, Q_orientation, Q_justify, Q_border; +Lisp_Object Q_margin_width; Lisp_Object Qetched_in, Qetched_out, Qbevel_in, Qbevel_out; -Lisp_Object Vwidget_callback_current_channel; -Lisp_Object Qwidget_callback_current_channel; #ifdef DEBUG_WIDGETS int debug_widget_instances; @@ -274,7 +275,7 @@ return Fplist_get (IMAGE_INSTANCE_WIDGET_PROPS (ii), prop, Qnil); /* .. then try device specific methods ... */ - meths = decode_device_ii_format (IMAGE_INSTANCE_DEVICE (ii), + meths = decode_device_ii_format (image_instance_device (image_instance), IMAGE_INSTANCE_WIDGET_TYPE (ii), ERROR_ME_NOT); if (meths && HAS_IIFORMAT_METH_P (meths, property)) @@ -304,7 +305,7 @@ } /* Now try device specific methods first ... */ - meths = decode_device_ii_format (IMAGE_INSTANCE_DEVICE (ii), + meths = decode_device_ii_format (image_instance_device (image_instance), IMAGE_INSTANCE_WIDGET_TYPE (ii), ERROR_ME_NOT); if (meths && HAS_IIFORMAT_METH_P (meths, set_property) @@ -331,30 +332,32 @@ } /* Like the rest of redisplay, we want widget updates to occur -asynchronously. Thus toolkit specific methods for setting properties -must be called by redisplay instead of by *_set_property. Thus -*_set_property records the change and this function actually -implements it. We want to be slightly clever about this however by -supplying format specific functions for the updates instead of lumping -them all into this function. Note that there is no need for format -generic functions. */ + asynchronously. Thus toolkit specific methods for setting + properties must be called by redisplay instead of by + *_set_property. Thus *_set_property records the change and this + function actually implements it. We want to be slightly clever + about this however by supplying format specific functions for the + updates instead of lumping them all into this function. Note that + there is no need for format generic functions. */ void update_widget (Lisp_Object widget) { Lisp_Image_Instance* ii = XIMAGE_INSTANCE (widget); struct image_instantiator_methods* meths; - if (IMAGE_INSTANCE_TYPE (ii) != IMAGE_WIDGET) + if (!WIDGET_IMAGE_INSTANCEP (widget) + || EQ (IMAGE_INSTANCE_WIDGET_TYPE (ii), Qlayout) + || EQ (IMAGE_INSTANCE_WIDGET_TYPE (ii), Qnative_layout)) return; /* Device generic methods. We must update the widget's size as it may have been changed by the the layout routines. We also do this here so that explicit resizing from lisp does not result in synchronous updates. */ - MAYBE_DEVMETH (XDEVICE (ii->device), update_widget, (ii)); + MAYBE_DEVMETH (DOMAIN_XDEVICE (ii->domain), update_widget, (ii)); /* Device-format specific methods */ - meths = decode_device_ii_format (IMAGE_INSTANCE_DEVICE (ii), + meths = decode_device_ii_format (image_instance_device (widget), IMAGE_INSTANCE_WIDGET_TYPE (ii), ERROR_ME_NOT); MAYBE_IIFORMAT_METH (meths, update, (widget)); @@ -389,7 +392,7 @@ IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP (ii)) { /* .. then try device specific methods ... */ - meths = decode_device_ii_format (IMAGE_INSTANCE_DEVICE (ii), + meths = decode_device_ii_format (image_instance_device (image_instance), IMAGE_INSTANCE_WIDGET_TYPE (ii), ERROR_ME_NOT); if (meths && HAS_IIFORMAT_METH_P (meths, query_geometry)) @@ -437,7 +440,7 @@ } } -static void +static int widget_layout (Lisp_Object image_instance, unsigned int width, unsigned int height, Lisp_Object domain) { @@ -445,21 +448,22 @@ struct image_instantiator_methods* meths; /* .. then try device specific methods ... */ - meths = decode_device_ii_format (IMAGE_INSTANCE_DEVICE (ii), + meths = decode_device_ii_format (image_instance_device (image_instance), IMAGE_INSTANCE_WIDGET_TYPE (ii), ERROR_ME_NOT); if (meths && HAS_IIFORMAT_METH_P (meths, layout)) - IIFORMAT_METH (meths, layout, (image_instance, - width, height, domain)); + return IIFORMAT_METH (meths, layout, (image_instance, + width, height, domain)); else { /* ... then format specific methods ... */ meths = decode_device_ii_format (Qnil, IMAGE_INSTANCE_WIDGET_TYPE (ii), ERROR_ME_NOT); if (meths && HAS_IIFORMAT_METH_P (meths, layout)) - IIFORMAT_METH (meths, layout, (image_instance, - width, height, domain)); + return IIFORMAT_METH (meths, layout, (image_instance, + width, height, domain)); } + return 1; } static void @@ -516,6 +520,7 @@ IMAGE_INSTANCE_WIDGET_PROPS (ii) = Qnil; SET_IMAGE_INSTANCE_WIDGET_FACE (ii, Qnil); IMAGE_INSTANCE_WIDGET_ITEMS (ii) = allocate_gui_item (); + IMAGE_INSTANCE_LAYOUT_CHILDREN (ii) = Qnil; IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (ii) = Qnil; IMAGE_INSTANCE_WIDGET_WIDTH_SUBR (ii) = Qnil; IMAGE_INSTANCE_WIDGET_HEIGHT_SUBR (ii) = Qnil; @@ -547,15 +552,15 @@ Lisp_Object props = find_keyword_in_vector (instantiator, Q_properties); Lisp_Object items = find_keyword_in_vector (instantiator, Q_items); Lisp_Object orient = find_keyword_in_vector (instantiator, Q_orientation); + Lisp_Object mwidth = find_keyword_in_vector (instantiator, Q_margin_width); int pw=0, ph=0, tw=0, th=0; /* this just does pixel type sizing */ subwindow_instantiate (image_instance, instantiator, pointer_fg, pointer_bg, dest_mask, domain); - - if (!(dest_mask & (IMAGE_WIDGET_MASK | IMAGE_LAYOUT_MASK))) - incompatible_image_types (instantiator, dest_mask, - IMAGE_WIDGET_MASK | IMAGE_LAYOUT_MASK); + + if (!(dest_mask & IMAGE_WIDGET_MASK)) + incompatible_image_types (instantiator, dest_mask, IMAGE_WIDGET_MASK); initialize_widget_image_instance (ii, XVECTOR_DATA (instantiator)[0]); @@ -566,57 +571,10 @@ if (!NILP (face)) SET_IMAGE_INSTANCE_WIDGET_FACE (ii, Fget_face (face)); - /* Do layout specific initialisation. This feels a bit tacky, but - the alternative is a myriad of different little functions. */ - if (EQ (IMAGE_INSTANCE_WIDGET_TYPE (ii), Qlayout)) - { - Lisp_Object rest, children = Qnil; - Lisp_Object border = find_keyword_in_vector (instantiator, Q_border); - - if (NILP (orient)) - { - IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) = LAYOUT_VERTICAL; - } - IMAGE_INSTANCE_TYPE (ii) = IMAGE_LAYOUT; - - if (EQ (border, Qt)) - { - IMAGE_INSTANCE_LAYOUT_BORDER (ii) = Qetched_in; - } - else if (GLYPHP (border)) - { - /* We are going to be sneaky here and add the border text as - just another child, the layout and output routines don't know - this and will just display at the offsets we prescribe. */ - Lisp_Object gii = glyph_image_instance (border, domain, ERROR_ME, 1); - /* make sure we are designated as the parent. */ - XIMAGE_INSTANCE_PARENT (gii) = image_instance; - children = Fcons (gii, children); - IMAGE_INSTANCE_LAYOUT_BORDER (ii) = make_int (0); - } - else - { - IMAGE_INSTANCE_LAYOUT_BORDER (ii) = border; - } - - /* Pick up the sub-widgets. */ - LIST_LOOP (rest, items) - { - /* make sure the image is instantiated */ - Lisp_Object gii = glyph_image_instance (XCAR (rest), domain, ERROR_ME, 1); - /* make sure we are designated as the parent. */ - XIMAGE_INSTANCE_PARENT (gii) = image_instance; - children = Fcons (gii, children); - } - /* Make sure elements in the layout are in the order the - user expected. */ - children = Fnreverse (children); - IMAGE_INSTANCE_LAYOUT_CHILDREN (ii) = children; - } /* retrieve the gui item information. This is easy if we have been provided with a vector, more difficult if we have just been given keywords */ - else if (STRINGP (desc) || NILP (desc)) + if (STRINGP (desc) || NILP (desc)) { /* big cheat - we rely on the fact that a gui item looks like an instantiator */ IMAGE_INSTANCE_WIDGET_ITEMS (ii) = @@ -626,14 +584,16 @@ else IMAGE_INSTANCE_WIDGET_ITEMS (ii) = gui_parse_item_keywords_no_errors (desc); - + /* Pick up the orientation before we do our first layout. */ if (EQ (orient, Qleft) || EQ (orient, Qright) || EQ (orient, Qvertical)) IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) = LAYOUT_VERTICAL; /* parse more gui items out of the properties */ if (!NILP (props) - && !EQ (IMAGE_INSTANCE_WIDGET_TYPE (ii), Qlayout)) + && + !EQ (IMAGE_INSTANCE_WIDGET_TYPE (ii), Qlayout) + && !EQ (IMAGE_INSTANCE_WIDGET_TYPE (ii), Qnative_layout)) { if (NILP (items)) { @@ -709,15 +669,23 @@ IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP (ii) = 0; } - /* When we create the widgets the window system expects a valid - size, so If we still don' t have sizes, call layout to pick them - up. If query_geometry or layout relies on the widget being in - existence then we are in catch 22. */ - image_instance_layout (image_instance, - pw ? pw : IMAGE_UNSPECIFIED_GEOMETRY, - ph ? ph : IMAGE_UNSPECIFIED_GEOMETRY, - domain); + /* Pick up the margin width. */ + if (!NILP (mwidth)) + IMAGE_INSTANCE_MARGIN_WIDTH (ii) = XINT (mwidth); + + /* Layout for the layout widget is premature at this point since the + children will not have been instantiated. We can't instantiate + them until the device instantiation method for the layout has + been executed. We do however want to record any specified + dimensions. */ + if (pw) IMAGE_INSTANCE_WIDTH (ii) = pw; + if (ph) IMAGE_INSTANCE_HEIGHT (ii) = ph; +} +static void +widget_post_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, + Lisp_Object domain) +{ #ifdef DEBUG_WIDGETS debug_widget_instances++; stderr_out ("instantiated "); @@ -878,12 +846,6 @@ /***************************************************************************** * widget layout * *****************************************************************************/ -static int -layout_possible_dest_types (void) -{ - return IMAGE_LAYOUT_MASK; -} - /* we need to convert things like glyphs to images, eval expressions etc.*/ static Lisp_Object @@ -911,6 +873,74 @@ return inst; } +static void +layout_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, + Lisp_Object pointer_fg, Lisp_Object pointer_bg, + int dest_mask, Lisp_Object domain) +{ + Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); + Lisp_Object orient = find_keyword_in_vector (instantiator, Q_orientation); + Lisp_Object border = find_keyword_in_vector (instantiator, Q_border); + + /* Do widget type instantiation first. */ + widget_instantiate (image_instance, instantiator, pointer_fg, pointer_bg, + dest_mask, domain); + + if (NILP (orient)) + { + IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) = LAYOUT_VERTICAL; + } + + if (EQ (border, Qt)) + { + IMAGE_INSTANCE_LAYOUT_BORDER (ii) = Qetched_in; + } + else + { + IMAGE_INSTANCE_LAYOUT_BORDER (ii) = border; + } + /* We don't do the children yet as we might not have a containing + window. */ +} + +static void +layout_post_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, + Lisp_Object domain) +{ + Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); + Lisp_Object items = find_keyword_in_vector (instantiator, Q_items); + Lisp_Object rest, children = Qnil; + + if (GLYPHP (IMAGE_INSTANCE_LAYOUT_BORDER (ii))) + { + /* We are going to be sneaky here and add the border text as + just another child, the layout and output routines don't know + this and will just display at the offsets we prescribe. */ + Lisp_Object gii = glyph_image_instance + (IMAGE_INSTANCE_LAYOUT_BORDER (ii), + image_instance, ERROR_ME, 1); + /* make sure we are designated as the parent. */ + XIMAGE_INSTANCE_PARENT (gii) = image_instance; + children = Fcons (gii, children); + IMAGE_INSTANCE_LAYOUT_BORDER (ii) = make_int (0); + } + + /* Pick up the sub-widgets. */ + LIST_LOOP (rest, items) + { + /* make sure the image is instantiated */ + Lisp_Object gii = glyph_image_instance (XCAR (rest), + image_instance, ERROR_ME, 1); + /* make sure we are designated as the parent. */ + XIMAGE_INSTANCE_PARENT (gii) = image_instance; + children = Fcons (gii, children); + } + /* Make sure elements in the layout are in the order the + user expected. */ + children = Fnreverse (children); + IMAGE_INSTANCE_LAYOUT_CHILDREN (ii) = children; +} + /* Layout widget. Sizing commentary: we have a number of problems that we would like to address. Some consider some of these more important than others. It used to be that size information was @@ -969,6 +999,10 @@ int maxph = 0, maxpw = 0, nitems = 0, ph_adjust = 0; unsigned int gheight, gwidth; + /* If we are not initialized then we won't have any children. */ + if (!IMAGE_INSTANCE_INITIALIZED (ii)) + return; + /* First just set up what we already have. */ if (width) *width = IMAGE_INSTANCE_WIDTH (ii); if (height) *height = IMAGE_INSTANCE_HEIGHT (ii); @@ -1018,9 +1052,11 @@ } else if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) == LAYOUT_HORIZONTAL) - *width = maxpw + (nitems + 1) * WIDGET_BORDER_WIDTH * 2; + *width = maxpw + ((nitems + 1) * WIDGET_BORDER_WIDTH + + IMAGE_INSTANCE_MARGIN_WIDTH (ii)) * 2; else - *width = maxpw + 2 * WIDGET_BORDER_WIDTH * 2; + *width = maxpw + 2 * (WIDGET_BORDER_WIDTH * 2 + + IMAGE_INSTANCE_MARGIN_WIDTH (ii)); /* Work out vertical spacings. */ if (!NILP (IMAGE_INSTANCE_WIDGET_HEIGHT_SUBR (ii))) @@ -1032,12 +1068,14 @@ } else if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) == LAYOUT_VERTICAL) - *height = maxph + (nitems + 1) * WIDGET_BORDER_HEIGHT * 2 + ph_adjust; + *height = maxph + ((nitems + 1) * WIDGET_BORDER_HEIGHT + + IMAGE_INSTANCE_MARGIN_WIDTH (ii)) * 2 + ph_adjust; else - *height = maxph + 2 * WIDGET_BORDER_HEIGHT * 2 + ph_adjust; + *height = maxph + (2 * WIDGET_BORDER_HEIGHT + + IMAGE_INSTANCE_MARGIN_WIDTH (ii)) * 2 + ph_adjust; } -static void +int layout_layout (Lisp_Object image_instance, unsigned int width, unsigned int height, Lisp_Object domain) { @@ -1047,7 +1085,11 @@ int x, y, maxph = 0, maxpw = 0, nitems = 0, horiz_spacing, vert_spacing, ph_adjust = 0; unsigned int gheight, gwidth; - + + /* If we are not initialized then we won't have any children. */ + if (!IMAGE_INSTANCE_INITIALIZED (ii)) + return 0; + /* Pick up the border text if we have one. */ if (INTP (IMAGE_INSTANCE_LAYOUT_BORDER (ii))) { @@ -1095,20 +1137,26 @@ == LAYOUT_HORIZONTAL) /* We have a larger area to display in so distribute the space evenly. */ - horiz_spacing = (width - maxpw) / (nitems + 1); + horiz_spacing = (width - (maxpw + + IMAGE_INSTANCE_MARGIN_WIDTH (ii) * 2)) + / (nitems + 1); else - horiz_spacing = (width - maxpw) / 2; + horiz_spacing = (width - maxpw) / 2 + - IMAGE_INSTANCE_MARGIN_WIDTH (ii); if (height < maxph) vert_spacing = WIDGET_BORDER_HEIGHT * 2; else if (IMAGE_INSTANCE_SUBWINDOW_ORIENT (ii) == LAYOUT_VERTICAL) - vert_spacing = (height - (maxph + ph_adjust)) / (nitems + 1); + vert_spacing = (height - (maxph + ph_adjust + + IMAGE_INSTANCE_MARGIN_WIDTH (ii) * 2)) + / (nitems + 1); else - vert_spacing = (height - (maxph + ph_adjust)) / 2; + vert_spacing = (height - (maxph + ph_adjust)) / 2 + - IMAGE_INSTANCE_MARGIN_WIDTH (ii); - y = vert_spacing + ph_adjust; - x = horiz_spacing; + y = vert_spacing + ph_adjust + IMAGE_INSTANCE_MARGIN_WIDTH (ii); + x = horiz_spacing + IMAGE_INSTANCE_MARGIN_WIDTH (ii); /* Now flip through putting items where we want them, paying attention to justification. Make sure we don't mess with the @@ -1156,6 +1204,41 @@ /* Now layout subwidgets if they require it. */ image_instance_layout (glyph, gwidth, gheight, domain); } + return 1; +} + +/* Layout subwindows if they are real subwindows. */ +static int +native_layout_layout (Lisp_Object image_instance, + unsigned int width, unsigned int height, + Lisp_Object domain) +{ + Lisp_Image_Instance* ii = XIMAGE_INSTANCE (image_instance); + Lisp_Object rest; + + /* The first time this gets called, the layout will be only + partially instantiated. The children get done in + post_instantiate. */ + if (!IMAGE_INSTANCE_INITIALIZED (ii)) + return 0; + + /* Defining this overrides the default layout_layout so we first have to call that to get + suitable instances and values set up. */ + layout_layout (image_instance, width, height, domain); + + LIST_LOOP (rest, IMAGE_INSTANCE_LAYOUT_CHILDREN (ii)) + { + struct display_glyph_area dga; + dga.xoffset = 0; + dga.yoffset = 0; + dga.width = IMAGE_INSTANCE_WIDTH (ii); + dga.height = IMAGE_INSTANCE_HEIGHT (ii); + + map_subwindow (XCAR (rest), + IMAGE_INSTANCE_XOFFSET (ii), + IMAGE_INSTANCE_YOFFSET (ii), &dga); + } + return 1; } @@ -1176,12 +1259,12 @@ defkeyword (&Q_orientation, ":orientation"); defkeyword (&Q_justify, ":justify"); defkeyword (&Q_border, ":border"); + defkeyword (&Q_margin_width, ":margin-width"); defsymbol (&Qetched_in, "etched-in"); defsymbol (&Qetched_out, "etched-out"); defsymbol (&Qbevel_in, "bevel-in"); defsymbol (&Qbevel_out, "bevel-out"); - defsymbol (&Qwidget_callback_current_channel, "widget-callback-current-channel"); } #define VALID_GUI_KEYWORDS(type) do { \ @@ -1225,7 +1308,9 @@ IIFORMAT_HAS_SHARED_METHOD (button, validate, widget); IIFORMAT_HAS_SHARED_METHOD (button, possible_dest_types, widget); IIFORMAT_HAS_SHARED_METHOD (button, instantiate, widget); + IIFORMAT_HAS_SHARED_METHOD (button, post_instantiate, widget); IIFORMAT_HAS_SHARED_METHOD (button, normalize, widget); + IIFORMAT_HAS_SHARED_METHOD (button, decode_domain, subwindow); IIFORMAT_HAS_METHOD (button, query_geometry); IIFORMAT_VALID_KEYWORD (button, Q_image, check_valid_glyph_or_instantiator); @@ -1239,6 +1324,8 @@ IIFORMAT_HAS_SHARED_METHOD (edit_field, validate, widget); IIFORMAT_HAS_SHARED_METHOD (edit_field, possible_dest_types, widget); IIFORMAT_HAS_SHARED_METHOD (edit_field, instantiate, widget); + IIFORMAT_HAS_SHARED_METHOD (edit_field, post_instantiate, widget); + IIFORMAT_HAS_SHARED_METHOD (edit_field, decode_domain, subwindow); VALID_WIDGET_KEYWORDS (edit_field); VALID_GUI_KEYWORDS (edit_field); } @@ -1248,6 +1335,8 @@ INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (combo_box, "combo-box"); IIFORMAT_HAS_METHOD (combo_box, validate); IIFORMAT_HAS_SHARED_METHOD (combo_box, possible_dest_types, widget); + IIFORMAT_HAS_SHARED_METHOD (combo_box, decode_domain, subwindow); + VALID_GUI_KEYWORDS (combo_box); IIFORMAT_VALID_KEYWORD (combo_box, Q_width, check_valid_int); @@ -1263,6 +1352,8 @@ IIFORMAT_HAS_SHARED_METHOD (scrollbar, validate, widget); IIFORMAT_HAS_SHARED_METHOD (scrollbar, possible_dest_types, widget); IIFORMAT_HAS_SHARED_METHOD (scrollbar, instantiate, widget); + IIFORMAT_HAS_SHARED_METHOD (scrollbar, post_instantiate, widget); + IIFORMAT_HAS_SHARED_METHOD (scrollbar, decode_domain, subwindow); VALID_GUI_KEYWORDS (scrollbar); IIFORMAT_VALID_KEYWORD (scrollbar, Q_pixel_width, check_valid_int_or_function); @@ -1276,6 +1367,8 @@ IIFORMAT_HAS_SHARED_METHOD (progress_gauge, validate, widget); IIFORMAT_HAS_SHARED_METHOD (progress_gauge, possible_dest_types, widget); IIFORMAT_HAS_SHARED_METHOD (progress_gauge, instantiate, widget); + IIFORMAT_HAS_SHARED_METHOD (progress_gauge, post_instantiate, widget); + IIFORMAT_HAS_SHARED_METHOD (progress_gauge, decode_domain, subwindow); IIFORMAT_HAS_METHOD (progress_gauge, set_property); VALID_WIDGET_KEYWORDS (progress_gauge); VALID_GUI_KEYWORDS (progress_gauge); @@ -1287,6 +1380,8 @@ IIFORMAT_HAS_SHARED_METHOD (tree_view, validate, combo_box); IIFORMAT_HAS_SHARED_METHOD (tree_view, possible_dest_types, widget); IIFORMAT_HAS_SHARED_METHOD (tree_view, instantiate, widget); + IIFORMAT_HAS_SHARED_METHOD (tree_view, post_instantiate, widget); + IIFORMAT_HAS_SHARED_METHOD (tree_view, decode_domain, subwindow); IIFORMAT_HAS_METHOD (tree_view, query_geometry); VALID_WIDGET_KEYWORDS (tree_view); VALID_GUI_KEYWORDS (tree_view); @@ -1299,6 +1394,8 @@ IIFORMAT_HAS_SHARED_METHOD (tab_control, validate, combo_box); IIFORMAT_HAS_SHARED_METHOD (tab_control, possible_dest_types, widget); IIFORMAT_HAS_SHARED_METHOD (tab_control, instantiate, widget); + IIFORMAT_HAS_SHARED_METHOD (tab_control, post_instantiate, widget); + IIFORMAT_HAS_SHARED_METHOD (tab_control, decode_domain, subwindow); IIFORMAT_HAS_METHOD (tab_control, query_geometry); IIFORMAT_HAS_METHOD (tab_control, set_property); VALID_WIDGET_KEYWORDS (tab_control); @@ -1312,26 +1409,52 @@ INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (label, "label"); IIFORMAT_HAS_SHARED_METHOD (label, possible_dest_types, widget); IIFORMAT_HAS_SHARED_METHOD (label, instantiate, widget); + IIFORMAT_HAS_SHARED_METHOD (label, post_instantiate, widget); + IIFORMAT_HAS_SHARED_METHOD (label, decode_domain, subwindow); VALID_WIDGET_KEYWORDS (label); IIFORMAT_VALID_KEYWORD (label, Q_descriptor, check_valid_string); } +#define VALID_LAYOUT_KEYWORDS(layout) \ + VALID_WIDGET_KEYWORDS (layout); \ + IIFORMAT_VALID_KEYWORD (layout, Q_orientation, check_valid_orientation); \ + IIFORMAT_VALID_KEYWORD (layout, Q_justify, check_valid_justification); \ + IIFORMAT_VALID_KEYWORD (layout, Q_border, check_valid_border); \ + IIFORMAT_VALID_KEYWORD (layout, Q_margin_width, check_valid_int); \ + IIFORMAT_VALID_KEYWORD (layout, Q_items, \ + check_valid_glyph_or_instantiator_list) + static void image_instantiator_layout (void) { INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (layout, "layout"); - IIFORMAT_HAS_METHOD (layout, possible_dest_types); - IIFORMAT_HAS_SHARED_METHOD (layout, instantiate, widget); + IIFORMAT_HAS_SHARED_METHOD (layout, possible_dest_types, widget); + IIFORMAT_HAS_METHOD (layout, instantiate); + IIFORMAT_HAS_METHOD (layout, post_instantiate); + IIFORMAT_HAS_SHARED_METHOD (layout, decode_domain, subwindow); IIFORMAT_HAS_METHOD (layout, normalize); IIFORMAT_HAS_METHOD (layout, query_geometry); IIFORMAT_HAS_METHOD (layout, layout); - VALID_WIDGET_KEYWORDS (layout); - IIFORMAT_VALID_KEYWORD (layout, Q_orientation, check_valid_orientation); - IIFORMAT_VALID_KEYWORD (layout, Q_justify, check_valid_justification); - IIFORMAT_VALID_KEYWORD (layout, Q_border, check_valid_border); - IIFORMAT_VALID_KEYWORD (layout, Q_items, - check_valid_glyph_or_instantiator_list); + + VALID_GUI_KEYWORDS (layout); + VALID_LAYOUT_KEYWORDS (layout); } +static void image_instantiator_native_layout (void) +{ + INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (native_layout, "native-layout"); + IIFORMAT_HAS_SHARED_METHOD (native_layout, possible_dest_types, widget); + IIFORMAT_HAS_SHARED_METHOD (native_layout, instantiate, layout); + IIFORMAT_HAS_SHARED_METHOD (native_layout, post_instantiate, layout); + IIFORMAT_HAS_METHOD (native_layout, layout); + IIFORMAT_HAS_SHARED_METHOD (native_layout, decode_domain, subwindow); + IIFORMAT_HAS_SHARED_METHOD (native_layout, normalize, layout); + IIFORMAT_HAS_SHARED_METHOD (native_layout, query_geometry, layout); + IIFORMAT_HAS_SHARED_METHOD (native_layout, layout, layout); + + VALID_GUI_KEYWORDS (native_layout); + VALID_LAYOUT_KEYWORDS (native_layout); +} + void image_instantiator_format_create_glyphs_widget (void) { @@ -1345,6 +1468,7 @@ image_instantiator_tab_control(); image_instantiator_labels(); image_instantiator_layout(); + image_instantiator_native_layout(); } void @@ -1359,10 +1483,4 @@ vars_of_glyphs_widget (void) { reinit_vars_of_glyphs_widget (); - - DEFVAR_LISP ("widget-callback-current-channel", &Vwidget_callback_current_channel /* -The domain that is current when a widget callback is invoked. -This is invariably the frame that the widget is instantiated in. -*/); - Vwidget_callback_current_channel = Qnil; } Index: src/glyphs-x.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/glyphs-x.c,v retrieving revision 1.49.2.67 diff -u -r1.49.2.67 glyphs-x.c --- src/glyphs-x.c 2000/04/28 15:17:20 1.49.2.67 +++ src/glyphs-x.c 2000/05/03 14:39:48 @@ -98,7 +98,6 @@ DECLARE_IMAGE_INSTANTIATOR_FORMAT (string); DECLARE_IMAGE_INSTANTIATOR_FORMAT (formatted_string); DECLARE_IMAGE_INSTANTIATOR_FORMAT (inherit); -DECLARE_IMAGE_INSTANTIATOR_FORMAT (layout); #ifdef HAVE_JPEG DECLARE_IMAGE_INSTANTIATOR_FORMAT (jpeg); #endif @@ -128,7 +127,9 @@ DEFINE_IMAGE_INSTANTIATOR_FORMAT (autodetect); #ifdef HAVE_WIDGETS +DECLARE_IMAGE_INSTANTIATOR_FORMAT (layout); DEFINE_DEVICE_IIFORMAT (x, widget); +DEFINE_DEVICE_IIFORMAT (x, native_layout); DEFINE_DEVICE_IIFORMAT (x, button); DEFINE_DEVICE_IIFORMAT (x, progress_gauge); DEFINE_DEVICE_IIFORMAT (x, edit_field); @@ -394,9 +395,10 @@ if (!p->data) return; - if (DEVICE_LIVE_P (XDEVICE (p->device))) + if (DEVICE_LIVE_P (XDEVICE (IMAGE_INSTANCE_DEVICE (p)))) { - Display *dpy = DEVICE_X_DISPLAY (XDEVICE (p->device)); + Display *dpy = DEVICE_X_DISPLAY + (XDEVICE (IMAGE_INSTANCE_DEVICE (p))); if (IMAGE_INSTANCE_TYPE (p) == IMAGE_WIDGET) { @@ -2210,11 +2212,11 @@ /* Possibly update the colors and font */ if (IMAGE_INSTANCE_WIDGET_FACE_CHANGED (p) || - XFRAME (IMAGE_INSTANCE_SUBWINDOW_FRAME (p))->faces_changed + XFRAME (IMAGE_INSTANCE_FRAME (p))->faces_changed || IMAGE_INSTANCE_WIDGET_ITEMS_CHANGED (p)) { - update_widget_face (wv, p, IMAGE_INSTANCE_SUBWINDOW_FRAME (p)); + update_widget_face (wv, p, IMAGE_INSTANCE_FRAME (p)); } /* Possibly update the text. */ @@ -2267,15 +2269,15 @@ /* This function can GC */ Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii); - Lisp_Object frame = FW_FRAME (domain); + Lisp_Object frame = DOMAIN_FRAME (domain); struct frame* f = XFRAME (frame); Display *dpy; Screen *xs; Window pw, win; XSetWindowAttributes xswa; Mask valueMask = 0; - unsigned int w = IMAGE_INSTANCE_SUBWINDOW_WIDTH (ii), - h = IMAGE_INSTANCE_SUBWINDOW_HEIGHT (ii); + unsigned int w = IMAGE_INSTANCE_WIDTH (ii), + h = IMAGE_INSTANCE_HEIGHT (ii); if (!DEVICE_X_P (XDEVICE (device))) signal_simple_error ("Not an X device", device); @@ -2420,7 +2422,7 @@ Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii), pixel; struct device* d = XDEVICE (device); - Lisp_Object frame = FW_FRAME (domain); + Lisp_Object frame = DOMAIN_FRAME (domain); struct frame* f = XFRAME (frame); char* nm=0; Widget wid; @@ -2478,12 +2480,12 @@ anymore...*/ pixel = FACE_FOREGROUND (IMAGE_INSTANCE_WIDGET_FACE (ii), - IMAGE_INSTANCE_SUBWINDOW_FRAME (ii)); + IMAGE_INSTANCE_FRAME (ii)); fcolor = COLOR_INSTANCE_X_COLOR (XCOLOR_INSTANCE (pixel)); pixel = FACE_BACKGROUND (IMAGE_INSTANCE_WIDGET_FACE (ii), - IMAGE_INSTANCE_SUBWINDOW_FRAME (ii)); + IMAGE_INSTANCE_FRAME (ii)); bcolor = COLOR_INSTANCE_X_COLOR (XCOLOR_INSTANCE (pixel)); lw_add_widget_value_arg (wv, XtNbackground, bcolor.pixel); @@ -2529,6 +2531,18 @@ return Qunbound; } +/* Instantiate a layout control for putting other widgets in. */ +static void +x_native_layout_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, + Lisp_Object pointer_fg, Lisp_Object pointer_bg, + int dest_mask, Lisp_Object domain) +{ + Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); + + x_widget_instantiate (image_instance, instantiator, pointer_fg, + pointer_bg, dest_mask, domain, "layout", 0); +} + /* Instantiate a button widget. Unfortunately instantiated widgets are particular to a frame since they need to have a parent. It's not like images where you just select the image into the context you @@ -2692,7 +2706,7 @@ IMAGE_INSTANCE_WIDGET_ITEMS (ii)); update_tab_widget_face (wv, ii, - IMAGE_INSTANCE_SUBWINDOW_FRAME (ii)); + IMAGE_INSTANCE_FRAME (ii)); x_widget_instantiate (image_instance, instantiator, pointer_fg, pointer_bg, dest_mask, domain, "tab-control", wv); @@ -2707,7 +2721,7 @@ /* Possibly update the face. */ if (IMAGE_INSTANCE_WIDGET_FACE_CHANGED (ii) || - XFRAME (IMAGE_INSTANCE_SUBWINDOW_FRAME (ii))->faces_changed + XFRAME (IMAGE_INSTANCE_FRAME (ii))->faces_changed || IMAGE_INSTANCE_WIDGET_ITEMS_CHANGED (ii)) { @@ -2718,7 +2732,7 @@ return; update_tab_widget_face (wv, ii, - IMAGE_INSTANCE_SUBWINDOW_FRAME (ii)); + IMAGE_INSTANCE_FRAME (ii)); lw_modify_all_widgets (IMAGE_INSTANCE_X_WIDGET_LWID (ii), wv, True); } @@ -2800,12 +2814,15 @@ INITIALIZE_DEVICE_IIFORMAT (x, subwindow); IIFORMAT_HAS_DEVMETHOD (x, subwindow, instantiate); #ifdef HAVE_WIDGETS + /* layout widget */ + INITIALIZE_DEVICE_IIFORMAT (x, native_layout); + IIFORMAT_HAS_DEVMETHOD (x, native_layout, instantiate); /* button widget */ INITIALIZE_DEVICE_IIFORMAT (x, button); IIFORMAT_HAS_DEVMETHOD (x, button, property); IIFORMAT_HAS_DEVMETHOD (x, button, instantiate); IIFORMAT_HAS_DEVMETHOD (x, button, update); - + /* general widget methods. */ INITIALIZE_DEVICE_IIFORMAT (x, widget); IIFORMAT_HAS_DEVMETHOD (x, widget, property); /* progress gauge */ Index: src/glyphs-x.h =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/glyphs-x.h,v retrieving revision 1.4.2.11 diff -u -r1.4.2.11 glyphs-x.h --- src/glyphs-x.h 2000/04/20 01:50:59 1.4.2.11 +++ src/glyphs-x.h 2000/05/03 14:39:48 @@ -122,6 +122,11 @@ (X_SUBWINDOW_INSTANCE_DATA (i)->data.wid.id) #define IMAGE_INSTANCE_X_CLIPWIDGET(i) \ (X_SUBWINDOW_INSTANCE_DATA (i)->data.wid.clip_window) +#define IMAGE_INSTANCE_X_SUBWINDOW_ID(i) \ + (* (Window *) & IMAGE_INSTANCE_SUBWINDOW_ID (i)) +#define IMAGE_INSTANCE_X_WIDGET_ID(i) \ + (* (Widget *) & IMAGE_INSTANCE_SUBWINDOW_ID (i)) + #define XIMAGE_INSTANCE_X_SUBWINDOW_PARENT(i) \ IMAGE_INSTANCE_X_SUBWINDOW_PARENT (XIMAGE_INSTANCE (i)) #define XIMAGE_INSTANCE_X_SUBWINDOW_DISPLAY(i) \ @@ -136,10 +141,14 @@ IMAGE_INSTANCE_X_CLIPWIDGET (XIMAGE_INSTANCE (i)) #define XIMAGE_INSTANCE_X_CLIPWINDOW(i) \ IMAGE_INSTANCE_X_CLIPWINDOW (XIMAGE_INSTANCE (i)) -#define IMAGE_INSTANCE_X_SUBWINDOW_ID(i) \ - (* (Window *) & IMAGE_INSTANCE_SUBWINDOW_ID (i)) -#define IMAGE_INSTANCE_X_WIDGET_ID(i) \ - (* (Widget *) & IMAGE_INSTANCE_SUBWINDOW_ID (i)) +#define XIMAGE_INSTANCE_X_WIDGET_ID(i) \ + IMAGE_INSTANCE_X_WIDGET_ID (XIMAGE_INSTANCE (i)) + +#define DOMAIN_X_WIDGET(domain) \ + ((IMAGE_INSTANCEP (domain) && \ + X_SUBWINDOW_INSTANCE_DATA (XIMAGE_INSTANCE (domain))) ? \ + XIMAGE_INSTANCE_X_WIDGET_ID (domain) : \ + FRAME_X_CONTAINER_WIDGET (f) (DOMAIN_XFRAME (domain))) #endif /* HAVE_X_WINDOWS */ #endif /* INCLUDED_glyphs_x_h_ */ Index: src/glyphs.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/glyphs.c,v retrieving revision 1.23.2.63 diff -u -r1.23.2.63 glyphs.c --- src/glyphs.c 2000/04/28 15:17:21 1.23.2.63 +++ src/glyphs.c 2000/05/03 14:39:49 @@ -44,6 +44,7 @@ #include "chartab.h" #include "rangetab.h" #include "blocktype.h" +#include "glyphs.h" #ifdef HAVE_XPM #include @@ -59,7 +60,6 @@ Lisp_Object Qpointer_image_instance_p; Lisp_Object Qsubwindow_image_instance_p; Lisp_Object Qlayout_image_instance_p; -Lisp_Object Qupdate_widget_instances; Lisp_Object Qwidget_image_instance_p; Lisp_Object Qconst_glyph_variable; Lisp_Object Qmono_pixmap, Qcolor_pixmap, Qsubwindow; @@ -124,13 +124,15 @@ image_instantiator_format_entry_dynarr * the_image_instantiator_format_entry_dynarr; -static Lisp_Object allocate_image_instance (Lisp_Object device, Lisp_Object glyph); +static Lisp_Object allocate_image_instance (Lisp_Object cache_domain, + Lisp_Object glyph); static void image_validate (Lisp_Object instantiator); static void glyph_property_was_changed (Lisp_Object glyph, Lisp_Object property, Lisp_Object locale); static void set_image_instance_dirty_p (Lisp_Object instance, int dirty); static void register_ignored_expose (struct frame* f, int x, int y, int width, int height); +static void cache_subwindow_instance_in_frame_maybe (Lisp_Object instance); /* Unfortunately windows and X are different. In windows BeginPaint() will prevent WM_PAINT messages being generated so it is unnecessary to register exposures as they will not occur. Under X they will @@ -542,6 +544,58 @@ return Fvector (len, elt); } +#ifdef ERROR_CHECK_GLYPHS +static int +check_instance_cache_mapper (Lisp_Object key, Lisp_Object value, + void *flag_closure) +{ + /* This function can GC */ + Lisp_Object window; + VOID_TO_LISP (window, flag_closure); + assert (EQ (XIMAGE_INSTANCE_DOMAIN (value), window)); + + return 0; +} + +void +check_window_subwindow_cache (struct window* w) +{ + Lisp_Object window; + + XSETWINDOW (window, w); + + assert (!NILP (w->subwindow_instance_cache)); + elisp_maphash (check_instance_cache_mapper, + w->subwindow_instance_cache, + LISP_TO_VOID (window)); +} + +void +check_image_instance_structure (Lisp_Object instance) +{ + /* Weird nothing images exist at startup when the console is + deleted. */ + if (!NOTHING_IMAGE_INSTANCEP (instance)) + assert (DOMAIN_LIVE_P (instance)); + if (WINDOWP (XIMAGE_INSTANCE_DOMAIN (instance))) + check_window_subwindow_cache + (XWINDOW (XIMAGE_INSTANCE_DOMAIN (instance))); +} +#endif + +/* Determine what domain the image instance should be cached in. */ +static Lisp_Object +decode_image_instantiator_domain (Lisp_Object instantiator, + Lisp_Object domain) +{ + Lisp_Object device = DOMAIN_DEVICE (domain); + struct image_instantiator_methods *meths = + decode_image_instantiator_format (XVECTOR_DATA (instantiator)[0], + ERROR_ME); + return IIFORMAT_METH_OR_GIVEN (meths, decode_domain, (instantiator, domain), + device); +} + static Lisp_Object normalize_image_instantiator (Lisp_Object instantiator, Lisp_Object contype, @@ -576,54 +630,67 @@ } static Lisp_Object -instantiate_image_instantiator (Lisp_Object device, Lisp_Object domain, +instantiate_image_instantiator (Lisp_Object cache_domain, Lisp_Object domain, Lisp_Object instantiator, Lisp_Object pointer_fg, Lisp_Object pointer_bg, int dest_mask, Lisp_Object glyph) { - Lisp_Object ii = allocate_image_instance (device, glyph); + Lisp_Object ii = allocate_image_instance (cache_domain, glyph); Lisp_Image_Instance* p = XIMAGE_INSTANCE (ii); - struct image_instantiator_methods *meths; + struct image_instantiator_methods *meths, *device_meths; struct gcpro gcpro1; - int methp = 0; GCPRO1 (ii); - if (!valid_image_instantiator_format_p (XVECTOR_DATA (instantiator)[0], device)) + if (!valid_image_instantiator_format_p (XVECTOR_DATA (instantiator)[0], + DOMAIN_DEVICE (cache_domain))) signal_simple_error ("Image instantiator format is invalid in this locale.", instantiator); meths = decode_image_instantiator_format (XVECTOR_DATA (instantiator)[0], ERROR_ME); - methp = (int)HAS_IIFORMAT_METH_P (meths, instantiate); MAYBE_IIFORMAT_METH (meths, instantiate, (ii, instantiator, pointer_fg, pointer_bg, dest_mask, domain)); - /* now do device specific instantiation */ - meths = decode_device_ii_format (device, XVECTOR_DATA (instantiator)[0], - ERROR_ME_NOT); + /* Now do device specific instantiation. */ + device_meths = decode_device_ii_format (DOMAIN_DEVICE (cache_domain), + XVECTOR_DATA (instantiator)[0], + ERROR_ME_NOT); - if (!methp && (!meths || !HAS_IIFORMAT_METH_P (meths, instantiate))) + if (!HAS_IIFORMAT_METH_P (meths, instantiate) + && (!device_meths || !HAS_IIFORMAT_METH_P (device_meths, instantiate))) signal_simple_error ("Don't know how to instantiate this image instantiator?", instantiator); - MAYBE_IIFORMAT_METH (meths, instantiate, (ii, instantiator, pointer_fg, - pointer_bg, dest_mask, domain)); - UNGCPRO; - /* Some code may have already laid out the widget, if not then do it - here. */ + /* In general native window system methods will require sane + geometry values, thus the instance needs to have been laid-out + before they get called. */ + image_instance_layout (ii, XIMAGE_INSTANCE_WIDTH (ii), + XIMAGE_INSTANCE_HEIGHT (ii), domain); + + MAYBE_IIFORMAT_METH (device_meths, instantiate, (ii, instantiator, pointer_fg, + pointer_bg, dest_mask, domain)); + /* Do post instantiation. */ + MAYBE_IIFORMAT_METH (meths, post_instantiate, (ii, instantiator, domain)); + MAYBE_IIFORMAT_METH (device_meths, post_instantiate, (ii, instantiator, domain)); + + /* We're done. */ + IMAGE_INSTANCE_INITIALIZED (p) = 1; + /* Now that we're done verify that we really are laid out. */ if (IMAGE_INSTANCE_LAYOUT_CHANGED (p)) - image_instance_layout (ii, IMAGE_UNSPECIFIED_GEOMETRY, - IMAGE_UNSPECIFIED_GEOMETRY, domain); - + image_instance_layout (ii, XIMAGE_INSTANCE_WIDTH (ii), + XIMAGE_INSTANCE_HEIGHT (ii), domain); + /* We *must* have a clean image at this point. */ IMAGE_INSTANCE_TEXT_CHANGED (p) = 0; IMAGE_INSTANCE_SIZE_CHANGED (p) = 0; IMAGE_INSTANCE_LAYOUT_CHANGED (p) = 0; IMAGE_INSTANCE_DIRTYP (p) = 0; + + ERROR_CHECK_IMAGE_INSTANCE (ii); - return ii; + RETURN_UNGCPRO (ii); } @@ -638,7 +705,23 @@ { Lisp_Image_Instance *i = XIMAGE_INSTANCE (obj); + /* #### I want to check the instance here, but there are way too + many instances of the instance being marked while the domain is + dead. For instance you can get marked through an event when using + callback_ex.*/ +#if 0 + ERROR_CHECK_IMAGE_INSTANCE (obj); +#endif + mark_object (i->name); + /* Is this legal in marking? We may get in the situation where the + domain has been deleted - making the instance unusable. It seems + better to remove the domain so that it can be finalized. */ + if (!DOMAIN_LIVE_P (i->domain)) + i->domain = Qnil; + else + mark_object (i->domain); + /* We don't mark the glyph reference since that would create a circularity preventing GC. */ switch (IMAGE_INSTANCE_TYPE (i)) @@ -657,23 +740,27 @@ break; case IMAGE_WIDGET: - case IMAGE_LAYOUT: mark_object (IMAGE_INSTANCE_WIDGET_TYPE (i)); mark_object (IMAGE_INSTANCE_WIDGET_PROPS (i)); mark_object (IMAGE_INSTANCE_WIDGET_FACE (i)); mark_object (IMAGE_INSTANCE_WIDGET_ITEMS (i)); + mark_object (IMAGE_INSTANCE_LAYOUT_CHILDREN (i)); mark_object (IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (i)); mark_object (IMAGE_INSTANCE_WIDGET_HEIGHT_SUBR (i)); mark_object (IMAGE_INSTANCE_WIDGET_WIDTH_SUBR (i)); case IMAGE_SUBWINDOW: - mark_object (IMAGE_INSTANCE_SUBWINDOW_FRAME (i)); break; default: break; } - MAYBE_DEVMETH (XDEVICE (i->device), mark_image_instance, (i)); + /* The image may have been previously finalized (yes that's wierd, + see Fdelete_frame() and mark_window_as_deleted()), in which case + the domain will be nil, so cope with this. */ + if (!NILP (IMAGE_INSTANCE_DEVICE (i))) + MAYBE_DEVMETH (XDEVICE (IMAGE_INSTANCE_DEVICE (i)), + mark_image_instance, (i)); return i->device; } @@ -697,7 +784,7 @@ write_c_string (" ", printcharfun); } write_c_string ("on ", printcharfun); - print_internal (ii->device, printcharfun, 0); + print_internal (ii->domain, printcharfun, 0); write_c_string (" ", printcharfun); switch (IMAGE_INSTANCE_TYPE (ii)) { @@ -773,7 +860,7 @@ case IMAGE_WIDGET: print_internal (IMAGE_INSTANCE_WIDGET_TYPE (ii), printcharfun, 0); - if (!NILP (IMAGE_INSTANCE_WIDGET_TEXT (ii))) + if (GUI_ITEMP (IMAGE_INSTANCE_WIDGET_ITEM (ii))) { write_c_string (" ", printcharfun); print_internal (IMAGE_INSTANCE_WIDGET_TEXT (ii), printcharfun, 1); @@ -788,9 +875,8 @@ case IMAGE_SUBWINDOW: - case IMAGE_LAYOUT: - sprintf (buf, " %dx%d", IMAGE_INSTANCE_SUBWINDOW_WIDTH (ii), - IMAGE_INSTANCE_SUBWINDOW_HEIGHT (ii)); + sprintf (buf, " %dx%d", IMAGE_INSTANCE_WIDTH (ii), + IMAGE_INSTANCE_HEIGHT (ii)); write_c_string (buf, printcharfun); /* This is stolen from frame.c. Subwindows are strange in that they @@ -799,7 +885,7 @@ write_c_string (" on #<", printcharfun); { - struct frame* f = XFRAME (IMAGE_INSTANCE_SUBWINDOW_FRAME (ii)); + struct frame* f = XFRAME (IMAGE_INSTANCE_FRAME (ii)); if (!FRAME_LIVE_P (f)) write_c_string ("dead", printcharfun); @@ -817,7 +903,7 @@ abort (); } - MAYBE_DEVMETH (XDEVICE (ii->device), print_image_instance, + MAYBE_DEVMETH (DOMAIN_XDEVICE (ii->domain), print_image_instance, (ii, printcharfun, escapeflag)); sprintf (buf, " 0x%x>", ii->header.uid); write_c_string (buf, printcharfun); @@ -828,23 +914,20 @@ { Lisp_Image_Instance *i = (Lisp_Image_Instance *) header; - if (IMAGE_INSTANCE_TYPE (i) == IMAGE_NOTHING) - /* objects like this exist at dump time, so don't bomb out. */ + /* objects like this exist at dump time, so don't bomb out. */ + if (IMAGE_INSTANCE_TYPE (i) == IMAGE_NOTHING + || + NILP (IMAGE_INSTANCE_DEVICE (i))) return; if (for_disksave) finalose (i); - /* do this so that the cachels get reset */ - if (IMAGE_INSTANCE_TYPE (i) == IMAGE_WIDGET - || - IMAGE_INSTANCE_TYPE (i) == IMAGE_SUBWINDOW - || - IMAGE_INSTANCE_TYPE (i) == IMAGE_SUBWINDOW) - { - MARK_FRAME_SUBWINDOWS_CHANGED - (XFRAME (IMAGE_INSTANCE_SUBWINDOW_FRAME (i))); - } + /* We can't use the domain here, because it might have + disappeared. */ + MAYBE_DEVMETH (XDEVICE (IMAGE_INSTANCE_DEVICE (i)), + finalize_image_instance, (i)); - MAYBE_DEVMETH (XDEVICE (i->device), finalize_image_instance, (i)); + /* Make sure we don't try this twice. */ + IMAGE_INSTANCE_DEVICE (i) = Qnil; } static int @@ -852,13 +935,16 @@ { Lisp_Image_Instance *i1 = XIMAGE_INSTANCE (obj1); Lisp_Image_Instance *i2 = XIMAGE_INSTANCE (obj2); - struct device *d1 = XDEVICE (i1->device); - struct device *d2 = XDEVICE (i2->device); - if (d1 != d2) - return 0; - if (IMAGE_INSTANCE_TYPE (i1) != IMAGE_INSTANCE_TYPE (i2) + ERROR_CHECK_IMAGE_INSTANCE (obj1); + ERROR_CHECK_IMAGE_INSTANCE (obj2); + + if (!EQ (IMAGE_INSTANCE_DOMAIN (i1), + IMAGE_INSTANCE_DOMAIN (i2)) + || IMAGE_INSTANCE_TYPE (i1) != IMAGE_INSTANCE_TYPE (i2) || IMAGE_INSTANCE_WIDTH (i1) != IMAGE_INSTANCE_WIDTH (i2) + || IMAGE_INSTANCE_MARGIN_WIDTH (i1) != + IMAGE_INSTANCE_MARGIN_WIDTH (i2) || IMAGE_INSTANCE_HEIGHT (i1) != IMAGE_INSTANCE_HEIGHT (i2) || IMAGE_INSTANCE_XOFFSET (i1) != IMAGE_INSTANCE_XOFFSET (i2) || IMAGE_INSTANCE_YOFFSET (i1) != IMAGE_INSTANCE_YOFFSET (i2)) @@ -900,7 +986,6 @@ break; case IMAGE_WIDGET: - case IMAGE_LAYOUT: if (!(EQ (IMAGE_INSTANCE_WIDGET_TYPE (i1), IMAGE_INSTANCE_WIDGET_TYPE (i2)) && IMAGE_INSTANCE_SUBWINDOW_ID (i1) == @@ -911,6 +996,9 @@ && internal_equal (IMAGE_INSTANCE_WIDGET_ITEMS (i1), IMAGE_INSTANCE_WIDGET_ITEMS (i2), depth + 1) + && internal_equal (IMAGE_INSTANCE_LAYOUT_CHILDREN (i1), + IMAGE_INSTANCE_LAYOUT_CHILDREN (i2), + depth + 1) && internal_equal (IMAGE_INSTANCE_WIDGET_PROPS (i1), IMAGE_INSTANCE_WIDGET_PROPS (i2), depth + 1) @@ -934,40 +1022,47 @@ abort (); } - return DEVMETH_OR_GIVEN (d1, image_instance_equal, (i1, i2, depth), 1); + return DEVMETH_OR_GIVEN (DOMAIN_XDEVICE (i1->domain), + image_instance_equal, (i1, i2, depth), 1); } -#if 0 -/* internal_hash will not go very far down a list because of the way - its written. For items we need to hash all elements so we provide - our own list hashing function. */ -static unsigned long -full_list_hash (Lisp_Object obj, int depth) +/* Image instance domain manipulators. We can't error check in these + otherwise we get into infinite recursion. */ +Lisp_Object +image_instance_device (Lisp_Object instance) { - unsigned long hash = 0; - Lisp_Object rest; + return XIMAGE_INSTANCE_DEVICE (instance); +} + +Lisp_Object +image_instance_frame (Lisp_Object instance) +{ + return XIMAGE_INSTANCE_FRAME (instance); +} - if (!CONSP (obj)) - return internal_hash (obj, depth + 1); +Lisp_Object +image_instance_window (Lisp_Object instance) +{ + return DOMAIN_WINDOW (XIMAGE_INSTANCE_DOMAIN (instance)); +} - hash = LISP_HASH (XCAR (obj)); - LIST_LOOP (rest, XCDR (obj)) - { - hash = HASH2 (hash, internal_hash (XCAR (rest), depth + 1)); - } - return hash; +int +image_instance_live_p (Lisp_Object instance) +{ + return DOMAIN_LIVE_P (XIMAGE_INSTANCE_DOMAIN (instance)); } -#endif static unsigned long image_instance_hash (Lisp_Object obj, int depth) { Lisp_Image_Instance *i = XIMAGE_INSTANCE (obj); - struct device *d = XDEVICE (i->device); - unsigned long hash = HASH3 ((unsigned long) d, + unsigned long hash = HASH4 (LISP_HASH (IMAGE_INSTANCE_DOMAIN (i)), IMAGE_INSTANCE_WIDTH (i), + IMAGE_INSTANCE_MARGIN_WIDTH (i), IMAGE_INSTANCE_HEIGHT (i)); + ERROR_CHECK_IMAGE_INSTANCE (obj); + switch (IMAGE_INSTANCE_TYPE (i)) { case IMAGE_NOTHING: @@ -988,13 +1083,14 @@ break; case IMAGE_WIDGET: - case IMAGE_LAYOUT: /* We need the hash to be equivalent to what should be displayed. */ - hash = HASH4 (hash, + hash = HASH5 (hash, LISP_HASH (IMAGE_INSTANCE_WIDGET_TYPE (i)), internal_hash (IMAGE_INSTANCE_WIDGET_PROPS (i), depth + 1), - internal_hash (IMAGE_INSTANCE_WIDGET_ITEMS (i), depth + 1)); + internal_hash (IMAGE_INSTANCE_WIDGET_ITEMS (i), depth + 1), + internal_hash (IMAGE_INSTANCE_LAYOUT_CHILDREN (i), + depth + 1)); case IMAGE_SUBWINDOW: hash = HASH2 (hash, (int) IMAGE_INSTANCE_SUBWINDOW_ID (i)); break; @@ -1003,8 +1099,10 @@ abort (); } - return HASH2 (hash, DEVMETH_OR_GIVEN (d, image_instance_hash, (i, depth), - 0)); + return HASH2 (hash, DEVMETH_OR_GIVEN + (XDEVICE (image_instance_device (obj)), + image_instance_hash, (i, depth), + 0)); } DEFINE_LRECORD_IMPLEMENTATION ("image-instance", image_instance, @@ -1014,23 +1112,36 @@ Lisp_Image_Instance); static Lisp_Object -allocate_image_instance (Lisp_Object device, Lisp_Object glyph) +allocate_image_instance (Lisp_Object cache_domain, Lisp_Object glyph) { Lisp_Image_Instance *lp = alloc_lcrecord_type (Lisp_Image_Instance, &lrecord_image_instance); Lisp_Object val; zero_lcrecord (lp); - lp->device = device; + /* It's not possible to simply keep a record of the domain in which + the instance was instantiated. This is because caching may mean + that the domain becomes invalid but the instance remains + valid. However, the only truly relevant domain is the domain in + which the instance is cached since this is the one that will be + common to the instances. */ + lp->domain = cache_domain; + /* The cache domain is not quite sufficient since the domain can get + deleted before the image instance does. We need to know the + domain device in order to finalize the image instance + properly. We therefore record the device also. */ + lp->device = DOMAIN_DEVICE (cache_domain); lp->type = IMAGE_NOTHING; lp->name = Qnil; lp->x_offset = 0; lp->y_offset = 0; - lp->width = 0; - lp->height = 0; + lp->width = IMAGE_UNSPECIFIED_GEOMETRY; + lp->margin_width = 0; + lp->height = IMAGE_UNSPECIFIED_GEOMETRY; lp->parent = glyph; /* So that layouts get done. */ lp->layout_changed = 1; + lp->initialized = 0; XSETIMAGE_INSTANCE (val, lp); MARK_GLYPHS_CHANGED; @@ -1051,7 +1162,6 @@ if (EQ (type, Qpointer)) return IMAGE_POINTER; if (EQ (type, Qsubwindow)) return IMAGE_SUBWINDOW; if (EQ (type, Qwidget)) return IMAGE_WIDGET; - if (EQ (type, Qlayout)) return IMAGE_LAYOUT; maybe_signal_simple_error ("Invalid image-instance type", type, Qimage, errb); @@ -1071,7 +1181,6 @@ case IMAGE_POINTER: return Qpointer; case IMAGE_SUBWINDOW: return Qsubwindow; case IMAGE_WIDGET: return Qwidget; - case IMAGE_LAYOUT: return Qlayout; default: abort (); } @@ -1080,16 +1189,6 @@ } static int -image_instance_type_to_mask (enum image_instance_type type) -{ - /* This depends on the fact that enums are assigned consecutive - integers starting at 0. (Remember that IMAGE_UNKNOWN is the - first enum.) I'm fairly sure this behavior is ANSI-mandated, - so there should be no portability problems here. */ - return (1 << ((int) (type) - 1)); -} - -static int decode_image_instance_type_list (Lisp_Object list) { Lisp_Object rest; @@ -1319,6 +1418,7 @@ (image_instance)) { CHECK_IMAGE_INSTANCE (image_instance); + ERROR_CHECK_IMAGE_INSTANCE (image_instance); return encode_image_instance_type (XIMAGE_INSTANCE_TYPE (image_instance)); } @@ -1358,12 +1458,13 @@ struct image_instantiator_methods* meths; CHECK_IMAGE_INSTANCE (image_instance); + ERROR_CHECK_IMAGE_INSTANCE (image_instance); CHECK_SYMBOL (prop); ii = XIMAGE_INSTANCE (image_instance); /* ... then try device specific methods ... */ type = encode_image_instance_type (IMAGE_INSTANCE_TYPE (ii)); - meths = decode_device_ii_format (IMAGE_INSTANCE_DEVICE (ii), + meths = decode_device_ii_format (image_instance_device (image_instance), type, ERROR_ME_NOT); if (meths && HAS_IIFORMAT_METH_P (meths, property) && @@ -1395,11 +1496,12 @@ struct image_instantiator_methods* meths; CHECK_IMAGE_INSTANCE (image_instance); + ERROR_CHECK_IMAGE_INSTANCE (image_instance); CHECK_SYMBOL (prop); ii = XIMAGE_INSTANCE (image_instance); type = encode_image_instance_type (IMAGE_INSTANCE_TYPE (ii)); /* try device specific methods first ... */ - meths = decode_device_ii_format (IMAGE_INSTANCE_DEVICE (ii), + meths = decode_device_ii_format (image_instance_device (image_instance), type, ERROR_ME_NOT); if (meths && HAS_IIFORMAT_METH_P (meths, set_property) && @@ -1442,6 +1544,7 @@ (image_instance)) { CHECK_IMAGE_INSTANCE (image_instance); + ERROR_CHECK_IMAGE_INSTANCE (image_instance); switch (XIMAGE_INSTANCE_TYPE (image_instance)) { @@ -1461,6 +1564,7 @@ (image_instance)) { CHECK_IMAGE_INSTANCE (image_instance); + ERROR_CHECK_IMAGE_INSTANCE (image_instance); switch (XIMAGE_INSTANCE_TYPE (image_instance)) { @@ -1481,6 +1585,7 @@ (image_instance)) { CHECK_IMAGE_INSTANCE (image_instance); + ERROR_CHECK_IMAGE_INSTANCE (image_instance); switch (XIMAGE_INSTANCE_TYPE (image_instance)) { @@ -1500,6 +1605,7 @@ (image_instance)) { CHECK_IMAGE_INSTANCE (image_instance); + ERROR_CHECK_IMAGE_INSTANCE (image_instance); switch (XIMAGE_INSTANCE_TYPE (image_instance)) { @@ -1508,7 +1614,6 @@ case IMAGE_POINTER: case IMAGE_SUBWINDOW: case IMAGE_WIDGET: - case IMAGE_LAYOUT: return make_int (XIMAGE_INSTANCE_HEIGHT (image_instance)); default: @@ -1522,6 +1627,7 @@ (image_instance)) { CHECK_IMAGE_INSTANCE (image_instance); + ERROR_CHECK_IMAGE_INSTANCE (image_instance); switch (XIMAGE_INSTANCE_TYPE (image_instance)) { @@ -1530,7 +1636,6 @@ case IMAGE_POINTER: case IMAGE_SUBWINDOW: case IMAGE_WIDGET: - case IMAGE_LAYOUT: return make_int (XIMAGE_INSTANCE_WIDTH (image_instance)); default: @@ -1549,6 +1654,7 @@ (image_instance)) { CHECK_IMAGE_INSTANCE (image_instance); + ERROR_CHECK_IMAGE_INSTANCE (image_instance); switch (XIMAGE_INSTANCE_TYPE (image_instance)) { @@ -1573,6 +1679,7 @@ (image_instance)) { CHECK_IMAGE_INSTANCE (image_instance); + ERROR_CHECK_IMAGE_INSTANCE (image_instance); switch (XIMAGE_INSTANCE_TYPE (image_instance)) { @@ -1594,6 +1701,7 @@ (image_instance)) { CHECK_IMAGE_INSTANCE (image_instance); + ERROR_CHECK_IMAGE_INSTANCE (image_instance); switch (XIMAGE_INSTANCE_TYPE (image_instance)) { @@ -1605,7 +1713,7 @@ case IMAGE_WIDGET: return FACE_FOREGROUND ( XIMAGE_INSTANCE_WIDGET_FACE (image_instance), - XIMAGE_INSTANCE_SUBWINDOW_FRAME + XIMAGE_INSTANCE_FRAME (image_instance)); default: @@ -1621,6 +1729,7 @@ (image_instance)) { CHECK_IMAGE_INSTANCE (image_instance); + ERROR_CHECK_IMAGE_INSTANCE (image_instance); switch (XIMAGE_INSTANCE_TYPE (image_instance)) { @@ -1632,7 +1741,7 @@ case IMAGE_WIDGET: return FACE_BACKGROUND ( XIMAGE_INSTANCE_WIDGET_FACE (image_instance), - XIMAGE_INSTANCE_SUBWINDOW_FRAME + XIMAGE_INSTANCE_FRAME (image_instance)); default: @@ -1654,16 +1763,18 @@ Lisp_Object device; CHECK_IMAGE_INSTANCE (image_instance); + ERROR_CHECK_IMAGE_INSTANCE (image_instance); CHECK_COLOR_INSTANCE (foreground); CHECK_COLOR_INSTANCE (background); - device = XIMAGE_INSTANCE_DEVICE (image_instance); + device = image_instance_device (image_instance); if (!HAS_DEVMETH_P (XDEVICE (device), colorize_image_instance)) return image_instance; /* #### There should be a copy_image_instance(), which calls a device-specific method to copy the window-system subobject. */ - new = allocate_image_instance (device, Qnil); + new = allocate_image_instance (XIMAGE_INSTANCE_DOMAIN (image_instance), + Qnil); copy_lcrecord (XIMAGE_INSTANCE (new), XIMAGE_INSTANCE (image_instance)); /* note that if this method returns non-zero, this method MUST copy any window-system resources, so that when one image instance is @@ -1690,6 +1801,7 @@ Lisp_Image_Instance* ii = XIMAGE_INSTANCE (image_instance); Lisp_Object type; struct image_instantiator_methods* meths; + ERROR_CHECK_IMAGE_INSTANCE (image_instance); type = encode_image_instance_type (IMAGE_INSTANCE_TYPE (ii)); meths = decode_device_ii_format (Qnil, type, ERROR_ME_NOT); @@ -1724,6 +1836,12 @@ Lisp_Object type; struct image_instantiator_methods* meths; + ERROR_CHECK_IMAGE_INSTANCE (image_instance); + + /* Nothing is as nothing does. */ + if (NOTHING_IMAGE_INSTANCEP (image_instance)) + return; + type = encode_image_instance_type (IMAGE_INSTANCE_TYPE (ii)); meths = decode_device_ii_format (Qnil, type, ERROR_ME_NOT); @@ -1732,7 +1850,8 @@ || height == IMAGE_UNSPECIFIED_GEOMETRY) { - unsigned int dwidth, dheight; + unsigned int dwidth = IMAGE_UNSPECIFIED_GEOMETRY, + dheight = IMAGE_UNSPECIFIED_GEOMETRY; /* Get the desired geometry. */ if (meths && HAS_IIFORMAT_METH_P (meths, query_geometry)) @@ -1754,6 +1873,13 @@ height = dheight; } + /* If we don't have sane values then we cannot layout at this point and + must just return. */ + if (width == IMAGE_UNSPECIFIED_GEOMETRY + || + height == IMAGE_UNSPECIFIED_GEOMETRY) + return; + /* At this point width and height should contain sane values. Thus we set the glyph geometry and lay it out. */ if (IMAGE_INSTANCE_WIDTH (ii) != width @@ -1766,15 +1892,11 @@ IMAGE_INSTANCE_WIDTH (ii) = width; IMAGE_INSTANCE_HEIGHT (ii) = height; - if (meths && HAS_IIFORMAT_METH_P (meths, layout)) - { - IIFORMAT_METH (meths, layout, (image_instance, width, height, domain)); - } - /* else no change to the geometry. */ - - /* Do not clear the dirty flag here - redisplay will do this for - us at the end. */ - IMAGE_INSTANCE_LAYOUT_CHANGED (ii) = 0; + if (IIFORMAT_METH_OR_GIVEN (meths, layout, + (image_instance, width, height, domain), 1)) + /* Do not clear the dirty flag here - redisplay will do this for + us at the end. */ + IMAGE_INSTANCE_LAYOUT_CHANGED (ii) = 0; } /* @@ -1917,7 +2039,7 @@ Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); /* Should never get here with a domain other than a window. */ - assert (!NILP (string) && WINDOWP (domain)); + assert (!NILP (string) && WINDOWP (DOMAIN_WINDOW (domain))); if (dest_mask & IMAGE_TEXT_MASK) { IMAGE_INSTANCE_TYPE (ii) = IMAGE_TEXT; @@ -1941,7 +2063,7 @@ unsigned char charsets[NUM_LEADING_BYTES]; struct face_cachel frame_cachel; struct face_cachel *cachel; - Lisp_Object frame = FW_FRAME (domain); + Lisp_Object frame = DOMAIN_FRAME (domain); /* Compute height */ if (height) @@ -1960,7 +2082,8 @@ } else { - cachel = WINDOW_FACE_CACHEL (XWINDOW (domain), DEFAULT_INDEX); + cachel = WINDOW_FACE_CACHEL (DOMAIN_XWINDOW (domain), + DEFAULT_INDEX); } ensure_face_cachel_complete (cachel, domain, charsets); @@ -1993,7 +2116,7 @@ struct face_cachel frame_cachel; struct face_cachel *cachel; int i; - Lisp_Object frame = FW_FRAME (domain); + Lisp_Object frame = DOMAIN_FRAME (domain); /* Compute string font info */ find_charsets_in_bufbyte_string (charsets, @@ -2748,8 +2871,7 @@ Lisp_Object domain, Lisp_Object instantiator, Lisp_Object depth) { - Lisp_Object device = DFW_DEVICE (domain); - struct device *d = XDEVICE (device); + Lisp_Object device = DOMAIN_DEVICE (domain); Lisp_Object glyph = IMAGE_SPECIFIER_ATTACHEE (XIMAGE_SPECIFIER (specifier)); int dest_mask = XIMAGE_SPECIFIER_ALLOWED (specifier); int pointerp = dest_mask & image_instance_type_to_mask (IMAGE_POINTER); @@ -2759,7 +2881,7 @@ /* make sure that the image instance's device and type are matching. */ - if (EQ (device, XIMAGE_INSTANCE_DEVICE (instantiator))) + if (EQ (device, image_instance_device (instantiator))) { int mask = image_instance_type_to_mask (XIMAGE_INSTANCE_TYPE (instantiator)); @@ -2788,12 +2910,12 @@ Lisp_Object ls3 = Qnil; Lisp_Object pointer_fg = Qnil; Lisp_Object pointer_bg = Qnil; - + Lisp_Object cache_domain + = decode_image_instantiator_domain (instantiator, domain); /* We have to put subwindow, widget and text image instances in a per-window cache so that we can see the same glyph in - different windows. Unfortunately we do not know the type of - image_instance until after it has been created. We thus need - to be really careful how we place things. */ + different windows. We use decode_domain to determine the type + of image_instance that will be created. */ if (pointerp) { @@ -2802,121 +2924,99 @@ ls3 = list3 (instantiator, pointer_fg, pointer_bg); } - /* First look in the hash table. */ - subtable = Fgethash (make_int (dest_mask), d->image_instance_cache, - Qunbound); - if (UNBOUNDP (subtable)) - { - /* For the image instance cache, we do comparisons with EQ rather - than with EQUAL, as we do for color and font names. - The reasons are: - - 1) pixmap data can be very long, and thus the hashing and - comparing will take awhile. - 2) It's not so likely that we'll run into things that are EQUAL - but not EQ (that can happen a lot with faces, because their - specifiers are copied around); but pixmaps tend not to be - in faces. - - However, if the image-instance could be a pointer, we have to - use EQUAL because we massaged the instantiator into a cons3 - also containing the foreground and background of the - pointer face. - */ - - subtable = make_lisp_hash_table (20, - pointerp ? HASH_TABLE_KEY_CAR_WEAK - : HASH_TABLE_KEY_WEAK, - pointerp ? HASH_TABLE_EQUAL - : HASH_TABLE_EQ); - Fputhash (make_int (dest_mask), subtable, - d->image_instance_cache); - instance = Qunbound; - } - else + /* First look in the device cache. */ + if (DEVICEP (cache_domain)) { - instance = Fgethash (pointerp ? ls3 : instantiator, - subtable, Qunbound); - /* subwindows have a per-window cache and have to be treated - differently. dest_mask can be a bitwise OR of all image - types so we will only catch someone possibly trying to - instantiate a subwindow type thing. Unfortunately, this - will occur most of the time so this probably slows things - down. But with the current design I don't see anyway - round it. */ - if (UNBOUNDP (instance) - && - dest_mask & (IMAGE_SUBWINDOW_MASK - | IMAGE_WIDGET_MASK - | IMAGE_LAYOUT_MASK - | IMAGE_TEXT_MASK) - && WINDOWP (domain)) + subtable = Fgethash (make_int (dest_mask), + XDEVICE (cache_domain)->image_instance_cache, + Qunbound); + if (UNBOUNDP (subtable)) { - instance = Fgethash (instantiator, - XWINDOW (domain)->subwindow_instance_cache, - Qunbound); + /* For the image instance cache, we do comparisons with EQ rather + than with EQUAL, as we do for color and font names. + The reasons are: + + 1) pixmap data can be very long, and thus the hashing and + comparing will take awhile. + 2) It's not so likely that we'll run into things that are EQUAL + but not EQ (that can happen a lot with faces, because their + specifiers are copied around); but pixmaps tend not to be + in faces. + + However, if the image-instance could be a pointer, we have to + use EQUAL because we massaged the instantiator into a cons3 + also containing the foreground and background of the + pointer face. + */ + + subtable = make_lisp_hash_table + (20, pointerp ? HASH_TABLE_KEY_CAR_WEAK + : HASH_TABLE_KEY_WEAK, + pointerp ? HASH_TABLE_EQUAL + : HASH_TABLE_EQ); + Fputhash (make_int (dest_mask), subtable, + XDEVICE (cache_domain)->image_instance_cache); + instance = Qunbound; } + else + { + instance = Fgethash (pointerp ? ls3 : instantiator, + subtable, Qunbound); + } + } + else if (WINDOWP (cache_domain)) + { + /* Subwindows have a per-window cache and have to be treated + differently. */ + instance = Fgethash (instantiator, + XWINDOW (cache_domain)->subwindow_instance_cache, + Qunbound); } + else + abort (); /* We're not allowed anything else currently. */ + /* If we don't have an instance at this point then create + one. */ if (UNBOUNDP (instance)) { Lisp_Object locative = noseeum_cons (Qnil, noseeum_cons (pointerp ? ls3 : instantiator, - subtable)); + DEVICEP (cache_domain) ? subtable + : XWINDOW (cache_domain) + ->subwindow_instance_cache)); int speccount = specpdl_depth (); - /* make sure we cache the failures, too. - Use an unwind-protect to catch such errors. - If we fail, the unwind-protect records nil in - the hash table. If we succeed, we change the - car of the locative to the resulting instance, - which gets recorded instead. */ + /* Make sure we cache the failures, too. Use an + unwind-protect to catch such errors. If we fail, the + unwind-protect records nil in the hash table. If we + succeed, we change the car of the locative to the + resulting instance, which gets recorded instead. */ record_unwind_protect (image_instantiate_cache_result, locative); - instance = instantiate_image_instantiator (device, - domain, - instantiator, - pointer_fg, pointer_bg, - dest_mask, - glyph); + instance = + instantiate_image_instantiator (cache_domain, + domain, instantiator, + pointer_fg, pointer_bg, + dest_mask, glyph); + + /* We need a per-frame cache for redisplay. */ + cache_subwindow_instance_in_frame_maybe (instance); Fsetcar (locative, instance); - /* only after the image has been instantiated do we know - whether we need to put it in the per-window image instance - cache. */ - if (image_instance_type_to_mask (XIMAGE_INSTANCE_TYPE (instance)) - & - (IMAGE_SUBWINDOW_MASK - | IMAGE_WIDGET_MASK - | IMAGE_LAYOUT_MASK - | IMAGE_TEXT_MASK )) - { -#ifdef ERROR_CHECK_GLYPHS - if (XIMAGE_INSTANCE_TYPE (instance) != IMAGE_TEXT) - assert (EQ (XIMAGE_INSTANCE_SUBWINDOW_FRAME (instance), - FW_FRAME (domain))); -#endif - if (!WINDOWP (domain)) - signal_simple_error ("Can't instantiate text or subwindow outside a window", - instantiator); #ifdef ERROR_CHECK_GLYPHS - if (XIMAGE_INSTANCE_TYPE (instance) != IMAGE_TEXT) - assert (EQ (XIMAGE_INSTANCE_SUBWINDOW_FRAME (instance), - FW_FRAME (domain))); + if (image_instance_type_to_mask (XIMAGE_INSTANCE_TYPE (instance)) + & (IMAGE_SUBWINDOW_MASK | IMAGE_WIDGET_MASK)) + assert (EQ (XIMAGE_INSTANCE_FRAME (instance), + DOMAIN_FRAME (domain))); #endif - Fsetcdr (XCDR (locative), XWINDOW (domain)->subwindow_instance_cache); - } unbind_to (speccount, Qnil); #ifdef ERROR_CHECK_GLYPHS if (image_instance_type_to_mask (XIMAGE_INSTANCE_TYPE (instance)) - & - (IMAGE_SUBWINDOW_MASK - | IMAGE_WIDGET_MASK - | IMAGE_LAYOUT_MASK - | IMAGE_TEXT_MASK )) + & (IMAGE_SUBWINDOW_MASK | IMAGE_WIDGET_MASK)) assert (EQ (Fgethash ((pointerp ? ls3 : instantiator), - XWINDOW (domain)->subwindow_instance_cache, + XWINDOW (cache_domain) + ->subwindow_instance_cache, Qunbound), instance)); #endif } @@ -2929,9 +3029,10 @@ #ifdef ERROR_CHECK_GLYPHS if (image_instance_type_to_mask (XIMAGE_INSTANCE_TYPE (instance)) & (IMAGE_SUBWINDOW_MASK | IMAGE_WIDGET_MASK)) - assert (EQ (XIMAGE_INSTANCE_SUBWINDOW_FRAME (instance), - FW_FRAME (domain))); + assert (EQ (XIMAGE_INSTANCE_FRAME (instance), + DOMAIN_FRAME (domain))); #endif + ERROR_CHECK_IMAGE_INSTANCE (instance); return instance; } @@ -3496,8 +3597,7 @@ XIMAGE_SPECIFIER_ALLOWED (g->image) = IMAGE_NOTHING_MASK | IMAGE_TEXT_MASK | IMAGE_MONO_PIXMAP_MASK | IMAGE_COLOR_PIXMAP_MASK - | IMAGE_SUBWINDOW_MASK | IMAGE_WIDGET_MASK - | IMAGE_LAYOUT_MASK; + | IMAGE_SUBWINDOW_MASK | IMAGE_WIDGET_MASK; break; case GLYPH_POINTER: XIMAGE_SPECIFIER_ALLOWED (g->image) = @@ -3651,6 +3751,7 @@ domain, errb, no_quit, 0, Qzero); assert (!UNBOUNDP (image_instance)); + ERROR_CHECK_IMAGE_INSTANCE (image_instance); return image_instance; } @@ -4092,139 +4193,51 @@ per-frame instance cache that we use to determine if a subwindow is obscuring an area that we want to clear. We need to be able to flip through this quickly so a hashtable is not suitable hence the - subwindow_cachels. The question is should we just not mark - instances in the subwindow_cachels or should we try and invalidate - the cache at suitable points in redisplay? If we don't invalidate - the cache it will fill up with crud that will only get removed when - the frame is deleted. So invalidation is good, the question is when - and whether we mark as well. Go for the simple option - don't mark, - MARK_SUBWINDOWS_CHANGED when a subwindow gets deleted. */ - -void -mark_subwindow_cachels (subwindow_cachel_dynarr *elements) -{ - int elt; - - if (!elements) - return; + subwindow_cachels. This is a weak list so unreference instances + will get deleted properly. */ - for (elt = 0; elt < Dynarr_length (elements); elt++) - { - struct subwindow_cachel *cachel = Dynarr_atp (elements, elt); - mark_object (cachel->subwindow); - } -} - -static void -update_subwindow_cachel_data (struct frame *f, Lisp_Object subwindow, - struct subwindow_cachel *cachel) -{ - cachel->subwindow = subwindow; - cachel->width = XIMAGE_INSTANCE_SUBWINDOW_WIDTH (subwindow); - cachel->height = XIMAGE_INSTANCE_SUBWINDOW_HEIGHT (subwindow); - cachel->updated = 1; -} - -static void -add_subwindow_cachel (struct frame *f, Lisp_Object subwindow) -{ - struct subwindow_cachel new_cachel; - - xzero (new_cachel); - new_cachel.subwindow = Qnil; - new_cachel.x=0; - new_cachel.y=0; - new_cachel.being_displayed=0; - - update_subwindow_cachel_data (f, subwindow, &new_cachel); - Dynarr_add (f->subwindow_cachels, new_cachel); -} - -static int -get_subwindow_cachel_index (struct frame *f, Lisp_Object subwindow) -{ - int elt; - - if (noninteractive) - return 0; - - for (elt = 0; elt < Dynarr_length (f->subwindow_cachels); elt++) - { - struct subwindow_cachel *cachel = - Dynarr_atp (f->subwindow_cachels, elt); - - if (EQ (cachel->subwindow, subwindow) && !NILP (subwindow)) - { - if (!cachel->updated) - update_subwindow_cachel_data (f, subwindow, cachel); - return elt; - } - } - - /* If we didn't find the glyph, add it and then return its index. */ - add_subwindow_cachel (f, subwindow); - return elt; -} - -static void -update_subwindow_cachel (Lisp_Object subwindow) -{ - struct frame* f; - int elt; - - if (NILP (subwindow)) - return; - - f = XFRAME ( XIMAGE_INSTANCE_SUBWINDOW_FRAME (subwindow)); - - for (elt = 0; elt < Dynarr_length (f->subwindow_cachels); elt++) - { - struct subwindow_cachel *cachel = - Dynarr_atp (f->subwindow_cachels, elt); - - if (EQ (cachel->subwindow, subwindow) && !NILP (subwindow)) - { - update_subwindow_cachel_data (f, subwindow, cachel); - } - } -} - /* redisplay in general assumes that drawing something will erase what was there before. unfortunately this does not apply to subwindows that need to be specifically unmapped in order to disappear. we take a brute force approach - on the basis that its cheap - and unmap all subwindows in a display line */ -void -reset_subwindow_cachels (struct frame *f) + +/* Put new instances in the frame subwindow cache. This is less costly than + doing it every time something gets mapped, and deleted instances will be + removed automatically. */ +static void +cache_subwindow_instance_in_frame_maybe (Lisp_Object instance) { - int elt; - for (elt = 0; elt < Dynarr_length (f->subwindow_cachels); elt++) + Lisp_Image_Instance* ii = XIMAGE_INSTANCE (instance); + if (image_instance_type_to_mask (IMAGE_INSTANCE_TYPE (ii)) + & (IMAGE_WIDGET_MASK | IMAGE_SUBWINDOW_MASK)) { - struct subwindow_cachel *cachel = - Dynarr_atp (f->subwindow_cachels, elt); - - if (!NILP (cachel->subwindow) && cachel->being_displayed) - { - cachel->updated = 1; - /* #### This is not optimal as update_subwindow will search - the cachels for ourselves as well. We could easily optimize. */ - unmap_subwindow (cachel->subwindow); - } + struct frame* f = DOMAIN_XFRAME (IMAGE_INSTANCE_DOMAIN (ii)); + XWEAK_LIST_LIST (FRAME_SUBWINDOW_CACHE (f)) + = Fcons (instance, XWEAK_LIST_LIST (FRAME_SUBWINDOW_CACHE (f))); } - Dynarr_reset (f->subwindow_cachels); } +/* Unmap and finalize all subwindow instances in the frame cache. This + is necessary because GC will not guarantee the order things get + deleted in and moreover, frame finalization deletes the window + system windows before deleting XEmacs windows, and hence + subwindows. */ void -mark_subwindow_cachels_as_not_updated (struct frame *f) +free_frame_subwindow_instance_cache (struct frame* f) { - int elt; + Lisp_Object rest; - for (elt = 0; elt < Dynarr_length (f->subwindow_cachels); elt++) - Dynarr_atp (f->subwindow_cachels, elt)->updated = 0; + LIST_LOOP (rest, XWEAK_LIST_LIST (FRAME_SUBWINDOW_CACHE (f))) + { + Lisp_Image_Instance *ii = XIMAGE_INSTANCE (XCAR (rest)); + /* Make sure that the subwindow is unmapped so that window + deletion will not try and do it again. */ + unmap_subwindow (XCAR (rest)); + finalize_image_instance (ii, 0); + } } - - /***************************************************************************** * subwindow exposure ignorance * *****************************************************************************/ @@ -4315,20 +4328,23 @@ ****************************************************************************/ int find_matching_subwindow (struct frame* f, int x, int y, int width, int height) { - int elt; + Lisp_Object rest; - for (elt = 0; elt < Dynarr_length (f->subwindow_cachels); elt++) + LIST_LOOP (rest, XWEAK_LIST_LIST (FRAME_SUBWINDOW_CACHE (f))) { - struct subwindow_cachel *cachel = - Dynarr_atp (f->subwindow_cachels, elt); + Lisp_Image_Instance *ii = XIMAGE_INSTANCE (XCAR (rest)); - if (cachel->being_displayed + if (IMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP (ii) && - cachel->x <= x && cachel->y <= y + IMAGE_INSTANCE_DISPLAY_X (ii) <= x + && + IMAGE_INSTANCE_DISPLAY_Y (ii) <= y && - cachel->x + cachel->width >= x + width + IMAGE_INSTANCE_DISPLAY_X (ii) + + IMAGE_INSTANCE_DISPLAY_WIDTH (ii) >= x + width && - cachel->y + cachel->height >= y + height) + IMAGE_INSTANCE_DISPLAY_Y (ii) + + IMAGE_INSTANCE_DISPLAY_HEIGHT (ii) >= y + height) { return 1; } @@ -4356,9 +4372,9 @@ Fsignal will abort. */ specbind (Qinhibit_quit, Qt); - if (IMAGE_INSTANCE_TYPE (ii) == IMAGE_WIDGET - || - IMAGE_INSTANCE_TYPE (ii) == IMAGE_LAYOUT) + ERROR_CHECK_IMAGE_INSTANCE (subwindow); + + if (WIDGET_IMAGE_INSTANCEP (subwindow)) { if (image_instance_changed (subwindow)) update_widget (subwindow); @@ -4369,9 +4385,10 @@ } else if (IMAGE_INSTANCE_TYPE (ii) == IMAGE_SUBWINDOW && - !NILP (IMAGE_INSTANCE_SUBWINDOW_FRAME (ii))) + !NILP (IMAGE_INSTANCE_FRAME (ii))) { - MAYBE_DEVMETH (XDEVICE (ii->device), update_subwindow, (ii)); + MAYBE_DEVMETH (DOMAIN_XDEVICE (ii->domain), + update_subwindow, (ii)); } IMAGE_INSTANCE_SIZE_CHANGED (ii) = 0; @@ -4398,72 +4415,77 @@ if (internal_hash (subwindow, IMAGE_INSTANCE_HASH_DEPTH) != IMAGE_INSTANCE_DISPLAY_HASH (ii)) return 1; - else if ((WIDGET_IMAGE_INSTANCEP (subwindow) - || LAYOUT_IMAGE_INSTANCEP (subwindow)) - && !internal_equal (IMAGE_INSTANCE_WIDGET_ITEMS (ii), - IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (ii), 0)) + /* #### I think there is probably a bug here. This gets called for + layouts - and yet the pending items are always nil for + layouts. We are saved by layout optimization, but I'm undecided + as to what the correct fix is. */ + else if (WIDGET_IMAGE_INSTANCEP (subwindow) + && (!internal_equal (IMAGE_INSTANCE_WIDGET_ITEMS (ii), + IMAGE_INSTANCE_WIDGET_PENDING_ITEMS (ii), 0) + || !NILP (IMAGE_INSTANCE_LAYOUT_CHILDREN (ii)))) return 1; else return 0; } /* Update all the subwindows on a frame. */ -DEFUN ("update-widget-instances", Fupdate_widget_instances,1, 1, 0, /* -Given a FRAME, re-evaluate the display hash code for all widgets in the frame. -Don't use this. -*/ - (frame)) +void +update_widget_instances (Lisp_Object frame) { - int elt; struct frame* f; + Lisp_Object rest; + + /* Its possible for the preceeding callback to have deleted the + frame, so cope with this. */ + if (!FRAMEP (frame) || !FRAME_LIVE_P (XFRAME (frame))) + return; + CHECK_FRAME (frame); f = XFRAME (frame); - + /* If we get called we know something has changed. */ - for (elt = 0; elt < Dynarr_length (f->subwindow_cachels); elt++) - { - struct subwindow_cachel *cachel = - Dynarr_atp (f->subwindow_cachels, elt); - - if (cachel->being_displayed && - image_instance_changed (cachel->subwindow)) - { - set_image_instance_dirty_p (cachel->subwindow, 1); - MARK_FRAME_GLYPHS_CHANGED (f); - } - } - return Qnil; + LIST_LOOP (rest, XWEAK_LIST_LIST (FRAME_SUBWINDOW_CACHE (f))) + { + Lisp_Object widget = XCAR (rest); + + if (XIMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP (widget) + && + image_instance_changed (widget)) + { + set_image_instance_dirty_p (widget, 1); + MARK_FRAME_GLYPHS_CHANGED (f); + } + } } /* remove a subwindow from its frame */ void unmap_subwindow (Lisp_Object subwindow) { Lisp_Image_Instance* ii = XIMAGE_INSTANCE (subwindow); - int elt; - struct subwindow_cachel* cachel; struct frame* f; + + ERROR_CHECK_IMAGE_INSTANCE (subwindow); - if (!(IMAGE_INSTANCE_TYPE (ii) == IMAGE_WIDGET - || - IMAGE_INSTANCE_TYPE (ii) == IMAGE_SUBWINDOW) + if (!image_instance_type_to_mask (IMAGE_INSTANCE_TYPE (ii)) + & (IMAGE_WIDGET_MASK | IMAGE_SUBWINDOW_MASK) || - NILP (IMAGE_INSTANCE_SUBWINDOW_FRAME (ii))) + !IMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP (ii)) return; + #ifdef DEBUG_WIDGETS stderr_out ("unmapping subwindow %d\n", IMAGE_INSTANCE_SUBWINDOW_ID (ii)); #endif - f = XFRAME (IMAGE_INSTANCE_SUBWINDOW_FRAME (ii)); - elt = get_subwindow_cachel_index (f, subwindow); - cachel = Dynarr_atp (f->subwindow_cachels, elt); + f = XFRAME (IMAGE_INSTANCE_FRAME (ii)); /* make sure we don't get expose events */ - register_ignored_expose (f, cachel->x, cachel->y, cachel->width, cachel->height); - cachel->x = ~0; - cachel->y = ~0; - cachel->being_displayed = 0; + register_ignored_expose (f, IMAGE_INSTANCE_DISPLAY_X (ii), + IMAGE_INSTANCE_DISPLAY_Y (ii), + IMAGE_INSTANCE_DISPLAY_WIDTH (ii), + IMAGE_INSTANCE_DISPLAY_HEIGHT (ii)); IMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP (ii) = 0; - MAYBE_DEVMETH (XDEVICE (ii->device), unmap_subwindow, (ii)); + MAYBE_DEVMETH (XDEVICE (IMAGE_INSTANCE_DEVICE (ii)), + unmap_subwindow, (ii)); } /* show a subwindow in its frame */ @@ -4471,15 +4493,12 @@ struct display_glyph_area *dga) { Lisp_Image_Instance* ii = XIMAGE_INSTANCE (subwindow); - int elt; - struct subwindow_cachel* cachel; struct frame* f; - if (!(IMAGE_INSTANCE_TYPE (ii) == IMAGE_WIDGET - || - IMAGE_INSTANCE_TYPE (ii) == IMAGE_SUBWINDOW) - || - NILP (IMAGE_INSTANCE_SUBWINDOW_FRAME (ii))) + ERROR_CHECK_IMAGE_INSTANCE (subwindow); + + if (!image_instance_type_to_mask (IMAGE_INSTANCE_TYPE (ii)) + & (IMAGE_WIDGET_MASK | IMAGE_SUBWINDOW_MASK)) return; #ifdef DEBUG_WIDGETS @@ -4487,17 +4506,15 @@ IMAGE_INSTANCE_SUBWINDOW_ID (ii), dga->width, dga->height, x, y); #endif - f = XFRAME (IMAGE_INSTANCE_SUBWINDOW_FRAME (ii)); + f = XFRAME (IMAGE_INSTANCE_FRAME (ii)); IMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP (ii) = 1; - elt = get_subwindow_cachel_index (f, subwindow); - cachel = Dynarr_atp (f->subwindow_cachels, elt); - cachel->x = x; - cachel->y = y; - cachel->width = dga->width; - cachel->height = dga->height; - cachel->being_displayed = 1; + IMAGE_INSTANCE_DISPLAY_X (ii) = x; + IMAGE_INSTANCE_DISPLAY_Y (ii) = y; + IMAGE_INSTANCE_DISPLAY_WIDTH (ii) = dga->width; + IMAGE_INSTANCE_DISPLAY_HEIGHT (ii) = dga->height; - MAYBE_DEVMETH (XDEVICE (ii->device), map_subwindow, (ii, x, y, dga)); + MAYBE_DEVMETH (DOMAIN_XDEVICE (ii->domain), + map_subwindow, (ii, x, y, dga)); } static int @@ -4506,6 +4523,12 @@ return IMAGE_SUBWINDOW_MASK; } +Lisp_Object +subwindow_decode_domain (Lisp_Object instantiator, Lisp_Object domain) +{ + return DOMAIN_WINDOW (domain); +} + /* Partially instantiate a subwindow. */ void subwindow_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, @@ -4513,8 +4536,8 @@ int dest_mask, Lisp_Object domain) { Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance); - Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii); - Lisp_Object frame = FW_FRAME (domain); + Lisp_Object device = image_instance_device (image_instance); + Lisp_Object frame = DOMAIN_FRAME (domain); Lisp_Object width = find_keyword_in_vector (instantiator, Q_pixel_width); Lisp_Object height = find_keyword_in_vector (instantiator, Q_pixel_height); @@ -4527,31 +4550,35 @@ ii->data = 0; IMAGE_INSTANCE_SUBWINDOW_ID (ii) = 0; IMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP (ii) = 0; - IMAGE_INSTANCE_SUBWINDOW_FRAME (ii) = frame; - /* #### This stuff may get overidden by the widget code and is - actually really dumb now that we have dynamic geometry - calculations. What should really happen is that the subwindow - should query its child for an appropriate geometry. */ if (INTP (width)) { int w = 1; if (XINT (width) > 1) w = XINT (width); - IMAGE_INSTANCE_SUBWINDOW_WIDTH (ii) = w; + IMAGE_INSTANCE_WIDTH (ii) = w; + IMAGE_INSTANCE_SUBWINDOW_H_RESIZEP (ii) = 0; } - else - IMAGE_INSTANCE_SUBWINDOW_WIDTH (ii) = 20; if (INTP (height)) { int h = 1; if (XINT (height) > 1) h = XINT (height); - IMAGE_INSTANCE_SUBWINDOW_HEIGHT (ii) = h; + IMAGE_INSTANCE_HEIGHT (ii) = h; + IMAGE_INSTANCE_SUBWINDOW_V_RESIZEP (ii) = 0; } - else - IMAGE_INSTANCE_SUBWINDOW_HEIGHT (ii) = 20; +} + +/* This is just a backup in case no-one has assigned a suitable geometry. + #### It should really query the enclose window for geometry. */ +static void +subwindow_query_geometry (Lisp_Object image_instance, unsigned int* width, + unsigned int* height, enum image_instance_geometry disp, + Lisp_Object domain) +{ + if (width) *width = 20; + if (height) *height = 20; } DEFUN ("subwindowp", Fsubwindowp, 1, 1, 0, /* @@ -4600,9 +4627,6 @@ IMAGE_INSTANCE_WIDTH (ii) = neww; IMAGE_INSTANCE_SIZE_CHANGED (ii) = 1; - /* need to update the cachels as redisplay will not do this */ - update_subwindow_cachel (subwindow); - return subwindow; } @@ -4736,7 +4760,7 @@ /* We might need to kick redisplay at this point - but we also might not. */ MARK_DEVICE_FRAMES_GLYPHS_CHANGED - (XDEVICE (IMAGE_INSTANCE_DEVICE (ii))); + (XDEVICE (image_instance_device (value))); /* Cascade dirtiness so that we can have an animated glyph in a layout for instance. */ set_image_instance_dirty_p (value, 1); @@ -4793,7 +4817,6 @@ DEFSUBR (Fvalid_image_instantiator_format_p); DEFSUBR (Fset_console_type_image_conversion_list); DEFSUBR (Fconsole_type_image_conversion_list); - DEFSUBR (Fupdate_widget_instances); defkeyword (&Q_file, ":file"); defkeyword (&Q_data, ":data"); @@ -4829,7 +4852,6 @@ defsymbol (&Qwidget_image_instance_p, "widget-image-instance-p"); defsymbol (&Qsubwindow_image_instance_p, "subwindow-image-instance-p"); defsymbol (&Qlayout_image_instance_p, "layout-image-instance-p"); - defsymbol (&Qupdate_widget_instances, "update-widget-instances"); DEFSUBR (Fmake_image_instance); DEFSUBR (Fimage_instance_p); @@ -5015,6 +5037,7 @@ INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (string, "string"); IIFORMAT_HAS_METHOD (string, validate); + IIFORMAT_HAS_SHARED_METHOD (string, decode_domain, subwindow); IIFORMAT_HAS_METHOD (string, possible_dest_types); IIFORMAT_HAS_METHOD (string, instantiate); @@ -5034,7 +5057,9 @@ /* subwindows */ INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (subwindow, "subwindow"); IIFORMAT_HAS_METHOD (subwindow, possible_dest_types); + IIFORMAT_HAS_METHOD (subwindow, decode_domain); IIFORMAT_HAS_METHOD (subwindow, instantiate); + IIFORMAT_HAS_METHOD (subwindow, query_geometry); IIFORMAT_VALID_KEYWORD (subwindow, Q_pixel_width, check_valid_int); IIFORMAT_VALID_KEYWORD (subwindow, Q_pixel_height, check_valid_int); Index: src/glyphs.h =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/glyphs.h,v retrieving revision 1.18.2.45 diff -u -r1.18.2.45 glyphs.h --- src/glyphs.h 2000/04/14 16:15:40 1.18.2.45 +++ src/glyphs.h 2000/05/03 14:39:50 @@ -120,6 +120,11 @@ Lisp_Object (*normalize_method) (Lisp_Object instantiator, Lisp_Object console_type); + /* Decode domain method: Given an instantiator and a domain, return + a domain appropriate for the instance to be cached in. */ + Lisp_Object (*decode_domain_method) (Lisp_Object instantiator, + Lisp_Object domain); + /* Possible-dest-types method: Return a mask indicating what dest types are compatible with this format. */ int (*possible_dest_types_method) (void); @@ -134,6 +139,11 @@ Lisp_Object pointer_bg, int dest_mask, Lisp_Object domain); + /* Post instantiate method: finish instantiation of the image + instance. */ + void (*post_instantiate_method) (Lisp_Object image_instance, + Lisp_Object instantiator, + Lisp_Object domain); /* Property method: Given an image instance, return device specific properties. */ Lisp_Object (*property_method) (Lisp_Object image_instance, @@ -155,10 +165,10 @@ Lisp_Object domain); /* Layout the instance and its children bounded by the provided - dimensions. */ - void (*layout_method) (Lisp_Object image_instance, - unsigned int width, unsigned int height, - Lisp_Object domain); + dimensions. Returns success or failure. */ + int (*layout_method) (Lisp_Object image_instance, + unsigned int width, unsigned int height, + Lisp_Object domain); }; /***** Calling an image-instantiator method *****/ @@ -187,7 +197,7 @@ the specified value */ #define IIFORMAT_METH_OR_GIVEN(mstruc, m, args, given) \ - (HAS_IIFORMAT_METH_P (mstruc, m) ? \ + ((mstruc && HAS_IIFORMAT_METH_P (mstruc, m)) ? \ IIFORMAT_METH (mstruc, m, args) : (given)) /***** Defining new image-instantiator types *****/ @@ -336,6 +346,8 @@ void subwindow_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, Lisp_Object pointer_fg, Lisp_Object pointer_bg, int dest_mask, Lisp_Object domain); +Lisp_Object subwindow_decode_domain (Lisp_Object instantiator, + Lisp_Object domain); void widget_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, Lisp_Object pointer_fg, Lisp_Object pointer_bg, int dest_mask, Lisp_Object domain); @@ -346,6 +358,9 @@ void image_instance_layout (Lisp_Object image_instance, unsigned int width, unsigned int height, Lisp_Object domain); +int layout_layout (Lisp_Object image_instance, + unsigned int width, unsigned int height, + Lisp_Object domain); int invalidate_glyph_geometry_maybe (Lisp_Object glyph_or_ii, struct window* w); DECLARE_DOESNT_RETURN (incompatible_image_types (Lisp_Object instantiator, @@ -395,6 +410,18 @@ #define CHECK_IMAGE_INSTANCE(x) CHECK_RECORD (x, image_instance) #define CONCHECK_IMAGE_INSTANCE(x) CONCHECK_RECORD (x, image_instance) +#ifdef ERROR_CHECK_GLYPHS +void check_image_instance_structure (Lisp_Object instance); +void check_window_subwindow_cache (struct window* w); +#define ERROR_CHECK_IMAGE_INSTANCE(ii) \ + check_image_instance_structure (ii) +#define ERROR_CHECK_SUBWINDOW_CACHE(w) \ + check_window_subwindow_cache (w) +#else +#define ERROR_CHECK_IMAGE_INSTANCE(ii) +#define ERROR_CHECK_SUBWINDOW_CACHE(w) +#endif + enum image_instance_type { IMAGE_UNKNOWN, @@ -404,8 +431,7 @@ IMAGE_COLOR_PIXMAP, IMAGE_POINTER, IMAGE_SUBWINDOW, - IMAGE_WIDGET, - IMAGE_LAYOUT + IMAGE_WIDGET }; #define IMAGE_NOTHING_MASK (1 << 0) @@ -415,7 +441,13 @@ #define IMAGE_POINTER_MASK (1 << 4) #define IMAGE_SUBWINDOW_MASK (1 << 5) #define IMAGE_WIDGET_MASK (1 << 6) -#define IMAGE_LAYOUT_MASK (1 << 7) + +/* This depends on the fact that enums are assigned consecutive + integers starting at 0. (Remember that IMAGE_UNKNOWN is the + first enum.) I'm fairly sure this behavior is ANSI-mandated, + so there should be no portability problems here. */ +#define image_instance_type_to_mask(type) \ + ((int) (1 << ((int) (type) - 1))) #define IMAGE_INSTANCE_TYPE_P(ii, type) \ (IMAGE_INSTANCEP (ii) && XIMAGE_INSTANCE_TYPE (ii) == type) @@ -434,8 +466,6 @@ IMAGE_INSTANCE_TYPE_P (ii, IMAGE_SUBWINDOW) #define WIDGET_IMAGE_INSTANCEP(ii) \ IMAGE_INSTANCE_TYPE_P (ii, IMAGE_WIDGET) -#define LAYOUT_IMAGE_INSTANCEP(ii) \ - IMAGE_INSTANCE_TYPE_P (ii, IMAGE_LAYOUT) #define CHECK_NOTHING_IMAGE_INSTANCE(x) do { \ CHECK_IMAGE_INSTANCE (x); \ @@ -480,23 +510,20 @@ x = wrong_type_argument (Qwidget_image_instance_p, (x)); \ } while (0) -#define CHECK_LAYOUT_IMAGE_INSTANCE(x) do { \ - CHECK_IMAGE_INSTANCE (x); \ - if (!LAYOUT_IMAGE_INSTANCEP (x)) \ - x = wrong_type_argument (Qlayout_image_instance_p, (x)); \ -} while (0) - struct Lisp_Image_Instance { struct lcrecord_header header; - Lisp_Object device; + Lisp_Object domain; /* The domain in which we were cached. */ + Lisp_Object device; /* The device of the domain. Recorded + since the domain may get deleted + before us. */ Lisp_Object name; /* The glyph from which we were instantiated. This is a weak reference. */ Lisp_Object parent; enum image_instance_type type; unsigned int x_offset, y_offset; /* for layout purposes */ - unsigned int width, height; + unsigned int width, height, margin_width; unsigned long display_hash; /* Hash value representing the structure of the image_instance when it was last displayed. */ @@ -505,6 +532,7 @@ unsigned int text_changed : 1; unsigned int layout_changed : 1; unsigned int optimize_output : 1; /* For outputting layouts. */ + unsigned int initialized : 1; /* When we're fully done. */ union { @@ -529,22 +557,29 @@ } pixmap; /* used for pointers as well */ struct { - Lisp_Object frame; void* subwindow; /* specific devices can use this as necessary */ - unsigned int being_displayed : 1; /* used to detect when needs to be unmapped */ + struct + { /* We need these so we can do without + subwindow_cachel */ + unsigned int x, y; + unsigned int width, height; + } display_data; + unsigned int being_displayed : 1; /* used to detect when needs + to be unmapped */ unsigned int v_resize : 1; /* Whether the vsize is allowed to change. */ unsigned int h_resize : 1; /* Whether the hsize is allowed to change. */ unsigned int orientation : 1; /* Vertical or horizontal. */ unsigned int justification : 2; /* Left, right or center. */ - /* Face for colors and font. We specify this here becuase we + /* Face for colors and font. We specify this here because we want people to be able to put :face in the instantiator spec. Using gyph-face is more inconvenient, although more general. */ Lisp_Object face; Lisp_Object type; Lisp_Object props; /* properties or border*/ - Lisp_Object items; /* a list of gui_items or children */ + Lisp_Object items; /* a list of displayed gui_items */ Lisp_Object pending_items; /* gui_items that should be displayed */ + Lisp_Object children; /* a list of children */ Lisp_Object width; /* dynamic width spec. */ Lisp_Object height; /* dynamic height spec. */ /* Change flags to augment dirty. */ @@ -568,7 +603,10 @@ #define IMAGE_INSTANCE_HASH_DEPTH 0 /* Accessor macros. */ +#define IMAGE_INSTANCE_DOMAIN(i) ((i)->domain) +#define IMAGE_INSTANCE_DOMAIN_LIVE_P(i) (DOMAIN_LIVE_P ((i)->domain)) #define IMAGE_INSTANCE_DEVICE(i) ((i)->device) +#define IMAGE_INSTANCE_FRAME(i) (DOMAIN_FRAME ((i)->domain)) #define IMAGE_INSTANCE_NAME(i) ((i)->name) #define IMAGE_INSTANCE_PARENT(i) ((i)->parent) #define IMAGE_INSTANCE_GLYPH(i) (image_instance_parent_glyph(i)) @@ -576,14 +614,18 @@ #define IMAGE_INSTANCE_XOFFSET(i) ((i)->x_offset) #define IMAGE_INSTANCE_YOFFSET(i) ((i)->y_offset) #define IMAGE_INSTANCE_WIDTH(i) ((i)->width) +#define IMAGE_INSTANCE_MARGIN_WIDTH(i) ((i)->margin_width) #define IMAGE_INSTANCE_HEIGHT(i) ((i)->height) +#define IMAGE_INSTANCE_INITIALIZED(i) ((i)->initialized) #define IMAGE_INSTANCE_DISPLAY_HASH(i) ((i)->display_hash) #define IMAGE_INSTANCE_PIXMAP_TYPE_P(i) \ ((IMAGE_INSTANCE_TYPE (i) == IMAGE_MONO_PIXMAP) \ || (IMAGE_INSTANCE_TYPE (i) == IMAGE_COLOR_PIXMAP)) #define IMAGE_INSTANCE_DIRTYP(i) ((i)->dirty) #define IMAGE_INSTANCE_NEEDS_LAYOUT(i) \ - (IMAGE_INSTANCE_DIRTYP (i) && IMAGE_INSTANCE_LAYOUT_CHANGED (i)) + ((IMAGE_INSTANCE_DIRTYP (i) && IMAGE_INSTANCE_LAYOUT_CHANGED (i)) \ + || (FRAMEP (IMAGE_INSTANCE_FRAME (i)) \ + && XFRAME (IMAGE_INSTANCE_FRAME (i))->size_changed)) #define IMAGE_INSTANCE_FACE(i) \ (GLYPHP (IMAGE_INSTANCE_GLYPH (i)) ? \ XGLYPH_FACE (IMAGE_INSTANCE_GLYPH (i)) : Qnil) @@ -627,12 +669,14 @@ #define IMAGE_INSTANCE_PIXMAP_TIMEOUT(i) ((i)->u.pixmap.timeout) /* Subwindow properties */ -#define IMAGE_INSTANCE_SUBWINDOW_WIDTH(i) \ - IMAGE_INSTANCE_WIDTH(i) -#define IMAGE_INSTANCE_SUBWINDOW_HEIGHT(i) \ - IMAGE_INSTANCE_HEIGHT(i) #define IMAGE_INSTANCE_SUBWINDOW_ID(i) ((i)->u.subwindow.subwindow) -#define IMAGE_INSTANCE_SUBWINDOW_FRAME(i) ((i)->u.subwindow.frame) +/* Display data. */ +#define IMAGE_INSTANCE_DISPLAY_X(i) ((i)->u.subwindow.display_data.x) +#define IMAGE_INSTANCE_DISPLAY_Y(i) ((i)->u.subwindow.display_data.y) +#define IMAGE_INSTANCE_DISPLAY_WIDTH(i) \ + ((i)->u.subwindow.display_data.width) +#define IMAGE_INSTANCE_DISPLAY_HEIGHT(i) \ + ((i)->u.subwindow.display_data.height) #define IMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP(i) \ ((i)->u.subwindow.being_displayed) #define IMAGE_INSTANCE_SUBWINDOW_V_RESIZEP(i) \ @@ -669,11 +713,17 @@ #define IMAGE_INSTANCE_WIDGET_TEXT(i) XGUI_ITEM (IMAGE_INSTANCE_WIDGET_ITEM (i))->name /* Layout properties */ -#define IMAGE_INSTANCE_LAYOUT_CHILDREN(i) ((i)->u.subwindow.items) +#define IMAGE_INSTANCE_LAYOUT_CHILDREN(i) ((i)->u.subwindow.children) #define IMAGE_INSTANCE_LAYOUT_BORDER(i) ((i)->u.subwindow.props) +#define XIMAGE_INSTANCE_DOMAIN(i) \ + IMAGE_INSTANCE_DOMAIN (XIMAGE_INSTANCE (i)) +#define XIMAGE_INSTANCE_DOMAIN_LIVE_P(i) \ + IMAGE_INSTANCE_DOMAIN_LIVE_P (XIMAGE_INSTANCE (i)) #define XIMAGE_INSTANCE_DEVICE(i) \ IMAGE_INSTANCE_DEVICE (XIMAGE_INSTANCE (i)) +#define XIMAGE_INSTANCE_FRAME(i) \ + IMAGE_INSTANCE_FRAME (XIMAGE_INSTANCE (i)) #define XIMAGE_INSTANCE_NAME(i) \ IMAGE_INSTANCE_NAME (XIMAGE_INSTANCE (i)) #define XIMAGE_INSTANCE_GLYPH(i) \ @@ -694,8 +744,12 @@ IMAGE_INSTANCE_NEEDS_LAYOUT (XIMAGE_INSTANCE (i)) #define XIMAGE_INSTANCE_WIDTH(i) \ IMAGE_INSTANCE_WIDTH (XIMAGE_INSTANCE (i)) +#define XIMAGE_INSTANCE_MARGIN_WIDTH(i) \ + IMAGE_INSTANCE_MARGIN_WIDTH (XIMAGE_INSTANCE (i)) #define XIMAGE_INSTANCE_HEIGHT(i) \ IMAGE_INSTANCE_HEIGHT (XIMAGE_INSTANCE (i)) +#define XIMAGE_INSTANCE_INITIALIZED(i) \ + IMAGE_INSTANCE_INITIALIZED (XIMAGE_INSTANCE (i)) #define XIMAGE_INSTANCE_FACE(i) \ IMAGE_INSTANCE_FACE (XIMAGE_INSTANCE (i)) @@ -767,14 +821,16 @@ #define XIMAGE_INSTANCE_LAYOUT_BORDER(i) \ IMAGE_INSTANCE_LAYOUT_BORDER (XIMAGE_INSTANCE (i)) -#define XIMAGE_INSTANCE_SUBWINDOW_WIDTH(i) \ - IMAGE_INSTANCE_SUBWINDOW_WIDTH (XIMAGE_INSTANCE (i)) -#define XIMAGE_INSTANCE_SUBWINDOW_HEIGHT(i) \ - IMAGE_INSTANCE_SUBWINDOW_HEIGHT (XIMAGE_INSTANCE (i)) #define XIMAGE_INSTANCE_SUBWINDOW_ID(i) \ IMAGE_INSTANCE_SUBWINDOW_ID (XIMAGE_INSTANCE (i)) -#define XIMAGE_INSTANCE_SUBWINDOW_FRAME(i) \ - IMAGE_INSTANCE_SUBWINDOW_FRAME (XIMAGE_INSTANCE (i)) +#define XIMAGE_INSTANCE_DISPLAY_X(i) \ + IMAGE_INSTANCE_DISPLAY_X (XIMAGE_INSTANCE (i)) +#define XIMAGE_INSTANCE_DISPLAY_Y(i) \ + IMAGE_INSTANCE_DISPLAY_Y (XIMAGE_INSTANCE (i)) +#define XIMAGE_INSTANCE_DISPLAY_WIDTH(i) \ + IMAGE_INSTANCE_DISPLAY_WIDTH (XIMAGE_INSTANCE (i)) +#define XIMAGE_INSTANCE_DISPLAY_HEIGHT(i) \ + IMAGE_INSTANCE_DISPLAY_HEIGHT (XIMAGE_INSTANCE (i)) #define XIMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP(i) \ IMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP (XIMAGE_INSTANCE (i)) #define XIMAGE_INSTANCE_SUBWINDOW_ORIENT(i) \ @@ -785,6 +841,11 @@ #define MARK_IMAGE_INSTANCE_CHANGED(i) \ (IMAGE_INSTANCE_DIRTYP (i) = 1); +Lisp_Object image_instance_device (Lisp_Object instance); +Lisp_Object image_instance_frame (Lisp_Object instance); +Lisp_Object image_instance_window (Lisp_Object instance); +int image_instance_live_p (Lisp_Object instance); + #ifdef HAVE_XPM Lisp_Object evaluate_xpm_color_symbols (void); Lisp_Object pixmap_to_lisp_data (Lisp_Object name, int ok_if_data_invalid); @@ -883,8 +944,7 @@ extern Lisp_Object Q_foreground, Q_background, Q_face, Q_descriptor, Q_group; extern Lisp_Object Q_width, Q_height, Q_pixel_width, Q_pixel_height, Q_text; extern Lisp_Object Q_items, Q_properties, Q_image, Qimage_conversion_error; -extern Lisp_Object Q_orientation, Qupdate_widget_instances; -extern Lisp_Object Qwidget_callback_current_channel; +extern Lisp_Object Q_orientation, Q_margin_width; extern Lisp_Object Vcontinuation_glyph, Vcontrol_arrow_glyph, Vhscroll_glyph; extern Lisp_Object Vinvisible_text_glyph, Voctal_escape_glyph, Vtruncation_glyph; extern Lisp_Object Vxemacs_logo; @@ -985,34 +1045,16 @@ * Subwindow Object * ****************************************************************************/ -/* redisplay needs a per-frame cache of subwindows being displayed so - * that we known when to unmap them */ -typedef struct subwindow_cachel subwindow_cachel; -struct subwindow_cachel -{ - Lisp_Object subwindow; - unsigned int x, y; - unsigned int width, height; - unsigned int being_displayed : 1; - unsigned int updated : 1; -}; - -typedef struct -{ - Dynarr_declare (subwindow_cachel); -} subwindow_cachel_dynarr; - -void mark_subwindow_cachels (subwindow_cachel_dynarr *elements); -void mark_subwindow_cachels_as_not_updated (struct frame *f); -void reset_subwindow_cachels (struct frame *f); void unmap_subwindow (Lisp_Object subwindow); void map_subwindow (Lisp_Object subwindow, int x, int y, struct display_glyph_area *dga); int find_matching_subwindow (struct frame* f, int x, int y, int width, int height); void update_widget (Lisp_Object widget); +void update_widget_instances (Lisp_Object frame); void update_subwindow (Lisp_Object subwindow); Lisp_Object image_instance_parent_glyph (struct Lisp_Image_Instance*); int image_instance_changed (Lisp_Object image); +void free_frame_subwindow_instance_cache (struct frame* f); struct expose_ignore { Index: src/gui-msw.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/Attic/gui-msw.c,v retrieving revision 1.1.2.11 diff -u -r1.1.2.11 gui-msw.c --- src/gui-msw.c 2000/04/28 15:17:22 1.1.2.11 +++ src/gui-msw.c 2000/05/03 14:39:50 @@ -22,13 +22,13 @@ #include #include "lisp.h" +#include "console-msw.h" #include "redisplay.h" #include "gui.h" #include "glyphs.h" #include "frame.h" -#include "events.h" #include "elhash.h" -#include "console-msw.h" +#include "events.h" #include "buffer.h" /* @@ -84,15 +84,8 @@ mswindows_enqueue_dispatch_event (event); /* The result of this evaluation could cause other instances to change so - enqueue an update callback to check this. We also have to make sure that - the function does not appear in the command history. - #### I'm sure someone can tell me how to optimize this. */ - mswindows_enqueue_misc_user_event - (frame, Qeval, - list3 (Qlet, - list2 (Qthis_command, - Qlast_command), - list2 (Qupdate_widget_instances, frame))); + enqueue an update callback to check this. */ + enqueue_magic_eval_event (update_widget_instances, frame); return Qt; } Index: src/gui-x.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/gui-x.c,v retrieving revision 1.14.2.25 diff -u -r1.14.2.25 gui-x.c --- src/gui-x.c 2000/04/29 00:04:48 1.14.2.25 +++ src/gui-x.c 2000/05/03 14:39:50 @@ -229,10 +229,6 @@ VOID_TO_LISP (data, client_data); XSETFRAME (frame, f); - image_instance = XCAR (data); - callback = XCAR (XCDR (data)); - callback_ex = XCDR (XCDR (data)); - #if 0 /* #### What the hell? I can't understand why this call is here, and doing it is really courting disaster in the new event @@ -255,6 +251,9 @@ } else { + image_instance = XCAR (data); + callback = XCAR (XCDR (data)); + callback_ex = XCDR (XCDR (data)); update_subwindows_p = 1; if (!NILP (callback_ex) && !UNBOUNDP (callback_ex)) @@ -294,16 +293,9 @@ if (!NILP (event)) enqueue_Xt_dispatch_event (event); /* The result of this evaluation could cause other instances to change so - enqueue an update callback to check this. We also have to make sure that - the function does not appear in the command history. - #### I'm sure someone can tell me how to optimize this. */ + enqueue an update callback to check this. */ if (update_subwindows_p && !NILP (event)) - signal_special_Xt_user_event (frame, Qeval, - list3 (Qlet, - list2 (Qthis_command, - Qlast_command), - list2 (Qupdate_widget_instances, - frame))); + enqueue_magic_eval_event (update_widget_instances, frame); } #if 1 Index: src/gui.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/gui.c,v retrieving revision 1.10.2.28 diff -u -r1.10.2.28 gui.c --- src/gui.c 2000/04/28 15:17:22 1.10.2.28 +++ src/gui.c 2000/05/03 14:39:50 @@ -81,10 +81,10 @@ Vquit_flag = Qt; } else if (SYMBOLP (data) - || (COMPILED_FUNCTIONP (data) - && XCOMPILED_FUNCTION (data)->flags.interactivep) - || (CONSP (data) && (EQ (XCAR (data), Qlambda)) - && !NILP (Fassq (Qinteractive, Fcdr (Fcdr (data)))))) + || (COMPILED_FUNCTIONP (data) + && XCOMPILED_FUNCTION (data)->flags.interactivep) + || (CONSP (data) && (EQ (XCAR (data), Qlambda)) + && !NILP (Fassq (Qinteractive, Fcdr (Fcdr (data)))))) { *fn = Qcall_interactively; *arg = data; Index: src/lisp.h =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/lisp.h,v retrieving revision 1.38.2.59 diff -u -r1.38.2.59 lisp.h --- src/lisp.h 2000/04/29 00:04:48 1.38.2.59 +++ src/lisp.h 2000/05/03 14:39:52 @@ -2830,7 +2830,7 @@ extern Lisp_Object Qmax, Qmemory, Qmessage, Qminus, Qmnemonic, Qmodifiers; extern Lisp_Object Qmono_pixmap_image_instance_p, Qmotion; extern Lisp_Object Qmouse_leave_buffer_hook, Qmsprinter, Qmswindows; -extern Lisp_Object Qname, Qnas, Qnatnump; +extern Lisp_Object Qname, Qnas, Qnatnump, Qnative_layout; extern Lisp_Object Qno_ascii_cntl, Qno_ascii_eol, Qno_catch; extern Lisp_Object Qno_conversion, Qno_iso6429, Qnone, Qnot, Qnothing; extern Lisp_Object Qnothing_image_instance_p, Qnotice; Index: src/nt.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/nt.c,v retrieving revision 1.17.2.15 diff -u -r1.17.2.15 nt.c --- src/nt.c 2000/03/12 23:10:42 1.17.2.15 +++ src/nt.c 2000/05/03 14:39:52 @@ -47,8 +47,8 @@ #include #include -#include -#include +#include "syswindows.h" +#include "sysmmsystem.h" #include "nt.h" #include Index: src/ntplay.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/ntplay.c,v retrieving revision 1.4.2.5 diff -u -r1.4.2.5 ntplay.c --- src/ntplay.c 2000/04/02 11:56:34 1.4.2.5 +++ src/ntplay.c 2000/05/03 14:39:52 @@ -18,19 +18,13 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.*/ -#include #include #include #include "sysfile.h" +#include "syswindows.h" #include "lisp.h" #include "nativesound.h" -#if (defined (__CYGWIN32__) || defined(__MINGW32__)) && \ - CYGWIN_VERSION_DLL_MAJOR < 21 -extern BOOL WINAPI PlaySound(LPCSTR,HMODULE,DWORD); -#else -#include -#endif static int play_sound_data_1 (unsigned char *data, int length, int volume, int convert); Index: src/objects-msw.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/objects-msw.c,v retrieving revision 1.19.2.15 diff -u -r1.19.2.15 objects-msw.c --- src/objects-msw.c 2000/02/21 04:33:52 1.19.2.15 +++ src/objects-msw.c 2000/05/03 14:39:53 @@ -49,13 +49,6 @@ #include "device.h" #include "insdel.h" -#if (defined(__CYGWIN32__) || defined(__MINGW32__)) && \ - CYGWIN_VERSION_DLL_MAJOR < 21 -#define stricmp strcasecmp -#define FONTENUMPROC FONTENUMEXPROC -#define ntmTm ntmentm -#endif - typedef struct colormap_t { const char *name; Index: src/objects.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/objects.c,v retrieving revision 1.5.2.11 diff -u -r1.5.2.11 objects.c --- src/objects.c 2000/02/21 23:06:58 1.5.2.11 +++ src/objects.c 2000/05/03 14:39:54 @@ -507,7 +507,7 @@ { /* When called, we're inside of call_with_suspended_errors(), so we can freely error. */ - Lisp_Object device = DFW_DEVICE (domain); + Lisp_Object device = DOMAIN_DEVICE (domain); struct device *d = XDEVICE (device); if (COLOR_INSTANCEP (instantiator)) @@ -706,7 +706,7 @@ { /* When called, we're inside of call_with_suspended_errors(), so we can freely error. */ - Lisp_Object device = DFW_DEVICE (domain); + Lisp_Object device = DOMAIN_DEVICE (domain); struct device *d = XDEVICE (device); Lisp_Object instance; Index: src/redisplay-msw.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/redisplay-msw.c,v retrieving revision 1.28.2.24 diff -u -r1.28.2.24 redisplay-msw.c --- src/redisplay-msw.c 2000/04/13 02:37:09 1.28.2.24 +++ src/redisplay-msw.c 2000/05/03 14:39:54 @@ -1157,20 +1157,22 @@ findex, 0, 1); break; - case IMAGE_SUBWINDOW: case IMAGE_WIDGET: + if (EQ (XIMAGE_INSTANCE_WIDGET_TYPE (instance), + Qlayout)) + { + redisplay_output_layout (w, instance, &dbox, &dga, findex, + cursor_start, cursor_width, + cursor_height); + if (rb->cursor_type == CURSOR_ON) + mswindows_output_cursor (w, dl, xpos, cursor_width, + findex, 0, 1); + break; + } + case IMAGE_SUBWINDOW: redisplay_output_subwindow (w, instance, &dbox, &dga, findex, cursor_start, cursor_width, cursor_height); - if (rb->cursor_type == CURSOR_ON) - mswindows_output_cursor (w, dl, xpos, cursor_width, - findex, 0, 1); - break; - - case IMAGE_LAYOUT: - redisplay_output_layout (w, instance, &dbox, &dga, findex, - cursor_start, cursor_width, - cursor_height); if (rb->cursor_type == CURSOR_ON) mswindows_output_cursor (w, dl, xpos, cursor_width, findex, 0, 1); Index: src/redisplay-output.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/redisplay-output.c,v retrieving revision 1.11.2.36 diff -u -r1.11.2.36 redisplay-output.c --- src/redisplay-output.c 2000/04/04 10:50:51 1.11.2.36 +++ src/redisplay-output.c 2000/05/03 14:39:55 @@ -281,13 +281,7 @@ return 0; } else - { -#ifdef DEBUG_WIDGET_OUTPUT - if (XIMAGE_INSTANCE_TYPE (image) == IMAGE_LAYOUT) - printf ("glyph layout %p considered unchanged\n", ii); -#endif - return 1; - } + return 1; } /* We now do this last so that glyph checks can do their own thing for face changes. Face changes quite often happen when we are @@ -1146,22 +1140,27 @@ static void redisplay_unmap_subwindows (struct frame* f, int x, int y, int width, int height, Lisp_Object ignored_window) { - int elt; + Lisp_Object rest; - for (elt = 0; elt < Dynarr_length (f->subwindow_cachels); elt++) + LIST_LOOP (rest, XWEAK_LIST_LIST (FRAME_SUBWINDOW_CACHE (f))) { - struct subwindow_cachel *cachel = - Dynarr_atp (f->subwindow_cachels, elt); + Lisp_Image_Instance *ii = XIMAGE_INSTANCE (XCAR (rest)); - if (cachel->being_displayed + if (IMAGE_INSTANCE_SUBWINDOW_DISPLAYEDP (ii) && - cachel->x + cachel->width > x && cachel->x < x + width + IMAGE_INSTANCE_DISPLAY_X (ii) + + IMAGE_INSTANCE_DISPLAY_WIDTH (ii) > x + && + IMAGE_INSTANCE_DISPLAY_X (ii) < x + width && - cachel->y + cachel->height > y && cachel->y < y + height + IMAGE_INSTANCE_DISPLAY_Y (ii) + + IMAGE_INSTANCE_DISPLAY_HEIGHT (ii) > y + && + IMAGE_INSTANCE_DISPLAY_Y (ii) < y + height && - !EQ (cachel->subwindow, ignored_window)) + !EQ (XCAR (rest), ignored_window)) { - unmap_subwindow (cachel->subwindow); + unmap_subwindow (XCAR (rest)); } } } @@ -1174,7 +1173,7 @@ ****************************************************************************/ void redisplay_unmap_subwindows_maybe (struct frame* f, int x, int y, int width, int height) { - if (Dynarr_length (FRAME_SUBWINDOW_CACHE (f))) + if (!NILP (XWEAK_LIST_LIST (FRAME_SUBWINDOW_CACHE (f)))) { redisplay_unmap_subwindows (f, x, y, width, height, Qnil); } @@ -1183,7 +1182,7 @@ static void redisplay_unmap_subwindows_except_us (struct frame* f, int x, int y, int width, int height, Lisp_Object subwindow) { - if (Dynarr_length (FRAME_SUBWINDOW_CACHE (f))) + if (!NILP (XWEAK_LIST_LIST (FRAME_SUBWINDOW_CACHE (f)))) { redisplay_unmap_subwindows (f, x, y, width, height, subwindow); } @@ -1466,16 +1465,17 @@ break; case IMAGE_WIDGET: + if (EQ (IMAGE_INSTANCE_WIDGET_TYPE (childii), Qlayout)) + { + redisplay_output_layout (w, child, &cdb, &cdga, findex, + 0, 0, 0); + break; + } case IMAGE_SUBWINDOW: if (!IMAGE_INSTANCE_OPTIMIZE_OUTPUT (childii) || IMAGE_INSTANCE_DIRTYP (childii)) redisplay_output_subwindow (w, child, &cdb, &cdga, findex, 0, 0, 0); - break; - - case IMAGE_LAYOUT: - redisplay_output_layout (w, child, &cdb, &cdga, findex, - 0, 0, 0); break; case IMAGE_NOTHING: Index: src/redisplay-tty.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/redisplay-tty.c,v retrieving revision 1.15.2.10 diff -u -r1.15.2.10 redisplay-tty.c --- src/redisplay-tty.c 2000/04/02 14:28:58 1.15.2.10 +++ src/redisplay-tty.c 2000/05/03 14:39:55 @@ -340,7 +340,6 @@ case IMAGE_COLOR_PIXMAP: case IMAGE_SUBWINDOW: case IMAGE_WIDGET: - case IMAGE_LAYOUT: /* just do nothing here */ break; Index: src/redisplay-x.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/redisplay-x.c,v retrieving revision 1.23.2.24 diff -u -r1.23.2.24 redisplay-x.c --- src/redisplay-x.c 2000/04/02 14:28:58 1.23.2.24 +++ src/redisplay-x.c 2000/05/03 14:39:56 @@ -460,16 +460,18 @@ break; case IMAGE_WIDGET: + if (EQ (XIMAGE_INSTANCE_WIDGET_TYPE (instance), + Qlayout)) + { + redisplay_output_layout (w, instance, &dbox, &dga, findex, + cursor_start, cursor_width, + cursor_height); + break; + } case IMAGE_SUBWINDOW: redisplay_output_subwindow (w, instance, &dbox, &dga, findex, cursor_start, cursor_width, cursor_height); - break; - - case IMAGE_LAYOUT: - redisplay_output_layout (w, instance, &dbox, &dga, findex, - cursor_start, cursor_width, - cursor_height); break; case IMAGE_NOTHING: Index: src/redisplay.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/redisplay.c,v retrieving revision 1.55.2.54 diff -u -r1.55.2.54 redisplay.c --- src/redisplay.c 2000/04/28 09:25:23 1.55.2.54 +++ src/redisplay.c 2000/05/03 14:39:58 @@ -6342,12 +6342,9 @@ process.*/ if (f->frame_changed || f->subwindows_changed) { - reset_subwindow_cachels (f); /* we have to do this so the gutter gets regenerated. */ reset_gutter_display_lines (f); } - else - mark_subwindow_cachels_as_not_updated (f); hold_frame_size_changes (); Index: src/specifier.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/specifier.c,v retrieving revision 1.15.2.17 diff -u -r1.15.2.17 specifier.c --- src/specifier.c 2000/03/16 11:21:57 1.15.2.17 +++ src/specifier.c 2000/05/03 14:40:00 @@ -609,15 +609,18 @@ DEFUN ("valid-specifier-domain-p", Fvalid_specifier_domain_p, 1, 1, 0, /* Return t if DOMAIN is a valid specifier domain. A domain is used to instance a specifier (i.e. determine the specifier's -value in that domain). Valid domains are windows, frames, and devices. -\(nil is not valid.) +value in that domain). Valid domains are image instances, windows, frames, +and devices. \(nil is not valid.) image instances are pseudo-domains since +instantiation will actually occur in the window the image instance itself is +instantiated in. */ (domain)) { /* This cannot GC. */ return ((DEVICEP (domain) && DEVICE_LIVE_P (XDEVICE (domain))) || (FRAMEP (domain) && FRAME_LIVE_P (XFRAME (domain))) || - (WINDOWP (domain) && WINDOW_LIVE_P (XWINDOW (domain)))) + (WINDOWP (domain) && WINDOW_LIVE_P (XWINDOW (domain))) || + IMAGE_INSTANCEP (domain)) ? Qt : Qnil; } @@ -2435,7 +2438,7 @@ GCPRO2 (specifier, inst_list); sp = XSPECIFIER (specifier); - device = DFW_DEVICE (domain); + device = DOMAIN_DEVICE (domain); if (no_quit) /* The instantiate method is allowed to call eval. Since it @@ -2515,7 +2518,9 @@ /* Attempt to determine buffer, window, frame, and device from the domain. */ - if (WINDOWP (domain)) + if (IMAGE_INSTANCEP (domain)) + window = DOMAIN_WINDOW (domain); + else if (WINDOWP (domain)) window = domain; else if (FRAMEP (domain)) frame = domain; Index: src/specifier.h =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/specifier.h,v retrieving revision 1.6.2.11 diff -u -r1.6.2.11 specifier.h --- src/specifier.h 2000/02/26 11:39:49 1.6.2.11 +++ src/specifier.h 2000/05/03 14:40:00 @@ -413,6 +413,42 @@ Lisp_Object oldval); }; +/* This turns out to be used heavily so we make it a macro to make it + inline. Also, the majority of the time the object will turn out to + be a window so we move it from being checked last to being checked + first. */ +#define DOMAIN_DEVICE(obj) \ + (WINDOWP (obj) ? WINDOW_DEVICE (XWINDOW (obj)) \ + : (FRAMEP (obj) ? FRAME_DEVICE (XFRAME (obj)) \ + : (DEVICEP (obj) ? obj \ + : (IMAGE_INSTANCEP (obj) ? image_instance_device (obj) \ + : Qnil)))) + +#define DOMAIN_FRAME(obj) \ + (WINDOWP (obj) ? WINDOW_FRAME (XWINDOW (obj)) \ + : (FRAMEP (obj) ? obj \ + : (IMAGE_INSTANCEP (obj) ? image_instance_frame (obj) \ + : Qnil))) + +#define DOMAIN_WINDOW(obj) \ + (WINDOWP (obj) ? obj \ + : (IMAGE_INSTANCEP (obj) ? image_instance_window (obj) \ + : Qnil)) + +#define DOMAIN_LIVE_P(obj) \ + (WINDOWP (obj) ? WINDOW_LIVE_P (XWINDOW (obj)) \ + : (FRAMEP (obj) ? FRAME_LIVE_P (XFRAME (obj)) \ + : (DEVICEP (obj) ? DEVICE_LIVE_P (XDEVICE (obj)) \ + : (IMAGE_INSTANCEP (obj) ? image_instance_live_p (obj) \ + : 0)))) + +#define DOMAIN_XDEVICE(obj) \ + (XDEVICE (DOMAIN_DEVICE (obj))) +#define DOMAIN_XFRAME(obj) \ + (XFRAME (DOMAIN_FRAME (obj))) +#define DOMAIN_XWINDOW(obj) \ + (XWINDOW (DOMAIN_WINDOW (obj))) + EXFUN (Fcopy_specifier, 6); EXFUN (Fmake_specifier, 1); EXFUN (Fset_specifier_dirty_flag, 1); Index: src/toolbar-msw.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/toolbar-msw.c,v retrieving revision 1.13.2.8 diff -u -r1.13.2.8 toolbar-msw.c --- src/toolbar-msw.c 2000/03/29 18:35:34 1.13.2.8 +++ src/toolbar-msw.c 2000/05/03 14:40:01 @@ -46,18 +46,7 @@ #define TOOLBAR_ID_BIAS 16 #define TOOLBAR_HANDLE(f,p) \ GetDlgItem(FRAME_MSWINDOWS_HANDLE(f), TOOLBAR_ID_BIAS + p) -#ifndef TB_SETIMAGELIST -#define TB_SETIMAGELIST (WM_USER + 48) -#define TB_GETIMAGELIST (WM_USER + 49) -#define TB_SETDISABLEDIMAGELIST (WM_USER + 54) -#define TB_GETDISABLEDIMAGELIST (WM_USER + 55) -#endif -#ifndef TB_SETPADDING -#define TB_SETPADDING (WM_USER + 87) -#endif -#ifndef TBSTYLE_FLAT -#define TBSTYLE_FLAT 0x800 -#endif + #define MSWINDOWS_BUTTON_SHADOW_THICKNESS 2 #define MSWINDOWS_BLANK_SIZE 5 #define MSWINDOWS_MINIMUM_TOOLBAR_SIZE 8 Index: src/window.c =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/window.c,v retrieving revision 1.41.2.47 diff -u -r1.41.2.47 window.c --- src/window.c 2000/03/19 14:14:46 1.41.2.47 +++ src/window.c 2000/05/03 14:40:05 @@ -281,7 +281,7 @@ p->face_cachels = Dynarr_new (face_cachel); p->glyph_cachels = Dynarr_new (glyph_cachel); p->line_start_cache = Dynarr_new (line_start_cache); - p->subwindow_instance_cache = make_lisp_hash_table (10, + p->subwindow_instance_cache = make_lisp_hash_table (30, HASH_TABLE_KEY_WEAK, HASH_TABLE_EQ); p->line_cache_last_updated = Qzero; @@ -1867,13 +1867,45 @@ /* #### Here, if replacement is a vertical combination and so is its new parent, we should make replacement's children be children of that parent instead. */ + + ERROR_CHECK_SUBWINDOW_CACHE (p); } +static int +window_unmap_subwindows_cache_mapper (Lisp_Object key, Lisp_Object value, + void *flag_closure) +{ + unmap_subwindow (value); + return 0; +} + +static void +window_unmap_subwindows (struct window* w) +{ + assert (!NILP (w->subwindow_instance_cache)); + elisp_maphash (window_unmap_subwindows_cache_mapper, + w->subwindow_instance_cache, 0); +} + /* we're deleting W; set the structure of W to indicate this. */ static void mark_window_as_deleted (struct window *w) { + /* The window instance cache is going away now, so need to get the + cachels reset by redisplay. */ + MARK_FRAME_SUBWINDOWS_CHANGED (XFRAME (WINDOW_FRAME (w))); + + /* The cache is going away. If we leave unmapping to + reset_subwindow_cachels then we get in a situation where the + domain (the window) has been deleted but we still need access to + its attributes in order to unmap windows properly. Since the + subwindows are going to get GC'd anyway as a result of the domain + going away, it is safer to just unmap them all while we know the + domain is still valid. */ + ERROR_CHECK_SUBWINDOW_CACHE (w); + window_unmap_subwindows (w); + /* In the loop (while t (split-window) (delete-window)) we end up with a tree of deleted windows which are all connected @@ -1885,13 +1917,13 @@ Since the window-configuration code doesn't need any of the pointers to other windows (they are all recreated from the window-config data), we set them all to nil so that we - are able to collect more actual garbage. - */ + are able to collect more actual garbage. */ w->next = Qnil; w->prev = Qnil; w->hchild = Qnil; w->vchild = Qnil; w->parent = Qnil; + w->subwindow_instance_cache = Qnil; w->dead = 1; @@ -1928,6 +1960,7 @@ window = Fselected_window (Qnil); else CHECK_WINDOW (window); + w = XWINDOW (window); /* It's okay to delete an already-deleted window. */ @@ -3475,7 +3508,7 @@ p->face_cachels = Dynarr_new (face_cachel); p->glyph_cachels = Dynarr_new (glyph_cachel); p->subwindow_instance_cache = - make_lisp_hash_table (10, + make_lisp_hash_table (30, HASH_TABLE_KEY_WEAK, HASH_TABLE_EQ); Index: src/s/cygwin32.h =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/s/cygwin32.h,v retrieving revision 1.14.2.15 diff -u -r1.14.2.15 cygwin32.h --- src/s/cygwin32.h 2000/03/06 20:57:49 1.14.2.15 +++ src/s/cygwin32.h 2000/05/03 14:40:06 @@ -85,63 +85,9 @@ extern int srandom( unsigned seed); extern long random(); -# define SND_ASYNC 1 -# define SND_NODEFAULT 2 -# define SND_MEMORY 4 -# define SND_FILENAME 0x2000L -# define VK_APPS 0x5D -# define SIF_TRACKPOS 0x0010 -# define ICC_BAR_CLASSES 4 -# define FW_BLACK FW_HEAVY -# define FW_ULTRABOLD FW_EXTRABOLD -# define FW_DEMIBOLD FW_SEMIBOLD -# define FW_ULTRALIGHT FW_EXTRALIGHT -# define APPCMD_FILTERINITS 0x20L -# define CBF_FAIL_SELFCONNECTIONS 0x1000 -# define CBF_SKIP_ALLNOTIFICATIONS 0x3C0000 -# define CBF_FAIL_ADVISES 0x4000 -# define CBF_FAIL_POKES 0x10000 -# define CBF_FAIL_REQUESTS 0x20000 -# define SZDDESYS_TOPIC "System" -# define JOHAB_CHARSET 130 -# define MAC_CHARSET 77 # endif #endif -#ifndef SPI_GETWHEELSCROLLLINES -#define SPI_GETWHEELSCROLLLINES 104 -#endif -#ifndef WHEEL_PAGESCROLL -#define WHEEL_PAGESCROLL (UINT_MAX) -#endif -#ifndef WHEEL_DELTA -#define WHEEL_DELTA 120 -#endif -#ifndef WM_MOUSEWHEEL -#define WM_MOUSEWHEEL 0x20A -#endif -#ifndef TCS_BOTTOM -#define TCS_BOTTOM 0x0002 -#endif -#ifndef TCS_VERTICAL -#define TCS_VERTICAL 0x0080 -#endif -#ifndef PHYSICALWIDTH -#define PHYSICALWIDTH 110 -#endif -#ifndef PHYSICALHEIGHT -#define PHYSICALHEIGHT 111 -#endif -#ifndef PHYSICALOFFSETX -#define PHYSICALOFFSETX 112 -#endif -#ifndef PHYSICALOFFSETY -#define PHYSICALOFFSETY 113 -#endif - - -#define PBS_SMOOTH 0x01 - #ifdef HAVE_MS_WINDOWS #define HAVE_NTGUI #define HAVE_FACES @@ -153,7 +99,7 @@ #define C_SWITCH_SYSTEM -Wno-sign-compare -fno-caller-saves #define LIBS_SYSTEM -lwinmm - +#define WIN32_LEAN_AND_MEAN #define TEXT_START -1 #define TEXT_END -1 Index: src/s/mingw32.h =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/src/s/Attic/mingw32.h,v retrieving revision 1.1.2.7 diff -u -r1.1.2.7 mingw32.h --- src/s/mingw32.h 2000/03/06 15:46:42 1.1.2.7 +++ src/s/mingw32.h 2000/05/03 14:40:06 @@ -39,6 +39,7 @@ #define C_SWITCH_SYSTEM "-mno-cygwin -Wno-sign-compare -fno-caller-saves -Int/inc -I../nt/inc -DWINDOWSNT" #define LIBS_SYSTEM "-mno-cygwin -lwinmm -lwsock32" +#define WIN32_LEAN_AND_MEAN #define TEXT_START -1 #define TEXT_END -1 @@ -51,43 +52,8 @@ #define LOCALE_USE_CP_ACP 0x40000000 #define NSIG 23 -#ifndef SPI_GETWHEELSCROLLLINES -#define SPI_GETWHEELSCROLLLINES 104 -#endif -#ifndef WHEEL_PAGESCROLL -#define WHEEL_PAGESCROLL (UINT_MAX) -#endif -#ifndef WHEEL_DELTA -#define WHEEL_DELTA 120 -#endif - /* this is necessary to get the TCS_* definitions in */ #define _WIN32_IE 0x0400 - -#ifndef WM_MOUSEWHEEL -#define WM_MOUSEWHEEL 0x20A -#endif -#ifndef TCS_BOTTOM -#define TCS_BOTTOM 0x0002 -#endif -#ifndef TCS_VERTICAL -#define TCS_VERTICAL 0x0080 -#endif -#ifndef PHYSICALWIDTH -#define PHYSICALWIDTH 110 -#endif -#ifndef PHYSICALHEIGHT -#define PHYSICALHEIGHT 111 -#endif -#ifndef PHYSICALOFFSETX -#define PHYSICALOFFSETX 112 -#endif -#ifndef PHYSICALOFFSETY -#define PHYSICALOFFSETY 113 -#endif -#ifndef PBS_SMOOTH -#define PBS_SMOOTH 0x01 -#endif /* translate NT world unexec stuff to our a.out definitions */ Index: tests/glyph-test.el =================================================================== RCS file: /usr/CVSroot/XEmacs/xemacs/tests/Attic/glyph-test.el,v retrieving revision 1.1.2.21 diff -u -r1.1.2.21 glyph-test.el --- tests/glyph-test.el 2000/04/14 16:15:44 1.1.2.21 +++ tests/glyph-test.el 2000/05/03 14:40:07 @@ -148,13 +148,14 @@ ;; layout (setq layout (make-glyph - [layout :pixel-width 200 :pixel-height 250 - :orientation vertical - :justify left - :border [string :data "Hello There Mrs"] - :items ([layout :orientation horizontal - :items (radio-button1 radio-button2)] - edit-field toggle-button label str)])) + [native-layout :descriptor "The Layout" + :orientation vertical + :justify left +; :border [string :data "Hello There Mrs"] + :border etched-in + :items ([native-layout :orientation horizontal + :items (radio-button1 radio-button2)] + edit-field toggle-button label str)])) (set-glyph-face layout 'gui-element) (set-extent-begin-glyph (make-extent (point) (point)) layout)