/* Functions for the X window system.
-Copyright (C) 1989, 1992-2013 Free Software Foundation, Inc.
+Copyright (C) 1989, 1992-2014 Free Software Foundation, Inc.
This file is part of GNU Emacs.
#include "lisp.h"
#include "xterm.h"
+#include "menu.h"
#include "frame.h"
#include "window.h"
#include "character.h"
*yptr = real_y;
}
-\f
+/* Get the mouse position in frame relative coordinates. */
+
+void
+x_relative_mouse_position (struct frame *f, int *x, int *y)
+{
+ Window root, dummy_window;
+ int dummy;
+
+ eassert (FRAME_X_P (f));
+
+ block_input ();
+
+ XQueryPointer (FRAME_X_DISPLAY (f),
+ DefaultRootWindow (FRAME_X_DISPLAY (f)),
+
+ /* The root window which contains the pointer. */
+ &root,
+
+ /* Window pointer is on, not used */
+ &dummy_window,
+
+ /* The position on that root window. */
+ x, y,
+
+ /* x/y in dummy_window coordinates, not used. */
+ &dummy, &dummy,
+ /* Modifier keys and pointer buttons, about which
+ we don't care. */
+ (unsigned int *) &dummy);
+
+ unblock_input ();
+
+ /* Translate root window coordinates to window coordinates. */
+ *x -= f->left_pos + FRAME_OUTER_TO_INNER_DIFF_X (f);
+ *y -= f->top_pos + FRAME_OUTER_TO_INNER_DIFF_Y (f);
+}
/* Gamma-correct COLOR on frame F. */
}
}
-static Cursor
-make_invisible_cursor (struct frame *f)
-{
- Display *dpy = FRAME_X_DISPLAY (f);
- static char const no_data[] = { 0 };
- Pixmap pix;
- XColor col;
- Cursor c = 0;
-
- x_catch_errors (dpy);
- pix = XCreateBitmapFromData (dpy, FRAME_DISPLAY_INFO (f)->root_window,
- no_data, 1, 1);
- if (! x_had_errors_p (dpy) && pix != None)
- {
- Cursor pixc;
- col.pixel = 0;
- col.red = col.green = col.blue = 0;
- col.flags = DoRed | DoGreen | DoBlue;
- pixc = XCreatePixmapCursor (dpy, pix, pix, &col, &col, 0, 0);
- if (! x_had_errors_p (dpy) && pixc != None)
- c = pixc;
- XFreePixmap (dpy, pix);
- }
-
- x_uncatch_errors ();
-
- return c;
-}
-
static void
x_set_mouse_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
{
struct x_output *x = f->output_data.x;
Display *dpy = FRAME_X_DISPLAY (f);
Cursor cursor, nontext_cursor, mode_cursor, hand_cursor;
- Cursor hourglass_cursor, horizontal_drag_cursor;
+ Cursor hourglass_cursor, horizontal_drag_cursor, vertical_drag_cursor;
unsigned long pixel = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f));
unsigned long mask_color = FRAME_BACKGROUND_PIXEL (f);
if (!NILP (Vx_window_horizontal_drag_shape))
{
- CHECK_NUMBER (Vx_window_horizontal_drag_shape);
+ CHECK_TYPE_RANGED_INTEGER (unsigned, Vx_window_horizontal_drag_shape);
horizontal_drag_cursor
= XCreateFontCursor (dpy, XINT (Vx_window_horizontal_drag_shape));
}
horizontal_drag_cursor
= XCreateFontCursor (dpy, XC_sb_h_double_arrow);
+ if (!NILP (Vx_window_vertical_drag_shape))
+ {
+ CHECK_NUMBER (Vx_window_vertical_drag_shape);
+ vertical_drag_cursor
+ = XCreateFontCursor (dpy, XINT (Vx_window_vertical_drag_shape));
+ }
+ else
+ vertical_drag_cursor
+ = XCreateFontCursor (dpy, XC_sb_v_double_arrow);
+
/* Check and report errors with the above calls. */
x_check_errors (dpy, "can't set cursor shape: %s");
x_uncatch_errors ();
XRecolorCursor (dpy, hand_cursor, &fore_color, &back_color);
XRecolorCursor (dpy, hourglass_cursor, &fore_color, &back_color);
XRecolorCursor (dpy, horizontal_drag_cursor, &fore_color, &back_color);
+ XRecolorCursor (dpy, vertical_drag_cursor, &fore_color, &back_color);
}
if (FRAME_X_WINDOW (f) != 0)
XDefineCursor (dpy, FRAME_X_WINDOW (f),
f->output_data.x->current_cursor = cursor);
- if (FRAME_DISPLAY_INFO (f)->invisible_cursor == 0)
- FRAME_DISPLAY_INFO (f)->invisible_cursor = make_invisible_cursor (f);
-
if (cursor != x->text_cursor
&& x->text_cursor != 0)
XFreeCursor (dpy, x->text_cursor);
XFreeCursor (dpy, x->horizontal_drag_cursor);
x->horizontal_drag_cursor = horizontal_drag_cursor;
+ if (vertical_drag_cursor != x->vertical_drag_cursor
+ && x->vertical_drag_cursor != 0)
+ XFreeCursor (dpy, x->vertical_drag_cursor);
+ x->vertical_drag_cursor = vertical_drag_cursor;
+
XFlush (dpy);
unblock_input ();
nlines = 0;
/* Make sure we redisplay all windows in this frame. */
- windows_or_buffers_changed++;
+ windows_or_buffers_changed = 59;
#if defined (USE_X_TOOLKIT) || defined (USE_GTK)
FRAME_MENU_BAR_LINES (f) = 0;
+ FRAME_MENU_BAR_HEIGHT (f) = 0;
if (nlines)
{
FRAME_EXTERNAL_MENU_BAR (f) = 1;
}
#else /* not USE_X_TOOLKIT && not USE_GTK */
FRAME_MENU_BAR_LINES (f) = nlines;
- resize_frame_windows (f, FRAME_LINES (f), 0);
+ FRAME_MENU_BAR_HEIGHT (f) = nlines * FRAME_LINE_HEIGHT (f);
+ resize_frame_windows (f, FRAME_TEXT_HEIGHT (f), 0, 1);
+ if (FRAME_X_WINDOW (f))
+ x_clear_under_internal_border (f);
/* If the menu bar height gets changed, the internal border below
the top margin has to be cleared. Also, if the menu bar gets
int y;
/* height can be zero here. */
- if (height > 0 && width > 0)
+ if (FRAME_X_WINDOW (f) && height > 0 && width > 0)
{
y = FRAME_TOP_MARGIN_HEIGHT (f);
int nlines;
#if ! defined (USE_GTK)
int delta, root_height;
- Lisp_Object root_window;
+ int unit = FRAME_LINE_HEIGHT (f);
#endif
/* Treat tool bars like menu bars. */
#ifdef USE_GTK
FRAME_TOOL_BAR_LINES (f) = 0;
+ FRAME_TOOL_BAR_HEIGHT (f) = 0;
if (nlines)
{
FRAME_EXTERNAL_TOOL_BAR (f) = 1;
#else /* !USE_GTK */
- /* Make sure we redisplay all windows in this frame. */
- ++windows_or_buffers_changed;
+ /* Make sure we redisplay all windows in this frame. */
+ windows_or_buffers_changed = 60;
- delta = nlines - FRAME_TOOL_BAR_LINES (f);
+ /* DELTA is in pixels now. */
+ delta = (nlines - FRAME_TOOL_BAR_LINES (f)) * unit;
- /* Don't resize the tool-bar to more than we have room for. */
- root_window = FRAME_ROOT_WINDOW (f);
- root_height = WINDOW_TOTAL_LINES (XWINDOW (root_window));
- if (root_height - delta < 1)
+ /* Don't resize the tool-bar to more than we have room for. Note: The
+ calculations below and the subsequent call to resize_frame_windows
+ are inherently flawed because they can make the toolbar higher than
+ the containing frame. */
+ if (delta > 0)
{
- delta = root_height - 1;
- nlines = FRAME_TOOL_BAR_LINES (f) + delta;
+ root_height = WINDOW_PIXEL_HEIGHT (XWINDOW (FRAME_ROOT_WINDOW (f)));
+ if (root_height - delta < unit)
+ {
+ delta = root_height - unit;
+ /* When creating a new frame and toolbar mode is enabled, we
+ need at least one toolbar line. */
+ nlines = max (FRAME_TOOL_BAR_LINES (f) + delta / unit, 1);
+ }
}
FRAME_TOOL_BAR_LINES (f) = nlines;
- resize_frame_windows (f, FRAME_LINES (f), 0);
+ FRAME_TOOL_BAR_HEIGHT (f) = nlines * FRAME_LINE_HEIGHT (f);
+ resize_frame_windows (f, FRAME_TEXT_HEIGHT (f), 0, 1);
+#if !defined USE_X_TOOLKIT && !defined USE_GTK
+ if (FRAME_X_WINDOW (f))
+ x_clear_under_internal_border (f);
+#endif
adjust_frame_glyphs (f);
/* We also have to make sure that the internal border at the top of
below the tool bar if one is displayed, but is below the menu bar
if there isn't a tool bar. The tool bar draws into the area
below the menu bar. */
- if (FRAME_X_WINDOW (f) && FRAME_TOOL_BAR_LINES (f) == 0)
+ if (FRAME_X_WINDOW (f) && FRAME_TOOL_BAR_HEIGHT (f) == 0)
{
clear_frame (f);
clear_current_matrices (f);
{
int height = FRAME_INTERNAL_BORDER_WIDTH (f);
int width = FRAME_PIXEL_WIDTH (f);
- int y = (FRAME_MENU_BAR_LINES (f) + nlines) * FRAME_LINE_HEIGHT (f);
+ int y = nlines * unit;
/* height can be zero here. */
if (height > 0 && width > 0)
clear_glyph_matrix (XWINDOW (f->tool_bar_window)->current_matrix);
}
- run_window_configuration_change_hook (f);
+ run_window_configuration_change_hook (f);
#endif /* USE_GTK */
}
/* If we're switching from explicit to implicit, we had better
update the mode lines and thereby update the title. */
if (f->explicit_name && NILP (name))
- update_mode_lines = 1;
+ update_mode_lines = 37;
f->explicit_name = ! NILP (name);
}
if (EQ (name, f->title))
return;
- update_mode_lines = 1;
+ update_mode_lines = 38;
fset_title (f, name);
void
x_set_scroll_bar_default_width (struct frame *f)
{
- int wid = FRAME_COLUMN_WIDTH (f);
+ int unit = FRAME_COLUMN_WIDTH (f);
#ifdef USE_TOOLKIT_SCROLL_BARS
#ifdef USE_GTK
int minw = xg_get_default_scrollbar_width ();
int minw = 16;
#endif
/* A minimum width of 14 doesn't look good for toolkit scroll bars. */
- FRAME_CONFIG_SCROLL_BAR_COLS (f) = (minw + wid - 1) / wid;
+ FRAME_CONFIG_SCROLL_BAR_COLS (f) = (minw + unit - 1) / unit;
FRAME_CONFIG_SCROLL_BAR_WIDTH (f) = minw;
#else
- /* Make the actual width at least 14 pixels and a multiple of a
- character width. */
- FRAME_CONFIG_SCROLL_BAR_COLS (f) = (14 + wid - 1) / wid;
-
- /* Use all of that space (aside from required margins) for the
- scroll bar. */
- FRAME_CONFIG_SCROLL_BAR_WIDTH (f) = 0;
+ /* The width of a non-toolkit scrollbar is at least 14 pixels and a
+ multiple of the frame's character width. */
+ FRAME_CONFIG_SCROLL_BAR_COLS (f) = (14 + unit - 1) / unit;
+ FRAME_CONFIG_SCROLL_BAR_WIDTH (f)
+ = FRAME_CONFIG_SCROLL_BAR_COLS (f) * unit;
#endif
}
#ifdef HAVE_X_I18N
static XFontSet xic_create_xfontset (struct frame *);
-static XIMStyle best_xim_style (XIMStyles *, XIMStyles *);
+static XIMStyle best_xim_style (XIMStyles *);
/* Supported XIM styles, ordered by preference. */
-static XIMStyle supported_xim_styles[] =
+static const XIMStyle supported_xim_styles[] =
{
XIMPreeditPosition | XIMStatusArea,
XIMPreeditPosition | XIMStatusNothing,
}
}
if (motif)
- strcat (fontsetname, ":");
+ return strcat (fontsetname, ":");
return fontsetname;
}
#endif /* HAVE_X_WINDOWS && USE_X_TOOLKIT */
input method XIM. */
static XIMStyle
-best_xim_style (XIMStyles *user, XIMStyles *xim)
+best_xim_style (XIMStyles *xim)
{
int i, j;
+ int nr_supported = ARRAYELTS (supported_xim_styles);
- for (i = 0; i < user->count_styles; ++i)
+ for (i = 0; i < nr_supported; ++i)
for (j = 0; j < xim->count_styles; ++j)
- if (user->supported_styles[i] == xim->supported_styles[j])
- return user->supported_styles[i];
+ if (supported_xim_styles[i] == xim->supported_styles[j])
+ return supported_xim_styles[i];
/* Return the default style. */
return XIMPreeditNothing | XIMStatusNothing;
/* Create XIC for frame F. */
-static XIMStyle xic_style;
-
void
create_frame_xic (struct frame *f)
{
XIM xim;
XIC xic = NULL;
XFontSet xfs = NULL;
+ XVaNestedList status_attr = NULL;
+ XVaNestedList preedit_attr = NULL;
+ XRectangle s_area;
+ XPoint spot;
+ XIMStyle xic_style;
if (FRAME_XIC (f))
- return;
+ goto out;
- /* Create X fontset. */
- xfs = xic_create_xfontset (f);
xim = FRAME_X_XIM (f);
- if (xim)
- {
- XRectangle s_area;
- XPoint spot;
- XVaNestedList preedit_attr;
- XVaNestedList status_attr;
+ if (!xim)
+ goto out;
- s_area.x = 0; s_area.y = 0; s_area.width = 1; s_area.height = 1;
- spot.x = 0; spot.y = 1;
+ /* Determine XIC style. */
+ xic_style = best_xim_style (FRAME_X_XIM_STYLES (f));
- /* Determine XIC style. */
- if (xic_style == 0)
- {
- XIMStyles supported_list;
- supported_list.count_styles = (sizeof supported_xim_styles
- / sizeof supported_xim_styles[0]);
- supported_list.supported_styles = supported_xim_styles;
- xic_style = best_xim_style (&supported_list,
- FRAME_X_XIM_STYLES (f));
- }
+ /* Create X fontset. */
+ if (xic_style & (XIMPreeditPosition | XIMStatusArea))
+ {
+ xfs = xic_create_xfontset (f);
+ if (!xfs)
+ goto out;
+ FRAME_XIC_FONTSET (f) = xfs;
+ }
+
+ if (xic_style & XIMPreeditPosition)
+ {
+ spot.x = 0; spot.y = 1;
preedit_attr = XVaCreateNestedList (0,
XNFontSet, xfs,
XNForeground,
: NULL),
&spot,
NULL);
+
+ if (!preedit_attr)
+ goto out;
+ }
+
+ if (xic_style & XIMStatusArea)
+ {
+ s_area.x = 0; s_area.y = 0; s_area.width = 1; s_area.height = 1;
status_attr = XVaCreateNestedList (0,
- XNArea,
- &s_area,
- XNFontSet,
- xfs,
- XNForeground,
- FRAME_FOREGROUND_PIXEL (f),
- XNBackground,
- FRAME_BACKGROUND_PIXEL (f),
- NULL);
-
- xic = XCreateIC (xim,
- XNInputStyle, xic_style,
- XNClientWindow, FRAME_X_WINDOW (f),
- XNFocusWindow, FRAME_X_WINDOW (f),
- XNStatusAttributes, status_attr,
- XNPreeditAttributes, preedit_attr,
- NULL);
- XFree (preedit_attr);
- XFree (status_attr);
+ XNArea,
+ &s_area,
+ XNFontSet,
+ xfs,
+ XNForeground,
+ FRAME_FOREGROUND_PIXEL (f),
+ XNBackground,
+ FRAME_BACKGROUND_PIXEL (f),
+ NULL);
+
+ if (!status_attr)
+ goto out;
}
+ if (preedit_attr && status_attr)
+ xic = XCreateIC (xim,
+ XNInputStyle, xic_style,
+ XNClientWindow, FRAME_X_WINDOW (f),
+ XNFocusWindow, FRAME_X_WINDOW (f),
+ XNStatusAttributes, status_attr,
+ XNPreeditAttributes, preedit_attr,
+ NULL);
+ else if (preedit_attr)
+ xic = XCreateIC (xim,
+ XNInputStyle, xic_style,
+ XNClientWindow, FRAME_X_WINDOW (f),
+ XNFocusWindow, FRAME_X_WINDOW (f),
+ XNPreeditAttributes, preedit_attr,
+ NULL);
+ else if (status_attr)
+ xic = XCreateIC (xim,
+ XNInputStyle, xic_style,
+ XNClientWindow, FRAME_X_WINDOW (f),
+ XNFocusWindow, FRAME_X_WINDOW (f),
+ XNStatusAttributes, status_attr,
+ NULL);
+ else
+ xic = XCreateIC (xim,
+ XNInputStyle, xic_style,
+ XNClientWindow, FRAME_X_WINDOW (f),
+ XNFocusWindow, FRAME_X_WINDOW (f),
+ NULL);
+
+ if (!xic)
+ goto out;
+
FRAME_XIC (f) = xic;
FRAME_XIC_STYLE (f) = xic_style;
- FRAME_XIC_FONTSET (f) = xfs;
+ xfs = NULL; /* Don't free below. */
+
+ out:
+
+ if (xfs)
+ free_frame_xic (f);
+
+ if (preedit_attr)
+ XFree (preedit_attr);
+
+ if (status_attr)
+ XFree (status_attr);
}
f->output_data.x->scroll_bar_top_shadow_pixel = -1;
f->output_data.x->scroll_bar_bottom_shadow_pixel = -1;
#endif /* USE_TOOLKIT_SCROLL_BARS */
+ f->output_data.x->white_relief.pixel = -1;
+ f->output_data.x->black_relief.pixel = -1;
fset_icon_name (f,
x_get_arg (dpyinfo, parms, Qicon_name, "iconName", "Title",
#endif
"internalBorderWidth", "internalBorderWidth",
RES_TYPE_NUMBER);
+ x_default_parameter (f, parms, Qright_divider_width, make_number (0),
+ NULL, NULL, RES_TYPE_NUMBER);
+ x_default_parameter (f, parms, Qbottom_divider_width, make_number (0),
+ NULL, NULL, RES_TYPE_NUMBER);
x_default_parameter (f, parms, Qvertical_scroll_bars,
#if defined (USE_GTK) && defined (USE_TOOLKIT_SCROLL_BARS)
Qright,
happen. */
init_frame_faces (f);
+ /* PXW: This is a duplicate from below. We have to do it here since
+ otherwise x_set_tool_bar_lines will work with the character sizes
+ installed by init_frame_faces while the frame's pixel size is still
+ calculated from a character size of 1 and we subsequently hit the
+ eassert (height >= 0) assertion in window_box_height. The
+ non-pixelwise code apparently worked around this because it had one
+ frame line vs one toolbar line which left us with a zero root
+ window height which was obviously wrong as well ... */
+ change_frame_size (f, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f),
+ FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), 1, 0, 0, 1);
+
/* Set the menu-bar-lines and tool-bar-lines parameters. We don't
look up the X resources controlling the menu-bar and tool-bar
here; they are processed specially at startup, and reflected in
/* Dimensions, especially FRAME_LINES (f), must be done via change_frame_size.
Change will not be effected unless different from the current
FRAME_LINES (f). */
- width = FRAME_COLS (f);
- height = FRAME_LINES (f);
-
- SET_FRAME_COLS (f, 0);
- FRAME_LINES (f) = 0;
- change_frame_size (f, height, width, 1, 0, 0);
+ width = FRAME_TEXT_WIDTH (f);
+ height = FRAME_TEXT_HEIGHT (f);
+ FRAME_TEXT_HEIGHT (f) = 0;
+ SET_FRAME_WIDTH (f, 0);
+ change_frame_size (f, width, height, 1, 0, 0, 1);
#if defined (USE_X_TOOLKIT) || defined (USE_GTK)
/* Create the menu bar. */
Lisp_Object attributes_list = Qnil;
Display *dpy = dpyinfo->display;
+ (void) dpy; /* Suppress unused variable warning. */
+
#ifdef HAVE_XRANDR
int xrr_event_base, xrr_error_base;
bool xrr_ok = false;
static struct x_display_info *
x_display_info_for_name (Lisp_Object name)
{
- Lisp_Object names;
struct x_display_info *dpyinfo;
CHECK_STRING (name);
- for (dpyinfo = x_display_list, names = x_display_name_list;
- dpyinfo;
- dpyinfo = dpyinfo->next, names = XCDR (names))
- {
- Lisp_Object tem;
- tem = Fstring_equal (XCAR (XCAR (names)), name);
- if (!NILP (tem))
- return dpyinfo;
- }
+ for (dpyinfo = x_display_list; dpyinfo; dpyinfo = dpyinfo->next)
+ if (!NILP (Fstring_equal (XCAR (dpyinfo->name_list_element), name)))
+ return dpyinfo;
/* Use this general default value to start with. */
Vx_resource_name = Vinvocation_name;
doc: /* Return the list of display names that Emacs has connections to. */)
(void)
{
- Lisp_Object tail, result;
+ Lisp_Object result = Qnil;
+ struct x_display_info *xdi;
- result = Qnil;
- for (tail = x_display_name_list; CONSP (tail); tail = XCDR (tail))
- result = Fcons (XCAR (XCAR (tail)), result);
+ for (xdi = x_display_list; xdi; xdi = xdi->next)
+ result = Fcons (XCAR (xdi->name_list_element), result);
return result;
}
}
-DEFUN ("x-window-property", Fx_window_property, Sx_window_property,
- 1, 6, 0,
- doc: /* Value is the value of window property PROP on FRAME.
-If FRAME is nil or omitted, use the selected frame.
-
-On X Windows, the following optional arguments are also accepted:
-If TYPE is nil or omitted, get the property as a string.
-Otherwise TYPE is the name of the atom that denotes the type expected.
-If SOURCE is non-nil, get the property on that window instead of from
-FRAME. The number 0 denotes the root window.
-If DELETE-P is non-nil, delete the property after retrieving it.
-If VECTOR-RET-P is non-nil, don't return a string but a vector of values.
-
-On MS Windows, this function accepts but ignores those optional arguments.
-
-Value is nil if FRAME hasn't a property with name PROP or if PROP has
-no value of TYPE (always string in the MS Windows case). */)
- (Lisp_Object prop, Lisp_Object frame, Lisp_Object type,
- Lisp_Object source, Lisp_Object delete_p, Lisp_Object vector_ret_p)
+static Lisp_Object
+x_window_property_intern (struct frame *f,
+ Window target_window,
+ Atom prop_atom,
+ Atom target_type,
+ Lisp_Object delete_p,
+ Lisp_Object vector_ret_p,
+ bool *found)
{
- struct frame *f = decode_window_system_frame (frame);
- Atom prop_atom;
- int rc;
- Lisp_Object prop_value = Qnil;
unsigned char *tmp_data = NULL;
+ Lisp_Object prop_value = Qnil;
Atom actual_type;
- Atom target_type = XA_STRING;
int actual_format;
unsigned long actual_size, bytes_remaining;
- Window target_window = FRAME_X_WINDOW (f);
+ int rc;
struct gcpro gcpro1;
GCPRO1 (prop_value);
- CHECK_STRING (prop);
-
- if (! NILP (source))
- {
- CONS_TO_INTEGER (source, Window, target_window);
- if (! target_window)
- target_window = FRAME_DISPLAY_INFO (f)->root_window;
- }
-
- block_input ();
- if (STRINGP (type))
- {
- if (strcmp ("AnyPropertyType", SSDATA (type)) == 0)
- target_type = AnyPropertyType;
- else
- target_type = XInternAtom (FRAME_X_DISPLAY (f), SSDATA (type), False);
- }
- prop_atom = XInternAtom (FRAME_X_DISPLAY (f), SSDATA (prop), False);
rc = XGetWindowProperty (FRAME_X_DISPLAY (f), target_window,
prop_atom, 0, 0, False, target_type,
&actual_type, &actual_format, &actual_size,
&bytes_remaining, &tmp_data);
- if (rc == Success)
- {
- int size = bytes_remaining;
+ *found = actual_format != 0;
+
+ if (rc == Success && *found)
+ {
XFree (tmp_data);
tmp_data = NULL;
rc = XGetWindowProperty (FRAME_X_DISPLAY (f), target_window,
- prop_atom, 0, bytes_remaining,
- ! NILP (delete_p), target_type,
- &actual_type, &actual_format,
- &actual_size, &bytes_remaining,
- &tmp_data);
+ prop_atom, 0, bytes_remaining,
+ ! NILP (delete_p), target_type,
+ &actual_type, &actual_format,
+ &actual_size, &bytes_remaining,
+ &tmp_data);
if (rc == Success && tmp_data)
{
/* The man page for XGetWindowProperty says:
}
if (NILP (vector_ret_p))
- prop_value = make_string ((char *) tmp_data, size);
+ prop_value = make_string ((char *) tmp_data, actual_size);
else
prop_value = x_property_data_to_lisp (f,
tmp_data,
if (tmp_data) XFree (tmp_data);
}
+ UNGCPRO;
+ return prop_value;
+}
+
+DEFUN ("x-window-property", Fx_window_property, Sx_window_property,
+ 1, 6, 0,
+ doc: /* Value is the value of window property PROP on FRAME.
+If FRAME is nil or omitted, use the selected frame.
+
+On X Windows, the following optional arguments are also accepted:
+If TYPE is nil or omitted, get the property as a string.
+Otherwise TYPE is the name of the atom that denotes the type expected.
+If SOURCE is non-nil, get the property on that window instead of from
+FRAME. The number 0 denotes the root window.
+If DELETE-P is non-nil, delete the property after retrieving it.
+If VECTOR-RET-P is non-nil, don't return a string but a vector of values.
+
+On MS Windows, this function accepts but ignores those optional arguments.
+
+Value is nil if FRAME hasn't a property with name PROP or if PROP has
+no value of TYPE (always string in the MS Windows case). */)
+ (Lisp_Object prop, Lisp_Object frame, Lisp_Object type,
+ Lisp_Object source, Lisp_Object delete_p, Lisp_Object vector_ret_p)
+{
+ struct frame *f = decode_window_system_frame (frame);
+ Atom prop_atom;
+ Lisp_Object prop_value = Qnil;
+ Atom target_type = XA_STRING;
+ Window target_window = FRAME_X_WINDOW (f);
+ struct gcpro gcpro1;
+ bool found;
+
+ GCPRO1 (prop_value);
+ CHECK_STRING (prop);
+
+ if (! NILP (source))
+ {
+ CONS_TO_INTEGER (source, Window, target_window);
+ if (! target_window)
+ target_window = FRAME_DISPLAY_INFO (f)->root_window;
+ }
+
+ block_input ();
+ if (STRINGP (type))
+ {
+ if (strcmp ("AnyPropertyType", SSDATA (type)) == 0)
+ target_type = AnyPropertyType;
+ else
+ target_type = XInternAtom (FRAME_X_DISPLAY (f), SSDATA (type), False);
+ }
+
+ prop_atom = XInternAtom (FRAME_X_DISPLAY (f), SSDATA (prop), False);
+ prop_value = x_window_property_intern (f,
+ target_window,
+ prop_atom,
+ target_type,
+ delete_p,
+ vector_ret_p,
+ &found);
+ if (NILP (prop_value)
+ && ! found
+ && NILP (source)
+ && target_window != FRAME_OUTER_WINDOW (f))
+ {
+ prop_value = x_window_property_intern (f,
+ FRAME_OUTER_WINDOW (f),
+ prop_atom,
+ target_type,
+ delete_p,
+ vector_ret_p,
+ &found);
+ }
+
+
unblock_input ();
UNGCPRO;
return prop_value;
f->output_data.x->scroll_bar_top_shadow_pixel = -1;
f->output_data.x->scroll_bar_bottom_shadow_pixel = -1;
#endif /* USE_TOOLKIT_SCROLL_BARS */
+ f->output_data.x->white_relief.pixel = -1;
+ f->output_data.x->black_relief.pixel = -1;
+
fset_icon_name (f, Qnil);
FRAME_DISPLAY_INFO (f) = dpyinfo;
f->output_data.x->parent_desc = FRAME_DISPLAY_INFO (f)->root_window;
x_default_parameter (f, parms, Qinternal_border_width, make_number (1),
"internalBorderWidth", "internalBorderWidth",
RES_TYPE_NUMBER);
+ x_default_parameter (f, parms, Qright_divider_width, make_number (0),
+ NULL, NULL, RES_TYPE_NUMBER);
+ x_default_parameter (f, parms, Qbottom_divider_width, make_number (0),
+ NULL, NULL, RES_TYPE_NUMBER);
/* Also do the stuff which must be set before the window exists. */
x_default_parameter (f, parms, Qforeground_color, build_string ("black"),
height = FRAME_LINES (f);
SET_FRAME_COLS (f, 0);
FRAME_LINES (f) = 0;
- change_frame_size (f, height, width, 1, 0, 0);
+ change_frame_size (f, width, height, 1, 0, 0, 0);
/* Add `tooltip' frame parameter's default value. */
if (NILP (Fframe_parameter (frame, Qtooltip)))
parms = Fcons (Fcons (Qinternal_border_width, make_number (3)), parms);
if (NILP (Fassq (Qborder_width, parms)))
parms = Fcons (Fcons (Qborder_width, make_number (1)), parms);
+ if (NILP (Fassq (Qbottom_divider_width, parms)))
+ parms = Fcons (Fcons (Qbottom_divider_width, make_number (0)), parms);
+ if (NILP (Fassq (Qright_divider_width, parms)))
+ parms = Fcons (Fcons (Qright_divider_width, make_number (0)), parms);
if (NILP (Fassq (Qborder_color, parms)))
parms = Fcons (Fcons (Qborder_color, build_string ("lightyellow")), parms);
if (NILP (Fassq (Qbackground_color, parms)))
w = XWINDOW (FRAME_ROOT_WINDOW (f));
w->left_col = 0;
w->top_line = 0;
+ w->pixel_left = 0;
+ w->pixel_top = 0;
if (CONSP (Vx_max_tooltip_size)
&& RANGED_INTEGERP (1, XCAR (Vx_max_tooltip_size), INT_MAX)
w->total_lines = 40;
}
+ w->pixel_width = w->total_cols * FRAME_COLUMN_WIDTH (f);
+ w->pixel_height = w->total_lines * FRAME_LINE_HEIGHT (f);
+
FRAME_TOTAL_COLS (f) = w->total_cols;
adjust_frame_glyphs (f);
w->pseudo_window_p = 1;
{
/* w->total_cols and FRAME_TOTAL_COLS want the width in columns,
not in pixels. */
+ w->pixel_width = width;
width /= WINDOW_FRAME_COLUMN_WIDTH (w);
w->total_cols = width;
FRAME_TOTAL_COLS (f) = width;
+ SET_FRAME_WIDTH (f, width);
adjust_frame_glyphs (f);
clear_glyph_matrix (w->desired_matrix);
clear_glyph_matrix (w->current_matrix);
x_set_icon_name,
x_set_icon_type,
x_set_internal_border_width,
+ x_set_right_divider_width,
+ x_set_bottom_divider_width,
x_set_menu_bar_lines,
x_set_mouse_color,
x_explicitly_set_name,
or when you set the mouse color. */);
Vx_window_horizontal_drag_shape = Qnil;
+ DEFVAR_LISP ("x-window-vertical-drag-cursor",
+ Vx_window_vertical_drag_shape,
+ doc: /* Pointer shape to use for indicating a window can be dragged vertically.
+This variable takes effect when you create a new frame
+or when you set the mouse color. */);
+ Vx_window_vertical_drag_shape = Qnil;
+
DEFVAR_LISP ("x-cursor-fore-pixel", Vx_cursor_fore_pixel,
doc: /* A string indicating the foreground color of the cursor box. */);
Vx_cursor_fore_pixel = Qnil;