annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1 /* gtk-xemacs.c
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
2 **
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
3 ** Description: A widget to encapsulate a XEmacs 'text widget'
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
4 **
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
5 ** Created by: William M. Perry
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
6 ** Copyright (c) 2000 William M. Perry <wmperry@gnu.org>
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
7 **
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
8 */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
9
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
10 #include <config.h>
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
11
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
12 #include "lisp.h"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
13 #include "console-gtk.h"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
14 #include "objects-gtk.h"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
15 #include "gtk-xemacs.h"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
16 #include "window.h"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
17 #include "faces.h"
778
2923009caf47 [xemacs-hg @ 2002-03-16 10:38:59 by ben]
ben
parents: 744
diff changeset
18 #include "event-gtk.h"
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
19
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
20 extern Lisp_Object Vmodeline_face;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
21 extern Lisp_Object Vscrollbar_on_left_p;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
22
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
23 EXFUN (Fmake_image_instance, 4);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
24
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
25 static void gtk_xemacs_class_init (GtkXEmacsClass *klass);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
26 static void gtk_xemacs_init (GtkXEmacs *xemacs);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
27 static void gtk_xemacs_size_allocate (GtkWidget *widget, GtkAllocation *allocaction);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
28 static void gtk_xemacs_draw (GtkWidget *widget, GdkRectangle *area);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
29 static void gtk_xemacs_paint (GtkWidget *widget, GdkRectangle *area);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
30 static void gtk_xemacs_size_request (GtkWidget *widget, GtkRequisition *requisition);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
31 static void gtk_xemacs_realize (GtkWidget *widget);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
32 static void gtk_xemacs_style_set (GtkWidget *widget, GtkStyle *previous_style);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
33 static gint gtk_xemacs_expose (GtkWidget *widget, GdkEventExpose *event);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
34
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
35 guint
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
36 gtk_xemacs_get_type (void)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
37 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
38 static guint xemacs_type = 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
39
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
40 if (!xemacs_type)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
41 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
42 static const GtkTypeInfo xemacs_info =
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
43 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
44 "GtkXEmacs",
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
45 sizeof (GtkXEmacs),
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
46 sizeof (GtkXEmacsClass),
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
47 (GtkClassInitFunc) gtk_xemacs_class_init,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
48 (GtkObjectInitFunc) gtk_xemacs_init,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
49 /* reserved_1 */ NULL,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
50 /* reserved_2 */ NULL,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
51 (GtkClassInitFunc) NULL,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
52 };
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
53
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
54 xemacs_type = gtk_type_unique (gtk_fixed_get_type (), &xemacs_info);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
55 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
56
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
57 return xemacs_type;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
58 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
59
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
60 static GtkWidgetClass *parent_class;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
61
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
62 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
63 gtk_xemacs_class_init (GtkXEmacsClass *class)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
64 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
65 GtkWidgetClass *widget_class;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
66
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
67 widget_class = (GtkWidgetClass*) class;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
68 parent_class = (GtkWidgetClass *) gtk_type_class (gtk_fixed_get_type ());
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
69
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
70 widget_class->size_allocate = gtk_xemacs_size_allocate;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
71 widget_class->size_request = gtk_xemacs_size_request;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
72 widget_class->draw = gtk_xemacs_draw;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
73 widget_class->expose_event = gtk_xemacs_expose;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
74 widget_class->realize = gtk_xemacs_realize;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
75 widget_class->button_press_event = emacs_gtk_button_event_handler;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
76 widget_class->button_release_event = emacs_gtk_button_event_handler;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
77 widget_class->key_press_event = emacs_gtk_key_event_handler;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
78 widget_class->key_release_event = emacs_gtk_key_event_handler;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
79 widget_class->motion_notify_event = emacs_gtk_motion_event_handler;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
80 widget_class->style_set = gtk_xemacs_style_set;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
81 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
82
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
83 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
84 gtk_xemacs_init (GtkXEmacs *xemacs)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
85 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
86 GTK_WIDGET_SET_FLAGS (xemacs, GTK_CAN_FOCUS);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
87 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
88
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
89 GtkWidget*
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
90 gtk_xemacs_new (struct frame *f)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
91 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
92 GtkXEmacs *xemacs;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
93
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
94 xemacs = gtk_type_new (gtk_xemacs_get_type ());
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
95 xemacs->f = f;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
96
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
97 return GTK_WIDGET (xemacs);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
98 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
99
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
100 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
101 __nuke_background_items (GtkWidget *widget)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
102 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
103 /* This bit of voodoo is here to get around the annoying flicker
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
104 when GDK tries to futz with our background pixmap as well as
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
105 XEmacs doing it
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
106
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
107 We do NOT set the background of this widget window, that way
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
108 there is NO flickering, etc. The downside is the XEmacs frame
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
109 appears as 'seethru' when XEmacs is too busy to redraw the
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
110 frame.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
111
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
112 Well, wait, we do... otherwise there sre weird 'seethru' areas
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
113 even when XEmacs does a full redisplay. Most noticable in some
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
114 areas of the modeline, or in the right-hand-side of the window
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
115 between the scrollbar ad n the edge of the window.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
116 */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
117 if (widget->window)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
118 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
119 gdk_window_set_back_pixmap (widget->window, NULL, 0);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
120 gdk_window_set_back_pixmap (widget->parent->window, NULL, 0);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
121 gdk_window_set_background (widget->parent->window,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
122 &widget->style->bg[GTK_STATE_NORMAL]);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
123 gdk_window_set_background (widget->window,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
124 &widget->style->bg[GTK_STATE_NORMAL]);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
125 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
126 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
127
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
128 extern Lisp_Object xemacs_gtk_convert_color(GdkColor *c, GtkWidget *w);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
129
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
130 /* From objects-gtk.c */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
131 extern Lisp_Object __get_gtk_font_truename (GdkFont *gdk_font, int expandp);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
132
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
133 #define convert_font(f) __get_gtk_font_truename (f, 0)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
134
778
2923009caf47 [xemacs-hg @ 2002-03-16 10:38:59 by ben]
ben
parents: 744
diff changeset
135 #ifdef SMASH_FACE_FALLBACKS
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
136 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
137 smash_face_fallbacks (struct frame *f, GtkStyle *style)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
138 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
139 #define FROB(face,prop,slot) do { \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
140 Lisp_Object fallback = Qnil; \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
141 Lisp_Object specifier = Fget (face, prop, Qnil); \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
142 struct Lisp_Specifier *sp = NULL; \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
143 if (NILP (specifier)) continue; \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
144 sp = XSPECIFIER (specifier); \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
145 fallback = sp->fallback; \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
146 if (EQ (Fcar (Fcar (Fcar (fallback))), Qgtk)) \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
147 fallback = XCDR (fallback); \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
148 if (! NILP (slot)) \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
149 fallback = acons (list1 (Qgtk), \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
150 slot, \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
151 fallback); \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
152 set_specifier_fallback (specifier, fallback); \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
153 } while (0);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
154 #define FROB_FACE(face,fg_slot,bg_slot) \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
155 do { \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
156 FROB (face, Qforeground, xemacs_gtk_convert_color (&style->fg_slot[GTK_STATE_NORMAL], FRAME_GTK_SHELL_WIDGET (f))); \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
157 FROB (face, Qbackground, xemacs_gtk_convert_color (&style->bg_slot[GTK_STATE_NORMAL], FRAME_GTK_SHELL_WIDGET (f))); \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
158 if (style->rc_style && style->rc_style->bg_pixmap_name[GTK_STATE_NORMAL]) \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
159 { \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
160 FROB (Vdefault_face, Qbackground_pixmap, \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
161 Fmake_image_instance (build_string (style->rc_style->bg_pixmap_name[GTK_STATE_NORMAL]), \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
162 f->device, Qnil, make_int (5))); \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
163 } \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
164 else \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
165 { \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
166 FROB (Vdefault_face, Qbackground_pixmap, Qnil); \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
167 } \
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
168 } while (0)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
169
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
170 FROB (Vdefault_face, Qfont, convert_font (style->font));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
171 FROB_FACE (Vdefault_face, fg, bg);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
172 FROB_FACE (Vgui_element_face, text, mid);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
173
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
174 #undef FROB
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
175 #undef FROB_FACE
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
176 }
778
2923009caf47 [xemacs-hg @ 2002-03-16 10:38:59 by ben]
ben
parents: 744
diff changeset
177 #endif /* SMASH_FACE_FALLBACKS */
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
178
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
179 #ifdef HAVE_SCROLLBARS
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
180 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
181 smash_scrollbar_specifiers (struct frame *f, GtkStyle *style)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
182 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
183 Lisp_Object frame;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
184 int slider_size = 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
185 int hsize, vsize;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
186 GtkRangeClass *klass;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
187
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 778
diff changeset
188 frame = wrap_frame (f);
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
189
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
190 klass = (GtkRangeClass *) gtk_type_class (GTK_TYPE_SCROLLBAR);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
191 slider_size = klass->slider_width;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
192 hsize = slider_size + (style->klass->ythickness * 2);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
193 vsize = slider_size + (style->klass->xthickness * 2);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
194
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
195 style = gtk_style_attach (style,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
196 GTK_WIDGET (DEVICE_GTK_APP_SHELL (XDEVICE (FRAME_DEVICE (f))))->window);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
197
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
198 Fadd_spec_to_specifier (Vscrollbar_width, make_int (vsize), frame, Qnil, Qnil);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
199 Fadd_spec_to_specifier (Vscrollbar_height, make_int (hsize), frame, Qnil, Qnil);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
200 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
201 #endif /* HAVE_SCROLLBARS */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
202
744
8ae895c67ce7 [xemacs-hg @ 2002-02-04 15:44:37 by wmperry]
wmperry
parents: 462
diff changeset
203 #ifdef HAVE_TOOLBARS
8ae895c67ce7 [xemacs-hg @ 2002-02-04 15:44:37 by wmperry]
wmperry
parents: 462
diff changeset
204 extern Lisp_Object Vtoolbar_shadow_thickness;
8ae895c67ce7 [xemacs-hg @ 2002-02-04 15:44:37 by wmperry]
wmperry
parents: 462
diff changeset
205
8ae895c67ce7 [xemacs-hg @ 2002-02-04 15:44:37 by wmperry]
wmperry
parents: 462
diff changeset
206 static void
8ae895c67ce7 [xemacs-hg @ 2002-02-04 15:44:37 by wmperry]
wmperry
parents: 462
diff changeset
207 smash_toolbar_specifiers(struct frame *f, GtkStyle *style)
8ae895c67ce7 [xemacs-hg @ 2002-02-04 15:44:37 by wmperry]
wmperry
parents: 462
diff changeset
208 {
8ae895c67ce7 [xemacs-hg @ 2002-02-04 15:44:37 by wmperry]
wmperry
parents: 462
diff changeset
209 Lisp_Object frame;
8ae895c67ce7 [xemacs-hg @ 2002-02-04 15:44:37 by wmperry]
wmperry
parents: 462
diff changeset
210 GtkStyleClass *klass = (GtkStyleClass *) style->klass;
8ae895c67ce7 [xemacs-hg @ 2002-02-04 15:44:37 by wmperry]
wmperry
parents: 462
diff changeset
211
793
e38acbeb1cae [xemacs-hg @ 2002-03-29 04:46:17 by ben]
ben
parents: 778
diff changeset
212 frame = wrap_frame (f);
744
8ae895c67ce7 [xemacs-hg @ 2002-02-04 15:44:37 by wmperry]
wmperry
parents: 462
diff changeset
213
8ae895c67ce7 [xemacs-hg @ 2002-02-04 15:44:37 by wmperry]
wmperry
parents: 462
diff changeset
214 Fadd_spec_to_specifier (Vtoolbar_shadow_thickness, make_int (klass->xthickness),
8ae895c67ce7 [xemacs-hg @ 2002-02-04 15:44:37 by wmperry]
wmperry
parents: 462
diff changeset
215 Qnil, list2 (Qgtk, Qdefault), Qprepend);
8ae895c67ce7 [xemacs-hg @ 2002-02-04 15:44:37 by wmperry]
wmperry
parents: 462
diff changeset
216 }
8ae895c67ce7 [xemacs-hg @ 2002-02-04 15:44:37 by wmperry]
wmperry
parents: 462
diff changeset
217 #endif /* HAVE_TOOLBARS */
8ae895c67ce7 [xemacs-hg @ 2002-02-04 15:44:37 by wmperry]
wmperry
parents: 462
diff changeset
218
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
219 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
220 gtk_xemacs_realize (GtkWidget *widget)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
221 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
222 parent_class->realize (widget);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
223 gtk_xemacs_style_set (widget, gtk_widget_get_style (widget));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
224 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
225
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
226 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
227 gtk_xemacs_style_set (GtkWidget *widget, GtkStyle *previous_style)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
228 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
229 GtkStyle *new_style = gtk_widget_get_style (widget);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
230 GtkXEmacs *x = GTK_XEMACS (widget);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
231
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
232 parent_class->style_set (widget, previous_style);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
233
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
234 if (x->f)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
235 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
236 __nuke_background_items (widget);
778
2923009caf47 [xemacs-hg @ 2002-03-16 10:38:59 by ben]
ben
parents: 744
diff changeset
237 #ifdef SMASH_FACE_FALLBACKS
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
238 smash_face_fallbacks (x->f, new_style);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
239 #endif
744
8ae895c67ce7 [xemacs-hg @ 2002-02-04 15:44:37 by wmperry]
wmperry
parents: 462
diff changeset
240 #ifdef HAVE_SCROLLBARS
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
241 smash_scrollbar_specifiers (x->f, new_style);
744
8ae895c67ce7 [xemacs-hg @ 2002-02-04 15:44:37 by wmperry]
wmperry
parents: 462
diff changeset
242 #endif
8ae895c67ce7 [xemacs-hg @ 2002-02-04 15:44:37 by wmperry]
wmperry
parents: 462
diff changeset
243 #ifdef HAVE_TOOLBARS
8ae895c67ce7 [xemacs-hg @ 2002-02-04 15:44:37 by wmperry]
wmperry
parents: 462
diff changeset
244 smash_toolbar_specifiers (x->f, new_style);
8ae895c67ce7 [xemacs-hg @ 2002-02-04 15:44:37 by wmperry]
wmperry
parents: 462
diff changeset
245 #endif
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
246 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
247 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
248
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
249 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
250 gtk_xemacs_size_request (GtkWidget *widget, GtkRequisition *requisition)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
251 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
252 GtkXEmacs *x = GTK_XEMACS (widget);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
253 struct frame *f = GTK_XEMACS_FRAME (x);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
254 int width, height;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
255
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
256 if (f)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
257 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
258 char_to_pixel_size (f, FRAME_WIDTH (f), FRAME_HEIGHT (f),
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
259 &width, &height);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
260 requisition->width = width;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
261 requisition->height = height;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
262 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
263 else
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
264 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
265 parent_class->size_request (widget, requisition);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
266 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
267 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
268
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
269 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
270 gtk_xemacs_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
271 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
272 GtkXEmacs *x = GTK_XEMACS (widget);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
273 struct frame *f = GTK_XEMACS_FRAME (x);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
274 int columns, rows;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
275
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
276 parent_class->size_allocate(widget, allocation);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
277
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
278 if (f)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
279 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
280 f->pixwidth = allocation->width;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
281 f->pixheight = allocation->height;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
282
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
283 pixel_to_char_size (f,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
284 allocation->width,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
285 allocation->height, &columns, &rows);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
286
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
287 change_frame_size (f, rows, columns, 1);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
288 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
289 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
290
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
291 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
292 gtk_xemacs_paint (GtkWidget *widget, GdkRectangle *area)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
293 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
294 GtkXEmacs *x = GTK_XEMACS (widget);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
295 struct frame *f = GTK_XEMACS_FRAME (x);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
296 gtk_redraw_exposed_area (f, area->x, area->y, area->width, area->height);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
297 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
298
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
299 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
300 gtk_xemacs_draw (GtkWidget *widget, GdkRectangle *area)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
301 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
302 GtkFixed *fixed = GTK_FIXED (widget);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
303 GtkFixedChild *child;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
304 GdkRectangle child_area;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
305 GList *children;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
306
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
307 /* I need to manually iterate over the children instead of just
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
308 chaining to parent_class->draw() because it calls
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
309 gtk_fixed_paint() directly, which clears the background window,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
310 which causes A LOT of flashing. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
311
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
312 gtk_xemacs_paint (widget, area);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
313
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
314 children = fixed->children;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
315
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
316 while (children)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
317 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
318 child = children->data;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
319 children = children->next;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
320 /* #### This is what causes the scrollbar flickering!
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
321 Evidently the scrollbars pretty much take care of drawing
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
322 themselves in most cases. Then we come along and tell them
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
323 to redraw again!
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
324
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
325 But if we just leave it out, then they do not get drawn
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
326 correctly the first time!
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
327
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
328 Scrollbar flickering has been greatly helped by the
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
329 optimizations in scrollbar-gtk.c /
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
330 gtk_update_scrollbar_instance_status (), so this is not that
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
331 big a deal anymore.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
332 */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
333 if (gtk_widget_intersect (child->widget, area, &child_area))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
334 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
335 gtk_widget_draw (child->widget, &child_area);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
336 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
337 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
338 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
339
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
340 static gint
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
341 gtk_xemacs_expose (GtkWidget *widget, GdkEventExpose *event)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
342 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
343 GtkXEmacs *x = GTK_XEMACS (widget);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
344 struct frame *f = GTK_XEMACS_FRAME (x);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
345 GdkRectangle *a = &event->area;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
346
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
347 /* This takes care of drawing the scrollbars, etc */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
348 parent_class->expose_event (widget, event);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
349
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
350 /* Now draw the actual frame data */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
351 if (!check_for_ignored_expose (f, a->x, a->y, a->width, a->height) &&
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
352 !find_matching_subwindow (f, a->x, a->y, a->width, a->height))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
353 gtk_redraw_exposed_area (f, a->x, a->y, a->width, a->height);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
354 return (TRUE);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
355 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
356
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
357 Lisp_Object
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
358 xemacs_gtk_convert_color(GdkColor *c, GtkWidget *w)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
359 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
360 char color_buf[255];
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
361
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
362 sprintf (color_buf, "#%04x%04x%04x", c->red, c->green, c->blue);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
363
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
364 return (build_string (color_buf));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
365 }