Mercurial > hg > xemacs-beta
annotate src/redisplay-gtk.c @ 5167:e374ea766cc1
clean up, rearrange allocation statistics code
-------------------- ChangeLog entries follow: --------------------
src/ChangeLog addition:
2010-03-21 Ben Wing <ben@xemacs.org>
* alloc.c:
* alloc.c (assert_proper_sizing):
* alloc.c (c_readonly):
* alloc.c (malloced_storage_size):
* alloc.c (fixed_type_block_overhead):
* alloc.c (lisp_object_storage_size):
* alloc.c (inc_lrecord_stats):
* alloc.c (dec_lrecord_stats):
* alloc.c (pluralize_word):
* alloc.c (object_memory_usage_stats):
* alloc.c (Fobject_memory_usage):
* alloc.c (compute_memusage_stats_length):
* alloc.c (disksave_object_finalization_1):
* alloc.c (Fgarbage_collect):
* mc-alloc.c:
* mc-alloc.c (mc_alloced_storage_size):
* mc-alloc.h:
No functionality change here. Collect the allocations-statistics
code that was scattered throughout alloc.c into one place. Add
remaining section headings so that all sections have headings
clearly identifying the start of the section and its purpose.
Expose mc_alloced_storage_size() even when not MEMORY_USAGE_STATS;
this fixes build problems and is related to the export of
lisp_object_storage_size() and malloced_storage_size() when
non-MEMORY_USAGE_STATS in the previous change set.
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Sun, 21 Mar 2010 04:41:49 -0500 |
parents | b3ce27ca7647 |
children | 308d34e9f07d |
rev | line source |
---|---|
714 | 1 /* GTK output and frame manipulation routines. |
462 | 2 Copyright (C) 1994, 1995 Board of Trustees, University of Illinois. |
3 Copyright (C) 1994 Lucid, Inc. | |
4 Copyright (C) 1995 Sun Microsystems, Inc. | |
1318 | 5 Copyright (C) 2002, 2003 Ben Wing. |
462 | 6 |
7 This file is part of XEmacs. | |
8 | |
9 XEmacs is free software; you can redistribute it and/or modify it | |
10 under the terms of the GNU General Public License as published by the | |
11 Free Software Foundation; either version 2, or (at your option) any | |
12 later version. | |
13 | |
14 XEmacs is distributed in the hope that it will be useful, but WITHOUT | |
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
17 for more details. | |
18 | |
19 You should have received a copy of the GNU General Public License | |
20 along with XEmacs; see the file COPYING. If not, write to | |
21 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
22 Boston, MA 02111-1307, USA. */ | |
23 | |
24 /* Synched up with: Not in FSF. */ | |
25 | |
4908
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4882
diff
changeset
|
26 #define THIS_IS_GTK |
4881
a4322ac49e37
break out common separate-into-runs routines into redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
3479
diff
changeset
|
27 #include "redisplay-xlike-inc.c" |
462 | 28 |
29 /***************************************************************************** | |
4908
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4882
diff
changeset
|
30 Draw a shadow around the given area using the standard theme engine routines. |
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4882
diff
changeset
|
31 ****************************************************************************/ |
462 | 32 |
33 static void | |
4908
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4882
diff
changeset
|
34 XLIKE_bevel_area (struct window *w, face_index UNUSED (findex), |
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4882
diff
changeset
|
35 int x, int y, int width, int height, |
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4882
diff
changeset
|
36 int shadow_thickness, int UNUSED (edges), |
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4882
diff
changeset
|
37 enum edge_style style) |
462 | 38 { |
39 struct frame *f = XFRAME (w->frame); | |
4908
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4882
diff
changeset
|
40 GdkWindow *x_win = GET_GTK_WIDGET_WINDOW (FRAME_GTK_TEXT_WIDGET (f)); |
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4882
diff
changeset
|
41 GtkStyle *gstyle = FRAME_GTK_TEXT_WIDGET (f)->style; |
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4882
diff
changeset
|
42 GtkShadowType stype; |
462 | 43 |
4908
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4882
diff
changeset
|
44 if (shadow_thickness == 0) |
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4882
diff
changeset
|
45 stype = GTK_SHADOW_NONE; |
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4882
diff
changeset
|
46 else |
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4882
diff
changeset
|
47 switch (style) |
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4882
diff
changeset
|
48 { |
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4882
diff
changeset
|
49 case EDGE_BEVEL_IN: style = GTK_SHADOW_IN; break; |
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4882
diff
changeset
|
50 case EDGE_BEVEL_OUT: style = GTK_SHADOW_OUT; break; |
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4882
diff
changeset
|
51 case EDGE_ETCHED_IN: style = GTK_SHADOW_ETCHED_IN; break; |
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4882
diff
changeset
|
52 case EDGE_ETCHED_OUT: style = GTK_SHADOW_ETCHED_OUT; break; |
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4882
diff
changeset
|
53 default: ABORT (); style = GTK_SHADOW_OUT; |
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4882
diff
changeset
|
54 } |
462 | 55 |
56 /* Do we want to have some magic constants to set | |
57 GTK_SHADOW_ETCHED_IN or GTK_SHADOW_ETCHED_OUT? */ | |
58 | |
4908
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4882
diff
changeset
|
59 gtk_paint_shadow (gstyle, x_win, GTK_STATE_NORMAL, stype, NULL, |
462 | 60 FRAME_GTK_TEXT_WIDGET (f), "modeline", |
61 x, y, width, height); | |
62 } | |
63 | |
64 | |
65 | |
66 /* Make audible bell. */ | |
67 static void | |
4908
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4882
diff
changeset
|
68 XLIKE_ring_bell (struct device *UNUSED (d), int volume, int UNUSED (pitch), |
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4882
diff
changeset
|
69 int UNUSED (duration)) |
462 | 70 { |
714 | 71 /* Gdk does not allow us to control the duration / pitch / volume */ |
72 if (volume > 0) | |
73 { | |
74 gdk_beep (); | |
75 } | |
462 | 76 } |
77 | |
78 | |
79 /* This makes me feel incredibly dirty... but there is no other way to | |
80 get this done right other than calling clear_area before every | |
81 single $#!%@ing piece of text, which I do NOT want to do. */ | |
82 #define USE_X_SPECIFIC_DRAW_ROUTINES 1 | |
83 | |
4908
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4882
diff
changeset
|
84 #include "sysgdkx.h" |
462 | 85 |
4908
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4882
diff
changeset
|
86 static void |
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4882
diff
changeset
|
87 gdk_draw_text_image (GdkDrawable *drawable, |
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4882
diff
changeset
|
88 GdkFont *font, |
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4882
diff
changeset
|
89 GdkGC *gc, |
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4882
diff
changeset
|
90 gint x, |
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4882
diff
changeset
|
91 gint y, |
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4882
diff
changeset
|
92 const gchar *text, |
b3ce27ca7647
various fixes related to gtk, redisplay-xlike-inc.c
Ben Wing <ben@xemacs.org>
parents:
4882
diff
changeset
|
93 gint text_length) |
462 | 94 { |
95 #if !USE_X_SPECIFIC_DRAW_ROUTINES | |
96 int width = gdk_text_measure (font, text, text_length); | |
97 int height = gdk_text_height (font, text, text_length); | |
98 | |
99 gdk_draw_rectangle (drawable, gc, TRUE, x, y, width, height); | |
100 gdk_draw_text (drawable, font, gc, x, y, text, text_length); | |
101 #else | |
102 GdkWindowPrivate *drawable_private; | |
103 GdkFontPrivate *font_private; | |
104 GdkGCPrivate *gc_private; | |
105 | |
106 g_return_if_fail (drawable != NULL); | |
107 g_return_if_fail (font != NULL); | |
108 g_return_if_fail (gc != NULL); | |
109 g_return_if_fail (text != NULL); | |
110 | |
111 drawable_private = (GdkWindowPrivate*) drawable; | |
112 if (drawable_private->destroyed) | |
113 return; | |
114 gc_private = (GdkGCPrivate*) gc; | |
115 font_private = (GdkFontPrivate*) font; | |
116 | |
117 if (font->type == GDK_FONT_FONT) | |
118 { | |
119 XFontStruct *xfont = (XFontStruct *) font_private->xfont; | |
120 XSetFont(drawable_private->xdisplay, gc_private->xgc, xfont->fid); | |
121 if ((xfont->min_byte1 == 0) && (xfont->max_byte1 == 0)) | |
122 { | |
123 XDrawImageString (drawable_private->xdisplay, drawable_private->xwindow, | |
124 gc_private->xgc, x, y, text, text_length); | |
125 } | |
126 else | |
127 { | |
128 XDrawImageString16 (drawable_private->xdisplay, drawable_private->xwindow, | |
129 gc_private->xgc, x, y, (XChar2b *) text, text_length / 2); | |
130 } | |
131 } | |
132 else if (font->type == GDK_FONT_FONTSET) | |
133 { | |
134 XFontSet fontset = (XFontSet) font_private->xfont; | |
135 XmbDrawImageString (drawable_private->xdisplay, drawable_private->xwindow, | |
136 fontset, gc_private->xgc, x, y, text, text_length); | |
137 } | |
138 else | |
139 g_error("undefined font type\n"); | |
140 #endif | |
141 } | |
142 | |
143 static void | |
144 our_draw_bitmap (GdkDrawable *drawable, | |
145 GdkGC *gc, | |
146 GdkPixmap *src, | |
147 gint xsrc, | |
148 gint ysrc, | |
149 gint xdest, | |
150 gint ydest, | |
151 gint width, | |
152 gint height) | |
153 { | |
154 GdkWindowPrivate *drawable_private; | |
155 GdkWindowPrivate *src_private; | |
156 GdkGCPrivate *gc_private; | |
157 | |
158 g_return_if_fail (drawable != NULL); | |
159 g_return_if_fail (src != NULL); | |
160 g_return_if_fail (gc != NULL); | |
161 | |
162 drawable_private = (GdkWindowPrivate*) drawable; | |
163 src_private = (GdkWindowPrivate*) src; | |
164 if (drawable_private->destroyed || src_private->destroyed) | |
165 return; | |
166 gc_private = (GdkGCPrivate*) gc; | |
167 | |
168 if (width == -1) | |
169 width = src_private->width; | |
170 if (height == -1) | |
171 height = src_private->height; | |
172 | |
173 XCopyPlane (drawable_private->xdisplay, | |
174 src_private->xwindow, | |
175 drawable_private->xwindow, | |
176 gc_private->xgc, | |
177 xsrc, ysrc, | |
178 width, height, | |
179 xdest, ydest, 1L); | |
180 } |