Mercurial > hg > xemacs-beta
view src/gtk-xemacs.c @ 793:e38acbeb1cae
[xemacs-hg @ 2002-03-29 04:46:17 by ben]
lots o' fixes
etc/ChangeLog: New file.
Separated out all entries for etc/ into their own ChangeLog.
Includes entries for the following files:
etc/BABYL, etc/BETA, etc/CHARSETS, etc/DISTRIB, etc/Emacs.ad,
etc/FTP, etc/GNUS-NEWS, etc/GOATS, etc/HELLO, etc/INSTALL,
etc/MACHINES, etc/MAILINGLISTS, etc/MSDOS, etc/MYTHOLOGY, etc/NEWS,
etc/OXYMORONS, etc/PACKAGES, etc/README, etc/TUTORIAL,
etc/TUTORIAL.de, etc/TUTORIAL.ja, etc/TUTORIAL.ko, etc/TUTORIAL.se,
etc/aliases.ksh, etc/altrasoft-logo.xpm, etc/check_cygwin_setup.sh,
etc/custom/example-themes/europe-theme.el,
etc/custom/example-themes/ex-custom-file,
etc/custom/example-themes/example-theme.el, etc/e/eterm.ti,
etc/edt-user.doc, etc/enriched.doc, etc/etags.1, etc/gnuserv.1,
etc/gnuserv.README, etc/package-index.LATEST.gpg,
etc/package-index.LATEST.pgp, etc/photos/jan.png, etc/recycle.xpm,
etc/refcard.tex, etc/sample.Xdefaults, etc/sample.emacs,
etc/sgml/CATALOG, etc/sgml/HTML32.dtd, etc/skk/SKK.tut.E,
etc/smilies/Face_ase.xbm, etc/smilies/Face_ase2.xbm,
etc/smilies/Face_ase3.xbm, etc/smilies/Face_smile.xbm,
etc/smilies/Face_weep.xbm, etc/sounds, etc/toolbar,
etc/toolbar/workshop-cap-up.xpm, etc/xemacs-ja.1, etc/xemacs.1,
etc/yow.lines, etc\BETA, etc\NEWS, etc\README, etc\TUTORIAL,
etc\TUTORIAL.de, etc\check_cygwin_setup.sh, etc\sample.init.el,
etc\unicode\README, etc\unicode\mule-ucs\*, etc\unicode\other\*
unicode/unicode-consortium/8859-16.TXT: New file.
mule/english.el: Define this charset now, since a bug was fixed that formerly
prevented it.
mule/ethio-util.el: Fix compile errors involving Unicode `characters', which should be
integers.
Makefile.in.in: Always include gui.c, to fix compile error when TTY-only.
EmacsFrame.c, abbrev.c, alloc.c, buffer.c, buffer.h, bytecode.c, bytecode.h, callint.c, callproc.c, casetab.c, casetab.h, charset.h, chartab.c, chartab.h, cmds.c, console-msw.c, console-msw.h, console-tty.c, console-x.c, console-x.h, console.c, console.h, data.c, database.c, device-gtk.c, device-msw.c, device-x.c, device.c, device.h, dialog-msw.c, doc.c, doprnt.c, dumper.c, dynarr.c, editfns.c, eldap.c, eldap.h, elhash.c, elhash.h, emacs.c, eval.c, event-Xt.c, event-gtk.c, event-msw.c, event-stream.c, event-tty.c, event-unixoid.c, events.c, events.h, extents.c, extents.h, faces.c, faces.h, file-coding.c, file-coding.h, fileio.c, filelock.c, fns.c, frame-gtk.c, frame-msw.c, frame-tty.c, frame-x.c, frame.c, frame.h, free-hook.c, general-slots.h, glyphs-eimage.c, glyphs-gtk.c, glyphs-msw.c, glyphs-widget.c, glyphs-x.c, glyphs.c, glyphs.h, gpmevent.c, gtk-xemacs.c, gui-msw.c, gui-x.c, gui-x.h, gui.c, gui.h, gutter.c, gutter.h, indent.c, input-method-xlib.c, insdel.c, keymap.c, keymap.h, lisp-disunion.h, lisp-union.h, lisp.h, lread.c, lrecord.h, lstream.c, lstream.h, marker.c, menubar-gtk.c, menubar-msw.c, menubar-x.c, menubar.c, minibuf.c, mule-canna.c, mule-ccl.c, mule-charset.c, mule-wnnfns.c, native-gtk-toolbar.c, objects-msw.c, objects-tty.c, objects-x.c, objects.c, objects.h, opaque.c, opaque.h, postgresql.c, postgresql.h, print.c, process-unix.c, process.c, process.h, rangetab.c, rangetab.h, redisplay-gtk.c, redisplay-msw.c, redisplay-output.c, redisplay-tty.c, redisplay-x.c, redisplay.c, scrollbar-gtk.c, scrollbar-msw.c, scrollbar-x.c, scrollbar.c, scrollbar.h, search.c, select-gtk.c, select-x.c, sound.c, specifier.c, specifier.h, strftime.c, symbols.c, symeval.h, syntax.h, text.c, text.h, toolbar-common.c, toolbar-msw.c, toolbar.c, toolbar.h, tooltalk.c, tooltalk.h, ui-gtk.c, ui-gtk.h, undo.c, vm-limit.c, window.c, window.h: Eliminate XSETFOO. Replace all usages with wrap_foo().
Make symbol->name a Lisp_Object, not Lisp_String *. Eliminate
nearly all uses of Lisp_String * in favor of Lisp_Object, and
correct macros so most of them favor Lisp_Object.
Create new error-behavior ERROR_ME_DEBUG_WARN -- output warnings,
but at level `debug' (usually ignored). Use it when instantiating
specifiers, so problems can be debugged. Move
log-warning-minimum-level into C so that we can optimize
ERROR_ME_DEBUG_WARN.
Fix warning levels consistent with new definitions.
Add default_ and parent fields to char table; not yet implemented.
New fun Dynarr_verify(); use for further error checking on Dynarrs.
Rearrange code at top of lisp.h in conjunction with dynarr changes.
Fix eifree(). Use Eistrings in various places
(format_event_object(), where_is_to_char(), and callers thereof)
to avoid fixed-size strings buffers. New fun write_eistring().
Reindent and fix GPM code to follow standards.
Set default MS Windows font to Lucida Console (same size as
Courier New but less interline spacing, so more lines fit).
Increase default frame size on Windows to 50 lines. (If that's too
big for the workspace, the frame will be shrunk as necessary.)
Fix problem with text files with no newlines (). (Change
`convert-eol' coding system to use `nil' for autodetect,
consistent with make-coding-system.)
Correct compile warnings in vm-limit.c.
Fix handling of reverse-direction charsets to avoid errors when
opening (e.g.) mule-ucs/lisp/reldata/uiso8859-6.el.
Recode some object printing methods to use write_fmt_string()
instead of a fixed buffer and sprintf.
Turn on display of png comments as warnings (level `info'), now
that they're unobtrusive.
Revamped the sound documentation.
Fixed bug in redisplay w.r.t. hscroll/truncation/continuation
glyphs causing jumping up and down of the lines, since they're
bigger than the line size. (It was seen most obviously when
there's a horizontal scroll bar, e.g. do C-h a glyph or something
like that.) The problem was that the glyph-contrib-p setting on
glyphs was ignored even if it was set properly, which it wasn't
until now.
author | ben |
---|---|
date | Fri, 29 Mar 2002 04:49:13 +0000 |
parents | 2923009caf47 |
children | 285f13b079f3 |
line wrap: on
line source
/* gtk-xemacs.c ** ** Description: A widget to encapsulate a XEmacs 'text widget' ** ** Created by: William M. Perry ** Copyright (c) 2000 William M. Perry <wmperry@gnu.org> ** */ #include <config.h> #include "lisp.h" #include "console-gtk.h" #include "objects-gtk.h" #include "gtk-xemacs.h" #include "window.h" #include "faces.h" #include "event-gtk.h" extern Lisp_Object Vmodeline_face; extern Lisp_Object Vscrollbar_on_left_p; EXFUN (Fmake_image_instance, 4); static void gtk_xemacs_class_init (GtkXEmacsClass *klass); static void gtk_xemacs_init (GtkXEmacs *xemacs); static void gtk_xemacs_size_allocate (GtkWidget *widget, GtkAllocation *allocaction); static void gtk_xemacs_draw (GtkWidget *widget, GdkRectangle *area); static void gtk_xemacs_paint (GtkWidget *widget, GdkRectangle *area); static void gtk_xemacs_size_request (GtkWidget *widget, GtkRequisition *requisition); static void gtk_xemacs_realize (GtkWidget *widget); static void gtk_xemacs_style_set (GtkWidget *widget, GtkStyle *previous_style); static gint gtk_xemacs_expose (GtkWidget *widget, GdkEventExpose *event); guint gtk_xemacs_get_type (void) { static guint xemacs_type = 0; if (!xemacs_type) { static const GtkTypeInfo xemacs_info = { "GtkXEmacs", sizeof (GtkXEmacs), sizeof (GtkXEmacsClass), (GtkClassInitFunc) gtk_xemacs_class_init, (GtkObjectInitFunc) gtk_xemacs_init, /* reserved_1 */ NULL, /* reserved_2 */ NULL, (GtkClassInitFunc) NULL, }; xemacs_type = gtk_type_unique (gtk_fixed_get_type (), &xemacs_info); } return xemacs_type; } static GtkWidgetClass *parent_class; static void gtk_xemacs_class_init (GtkXEmacsClass *class) { GtkWidgetClass *widget_class; widget_class = (GtkWidgetClass*) class; parent_class = (GtkWidgetClass *) gtk_type_class (gtk_fixed_get_type ()); widget_class->size_allocate = gtk_xemacs_size_allocate; widget_class->size_request = gtk_xemacs_size_request; widget_class->draw = gtk_xemacs_draw; widget_class->expose_event = gtk_xemacs_expose; widget_class->realize = gtk_xemacs_realize; widget_class->button_press_event = emacs_gtk_button_event_handler; widget_class->button_release_event = emacs_gtk_button_event_handler; widget_class->key_press_event = emacs_gtk_key_event_handler; widget_class->key_release_event = emacs_gtk_key_event_handler; widget_class->motion_notify_event = emacs_gtk_motion_event_handler; widget_class->style_set = gtk_xemacs_style_set; } static void gtk_xemacs_init (GtkXEmacs *xemacs) { GTK_WIDGET_SET_FLAGS (xemacs, GTK_CAN_FOCUS); } GtkWidget* gtk_xemacs_new (struct frame *f) { GtkXEmacs *xemacs; xemacs = gtk_type_new (gtk_xemacs_get_type ()); xemacs->f = f; return GTK_WIDGET (xemacs); } static void __nuke_background_items (GtkWidget *widget) { /* This bit of voodoo is here to get around the annoying flicker when GDK tries to futz with our background pixmap as well as XEmacs doing it We do NOT set the background of this widget window, that way there is NO flickering, etc. The downside is the XEmacs frame appears as 'seethru' when XEmacs is too busy to redraw the frame. Well, wait, we do... otherwise there sre weird 'seethru' areas even when XEmacs does a full redisplay. Most noticable in some areas of the modeline, or in the right-hand-side of the window between the scrollbar ad n the edge of the window. */ if (widget->window) { gdk_window_set_back_pixmap (widget->window, NULL, 0); gdk_window_set_back_pixmap (widget->parent->window, NULL, 0); gdk_window_set_background (widget->parent->window, &widget->style->bg[GTK_STATE_NORMAL]); gdk_window_set_background (widget->window, &widget->style->bg[GTK_STATE_NORMAL]); } } extern Lisp_Object xemacs_gtk_convert_color(GdkColor *c, GtkWidget *w); /* From objects-gtk.c */ extern Lisp_Object __get_gtk_font_truename (GdkFont *gdk_font, int expandp); #define convert_font(f) __get_gtk_font_truename (f, 0) #ifdef SMASH_FACE_FALLBACKS static void smash_face_fallbacks (struct frame *f, GtkStyle *style) { #define FROB(face,prop,slot) do { \ Lisp_Object fallback = Qnil; \ Lisp_Object specifier = Fget (face, prop, Qnil); \ struct Lisp_Specifier *sp = NULL; \ if (NILP (specifier)) continue; \ sp = XSPECIFIER (specifier); \ fallback = sp->fallback; \ if (EQ (Fcar (Fcar (Fcar (fallback))), Qgtk)) \ fallback = XCDR (fallback); \ if (! NILP (slot)) \ fallback = acons (list1 (Qgtk), \ slot, \ fallback); \ set_specifier_fallback (specifier, fallback); \ } while (0); #define FROB_FACE(face,fg_slot,bg_slot) \ do { \ FROB (face, Qforeground, xemacs_gtk_convert_color (&style->fg_slot[GTK_STATE_NORMAL], FRAME_GTK_SHELL_WIDGET (f))); \ FROB (face, Qbackground, xemacs_gtk_convert_color (&style->bg_slot[GTK_STATE_NORMAL], FRAME_GTK_SHELL_WIDGET (f))); \ if (style->rc_style && style->rc_style->bg_pixmap_name[GTK_STATE_NORMAL]) \ { \ FROB (Vdefault_face, Qbackground_pixmap, \ Fmake_image_instance (build_string (style->rc_style->bg_pixmap_name[GTK_STATE_NORMAL]), \ f->device, Qnil, make_int (5))); \ } \ else \ { \ FROB (Vdefault_face, Qbackground_pixmap, Qnil); \ } \ } while (0) FROB (Vdefault_face, Qfont, convert_font (style->font)); FROB_FACE (Vdefault_face, fg, bg); FROB_FACE (Vgui_element_face, text, mid); #undef FROB #undef FROB_FACE } #endif /* SMASH_FACE_FALLBACKS */ #ifdef HAVE_SCROLLBARS static void smash_scrollbar_specifiers (struct frame *f, GtkStyle *style) { Lisp_Object frame; int slider_size = 0; int hsize, vsize; GtkRangeClass *klass; frame = wrap_frame (f); klass = (GtkRangeClass *) gtk_type_class (GTK_TYPE_SCROLLBAR); slider_size = klass->slider_width; hsize = slider_size + (style->klass->ythickness * 2); vsize = slider_size + (style->klass->xthickness * 2); style = gtk_style_attach (style, GTK_WIDGET (DEVICE_GTK_APP_SHELL (XDEVICE (FRAME_DEVICE (f))))->window); Fadd_spec_to_specifier (Vscrollbar_width, make_int (vsize), frame, Qnil, Qnil); Fadd_spec_to_specifier (Vscrollbar_height, make_int (hsize), frame, Qnil, Qnil); } #endif /* HAVE_SCROLLBARS */ #ifdef HAVE_TOOLBARS extern Lisp_Object Vtoolbar_shadow_thickness; static void smash_toolbar_specifiers(struct frame *f, GtkStyle *style) { Lisp_Object frame; GtkStyleClass *klass = (GtkStyleClass *) style->klass; frame = wrap_frame (f); Fadd_spec_to_specifier (Vtoolbar_shadow_thickness, make_int (klass->xthickness), Qnil, list2 (Qgtk, Qdefault), Qprepend); } #endif /* HAVE_TOOLBARS */ static void gtk_xemacs_realize (GtkWidget *widget) { parent_class->realize (widget); gtk_xemacs_style_set (widget, gtk_widget_get_style (widget)); } static void gtk_xemacs_style_set (GtkWidget *widget, GtkStyle *previous_style) { GtkStyle *new_style = gtk_widget_get_style (widget); GtkXEmacs *x = GTK_XEMACS (widget); parent_class->style_set (widget, previous_style); if (x->f) { __nuke_background_items (widget); #ifdef SMASH_FACE_FALLBACKS smash_face_fallbacks (x->f, new_style); #endif #ifdef HAVE_SCROLLBARS smash_scrollbar_specifiers (x->f, new_style); #endif #ifdef HAVE_TOOLBARS smash_toolbar_specifiers (x->f, new_style); #endif } } static void gtk_xemacs_size_request (GtkWidget *widget, GtkRequisition *requisition) { GtkXEmacs *x = GTK_XEMACS (widget); struct frame *f = GTK_XEMACS_FRAME (x); int width, height; if (f) { char_to_pixel_size (f, FRAME_WIDTH (f), FRAME_HEIGHT (f), &width, &height); requisition->width = width; requisition->height = height; } else { parent_class->size_request (widget, requisition); } } static void gtk_xemacs_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { GtkXEmacs *x = GTK_XEMACS (widget); struct frame *f = GTK_XEMACS_FRAME (x); int columns, rows; parent_class->size_allocate(widget, allocation); if (f) { f->pixwidth = allocation->width; f->pixheight = allocation->height; pixel_to_char_size (f, allocation->width, allocation->height, &columns, &rows); change_frame_size (f, rows, columns, 1); } } static void gtk_xemacs_paint (GtkWidget *widget, GdkRectangle *area) { GtkXEmacs *x = GTK_XEMACS (widget); struct frame *f = GTK_XEMACS_FRAME (x); gtk_redraw_exposed_area (f, area->x, area->y, area->width, area->height); } static void gtk_xemacs_draw (GtkWidget *widget, GdkRectangle *area) { GtkFixed *fixed = GTK_FIXED (widget); GtkFixedChild *child; GdkRectangle child_area; GList *children; /* I need to manually iterate over the children instead of just chaining to parent_class->draw() because it calls gtk_fixed_paint() directly, which clears the background window, which causes A LOT of flashing. */ gtk_xemacs_paint (widget, area); children = fixed->children; while (children) { child = children->data; children = children->next; /* #### This is what causes the scrollbar flickering! Evidently the scrollbars pretty much take care of drawing themselves in most cases. Then we come along and tell them to redraw again! But if we just leave it out, then they do not get drawn correctly the first time! Scrollbar flickering has been greatly helped by the optimizations in scrollbar-gtk.c / gtk_update_scrollbar_instance_status (), so this is not that big a deal anymore. */ if (gtk_widget_intersect (child->widget, area, &child_area)) { gtk_widget_draw (child->widget, &child_area); } } } static gint gtk_xemacs_expose (GtkWidget *widget, GdkEventExpose *event) { GtkXEmacs *x = GTK_XEMACS (widget); struct frame *f = GTK_XEMACS_FRAME (x); GdkRectangle *a = &event->area; /* This takes care of drawing the scrollbars, etc */ parent_class->expose_event (widget, event); /* Now draw the actual frame data */ if (!check_for_ignored_expose (f, a->x, a->y, a->width, a->height) && !find_matching_subwindow (f, a->x, a->y, a->width, a->height)) gtk_redraw_exposed_area (f, a->x, a->y, a->width, a->height); return (TRUE); } Lisp_Object xemacs_gtk_convert_color(GdkColor *c, GtkWidget *w) { char color_buf[255]; sprintf (color_buf, "#%04x%04x%04x", c->red, c->green, c->blue); return (build_string (color_buf)); }