You should have received a copy of the GNU General Public License
along with GNU Emacs; see the file COPYING. If not, write to
-the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA. */
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA. */
#include <config.h>
-#include <signal.h>
#include <stdio.h>
#include <math.h>
int width = FRAME_PIXEL_WIDTH (f);
int y = nlines * FRAME_LINE_HEIGHT (f);
- BLOCK_INPUT;
- x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
- 0, y, width, height, False);
- UNBLOCK_INPUT;
+ /* height can be zero here. */
+ if (height > 0 && width > 0)
+ {
+ BLOCK_INPUT;
+ x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
+ 0, y, width, height, False);
+ UNBLOCK_INPUT;
+ }
if (WINDOWP (f->tool_bar_window))
clear_glyph_matrix (XWINDOW (f->tool_bar_window)->current_matrix);
BLOCK_INPUT;
{
- Atom type, *atoms = 0;
+ Atom type;
+ unsigned char *catoms;
int format = 0;
unsigned long nitems = 0;
unsigned long bytes_after;
FRAME_X_DISPLAY_INFO (f)->Xatom_wm_protocols,
(long)0, (long)100, False, XA_ATOM,
&type, &format, &nitems, &bytes_after,
- (unsigned char **) &atoms)
+ &catoms)
== Success)
&& format == 32 && type == XA_ATOM)
- while (nitems > 0)
- {
- nitems--;
- if (atoms[nitems] == FRAME_X_DISPLAY_INFO (f)->Xatom_wm_delete_window)
- need_delete = 0;
- else if (atoms[nitems] == FRAME_X_DISPLAY_INFO (f)->Xatom_wm_take_focus)
- need_focus = 0;
- else if (atoms[nitems] == FRAME_X_DISPLAY_INFO (f)->Xatom_wm_save_yourself)
- need_save = 0;
- }
- if (atoms) XFree ((char *) atoms);
+ {
+ Atom *atoms = (Atom *) catoms;
+ while (nitems > 0)
+ {
+ nitems--;
+ if (atoms[nitems]
+ == FRAME_X_DISPLAY_INFO (f)->Xatom_wm_delete_window)
+ need_delete = 0;
+ else if (atoms[nitems]
+ == FRAME_X_DISPLAY_INFO (f)->Xatom_wm_take_focus)
+ need_focus = 0;
+ else if (atoms[nitems]
+ == FRAME_X_DISPLAY_INFO (f)->Xatom_wm_save_yourself)
+ need_save = 0;
+ }
+ }
+ if (catoms)
+ XFree (catoms);
}
{
Atom props [10];
/* Create an X fontset on frame F with base font name BASE_FONTNAME. */
+char xic_defaut_fontset[] = "-*-*-*-r-normal--14-*-*-*-*-*-*-*";
+
+/* Create an Xt fontset spec from the name of a base font.
+ If `motif' is True use the Motif syntax. */
+char *
+xic_create_fontsetname (base_fontname, motif)
+ char *base_fontname;
+ Bool motif;
+{
+ const char *sep = motif ? ";" : ",";
+ char *fontsetname;
+
+ /* Make a fontset name from the base font name. */
+ if (xic_defaut_fontset == base_fontname)
+ { /* There is no base font name, use the default. */
+ int len = strlen (base_fontname) + 2;
+ fontsetname = xmalloc (len);
+ bzero (fontsetname, len);
+ strcpy (fontsetname, base_fontname);
+ }
+ else
+ {
+ /* Make a fontset name from the base font name.
+ The font set will be made of the following elements:
+ - the base font.
+ - the base font where the charset spec is replaced by -*-*.
+ - the same but with the family also replaced with -*-*-. */
+ char *p = base_fontname;
+ int i;
+
+ for (i = 0; *p; p++)
+ if (*p == '-') i++;
+ if (i != 14)
+ { /* As the font name doesn't conform to XLFD, we can't
+ modify it to generalize it to allcs and allfamilies.
+ Use the specified font plus the default. */
+ int len = strlen (base_fontname) + strlen (xic_defaut_fontset) + 3;
+ fontsetname = xmalloc (len);
+ bzero (fontsetname, len);
+ strcpy (fontsetname, base_fontname);
+ strcat (fontsetname, sep);
+ strcat (fontsetname, xic_defaut_fontset);
+ }
+ else
+ {
+ int len;
+ char *p1 = NULL, *p2 = NULL;
+ char *font_allcs = NULL;
+ char *font_allfamilies = NULL;
+ char *font_all = NULL;
+ char *allcs = "*-*-*-*-*-*-*";
+ char *allfamilies = "-*-*-";
+ char *all = "*-*-*-*-";
+
+ for (i = 0, p = base_fontname; i < 8; p++)
+ {
+ if (*p == '-')
+ {
+ i++;
+ if (i == 3)
+ p1 = p + 1;
+ else if (i == 7)
+ p2 = p + 1;
+ }
+ }
+ /* Build the font spec that matches all charsets. */
+ len = p - base_fontname + strlen (allcs) + 1;
+ font_allcs = (char *) alloca (len);
+ bzero (font_allcs, len);
+ bcopy (base_fontname, font_allcs, p - base_fontname);
+ strcat (font_allcs, allcs);
+
+ /* Build the font spec that matches all families. */
+ len = p - p1 + strlen (allcs) + strlen (allfamilies) + 1;
+ font_allfamilies = (char *) alloca (len);
+ bzero (font_allfamilies, len);
+ strcpy (font_allfamilies, allfamilies);
+ bcopy (p1, font_allfamilies + strlen (allfamilies), p - p1);
+ strcat (font_allfamilies, allcs);
+
+ /* Build the font spec that matches all. */
+ len = p - p2 + strlen (allcs) + strlen (all) + strlen (allfamilies) + 1;
+ font_all = (char *) alloca (len);
+ bzero (font_all, len);
+ strcpy (font_all, allfamilies);
+ strcat (font_all, all);
+ bcopy (p2, font_all + strlen (all) + strlen (allfamilies), p - p2);
+ strcat (font_all, allcs);
+
+ /* Build the actual font set name. */
+ len = strlen (base_fontname) + strlen (font_allcs)
+ + strlen (font_allfamilies) + strlen (font_all) + 5;
+ fontsetname = xmalloc (len);
+ bzero (fontsetname, len);
+ strcpy (fontsetname, base_fontname);
+ strcat (fontsetname, sep);
+ strcat (fontsetname, font_allcs);
+ strcat (fontsetname, sep);
+ strcat (fontsetname, font_allfamilies);
+ strcat (fontsetname, sep);
+ strcat (fontsetname, font_all);
+ }
+ }
+ if (motif)
+ strcat (fontsetname, ":");
+ return fontsetname;
+}
+
static XFontSet
xic_create_xfontset (f, base_fontname)
struct frame *f;
char *def_string;
Lisp_Object rest, frame;
+ if (!base_fontname)
+ base_fontname = xic_defaut_fontset;
+
/* See if there is another frame already using same fontset. */
FOR_EACH_FRAME (rest, frame)
{
if (!xfs)
{
+ char *fontsetname = xic_create_fontsetname (base_fontname, False);
+
/* New fontset. */
xfs = XCreateFontSet (FRAME_X_DISPLAY (f),
- base_fontname, &missing_list,
+ fontsetname, &missing_list,
&missing_count, &def_string);
if (missing_list)
XFreeStringList (missing_list);
+ xfree (fontsetname);
}
if (FRAME_XIC_BASE_FONTNAME (f))
if (FRAME_XIC (f))
return;
+ /* Create X fontset. */
+ xfs = xic_create_xfontset
+ (f, (FRAME_FONTSET (f) < 0) ? NULL
+ : (char *) SDATA (fontset_ascii (FRAME_FONTSET (f))));
+
xim = FRAME_X_XIM (f);
if (xim)
{
XPoint spot;
XVaNestedList preedit_attr;
XVaNestedList status_attr;
- char *base_fontname;
- int fontset;
s_area.x = 0; s_area.y = 0; s_area.width = 1; s_area.height = 1;
spot.x = 0; spot.y = 1;
- /* Create X fontset. */
- fontset = FRAME_FONTSET (f);
- if (fontset < 0)
- base_fontname = "-*-*-*-r-normal--14-*-*-*-*-*-*-*";
- else
- {
- /* Determine the base fontname from the ASCII font name of
- FONTSET. */
- char *ascii_font = (char *) SDATA (fontset_ascii (fontset));
- char *p = ascii_font;
- int i;
-
- for (i = 0; *p; p++)
- if (*p == '-') i++;
- if (i != 14)
- /* As the font name doesn't conform to XLFD, we can't
- modify it to get a suitable base fontname for the
- frame. */
- base_fontname = "-*-*-*-r-normal--14-*-*-*-*-*-*-*";
- else
- {
- int len = strlen (ascii_font) + 1;
- char *p1 = NULL;
-
- for (i = 0, p = ascii_font; i < 8; p++)
- {
- if (*p == '-')
- {
- i++;
- if (i == 3)
- p1 = p + 1;
- }
- }
- base_fontname = (char *) alloca (len);
- bzero (base_fontname, len);
- strcpy (base_fontname, "-*-*-");
- bcopy (p1, base_fontname + 5, p - p1);
- strcat (base_fontname, "*-*-*-*-*-*-*");
- }
- }
- xfs = xic_create_xfontset (f, base_fontname);
/* Determine XIC style. */
if (xic_style == 0)
Atom prop_atom;
int rc;
Lisp_Object prop_value = Qnil;
- char *tmp_data = NULL;
+ unsigned char *tmp_data = NULL;
Atom actual_type;
Atom target_type = XA_STRING;
int actual_format;
rc = XGetWindowProperty (FRAME_X_DISPLAY (f), target_window,
prop_atom, 0, 0, False, target_type,
&actual_type, &actual_format, &actual_size,
- &bytes_remaining, (unsigned char **) &tmp_data);
+ &bytes_remaining, &tmp_data);
if (rc == Success)
{
int size = bytes_remaining;
! NILP (delete_p), target_type,
&actual_type, &actual_format,
&actual_size, &bytes_remaining,
- (unsigned char **) &tmp_data);
+ &tmp_data);
if (rc == Success && tmp_data)
{
/* The man page for XGetWindowProperty says:
long *ldata = (long *) tmp_data;
for (i = 0; i < actual_size; ++i)
- idata[i]= (int) ldata[i];
+ idata[i] = (int) ldata[i];
}
if (NILP (vector_ret_p))
prop_value = make_string (tmp_data, size);
else
prop_value = x_property_data_to_lisp (f,
- (unsigned char *) tmp_data,
+ tmp_data,
actual_type,
actual_format,
actual_size);
static void show_hourglass P_ ((struct atimer *));
static void hide_hourglass P_ ((void));
+/* Return non-zero if houglass timer has been started or hourglass is shown. */
+
+int
+hourglass_started ()
+{
+ return hourglass_shown_p || hourglass_atimer != NULL;
+}
+
/* Cancel a currently active hourglass timer, and start a new one. */
EMACS_TIME delay;
int secs, usecs = 0;
+ /* Don't bother for ttys. */
+ if (NILP (Vwindow_system))
+ return;
+
cancel_hourglass ();
if (INTEGERP (Vhourglass_delay)
check_x ();
- /* Use this general default value to start with until we know if
- this frame has a specified name. */
- Vx_resource_name = Vinvocation_name;
#ifdef MULTI_KBOARD
kb = dpyinfo->kboard;
&& !EQ (name, Qunbound)
&& !NILP (name))
error ("Invalid frame name--not a string or nil");
- Vx_resource_name = name;
frame = Qnil;
GCPRO3 (parms, name, frame);
clear_glyph_matrix (w->desired_matrix);
clear_glyph_matrix (w->current_matrix);
SET_TEXT_POS (pos, BEGV, BEGV_BYTE);
- try_window (FRAME_ROOT_WINDOW (f), pos);
+ try_window (FRAME_ROOT_WINDOW (f), pos, 0);
/* Compute width and height of the tooltip. */
width = height = 0;