aboutsummaryrefslogtreecommitdiffstats
path: root/src/xterm.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/xterm.c')
-rw-r--r--src/xterm.c159
1 files changed, 79 insertions, 80 deletions
diff --git a/src/xterm.c b/src/xterm.c
index a571d02557..b6e596b854 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -1,8 +1,6 @@
/* X Communication module for terminals which understand the X protocol.
-Copyright (C) 1989, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
- 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
- Free Software Foundation, Inc.
+Copyright (C) 1989, 1993-2011 Free Software Foundation, Inc.
This file is part of GNU Emacs.
@@ -90,9 +88,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
-#ifdef HAVE_UNISTD_H
+
#include <unistd.h>
-#endif
#ifdef USE_GTK
#include "gtkutil.h"
@@ -148,10 +145,6 @@ int use_xim = 0; /* configure --without-xim */
-/* Non-nil means Emacs uses toolkit scroll bars. */
-
-Lisp_Object Vx_toolkit_scroll_bars;
-
/* Non-zero means that a HELP_EVENT has been generated since Emacs
start. */
@@ -160,14 +153,6 @@ static int any_help_event_p;
/* Last window where we saw the mouse. Used by mouse-autoselect-window. */
static Lisp_Object last_window;
-/* Non-zero means make use of UNDERLINE_POSITION font properties. */
-
-int x_use_underline_position_properties;
-
-/* Non-zero means to draw the underline at the same place as the descent line. */
-
-int x_underline_at_descent_line;
-
/* This is a chain of structures for all the X displays currently in
use. */
@@ -208,11 +193,6 @@ static String Xt_default_resources[] = {0};
static int toolkit_scroll_bar_interaction;
-/* Non-zero means to not move point as a result of clicking on a
- frame to focus it (when focus-follows-mouse is nil). */
-
-int x_mouse_click_focus_ignore_position;
-
/* Non-zero timeout value means ignore next mouse click if it arrives
before that timeout elapses (i.e. as part of the same sequence of
events resulting from clicking on a frame to select it). */
@@ -283,10 +263,6 @@ static int input_signal_count;
static int x_noop_count;
-/* The keysyms to use for the various modifiers. */
-
-Lisp_Object Vx_alt_keysym, Vx_hyper_keysym, Vx_meta_keysym, Vx_super_keysym;
-Lisp_Object Vx_keysym_table;
static Lisp_Object Qalt, Qhyper, Qmeta, Qsuper, Qmodifier_value;
static Lisp_Object Qvendor_specific_keysyms;
@@ -303,11 +279,34 @@ Lisp_Object Qx_gtk_map_stock;
/* Some functions take this as char *, not const char *. */
static char emacs_class[] = EMACS_CLASS;
-/* Used in x_flush. */
+/* XEmbed implementation. */
+
+#define XEMBED_VERSION 0
+
+enum xembed_info
+ {
+ XEMBED_MAPPED = 1 << 0
+ };
-extern XrmDatabase x_load_resources (Display *, const char *, const char *,
- const char *);
-extern int x_bitmap_mask (FRAME_PTR, int);
+enum xembed_message
+ {
+ XEMBED_EMBEDDED_NOTIFY = 0,
+ XEMBED_WINDOW_ACTIVATE = 1,
+ XEMBED_WINDOW_DEACTIVATE = 2,
+ XEMBED_REQUEST_FOCUS = 3,
+ XEMBED_FOCUS_IN = 4,
+ XEMBED_FOCUS_OUT = 5,
+ XEMBED_FOCUS_NEXT = 6,
+ XEMBED_FOCUS_PREV = 7,
+
+ XEMBED_MODALITY_ON = 10,
+ XEMBED_MODALITY_OFF = 11,
+ XEMBED_REGISTER_ACCELERATOR = 12,
+ XEMBED_UNREGISTER_ACCELERATOR = 13,
+ XEMBED_ACTIVATE_ACCELERATOR = 14
+ };
+
+/* Used in x_flush. */
static int x_alloc_nearest_color_1 (Display *, Colormap, XColor *);
static void x_set_window_size_1 (struct frame *, int, int, int);
@@ -409,9 +408,8 @@ struct record event_record[100];
int event_record_index;
-record_event (locus, type)
- char *locus;
- int type;
+void
+record_event (char *locus, int type)
{
if (event_record_index == sizeof (event_record) / sizeof (struct record))
event_record_index = 0;
@@ -489,14 +487,14 @@ x_set_frame_alpha (struct frame *f)
&data);
if (rc == Success && actual != None)
- if (*(unsigned long *)data == opac)
- {
- XFree ((void *) data);
- x_uncatch_errors ();
- return;
- }
- else
+ {
XFree ((void *) data);
+ if (*(unsigned long *)data == opac)
+ {
+ x_uncatch_errors ();
+ return;
+ }
+ }
x_uncatch_errors ();
}
@@ -900,6 +898,7 @@ static void x_draw_relief_rect (struct frame *, int, int, int, int,
XRectangle *);
static void x_draw_box_rect (struct glyph_string *, int, int, int, int,
int, int, int, XRectangle *);
+static void x_scroll_bar_clear (struct frame *);
#if GLYPH_DEBUG
static void x_check_font (struct frame *, struct font *);
@@ -1364,7 +1363,7 @@ x_draw_glyphless_glyph_string_foreground (struct glyph_string *s)
glyph->u.glyphless.ch)
: XCHAR_TABLE (Vglyphless_char_display)->extras[0]);
if (STRINGP (acronym))
- str = (char *) SDATA (acronym);
+ str = SSDATA (acronym);
}
}
else if (glyph->u.glyphless.method == GLYPHLESS_DISPLAY_HEX_CODE)
@@ -5614,7 +5613,7 @@ x_scroll_bar_report_motion (FRAME_PTR *fp, Lisp_Object *bar_window, enum scroll_
Clear out the scroll bars, and ask for expose events, so we can
redraw them. */
-void
+static void
x_scroll_bar_clear (FRAME_PTR f)
{
#ifndef USE_TOOLKIT_SCROLL_BARS
@@ -5764,6 +5763,10 @@ event_handler_gdk (GdkXEvent *gxev, GdkEvent *ev, gpointer data)
#endif /* USE_GTK */
+static void xembed_send_message (struct frame *f, Time time,
+ enum xembed_message message,
+ long detail, long data1, long data2);
+
/* Handles the XEvent EVENT on display DPYINFO.
*FINISH is X_EVENT_GOTO_OUT if caller should stop reading events.
@@ -6498,7 +6501,6 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish,
{
/* Decode the input data. */
int require;
- unsigned char *p;
/* The input should be decoded with `coding_system'
which depends on which X*LookupString function
@@ -7947,7 +7949,7 @@ x_new_font (struct frame *f, Lisp_Object font_object, int fontset)
&& (FRAME_XIC_STYLE (f) & (XIMPreeditPosition | XIMStatusArea)))
{
BLOCK_INPUT;
- xic_set_xfontset (f, SDATA (fontset_ascii (fontset)));
+ xic_set_xfontset (f, SSDATA (fontset_ascii (fontset)));
UNBLOCK_INPUT;
}
#endif
@@ -8438,7 +8440,7 @@ get_current_wm_state (struct frame *f,
for (i = 0; i < actual_size; ++i)
{
Atom a = ((Atom*)tmp_data)[i];
- if (a == dpyinfo->Xatom_net_wm_state_maximized_horz)
+ if (a == dpyinfo->Xatom_net_wm_state_maximized_horz)
{
if (*size_state == FULLSCREEN_HEIGHT)
*size_state = FULLSCREEN_MAXIMIZED;
@@ -8469,7 +8471,6 @@ do_ewmh_fullscreen (struct frame *f)
{
struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
int have_net_atom = wm_supports (f, dpyinfo->Xatom_net_wm_state);
- Lisp_Object lval = get_frame_param (f, Qfullscreen);
int cur, dummy;
get_current_wm_state (f, FRAME_OUTER_WINDOW (f), &cur, &dummy);
@@ -8587,9 +8588,13 @@ x_check_fullscreen (struct frame *f)
if (f->output_data.x->parent_desc != FRAME_X_DISPLAY_INFO (f)->root_window)
return; /* Only fullscreen without WM or with EWM hints (above). */
+ /* Setting fullscreen to nil doesn't do anything. We could save the
+ last non-fullscreen size and restore it, but it seems like a
+ lot of work for this unusual case (no window manager running). */
+
if (f->want_fullscreen != FULLSCREEN_NONE)
{
- int width = FRAME_COLS (f), height = FRAME_LINES (f);
+ int width = FRAME_PIXEL_WIDTH (f), height = FRAME_PIXEL_HEIGHT (f);
struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
switch (f->want_fullscreen)
@@ -8607,12 +8612,8 @@ x_check_fullscreen (struct frame *f)
height = x_display_pixel_height (dpyinfo);
}
- if (FRAME_COLS (f) != width || FRAME_LINES (f) != height)
- {
- change_frame_size (f, height, width, 0, 1, 0);
- SET_FRAME_GARBAGED (f);
- cancel_mouse_face (f);
- }
+ XResizeWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
+ width, height);
}
}
@@ -8989,10 +8990,9 @@ XTframe_raise_lower (FRAME_PTR f, int raise_flag)
/* XEmbed implementation. */
-void
+static void
xembed_set_info (struct frame *f, enum xembed_info flags)
{
- Atom atom;
unsigned long data[2];
struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
@@ -9004,7 +9004,7 @@ xembed_set_info (struct frame *f, enum xembed_info flags)
32, PropModeReplace, (unsigned char *) data, 2);
}
-void
+static void
xembed_send_message (struct frame *f, Time time, enum xembed_message message, long int detail, long int data1, long int data2)
{
XEvent event;
@@ -9873,7 +9873,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
++x_initialized;
}
- if (! x_display_ok (SDATA (display_name)))
+ if (! x_display_ok (SSDATA (display_name)))
error ("Display %s can't be opened", SDATA (display_name));
#ifdef USE_GTK
@@ -9892,7 +9892,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
{
static char display_opt[] = "--display";
static char name_opt[] = "--name";
-
+
for (argc = 0; argc < NUM_ARGV; ++argc)
argv[argc] = 0;
@@ -9965,7 +9965,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
argv[argc++] = xrm_option;
}
turn_on_atimers (0);
- dpy = XtOpenDisplay (Xt_app_con, SDATA (display_name),
+ dpy = XtOpenDisplay (Xt_app_con, SSDATA (display_name),
resource_name, EMACS_CLASS,
emacs_options, XtNumber (emacs_options),
&argc, argv);
@@ -10004,8 +10004,8 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
for (share = x_display_list, tail = x_display_name_list; share;
share = share->next, tail = XCDR (tail))
- if (same_x_server (SDATA (XCAR (XCAR (tail))),
- SDATA (display_name)))
+ if (same_x_server (SSDATA (XCAR (XCAR (tail))),
+ SSDATA (display_name)))
break;
if (share)
terminal->kboard = share->terminal->kboard;
@@ -10066,7 +10066,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
/* Set the name of the terminal. */
terminal->name = (char *) xmalloc (SBYTES (display_name) + 1);
- strncpy (terminal->name, SDATA (display_name), SBYTES (display_name));
+ strncpy (terminal->name, SSDATA (display_name), SBYTES (display_name));
terminal->name[SBYTES (display_name)] = 0;
#if 0
@@ -10157,8 +10157,8 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
build_string ("PrivateColormap"),
Qnil, Qnil);
if (STRINGP (value)
- && (!strcmp (SDATA (value), "true")
- || !strcmp (SDATA (value), "on")))
+ && (!strcmp (SSDATA (value), "true")
+ || !strcmp (SSDATA (value), "on")))
dpyinfo->cmap = XCopyColormapAndFree (dpyinfo->display, dpyinfo->cmap);
}
}
@@ -10355,8 +10355,8 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
build_string ("Synchronous"),
Qnil, Qnil);
if (STRINGP (value)
- && (!strcmp (SDATA (value), "true")
- || !strcmp (SDATA (value), "on")))
+ && (!strcmp (SSDATA (value), "true")
+ || !strcmp (SSDATA (value), "on")))
XSynchronize (dpyinfo->display, True);
}
@@ -10368,13 +10368,13 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
Qnil, Qnil);
#ifdef USE_XIM
if (STRINGP (value)
- && (!strcmp (SDATA (value), "false")
- || !strcmp (SDATA (value), "off")))
+ && (!strcmp (SSDATA (value), "false")
+ || !strcmp (SSDATA (value), "off")))
use_xim = 0;
#else
if (STRINGP (value)
- && (!strcmp (SDATA (value), "true")
- || !strcmp (SDATA (value), "on")))
+ && (!strcmp (SSDATA (value), "true")
+ || !strcmp (SSDATA (value), "on")))
use_xim = 1;
#endif
}
@@ -10750,7 +10750,7 @@ syms_of_xterm (void)
#endif
DEFVAR_BOOL ("x-use-underline-position-properties",
- &x_use_underline_position_properties,
+ x_use_underline_position_properties,
doc: /* *Non-nil means make use of UNDERLINE_POSITION font properties.
A value of nil means ignore them. If you encounter fonts with bogus
UNDERLINE_POSITION font properties, for example 7x13 on XFree prior
@@ -10760,7 +10760,7 @@ sizes. */);
x_use_underline_position_properties = 1;
DEFVAR_BOOL ("x-underline-at-descent-line",
- &x_underline_at_descent_line,
+ x_underline_at_descent_line,
doc: /* *Non-nil means to draw the underline at the same place as the descent line.
A value of nil means to draw the underline according to the value of the
variable `x-use-underline-position-properties', which is usually at the
@@ -10768,7 +10768,7 @@ baseline level. The default value is nil. */);
x_underline_at_descent_line = 0;
DEFVAR_BOOL ("x-mouse-click-focus-ignore-position",
- &x_mouse_click_focus_ignore_position,
+ x_mouse_click_focus_ignore_position,
doc: /* Non-nil means that a mouse click to focus a frame does not move point.
This variable is only used when the window manager requires that you
click on a frame to select it (give it focus). In that case, a value
@@ -10777,7 +10777,7 @@ reflect the mouse click position, while a non-nil value means that the
selected window or cursor position is preserved. */);
x_mouse_click_focus_ignore_position = 0;
- DEFVAR_LISP ("x-toolkit-scroll-bars", &Vx_toolkit_scroll_bars,
+ DEFVAR_LISP ("x-toolkit-scroll-bars", Vx_toolkit_scroll_bars,
doc: /* Which toolkit scroll bars Emacs uses, if any.
A value of nil means Emacs doesn't use toolkit scroll bars.
With the X Window system, the value is a symbol describing the
@@ -10810,35 +10810,35 @@ With MS Windows, the value is t. */);
Qsuper = intern_c_string ("super");
Fput (Qsuper, Qmodifier_value, make_number (super_modifier));
- DEFVAR_LISP ("x-alt-keysym", &Vx_alt_keysym,
+ DEFVAR_LISP ("x-alt-keysym", Vx_alt_keysym,
doc: /* Which keys Emacs uses for the alt modifier.
This should be one of the symbols `alt', `hyper', `meta', `super'.
For example, `alt' means use the Alt_L and Alt_R keysyms. The default
is nil, which is the same as `alt'. */);
Vx_alt_keysym = Qnil;
- DEFVAR_LISP ("x-hyper-keysym", &Vx_hyper_keysym,
+ DEFVAR_LISP ("x-hyper-keysym", Vx_hyper_keysym,
doc: /* Which keys Emacs uses for the hyper modifier.
This should be one of the symbols `alt', `hyper', `meta', `super'.
For example, `hyper' means use the Hyper_L and Hyper_R keysyms. The
default is nil, which is the same as `hyper'. */);
Vx_hyper_keysym = Qnil;
- DEFVAR_LISP ("x-meta-keysym", &Vx_meta_keysym,
+ DEFVAR_LISP ("x-meta-keysym", Vx_meta_keysym,
doc: /* Which keys Emacs uses for the meta modifier.
This should be one of the symbols `alt', `hyper', `meta', `super'.
For example, `meta' means use the Meta_L and Meta_R keysyms. The
default is nil, which is the same as `meta'. */);
Vx_meta_keysym = Qnil;
- DEFVAR_LISP ("x-super-keysym", &Vx_super_keysym,
+ DEFVAR_LISP ("x-super-keysym", Vx_super_keysym,
doc: /* Which keys Emacs uses for the super modifier.
This should be one of the symbols `alt', `hyper', `meta', `super'.
For example, `super' means use the Super_L and Super_R keysyms. The
default is nil, which is the same as `super'. */);
Vx_super_keysym = Qnil;
- DEFVAR_LISP ("x-keysym-table", &Vx_keysym_table,
+ DEFVAR_LISP ("x-keysym-table", Vx_keysym_table,
doc: /* Hash table of character codes indexed by X keysym codes. */);
Vx_keysym_table = make_hash_table (Qeql, make_number (900),
make_float (DEFAULT_REHASH_SIZE),
@@ -10847,4 +10847,3 @@ default is nil, which is the same as `super'. */);
}
#endif /* HAVE_X_WINDOWS */
-