/* Graphical user interface functions for the Microsoft W32 API.
- Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+
+Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
Free Software Foundation, Inc.
#define FOF_NO_CONNECTED_ELEMENTS 0x2000
#endif
-void syms_of_w32fns ();
-void globals_of_w32fns ();
+void syms_of_w32fns (void);
+void globals_of_w32fns (void);
-extern void free_frame_menubar ();
-extern double atof ();
-extern int w32_console_toggle_lock_key P_ ((int, Lisp_Object));
-extern void w32_menu_display_help P_ ((HWND, HMENU, UINT, UINT));
-extern void w32_free_menu_strings P_ ((HWND));
-extern const char *map_w32_filename P_ ((const char *, const char **));
+extern void free_frame_menubar (struct frame *);
+extern double atof (const char *);
+extern int w32_console_toggle_lock_key (int, Lisp_Object);
+extern void w32_menu_display_help (HWND, HMENU, UINT, UINT);
+extern void w32_free_menu_strings (HWND);
+extern const char *map_w32_filename (const char *, const char **);
extern int quit_char;
-extern char *lispy_function_keys[];
+extern const char *const lispy_function_keys[];
/* The colormap for converting color names to RGB values */
Lisp_Object Vw32_color_map;
(IN HMONITOR monitor, OUT struct MONITOR_INFO* info);
TrackMouseEvent_Proc track_mouse_event_fn = NULL;
-ClipboardSequence_Proc clipboard_sequence_fn = NULL;
ImmGetCompositionString_Proc get_composition_string_fn = NULL;
ImmGetContext_Proc get_ime_context_fn = NULL;
ImmReleaseContext_Proc release_ime_context_fn = NULL;
/* The below are defined in frame.c. */
+extern Lisp_Object Vmenu_bar_mode, Vtool_bar_mode;
+extern Lisp_Object Vwindow_system_version;
extern Lisp_Object Qtooltip;
#ifdef GLYPH_DEBUG
static int menubar_in_use = 0;
/* From w32uniscribe.c */
-extern void syms_of_w32uniscribe ();
+extern void syms_of_w32uniscribe (void);
extern int uniscribe_available;
/* Function prototypes for hourglass support. */
-static void w32_show_hourglass P_ ((struct frame *));
-static void w32_hide_hourglass P_ ((void));
+static void w32_show_hourglass (struct frame *);
+static void w32_hide_hourglass (void);
\f
/* Error if we are not connected to MS-Windows. */
void
-check_w32 ()
+check_w32 (void)
{
if (! w32_in_use)
error ("MS-Windows not in use or not initialized");
You should not call this unless HAVE_MENUS is defined. */
int
-have_menus_p ()
+have_menus_p (void)
{
return w32_in_use;
}
and checking validity for W32. */
FRAME_PTR
-check_x_frame (frame)
- Lisp_Object frame;
+check_x_frame (Lisp_Object frame)
{
FRAME_PTR f;
the first display on the list. */
struct w32_display_info *
-check_x_display_info (frame)
- Lisp_Object frame;
+check_x_display_info (Lisp_Object frame)
{
if (NILP (frame))
{
/* This function can be called during GC, so use GC_xxx type test macros. */
struct frame *
-x_window_to_frame (dpyinfo, wdesc)
- struct w32_display_info *dpyinfo;
- HWND wdesc;
+x_window_to_frame (struct w32_display_info *dpyinfo, HWND wdesc)
{
Lisp_Object tail, frame;
struct frame *f;
}
\f
-static Lisp_Object unwind_create_frame P_ ((Lisp_Object));
-static Lisp_Object unwind_create_tip_frame P_ ((Lisp_Object));
-static void my_create_window P_ ((struct frame *));
-static void my_create_tip_window P_ ((struct frame *));
+static Lisp_Object unwind_create_frame (Lisp_Object);
+static Lisp_Object unwind_create_tip_frame (Lisp_Object);
+static void my_create_window (struct frame *);
+static void my_create_tip_window (struct frame *);
/* TODO: Native Input Method support; see x_create_im. */
-void x_set_foreground_color P_ ((struct frame *, Lisp_Object, Lisp_Object));
-void x_set_background_color P_ ((struct frame *, Lisp_Object, Lisp_Object));
-void x_set_mouse_color P_ ((struct frame *, Lisp_Object, Lisp_Object));
-void x_set_cursor_color P_ ((struct frame *, Lisp_Object, Lisp_Object));
-void x_set_border_color P_ ((struct frame *, Lisp_Object, Lisp_Object));
-void x_set_cursor_type P_ ((struct frame *, Lisp_Object, Lisp_Object));
-void x_set_icon_type P_ ((struct frame *, Lisp_Object, Lisp_Object));
-void x_set_icon_name P_ ((struct frame *, Lisp_Object, Lisp_Object));
-void x_explicitly_set_name P_ ((struct frame *, Lisp_Object, Lisp_Object));
-void x_set_menu_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object));
-void x_set_title P_ ((struct frame *, Lisp_Object, Lisp_Object));
-void x_set_tool_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object));
-static void x_edge_detection P_ ((struct frame *, struct image *, Lisp_Object,
- Lisp_Object));
+void x_set_foreground_color (struct frame *, Lisp_Object, Lisp_Object);
+void x_set_background_color (struct frame *, Lisp_Object, Lisp_Object);
+void x_set_mouse_color (struct frame *, Lisp_Object, Lisp_Object);
+void x_set_cursor_color (struct frame *, Lisp_Object, Lisp_Object);
+void x_set_border_color (struct frame *, Lisp_Object, Lisp_Object);
+void x_set_cursor_type (struct frame *, Lisp_Object, Lisp_Object);
+void x_set_icon_type (struct frame *, Lisp_Object, Lisp_Object);
+void x_set_icon_name (struct frame *, Lisp_Object, Lisp_Object);
+void x_explicitly_set_name (struct frame *, Lisp_Object, Lisp_Object);
+void x_set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object);
+void x_set_title (struct frame *, Lisp_Object, Lisp_Object);
+void x_set_tool_bar_lines (struct frame *, Lisp_Object, Lisp_Object);
\f
not Emacs's own window. */
void
-x_real_positions (f, xptr, yptr)
- FRAME_PTR f;
- int *xptr, *yptr;
+x_real_positions (FRAME_PTR f, int *xptr, int *yptr)
{
POINT pt;
RECT rect;
This adds or updates a named color to `w32-color-map', making it
available for use. The original entry's RGB ref is returned, or nil
if the entry is new. */)
- (red, green, blue, name)
- Lisp_Object red, green, blue, name;
+ (Lisp_Object red, Lisp_Object green, Lisp_Object blue, Lisp_Object name)
{
Lisp_Object rgb;
Lisp_Object oldrgb = Qnil;
DEFUN ("w32-default-color-map", Fw32_default_color_map, Sw32_default_color_map,
0, 0, 0, doc: /* Return the default color map. */)
- ()
+ (void)
{
int i;
colormap_t *pc = w32_color_map;
}
static Lisp_Object
-w32_to_x_color (rgb)
- Lisp_Object rgb;
-{
- Lisp_Object color;
-
- CHECK_NUMBER (rgb);
-
- BLOCK_INPUT;
-
- color = Frassq (rgb, Vw32_color_map);
-
- UNBLOCK_INPUT;
-
- if (!NILP (color))
- return (Fcar (color));
- else
- return Qnil;
-}
-
-static Lisp_Object
-w32_color_map_lookup (colorname)
- char *colorname;
+w32_color_map_lookup (char *colorname)
{
Lisp_Object tail, ret = Qnil;
static void
-add_system_logical_colors_to_map (system_colors)
- Lisp_Object *system_colors;
+add_system_logical_colors_to_map (Lisp_Object *system_colors)
{
HKEY colors_key;
static Lisp_Object
-x_to_w32_color (colorname)
- char * colorname;
+x_to_w32_color (char * colorname)
{
register Lisp_Object ret = Qnil;
/* Gamma-correct COLOR on frame F. */
void
-gamma_correct (f, color)
- struct frame *f;
- COLORREF *color;
+gamma_correct (struct frame *f, COLORREF *color)
{
if (f->gamma)
{
If ALLOC is nonzero, allocate a new colormap cell. */
int
-w32_defined_color (f, color, color_def, alloc)
- FRAME_PTR f;
- char *color;
- XColor *color_def;
- int alloc;
+w32_defined_color (FRAME_PTR f, char *color, XColor *color_def, int alloc)
{
register Lisp_Object tem;
COLORREF w32_color_ref;
ARG says. */
int
-x_decode_color (f, arg, def)
- FRAME_PTR f;
- Lisp_Object arg;
- int def;
+x_decode_color (FRAME_PTR f, Lisp_Object arg, int def)
{
XColor cdef;
in the standard place; do not attempt to change the window. */
void
-x_set_foreground_color (f, arg, oldval)
- struct frame *f;
- Lisp_Object arg, oldval;
+x_set_foreground_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
{
struct w32_output *x = f->output_data.w32;
PIX_TYPE fg, old_fg;
}
void
-x_set_background_color (f, arg, oldval)
- struct frame *f;
- Lisp_Object arg, oldval;
+x_set_background_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
{
FRAME_BACKGROUND_PIXEL (f)
= x_decode_color (f, arg, WHITE_PIX_DEFAULT (f));
}
void
-x_set_mouse_color (f, arg, oldval)
- struct frame *f;
- Lisp_Object arg, oldval;
+x_set_mouse_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
{
Cursor cursor, nontext_cursor, mode_cursor, hand_cursor;
int count;
}
void
-x_set_cursor_color (f, arg, oldval)
- struct frame *f;
- Lisp_Object arg, oldval;
+x_set_cursor_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
{
unsigned long fore_pixel, pixel;
F has a window. */
void
-x_set_border_pixel (f, pix)
- struct frame *f;
- int pix;
+x_set_border_pixel (struct frame *f, int pix)
{
f->output_data.w32->border_pixel = pix;
F has a window; it must be redone when the window is created. */
void
-x_set_border_color (f, arg, oldval)
- struct frame *f;
- Lisp_Object arg, oldval;
+x_set_border_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
{
int pix;
void
-x_set_cursor_type (f, arg, oldval)
- FRAME_PTR f;
- Lisp_Object arg, oldval;
+x_set_cursor_type (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval)
{
set_frame_cursor_types (f, arg);
}
\f
void
-x_set_icon_type (f, arg, oldval)
- struct frame *f;
- Lisp_Object arg, oldval;
+x_set_icon_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
{
int result;
}
void
-x_set_icon_name (f, arg, oldval)
- struct frame *f;
- Lisp_Object arg, oldval;
+x_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
{
if (STRINGP (arg))
{
\f
void
-x_set_menu_bar_lines (f, value, oldval)
- struct frame *f;
- Lisp_Object value, oldval;
+x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
{
int nlines;
int olines = FRAME_MENU_BAR_LINES (f);
The frame's height doesn't change. */
void
-x_set_tool_bar_lines (f, value, oldval)
- struct frame *f;
- Lisp_Object value, oldval;
+x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
{
int delta, nlines, root_height;
Lisp_Object root_window;
F->explicit_name is set, ignore the new name; otherwise, set it. */
void
-x_set_name (f, name, explicit)
- struct frame *f;
- Lisp_Object name;
- int explicit;
+x_set_name (struct frame *f, Lisp_Object name, int explicit)
{
/* Make sure that requests from lisp code override requests from
Emacs redisplay code. */
specified a name for the frame; the name will override any set by the
redisplay code. */
void
-x_explicitly_set_name (f, arg, oldval)
- FRAME_PTR f;
- Lisp_Object arg, oldval;
+x_explicitly_set_name (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval)
{
x_set_name (f, arg, 1);
}
name; names set this way will never override names set by the user's
lisp code. */
void
-x_implicitly_set_name (f, arg, oldval)
- FRAME_PTR f;
- Lisp_Object arg, oldval;
+x_implicitly_set_name (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval)
{
x_set_name (f, arg, 0);
}
If NAME is nil, use the frame name as the title. */
void
-x_set_title (f, name, old_name)
- struct frame *f;
- Lisp_Object name, old_name;
+x_set_title (struct frame *f, Lisp_Object name, Lisp_Object old_name)
{
/* Don't change the title if it's already NAME. */
if (EQ (name, f->title))
}
}
-void x_set_scroll_bar_default_width (f)
- struct frame *f;
+void
+x_set_scroll_bar_default_width (struct frame *f)
{
int wid = FRAME_COLUMN_WIDTH (f);
return cursor;
}
-extern LRESULT CALLBACK w32_wnd_proc ();
+static LRESULT CALLBACK w32_wnd_proc (HWND, UINT, WPARAM, LPARAM);
static BOOL
-w32_init_class (hinst)
- HINSTANCE hinst;
+w32_init_class (HINSTANCE hinst)
{
WNDCLASS wc;
}
static HWND
-w32_createscrollbar (f, bar)
- struct frame *f;
- struct scroll_bar * bar;
+w32_createscrollbar (struct frame *f, struct scroll_bar * bar)
{
return (CreateWindow ("SCROLLBAR", "", SBS_VERT | WS_CHILD | WS_VISIBLE,
/* Position and size of scroll bar. */
}
static void
-w32_createwindow (f)
- struct frame *f;
+w32_createwindow (struct frame *f)
{
HWND hwnd;
RECT rect;
}
static void
-my_post_msg (wmsg, hwnd, msg, wParam, lParam)
- W32Msg * wmsg;
- HWND hwnd;
- UINT msg;
- WPARAM wParam;
- LPARAM lParam;
+my_post_msg (W32Msg * wmsg, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
wmsg->msg.hwnd = hwnd;
wmsg->msg.message = msg;
it regains focus, be conservative and clear all modifiers since
we cannot reconstruct the left and right modifier state. */
static void
-reset_modifiers ()
+reset_modifiers (void)
{
SHORT ctrl, alt;
modifier keys, we know that, if no modifiers are set, then neither
the left or right modifier should be set. */
static void
-sync_modifiers ()
+sync_modifiers (void)
{
if (!modifiers_recorded)
return;
}
static unsigned int
-w32_get_modifiers ()
+w32_get_modifiers (void)
{
return ((modifier_set (VK_SHIFT) ? shift_modifier : 0) |
(modifier_set (VK_CONTROL) ? ctrl_modifier : 0) |
and window input. */
static int
-construct_console_modifiers ()
+construct_console_modifiers (void)
{
int mods;
combinations like Alt-Tab which are used by the system. */
static void
-register_hot_keys (hwnd)
- HWND hwnd;
+register_hot_keys (HWND hwnd)
{
Lisp_Object keylist;
}
static void
-unregister_hot_keys (hwnd)
- HWND hwnd;
+unregister_hot_keys (HWND hwnd)
{
Lisp_Object keylist;
}
static void
-cancel_all_deferred_msgs ()
+cancel_all_deferred_msgs (void)
{
deferred_msg * item;
}
static void
-signal_user_input ()
+signal_user_input (void)
{
/* Interrupt any lisp that wants to be interrupted by input. */
if (!NILP (Vthrow_on_input))
static void
-post_character_message (hwnd, msg, wParam, lParam, modifiers)
- HWND hwnd;
- UINT msg;
- WPARAM wParam;
- LPARAM lParam;
- DWORD modifiers;
-
+post_character_message (HWND hwnd, UINT msg,
+ WPARAM wParam, LPARAM lParam,
+ DWORD modifiers)
{
W32Msg wmsg;
/* Main window procedure */
-LRESULT CALLBACK
-w32_wnd_proc (hwnd, msg, wParam, lParam)
- HWND hwnd;
- UINT msg;
- WPARAM wParam;
- LPARAM lParam;
+static LRESULT CALLBACK
+w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
struct frame *f;
struct w32_display_info *dpyinfo = &one_w32_display_info;
{
PAINTSTRUCT paintStruct;
RECT update_rect;
- bzero (&update_rect, sizeof (update_rect));
+ memset (&update_rect, 0, sizeof (update_rect));
f = x_window_to_frame (dpyinfo, hwnd);
if (f == 0)
HIMC context;
struct window *w;
- if (!context)
- break;
-
f = x_window_to_frame (dpyinfo, hwnd);
w = XWINDOW (FRAME_SELECTED_WINDOW (f));
- WINDOW_MODE_LINE_HEIGHT (w));
context = get_ime_context_fn (hwnd);
+
+ if (!context)
+ break;
+
set_ime_composition_window_fn (context, &form);
release_ime_context_fn (hwnd, context);
}
}
static void
-my_create_window (f)
- struct frame * f;
+my_create_window (struct frame * f)
{
MSG msg;
messages for the tooltip. Creating tooltips indirectly also creates
deadlocks when tooltips are created for menu items. */
static void
-my_create_tip_window (f)
- struct frame *f;
+my_create_tip_window (struct frame *f)
{
RECT rect;
/* Create and set up the w32 window for frame F. */
static void
-w32_window (f, window_prompting, minibuffer_only)
- struct frame *f;
- long window_prompting;
- int minibuffer_only;
+w32_window (struct frame *f, long window_prompting, int minibuffer_only)
{
BLOCK_INPUT;
well. */
static void
-x_icon (f, parms)
- struct frame *f;
- Lisp_Object parms;
+x_icon (struct frame *f, Lisp_Object parms)
{
Lisp_Object icon_x, icon_y;
struct w32_display_info *dpyinfo = &one_w32_display_info;
static void
-x_make_gc (f)
- struct frame *f;
+x_make_gc (struct frame *f)
{
XGCValues gc_values;
constructed. */
static Lisp_Object
-unwind_create_frame (frame)
- Lisp_Object frame;
+unwind_create_frame (Lisp_Object frame)
{
struct frame *f = XFRAME (frame);
}
static void
-x_default_font_parameter (f, parms)
- struct frame *f;
- Lisp_Object parms;
+x_default_font_parameter (struct frame *f, Lisp_Object parms)
{
struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f);
Lisp_Object font_param = x_get_arg (dpyinfo, parms, Qfont, NULL, NULL,
be shared by the new frame.
This function is an internal primitive--use `make-frame' instead. */)
- (parameters)
- Lisp_Object parameters;
+ (Lisp_Object parameters)
{
struct frame *f;
Lisp_Object frame, tem;
f->output_method = output_w32;
f->output_data.w32 =
(struct w32_output *) xmalloc (sizeof (struct w32_output));
- bzero (f->output_data.w32, sizeof (struct w32_output));
+ memset (f->output_data.w32, 0, sizeof (struct w32_output));
FRAME_FONTSET (f) = -1;
f->icon_name
"background", "Background", RES_TYPE_STRING);
x_default_parameter (f, parameters, Qmouse_color, build_string ("black"),
"pointerColor", "Foreground", RES_TYPE_STRING);
- x_default_parameter (f, parameters, Qcursor_color, build_string ("black"),
- "cursorColor", "Foreground", RES_TYPE_STRING);
x_default_parameter (f, parameters, Qborder_color, build_string ("black"),
"borderColor", "BorderColor", RES_TYPE_STRING);
x_default_parameter (f, parameters, Qscreen_gamma, Qnil,
happen. */
init_frame_faces (f);
- x_default_parameter (f, parameters, Qmenu_bar_lines, make_number (1),
- "menuBar", "MenuBar", RES_TYPE_NUMBER);
- x_default_parameter (f, parameters, Qtool_bar_lines, make_number (1),
- "toolBar", "ToolBar", RES_TYPE_NUMBER);
+ /* The X resources controlling the menu-bar and tool-bar are
+ processed specially at startup, and reflected in the mode
+ variables; ignore them here. */
+ x_default_parameter (f, parameters, Qmenu_bar_lines,
+ NILP (Vmenu_bar_mode)
+ ? make_number (0) : make_number (1),
+ NULL, NULL, RES_TYPE_NUMBER);
+ x_default_parameter (f, parameters, Qtool_bar_lines,
+ NILP (Vtool_bar_mode)
+ ? make_number (0) : make_number (1),
+ NULL, NULL, RES_TYPE_NUMBER);
x_default_parameter (f, parameters, Qbuffer_predicate, Qnil,
"bufferPredicate", "BufferPredicate", RES_TYPE_SYMBOL);
display info directly because we're called from frame.c, which doesn't
know about that structure. */
Lisp_Object
-x_get_focus_frame (frame)
- struct frame *frame;
+x_get_focus_frame (struct frame *frame)
{
struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (frame);
Lisp_Object xfocus;
DEFUN ("x-focus-frame", Fx_focus_frame, Sx_focus_frame, 1, 1, 0,
doc: /* Give FRAME input focus, raising to foreground if necessary. */)
- (frame)
- Lisp_Object frame;
+ (Lisp_Object frame)
{
x_focus_on_frame (check_x_frame (frame));
return Qnil;
\f
DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0,
- doc: /* Internal function called by `color-defined-p', which see. */)
- (color, frame)
- Lisp_Object color, frame;
+ doc: /* Internal function called by `color-defined-p', which see.
+\(Note that the Nextstep version of this function ignores FRAME.) */)
+ (Lisp_Object color, Lisp_Object frame)
{
XColor foo;
FRAME_PTR f = check_x_frame (frame);
DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0,
doc: /* Internal function called by `color-values', which see. */)
- (color, frame)
- Lisp_Object color, frame;
+ (Lisp_Object color, Lisp_Object frame)
{
XColor foo;
FRAME_PTR f = check_x_frame (frame);
DEFUN ("xw-display-color-p", Fxw_display_color_p, Sxw_display_color_p, 0, 1, 0,
doc: /* Internal function called by `display-color-p', which see. */)
- (display)
- Lisp_Object display;
+ (Lisp_Object display)
{
struct w32_display_info *dpyinfo = check_x_display_info (display);
The optional argument DISPLAY specifies which display to ask about.
DISPLAY should be either a frame or a display name (a string).
If omitted or nil, that stands for the selected frame's display. */)
- (display)
- Lisp_Object display;
+ (Lisp_Object display)
{
struct w32_display_info *dpyinfo = check_x_display_info (display);
The optional argument DISPLAY specifies which display to ask about.
DISPLAY should be either a frame or a display name (a string).
If omitted or nil, that stands for the selected frame's display. */)
- (display)
- Lisp_Object display;
+ (Lisp_Object display)
{
struct w32_display_info *dpyinfo = check_x_display_info (display);
The optional argument DISPLAY specifies which display to ask about.
DISPLAY should be either a frame or a display name (a string).
If omitted or nil, that stands for the selected frame's display. */)
- (display)
- Lisp_Object display;
+ (Lisp_Object display)
{
struct w32_display_info *dpyinfo = check_x_display_info (display);
The optional argument DISPLAY specifies which display to ask about.
DISPLAY should be either a frame or a display name (a string).
If omitted or nil, that stands for the selected frame's display. */)
- (display)
- Lisp_Object display;
+ (Lisp_Object display)
{
struct w32_display_info *dpyinfo = check_x_display_info (display);
The optional argument DISPLAY specifies which display to ask about.
DISPLAY should be either a frame or a display name (a string).
If omitted or nil, that stands for the selected frame's display. */)
- (display)
- Lisp_Object display;
+ (Lisp_Object display)
{
struct w32_display_info *dpyinfo = check_x_display_info (display);
HDC hdc;
The optional argument DISPLAY specifies which display to ask about.
DISPLAY should be either a frame or a display name (a string).
If omitted or nil, that stands for the selected frame's display. */)
- (display)
- Lisp_Object display;
+ (Lisp_Object display)
{
struct w32_display_info *dpyinfo = check_x_display_info (display);
The optional argument DISPLAY specifies which display to ask about.
DISPLAY should be either a frame or a display name (a string).
If omitted or nil, that stands for the selected frame's display. */)
- (display)
- Lisp_Object display;
+ (Lisp_Object display)
{
return build_string ("Microsoft Corp.");
}
The optional argument DISPLAY specifies which display to ask about.
DISPLAY should be either a frame or a display name (a string).
If omitted or nil, that stands for the selected frame's display. */)
- (display)
- Lisp_Object display;
+ (Lisp_Object display)
{
return Fcons (make_number (w32_major_version),
Fcons (make_number (w32_minor_version),
The optional argument DISPLAY specifies which display to ask about.
DISPLAY should be either a frame or a display name (a string).
If omitted or nil, that stands for the selected frame's display. */)
- (display)
- Lisp_Object display;
+ (Lisp_Object display)
{
return make_number (1);
}
The optional argument DISPLAY specifies which display to ask about.
DISPLAY should be either a frame or a display name (a string).
If omitted or nil, that stands for the selected frame's display. */)
- (display)
- Lisp_Object display;
+ (Lisp_Object display)
{
struct w32_display_info *dpyinfo = check_x_display_info (display);
HDC hdc;
The optional argument DISPLAY specifies which display to ask about.
DISPLAY should be either a frame or a display name (a string).
If omitted or nil, that stands for the selected frame's display. */)
- (display)
- Lisp_Object display;
+ (Lisp_Object display)
{
struct w32_display_info *dpyinfo = check_x_display_info (display);
The optional argument DISPLAY specifies which display to ask about.
DISPLAY should be either a frame or a display name (a string).
If omitted or nil, that stands for the selected frame's display. */)
- (display)
- Lisp_Object display;
+ (Lisp_Object display)
{
return intern ("not-useful");
}
The optional argument DISPLAY specifies which display to ask about.
DISPLAY should be either a frame or a display name (a string).
If omitted or nil, that stands for the selected frame's display. */)
- (display)
- Lisp_Object display;
+ (Lisp_Object display)
{
struct w32_display_info *dpyinfo = check_x_display_info (display);
Lisp_Object result = Qnil;
The optional argument DISPLAY specifies which display to ask about.
DISPLAY should be either a frame or a display name (a string).
If omitted or nil, that stands for the selected frame's display. */)
- (display)
- Lisp_Object display;
+ (Lisp_Object display)
{
return Qnil;
}
\f
int
-x_pixel_width (f)
- register struct frame *f;
+x_pixel_width (register struct frame *f)
{
return FRAME_PIXEL_WIDTH (f);
}
int
-x_pixel_height (f)
- register struct frame *f;
+x_pixel_height (register struct frame *f)
{
return FRAME_PIXEL_HEIGHT (f);
}
int
-x_char_width (f)
- register struct frame *f;
+x_char_width (register struct frame *f)
{
return FRAME_COLUMN_WIDTH (f);
}
int
-x_char_height (f)
- register struct frame *f;
+x_char_height (register struct frame *f)
{
return FRAME_LINE_HEIGHT (f);
}
int
-x_screen_planes (f)
- register struct frame *f;
+x_screen_planes (register struct frame *f)
{
return FRAME_W32_DISPLAY_INFO (f)->n_planes;
}
Open a new connection if necessary. */
struct w32_display_info *
-x_display_info_for_name (name)
- Lisp_Object name;
+x_display_info_for_name (Lisp_Object name)
{
Lisp_Object names;
struct w32_display_info *dpyinfo;
}
DEFUN ("x-open-connection", Fx_open_connection, Sx_open_connection,
- 1, 3, 0, doc: /* Open a connection to a server.
+ 1, 3, 0, doc: /* Open a connection to a display server.
DISPLAY is the name of the display to connect to.
Optional second arg XRM-STRING is a string of resources in xrdb format.
If the optional third arg MUST-SUCCEED is non-nil,
-terminate Emacs if we can't open the connection. */)
- (display, xrm_string, must_succeed)
- Lisp_Object display, xrm_string, must_succeed;
+terminate Emacs if we can't open the connection.
+\(In the Nextstep version, the last two arguments are currently ignored.) */)
+ (Lisp_Object display, Lisp_Object xrm_string, Lisp_Object must_succeed)
{
unsigned char *xrm_option;
struct w32_display_info *dpyinfo;
doc: /* Close the connection to DISPLAY's server.
For DISPLAY, specify either a frame or a display name (a string).
If DISPLAY is nil, that stands for the selected frame's display. */)
- (display)
- Lisp_Object display;
+ (Lisp_Object display)
{
struct w32_display_info *dpyinfo = check_x_display_info (display);
int i;
DEFUN ("x-display-list", Fx_display_list, Sx_display_list, 0, 0, 0,
doc: /* Return the list of display names that Emacs has connections to. */)
- ()
+ (void)
{
Lisp_Object tail, result;
}
DEFUN ("x-synchronize", Fx_synchronize, Sx_synchronize, 1, 2, 0,
- doc: /* This is a noop on W32 systems. */)
- (on, display)
- Lisp_Object display, on;
+ doc: /* If ON is non-nil, report X errors as soon as the erring request is made.
+This function only has an effect on X Windows. With MS Windows, it is
+defined but does nothing.
+
+If ON is nil, allow buffering of requests.
+Turning on synchronization prohibits the Xlib routines from buffering
+requests and seriously degrades performance, but makes debugging much
+easier.
+The optional second argument TERMINAL specifies which display to act on.
+TERMINAL should be a terminal object, a frame or a display name (a string).
+If TERMINAL is omitted or nil, that stands for the selected frame's display. */)
+ (Lisp_Object on, Lisp_Object display)
{
return Qnil;
}
DEFUN ("x-change-window-property", Fx_change_window_property,
Sx_change_window_property, 2, 6, 0,
doc: /* Change window property PROP to VALUE on the X window of FRAME.
-VALUE may be a string or a list of conses, numbers and/or strings.
-If an element in the list is a string, it is converted to
-an Atom and the value of the Atom is used. If an element is a cons,
-it is converted to a 32 bit number where the car is the 16 top bits and the
-cdr is the lower 16 bits.
+PROP must be a string. VALUE may be a string or a list of conses,
+numbers and/or strings. If an element in the list is a string, it is
+converted to an atom and the value of the Atom is used. If an element
+is a cons, it is converted to a 32 bit number where the car is the 16
+top bits and the cdr is the lower 16 bits.
+
FRAME nil or omitted means use the selected frame.
If TYPE is given and non-nil, it is the name of the type of VALUE.
If TYPE is not given or nil, the type is STRING.
It must be one of 8, 16 or 32.
If VALUE is a string or FORMAT is nil or not given, FORMAT defaults to 8.
If OUTER_P is non-nil, the property is changed for the outer X window of
-FRAME. Default is to change on the edit X window.
-
-Value is VALUE. */)
- (prop, value, frame, type, format, outer_p)
- Lisp_Object prop, value, frame, type, format, outer_p;
+FRAME. Default is to change on the edit X window. */)
+ (Lisp_Object prop, Lisp_Object value, Lisp_Object frame, Lisp_Object type, Lisp_Object format, Lisp_Object outer_p)
{
#if 0 /* TODO : port window properties to W32 */
struct frame *f = check_x_frame (frame);
Sx_delete_window_property, 1, 2, 0,
doc: /* Remove window property PROP from X window of FRAME.
FRAME nil or omitted means use the selected frame. Value is PROP. */)
- (prop, frame)
- Lisp_Object prop, frame;
+ (Lisp_Object prop, Lisp_Object frame)
{
#if 0 /* TODO : port window properties to W32 */
DEFUN ("x-window-property", Fx_window_property, Sx_window_property,
1, 2, 0,
doc: /* Value is the value of window property PROP on FRAME.
-If FRAME is nil or omitted, use the selected frame. Value is nil
-if FRAME hasn't a property with name PROP or if PROP has no string
-value. */)
- (prop, frame)
- Lisp_Object prop, frame;
+If FRAME is nil or omitted, use the selected frame.
+
+On MS Windows, this function only accepts the PROP and FRAME arguments.
+
+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 retreiving it.
+If VECTOR_RET_P is non-nil, don't return a string but a vector of values.
+
+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)
{
#if 0 /* TODO : port window properties to W32 */
xdisp.c could be used. */
int
-hourglass_started ()
+hourglass_started (void)
{
return hourglass_shown_p || hourglass_timer;
}
/* Cancel a currently active hourglass timer, and start a new one. */
void
-start_hourglass ()
+start_hourglass (void)
{
DWORD delay;
int secs, msecs = 0;
cursor if shown. */
void
-cancel_hourglass ()
+cancel_hourglass (void)
{
if (hourglass_timer)
{
to indicate that an hourglass cursor is shown. */
static void
-w32_show_hourglass (f)
- struct frame *f;
+w32_show_hourglass (struct frame *f)
{
if (!hourglass_shown_p)
{
/* Hide the hourglass cursor on all frames, if it is currently shown. */
static void
-w32_hide_hourglass ()
+w32_hide_hourglass (void)
{
if (hourglass_shown_p)
{
Tool tips
***********************************************************************/
-static Lisp_Object x_create_tip_frame P_ ((struct w32_display_info *,
- Lisp_Object, Lisp_Object));
-static void compute_tip_xy P_ ((struct frame *, Lisp_Object, Lisp_Object,
- Lisp_Object, int, int, int *, int *));
+static Lisp_Object x_create_tip_frame (struct w32_display_info *,
+ Lisp_Object, Lisp_Object);
+static void compute_tip_xy (struct frame *, Lisp_Object, Lisp_Object,
+ Lisp_Object, int, int, int *, int *);
/* The frame of a currently visible tooltip. */
static Lisp_Object
-unwind_create_tip_frame (frame)
- Lisp_Object frame;
+unwind_create_tip_frame (Lisp_Object frame)
{
Lisp_Object deleted;
when this happens. */
static Lisp_Object
-x_create_tip_frame (dpyinfo, parms, text)
- struct w32_display_info *dpyinfo;
- Lisp_Object parms, text;
+x_create_tip_frame (struct w32_display_info *dpyinfo,
+ Lisp_Object parms, Lisp_Object text)
{
struct frame *f;
Lisp_Object frame, tem;
f->output_method = output_w32;
f->output_data.w32 =
(struct w32_output *) xmalloc (sizeof (struct w32_output));
- bzero (f->output_data.w32, sizeof (struct w32_output));
+ memset (f->output_data.w32, 0, sizeof (struct w32_output));
FRAME_FONTSET (f) = -1;
f->icon_name = Qnil;
the display in *ROOT_X, and *ROOT_Y. */
static void
-compute_tip_xy (f, parms, dx, dy, width, height, root_x, root_y)
- struct frame *f;
- Lisp_Object parms, dx, dy;
- int width, height;
- int *root_x, *root_y;
+compute_tip_xy (struct frame *f,
+ Lisp_Object parms, Lisp_Object dx, Lisp_Object dy,
+ int width, int height, int *root_x, int *root_y)
{
Lisp_Object left, top;
int min_x, min_y, max_x, max_y;
A tooltip's maximum size is specified by `x-max-tooltip-size'.
Text larger than the specified size is clipped. */)
- (string, frame, parms, timeout, dx, dy)
- Lisp_Object string, frame, parms, timeout, dx, dy;
+ (Lisp_Object string, Lisp_Object frame, Lisp_Object parms, Lisp_Object timeout, Lisp_Object dx, Lisp_Object dy)
{
struct frame *f;
struct window *w;
int root_x, root_y;
struct buffer *old_buffer;
struct text_pos pos;
- int i, width, height;
+ int i, width, height, seen_reversed_p;
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
int old_windows_or_buffers_changed = windows_or_buffers_changed;
int count = SPECPDL_INDEX ();
try_window (FRAME_ROOT_WINDOW (f), pos, TRY_WINDOW_IGNORE_FONTS_CHANGE);
/* Compute width and height of the tooltip. */
- width = height = 0;
+ width = height = seen_reversed_p = 0;
for (i = 0; i < w->desired_matrix->nrows; ++i)
{
struct glyph_row *row = &w->desired_matrix->rows[i];
/* Let the row go over the full width of the frame. */
row->full_width_p = 1;
- /* There's a glyph at the end of rows that is used to place
- the cursor there. Don't include the width of this glyph. */
+ row_width = row->pixel_width;
if (row->used[TEXT_AREA])
{
- last = &row->glyphs[TEXT_AREA][row->used[TEXT_AREA] - 1];
- row_width = row->pixel_width - last->pixel_width;
+ if (!row->reversed_p)
+ {
+ /* There's a glyph at the end of rows that is used to
+ place the cursor there. Don't include the width of
+ this glyph. */
+ last = &row->glyphs[TEXT_AREA][row->used[TEXT_AREA] - 1];
+ if (INTEGERP (last->object))
+ row_width -= last->pixel_width;
+ }
+ else
+ {
+ /* There could be a stretch glyph at the beginning of R2L
+ rows that is produced by extend_face_to_end_of_line.
+ Don't count that glyph. */
+ struct glyph *g = row->glyphs[TEXT_AREA];
+
+ if (g->type == STRETCH_GLYPH && INTEGERP (g->object))
+ {
+ row_width -= g->pixel_width;
+ seen_reversed_p = 1;
+ }
+ }
}
- else
- row_width = row->pixel_width;
height += row->height;
width = max (width, row_width);
}
+ /* If we've seen partial-length R2L rows, we need to re-adjust the
+ tool-tip frame width and redisplay it again, to avoid over-wide
+ tips due to the stretch glyph that extends R2L lines to full
+ width of the frame. */
+ if (seen_reversed_p)
+ {
+ /* w->total_cols and FRAME_TOTAL_COLS want the width in columns,
+ not in pixels. */
+ width /= WINDOW_FRAME_COLUMN_WIDTH (w);
+ w->total_cols = make_number (width);
+ FRAME_TOTAL_COLS (f) = width;
+ adjust_glyphs (f);
+ w->pseudo_window_p = 1;
+ clear_glyph_matrix (w->desired_matrix);
+ clear_glyph_matrix (w->current_matrix);
+ try_window (FRAME_ROOT_WINDOW (f), pos, TRY_WINDOW_IGNORE_FONTS_CHANGE);
+ width = height = 0;
+ /* Recompute width and height of the tooltip. */
+ for (i = 0; i < w->desired_matrix->nrows; ++i)
+ {
+ struct glyph_row *row = &w->desired_matrix->rows[i];
+ struct glyph *last;
+ int row_width;
+
+ if (!row->enabled_p || !row->displays_text_p)
+ break;
+ row->full_width_p = 1;
+ row_width = row->pixel_width;
+ if (row->used[TEXT_AREA] && !row->reversed_p)
+ {
+ last = &row->glyphs[TEXT_AREA][row->used[TEXT_AREA] - 1];
+ if (INTEGERP (last->object))
+ row_width -= last->pixel_width;
+ }
+
+ height += row->height;
+ width = max (width, row_width);
+ }
+ }
+
/* Round up the height to an integral multiple of FRAME_LINE_HEIGHT. */
if (height % FRAME_LINE_HEIGHT (f) != 0)
height += FRAME_LINE_HEIGHT (f) - height % FRAME_LINE_HEIGHT (f);
DEFUN ("x-hide-tip", Fx_hide_tip, Sx_hide_tip, 0, 0, 0,
doc: /* Hide the current tooltip window, if there is any.
Value is t if tooltip was open, nil otherwise. */)
- ()
+ (void)
{
int count;
Lisp_Object deleted, frame, timer;
read-only when "Directories" is selected in the filter. This
allows us to work around the fact that the standard Open File
dialog does not support directories. */
-UINT CALLBACK
-file_dialog_callback (hwnd, msg, wParam, lParam)
- HWND hwnd;
- UINT msg;
- WPARAM wParam;
- LPARAM lParam;
+static UINT CALLBACK
+file_dialog_callback (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
if (msg == WM_NOTIFY)
{
DEFUN ("x-file-dialog", Fx_file_dialog, Sx_file_dialog, 2, 5, 0,
doc: /* Read file name, prompting with PROMPT in directory DIR.
-Use a file selection dialog.
-Select DEFAULT-FILENAME in the dialog's file selection box, if
-specified. Ensure that file exists if MUSTMATCH is non-nil.
-If ONLY-DIR-P is non-nil, the user can only select directories. */)
- (prompt, dir, default_filename, mustmatch, only_dir_p)
- Lisp_Object prompt, dir, default_filename, mustmatch, only_dir_p;
+Use a file selection dialog. Select DEFAULT-FILENAME in the dialog's file
+selection box, if specified. If MUSTMATCH is non-nil, the returned file
+or directory must exist.
+
+This function is only defined on MS Windows, and X Windows with the
+Motif or Gtk toolkits. With the Motif toolkit, ONLY-DIR-P is ignored.
+Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */)
+ (Lisp_Object prompt, Lisp_Object dir, Lisp_Object default_filename, Lisp_Object mustmatch, Lisp_Object only_dir_p)
{
struct frame *f = SELECTED_FRAME ();
Lisp_Object file = Qnil;
specbind (Qinhibit_redisplay, Qt);
BLOCK_INPUT;
- bzero (&new_file_details, sizeof (new_file_details));
+ memset (&new_file_details, 0, sizeof (new_file_details));
/* Apparently NT4 crashes if you give it an unexpected size.
I'm not sure about Windows 9x, so play it safe. */
if (w32_major_version > 4 && w32_major_version < 95)
DEFUN ("system-move-file-to-trash", Fsystem_move_file_to_trash,
Ssystem_move_file_to_trash, 1, 1, 0,
doc: /* Move file or directory named FILENAME to the recycle bin. */)
- (filename)
- Lisp_Object filename;
+ (Lisp_Object filename)
{
Lisp_Object handler;
Lisp_Object encoded_file;
/* On Windows, write permission is required to delete/move files. */
_chmod (path, 0666);
- bzero (tmp_path, sizeof (tmp_path));
+ memset (tmp_path, 0, sizeof (tmp_path));
strcpy (tmp_path, path);
- bzero (&file_op, sizeof (file_op));
+ memset (&file_op, 0, sizeof (file_op));
file_op.hwnd = HWND_DESKTOP;
file_op.wFunc = FO_DELETE;
file_op.pFrom = tmp_path;
screen saver if defined.
If optional parameter FRAME is not specified, use selected frame. */)
- (command, frame)
- Lisp_Object command, frame;
+ (Lisp_Object command, Lisp_Object frame)
{
FRAME_PTR f = check_x_frame (frame);
1 - start normally
3 - start maximized
6 - start minimized */)
- (operation, document, parameters, show_flag)
- Lisp_Object operation, document, parameters, show_flag;
+ (Lisp_Object operation, Lisp_Object document, Lisp_Object parameters, Lisp_Object show_flag)
{
Lisp_Object current_dir;
char *errstr;
/* Convert a one-element vector style key sequence to a hot key
definition. */
static Lisp_Object
-w32_parse_hot_key (key)
- Lisp_Object key;
+w32_parse_hot_key (Lisp_Object key)
{
/* Copied from Fdefine_key and store_in_keymap. */
register Lisp_Object c;
is always interpreted as the Windows modifier keys.
The return value is the hotkey-id if registered, otherwise nil. */)
- (key)
- Lisp_Object key;
+ (Lisp_Object key)
{
key = w32_parse_hot_key (key);
DEFUN ("w32-unregister-hot-key", Fw32_unregister_hot_key,
Sw32_unregister_hot_key, 1, 1, 0,
doc: /* Unregister KEY as a hot-key combination. */)
- (key)
- Lisp_Object key;
+ (Lisp_Object key)
{
Lisp_Object item;
DEFUN ("w32-registered-hot-keys", Fw32_registered_hot_keys,
Sw32_registered_hot_keys, 0, 0, 0,
doc: /* Return list of registered hot-key IDs. */)
- ()
+ (void)
{
return Fdelq (Qnil, Fcopy_sequence (w32_grabbed_keys));
}
Sw32_reconstruct_hot_key, 1, 1, 0,
doc: /* Convert hot-key ID to a lisp key combination.
usage: (w32-reconstruct-hot-key ID) */)
- (hotkeyid)
- Lisp_Object hotkeyid;
+ (Lisp_Object hotkeyid)
{
int vk_code, w32_modifiers;
Lisp_Object key;
KEY can be `capslock', `kp-numlock', or `scroll'.
If the optional parameter NEW-STATE is a number, then the state of KEY
is set to off if the low bit of NEW-STATE is zero, otherwise on. */)
- (key, new_state)
- Lisp_Object key, new_state;
+ (Lisp_Object key, Lisp_Object new_state)
{
int vk_code;
doc: /* Return non-nil if a window exists with the specified CLASS and NAME.
This is a direct interface to the Windows API FindWindow function. */)
- (class, name)
-Lisp_Object class, name;
+ (Lisp_Object class, Lisp_Object name)
{
HWND hnd;
%m Remaining time (to charge or discharge) in minutes
%h Remaining time (to charge or discharge) in hours
%t Remaining time (to charge or discharge) in the form `h:min' */)
- ()
+ (void)
{
Lisp_Object status = Qnil;
storage of the file system, FREE is the free storage, and AVAIL is the
storage available to a non-superuser. All 3 numbers are in bytes.
If the underlying system call fails, value is nil. */)
- (filename)
- Lisp_Object filename;
+ (Lisp_Object filename)
{
Lisp_Object encoded, value;
\f
DEFUN ("default-printer-name", Fdefault_printer_name, Sdefault_printer_name,
0, 0, 0, doc: /* Return the name of Windows default printer device. */)
- ()
+ (void)
{
static char pname_buf[256];
int err;
x_set_font_backend,
x_set_alpha,
0, /* x_set_sticky */
+ 0, /* x_set_tool_bar_position */
};
void
-syms_of_w32fns ()
+syms_of_w32fns (void)
{
globals_of_w32fns ();
/* This is zero if not using MS-Windows. */
is non zero.
*/
void
-globals_of_w32fns ()
+globals_of_w32fns (void)
{
HMODULE user32_lib = GetModuleHandle ("user32.dll");
/*
*/
track_mouse_event_fn = (TrackMouseEvent_Proc)
GetProcAddress (user32_lib, "TrackMouseEvent");
- /* ditto for GetClipboardSequenceNumber. */
- clipboard_sequence_fn = (ClipboardSequence_Proc)
- GetProcAddress (user32_lib, "GetClipboardSequenceNumber");
monitor_from_point_fn = (MonitorFromPoint_Proc)
GetProcAddress (user32_lib, "MonitorFromPoint");
#undef abort
void
-w32_abort ()
+w32_abort (void)
{
int button;
button = MessageBox (NULL,
/* For convenience when debugging. */
int
-w32_last_error ()
+w32_last_error (void)
{
return GetLastError ();
}
-/* arch-tag: 707589ab-b9be-4638-8cdd-74629cc9b446
- (do not change this comment) */