/* 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.
#include <sys/types.h>
#endif /* makedev */
-#ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
-#endif /* ! defined (HAVE_SYS_IOCTL_H) */
#include "systime.h"
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
-#ifdef HAVE_UNISTD_H
+
#include <unistd.h>
-#endif
#ifdef USE_GTK
#include "gtkutil.h"
\f
-/* 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. */
/* 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. */
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). */
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;
/* 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
-extern XrmDatabase x_load_resources (Display *, const char *, const char *,
- const char *);
-extern int x_bitmap_mask (FRAME_PTR, int);
+enum xembed_info
+ {
+ XEMBED_MAPPED = 1 << 0
+ };
+
+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);
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;
}
#define OPAQUE 0xffffffff
-#define OPACITY "_NET_WM_WINDOW_OPACITY"
void
x_set_frame_alpha (struct frame *f)
unsigned long n, left;
x_catch_errors (dpy);
- rc = XGetWindowProperty (dpy, win, XInternAtom(dpy, OPACITY, False),
+ rc = XGetWindowProperty (dpy, win, dpyinfo->Xatom_net_wm_window_opacity,
0L, 1L, False, XA_CARDINAL,
&actual, &format, &n, &left,
&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 ();
}
x_catch_errors (dpy);
- XChangeProperty (dpy, win, XInternAtom (dpy, OPACITY, False),
+ XChangeProperty (dpy, win, dpyinfo->Xatom_net_wm_window_opacity,
XA_CARDINAL, 32, PropModeReplace,
(unsigned char *) &opac, 1L);
x_uncatch_errors ();
x_update_window_begin (struct window *w)
{
struct frame *f = XFRAME (WINDOW_FRAME (w));
- struct x_display_info *display_info = FRAME_X_DISPLAY_INFO (f);
+ Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
updated_window = w;
set_output_cursor (&w->cursor);
BLOCK_INPUT;
- if (f == display_info->mouse_face_mouse_frame)
+ if (f == hlinfo->mouse_face_mouse_frame)
{
/* Don't do highlighting for mouse motion during the update. */
- display_info->mouse_face_defer = 1;
+ hlinfo->mouse_face_defer = 1;
/* If F needs to be redrawn, simply forget about any prior mouse
highlighting. */
if (FRAME_GARBAGED_P (f))
- display_info->mouse_face_window = Qnil;
+ hlinfo->mouse_face_window = Qnil;
}
UNBLOCK_INPUT;
static void
x_update_window_end (struct window *w, int cursor_on_p, int mouse_face_overwritten_p)
{
- struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (XFRAME (w->frame));
+ Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame));
if (!w->pseudo_window_p)
{
XTframe_up_to_date to redisplay the mouse highlight. */
if (mouse_face_overwritten_p)
{
- dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1;
- dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1;
- dpyinfo->mouse_face_window = Qnil;
+ hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
+ hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
+ hlinfo->mouse_face_window = Qnil;
}
updated_window = NULL;
x_update_end (struct frame *f)
{
/* Mouse highlight may be displayed again. */
- FRAME_X_DISPLAY_INFO (f)->mouse_face_defer = 0;
+ MOUSE_HL_INFO (f)->mouse_face_defer = 0;
#ifndef XFlush
BLOCK_INPUT;
{
if (FRAME_X_P (f))
{
- struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
+ Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
- if (dpyinfo->mouse_face_deferred_gc
- || f == dpyinfo->mouse_face_mouse_frame)
+ if (hlinfo->mouse_face_deferred_gc
+ || f == hlinfo->mouse_face_mouse_frame)
{
BLOCK_INPUT;
- if (dpyinfo->mouse_face_mouse_frame)
- note_mouse_highlight (dpyinfo->mouse_face_mouse_frame,
- dpyinfo->mouse_face_mouse_x,
- dpyinfo->mouse_face_mouse_y);
- dpyinfo->mouse_face_deferred_gc = 0;
+ if (hlinfo->mouse_face_mouse_frame)
+ note_mouse_highlight (hlinfo->mouse_face_mouse_frame,
+ hlinfo->mouse_face_mouse_x,
+ hlinfo->mouse_face_mouse_y);
+ hlinfo->mouse_face_deferred_gc = 0;
UNBLOCK_INPUT;
}
}
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 *);
struct face *face;
/* What face has to be used last for the mouse face? */
- face_id = FRAME_X_DISPLAY_INFO (s->f)->mouse_face_face_id;
+ face_id = MOUSE_HL_INFO (s->f)->mouse_face_face_id;
face = FACE_FROM_ID (s->f, face_id);
if (face == NULL)
face = FACE_FROM_ID (s->f, MOUSE_FACE_ID);
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_HEXA_CODE)
+ else if (glyph->u.glyphless.method == GLYPHLESS_DISPLAY_HEX_CODE)
{
sprintf ((char *) buf, "%0*X",
glyph->u.glyphless.ch < 0x10000 ? 4 : 6,
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
#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.
struct frame *f = NULL;
struct coding_system coding;
XEvent event = *eventp;
+ Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight;
*finish = X_EVENT_NORMAL;
/* If mouse-highlight is an integer, input clears out
mouse highlighting. */
- if (!dpyinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)
+ if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)
&& (f == 0
- || !EQ (f->tool_bar_window, dpyinfo->mouse_face_window)))
+ || !EQ (f->tool_bar_window, hlinfo->mouse_face_window)))
{
- clear_mouse_face (dpyinfo);
- dpyinfo->mouse_face_hidden = 1;
+ clear_mouse_face (hlinfo);
+ hlinfo->mouse_face_hidden = 1;
}
#if defined USE_MOTIF && defined USE_TOOLKIT_SCROLL_BARS
{
/* Decode the input data. */
int require;
- unsigned char *p;
/* The input should be decoded with `coding_system'
which depends on which X*LookupString function
f = x_top_window_to_frame (dpyinfo, event.xcrossing.window);
if (f)
{
- if (f == dpyinfo->mouse_face_mouse_frame)
+ if (f == hlinfo->mouse_face_mouse_frame)
{
/* If we move outside the frame, then we're
certainly no longer on any text in the frame. */
- clear_mouse_face (dpyinfo);
- dpyinfo->mouse_face_mouse_frame = 0;
+ clear_mouse_face (hlinfo);
+ hlinfo->mouse_face_mouse_frame = 0;
}
/* Generate a nil HELP_EVENT to cancel a help-echo.
else
f = x_window_to_frame (dpyinfo, event.xmotion.window);
- if (dpyinfo->mouse_face_hidden)
+ if (hlinfo->mouse_face_hidden)
{
- dpyinfo->mouse_face_hidden = 0;
- clear_mouse_face (dpyinfo);
+ hlinfo->mouse_face_hidden = 0;
+ clear_mouse_face (hlinfo);
}
#ifdef USE_GTK
window = window_from_coordinates (f,
event.xmotion.x, event.xmotion.y,
- 0, 0, 0, 0);
+ 0, 0);
/* Window will be selected only when it is not selected now and
last mouse movement event was not in it. Minibuffer window
/* If we move outside the frame, then we're
certainly no longer on any text in the frame. */
- clear_mouse_face (dpyinfo);
+ clear_mouse_face (hlinfo);
}
/* If the contents of the global variable help_echo_string
int x = event.xbutton.x;
int y = event.xbutton.y;
- window = window_from_coordinates (f, x, y, 0, 0, 0, 1);
+ window = window_from_coordinates (f, x, y, 0, 1);
tool_bar_p = EQ (window, f->tool_bar_window);
if (tool_bar_p && event.xbutton.button < 4)
http://freedesktop.org/wiki/Specifications/wm-spec. */
static int
-wm_supports (struct frame *f, const char *atomname)
+wm_supports (struct frame *f, Atom want_atom)
{
Atom actual_type;
unsigned long actual_size, bytes_remaining;
int i, rc, actual_format;
- Atom prop_atom;
Window wmcheck_window;
struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
Window target_window = dpyinfo->root_window;
Display *dpy = FRAME_X_DISPLAY (f);
unsigned char *tmp_data = NULL;
Atom target_type = XA_WINDOW;
- Atom want_atom;
BLOCK_INPUT;
- prop_atom = XInternAtom (dpy, "_NET_SUPPORTING_WM_CHECK", False);
-
x_catch_errors (dpy);
rc = XGetWindowProperty (dpy, target_window,
- prop_atom, 0, max_len, False, target_type,
+ dpyinfo->Xatom_net_supporting_wm_check,
+ 0, max_len, False, target_type,
&actual_type, &actual_format, &actual_size,
&bytes_remaining, &tmp_data);
dpyinfo->net_supported_window = 0;
target_type = XA_ATOM;
- prop_atom = XInternAtom (dpy, "_NET_SUPPORTED", False);
tmp_data = NULL;
rc = XGetWindowProperty (dpy, target_window,
- prop_atom, 0, max_len, False, target_type,
+ dpyinfo->Xatom_net_supported,
+ 0, max_len, False, target_type,
&actual_type, &actual_format, &actual_size,
&bytes_remaining, &tmp_data);
}
rc = 0;
- want_atom = XInternAtom (dpy, atomname, False);
for (i = 0; rc == 0 && i < dpyinfo->nr_net_supported_atoms; ++i)
rc = dpyinfo->net_supported_atoms[i] == want_atom;
}
static void
-set_wm_state (Lisp_Object frame, int add, const char *what, const char *what2)
+set_wm_state (Lisp_Object frame, int add, Atom atom, Atom value)
{
- const char *atom = "_NET_WM_STATE";
- Fx_send_client_event (frame, make_number (0), frame,
- make_unibyte_string (atom, strlen (atom)),
- make_number (32),
- /* 1 = add, 0 = remove */
+ struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (XFRAME (frame));
+
+ x_send_client_event (frame, make_number (0), frame,
+ dpyinfo->Xatom_net_wm_state,
+ make_number (32),
+ /* 1 = add, 0 = remove */
+ Fcons
+ (make_number (add ? 1 : 0),
Fcons
- (make_number (add ? 1 : 0),
- Fcons
- (make_unibyte_string (what, strlen (what)),
- what2 != 0
- ? Fcons (make_unibyte_string (what2, strlen (what2)),
- Qnil)
- : Qnil)));
+ (make_fixnum_or_float (atom),
+ value != 0
+ ? Fcons (make_fixnum_or_float (value), Qnil)
+ : Qnil)));
}
void
x_set_sticky (struct frame *f, Lisp_Object new_value, Lisp_Object old_value)
{
Lisp_Object frame;
+ struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
XSETFRAME (frame, f);
+
set_wm_state (frame, NILP (new_value) ? 0 : 1,
- "_NET_WM_STATE_STICKY", NULL);
+ dpyinfo->Xatom_net_wm_state_sticky, None);
}
/* Return the current _NET_WM_STATE.
STICKY is set to 1 if the sticky state is set, 0 if not. */
static void
-get_current_vm_state (struct frame *f,
+get_current_wm_state (struct frame *f,
Window window,
int *size_state,
int *sticky)
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;
else
*size_state = FULLSCREEN_HEIGHT;
}
- else if (a == dpyinfo->Xatom_net_wm_state_fullscreen_atom)
+ else if (a == dpyinfo->Xatom_net_wm_state_fullscreen)
*size_state = FULLSCREEN_BOTH;
else if (a == dpyinfo->Xatom_net_wm_state_sticky)
*sticky = 1;
static int
do_ewmh_fullscreen (struct frame *f)
{
- int have_net_atom = wm_supports (f, "_NET_WM_STATE");
- Lisp_Object lval = get_frame_param (f, Qfullscreen);
+ struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
+ int have_net_atom = wm_supports (f, dpyinfo->Xatom_net_wm_state);
int cur, dummy;
- get_current_vm_state (f, FRAME_OUTER_WINDOW (f), &cur, &dummy);
+ get_current_wm_state (f, FRAME_OUTER_WINDOW (f), &cur, &dummy);
/* Some window managers don't say they support _NET_WM_STATE, but they do say
they support _NET_WM_STATE_FULLSCREEN. Try that also. */
if (!have_net_atom)
- have_net_atom = wm_supports (f, "_NET_WM_STATE_FULLSCREEN");
+ have_net_atom = wm_supports (f, dpyinfo->Xatom_net_wm_state_fullscreen);
if (have_net_atom && cur != f->want_fullscreen)
{
Lisp_Object frame;
- const char *fs = "_NET_WM_STATE_FULLSCREEN";
- const char *fw = "_NET_WM_STATE_MAXIMIZED_HORZ";
- const char *fh = "_NET_WM_STATE_MAXIMIZED_VERT";
XSETFRAME (frame, f);
case FULLSCREEN_BOTH:
if (cur == FULLSCREEN_WIDTH || cur == FULLSCREEN_MAXIMIZED
|| cur == FULLSCREEN_HEIGHT)
- set_wm_state (frame, 0, fw, fh);
- set_wm_state (frame, 1, fs, NULL);
+ set_wm_state (frame, 0, dpyinfo->Xatom_net_wm_state_maximized_horz,
+ dpyinfo->Xatom_net_wm_state_maximized_vert);
+ set_wm_state (frame, 1, dpyinfo->Xatom_net_wm_state_fullscreen, None);
break;
case FULLSCREEN_WIDTH:
if (cur == FULLSCREEN_BOTH || cur == FULLSCREEN_HEIGHT
|| cur == FULLSCREEN_MAXIMIZED)
- set_wm_state (frame, 0, fs, fh);
+ set_wm_state (frame, 0, dpyinfo->Xatom_net_wm_state_fullscreen,
+ dpyinfo->Xatom_net_wm_state_maximized_vert);
if (cur != FULLSCREEN_MAXIMIZED)
- set_wm_state (frame, 1, fw, NULL);
+ set_wm_state (frame, 1, dpyinfo->Xatom_net_wm_state_maximized_horz, None);
break;
case FULLSCREEN_HEIGHT:
if (cur == FULLSCREEN_BOTH || cur == FULLSCREEN_WIDTH
|| cur == FULLSCREEN_MAXIMIZED)
- set_wm_state (frame, 0, fs, fw);
+ set_wm_state (frame, 0, dpyinfo->Xatom_net_wm_state_fullscreen,
+ dpyinfo->Xatom_net_wm_state_maximized_horz);
if (cur != FULLSCREEN_MAXIMIZED)
- set_wm_state (frame, 1, fh, NULL);
+ set_wm_state (frame, 1, dpyinfo->Xatom_net_wm_state_maximized_vert, None);
break;
case FULLSCREEN_MAXIMIZED:
if (cur == FULLSCREEN_BOTH)
- set_wm_state (frame, 0, fs, NULL);
- set_wm_state (frame, 1, fw, fh);
+ set_wm_state (frame, 0, dpyinfo->Xatom_net_wm_state_fullscreen, None);
+ set_wm_state (frame, 1, dpyinfo->Xatom_net_wm_state_maximized_horz,
+ dpyinfo->Xatom_net_wm_state_maximized_vert);
break;
case FULLSCREEN_NONE:
if (cur == FULLSCREEN_BOTH)
- set_wm_state (frame, 0, fs, NULL);
+ set_wm_state (frame, 0, dpyinfo->Xatom_net_wm_state_fullscreen, None);
else
- set_wm_state (frame, 0, fw, fh);
+ set_wm_state (frame, 0, dpyinfo->Xatom_net_wm_state_maximized_horz,
+ dpyinfo->Xatom_net_wm_state_maximized_vert);
}
f->want_fullscreen = FULLSCREEN_NONE;
Lisp_Object lval;
int sticky = 0;
- get_current_vm_state (f, event->window, &value, &sticky);
+ get_current_wm_state (f, event->window, &value, &sticky);
lval = Qnil;
switch (value)
{
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)
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);
}
}
/* See Window Manager Specification/Extended Window Manager Hints at
http://freedesktop.org/wiki/Specifications/wm-spec */
- const char *atom = "_NET_ACTIVE_WINDOW";
- if (f->async_visible && wm_supports (f, atom))
+ struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
+ if (f->async_visible && wm_supports (f, dpyinfo->Xatom_net_active_window))
{
Lisp_Object frame;
XSETFRAME (frame, f);
- Fx_send_client_event (frame, make_number (0), frame,
- make_unibyte_string (atom, strlen (atom)),
- make_number (32),
- Fcons (make_number (1),
- Fcons (make_number (last_user_time),
- Qnil)));
+ x_send_client_event (frame, make_number (0), frame,
+ dpyinfo->Xatom_net_active_window,
+ make_number (32),
+ Fcons (make_number (1),
+ Fcons (make_number (last_user_time),
+ Qnil)));
}
}
\f
/* XEmbed implementation. */
-void
+static void
xembed_set_info (struct frame *f, enum xembed_info flags)
{
- Atom atom;
unsigned long data[2];
-
- atom = XInternAtom (FRAME_X_DISPLAY (f), "_XEMBED_INFO", False);
+ struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
data[0] = XEMBED_VERSION;
data[1] = flags;
- XChangeProperty (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), atom, atom,
+ XChangeProperty (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
+ dpyinfo->Xatom_XEMBED_INFO, dpyinfo->Xatom_XEMBED_INFO,
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;
struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
Lisp_Object bar;
struct scroll_bar *b;
+ Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight;
BLOCK_INPUT;
if (f == dpyinfo->x_highlight_frame)
dpyinfo->x_highlight_frame = 0;
- if (f == dpyinfo->mouse_face_mouse_frame)
+ if (f == hlinfo->mouse_face_mouse_frame)
{
- dpyinfo->mouse_face_beg_row
- = dpyinfo->mouse_face_beg_col = -1;
- dpyinfo->mouse_face_end_row
- = dpyinfo->mouse_face_end_col = -1;
- dpyinfo->mouse_face_window = Qnil;
- dpyinfo->mouse_face_deferred_gc = 0;
- dpyinfo->mouse_face_mouse_frame = 0;
+ hlinfo->mouse_face_beg_row
+ = hlinfo->mouse_face_beg_col = -1;
+ hlinfo->mouse_face_end_row
+ = hlinfo->mouse_face_end_col = -1;
+ hlinfo->mouse_face_window = Qnil;
+ hlinfo->mouse_face_deferred_gc = 0;
+ hlinfo->mouse_face_mouse_frame = 0;
}
UNBLOCK_INPUT;
struct terminal *terminal;
struct x_display_info *dpyinfo;
XrmDatabase xrdb;
+ Mouse_HLInfo *hlinfo;
BLOCK_INPUT;
{
static char display_opt[] = "--display";
static char name_opt[] = "--name";
-
+
for (argc = 0; argc < NUM_ARGV; ++argc)
argv[argc] = 0;
dpyinfo = (struct x_display_info *) xmalloc (sizeof (struct x_display_info));
memset (dpyinfo, 0, sizeof *dpyinfo);
+ hlinfo = &dpyinfo->mouse_highlight;
terminal = x_create_terminal (dpyinfo);
dpyinfo->bitmaps_size = 0;
dpyinfo->bitmaps_last = 0;
dpyinfo->scratch_cursor_gc = 0;
- dpyinfo->mouse_face_mouse_frame = 0;
- dpyinfo->mouse_face_deferred_gc = 0;
- dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1;
- dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1;
- dpyinfo->mouse_face_face_id = DEFAULT_FACE_ID;
- dpyinfo->mouse_face_window = Qnil;
- dpyinfo->mouse_face_overlay = Qnil;
- dpyinfo->mouse_face_mouse_x = dpyinfo->mouse_face_mouse_y = 0;
- dpyinfo->mouse_face_defer = 0;
- dpyinfo->mouse_face_hidden = 0;
+ hlinfo->mouse_face_mouse_frame = 0;
+ hlinfo->mouse_face_deferred_gc = 0;
+ hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1;
+ hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1;
+ hlinfo->mouse_face_face_id = DEFAULT_FACE_ID;
+ hlinfo->mouse_face_window = Qnil;
+ hlinfo->mouse_face_overlay = Qnil;
+ hlinfo->mouse_face_mouse_x = hlinfo->mouse_face_mouse_y = 0;
+ hlinfo->mouse_face_defer = 0;
+ hlinfo->mouse_face_hidden = 0;
dpyinfo->x_focus_frame = 0;
dpyinfo->x_focus_event_frame = 0;
dpyinfo->x_highlight_frame = 0;
dpyinfo->resx = (mm < 1) ? 100 : pixels * 25.4 / mm;
}
- dpyinfo->Xatom_wm_protocols
- = XInternAtom (dpyinfo->display, "WM_PROTOCOLS", False);
- dpyinfo->Xatom_wm_take_focus
- = XInternAtom (dpyinfo->display, "WM_TAKE_FOCUS", False);
- dpyinfo->Xatom_wm_save_yourself
- = XInternAtom (dpyinfo->display, "WM_SAVE_YOURSELF", False);
- dpyinfo->Xatom_wm_delete_window
- = XInternAtom (dpyinfo->display, "WM_DELETE_WINDOW", False);
- dpyinfo->Xatom_wm_change_state
- = XInternAtom (dpyinfo->display, "WM_CHANGE_STATE", False);
- dpyinfo->Xatom_wm_configure_denied
- = XInternAtom (dpyinfo->display, "WM_CONFIGURE_DENIED", False);
- dpyinfo->Xatom_wm_window_moved
- = XInternAtom (dpyinfo->display, "WM_MOVED", False);
- dpyinfo->Xatom_wm_client_leader
- = XInternAtom (dpyinfo->display, "WM_CLIENT_LEADER", False);
- dpyinfo->Xatom_editres
- = XInternAtom (dpyinfo->display, "Editres", False);
- dpyinfo->Xatom_CLIPBOARD
- = XInternAtom (dpyinfo->display, "CLIPBOARD", False);
- dpyinfo->Xatom_TIMESTAMP
- = XInternAtom (dpyinfo->display, "TIMESTAMP", False);
- dpyinfo->Xatom_TEXT
- = XInternAtom (dpyinfo->display, "TEXT", False);
- dpyinfo->Xatom_COMPOUND_TEXT
- = XInternAtom (dpyinfo->display, "COMPOUND_TEXT", False);
- dpyinfo->Xatom_UTF8_STRING
- = XInternAtom (dpyinfo->display, "UTF8_STRING", False);
- dpyinfo->Xatom_DELETE
- = XInternAtom (dpyinfo->display, "DELETE", False);
- dpyinfo->Xatom_MULTIPLE
- = XInternAtom (dpyinfo->display, "MULTIPLE", False);
- dpyinfo->Xatom_INCR
- = XInternAtom (dpyinfo->display, "INCR", False);
- dpyinfo->Xatom_EMACS_TMP
- = XInternAtom (dpyinfo->display, "_EMACS_TMP_", False);
- dpyinfo->Xatom_TARGETS
- = XInternAtom (dpyinfo->display, "TARGETS", False);
- dpyinfo->Xatom_NULL
- = XInternAtom (dpyinfo->display, "NULL", False);
- dpyinfo->Xatom_ATOM_PAIR
- = XInternAtom (dpyinfo->display, "ATOM_PAIR", False);
- /* For properties of font. */
- dpyinfo->Xatom_PIXEL_SIZE
- = XInternAtom (dpyinfo->display, "PIXEL_SIZE", False);
- dpyinfo->Xatom_AVERAGE_WIDTH
- = XInternAtom (dpyinfo->display, "AVERAGE_WIDTH", False);
- dpyinfo->Xatom_MULE_BASELINE_OFFSET
- = XInternAtom (dpyinfo->display, "_MULE_BASELINE_OFFSET", False);
- dpyinfo->Xatom_MULE_RELATIVE_COMPOSE
- = XInternAtom (dpyinfo->display, "_MULE_RELATIVE_COMPOSE", False);
- dpyinfo->Xatom_MULE_DEFAULT_ASCENT
- = XInternAtom (dpyinfo->display, "_MULE_DEFAULT_ASCENT", False);
-
- /* Ghostscript support. */
- dpyinfo->Xatom_PAGE = XInternAtom (dpyinfo->display, "PAGE", False);
- dpyinfo->Xatom_DONE = XInternAtom (dpyinfo->display, "DONE", False);
-
- dpyinfo->Xatom_Scrollbar = XInternAtom (dpyinfo->display, "SCROLLBAR",
- False);
-
- dpyinfo->Xatom_XEMBED = XInternAtom (dpyinfo->display, "_XEMBED",
- False);
-
- dpyinfo->Xatom_net_wm_state
- = XInternAtom (dpyinfo->display, "_NET_WM_STATE", False);
- dpyinfo->Xatom_net_wm_state_fullscreen_atom
- = XInternAtom (dpyinfo->display, "_NET_WM_STATE_FULLSCREEN", False);
- dpyinfo->Xatom_net_wm_state_maximized_horz
- = XInternAtom (dpyinfo->display, "_NET_WM_STATE_MAXIMIZED_HORZ", False);
- dpyinfo->Xatom_net_wm_state_maximized_vert
- = XInternAtom (dpyinfo->display, "_NET_WM_STATE_MAXIMIZED_VERT", False);
- dpyinfo->Xatom_net_wm_state_sticky
- = XInternAtom (dpyinfo->display, "_NET_WM_STATE_STICKY", False);
- dpyinfo->Xatom_net_window_type
- = XInternAtom (dpyinfo->display, "_NET_WM_WINDOW_TYPE", False);
- dpyinfo->Xatom_net_window_type_tooltip
- = XInternAtom (dpyinfo->display, "_NET_WM_WINDOW_TYPE_TOOLTIP", False);
- dpyinfo->Xatom_net_wm_icon_name
- = XInternAtom (dpyinfo->display, "_NET_WM_ICON_NAME", False);
- dpyinfo->Xatom_net_wm_name
- = XInternAtom (dpyinfo->display, "_NET_WM_NAME", False);
+ {
+ const struct
+ {
+ const char *name;
+ Atom *atom;
+ } atom_refs[] = {
+ { "WM_PROTOCOLS", &dpyinfo->Xatom_wm_protocols },
+ { "WM_TAKE_FOCUS", &dpyinfo->Xatom_wm_take_focus },
+ { "WM_SAVE_YOURSELF", &dpyinfo->Xatom_wm_save_yourself },
+ { "WM_DELETE_WINDOW", &dpyinfo->Xatom_wm_delete_window },
+ { "WM_CHANGE_STATE", &dpyinfo->Xatom_wm_change_state },
+ { "WM_CONFIGURE_DENIED", &dpyinfo->Xatom_wm_configure_denied },
+ { "WM_MOVED", &dpyinfo->Xatom_wm_window_moved },
+ { "WM_CLIENT_LEADER", &dpyinfo->Xatom_wm_client_leader },
+ { "Editres", &dpyinfo->Xatom_editres },
+ { "CLIPBOARD", &dpyinfo->Xatom_CLIPBOARD },
+ { "TIMESTAMP", &dpyinfo->Xatom_TIMESTAMP },
+ { "TEXT", &dpyinfo->Xatom_TEXT },
+ { "COMPOUND_TEXT", &dpyinfo->Xatom_COMPOUND_TEXT },
+ { "UTF8_STRING", &dpyinfo->Xatom_UTF8_STRING },
+ { "DELETE", &dpyinfo->Xatom_DELETE },
+ { "MULTIPLE", &dpyinfo->Xatom_MULTIPLE },
+ { "INCR", &dpyinfo->Xatom_INCR },
+ { "_EMACS_TMP_", &dpyinfo->Xatom_EMACS_TMP },
+ { "TARGETS", &dpyinfo->Xatom_TARGETS },
+ { "NULL", &dpyinfo->Xatom_NULL },
+ { "ATOM_PAIR", &dpyinfo->Xatom_ATOM_PAIR },
+ { "_XEMBED_INFO", &dpyinfo->Xatom_XEMBED_INFO },
+ /* For properties of font. */
+ { "PIXEL_SIZE", &dpyinfo->Xatom_PIXEL_SIZE },
+ { "AVERAGE_WIDTH", &dpyinfo->Xatom_AVERAGE_WIDTH },
+ { "_MULE_BASELINE_OFFSET", &dpyinfo->Xatom_MULE_BASELINE_OFFSET },
+ { "_MULE_RELATIVE_COMPOSE", &dpyinfo->Xatom_MULE_RELATIVE_COMPOSE },
+ { "_MULE_DEFAULT_ASCENT", &dpyinfo->Xatom_MULE_DEFAULT_ASCENT },
+ /* Ghostscript support. */
+ { "DONE", &dpyinfo->Xatom_DONE },
+ { "PAGE", &dpyinfo->Xatom_PAGE },
+ { "SCROLLBAR", &dpyinfo->Xatom_Scrollbar },
+ { "_XEMBED", &dpyinfo->Xatom_XEMBED },
+ /* EWMH */
+ { "_NET_WM_STATE", &dpyinfo->Xatom_net_wm_state },
+ { "_NET_WM_STATE_FULLSCREEN", &dpyinfo->Xatom_net_wm_state_fullscreen },
+ { "_NET_WM_STATE_MAXIMIZED_HORZ",
+ &dpyinfo->Xatom_net_wm_state_maximized_horz },
+ { "_NET_WM_STATE_MAXIMIZED_VERT",
+ &dpyinfo->Xatom_net_wm_state_maximized_vert },
+ { "_NET_WM_STATE_STICKY", &dpyinfo->Xatom_net_wm_state_sticky },
+ { "_NET_WM_WINDOW_TYPE", &dpyinfo->Xatom_net_window_type },
+ { "_NET_WM_WINDOW_TYPE_TOOLTIP",
+ &dpyinfo->Xatom_net_window_type_tooltip },
+ { "_NET_WM_ICON_NAME", &dpyinfo->Xatom_net_wm_icon_name },
+ { "_NET_WM_NAME", &dpyinfo->Xatom_net_wm_name },
+ { "_NET_SUPPORTED", &dpyinfo->Xatom_net_supported },
+ { "_NET_SUPPORTING_WM_CHECK", &dpyinfo->Xatom_net_supporting_wm_check },
+ { "_NET_WM_WINDOW_OPACITY", &dpyinfo->Xatom_net_wm_window_opacity },
+ { "_NET_ACTIVE_WINDOW", &dpyinfo->Xatom_net_active_window },
+ { "_NET_FRAME_EXTENTS", &dpyinfo->Xatom_net_frame_extents },
+ /* Session management */
+ { "SM_CLIENT_ID", &dpyinfo->Xatom_SM_CLIENT_ID },
+ { "_XSETTINGS_SETTINGS", &dpyinfo->Xatom_xsettings_prop },
+ { "MANAGER", &dpyinfo->Xatom_xsettings_mgr },
+ };
+
+ int i;
+ const int atom_count = sizeof (atom_refs) / sizeof (atom_refs[0]);
+ /* 1 for _XSETTINGS_SN */
+ const int total_atom_count = 1 + atom_count;
+ Atom *atoms_return = xmalloc (sizeof (Atom) * total_atom_count);
+ char **atom_names = xmalloc (sizeof (char *) * total_atom_count);
+ char xsettings_atom_name[64];
+
+ for (i = 0; i < atom_count; i++)
+ atom_names[i] = (char *) atom_refs[i].name;
+
+ /* Build _XSETTINGS_SN atom name */
+ snprintf (xsettings_atom_name, sizeof (xsettings_atom_name),
+ "_XSETTINGS_S%d", XScreenNumberOfScreen (dpyinfo->screen));
+ atom_names[i] = xsettings_atom_name;
+
+ XInternAtoms (dpyinfo->display, atom_names, total_atom_count,
+ False, atoms_return);
+
+ for (i = 0; i < atom_count; i++)
+ *atom_refs[i].atom = atoms_return[i];
+
+ /* Manual copy of last atom */
+ dpyinfo->Xatom_xsettings_sel = atoms_return[i];
+
+ xfree (atom_names);
+ xfree (atoms_return);
+ }
dpyinfo->x_dnd_atoms_size = 8;
dpyinfo->x_dnd_atoms_length = 0;
#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
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
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
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
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),
}
#endif /* HAVE_X_WINDOWS */
-