Merge chages made in Gnus trunk.
[emacs.git] / src / w32term.h
blob0731957cbd97bf58e8f3f549d4585f1567a628b8
1 /* Definitions and headers for communication on the Microsoft W32 API.
2 Copyright (C) 1995, 2001, 2002, 2003, 2004,
3 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
5 This file is part of GNU Emacs.
7 GNU Emacs is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
12 GNU Emacs is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
20 /* Added by Kevin Gallo */
22 #include "w32gui.h"
25 #define BLACK_PIX_DEFAULT(f) PALETTERGB(0,0,0)
26 #define WHITE_PIX_DEFAULT(f) PALETTERGB(255,255,255)
28 #define FONT_WIDTH(f) ((f)->max_width)
29 #define FONT_HEIGHT(f) ((f)->height)
30 #define FONT_BASE(f) ((f)->ascent)
31 #define FONT_DESCENT(f) ((f)->descent)
33 #define CP_DEFAULT 1004
35 #define CHECK_W32_FRAME(f, frame) \
36 if (NILP (frame)) \
37 f = SELECTED_FRAME (); \
38 else \
39 { \
40 CHECK_LIVE_FRAME (frame, 0); \
41 f = XFRAME (frame); \
42 } \
43 if (! FRAME_W32_P (f))
45 /* Indicates whether we are in the readsocket call and the message we
46 are processing in the current loop */
48 extern MSG CurMsg;
49 extern BOOL bUseDflt;
51 /* Structure recording bitmaps and reference count.
52 If REFCOUNT is 0 then this record is free to be reused. */
54 struct w32_bitmap_record
56 Pixmap pixmap;
57 char *file;
58 HINSTANCE hinst; /* Used to load the file */
59 int refcount;
60 /* Record some info about this pixmap. */
61 int height, width, depth;
64 struct w32_palette_entry {
65 struct w32_palette_entry * next;
66 PALETTEENTRY entry;
67 #if 0
68 unsigned refcount;
69 #endif
72 extern void w32_regenerate_palette(struct frame *f);
75 /* For each display (currently only one on w32), we have a structure that
76 records information about it. */
78 struct w32_display_info
80 /* Chain of all w32_display_info structures. */
81 struct w32_display_info *next;
83 /* The generic display parameters corresponding to this w32 display. */
84 struct terminal *terminal;
86 /* This is a cons cell of the form (NAME . FONT-LIST-CACHE).
87 The same cons cell also appears in x_display_name_list. */
88 Lisp_Object name_list_element;
90 /* Number of frames that are on this display. */
91 int reference_count;
93 /* Dots per inch of the screen. */
94 double resx, resy;
96 /* Number of planes on this screen. */
97 int n_planes;
99 /* Number of bits per pixel on this screen. */
100 int n_cbits;
102 /* Mask of things that cause the mouse to be grabbed. */
103 int grabbed;
105 /* Emacs bitmap-id of the default icon bitmap for this frame.
106 Or -1 if none has been allocated yet. */
107 int icon_bitmap_id;
109 /* The root window of this screen. */
110 Window root_window;
112 /* The cursor to use for vertical scroll bars. */
113 Cursor vertical_scroll_bar_cursor;
115 /* Resource data base */
116 XrmDatabase xrdb;
118 /* color palette information. */
119 int has_palette;
120 struct w32_palette_entry * color_list;
121 unsigned num_colors;
122 HPALETTE palette;
124 /* deferred action flags checked when starting frame update. */
125 int regen_palette;
127 /* Keystroke that has been faked by Emacs and will be ignored when
128 received; value is reset after key is received. */
129 int faked_key;
131 /* Minimum width over all characters in all fonts in font_table. */
132 int smallest_char_width;
134 /* Minimum font height over all fonts in font_table. */
135 int smallest_font_height;
137 /* Reusable Graphics Context for drawing a cursor in a non-default face. */
138 XGCValues *scratch_cursor_gc;
140 /* Information about the range of text currently shown in
141 mouse-face. */
142 Mouse_HLInfo mouse_highlight;
144 char *w32_id_name;
146 /* The number of fonts actually stored in w32_font_table.
147 font_table[n] is used and valid if 0 <= n < n_fonts. 0 <=
148 n_fonts <= font_table_size. and font_table[i].name != 0. */
149 int n_fonts;
151 /* Pointer to bitmap records. */
152 struct w32_bitmap_record *bitmaps;
154 /* Allocated size of bitmaps field. */
155 int bitmaps_size;
157 /* Last used bitmap index. */
158 int bitmaps_last;
160 /* The frame (if any) which has the window that has keyboard focus.
161 Zero if none. This is examined by Ffocus_frame in w32fns.c. Note
162 that a mere EnterNotify event can set this; if you need to know the
163 last frame specified in a FocusIn or FocusOut event, use
164 w32_focus_event_frame. */
165 struct frame *w32_focus_frame;
167 /* The last frame mentioned in a FocusIn or FocusOut event. This is
168 separate from w32_focus_frame, because whether or not LeaveNotify
169 events cause us to lose focus depends on whether or not we have
170 received a FocusIn event for it. */
171 struct frame *w32_focus_event_frame;
173 /* The frame which currently has the visual highlight, and should get
174 keyboard input (other sorts of input have the frame encoded in the
175 event). It points to the focus frame's selected window's
176 frame. It differs from w32_focus_frame when we're using a global
177 minibuffer. */
178 struct frame *x_highlight_frame;
181 /* This is a chain of structures for all the displays currently in use. */
182 extern struct w32_display_info *x_display_list;
183 extern struct w32_display_info one_w32_display_info;
185 /* This is a list of cons cells, each of the form (NAME . FONT-LIST-CACHE),
186 one for each element of w32_display_list and in the same order.
187 NAME is the name of the frame.
188 FONT-LIST-CACHE records previous values returned by x-list-fonts. */
189 extern Lisp_Object w32_display_name_list;
191 extern struct frame *x_window_to_frame (struct w32_display_info *, HWND);
193 struct w32_display_info *x_display_info_for_name (Lisp_Object);
195 Lisp_Object display_x_get_resource (struct w32_display_info *,
196 Lisp_Object, Lisp_Object,
197 Lisp_Object, Lisp_Object);
199 extern struct w32_display_info *w32_term_init (Lisp_Object,
200 char *, char *);
202 extern int x_display_pixel_height (struct w32_display_info *);
203 extern int x_display_pixel_width (struct w32_display_info *);
206 #define PIX_TYPE COLORREF
208 /* Each W32 frame object points to its own struct w32_display object
209 in the output_data.w32 field. The w32_display structure contains all
210 the information that is specific to W32 windows. */
212 /* Put some things in x_output for compatibility.
213 NTEMACS_TODO: Move all common things here to eliminate unneccesary
214 diffs between X and w32 code. */
215 struct x_output
217 #if 0 /* These are also defined in struct frame. Use that instead. */
218 PIX_TYPE background_pixel;
219 PIX_TYPE foreground_pixel;
220 #endif
222 /* Keep track of focus. May be EXPLICIT if we received a FocusIn for this
223 frame, or IMPLICIT if we received an EnterNotify.
224 FocusOut and LeaveNotify clears EXPLICIT/IMPLICIT. */
225 int focus_state;
229 enum
231 /* Values for focus_state, used as bit mask.
232 EXPLICIT means we received a FocusIn for the frame and know it has
233 the focus. IMPLICIT means we recevied an EnterNotify and the frame
234 may have the focus if no window manager is running.
235 FocusOut and LeaveNotify clears EXPLICIT/IMPLICIT. */
236 FOCUS_NONE = 0,
237 FOCUS_IMPLICIT = 1,
238 FOCUS_EXPLICIT = 2
241 struct w32_output
243 /* Placeholder for things accessed through output_data.x. */
244 struct x_output x_compatible;
246 /* Menubar "widget" handle. */
247 HMENU menubar_widget;
249 /* Original palette (used to deselect real palette after drawing) */
250 HPALETTE old_palette;
252 /* Here are the Graphics Contexts for the default font. */
253 XGCValues *cursor_gc; /* cursor drawing */
255 /* The window used for this frame.
256 May be zero while the frame object is being created
257 and the window has not yet been created. */
258 Window window_desc;
260 /* The window that is the parent of this window.
261 Usually this is a window that was made by the window manager,
262 but it can be the root window, and it can be explicitly specified
263 (see the explicit_parent field, below). */
264 Window parent_desc;
266 /* Default ASCII font of this frame. */
267 struct font *font;
269 /* The baseline offset of the default ASCII font. */
270 int baseline_offset;
272 /* If a fontset is specified for this frame instead of font, this
273 value contains an ID of the fontset, else -1. */
274 int fontset;
276 /* Pixel values used for various purposes.
277 border_pixel may be -1 meaning use a gray tile. */
278 COLORREF cursor_pixel;
279 COLORREF border_pixel;
280 COLORREF mouse_pixel;
281 COLORREF cursor_foreground_pixel;
283 /* Foreground color for scroll bars. A value of -1 means use the
284 default (black for non-toolkit scroll bars). */
285 COLORREF scroll_bar_foreground_pixel;
287 /* Background color for scroll bars. A value of -1 means use the
288 default (background color of the frame for non-toolkit scroll
289 bars). */
290 COLORREF scroll_bar_background_pixel;
292 /* Descriptor for the cursor in use for this window. */
293 Cursor text_cursor;
294 Cursor nontext_cursor;
295 Cursor modeline_cursor;
296 Cursor hand_cursor;
297 Cursor hourglass_cursor;
298 Cursor horizontal_drag_cursor;
300 /* Non-zero means hourglass cursor is currently displayed. */
301 unsigned hourglass_p : 1;
303 /* Non-hourglass cursor that is currently active. */
304 Cursor current_cursor;
306 /* Flag to set when the window needs to be completely repainted. */
307 int needs_exposure;
309 DWORD dwStyle;
311 /* This is the Emacs structure for the display this frame is on. */
312 /* struct w32_display_info *display_info; */
314 /* Nonzero means our parent is another application's window
315 and was explicitly specified. */
316 char explicit_parent;
318 /* Nonzero means tried already to make this frame visible. */
319 char asked_for_visible;
321 /* Nonzero means menubar is currently active. */
322 char menubar_active;
324 /* Nonzero means menubar is about to become active, but should be
325 brought up to date first. */
326 volatile char pending_menu_activation;
328 /* Relief GCs, colors etc. */
329 struct relief
331 XGCValues *gc;
332 unsigned long pixel;
333 int allocated_p;
335 black_relief, white_relief;
337 /* The background for which the above relief GCs were set up.
338 They are changed only when a different background is involved. */
339 unsigned long relief_background;
342 extern struct w32_output w32term_display;
344 /* Return the X output data for frame F. */
345 #define FRAME_X_OUTPUT(f) ((f)->output_data.w32)
347 /* Return the window associated with the frame F. */
348 #define FRAME_W32_WINDOW(f) ((f)->output_data.w32->window_desc)
349 #define FRAME_X_WINDOW(f) ((f)->output_data.w32->window_desc)
351 #define FRAME_FONT(f) ((f)->output_data.w32->font)
352 #define FRAME_FONTSET(f) ((f)->output_data.w32->fontset)
353 #define FRAME_BASELINE_OFFSET(f) ((f)->output_data.w32->baseline_offset)
355 /* This gives the w32_display_info structure for the display F is on. */
356 #define FRAME_W32_DISPLAY_INFO(f) (&one_w32_display_info)
357 #define FRAME_X_DISPLAY_INFO(f) (&one_w32_display_info)
359 /* This is the `Display *' which frame F is on. */
360 #define FRAME_X_DISPLAY(f) (0)
362 /* Value is the smallest width of any character in any font on frame F. */
364 #define FRAME_SMALLEST_CHAR_WIDTH(F) \
365 FRAME_W32_DISPLAY_INFO(F)->smallest_char_width
367 /* Value is the smallest height of any font on frame F. */
369 #define FRAME_SMALLEST_FONT_HEIGHT(F) \
370 FRAME_W32_DISPLAY_INFO(F)->smallest_font_height
372 /* W32-specific scroll bar stuff. */
374 /* We represent scroll bars as lisp vectors. This allows us to place
375 references to them in windows without worrying about whether we'll
376 end up with windows referring to dead scroll bars; the garbage
377 collector will free it when its time comes.
379 We use struct scroll_bar as a template for accessing fields of the
380 vector. */
382 struct scroll_bar {
384 /* These fields are shared by all vectors. */
385 EMACS_INT size_from_Lisp_Vector_struct;
386 struct Lisp_Vector *next_from_Lisp_Vector_struct;
388 /* The window we're a scroll bar for. */
389 Lisp_Object window;
391 /* The next and previous in the chain of scroll bars in this frame. */
392 Lisp_Object next, prev;
394 /* The window representing this scroll bar. Since this is a full
395 32-bit quantity, we store it split into two 32-bit values. */
396 Lisp_Object w32_window_low, w32_window_high;
398 /* Same as above for the widget. */
399 Lisp_Object w32_widget_low, w32_widget_high;
401 /* The position and size of the scroll bar in pixels, relative to the
402 frame. */
403 Lisp_Object top, left, width, height;
405 /* The starting and ending positions of the handle, relative to the
406 handle area (i.e. zero is the top position, not
407 SCROLL_BAR_TOP_BORDER). If they're equal, that means the handle
408 hasn't been drawn yet.
410 These are not actually the locations where the beginning and end
411 are drawn; in order to keep handles from becoming invisible when
412 editing large files, we establish a minimum height by always
413 drawing handle bottoms VERTICAL_SCROLL_BAR_MIN_HANDLE pixels below
414 where they would be normally; the bottom and top are in a
415 different co-ordinate system. */
416 Lisp_Object start, end;
418 /* If the scroll bar handle is currently being dragged by the user,
419 this is the number of pixels from the top of the handle to the
420 place where the user grabbed it. If the handle isn't currently
421 being dragged, this is Qnil. */
422 Lisp_Object dragging;
424 /* t if the background of the fringe that is adjacent to a scroll
425 bar is extended to the gap between the fringe and the bar. */
426 Lisp_Object fringe_extended_p;
429 /* The number of elements a vector holding a struct scroll_bar needs. */
430 #define SCROLL_BAR_VEC_SIZE \
431 ((sizeof (struct scroll_bar) \
432 - sizeof (EMACS_INT) - sizeof (struct Lisp_Vector *)) \
433 / sizeof (Lisp_Object))
435 /* Turning a lisp vector value into a pointer to a struct scroll_bar. */
436 #define XSCROLL_BAR(vec) ((struct scroll_bar *) XVECTOR (vec))
439 /* Building a 32-bit C integer from two 16-bit lisp integers. */
440 #define SCROLL_BAR_PACK(low, high) (XINT (high) << 16 | XINT (low))
442 /* Setting two lisp integers to the low and high words of a 32-bit C int. */
443 #define SCROLL_BAR_UNPACK(low, high, int32) \
444 (XSETINT ((low), (int32) & 0xffff), \
445 XSETINT ((high), ((int32) >> 16) & 0xffff))
448 /* Extract the window id of the scroll bar from a struct scroll_bar. */
449 #define SCROLL_BAR_W32_WINDOW(ptr) \
450 ((Window) SCROLL_BAR_PACK ((ptr)->w32_window_low, (ptr)->w32_window_high))
452 /* Store a window id in a struct scroll_bar. */
453 #define SET_SCROLL_BAR_W32_WINDOW(ptr, id) \
454 (SCROLL_BAR_UNPACK ((ptr)->w32_window_low, (ptr)->w32_window_high, (int) id))
456 /* Extract the X widget of the scroll bar from a struct scroll_bar. */
457 #define SCROLL_BAR_X_WIDGET(ptr) \
458 ((Widget) SCROLL_BAR_PACK ((ptr)->x_widget_low, (ptr)->x_widget_high))
460 /* Store a widget id in a struct scroll_bar. */
461 #define SET_SCROLL_BAR_X_WIDGET(ptr, w) \
462 (SCROLL_BAR_UNPACK ((ptr)->x_widget_low, (ptr)->x_widget_high, (int) w))
464 /* Return the inside width of a vertical scroll bar, given the outside
465 width. */
466 #define VERTICAL_SCROLL_BAR_INSIDE_WIDTH(f,width) \
467 ((width) \
468 - VERTICAL_SCROLL_BAR_LEFT_BORDER \
469 - VERTICAL_SCROLL_BAR_RIGHT_BORDER \
470 - VERTICAL_SCROLL_BAR_WIDTH_TRIM * 2)
472 /* Return the length of the rectangle within which the top of the
473 handle must stay. This isn't equivalent to the inside height,
474 because the scroll bar handle has a minimum height.
476 This is the real range of motion for the scroll bar, so when we're
477 scaling buffer positions to scroll bar positions, we use this, not
478 VERTICAL_SCROLL_BAR_INSIDE_HEIGHT. */
479 #define VERTICAL_SCROLL_BAR_TOP_RANGE(f,height) \
480 (VERTICAL_SCROLL_BAR_INSIDE_HEIGHT (f, height) - VERTICAL_SCROLL_BAR_MIN_HANDLE)
482 /* Return the inside height of vertical scroll bar, given the outside
483 height. See VERTICAL_SCROLL_BAR_TOP_RANGE too. */
484 #define VERTICAL_SCROLL_BAR_INSIDE_HEIGHT(f,height) \
485 ((height) - VERTICAL_SCROLL_BAR_TOP_BORDER - VERTICAL_SCROLL_BAR_BOTTOM_BORDER)
488 /* Border widths for scroll bars.
490 Scroll bar windows don't have any borders; their border width is
491 set to zero, and we redraw borders ourselves. This makes the code
492 a bit cleaner, since we don't have to convert between outside width
493 (used when relating to the rest of the screen) and inside width
494 (used when sizing and drawing the scroll bar window itself).
496 The handle moves up and down/back and forth in a rectangle inset
497 from the edges of the scroll bar. These are widths by which we
498 inset the handle boundaries from the scroll bar edges. */
499 #define VERTICAL_SCROLL_BAR_LEFT_BORDER (0)
500 #define VERTICAL_SCROLL_BAR_RIGHT_BORDER (0)
501 #define VERTICAL_SCROLL_BAR_TOP_BORDER (vertical_scroll_bar_top_border)
502 #define VERTICAL_SCROLL_BAR_BOTTOM_BORDER (vertical_scroll_bar_bottom_border)
504 /* Minimum lengths for scroll bar handles, in pixels. */
505 #define VERTICAL_SCROLL_BAR_MIN_HANDLE (vertical_scroll_bar_min_handle)
507 /* Trimming off a few pixels from each side prevents
508 text from glomming up against the scroll bar */
509 #define VERTICAL_SCROLL_BAR_WIDTH_TRIM (0)
512 struct frame; /* from frame.h */
514 extern void w32_fill_rect (struct frame *, HDC, COLORREF, RECT *);
515 extern void w32_clear_window (struct frame *);
517 #define w32_fill_area(f,hdc,pix,x,y,nx,ny) \
518 do { \
519 RECT rect; \
520 rect.left = x; \
521 rect.top = y; \
522 rect.right = x + nx; \
523 rect.bottom = y + ny; \
524 w32_fill_rect (f,hdc,pix,&rect); \
525 } while (0)
527 #define w32_clear_rect(f,hdc,lprect) \
528 w32_fill_rect (f, hdc, FRAME_BACKGROUND_PIXEL (f), lprect)
530 #define w32_clear_area(f,hdc,px,py,nx,ny) \
531 w32_fill_area (f, hdc, FRAME_BACKGROUND_PIXEL (f), px, py, nx, ny)
533 /* Define for earlier versions of Visual C */
534 #ifndef WM_MOUSEWHEEL
535 #define WM_MOUSEWHEEL (WM_MOUSELAST + 1)
536 #endif /* WM_MOUSEWHEEL */
537 #ifndef MSH_MOUSEWHEEL
538 #define MSH_MOUSEWHEEL "MSWHEEL_ROLLMSG"
539 #endif /* MSH_MOUSEWHEEL */
540 #ifndef WM_XBUTTONDOWN
541 #define WM_XBUTTONDOWN (WM_MOUSEWHEEL + 1)
542 #define WM_XBUTTONUP (WM_MOUSEWHEEL + 2)
543 #endif /* WM_XBUTTONDOWN */
544 #ifndef WM_MOUSEHWHEEL
545 #define WM_MOUSEHWHEEL (WM_MOUSEWHEEL + 4)
546 #endif /* WM_MOUSEHWHEEL */
547 #ifndef WM_APPCOMMAND
548 #define WM_APPCOMMAND 0x319
549 #define GET_APPCOMMAND_LPARAM(lParam) (HIWORD(lParam) & 0x7fff)
550 #endif
551 #ifndef WM_UNICHAR
552 #define WM_UNICHAR 0x109
553 #endif
554 #ifndef UNICODE_NOCHAR
555 #define UNICODE_NOCHAR 0xFFFF
556 #endif
558 #define WM_EMACS_START (WM_USER + 1)
559 #define WM_EMACS_KILL (WM_EMACS_START + 0)
560 #define WM_EMACS_CREATEWINDOW (WM_EMACS_START + 1)
561 #define WM_EMACS_DONE (WM_EMACS_START + 2)
562 #define WM_EMACS_CREATESCROLLBAR (WM_EMACS_START + 3)
563 #define WM_EMACS_SHOWWINDOW (WM_EMACS_START + 4)
564 #define WM_EMACS_SETWINDOWPOS (WM_EMACS_START + 5)
565 #define WM_EMACS_DESTROYWINDOW (WM_EMACS_START + 6)
566 #define WM_EMACS_TRACKPOPUPMENU (WM_EMACS_START + 7)
567 #define WM_EMACS_SETFOCUS (WM_EMACS_START + 8)
568 #define WM_EMACS_SETFOREGROUND (WM_EMACS_START + 9)
569 #define WM_EMACS_SETLOCALE (WM_EMACS_START + 10)
570 #define WM_EMACS_SETKEYBOARDLAYOUT (WM_EMACS_START + 11)
571 #define WM_EMACS_REGISTER_HOT_KEY (WM_EMACS_START + 12)
572 #define WM_EMACS_UNREGISTER_HOT_KEY (WM_EMACS_START + 13)
573 #define WM_EMACS_TOGGLE_LOCK_KEY (WM_EMACS_START + 14)
574 #define WM_EMACS_TRACK_CARET (WM_EMACS_START + 15)
575 #define WM_EMACS_DESTROY_CARET (WM_EMACS_START + 16)
576 #define WM_EMACS_SHOW_CARET (WM_EMACS_START + 17)
577 #define WM_EMACS_HIDE_CARET (WM_EMACS_START + 18)
578 #define WM_EMACS_SETCURSOR (WM_EMACS_START + 19)
579 #define WM_EMACS_PAINT (WM_EMACS_START + 20)
580 #define WM_EMACS_END (WM_EMACS_START + 21)
582 #define WND_FONTWIDTH_INDEX (0)
583 #define WND_LINEHEIGHT_INDEX (4)
584 #define WND_BORDER_INDEX (8)
585 #define WND_SCROLLBAR_INDEX (12)
586 #define WND_BACKGROUND_INDEX (16)
587 #define WND_LAST_INDEX (20)
589 #define WND_EXTRA_BYTES (WND_LAST_INDEX)
591 extern DWORD dwWindowsThreadId;
592 extern HANDLE hWindowsThread;
593 extern DWORD dwMainThreadId;
594 extern HANDLE hMainThread;
596 typedef struct W32Msg {
597 MSG msg;
598 DWORD dwModifiers;
599 RECT rect;
600 } W32Msg;
602 /* Structure for recording message when input thread must return a
603 result that depends on lisp thread to compute. Lisp thread can
604 complete deferred messages out of order. */
605 typedef struct deferred_msg
607 struct deferred_msg * next;
608 W32Msg w32msg;
609 LRESULT result;
610 int completed;
611 } deferred_msg;
613 extern CRITICAL_SECTION critsect;
615 extern void init_crit (void);
616 extern void delete_crit (void);
618 extern void signal_quit (void);
620 #define enter_crit() EnterCriticalSection (&critsect)
621 #define leave_crit() LeaveCriticalSection (&critsect)
623 extern void select_palette (struct frame * f, HDC hdc);
624 extern void deselect_palette (struct frame * f, HDC hdc);
625 extern HDC get_frame_dc (struct frame * f);
626 extern int release_frame_dc (struct frame * f, HDC hDC);
628 extern void drain_message_queue (void);
630 extern BOOL get_next_msg (W32Msg *, BOOL);
631 extern BOOL post_msg (W32Msg *);
632 extern void complete_deferred_msg (HWND hwnd, UINT msg, LRESULT result);
634 extern BOOL parse_button (int, int, int *, int *);
636 extern void w32_sys_ring_bell (struct frame *f);
637 extern void x_delete_display (struct w32_display_info *dpyinfo);
639 /* Keypad command key support. W32 doesn't have virtual keys defined
640 for the function keys on the keypad (they are mapped to the standard
641 fuction keys), so we define our own. */
642 #define VK_NUMPAD_BEGIN 0x92
643 #define VK_NUMPAD_CLEAR (VK_NUMPAD_BEGIN + 0)
644 #define VK_NUMPAD_ENTER (VK_NUMPAD_BEGIN + 1)
645 #define VK_NUMPAD_PRIOR (VK_NUMPAD_BEGIN + 2)
646 #define VK_NUMPAD_NEXT (VK_NUMPAD_BEGIN + 3)
647 #define VK_NUMPAD_END (VK_NUMPAD_BEGIN + 4)
648 #define VK_NUMPAD_HOME (VK_NUMPAD_BEGIN + 5)
649 #define VK_NUMPAD_LEFT (VK_NUMPAD_BEGIN + 6)
650 #define VK_NUMPAD_UP (VK_NUMPAD_BEGIN + 7)
651 #define VK_NUMPAD_RIGHT (VK_NUMPAD_BEGIN + 8)
652 #define VK_NUMPAD_DOWN (VK_NUMPAD_BEGIN + 9)
653 #define VK_NUMPAD_INSERT (VK_NUMPAD_BEGIN + 10)
654 #define VK_NUMPAD_DELETE (VK_NUMPAD_BEGIN + 11)
656 #ifndef VK_LWIN
657 /* Older compiler environments don't have these defined. */
658 #define VK_LWIN 0x5B
659 #define VK_RWIN 0x5C
660 #define VK_APPS 0x5D
661 #endif
663 /* Support for treating Windows and Apps keys as modifiers. These
664 constants must not overlap with any of the dwControlKeyState flags in
665 KEY_EVENT_RECORD. */
666 #define LEFT_WIN_PRESSED 0x8000
667 #define RIGHT_WIN_PRESSED 0x4000
668 #define APPS_PRESSED 0x2000
670 /* When compiling on Windows 9x/ME and NT 3.x, the following are not defined
671 (even though they are supported on 98 and ME. */
672 #ifndef WM_MOUSELEAVE
673 #define WM_MOUSELEAVE 0x02A3
674 #define TME_LEAVE 0x00000002;
676 typedef struct tagTRACKMOUSEEVENT
678 DWORD cbSize;
679 DWORD dwFlags;
680 HWND hwndTrack;
681 DWORD dwHoverTime;
682 } TRACKMOUSEEVENT;
683 #endif
685 struct image;
686 struct face;
688 XGCValues *XCreateGC (void *, Window, unsigned long, XGCValues *);
689 struct frame * check_x_frame (Lisp_Object);
691 EXFUN (Fx_display_color_p, 1);
692 EXFUN (Fx_display_grayscale_p, 1);
694 typedef DWORD (WINAPI * ClipboardSequence_Proc) (void);
695 typedef BOOL (WINAPI * AppendMenuW_Proc) (
696 IN HMENU,
697 IN UINT,
698 IN UINT_PTR,
699 IN LPCWSTR);