annotate src/w32term.c @ 24674:d0dee612f8e3

[andrewi] (dumpglyphs): On Windows NT, do output in Unicode even for ASCII, if enabled, to avoid memory allocation overhead for implicit Unicode conversion. Also, recognize that ASCII and Latin-1 have a trivial conversion to Unicode, so x_2byte_buffer lready contains the Unicode characters in that case. (construct_drag_n_drop): Remove old code that was trashing the drop location. [jasonr] (w32_write_glyphs, w32_clear_end_of_line, w32_clear_frame, clear_cursor, x_display_bar_cursor, x_display_box_cursor, x_set_window_size): Use phys_cursor_on field in frame. (do_line_dance): Updated WRT xterm.c. Use macros where possible. (dumprectangle): Take into account the width of a left-side scroll bar.
author Andrew Innes <andrewi@gnu.org>
date Sun, 02 May 1999 10:34:21 +0000
parents f9d3288b66c3
children 8d4b8adc3c98
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
16884
36babc489b0c Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents: 16588
diff changeset
1 /* Implementation of GUI terminal on the Microsoft W32 API.
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
2 Copyright (C) 1989, 93, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4 This file is part of GNU Emacs.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6 GNU Emacs is free software; you can redistribute it and/or modify
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7 it under the terms of the GNU General Public License as published by
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8 the Free Software Foundation; either version 2, or (at your option)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
9 any later version.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
10
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
11 GNU Emacs is distributed in the hope that it will be useful,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
14 GNU General Public License for more details.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
15
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
15742
80562f089595 Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 15723
diff changeset
17 along with GNU Emacs; see the file COPYING. If not, write to the
80562f089595 Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 15723
diff changeset
18 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
80562f089595 Fix FSF address in comment.
Karl Heuer <kwzh@gnu.org>
parents: 15723
diff changeset
19 Boston, MA 02111-1307, USA. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
20
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
21 #include <signal.h>
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
22 #include <config.h>
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
23 #include <stdio.h>
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
24 #include "lisp.h"
18507
be4c110cda51 Include charset.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16884
diff changeset
25 #include "charset.h"
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
26 #include "fontset.h"
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
27 #include "blockinput.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
28
24674
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
29 #include "w32heap.h"
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
30 #include "w32term.h"
21885
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
31 #include <shellapi.h>
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
32
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
33 #include "systty.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
34 #include "systime.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
35
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
36 #include <ctype.h>
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
37 #include <errno.h>
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
38 #include <setjmp.h>
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
39 #include <sys/stat.h>
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
40
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
41 #include "frame.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
42 #include "dispextern.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
43 #include "termhooks.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
44 #include "termopts.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
45 #include "termchar.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
46 #include "gnu.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
47 #include "disptab.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
48 #include "buffer.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
49 #include "window.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
50 #include "keyboard.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
51 #include "intervals.h"
21614
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
52 #include "coding.h"
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
53
21456
c0496e62b737 (min, max): Define as macros.
Karl Heuer <kwzh@gnu.org>
parents: 20179
diff changeset
54 #undef min
c0496e62b737 (min, max): Define as macros.
Karl Heuer <kwzh@gnu.org>
parents: 20179
diff changeset
55 #undef max
c0496e62b737 (min, max): Define as macros.
Karl Heuer <kwzh@gnu.org>
parents: 20179
diff changeset
56 #define min(x, y) (((x) < (y)) ? (x) : (y))
c0496e62b737 (min, max): Define as macros.
Karl Heuer <kwzh@gnu.org>
parents: 20179
diff changeset
57 #define max(x, y) (((x) > (y)) ? (x) : (y))
c0496e62b737 (min, max): Define as macros.
Karl Heuer <kwzh@gnu.org>
parents: 20179
diff changeset
58
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
59 #define CP_DEFAULT 1004
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
60
21875
16414f4d07e7 (msh_mousewheel): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21831
diff changeset
61 extern unsigned int msh_mousewheel;
16414f4d07e7 (msh_mousewheel): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21831
diff changeset
62
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
63 extern void free_frame_menubar ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
64
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
65 extern Lisp_Object Vwindow_system;
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
66
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
67 #define x_any_window_to_frame x_window_to_frame
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
68 #define x_top_window_to_frame x_window_to_frame
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
69
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
70
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
71 /* This is display since w32 does not support multiple ones. */
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
72 struct w32_display_info one_w32_display_info;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
73
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
74 /* This is a list of cons cells, each of the form (NAME . FONT-LIST-CACHE),
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
75 one for each element of w32_display_list and in the same order.
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
76 NAME is the name of the frame.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
77 FONT-LIST-CACHE records previous values returned by x-list-fonts. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
78 Lisp_Object w32_display_name_list;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
79
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
80 /* Frame being updated by update_frame. This is declared in term.c.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
81 This is set by update_begin and looked at by all the
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
82 w32 functions. It is zero while not inside an update.
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
83 In that case, the w32 functions assume that `selected_frame'
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
84 is the frame to apply to. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
85 extern struct frame *updating_frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
86
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
87 /* This is a frame waiting to be autoraised, within w32_read_socket. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
88 struct frame *pending_autoraise_frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
89
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
90 /* During an update, maximum vpos for ins/del line operations to affect. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
91
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
92 static int flexlines;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
93
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
94 /* During an update, nonzero if chars output now should be highlighted. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
95
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
96 static int highlight;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
97
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
98 /* Nominal cursor position -- where to draw output.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
99 During an update, these are different from the cursor-box position. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
100
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
101 static int curs_x;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
102 static int curs_y;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
103
23639
516fc58a7b7b (w32_enable_unicode_output): Rename from
Geoff Voelker <voelker@cs.washington.edu>
parents: 23638
diff changeset
104 /* Flag to enable Unicode output in case users wish to use programs
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
105 like Twinbridge on '95 rather than installed system level support
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
106 for Far East languages. */
23639
516fc58a7b7b (w32_enable_unicode_output): Rename from
Geoff Voelker <voelker@cs.washington.edu>
parents: 23638
diff changeset
107 int w32_enable_unicode_output;
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
108
16884
36babc489b0c Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents: 16588
diff changeset
109 DWORD dwWindowsThreadId = 0;
36babc489b0c Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents: 16588
diff changeset
110 HANDLE hWindowsThread = NULL;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
111 DWORD dwMainThreadId = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
112 HANDLE hMainThread = NULL;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
113
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
114 #ifndef SIF_ALL
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
115 /* These definitions are new with Windows 95. */
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
116 #define SIF_RANGE 0x0001
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
117 #define SIF_PAGE 0x0002
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
118 #define SIF_POS 0x0004
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
119 #define SIF_DISABLENOSCROLL 0x0008
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
120 #define SIF_TRACKPOS 0x0010
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
121 #define SIF_ALL (SIF_RANGE | SIF_PAGE | SIF_POS | SIF_TRACKPOS)
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
122
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
123 typedef struct tagSCROLLINFO
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
124 {
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
125 UINT cbSize;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
126 UINT fMask;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
127 int nMin;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
128 int nMax;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
129 UINT nPage;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
130 int nPos;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
131 int nTrackPos;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
132 } SCROLLINFO, FAR *LPSCROLLINFO;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
133 typedef SCROLLINFO CONST FAR *LPCSCROLLINFO;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
134 #endif /* SIF_ALL */
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
135
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
136 /* Dynamic linking to new proportional scroll bar functions. */
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
137 int (PASCAL *pfnSetScrollInfo) (HWND hwnd, int fnBar, LPSCROLLINFO lpsi, BOOL fRedraw);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
138 BOOL (PASCAL *pfnGetScrollInfo) (HWND hwnd, int fnBar, LPSCROLLINFO lpsi);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
139
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
140 int vertical_scroll_bar_min_handle;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
141 int vertical_scroll_bar_top_border;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
142 int vertical_scroll_bar_bottom_border;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
143
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
144 int last_scroll_bar_drag_pos;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
145
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
146 /* Mouse movement. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
147
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
148 /* Where the mouse was last time we reported a mouse event. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
149 static FRAME_PTR last_mouse_frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
150 static RECT last_mouse_glyph;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
151
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
152 Lisp_Object Vw32_num_mouse_buttons;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
153
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
154 Lisp_Object Vw32_swap_mouse_buttons;
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
155
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
156 /* Control whether x_raise_frame also sets input focus. */
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
157 Lisp_Object Vw32_grab_focus_on_raise;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
158
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
159 /* Control whether Caps Lock affects non-ascii characters. */
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
160 Lisp_Object Vw32_capslock_is_shiftlock;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
161
21614
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
162 /* Control whether right-alt and left-ctrl should be recognized as AltGr. */
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
163 Lisp_Object Vw32_recognize_altgr;
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
164
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
165 /* The scroll bar in which the last motion event occurred.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
166
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
167 If the last motion event occurred in a scroll bar, we set this
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
168 so w32_mouse_position can know whether to report a scroll bar motion or
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
169 an ordinary motion.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
170
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
171 If the last motion event didn't occur in a scroll bar, we set this
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
172 to Qnil, to tell w32_mouse_position to return an ordinary motion event. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
173 Lisp_Object last_mouse_scroll_bar;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
174 int last_mouse_scroll_bar_pos;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
175
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
176 /* This is a hack. We would really prefer that w32_mouse_position would
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
177 return the time associated with the position it returns, but there
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
178 doesn't seem to be any way to wrest the timestamp from the server
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
179 along with the position query. So, we just keep track of the time
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
180 of the last movement we received, and return that in hopes that
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
181 it's somewhat accurate. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
182 Time last_mouse_movement_time;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
183
24131
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
184 /* Associative list linking character set strings to Windows codepages. */
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
185 Lisp_Object Vw32_charset_to_codepage_alist;
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
186
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
187 /* Incremented by w32_read_socket whenever it really tries to read events. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
188 #ifdef __STDC__
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
189 static int volatile input_signal_count;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
190 #else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
191 static int input_signal_count;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
192 #endif
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
193
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
194 extern Lisp_Object Vcommand_line_args, Vsystem_name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
195
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
196 extern Lisp_Object Qface, Qmouse_face;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
197
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
198 extern int errno;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
199
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
200 /* A mask of extra modifier bits to put into every keyboard char. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
201 extern int extra_keyboard_modifiers;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
202
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
203 static Lisp_Object Qvendor_specific_keysyms;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
204
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
205 void w32_delete_display ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
206
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
207 static void redraw_previous_char ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
208 static void redraw_following_char ();
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
209 static unsigned int w32_get_modifiers ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
210
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
211 static int fast_find_position ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
212 static void note_mouse_highlight ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
213 static void clear_mouse_face ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
214 static void show_mouse_face ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
215 static void do_line_dance ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
216
21831
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
217 /* Forward declarations for term hooks. Consistency with the rest of Emacs
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
218 requires the use of K&R functions prototypes. However, MSVC does not
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
219 pick up the function prototypes correctly with K&R function definitions,
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
220 and so we declare them first to give a little help to MSVC. */
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
221 static void w32_clear_frame ();
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
222 static void w32_clear_end_of_line (int);
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
223 static void w32_ins_del_lines (int, int);
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
224 static void w32_change_line_highlight (int, int, int);
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
225 static void w32_insert_glyphs (GLYPH *, int);
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
226 static void w32_write_glyphs (GLYPH *, int);
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
227 static void w32_delete_glyphs (int);
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
228 static void w32_ring_bell ();
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
229 static void w32_reset_terminal_modes ();
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
230 static void w32_set_terminal_modes ();
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
231 static void w32_update_begin (FRAME_PTR);
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
232 static void w32_update_end (FRAME_PTR);
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
233 static void w32_set_terminal_window (int);
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
234 extern int w32_read_socket (int, struct input_event *, int, int);
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
235 static void w32_frame_up_to_date (FRAME_PTR);
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
236 static void w32_cursor_to (int, int);
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
237 static void w32_reassert_line_highlight (int, int);
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
238 static void w32_mouse_position (FRAME_PTR *, int, Lisp_Object *,
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
239 enum scroll_bar_part *, Lisp_Object *,
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
240 Lisp_Object *, unsigned long *);
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
241 static void w32_frame_rehighlight (FRAME_PTR);
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
242 static void w32_frame_raise_lower (FRAME_PTR, int);
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
243 static void w32_set_vertical_scroll_bar (struct window *, int, int, int);
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
244 static void w32_condemn_scroll_bars (FRAME_PTR);
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
245 static void w32_redeem_scroll_bar (struct window *);
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
246 static void w32_judge_scroll_bars (FRAME_PTR);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
247
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
248 #if 0
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
249 /* This is a function useful for recording debugging information
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
250 about the sequence of occurrences in this file. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
251
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
252 struct record
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
253 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
254 char *locus;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
255 int type;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
256 };
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
257
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
258 struct record event_record[100];
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
259
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
260 int event_record_index;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
261
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
262 record_event (locus, type)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
263 char *locus;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
264 int type;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
265 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
266 if (event_record_index == sizeof (event_record) / sizeof (struct record))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
267 event_record_index = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
268
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
269 event_record[event_record_index].locus = locus;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
270 event_record[event_record_index].type = type;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
271 event_record_index++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
272 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
273
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
274 #endif /* 0 */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
275
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
276 /* Return the struct w32_display_info. */
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
277
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
278 struct w32_display_info *
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
279 w32_display_info_for_display ()
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
280 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
281 return (&one_w32_display_info);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
282 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
283
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
284 void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
285 w32_fill_rect (f, _hdc, pix, lprect)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
286 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
287 HDC _hdc;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
288 COLORREF pix;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
289 RECT * lprect;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
290 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
291 HDC hdc;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
292 HBRUSH hb;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
293 RECT rect;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
294
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
295 if (_hdc)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
296 hdc = _hdc;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
297 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
298 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
299 if (!f) return;
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
300 hdc = get_frame_dc (f);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
301 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
302
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
303 hb = CreateSolidBrush (pix);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
304 FillRect (hdc, lprect, hb);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
305 DeleteObject (hb);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
306
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
307 if (!_hdc)
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
308 release_frame_dc (f, hdc);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
309 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
310
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
311 void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
312 w32_clear_window (f)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
313 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
314 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
315 RECT rect;
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
316
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
317 GetClientRect (FRAME_W32_WINDOW (f), &rect);
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
318 w32_clear_rect (f, NULL, &rect);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
319 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
320
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
321
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
322 /* Starting and ending updates.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
323
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
324 These hooks are called by update_frame at the beginning and end
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
325 of a frame update. We record in `updating_frame' the identity
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
326 of the frame being updated, so that the w32_... functions do not
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
327 need to take a frame as argument. Most of the w32_... functions
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
328 should never be called except during an update, the only exceptions
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
329 being w32_cursor_to, w32_write_glyphs and w32_reassert_line_highlight. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
330
21831
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
331 static void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
332 w32_update_begin (f)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
333 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
334 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
335 if (f == 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
336 abort ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
337
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
338 flexlines = f->height;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
339 highlight = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
340
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
341 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
342
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
343 /* Regenerate display palette before drawing if list of requested
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
344 colors has changed. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
345 if (FRAME_W32_DISPLAY_INFO (f)->regen_palette)
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
346 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
347 w32_regenerate_palette (f);
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
348 FRAME_W32_DISPLAY_INFO (f)->regen_palette = FALSE;
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
349 }
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
350
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
351 if (f == FRAME_W32_DISPLAY_INFO (f)->mouse_face_mouse_frame)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
352 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
353 /* Don't do highlighting for mouse motion during the update. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
354 FRAME_W32_DISPLAY_INFO (f)->mouse_face_defer = 1;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
355
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
356 /* If the frame needs to be redrawn,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
357 simply forget about any prior mouse highlighting. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
358 if (FRAME_GARBAGED_P (f))
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
359 FRAME_W32_DISPLAY_INFO (f)->mouse_face_window = Qnil;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
360
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
361 if (!NILP (FRAME_W32_DISPLAY_INFO (f)->mouse_face_window))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
362 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
363 int firstline, lastline, i;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
364 struct window *w = XWINDOW (FRAME_W32_DISPLAY_INFO (f)->mouse_face_window);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
365
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
366 /* Find the first, and the last+1, lines affected by redisplay. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
367 for (firstline = 0; firstline < f->height; firstline++)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
368 if (FRAME_DESIRED_GLYPHS (f)->enable[firstline])
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
369 break;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
370
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
371 lastline = f->height;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
372 for (i = f->height - 1; i >= 0; i--)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
373 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
374 if (FRAME_DESIRED_GLYPHS (f)->enable[i])
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
375 break;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
376 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
377 lastline = i;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
378 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
379
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
380 /* Can we tell that this update does not affect the window
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
381 where the mouse highlight is? If so, no need to turn off.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
382 Likewise, don't do anything if the frame is garbaged;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
383 in that case, the FRAME_CURRENT_GLYPHS that we would use
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
384 are all wrong, and we will redisplay that line anyway. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
385 if (! (firstline > (XFASTINT (w->top) + window_internal_height (w))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
386 || lastline < XFASTINT (w->top)))
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
387 clear_mouse_face (FRAME_W32_DISPLAY_INFO (f));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
388 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
389 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
390
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
391 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
392 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
393
21831
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
394 static void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
395 w32_update_end (f)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
396 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
397 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
398 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
399
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
400 do_line_dance ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
401 x_display_cursor (f, 1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
402
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
403 if (f == FRAME_W32_DISPLAY_INFO (f)->mouse_face_mouse_frame)
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
404 FRAME_W32_DISPLAY_INFO (f)->mouse_face_defer = 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
405
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
406 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
407 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
408
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
409 /* This is called after a redisplay on frame F. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
410
21831
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
411 static void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
412 w32_frame_up_to_date (f)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
413 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
414 {
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
415 BLOCK_INPUT;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
416 if (FRAME_W32_DISPLAY_INFO (f)->mouse_face_deferred_gc
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
417 || f == FRAME_W32_DISPLAY_INFO (f)->mouse_face_mouse_frame)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
418 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
419 note_mouse_highlight (FRAME_W32_DISPLAY_INFO (f)->mouse_face_mouse_frame,
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
420 FRAME_W32_DISPLAY_INFO (f)->mouse_face_mouse_x,
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
421 FRAME_W32_DISPLAY_INFO (f)->mouse_face_mouse_y);
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
422 FRAME_W32_DISPLAY_INFO (f)->mouse_face_deferred_gc = 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
423 }
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
424 UNBLOCK_INPUT;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
425 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
426
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
427 /* External interface to control of standout mode.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
428 Call this when about to modify line at position VPOS
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
429 and not change whether it is highlighted. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
430
21831
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
431 static void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
432 w32_reassert_line_highlight (new, vpos)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
433 int new, vpos;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
434 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
435 highlight = new;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
436 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
437
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
438 /* Call this when about to modify line at position VPOS
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
439 and change whether it is highlighted. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
440
21831
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
441 static void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
442 w32_change_line_highlight (new_highlight, vpos, first_unused_hpos)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
443 int new_highlight, vpos, first_unused_hpos;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
444 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
445 highlight = new_highlight;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
446 w32_cursor_to (vpos, 0);
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
447 w32_clear_end_of_line (updating_frame->width);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
448 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
449
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
450 /* This is used when starting Emacs and when restarting after suspend.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
451 When starting Emacs, no window is mapped. And nothing must be done
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
452 to Emacs's own window if it is suspended (though that rarely happens). */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
453
21831
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
454 static void
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
455 w32_set_terminal_modes (void)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
456 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
457 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
458
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
459 /* This is called when exiting or suspending Emacs.
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
460 Exiting will make the W32 windows go away, and suspending
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
461 requires no action. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
462
21831
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
463 static void
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
464 w32_reset_terminal_modes (void)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
465 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
466 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
467
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
468 /* Set the nominal cursor position of the frame.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
469 This is where display update commands will take effect.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
470 This does not affect the place where the cursor-box is displayed. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
471
21831
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
472 static void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
473 w32_cursor_to (row, col)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
474 register int row, col;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
475 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
476 int orow = row;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
477
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
478 curs_x = col;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
479 curs_y = row;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
480
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
481 if (updating_frame == 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
482 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
483 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
484 x_display_cursor (selected_frame, 1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
485 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
486 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
487 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
488
24131
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
489 /* Get the Windows codepage corresponding to the specified font. The
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
490 charset info in the font name is used to look up
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
491 w32-charset-to-codepage-alist. */
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
492 int
24131
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
493 w32_codepage_for_font (char *fontname)
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
494 {
24131
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
495 Lisp_Object codepage;
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
496 char charset_str[20], *charset, *end;
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
497
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
498 /* Extract charset part of font string. */
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
499 if (sscanf (fontname,
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
500 "-%*[^-]-%*[^-]-%*[^-]-%*[^-]-%*[^-]-%*[^-]-%*[^-]-%*[^-]-%*[^-]-%*[^-]-%*[^-]-%*[^-]-%19s",
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
501 charset_str) == EOF)
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
502 return CP_DEFAULT;
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
503
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
504 /* Remove leading "*-". */
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
505 if (strncmp ("*-", charset_str, 2) == 0)
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
506 charset = charset_str + 2;
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
507 else
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
508 charset = charset_str;
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
509
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
510 /* Stop match at wildcard (including preceding '-'). */
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
511 if (end = strchr (charset, '*'))
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
512 {
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
513 if (end > charset && *(end-1) == '-')
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
514 end--;
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
515 *end = '\0';
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
516 }
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
517
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
518 codepage = Fcdr (Fassoc (build_string(charset),
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
519 Vw32_charset_to_codepage_alist));
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
520
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
521 if (INTEGERP (codepage))
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
522 return XINT (codepage);
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
523 else
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
524 return CP_DEFAULT;
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
525 }
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
526
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
527 BOOL
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
528 w32_use_unicode_for_codepage (codepage)
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
529 {
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
530 /* If the current codepage is supported, use Unicode for output. */
23639
516fc58a7b7b (w32_enable_unicode_output): Rename from
Geoff Voelker <voelker@cs.washington.edu>
parents: 23638
diff changeset
531 return (w32_enable_unicode_output
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
532 && codepage != CP_DEFAULT && IsValidCodePage (codepage));
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
533 }
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
534
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
535 /* Dealing with bits of wchar_t as if they were an XChar2B. */
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
536 #define BUILD_WCHAR_T(byte1, byte2) \
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
537 ((wchar_t)(((byte1 & 0x00ff) << 8) | (byte2 & 0x00ff)))
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
538
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
539
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
540 #define BYTE1(ch) \
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
541 ((ch & 0xff00) >> 8)
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
542
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
543 #define BYTE2(ch) \
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
544 (ch & 0x00ff)
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
545
24146
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
546 #define W32_TEXTOUT(start_offset,nchars) \
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
547 { \
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
548 int charset_dim = CHARSET_DIMENSION(charset); \
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
549 if (font->bdf) \
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
550 w32_BDF_TextOut (font->bdf, hdc, left + xoffset, \
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
551 top + yoffset, \
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
552 x_1byte_buffer + start_offset, \
24480
f9d3288b66c3 (W32_TEXTOUT): Do not multiply nchars by
Geoff Voelker <voelker@cs.washington.edu>
parents: 24265
diff changeset
553 charset_dim, nchars, 0); \
24146
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
554 else if (print_via_unicode) \
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
555 ExtTextOutW (hdc, left + xoffset, top + yoffset, \
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
556 fuOptions, clip_region, \
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
557 x_2byte_buffer + start_offset, nchars, NULL); \
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
558 else \
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
559 ExtTextOut (hdc, left + xoffset, top + yoffset, \
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
560 fuOptions, clip_region, \
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
561 x_1byte_buffer + start_offset, \
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
562 nchars * charset_dim, NULL); \
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
563 start_offset += nchars * (print_via_unicode ? 1 : charset_dim ); \
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
564 xoffset += nchars * glyph_width; \
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
565 }
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
566
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
567 /* Display a sequence of N glyphs found at GP.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
568 WINDOW is the window to output to. LEFT and TOP are starting coords.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
569 HL is 1 if this text is highlighted, 2 if the cursor is on it,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
570 3 if should appear in its mouse-face.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
571 JUST_FOREGROUND if 1 means draw only the foreground;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
572 don't alter the background.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
573
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
574 FONT is the default font to use (for glyphs whose font-code is 0).
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
575
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
576 Since the display generation code is responsible for calling
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
577 compute_char_face and compute_glyph_face on everything it puts in
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
578 the display structure, we can assume that the face code on each
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
579 glyph is a valid index into FRAME_COMPUTED_FACES (f), and the one
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
580 to which we can actually apply intern_face.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
581 Call this function with input blocked. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
582
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
583 static int
21614
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
584 dumpglyphs (f, left, top, gp, n, hl, just_foreground, cmpcharp)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
585 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
586 int left, top;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
587 register GLYPH *gp; /* Points to first GLYPH. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
588 register int n; /* Number of glyphs to display. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
589 int hl;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
590 int just_foreground;
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
591 struct cmpchar_info *cmpcharp;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
592 {
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
593 wchar_t *x_2byte_buffer
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
594 = (wchar_t *) alloca (FRAME_WINDOW_WIDTH (f) * sizeof (*x_2byte_buffer));
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
595 register wchar_t *cp; /* Steps through x_2byte_buffer[]. */
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
596
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
597 /* Allocate double the window width, as this buffer may contain MBCS
23806
b59294a6167e (dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23677
diff changeset
598 characters under w32. Unsigned to let GetCharABCWidths work. */
b59294a6167e (dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23677
diff changeset
599 unsigned char *x_1byte_buffer
b59294a6167e (dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23677
diff changeset
600 = (unsigned char *) alloca (2 * FRAME_WINDOW_WIDTH (f)
b59294a6167e (dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23677
diff changeset
601 * sizeof (*x_1byte_buffer));
b59294a6167e (dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23677
diff changeset
602 register unsigned char *bp; /* Steps through x_1byte_buffer[]. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
603 register int tlen = GLYPH_TABLE_LENGTH;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
604 register Lisp_Object *tbase = GLYPH_TABLE_BASE;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
605 Window window = FRAME_W32_WINDOW (f);
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
606 HDC hdc = get_frame_dc (f);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
607 int orig_left = left;
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
608 int gidx = 0;
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
609 int i;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
610
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
611 while (n > 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
612 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
613 /* Get the face-code of the next GLYPH. */
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
614 int cf, len, n_chars;
21614
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
615 GLYPH g = *gp;
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
616 int ch, charset;
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
617 Lisp_Object first_ch;
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
618 /* HIGHEST and LOWEST are used while drawing a composite
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
619 character. The meanings are described later. */
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
620 int highest, lowest;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
621
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
622 GLYPH_FOLLOW_ALIASES (tbase, tlen, g);
21614
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
623 cf = (cmpcharp ? cmpcharp->face_work : FAST_GLYPH_FACE (g));
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
624 ch = FAST_GLYPH_CHAR (g);
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
625 if (unibyte_display_via_language_environment
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
626 && SINGLE_BYTE_CHAR_P (ch)
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
627 && ch >= 160)
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
628 ch = unibyte_char_to_multibyte (ch);
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
629 if (gidx == 0) XSETFASTINT (first_ch, ch);
21614
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
630 charset = CHAR_CHARSET (ch);
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
631 if (charset == CHARSET_COMPOSITION)
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
632 {
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
633 /* We must draw components of the composite character on the
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
634 same column. */
21614
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
635 cmpcharp = cmpchar_table[COMPOSITE_CHAR_ID (ch)];
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
636
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
637 /* Set the face in the slot for work. */
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
638 cmpcharp->face_work = cf;
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
639
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
640 /* We don't need the return value ... */
21614
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
641 dumpglyphs (f, left, top, cmpcharp->glyph, cmpcharp->glyph_len,
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
642 hl, just_foreground, cmpcharp);
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
643 /* ... because the width of just drawn text can be
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
644 calculated as follows. */
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
645 left += FONT_WIDTH (FRAME_FONT (f)) * cmpcharp->width;
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
646
21614
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
647 ++gp, --n;
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
648 while (gp && (*gp & GLYPH_MASK_PADDING)) ++gp, --n;
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
649 cmpcharp = NULL;
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
650 continue;
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
651 }
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
652
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
653 /* Find the run of consecutive glyphs which can be drawn with
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
654 the same DC (i.e. the same charset and the same face-code).
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
655 Extract their character codes into X_2BYTE_BUFFER.
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
656 If CMPCHARP is not NULL, face-code is not checked because we
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
657 use only the face specified in `cmpcharp->face_work'. */
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
658 cp = x_2byte_buffer;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
659 while (n > 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
660 {
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
661 int this_charset, c1, c2;
21614
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
662
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
663 g = *gp;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
664 GLYPH_FOLLOW_ALIASES (tbase, tlen, g);
21614
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
665 ch = FAST_GLYPH_CHAR (g);
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
666 if (unibyte_display_via_language_environment
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
667 && SINGLE_BYTE_CHAR_P (ch)
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
668 && ch >= 160)
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
669 ch = unibyte_char_to_multibyte (ch);
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
670 SPLIT_CHAR (ch, this_charset, c1, c2);
21614
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
671 if (this_charset != charset
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
672 || (cmpcharp == NULL && FAST_GLYPH_FACE (g) != cf))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
673 break;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
674
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
675 if (c2 > 0)
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
676 *cp = BUILD_WCHAR_T (c1, c2);
21614
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
677 else
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
678 *cp = BUILD_WCHAR_T (0, c1);
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
679 ++cp;
21614
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
680 ++gp, --n;
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
681 while (gp && (*gp & GLYPH_MASK_PADDING))
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
682 ++gp, --n;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
683 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
684
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
685 /* LEN gets the length of the run. */
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
686 len = cp - x_2byte_buffer;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
687 /* Now output this run of chars, with the font and pixel values
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
688 determined by the face code CF. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
689 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
690 struct face *face = FRAME_DEFAULT_FACE (f);
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
691 XFontStruct *font = NULL;
24131
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
692 int fontset;
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
693 struct font_info *fontp;
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
694 int font_id;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
695 COLORREF fg;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
696 COLORREF bg;
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
697 int stippled = 0;
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
698 int line_height = FRAME_LINE_HEIGHT (f);
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
699 /* Pixel width of each glyph in this run. */
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
700 int glyph_width
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
701 = (FONT_WIDTH (FRAME_FONT (f))
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
702 * (cmpcharp ? cmpcharp->width : CHARSET_WIDTH (charset)));
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
703 /* Overall pixel width of this run. */
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
704 int run_width
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
705 = (FONT_WIDTH (FRAME_FONT (f))
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
706 * (cmpcharp ? cmpcharp->width : len * CHARSET_WIDTH (charset)));
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
707 /* A flag to tell if we have already filled background. We
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
708 fill background in advance in the following cases:
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
709 1) A face has stipple.
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
710 2) A height of font is shorter than LINE_HEIGHT.
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
711 3) Drawing a composite character.
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
712 4) Font has non-zero _MULE_BASELINE_OFFSET property.
24146
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
713 5) Font is a bdf font.
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
714 After filling background, we draw glyphs by XDrawString16. */
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
715 int background_filled;
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
716 /* Baseline position of a character, offset from TOP. */
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
717 int baseline;
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
718 /* The property value of `_MULE_RELATIVE_COMPOSE' and
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
719 `_MULE_DEFAULT_ASCENT'. */
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
720 int relative_compose = 0, default_ascent = 0;
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
721 /* 1 if we find no font or a font of inappropriate size. */
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
722 int require_clipping;
24146
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
723 RECT clip_rectangle;
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
724 LPRECT clip_region = NULL;
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
725 UINT fuOptions = 0;
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
726
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
727 int codepage = CP_DEFAULT;
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
728 BOOL print_via_unicode = FALSE;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
729
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
730 /* HL = 3 means use a mouse face previously chosen. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
731 if (hl == 3)
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
732 cf = FRAME_W32_DISPLAY_INFO (f)->mouse_face_face_id;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
733
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
734 /* First look at the face of the text itself. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
735 if (cf != 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
736 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
737 /* It's possible for the display table to specify
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
738 a face code that is out of range. Use 0 in that case. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
739 if (cf < 0 || cf >= FRAME_N_COMPUTED_FACES (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
740 || FRAME_COMPUTED_FACES (f) [cf] == 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
741 cf = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
742
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
743 if (cf == 1)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
744 face = FRAME_MODE_LINE_FACE (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
745 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
746 face = intern_face (f, FRAME_COMPUTED_FACES (f) [cf]);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
747 if (FACE_STIPPLE (face))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
748 stippled = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
749 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
750
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
751 /* Then comes the distinction between modeline and normal text. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
752 else if (hl == 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
753 ;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
754 else if (hl == 1)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
755 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
756 face = FRAME_MODE_LINE_FACE (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
757 if (FACE_STIPPLE (face))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
758 stippled = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
759 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
760
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
761 /* Setting appropriate font and codepage for this charset. */
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
762 if (charset != CHARSET_ASCII)
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
763 {
24131
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
764 fontset = FACE_FONTSET (face);
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
765
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
766 if ((fontset < 0 && (fontset = FRAME_FONTSET (f)) < 0)
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
767 || !(fontp = FS_LOAD_FONT (f, FRAME_W32_FONT_TABLE (f),
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
768 charset, NULL, fontset)))
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
769 goto font_not_found;
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
770
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
771 font = (XFontStruct *) (fontp->font);
24131
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
772 codepage = w32_codepage_for_font (fontp->name);
24146
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
773
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
774 if ( font && !font->bdf )
24480
f9d3288b66c3 (W32_TEXTOUT): Do not multiply nchars by
Geoff Voelker <voelker@cs.washington.edu>
parents: 24265
diff changeset
775 print_via_unicode = w32_use_unicode_for_codepage (codepage);
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
776
24146
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
777 baseline = FONT_BASE (font) + fontp->baseline_offset;
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
778
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
779 if (cmpcharp && cmpcharp->cmp_rule == NULL)
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
780 {
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
781 relative_compose = fontp->relative_compose;
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
782 default_ascent = fontp->default_ascent;
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
783 }
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
784
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
785 /* We have to change code points in the following cases. */
24131
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
786 if (fontp->font_encoder)
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
787 {
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
788 /* This font requires CCL program to calculate code
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
789 point of characters. */
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
790 struct ccl_program *ccl = fontp->font_encoder;
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
791
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
792 if (CHARSET_DIMENSION (charset) == 1)
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
793 for (cp = x_2byte_buffer; cp < x_2byte_buffer + len; cp++)
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
794 {
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
795 ccl->reg[0] = charset;
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
796 ccl->reg[1] = BYTE2 (*cp);
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
797 ccl_driver (ccl, NULL, NULL, 0, 0, NULL);
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
798 /* We assume that MSBs are appropriately
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
799 set/reset by CCL program. */
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
800 #if 0 /* this probably works under NT, but not under 95. */
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
801 if (font->tm.tmLastChar < 256) /* 1-byte font */
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
802 *cp = BUILD_WCHAR_T (0, ccl->reg[1]);
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
803 else
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
804 *cp = BUILD_WCHAR_T (ccl->reg[1], ccl->reg[2]);
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
805 #else /* Assume single dimensional charsets stay so. */
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
806 *cp = BUILD_WCHAR_T (0, ccl->reg[1]);
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
807 #endif
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
808 }
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
809 else
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
810 for (cp = x_2byte_buffer; cp < x_2byte_buffer + len; cp++)
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
811 {
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
812 ccl->reg[0] = charset;
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
813 ccl->reg[1] = BYTE1 (*cp) , ccl->reg[2] = BYTE2 (*cp);
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
814 ccl_driver (ccl, NULL, NULL, 0, 0, NULL);
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
815 /* We assume that MSBs are appropriately
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
816 set/reset by CCL program. */
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
817 #if 0 /* this probably works under NT, but not under 95. */
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
818 if (font->tm.tmLastChar < 256) /* 1-byte font */
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
819 *cp = BUILD_WCHAR_T (0, ccl->reg[1]);
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
820 else
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
821 *cp = BUILD_WCHAR_T (ccl->reg[1],ccl->reg[2]);
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
822 #else /* Assume multidimensional charsets stay so. */
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
823 *cp = BUILD_WCHAR_T (ccl->reg[1],ccl->reg[2]);
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
824 #endif
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
825 }
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
826 }
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
827 else if (fontp->encoding[charset])
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
828 {
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
829 int enc = fontp->encoding[charset];
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
830
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
831 if ((enc == 1 || enc == 2) && CHARSET_DIMENSION (charset) == 2)
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
832 for (cp = x_2byte_buffer; cp < x_2byte_buffer + len; cp++)
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
833 *cp = BUILD_WCHAR_T (BYTE1 (*cp) | 0x80, BYTE2 (*cp));
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
834 if (enc == 1 || enc == 3)
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
835 for (cp = x_2byte_buffer; cp < x_2byte_buffer + len; cp++)
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
836 *cp = BUILD_WCHAR_T (BYTE1 (*cp), BYTE2 (*cp) | 0x80);
24146
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
837 /* Special encoding for SJIS Kanji. */
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
838 if (enc == 4)
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
839 {
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
840 if (CHARSET_DIMENSION (charset) == 2)
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
841 {
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
842 int sjis1, sjis2;
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
843 for (cp = x_2byte_buffer;
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
844 cp < x_2byte_buffer + len; cp++)
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
845 {
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
846 ENCODE_SJIS (BYTE1 (*cp), BYTE2 (*cp),
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
847 sjis1, sjis2);
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
848 *cp = BUILD_WCHAR_T (sjis1, sjis2);
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
849 }
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
850 }
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
851 else
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
852 for (cp = x_2byte_buffer;
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
853 cp < x_2byte_buffer + len; cp++)
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
854 *cp = BUILD_WCHAR_T (BYTE1 (*cp),
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
855 BYTE2 (*cp) | 0x80);
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
856 }
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
857 }
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
858 }
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
859 else
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
860 {
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
861 font_not_found:
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
862 if (charset == CHARSET_ASCII || charset == charset_latin_iso8859_1)
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
863 {
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
864 font = FACE_FONT (face);
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
865 if (!font || font == (XFontStruct *) FACE_DEFAULT)
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
866 font = FRAME_FONT (f);
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
867 baseline = FONT_BASE (FRAME_FONT (f));
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
868 if (charset == charset_latin_iso8859_1)
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
869 {
24146
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
870 if (!font->bdf && font->tm.tmLastChar < 0x80)
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
871 /* This font can't display Latin1 characters. */
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
872 font = NULL;
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
873 else
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
874 {
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
875 for (cp = x_2byte_buffer;
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
876 cp < x_2byte_buffer + len; cp++)
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
877 *cp = BUILD_WCHAR_T (BYTE1 (*cp),
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
878 BYTE2 (*cp) | 0x80);
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
879 }
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
880 }
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
881 }
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
882 }
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
883
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
884 fg = face->foreground;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
885 bg = face->background;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
886
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
887 /* Now override that if the cursor's on this character. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
888 if (hl == 2)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
889 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
890 /* The cursor overrides stippling. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
891 stippled = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
892
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
893 if (font == FRAME_FONT (f)
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
894 && face->background == FRAME_BACKGROUND_PIXEL (f)
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
895 && face->foreground == FRAME_FOREGROUND_PIXEL (f)
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
896 && !cmpcharp)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
897 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
898 bg = f->output_data.w32->cursor_pixel;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
899 fg = face->background;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
900 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
901 /* Cursor on non-default face: must merge. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
902 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
903 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
904 bg = f->output_data.w32->cursor_pixel;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
905 fg = face->background;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
906 /* If the glyph would be invisible,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
907 try a different foreground. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
908 if (fg == bg)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
909 fg = face->foreground;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
910 if (fg == bg)
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
911 fg = f->output_data.w32->cursor_foreground_pixel;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
912 if (fg == bg)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
913 fg = face->foreground;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
914 /* Make sure the cursor is distinct from text in this face. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
915 if (bg == face->background
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
916 && fg == face->foreground)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
917 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
918 bg = face->foreground;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
919 fg = face->background;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
920 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
921 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
922 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
923
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
924 if (font)
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
925 require_clipping = (!NILP (Vclip_large_size_font)
24146
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
926 && ((font->bdf
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
927 ? (font->bdf->ury > baseline
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
928 || font->bdf->lly > line_height - baseline)
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
929 : (font->tm.tmAscent > baseline
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
930 || font->tm.tmDescent > line_height - baseline))
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
931 || (!cmpcharp && FONT_MAX_WIDTH (font) > glyph_width)));
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
932
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
933 if (font && (just_foreground || (cmpcharp && gidx > 0)))
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
934 background_filled = 1;
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
935
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
936 /* Stippling not supported under w32. */
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
937
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
938 else if (!font
24146
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
939 || font->bdf
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
940 || FONT_HEIGHT (font) < line_height
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
941 || FONT_WIDTH (font) < glyph_width
23806
b59294a6167e (dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23677
diff changeset
942 || FONT_MAX_WIDTH (font) != FONT_WIDTH (font)
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
943 || cmpcharp)
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
944 {
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
945 /* Fill in the background for the current run. */
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
946 w32_fill_area (f, hdc, bg,
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
947 left,
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
948 top,
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
949 run_width,
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
950 line_height);
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
951 background_filled = 1;
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
952 if (cmpcharp)
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
953 /* To assure not to fill background while drawing
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
954 remaining components. */
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
955 just_foreground = 1;
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
956 }
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
957 else
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
958 background_filled = 0;
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
959
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
960 SetBkMode (hdc, background_filled ? TRANSPARENT : OPAQUE);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
961 SetTextColor (hdc, fg);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
962 SetBkColor (hdc, bg);
24146
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
963 SetTextAlign (hdc, TA_BASELINE | TA_LEFT);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
964
24674
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
965 /* On NT, where conversion to Unicode has to happen sometime
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
966 when using the normal ExtTextOut facility, we might as well
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
967 take advantage of x_2byte_buffer which is already allocated,
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
968 to avoid the allocation overhead for implicit conversion. */
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
969
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
970 if (!print_via_unicode
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
971 && codepage == CP_DEFAULT
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
972 && w32_enable_unicode_output
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
973 && os_subtype == OS_NT
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
974 && font && !font->bdf)
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
975 {
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
976 print_via_unicode = TRUE;
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
977 }
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
978
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
979 /* Note that we can special-case the conversion to Unicode when
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
980 the charset is CHARSET_ASCII (an important case) or Latin-1,
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
981 because x_2byte_buffer in fact already contains the unicode
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
982 characters. So avoid setting up x_1byte_buffer in that case. */
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
983 if (!print_via_unicode
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
984 || (charset != CHARSET_ASCII && charset != charset_latin_iso8859_1))
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
985 {
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
986 /* Convert x_2byte_buffer into a buffer of single byte
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
987 characters - possibly containing MBCS runs. */
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
988 bp = x_1byte_buffer;
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
989 for (i = 0; i < len; i++)
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
990 {
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
991 if (BYTE1 (*(x_2byte_buffer + i)))
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
992 *bp++ = BYTE1 (*(x_2byte_buffer + i));
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
993 *bp++ = BYTE2 (*(x_2byte_buffer + i));
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
994 }
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
995 n_chars = bp - x_1byte_buffer;
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
996 }
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
997 else
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
998 n_chars = len;
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
999
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
1000 if (print_via_unicode
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
1001 && charset != CHARSET_ASCII && charset != charset_latin_iso8859_1)
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
1002 {
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
1003 i = MultiByteToWideChar
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
1004 (codepage, 0, x_1byte_buffer, n_chars,
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
1005 x_2byte_buffer, FRAME_WINDOW_WIDTH (f));
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
1006
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
1007 /* Make sure we don't display nothing if conversion fails. */
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
1008 if (i == 0)
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
1009 print_via_unicode = FALSE;
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
1010 else
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
1011 n_chars = i;
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
1012 }
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1013
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1014 if (font)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1015 {
24146
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1016 if (font->hfont)
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1017 SelectObject (hdc, font->hfont);
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1018
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1019 if (!cmpcharp)
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1020 {
24146
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1021 int xoffset = 0, yoffset = baseline;
23806
b59294a6167e (dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23677
diff changeset
1022 if (require_clipping || FONT_WIDTH (font) != glyph_width
b59294a6167e (dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23677
diff changeset
1023 || FONT_MAX_WIDTH (font) != FONT_WIDTH (font))
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1024 {
24146
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1025 /* The incrementing of i in this loop is done
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1026 inside the W32_CHAROUT macro. */
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1027 for (i = 0; i < n_chars; )
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1028 {
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1029 if (require_clipping)
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1030 {
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1031 /* Set up a clipping rectangle for ExtTextOut */
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1032 fuOptions |= ETO_CLIPPED;
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1033 clip_rectangle.left = left + i * glyph_width;
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1034 clip_rectangle.right
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1035 = left + (i + 1) * glyph_width;
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1036 clip_rectangle.top = top;
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1037 clip_rectangle.bottom = top + line_height;
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1038 clip_region = &clip_rectangle;
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1039 }
24146
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1040 W32_TEXTOUT (i, 1);
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1041 }
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1042 }
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1043 else
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1044 {
24146
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1045 i = 0;
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1046 W32_TEXTOUT (i, n_chars);
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1047 }
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1048 }
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1049 else
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1050 {
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1051 /* Handle composite characters. */
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1052 RECT clip_rectangle;
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1053 LPRECT clip_region = NULL;
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1054 UINT fuOptions = 0;
23806
b59294a6167e (dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23677
diff changeset
1055 ABC char_placement;
b59294a6167e (dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23677
diff changeset
1056 int char_width = 0;
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1057
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1058 if (require_clipping)
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1059 {
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1060 /* Set up a clipping rectangle for ExtTextOut */
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1061 fuOptions |= ETO_CLIPPED;
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1062 clip_rectangle.left = left;
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1063 clip_rectangle.right = left + glyph_width;
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1064 clip_rectangle.top = top;
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1065 clip_rectangle.bottom = top + line_height;
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1066 clip_region = &clip_rectangle;
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1067 }
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1068 if ((cmpcharp->cmp_rule || relative_compose)
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1069 && gidx == 0)
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1070 {
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1071 /* This is the first character. Initialize variables.
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1072 HIGHEST is the highest position of glyphs ever
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1073 written, LOWEST the lowest position. */
24146
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1074 int xoffset = 0;
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1075 int yoffset = baseline;
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1076 int start = 0;
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1077
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1078 if (default_ascent
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1079 && CHAR_TABLE_P (Vuse_default_ascent)
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1080 && !NILP (Faref (Vuse_default_ascent, first_ch)))
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1081 {
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1082 highest = default_ascent;
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1083 lowest = 0;
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1084 }
24146
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1085 /* TODO: per char metrics for Truetype and BDF
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1086 fonts. */
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1087 {
24146
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1088 highest = FONT_BASE (font) + 1;
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1089 lowest = - (FONT_HEIGHT (font) - FONT_BASE (font));
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1090 }
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1091
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1092 if (cmpcharp->cmp_rule)
24146
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1093 xoffset = (int)(cmpcharp->col_offset[0]
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1094 * FONT_WIDTH (FRAME_FONT (f)));
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1095
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1096 i = 1;
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1097
23806
b59294a6167e (dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23677
diff changeset
1098 /* Truetype fonts often contain underhangs to
b59294a6167e (dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23677
diff changeset
1099 handle composition characters. This works
b59294a6167e (dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23677
diff changeset
1100 against our attempts to position the characters
b59294a6167e (dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23677
diff changeset
1101 manually, so we need to compensate for this.
b59294a6167e (dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23677
diff changeset
1102 */
b59294a6167e (dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23677
diff changeset
1103 if (print_via_unicode ?
b59294a6167e (dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23677
diff changeset
1104 GetCharABCWidthsW (hdc, *x_2byte_buffer,
b59294a6167e (dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23677
diff changeset
1105 *x_2byte_buffer,
b59294a6167e (dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23677
diff changeset
1106 &char_placement)
b59294a6167e (dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23677
diff changeset
1107 : GetCharABCWidths (hdc, *x_1byte_buffer,
b59294a6167e (dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23677
diff changeset
1108 *x_1byte_buffer,
b59294a6167e (dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23677
diff changeset
1109 &char_placement))
b59294a6167e (dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23677
diff changeset
1110 {
b59294a6167e (dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23677
diff changeset
1111 char_width = char_placement.abcA
b59294a6167e (dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23677
diff changeset
1112 + char_placement.abcB + char_placement.abcC;
24146
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1113 xoffset += FONT_WIDTH (font) - char_width;
23806
b59294a6167e (dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23677
diff changeset
1114 }
b59294a6167e (dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23677
diff changeset
1115 /* Don't let characters go beyond the glyph
b59294a6167e (dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23677
diff changeset
1116 boundary whatever their over/underhangs. */
24146
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1117 if (xoffset > glyph_width - char_width)
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1118 xoffset = glyph_width - char_width;
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1119
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1120 if (xoffset < 0)
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1121 xoffset = 0;
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1122
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1123 /* Draw the first character at the normal
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1124 position. */
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1125 W32_TEXTOUT (start, 1);
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1126 gidx++;
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1127 }
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1128 else
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1129 i = 0;
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1130
24146
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1131 for (; i < n_chars; gidx++)
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1132 {
24146
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1133 int xoffset = 0, yoffset = FONT_BASE (font);
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1134
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1135 if (relative_compose)
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1136 {
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1137 /* No per char metrics on w32. */
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1138 if (NILP (Vignore_relative_composition)
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1139 || NILP (Faref (Vignore_relative_composition,
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1140 make_number (cmpcharp->glyph[gidx]))))
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1141 {
24146
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1142 if (- (FONT_HEIGHT (font) - FONT_BASE (font))
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1143 >= relative_compose)
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1144 {
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1145 /* Draw above the current glyphs. */
24146
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1146 yoffset = highest + FONT_HEIGHT (font);
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1147 highest += FONT_HEIGHT (font);
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1148 }
24146
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1149 else if (FONT_BASE (font) <= 0)
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1150 {
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1151 /* Draw beneath the current glyphs. */
24146
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1152 yoffset = lowest;
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1153 lowest -= FONT_HEIGHT (font);
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1154 }
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1155 }
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1156 else
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1157 {
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1158 /* Draw the glyph at normal position. If
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1159 it sticks out of HIGHEST or LOWEST,
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1160 update them appropriately. */
24146
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1161 if (FONT_BASE (font) > highest)
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1162 highest = FONT_BASE (font);
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1163 else if (- (FONT_HEIGHT (font) - FONT_BASE (font))
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1164 < lowest)
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1165 lowest = - (FONT_HEIGHT (font) -
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1166 FONT_BASE (font));
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1167 }
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1168 }
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1169 else if (cmpcharp->cmp_rule)
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1170 {
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1171 int gref = (cmpcharp->cmp_rule[gidx] - 0xA0) / 9;
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1172 int nref = (cmpcharp->cmp_rule[gidx] - 0xA0) % 9;
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1173 int bottom, top;
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1174
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1175 /* Re-encode GREF and NREF so that they specify
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1176 only Y-axis information:
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1177 0:top, 1:base, 2:bottom, 3:center */
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1178 gref = gref / 3 + (gref == 4) * 2;
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1179 nref = nref / 3 + (nref == 4) * 2;
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1180
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1181 /* No per char metrics on w32. */
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1182 bottom = ((gref == 0 ? highest : gref == 1 ? 0
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1183 : gref == 2 ? lowest
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1184 : (highest + lowest) / 2)
24146
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1185 - (nref == 0 ? FONT_HEIGHT (font)
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1186 : nref == 1 ? (FONT_HEIGHT (font) -
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1187 FONT_BASE (font))
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1188 : nref == 2 ? 0
24146
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1189 : (FONT_HEIGHT (font) / 2)));
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1190 top = bottom + FONT_HEIGHT (font);
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1191
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1192 if (top > highest)
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1193 highest = top;
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1194 if (bottom < lowest)
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1195 lowest = bottom;
24146
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1196 yoffset = bottom + FONT_HEIGHT (font);
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1197 xoffset = (int)(cmpcharp->col_offset[gidx]
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1198 * FONT_WIDTH (FRAME_FONT(f)));
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1199 }
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1200
23806
b59294a6167e (dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23677
diff changeset
1201 /* Truetype fonts often contain underhangs to
b59294a6167e (dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23677
diff changeset
1202 handle composition characters. This works
b59294a6167e (dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23677
diff changeset
1203 against our attempts to position the characters
b59294a6167e (dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23677
diff changeset
1204 manually, so we need to compensate for this.
b59294a6167e (dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23677
diff changeset
1205 */
b59294a6167e (dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23677
diff changeset
1206 if (print_via_unicode ?
b59294a6167e (dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23677
diff changeset
1207 GetCharABCWidthsW (hdc, *(x_2byte_buffer + i),
b59294a6167e (dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23677
diff changeset
1208 *(x_2byte_buffer + i),
b59294a6167e (dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23677
diff changeset
1209 &char_placement)
b59294a6167e (dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23677
diff changeset
1210 : GetCharABCWidths (hdc, *(x_1byte_buffer + i),
b59294a6167e (dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23677
diff changeset
1211 *(x_1byte_buffer + i),
b59294a6167e (dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23677
diff changeset
1212 &char_placement))
b59294a6167e (dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23677
diff changeset
1213 {
b59294a6167e (dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23677
diff changeset
1214 char_width = char_placement.abcA
b59294a6167e (dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23677
diff changeset
1215 + char_placement.abcB + char_placement.abcC;
24146
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1216 xoffset += FONT_WIDTH (font) - char_width;
23806
b59294a6167e (dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23677
diff changeset
1217 }
b59294a6167e (dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23677
diff changeset
1218 /* Don't let characters go beyond the glyph
b59294a6167e (dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23677
diff changeset
1219 boundary whatever their over/underhangs. */
24146
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1220 if (xoffset > glyph_width - char_width)
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1221 xoffset = glyph_width - char_width;
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1222
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1223 if (xoffset < 0)
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1224 xoffset = 0;
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1225
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1226 W32_TEXTOUT (i, 1);
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1227 }
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1228 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1229 }
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1230 if (!font)
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1231 {
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1232 /* Show rectangles to indicate that we found no font. */
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1233 int limit = cmpcharp ? 1 : len;
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1234
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1235 for (i = 0; i < limit; i++)
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1236 Rectangle (hdc, left + glyph_width * i, top,
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1237 left + glyph_width * (i + 1) - 1,
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1238 top + line_height - 1);
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1239 }
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1240 else if (require_clipping && !NILP (Vhighlight_wrong_size_font))
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1241 {
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1242 /* Indicate that we found a font of inappropriate size. */
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1243 int limit = cmpcharp ? 1 : len;
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1244
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1245 for (i = 0; i < limit; i++)
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1246 {
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1247 w32_fill_area (f, hdc, fg, left + glyph_width * i,
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1248 top + line_height - 1, glyph_width, 1);
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1249 w32_fill_area (f, hdc, fg, left + glyph_width * i,
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1250 top + line_height - 3, 1, 2);
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1251 }
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1252 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1253 {
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1254 /* Setting underline position based on the metric of the
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1255 current font results in shaky underline if it strides
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1256 over different fonts. So, we set the position based only
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1257 on the default font of this frame. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1258 int underline_position = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1259
24146
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1260 if (FONT_HEIGHT (FRAME_FONT (f)) - FONT_BASE(FRAME_FONT (f))
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1261 <= underline_position)
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1262 underline_position = (FONT_HEIGHT (FRAME_FONT (f)) -
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
1263 FONT_BASE(FRAME_FONT (f))) - 1;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1264
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1265 if (face->underline)
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1266 w32_fill_area (f, hdc, fg, left,
23638
e6fb9ffee4f4 (dumpglyphs): Use FRAME_FONT for w32_fill_area.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23510
diff changeset
1267 top + FONT_BASE (FRAME_FONT (f))
e6fb9ffee4f4 (dumpglyphs): Use FRAME_FONT for w32_fill_area.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23510
diff changeset
1268 + underline_position,
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1269 run_width, 1);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1270 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1271
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1272 if (!cmpcharp)
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1273 left += run_width;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1274 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1275 }
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
1276 release_frame_dc (f, hdc);
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1277
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
1278 return (left - orig_left);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1279 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1280
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1281
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1282 /* Output some text at the nominal frame cursor position.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1283 Advance the cursor over the text.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1284 Output LEN glyphs at START.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1285
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
1286 `highlight', set up by w32_reassert_line_highlight or w32_change_line_highlight,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1287 controls the pixel values used for foreground and background. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1288
21831
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
1289 static void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
1290 w32_write_glyphs (start, len)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1291 register GLYPH *start;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1292 int len;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1293 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1294 register int temp_length;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1295 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1296
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1297 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1298
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1299 do_line_dance ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1300 f = updating_frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1301 if (f == 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1302 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1303 f = selected_frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1304 /* If not within an update,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1305 output at the frame's visible cursor. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1306 curs_x = f->cursor_x;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1307 curs_y = f->cursor_y;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1308 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1309
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1310 dumpglyphs (f,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1311 CHAR_TO_PIXEL_COL (f, curs_x),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1312 CHAR_TO_PIXEL_ROW (f, curs_y),
21614
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
1313 start, len, highlight, 0, NULL);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1314
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1315 /* If we drew on top of the cursor, note that it is turned off. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1316 if (curs_y == f->phys_cursor_y
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1317 && curs_x <= f->phys_cursor_x
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1318 && curs_x + len > f->phys_cursor_x)
24674
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
1319 f->phys_cursor_on = 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1320
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1321 if (updating_frame == 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1322 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1323 f->cursor_x += len;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1324 x_display_cursor (f, 1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1325 f->cursor_x -= len;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1326 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1327 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1328 curs_x += len;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1329
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1330 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1331 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1332
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1333 /* Clear to the end of the line.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1334 Erase the current text line from the nominal cursor position (inclusive)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1335 to column FIRST_UNUSED (exclusive). The idea is that everything
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1336 from FIRST_UNUSED onward is already erased. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1337
21831
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
1338 static void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
1339 w32_clear_end_of_line (first_unused)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1340 register int first_unused;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1341 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1342 struct frame *f = updating_frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1343
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1344 if (f == 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1345 abort ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1346
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1347 if (curs_y < 0 || curs_y >= f->height)
21831
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
1348 return;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1349 if (first_unused <= 0)
21831
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
1350 return;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1351
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1352 if (first_unused >= f->width)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1353 first_unused = f->width;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1354
18877
d3e5a5f5fe02 (w32_clear_end_of_line): Include scroll bar width.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18507
diff changeset
1355 first_unused += FRAME_LEFT_SCROLL_BAR_WIDTH (f);
d3e5a5f5fe02 (w32_clear_end_of_line): Include scroll bar width.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18507
diff changeset
1356
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1357 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1358
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1359 do_line_dance ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1360
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1361 /* Notice if the cursor will be cleared by this operation. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1362 if (curs_y == f->phys_cursor_y
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1363 && curs_x <= f->phys_cursor_x
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1364 && f->phys_cursor_x < first_unused)
24674
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
1365 f->phys_cursor_on = 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1366
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
1367 w32_clear_area (f, NULL,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1368 CHAR_TO_PIXEL_COL (f, curs_x),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1369 CHAR_TO_PIXEL_ROW (f, curs_y),
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
1370 FONT_WIDTH (f->output_data.w32->font) * (first_unused - curs_x),
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
1371 f->output_data.w32->line_height);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1372
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1373 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1374 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1375
21831
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
1376 static void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
1377 w32_clear_frame ()
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1378 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1379 struct frame *f = updating_frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1380
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1381 if (f == 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1382 f = selected_frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1383
24674
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
1384 f->phys_cursor_on = 0; /* Cursor not visible. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1385 curs_x = 0; /* Nominal cursor position is top left. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1386 curs_y = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1387
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1388 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1389
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
1390 w32_clear_window (f);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1391
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1392 /* We have to clear the scroll bars, too. If we have changed
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1393 colors or something like that, then they should be notified. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1394 x_scroll_bar_clear (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1395
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1396 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1397 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1398
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1399 /* Make audible bell. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1400
21831
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
1401 static void
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
1402 w32_ring_bell (void)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1403 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1404 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1405
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1406 if (visible_bell)
22059
23fda104cd36 (w32_ring_bell): Flash window correctly.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21885
diff changeset
1407 {
23fda104cd36 (w32_ring_bell): Flash window correctly.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21885
diff changeset
1408 int i;
23fda104cd36 (w32_ring_bell): Flash window correctly.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21885
diff changeset
1409 HWND hwnd = FRAME_W32_WINDOW (selected_frame);
23fda104cd36 (w32_ring_bell): Flash window correctly.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21885
diff changeset
1410
23fda104cd36 (w32_ring_bell): Flash window correctly.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21885
diff changeset
1411 for (i = 0; i < 5; i++)
23fda104cd36 (w32_ring_bell): Flash window correctly.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21885
diff changeset
1412 {
23fda104cd36 (w32_ring_bell): Flash window correctly.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21885
diff changeset
1413 FlashWindow (hwnd, TRUE);
23fda104cd36 (w32_ring_bell): Flash window correctly.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21885
diff changeset
1414 Sleep (10);
23fda104cd36 (w32_ring_bell): Flash window correctly.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21885
diff changeset
1415 }
23fda104cd36 (w32_ring_bell): Flash window correctly.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21885
diff changeset
1416 FlashWindow (hwnd, FALSE);
23fda104cd36 (w32_ring_bell): Flash window correctly.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21885
diff changeset
1417 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1418 else
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
1419 w32_sys_ring_bell ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1420
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1421 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1422 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1423
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1424 /* Insert and delete character.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1425 These are not supposed to be used because we are supposed to turn
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1426 off the feature of using them. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1427
21831
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
1428 static void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
1429 w32_insert_glyphs (start, len)
21831
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
1430 register GLYPH *start;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1431 register int len;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1432 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1433 abort ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1434 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1435
21831
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
1436 static void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
1437 w32_delete_glyphs (n)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1438 register int n;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1439 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1440 abort ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1441 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1442
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1443 /* Specify how many text lines, from the top of the window,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1444 should be affected by insert-lines and delete-lines operations.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1445 This, and those operations, are used only within an update
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
1446 that is bounded by calls to w32_update_begin and w32_update_end. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1447
21831
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
1448 static void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
1449 w32_set_terminal_window (n)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1450 register int n;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1451 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1452 if (updating_frame == 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1453 abort ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1454
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1455 if ((n <= 0) || (n > updating_frame->height))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1456 flexlines = updating_frame->height;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1457 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1458 flexlines = n;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1459 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1460
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1461 /* These variables need not be per frame
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1462 because redisplay is done on a frame-by-frame basis
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1463 and the line dance for one frame is finished before
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1464 anything is done for another frame. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1465
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1466 /* Array of line numbers from cached insert/delete operations.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1467 line_dance[i] is the old position of the line that we want
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1468 to move to line i, or -1 if we want a blank line there. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1469 static int *line_dance;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1470
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1471 /* Allocated length of that array. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1472 static int line_dance_len;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1473
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1474 /* Flag indicating whether we've done any work. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1475 static int line_dance_in_progress;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1476
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1477 /* Perform an insert-lines or delete-lines operation,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1478 inserting N lines or deleting -N lines at vertical position VPOS. */
21831
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
1479
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
1480 static void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
1481 w32_ins_del_lines (vpos, n)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1482 int vpos, n;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1483 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1484 register int fence, i;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1485
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1486 if (vpos >= flexlines)
21831
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
1487 return;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1488
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1489 if (!line_dance_in_progress)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1490 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1491 int ht = updating_frame->height;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1492 if (ht > line_dance_len)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1493 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1494 line_dance = (int *)xrealloc (line_dance, ht * sizeof (int));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1495 line_dance_len = ht;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1496 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1497 for (i = 0; i < ht; ++i) line_dance[i] = i;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1498 line_dance_in_progress = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1499 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1500 if (n >= 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1501 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1502 if (n > flexlines - vpos)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1503 n = flexlines - vpos;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1504 fence = vpos + n;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1505 for (i = flexlines; --i >= fence;)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1506 line_dance[i] = line_dance[i-n];
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1507 for (i = fence; --i >= vpos;)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1508 line_dance[i] = -1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1509 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1510 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1511 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1512 n = -n;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1513 if (n > flexlines - vpos)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1514 n = flexlines - vpos;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1515 fence = flexlines - n;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1516 for (i = vpos; i < fence; ++i)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1517 line_dance[i] = line_dance[i + n];
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1518 for (i = fence; i < flexlines; ++i)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1519 line_dance[i] = -1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1520 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1521 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1522
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1523 /* Here's where we actually move the pixels around.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1524 Must be called with input blocked. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1525 static void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1526 do_line_dance ()
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1527 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1528 register int i, j, distance;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1529 register struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1530 int ht;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1531 int intborder;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1532 HDC hdc;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1533
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1534 /* Must check this flag first. If it's not set, then not only is the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1535 array uninitialized, but we might not even have a frame. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1536 if (!line_dance_in_progress)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1537 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1538
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1539 f = updating_frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1540 if (f == 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1541 abort ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1542
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1543 ht = f->height;
24674
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
1544 intborder = CHAR_TO_PIXEL_COL (f, FRAME_LEFT_SCROLL_BAR_WIDTH (f));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1545
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1546 x_display_cursor (updating_frame, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1547
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
1548 hdc = get_frame_dc (f);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1549
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1550 for (i = 0; i < ht; ++i)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1551 if (line_dance[i] != -1 && (distance = line_dance[i]-i) > 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1552 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1553 for (j = i; (j < ht && line_dance[j] != -1
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1554 && line_dance[j]-j == distance); ++j);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1555 /* Copy [i,j) upward from [i+distance, j+distance) */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1556 BitBlt (hdc,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1557 intborder, CHAR_TO_PIXEL_ROW (f, i+distance),
24674
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
1558 FRAME_WINDOW_WIDTH (f) * FONT_WIDTH (FRAME_FONT (f)),
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
1559 (j-i) * FRAME_LINE_HEIGHT (f),
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1560 hdc,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1561 intborder, CHAR_TO_PIXEL_ROW (f, i),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1562 SRCCOPY);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1563 i = j-1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1564 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1565
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1566 for (i = ht; --i >=0; )
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1567 if (line_dance[i] != -1 && (distance = line_dance[i]-i) < 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1568 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1569 for (j = i; (--j >= 0 && line_dance[j] != -1
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1570 && line_dance[j]-j == distance););
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1571 /* Copy (j, i] downward from (j+distance, i+distance] */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1572 BitBlt (hdc,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1573 intborder, CHAR_TO_PIXEL_ROW (f, j+1+distance),
24674
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
1574 FRAME_WINDOW_WIDTH (f) * FONT_WIDTH (FRAME_FONT (f)),
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
1575 (i-j) * FRAME_LINE_HEIGHT (f),
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1576 hdc,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1577 intborder, CHAR_TO_PIXEL_ROW (f, j+1),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1578 SRCCOPY);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1579 i = j+1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1580 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1581
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1582 for (i = 0; i < ht; ++i)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1583 if (line_dance[i] == -1)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1584 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1585 for (j = i; j < ht && line_dance[j] == -1; ++j);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1586 /* Clear [i,j) */
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
1587 w32_clear_area (f, hdc,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1588 intborder,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1589 CHAR_TO_PIXEL_ROW (f, i),
24674
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
1590 FRAME_WINDOW_WIDTH (f) * FONT_WIDTH (FRAME_FONT (f)),
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
1591 (j-i) * FRAME_LINE_HEIGHT (f));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1592 i = j-1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1593 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1594 line_dance_in_progress = 0;
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
1595
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
1596 release_frame_dc (f, hdc);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1597 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1598
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1599 /* Support routines for exposure events. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1600 static void clear_cursor ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1601
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1602 /* Output into a rectangle of a window (for frame F)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1603 the characters in f->phys_lines that overlap that rectangle.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1604 TOP and LEFT are the position of the upper left corner of the rectangle.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1605 ROWS and COLS are the size of the rectangle.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1606 Call this function with input blocked. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1607
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1608 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1609 dumprectangle (f, left, top, cols, rows)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1610 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1611 register int left, top, cols, rows;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1612 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1613 register struct frame_glyphs *active_frame = FRAME_CURRENT_GLYPHS (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1614 int cursor_cleared = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1615 int bottom, right;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1616 register int y;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1617
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1618 if (FRAME_GARBAGED_P (f))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1619 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1620
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1621 /* Express rectangle as four edges, instead of position-and-size. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1622 bottom = top + rows;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1623 right = left + cols;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1624
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1625 /* Convert rectangle edges in pixels to edges in chars.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1626 Round down for left and top, up for right and bottom. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1627 top = PIXEL_TO_CHAR_ROW (f, top);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1628 left = PIXEL_TO_CHAR_COL (f, left);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
1629 bottom += (f->output_data.w32->line_height - 1);
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
1630 right += (FONT_WIDTH (f->output_data.w32->font) - 1);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1631 bottom = PIXEL_TO_CHAR_ROW (f, bottom);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1632 right = PIXEL_TO_CHAR_COL (f, right);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1633
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1634 /* Clip the rectangle to what can be visible. */
24674
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
1635 if (left < FRAME_LEFT_SCROLL_BAR_WIDTH (f))
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
1636 left = FRAME_LEFT_SCROLL_BAR_WIDTH (f);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1637 if (top < 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1638 top = 0;
24674
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
1639 if (right > f->width + FRAME_LEFT_SCROLL_BAR_WIDTH (f))
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
1640 right = f->width + FRAME_LEFT_SCROLL_BAR_WIDTH (f);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1641 if (bottom > f->height)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1642 bottom = f->height;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1643
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1644 /* Get size in chars of the rectangle. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1645 cols = right - left;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1646 rows = bottom - top;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1647
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1648 /* If rectangle has zero area, return. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1649 if (rows <= 0) return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1650 if (cols <= 0) return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1651
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1652 /* Turn off the cursor if it is in the rectangle.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1653 We will turn it back on afterward. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1654 if ((f->phys_cursor_x >= left) && (f->phys_cursor_x < right)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1655 && (f->phys_cursor_y >= top) && (f->phys_cursor_y < bottom))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1656 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1657 clear_cursor (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1658 cursor_cleared = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1659 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1660
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1661 /* Display the text in the rectangle, one text line at a time. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1662
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1663 for (y = top; y < bottom; y++)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1664 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1665 GLYPH *line = &active_frame->glyphs[y][left];
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1666
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1667 if (! active_frame->enable[y] || left > active_frame->used[y])
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1668 continue;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1669
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1670 dumpglyphs (f,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1671 CHAR_TO_PIXEL_COL (f, left),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1672 CHAR_TO_PIXEL_ROW (f, y),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1673 line, min (cols, active_frame->used[y] - left),
21614
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
1674 active_frame->highlight[y], 0, NULL);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1675 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1676
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1677 /* Turn the cursor on if we turned it off. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1678
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1679 if (cursor_cleared)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1680 x_display_cursor (f, 1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1681 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1682
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1683 static void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1684 frame_highlight (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1685 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1686 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1687 x_display_cursor (f, 1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1688 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1689
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1690 static void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1691 frame_unhighlight (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1692 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1693 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1694 x_display_cursor (f, 1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1695 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1696
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1697 static void x_frame_rehighlight ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1698
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1699 /* The focus has changed. Update the frames as necessary to reflect
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1700 the new situation. Note that we can't change the selected frame
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1701 here, because the Lisp code we are interrupting might become confused.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1702 Each event gets marked with the frame in which it occurred, so the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1703 Lisp code can tell when the switch took place by examining the events. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1704
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1705 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1706 x_new_focus_frame (dpyinfo, frame)
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
1707 struct w32_display_info *dpyinfo;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1708 struct frame *frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1709 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
1710 struct frame *old_focus = dpyinfo->w32_focus_frame;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1711 int events_enqueued = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1712
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
1713 if (frame != dpyinfo->w32_focus_frame)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1714 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1715 /* Set this before calling other routines, so that they see
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
1716 the correct value of w32_focus_frame. */
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
1717 dpyinfo->w32_focus_frame = frame;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1718
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1719 if (old_focus && old_focus->auto_lower)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1720 x_lower_frame (old_focus);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1721
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
1722 if (dpyinfo->w32_focus_frame && dpyinfo->w32_focus_frame->auto_raise)
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
1723 pending_autoraise_frame = dpyinfo->w32_focus_frame;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1724 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1725 pending_autoraise_frame = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1726 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1727
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1728 x_frame_rehighlight (dpyinfo);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1729 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1730
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1731 /* Handle an event saying the mouse has moved out of an Emacs frame. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1732
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1733 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1734 x_mouse_leave (dpyinfo)
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
1735 struct w32_display_info *dpyinfo;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1736 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
1737 x_new_focus_frame (dpyinfo, dpyinfo->w32_focus_event_frame);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1738 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1739
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1740 /* The focus has changed, or we have redirected a frame's focus to
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1741 another frame (this happens when a frame uses a surrogate
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1742 minibuffer frame). Shift the highlight as appropriate.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1743
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1744 The FRAME argument doesn't necessarily have anything to do with which
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1745 frame is being highlighted or unhighlighted; we only use it to find
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1746 the appropriate display info. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1747 static void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
1748 w32_frame_rehighlight (frame)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1749 struct frame *frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1750 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
1751 x_frame_rehighlight (FRAME_W32_DISPLAY_INFO (frame));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1752 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1753
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1754 static void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1755 x_frame_rehighlight (dpyinfo)
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
1756 struct w32_display_info *dpyinfo;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1757 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
1758 struct frame *old_highlight = dpyinfo->w32_highlight_frame;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
1759
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
1760 if (dpyinfo->w32_focus_frame)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1761 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
1762 dpyinfo->w32_highlight_frame
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
1763 = ((GC_FRAMEP (FRAME_FOCUS_FRAME (dpyinfo->w32_focus_frame)))
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
1764 ? XFRAME (FRAME_FOCUS_FRAME (dpyinfo->w32_focus_frame))
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
1765 : dpyinfo->w32_focus_frame);
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
1766 if (! FRAME_LIVE_P (dpyinfo->w32_highlight_frame))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1767 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
1768 FRAME_FOCUS_FRAME (dpyinfo->w32_focus_frame) = Qnil;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
1769 dpyinfo->w32_highlight_frame = dpyinfo->w32_focus_frame;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1770 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1771 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1772 else
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
1773 dpyinfo->w32_highlight_frame = 0;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
1774
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
1775 if (dpyinfo->w32_highlight_frame != old_highlight)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1776 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1777 if (old_highlight)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1778 frame_unhighlight (old_highlight);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
1779 if (dpyinfo->w32_highlight_frame)
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
1780 frame_highlight (dpyinfo->w32_highlight_frame);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1781 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1782 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1783
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1784 /* Keyboard processing - modifier keys, etc. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1785
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1786 /* Convert a keysym to its name. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1787
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1788 char *
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1789 x_get_keysym_name (keysym)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1790 int keysym;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1791 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1792 /* Make static so we can always return it */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1793 static char value[100];
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1794
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1795 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1796 GetKeyNameText(keysym, value, 100);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1797 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1798
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1799 return value;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1800 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1801
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1802 /* Mouse clicks and mouse movement. Rah. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1803
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1804 /* Given a pixel position (PIX_X, PIX_Y) on the frame F, return
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1805 glyph co-ordinates in (*X, *Y). Set *BOUNDS to the rectangle
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1806 that the glyph at X, Y occupies, if BOUNDS != 0.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1807 If NOCLIP is nonzero, do not force the value into range. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1808
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1809 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1810 pixel_to_glyph_coords (f, pix_x, pix_y, x, y, bounds, noclip)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1811 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1812 register int pix_x, pix_y;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1813 register int *x, *y;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1814 RECT *bounds;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1815 int noclip;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1816 {
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
1817 /* Support tty mode: if Vwindow_system is nil, behave correctly. */
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
1818 if (NILP (Vwindow_system))
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
1819 {
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
1820 *x = pix_x;
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
1821 *y = pix_y;
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
1822 return;
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
1823 }
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
1824
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1825 /* Arrange for the division in PIXEL_TO_CHAR_COL etc. to round down
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1826 even for negative values. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1827 if (pix_x < 0)
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
1828 pix_x -= FONT_WIDTH ((f)->output_data.w32->font) - 1;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1829 if (pix_y < 0)
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
1830 pix_y -= (f)->output_data.w32->line_height - 1;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1831
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1832 pix_x = PIXEL_TO_CHAR_COL (f, pix_x);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1833 pix_y = PIXEL_TO_CHAR_ROW (f, pix_y);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1834
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1835 if (bounds)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1836 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1837 bounds->left = CHAR_TO_PIXEL_COL (f, pix_x);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1838 bounds->top = CHAR_TO_PIXEL_ROW (f, pix_y);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
1839 bounds->right = bounds->left + FONT_WIDTH (f->output_data.w32->font) - 1;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
1840 bounds->bottom = bounds->top + f->output_data.w32->line_height - 1;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1841 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1842
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1843 if (!noclip)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1844 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1845 if (pix_x < 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1846 pix_x = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1847 else if (pix_x > f->width)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1848 pix_x = f->width;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1849
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1850 if (pix_y < 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1851 pix_y = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1852 else if (pix_y > f->height)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1853 pix_y = f->height;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1854 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1855
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1856 *x = pix_x;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1857 *y = pix_y;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1858 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1859
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1860 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1861 glyph_to_pixel_coords (f, x, y, pix_x, pix_y)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1862 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1863 register int x, y;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1864 register int *pix_x, *pix_y;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1865 {
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
1866 /* Support tty mode: if Vwindow_system is nil, behave correctly. */
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
1867 if (NILP (Vwindow_system))
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
1868 {
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
1869 *pix_x = x;
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
1870 *pix_y = y;
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
1871 return;
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
1872 }
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
1873
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1874 *pix_x = CHAR_TO_PIXEL_COL (f, x);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1875 *pix_y = CHAR_TO_PIXEL_ROW (f, y);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1876 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1877
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1878 BOOL
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1879 parse_button (message, pbutton, pup)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1880 int message;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1881 int * pbutton;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1882 int * pup;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1883 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1884 int button = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1885 int up = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1886
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1887 switch (message)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1888 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1889 case WM_LBUTTONDOWN:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1890 button = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1891 up = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1892 break;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1893 case WM_LBUTTONUP:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1894 button = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1895 up = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1896 break;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1897 case WM_MBUTTONDOWN:
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
1898 if (NILP (Vw32_swap_mouse_buttons))
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
1899 button = 1;
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
1900 else
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
1901 button = 2;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1902 up = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1903 break;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1904 case WM_MBUTTONUP:
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
1905 if (NILP (Vw32_swap_mouse_buttons))
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
1906 button = 1;
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
1907 else
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
1908 button = 2;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1909 up = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1910 break;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1911 case WM_RBUTTONDOWN:
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
1912 if (NILP (Vw32_swap_mouse_buttons))
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
1913 button = 2;
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
1914 else
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
1915 button = 1;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1916 up = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1917 break;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1918 case WM_RBUTTONUP:
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
1919 if (NILP (Vw32_swap_mouse_buttons))
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
1920 button = 2;
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
1921 else
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
1922 button = 1;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1923 up = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1924 break;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1925 default:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1926 return (FALSE);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1927 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1928
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1929 if (pup) *pup = up;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1930 if (pbutton) *pbutton = button;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1931
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1932 return (TRUE);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1933 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1934
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1935
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1936 /* Prepare a mouse-event in *RESULT for placement in the input queue.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1937
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1938 If the event is a button press, then note that we have grabbed
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1939 the mouse. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1940
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1941 static void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1942 construct_mouse_click (result, msg, f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1943 struct input_event *result;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
1944 W32Msg *msg;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1945 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1946 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1947 int button;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1948 int up;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1949
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1950 parse_button (msg->msg.message, &button, &up);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1951
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1952 /* Make the event type no_event; we'll change that when we decide
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1953 otherwise. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1954 result->kind = mouse_click;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1955 result->code = button;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1956 result->timestamp = msg->msg.time;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1957 result->modifiers = (msg->dwModifiers
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1958 | (up
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1959 ? up_modifier
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1960 : down_modifier));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1961
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1962 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1963 int row, column;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1964
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1965 XSETINT (result->x, LOWORD (msg->msg.lParam));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1966 XSETINT (result->y, HIWORD (msg->msg.lParam));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1967 XSETFRAME (result->frame_or_window, f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1968 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1969 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1970
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
1971 static void
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
1972 construct_mouse_wheel (result, msg, f)
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
1973 struct input_event *result;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
1974 W32Msg *msg;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
1975 struct frame *f;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
1976 {
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
1977 POINT p;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
1978 result->kind = mouse_wheel;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
1979 result->code = (short) HIWORD (msg->msg.wParam);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
1980 result->timestamp = msg->msg.time;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
1981 result->modifiers = msg->dwModifiers;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
1982 p.x = LOWORD (msg->msg.lParam);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
1983 p.y = HIWORD (msg->msg.lParam);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
1984 ScreenToClient(msg->msg.hwnd, &p);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
1985 XSETINT (result->x, p.x);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
1986 XSETINT (result->y, p.y);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
1987 XSETFRAME (result->frame_or_window, f);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
1988 }
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
1989
21885
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
1990 static void
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
1991 construct_drag_n_drop (result, msg, f)
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
1992 struct input_event *result;
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
1993 W32Msg *msg;
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
1994 struct frame *f;
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
1995 {
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
1996 Lisp_Object files;
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
1997 Lisp_Object frame;
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
1998 HDROP hdrop;
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
1999 POINT p;
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
2000 WORD num_files;
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
2001 char *name;
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
2002 int i, len;
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
2003
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
2004 result->kind = drag_n_drop;
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
2005 result->code = 0;
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
2006 result->timestamp = msg->msg.time;
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
2007 result->modifiers = msg->dwModifiers;
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
2008
24265
c5f1a1deffbb (construct_drag_n_drop): Call DraqQueryPoint before
Andrew Innes <andrewi@gnu.org>
parents: 24146
diff changeset
2009 hdrop = (HDROP) msg->msg.wParam;
c5f1a1deffbb (construct_drag_n_drop): Call DraqQueryPoint before
Andrew Innes <andrewi@gnu.org>
parents: 24146
diff changeset
2010 DragQueryPoint (hdrop, &p);
c5f1a1deffbb (construct_drag_n_drop): Call DraqQueryPoint before
Andrew Innes <andrewi@gnu.org>
parents: 24146
diff changeset
2011
24674
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
2012 #if 0
21885
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
2013 p.x = LOWORD (msg->msg.lParam);
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
2014 p.y = HIWORD (msg->msg.lParam);
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
2015 ScreenToClient (msg->msg.hwnd, &p);
24674
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
2016 #endif
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
2017
21885
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
2018 XSETINT (result->x, p.x);
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
2019 XSETINT (result->y, p.y);
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
2020
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
2021 num_files = DragQueryFile (hdrop, 0xFFFFFFFF, NULL, 0);
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
2022 files = Qnil;
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
2023
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
2024 for (i = 0; i < num_files; i++)
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
2025 {
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
2026 len = DragQueryFile (hdrop, i, NULL, 0);
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
2027 if (len <= 0)
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
2028 continue;
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
2029 name = alloca (len + 1);
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
2030 DragQueryFile (hdrop, i, name, len + 1);
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
2031 files = Fcons (build_string (name), files);
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
2032 }
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
2033
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
2034 DragFinish (hdrop);
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
2035
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
2036 XSETFRAME (frame, f);
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
2037 result->frame_or_window = Fcons (frame, files);
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
2038 }
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
2039
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2040
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2041 /* Function to report a mouse movement to the mainstream Emacs code.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2042 The input handler calls this.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2043
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2044 We have received a mouse movement event, which is given in *event.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2045 If the mouse is over a different glyph than it was last time, tell
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2046 the mainstream emacs code by setting mouse_moved. If not, ask for
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2047 another motion event, so we can check again the next time it moves. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2048
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2049 static void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2050 note_mouse_movement (frame, msg)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2051 FRAME_PTR frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2052 MSG *msg;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2053 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2054 last_mouse_movement_time = msg->time;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2055
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2056 if (msg->hwnd != FRAME_W32_WINDOW (frame))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2057 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2058 frame->mouse_moved = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2059 last_mouse_scroll_bar = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2060
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2061 note_mouse_highlight (frame, -1, -1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2062 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2063
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2064 /* Has the mouse moved off the glyph it was on at the last sighting? */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2065 else if (LOWORD (msg->lParam) < last_mouse_glyph.left
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2066 || LOWORD (msg->lParam) > last_mouse_glyph.right
15229
a270351f6e0c (note_mouse_movement): Upwards mouse movement recognition corrected.
Richard M. Stallman <rms@gnu.org>
parents: 15216
diff changeset
2067 || HIWORD (msg->lParam) < last_mouse_glyph.top
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2068 || HIWORD (msg->lParam) > last_mouse_glyph.bottom)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2069 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2070 frame->mouse_moved = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2071 last_mouse_scroll_bar = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2072
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2073 note_mouse_highlight (frame, LOWORD (msg->lParam), HIWORD (msg->lParam));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2074 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2075 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2076
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2077 /* This is used for debugging, to turn off note_mouse_highlight. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2078 static int disable_mouse_highlight;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2079
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2080 /* Take proper action when the mouse has moved to position X, Y on frame F
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2081 as regards highlighting characters that have mouse-face properties.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2082 Also dehighlighting chars where the mouse was before.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2083 X and Y can be negative or out of range. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2084
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2085 static void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2086 note_mouse_highlight (f, x, y)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2087 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2088 int x, y;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2089 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2090 int row, column, portion;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2091 RECT new_glyph;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2092 Lisp_Object window;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2093 struct window *w;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2094
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2095 if (disable_mouse_highlight)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2096 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2097
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2098 FRAME_W32_DISPLAY_INFO (f)->mouse_face_mouse_x = x;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2099 FRAME_W32_DISPLAY_INFO (f)->mouse_face_mouse_y = y;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2100 FRAME_W32_DISPLAY_INFO (f)->mouse_face_mouse_frame = f;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2101
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2102 if (FRAME_W32_DISPLAY_INFO (f)->mouse_face_defer)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2103 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2104
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2105 if (gc_in_progress)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2106 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2107 FRAME_W32_DISPLAY_INFO (f)->mouse_face_deferred_gc = 1;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2108 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2109 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2110
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2111 /* Find out which glyph the mouse is on. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2112 pixel_to_glyph_coords (f, x, y, &column, &row,
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2113 &new_glyph, FRAME_W32_DISPLAY_INFO (f)->grabbed);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2114
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2115 /* Which window is that in? */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2116 window = window_from_coordinates (f, column, row, &portion);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2117 w = XWINDOW (window);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2118
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2119 /* If we were displaying active text in another window, clear that. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2120 if (! EQ (window, FRAME_W32_DISPLAY_INFO (f)->mouse_face_window))
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2121 clear_mouse_face (FRAME_W32_DISPLAY_INFO (f));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2122
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2123 /* Are we in a window whose display is up to date?
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2124 And verify the buffer's text has not changed. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2125 if (WINDOWP (window) && portion == 0 && row >= 0 && column >= 0
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2126 && row < FRAME_HEIGHT (f) && column < FRAME_WIDTH (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2127 && EQ (w->window_end_valid, w->buffer)
16209
40552cb9a45d (note_mouse_highlight): Test last_overlay_modified field.
Richard M. Stallman <rms@gnu.org>
parents: 15742
diff changeset
2128 && w->last_modified == BUF_MODIFF (XBUFFER (w->buffer))
40552cb9a45d (note_mouse_highlight): Test last_overlay_modified field.
Richard M. Stallman <rms@gnu.org>
parents: 15742
diff changeset
2129 && w->last_overlay_modified == BUF_OVERLAY_MODIFF (XBUFFER (w->buffer)))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2130 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2131 int *ptr = FRAME_CURRENT_GLYPHS (f)->charstarts[row];
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2132 int i, pos;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2133
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2134 /* Find which buffer position the mouse corresponds to. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2135 for (i = column; i >= 0; i--)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2136 if (ptr[i] > 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2137 break;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2138 pos = ptr[i];
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2139 /* Is it outside the displayed active region (if any)? */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2140 if (pos <= 0)
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2141 clear_mouse_face (FRAME_W32_DISPLAY_INFO (f));
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2142 else if (! (EQ (window, FRAME_W32_DISPLAY_INFO (f)->mouse_face_window)
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2143 && row >= FRAME_W32_DISPLAY_INFO (f)->mouse_face_beg_row
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2144 && row <= FRAME_W32_DISPLAY_INFO (f)->mouse_face_end_row
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2145 && (row > FRAME_W32_DISPLAY_INFO (f)->mouse_face_beg_row
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2146 || column >= FRAME_W32_DISPLAY_INFO (f)->mouse_face_beg_col)
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2147 && (row < FRAME_W32_DISPLAY_INFO (f)->mouse_face_end_row
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2148 || column < FRAME_W32_DISPLAY_INFO (f)->mouse_face_end_col
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2149 || FRAME_W32_DISPLAY_INFO (f)->mouse_face_past_end)))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2150 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2151 Lisp_Object mouse_face, overlay, position;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2152 Lisp_Object *overlay_vec;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2153 int len, noverlays, ignor1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2154 struct buffer *obuf;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2155 int obegv, ozv;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2156
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2157 /* If we get an out-of-range value, return now; avoid an error. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2158 if (pos > BUF_Z (XBUFFER (w->buffer)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2159 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2160
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2161 /* Make the window's buffer temporarily current for
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2162 overlays_at and compute_char_face. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2163 obuf = current_buffer;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2164 current_buffer = XBUFFER (w->buffer);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2165 obegv = BEGV;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2166 ozv = ZV;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2167 BEGV = BEG;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2168 ZV = Z;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2169
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2170 /* Yes. Clear the display of the old active region, if any. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2171 clear_mouse_face (FRAME_W32_DISPLAY_INFO (f));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2172
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2173 /* Is this char mouse-active? */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2174 XSETINT (position, pos);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2175
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2176 len = 10;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2177 overlay_vec = (Lisp_Object *) xmalloc (len * sizeof (Lisp_Object));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2178
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2179 /* Put all the overlays we want in a vector in overlay_vec.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2180 Store the length in len. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2181 noverlays = overlays_at (XINT (pos), 1, &overlay_vec, &len,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2182 NULL, NULL);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2183 noverlays = sort_overlays (overlay_vec, noverlays, w);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2184
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2185 /* Find the highest priority overlay that has a mouse-face prop. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2186 overlay = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2187 for (i = 0; i < noverlays; i++)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2188 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2189 mouse_face = Foverlay_get (overlay_vec[i], Qmouse_face);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2190 if (!NILP (mouse_face))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2191 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2192 overlay = overlay_vec[i];
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2193 break;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2194 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2195 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2196 free (overlay_vec);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2197 /* If no overlay applies, get a text property. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2198 if (NILP (overlay))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2199 mouse_face = Fget_text_property (position, Qmouse_face, w->buffer);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2200
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2201 /* Handle the overlay case. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2202 if (! NILP (overlay))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2203 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2204 /* Find the range of text around this char that
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2205 should be active. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2206 Lisp_Object before, after;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2207 int ignore;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2208
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2209 before = Foverlay_start (overlay);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2210 after = Foverlay_end (overlay);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2211 /* Record this as the current active region. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2212 fast_find_position (window, before,
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2213 &FRAME_W32_DISPLAY_INFO (f)->mouse_face_beg_col,
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2214 &FRAME_W32_DISPLAY_INFO (f)->mouse_face_beg_row);
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2215 FRAME_W32_DISPLAY_INFO (f)->mouse_face_past_end
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2216 = !fast_find_position (window, after,
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2217 &FRAME_W32_DISPLAY_INFO (f)->mouse_face_end_col,
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2218 &FRAME_W32_DISPLAY_INFO (f)->mouse_face_end_row);
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2219 FRAME_W32_DISPLAY_INFO (f)->mouse_face_window = window;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2220 FRAME_W32_DISPLAY_INFO (f)->mouse_face_face_id
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2221 = compute_char_face (f, w, pos, 0, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2222 &ignore, pos + 1, 1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2223
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2224 /* Display it as active. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2225 show_mouse_face (FRAME_W32_DISPLAY_INFO (f), 1);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2226 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2227 /* Handle the text property case. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2228 else if (! NILP (mouse_face))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2229 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2230 /* Find the range of text around this char that
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2231 should be active. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2232 Lisp_Object before, after, beginning, end;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2233 int ignore;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2234
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2235 beginning = Fmarker_position (w->start);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2236 XSETINT (end, (BUF_Z (XBUFFER (w->buffer))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2237 - XFASTINT (w->window_end_pos)));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2238 before
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2239 = Fprevious_single_property_change (make_number (pos + 1),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2240 Qmouse_face,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2241 w->buffer, beginning);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2242 after
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2243 = Fnext_single_property_change (position, Qmouse_face,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2244 w->buffer, end);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2245 /* Record this as the current active region. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2246 fast_find_position (window, before,
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2247 &FRAME_W32_DISPLAY_INFO (f)->mouse_face_beg_col,
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2248 &FRAME_W32_DISPLAY_INFO (f)->mouse_face_beg_row);
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2249 FRAME_W32_DISPLAY_INFO (f)->mouse_face_past_end
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2250 = !fast_find_position (window, after,
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2251 &FRAME_W32_DISPLAY_INFO (f)->mouse_face_end_col,
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2252 &FRAME_W32_DISPLAY_INFO (f)->mouse_face_end_row);
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2253 FRAME_W32_DISPLAY_INFO (f)->mouse_face_window = window;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2254 FRAME_W32_DISPLAY_INFO (f)->mouse_face_face_id
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2255 = compute_char_face (f, w, pos, 0, 0,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2256 &ignore, pos + 1, 1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2257
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2258 /* Display it as active. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2259 show_mouse_face (FRAME_W32_DISPLAY_INFO (f), 1);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2260 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2261 BEGV = obegv;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2262 ZV = ozv;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2263 current_buffer = obuf;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2264 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2265 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2266 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2267
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2268 /* Find the row and column of position POS in window WINDOW.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2269 Store them in *COLUMNP and *ROWP.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2270 This assumes display in WINDOW is up to date.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2271 If POS is above start of WINDOW, return coords
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2272 of start of first screen line.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2273 If POS is after end of WINDOW, return coords of end of last screen line.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2274
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2275 Value is 1 if POS is in range, 0 if it was off screen. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2276
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2277 static int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2278 fast_find_position (window, pos, columnp, rowp)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2279 Lisp_Object window;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2280 int pos;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2281 int *columnp, *rowp;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2282 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2283 struct window *w = XWINDOW (window);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2284 FRAME_PTR f = XFRAME (WINDOW_FRAME (w));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2285 int i;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2286 int row = 0;
16258
008dd73a2005 (fast_find_position, show_macro_face): Use new WINDOW_LEFT_MARGIN macro.
Richard M. Stallman <rms@gnu.org>
parents: 16209
diff changeset
2287 int left = WINDOW_LEFT_MARGIN (w);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2288 int top = w->top;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2289 int height = XFASTINT (w->height) - ! MINI_WINDOW_P (w);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2290 int width = window_internal_width (w);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2291 int *charstarts;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2292 int lastcol;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2293 int maybe_next_line = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2294
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2295 /* Find the right row. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2296 for (i = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2297 i < height;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2298 i++)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2299 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2300 int linestart = FRAME_CURRENT_GLYPHS (f)->charstarts[top + i][left];
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2301 if (linestart > pos)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2302 break;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2303 /* If the position sought is the end of the buffer,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2304 don't include the blank lines at the bottom of the window. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2305 if (linestart == pos && pos == BUF_ZV (XBUFFER (w->buffer)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2306 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2307 maybe_next_line = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2308 break;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2309 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2310 if (linestart > 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2311 row = i;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2312 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2313
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2314 /* Find the right column with in it. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2315 charstarts = FRAME_CURRENT_GLYPHS (f)->charstarts[top + row];
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2316 lastcol = left;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2317 for (i = 0; i < width; i++)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2318 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2319 if (charstarts[left + i] == pos)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2320 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2321 *rowp = row + top;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2322 *columnp = i + left;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2323 return 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2324 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2325 else if (charstarts[left + i] > pos)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2326 break;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2327 else if (charstarts[left + i] > 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2328 lastcol = left + i;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2329 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2330
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2331 /* If we're looking for the end of the buffer,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2332 and we didn't find it in the line we scanned,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2333 use the start of the following line. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2334 if (maybe_next_line)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2335 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2336 row++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2337 i = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2338 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2339
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2340 *rowp = row + top;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2341 *columnp = lastcol;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2342 return 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2343 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2344
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2345 /* Display the active region described by mouse_face_*
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2346 in its mouse-face if HL > 0, in its normal face if HL = 0. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2347
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2348 static void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2349 show_mouse_face (dpyinfo, hl)
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2350 struct w32_display_info *dpyinfo;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2351 int hl;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2352 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2353 struct window *w = XWINDOW (dpyinfo->mouse_face_window);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2354 int width = window_internal_width (w);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2355 FRAME_PTR f = XFRAME (WINDOW_FRAME (w));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2356 int i;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2357 int cursor_off = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2358 int old_curs_x = curs_x;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2359 int old_curs_y = curs_y;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2360
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2361 /* Set these variables temporarily
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2362 so that if we have to turn the cursor off and on again
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2363 we will put it back at the same place. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2364 curs_x = f->phys_cursor_x;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2365 curs_y = f->phys_cursor_y;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2366
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2367 for (i = FRAME_W32_DISPLAY_INFO (f)->mouse_face_beg_row;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2368 i <= FRAME_W32_DISPLAY_INFO (f)->mouse_face_end_row; i++)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2369 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2370 int column = (i == FRAME_W32_DISPLAY_INFO (f)->mouse_face_beg_row
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2371 ? FRAME_W32_DISPLAY_INFO (f)->mouse_face_beg_col
16258
008dd73a2005 (fast_find_position, show_macro_face): Use new WINDOW_LEFT_MARGIN macro.
Richard M. Stallman <rms@gnu.org>
parents: 16209
diff changeset
2372 : WINDOW_LEFT_MARGIN (w));
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2373 int endcolumn = (i == FRAME_W32_DISPLAY_INFO (f)->mouse_face_end_row
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2374 ? FRAME_W32_DISPLAY_INFO (f)->mouse_face_end_col
16258
008dd73a2005 (fast_find_position, show_macro_face): Use new WINDOW_LEFT_MARGIN macro.
Richard M. Stallman <rms@gnu.org>
parents: 16209
diff changeset
2375 : WINDOW_LEFT_MARGIN (w) + width);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2376 endcolumn = min (endcolumn, FRAME_CURRENT_GLYPHS (f)->used[i]);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2377
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2378 /* If the cursor's in the text we are about to rewrite,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2379 turn the cursor off. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2380 if (i == curs_y
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2381 && curs_x >= column - 1
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2382 && curs_x <= endcolumn)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2383 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2384 x_display_cursor (f, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2385 cursor_off = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2386 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2387
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2388 dumpglyphs (f,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2389 CHAR_TO_PIXEL_COL (f, column),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2390 CHAR_TO_PIXEL_ROW (f, i),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2391 FRAME_CURRENT_GLYPHS (f)->glyphs[i] + column,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2392 endcolumn - column,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2393 /* Highlight with mouse face if hl > 0. */
21614
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2394 hl > 0 ? 3 : 0, 0, NULL);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2395 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2396
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2397 /* If we turned the cursor off, turn it back on. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2398 if (cursor_off)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2399 x_display_cursor (f, 1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2400
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2401 curs_x = old_curs_x;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2402 curs_y = old_curs_y;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2403
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2404 /* Change the mouse cursor according to the value of HL. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2405 if (hl > 0)
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2406 SetCursor (f->output_data.w32->cross_cursor);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2407 else
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2408 SetCursor (f->output_data.w32->text_cursor);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2409 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2410
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2411 /* Clear out the mouse-highlighted active region.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2412 Redraw it unhighlighted first. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2413
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2414 static void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2415 clear_mouse_face (dpyinfo)
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2416 struct w32_display_info *dpyinfo;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2417 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2418 if (! NILP (dpyinfo->mouse_face_window))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2419 show_mouse_face (dpyinfo, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2420
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2421 dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2422 dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2423 dpyinfo->mouse_face_window = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2424 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2425
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2426 struct scroll_bar *x_window_to_scroll_bar ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2427 static void x_scroll_bar_report_motion ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2428
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2429 /* Return the current position of the mouse.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2430 *fp should be a frame which indicates which display to ask about.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2431
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2432 If the mouse movement started in a scroll bar, set *fp, *bar_window,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2433 and *part to the frame, window, and scroll bar part that the mouse
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2434 is over. Set *x and *y to the portion and whole of the mouse's
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2435 position on the scroll bar.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2436
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2437 If the mouse movement started elsewhere, set *fp to the frame the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2438 mouse is on, *bar_window to nil, and *x and *y to the character cell
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2439 the mouse is over.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2440
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2441 Set *time to the server timestamp for the time at which the mouse
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2442 was at this position.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2443
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2444 Don't store anything if we don't have a valid set of values to report.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2445
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2446 This clears the mouse_moved flag, so we can wait for the next mouse
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2447 movement. This also calls XQueryPointer, which will cause the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2448 server to give us another MotionNotify when the mouse moves
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2449 again. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2450
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2451 static void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2452 w32_mouse_position (fp, insist, bar_window, part, x, y, time)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2453 FRAME_PTR *fp;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2454 int insist;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2455 Lisp_Object *bar_window;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2456 enum scroll_bar_part *part;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2457 Lisp_Object *x, *y;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2458 unsigned long *time;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2459 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2460 FRAME_PTR f1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2461
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2462 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2463
20179
b4fe0e8ac819 (w32_mouse_position): Handle INSIST < 0.
Karl Heuer <kwzh@gnu.org>
parents: 19713
diff changeset
2464 if (! NILP (last_mouse_scroll_bar) && insist == 0)
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2465 /* This is never called at the moment. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2466 x_scroll_bar_report_motion (fp, bar_window, part, x, y, time);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2467 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2468 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2469 POINT pt;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2470
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2471 Lisp_Object frame, tail;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2472
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2473 /* Clear the mouse-moved flag for every frame on this display. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2474 FOR_EACH_FRAME (tail, frame)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2475 XFRAME (frame)->mouse_moved = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2476
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2477 last_mouse_scroll_bar = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2478
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2479 GetCursorPos (&pt);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2480
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2481 /* Now we have a position on the root; find the innermost window
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2482 containing the pointer. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2483 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2484 if (FRAME_W32_DISPLAY_INFO (*fp)->grabbed && last_mouse_frame
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2485 && FRAME_LIVE_P (last_mouse_frame))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2486 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2487 f1 = last_mouse_frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2488 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2489 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2490 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2491 /* Is win one of our frames? */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2492 f1 = x_window_to_frame (FRAME_W32_DISPLAY_INFO (*fp), WindowFromPoint(pt));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2493 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2494
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2495 /* If not, is it one of our scroll bars? */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2496 if (! f1)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2497 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2498 struct scroll_bar *bar = x_window_to_scroll_bar (WindowFromPoint(pt));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2499
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2500 if (bar)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2501 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2502 f1 = XFRAME (WINDOW_FRAME (XWINDOW (bar->window)));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2503 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2504 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2505
20179
b4fe0e8ac819 (w32_mouse_position): Handle INSIST < 0.
Karl Heuer <kwzh@gnu.org>
parents: 19713
diff changeset
2506 if (f1 == 0 && insist > 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2507 f1 = selected_frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2508
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2509 if (f1)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2510 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2511 int ignore1, ignore2;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2512
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2513 ScreenToClient (FRAME_W32_WINDOW (f1), &pt);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2514
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2515 /* Ok, we found a frame. Store all the values. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2516
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2517 pixel_to_glyph_coords (f1, pt.x, pt.y, &ignore1, &ignore2,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2518 &last_mouse_glyph,
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2519 FRAME_W32_DISPLAY_INFO (f1)->grabbed
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2520 || insist);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2521
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2522 *bar_window = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2523 *part = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2524 *fp = f1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2525 XSETINT (*x, pt.x);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2526 XSETINT (*y, pt.y);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2527 *time = last_mouse_movement_time;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2528 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2529 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2530 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2531
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2532 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2533 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2534
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2535 /* Scroll bar support. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2536
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2537 /* Given an window ID, find the struct scroll_bar which manages it.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2538 This can be called in GC, so we have to make sure to strip off mark
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2539 bits. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2540 struct scroll_bar *
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2541 x_window_to_scroll_bar (window_id)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2542 Window window_id;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2543 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2544 Lisp_Object tail, frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2545
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2546 for (tail = Vframe_list;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2547 XGCTYPE (tail) == Lisp_Cons;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2548 tail = XCONS (tail)->cdr)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2549 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2550 Lisp_Object frame, bar, condemned;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2551
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2552 frame = XCONS (tail)->car;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2553 /* All elements of Vframe_list should be frames. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2554 if (! GC_FRAMEP (frame))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2555 abort ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2556
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2557 /* Scan this frame's scroll bar list for a scroll bar with the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2558 right window ID. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2559 condemned = FRAME_CONDEMNED_SCROLL_BARS (XFRAME (frame));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2560 for (bar = FRAME_SCROLL_BARS (XFRAME (frame));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2561 /* This trick allows us to search both the ordinary and
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2562 condemned scroll bar lists with one loop. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2563 ! GC_NILP (bar) || (bar = condemned,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2564 condemned = Qnil,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2565 ! GC_NILP (bar));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2566 bar = XSCROLL_BAR (bar)->next)
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2567 if (SCROLL_BAR_W32_WINDOW (XSCROLL_BAR (bar)) == window_id)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2568 return XSCROLL_BAR (bar);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2569 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2570
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2571 return 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2572 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2573
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2574 HWND
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2575 my_create_scrollbar (f, bar)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2576 struct frame * f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2577 struct scroll_bar * bar;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2578 {
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2579 return (HWND) SendMessage (FRAME_W32_WINDOW (f),
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2580 WM_EMACS_CREATESCROLLBAR, (WPARAM) f,
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2581 (LPARAM) bar);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2582 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2583
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
2584 //#define ATTACH_THREADS
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
2585
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2586 BOOL
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2587 my_show_window (FRAME_PTR f, HWND hwnd, int how)
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
2588 {
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
2589 #ifndef ATTACH_THREADS
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2590 return SendMessage (FRAME_W32_WINDOW (f), WM_EMACS_SHOWWINDOW,
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2591 (WPARAM) hwnd, (LPARAM) how);
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
2592 #else
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2593 return ShowWindow (hwnd, how);
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
2594 #endif
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
2595 }
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
2596
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
2597 void
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
2598 my_set_window_pos (HWND hwnd, HWND hwndAfter,
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2599 int x, int y, int cx, int cy, UINT flags)
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
2600 {
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
2601 #ifndef ATTACH_THREADS
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2602 WINDOWPOS pos;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2603 pos.hwndInsertAfter = hwndAfter;
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
2604 pos.x = x;
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
2605 pos.y = y;
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
2606 pos.cx = cx;
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
2607 pos.cy = cy;
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
2608 pos.flags = flags;
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
2609 SendMessage (hwnd, WM_EMACS_SETWINDOWPOS, (WPARAM) &pos, 0);
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
2610 #else
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
2611 SetWindowPos (hwnd, hwndAfter, x, y, cx, cy, flags);
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
2612 #endif
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
2613 }
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
2614
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2615 BOOL
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2616 my_set_focus (f, hwnd)
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2617 struct frame * f;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2618 HWND hwnd;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2619 {
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2620 SendMessage (FRAME_W32_WINDOW (f), WM_EMACS_SETFOCUS,
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2621 (WPARAM) hwnd, 0);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2622 }
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2623
21614
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2624 BOOL
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2625 my_set_foreground_window (hwnd)
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2626 HWND hwnd;
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2627 {
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2628 SendMessage (hwnd, WM_EMACS_SETFOREGROUND, (WPARAM) hwnd, 0);
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2629 }
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2630
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2631 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2632 my_destroy_window (f, hwnd)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2633 struct frame * f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2634 HWND hwnd;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2635 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2636 SendMessage (FRAME_W32_WINDOW (f), WM_EMACS_DESTROYWINDOW,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2637 (WPARAM) hwnd, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2638 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2639
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2640 /* Open a new window to serve as a scroll bar, and return the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2641 scroll bar vector for it. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2642 static struct scroll_bar *
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2643 x_scroll_bar_create (window, top, left, width, height)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2644 struct window *window;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2645 int top, left, width, height;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2646 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2647 FRAME_PTR f = XFRAME (WINDOW_FRAME (window));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2648 struct scroll_bar *bar
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2649 = XSCROLL_BAR (Fmake_vector (make_number (SCROLL_BAR_VEC_SIZE), Qnil));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2650 HWND hwnd;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2651
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2652 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2653
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2654 XSETWINDOW (bar->window, window);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2655 XSETINT (bar->top, top);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2656 XSETINT (bar->left, left);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2657 XSETINT (bar->width, width);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2658 XSETINT (bar->height, height);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2659 XSETINT (bar->start, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2660 XSETINT (bar->end, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2661 bar->dragging = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2662
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2663 /* Requires geometry to be set before call to create the real window */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2664
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2665 hwnd = my_create_scrollbar (f, bar);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2666
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2667 if (pfnSetScrollInfo)
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2668 {
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2669 SCROLLINFO si;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2670
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2671 si.cbSize = sizeof (si);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2672 si.fMask = SIF_ALL;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2673 si.nMin = 0;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2674 si.nMax = VERTICAL_SCROLL_BAR_TOP_RANGE (height)
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2675 + VERTICAL_SCROLL_BAR_MIN_HANDLE;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2676 si.nPage = si.nMax;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2677 si.nPos = 0;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2678
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2679 pfnSetScrollInfo (hwnd, SB_CTL, &si, FALSE);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2680 }
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2681 else
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2682 {
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2683 SetScrollRange (hwnd, SB_CTL, 0, VERTICAL_SCROLL_BAR_TOP_RANGE (height), FALSE);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2684 SetScrollPos (hwnd, SB_CTL, 0, FALSE);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2685 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2686
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2687 SET_SCROLL_BAR_W32_WINDOW (bar, hwnd);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2688
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2689 /* Add bar to its frame's list of scroll bars. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2690 bar->next = FRAME_SCROLL_BARS (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2691 bar->prev = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2692 XSETVECTOR (FRAME_SCROLL_BARS (f), bar);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2693 if (! NILP (bar->next))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2694 XSETVECTOR (XSCROLL_BAR (bar->next)->prev, bar);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2695
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2696 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2697
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2698 return bar;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2699 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2700
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2701 /* Draw BAR's handle in the proper position.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2702 If the handle is already drawn from START to END, don't bother
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2703 redrawing it, unless REBUILD is non-zero; in that case, always
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2704 redraw it. (REBUILD is handy for drawing the handle after expose
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2705 events.)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2706
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2707 Normally, we want to constrain the start and end of the handle to
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2708 fit inside its rectangle, but if the user is dragging the scroll bar
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2709 handle, we want to let them drag it down all the way, so that the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2710 bar's top is as far down as it goes; otherwise, there's no way to
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2711 move to the very end of the buffer. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2712 static void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2713 x_scroll_bar_set_handle (bar, start, end, rebuild)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2714 struct scroll_bar *bar;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2715 int start, end;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2716 int rebuild;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2717 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2718 int dragging = ! NILP (bar->dragging);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2719 Window w = SCROLL_BAR_W32_WINDOW (bar);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2720 FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window)));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2721
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2722 /* If the display is already accurate, do nothing. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2723 if (! rebuild
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2724 && start == XINT (bar->start)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2725 && end == XINT (bar->end))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2726 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2727
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2728 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2729
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2730 {
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2731 int top_range = VERTICAL_SCROLL_BAR_TOP_RANGE (XINT (bar->height));
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2732
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2733 /* Make sure the values are reasonable, and try to preserve
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2734 the distance between start and end. */
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2735 {
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2736 int length = end - start;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2737
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2738 if (start < 0)
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2739 start = 0;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2740 else if (start > top_range)
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2741 start = top_range;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2742 end = start + length;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2743
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2744 if (end < start)
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2745 end = start;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2746 else if (end > top_range && ! dragging)
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2747 end = top_range;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2748 }
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2749 }
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2750
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2751 /* Store the adjusted setting in the scroll bar. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2752 XSETINT (bar->start, start);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2753 XSETINT (bar->end, end);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2754
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2755 /* If being dragged, let scroll bar update itself. */
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2756 if (!dragging)
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2757 {
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2758 if (pfnSetScrollInfo)
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2759 {
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2760 SCROLLINFO si;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2761
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2762 si.cbSize = sizeof (si);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2763 si.fMask = SIF_PAGE | SIF_POS;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2764 si.nPage = end - start + VERTICAL_SCROLL_BAR_MIN_HANDLE;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2765 si.nPos = start;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2766
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2767 pfnSetScrollInfo (w, SB_CTL, &si, TRUE);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2768 }
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2769 else
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2770 SetScrollPos (w, SB_CTL, start, TRUE);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2771 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2772
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2773 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2774 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2775
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2776 /* Move a scroll bar around on the screen, to accommodate changing
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2777 window configurations. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2778 static void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2779 x_scroll_bar_move (bar, top, left, width, height)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2780 struct scroll_bar *bar;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2781 int top, left, width, height;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2782 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2783 Window w = SCROLL_BAR_W32_WINDOW (bar);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2784 FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window)));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2785
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2786 /* If already correctly positioned, do nothing. */
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2787 if ( XINT (bar->left) == left
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2788 && XINT (bar->top) == top
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2789 && XINT (bar->width) == width
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2790 && XINT (bar->height) == height )
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2791 {
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2792 /* Redraw after clear_frame. */
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2793 if (!my_show_window (f, w, SW_NORMAL))
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2794 InvalidateRect (w, NULL, FALSE);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2795 return;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2796 }
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2797
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2798 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2799
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2800 /* Make sure scroll bar is "visible" before moving, to ensure the
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2801 area of the parent window now exposed will be refreshed. */
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2802 my_show_window (f, w, SW_HIDE);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2803 MoveWindow (w, left, top, width, height, TRUE);
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2804 if (pfnSetScrollInfo)
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2805 {
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2806 SCROLLINFO si;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2807
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2808 si.cbSize = sizeof (si);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2809 si.fMask = SIF_RANGE;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2810 si.nMin = 0;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2811 si.nMax = VERTICAL_SCROLL_BAR_TOP_RANGE (height)
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2812 + VERTICAL_SCROLL_BAR_MIN_HANDLE;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2813
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2814 pfnSetScrollInfo (w, SB_CTL, &si, FALSE);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2815 }
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2816 else
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2817 SetScrollRange (w, SB_CTL, 0, VERTICAL_SCROLL_BAR_TOP_RANGE (height), FALSE);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2818 my_show_window (f, w, SW_NORMAL);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2819 // InvalidateRect (w, NULL, FALSE);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2820
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2821 XSETINT (bar->left, left);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2822 XSETINT (bar->top, top);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2823 XSETINT (bar->width, width);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2824 XSETINT (bar->height, height);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2825
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2826 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2827 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2828
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2829 /* Destroy the window for BAR, and set its Emacs window's scroll bar
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2830 to nil. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2831 static void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2832 x_scroll_bar_remove (bar)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2833 struct scroll_bar *bar;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2834 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2835 FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window)));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2836
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2837 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2838
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2839 /* Destroy the window. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2840 my_destroy_window (f, SCROLL_BAR_W32_WINDOW (bar));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2841
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2842 /* Disassociate this scroll bar from its window. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2843 XWINDOW (bar->window)->vertical_scroll_bar = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2844
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2845 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2846 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2847
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2848 /* Set the handle of the vertical scroll bar for WINDOW to indicate
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2849 that we are displaying PORTION characters out of a total of WHOLE
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2850 characters, starting at POSITION. If WINDOW has no scroll bar,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2851 create one. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2852 static void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2853 w32_set_vertical_scroll_bar (window, portion, whole, position)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2854 struct window *window;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2855 int portion, whole, position;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2856 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2857 FRAME_PTR f = XFRAME (WINDOW_FRAME (window));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2858 int top = XINT (window->top);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2859 int left = WINDOW_VERTICAL_SCROLL_BAR_COLUMN (window);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2860 int height = WINDOW_VERTICAL_SCROLL_BAR_HEIGHT (window);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2861
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2862 /* Where should this scroll bar be, pixelwise? */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2863 int pixel_top = CHAR_TO_PIXEL_ROW (f, top);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2864 int pixel_left = CHAR_TO_PIXEL_COL (f, left);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2865 int pixel_width
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2866 = (FRAME_SCROLL_BAR_PIXEL_WIDTH (f) > 0
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2867 ? FRAME_SCROLL_BAR_PIXEL_WIDTH (f)
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2868 : (FRAME_SCROLL_BAR_COLS (f) * FONT_WIDTH (f->output_data.w32->font)));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2869 int pixel_height = VERTICAL_SCROLL_BAR_PIXEL_HEIGHT (f, height);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2870
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2871 struct scroll_bar *bar;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2872
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2873 /* Does the scroll bar exist yet? */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2874 if (NILP (window->vertical_scroll_bar))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2875 bar = x_scroll_bar_create (window,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2876 pixel_top, pixel_left,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2877 pixel_width, pixel_height);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2878 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2879 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2880 /* It may just need to be moved and resized. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2881 bar = XSCROLL_BAR (window->vertical_scroll_bar);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2882 x_scroll_bar_move (bar, pixel_top, pixel_left, pixel_width, pixel_height);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2883 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2884
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2885 /* Set the scroll bar's current state. */
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2886 {
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2887 int top_range = VERTICAL_SCROLL_BAR_TOP_RANGE (pixel_height);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2888
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2889 if (whole == 0)
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2890 x_scroll_bar_set_handle (bar, 0, top_range, 0);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2891 else
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2892 {
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2893 int start = (int) (((double) position * top_range) / whole);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2894 int end = (int) (((double) (position + portion) * top_range) / whole);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2895
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2896 x_scroll_bar_set_handle (bar, start, end, 0);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2897 }
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
2898 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2899
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2900 XSETVECTOR (window->vertical_scroll_bar, bar);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2901 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2902
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2903
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2904 /* The following three hooks are used when we're doing a thorough
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2905 redisplay of the frame. We don't explicitly know which scroll bars
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2906 are going to be deleted, because keeping track of when windows go
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2907 away is a real pain - "Can you say set-window-configuration, boys
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2908 and girls?" Instead, we just assert at the beginning of redisplay
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2909 that *all* scroll bars are to be removed, and then save a scroll bar
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2910 from the fiery pit when we actually redisplay its window. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2911
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2912 /* Arrange for all scroll bars on FRAME to be removed at the next call
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2913 to `*judge_scroll_bars_hook'. A scroll bar may be spared if
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2914 `*redeem_scroll_bar_hook' is applied to its window before the judgement. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2915 static void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2916 w32_condemn_scroll_bars (frame)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2917 FRAME_PTR frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2918 {
21614
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2919 /* Transfer all the scroll bars to FRAME_CONDEMNED_SCROLL_BARS. */
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2920 while (! NILP (FRAME_SCROLL_BARS (frame)))
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2921 {
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2922 Lisp_Object bar;
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2923 bar = FRAME_SCROLL_BARS (frame);
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2924 FRAME_SCROLL_BARS (frame) = XSCROLL_BAR (bar)->next;
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2925 XSCROLL_BAR (bar)->next = FRAME_CONDEMNED_SCROLL_BARS (frame);
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2926 XSCROLL_BAR (bar)->prev = Qnil;
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2927 if (! NILP (FRAME_CONDEMNED_SCROLL_BARS (frame)))
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2928 XSCROLL_BAR (FRAME_CONDEMNED_SCROLL_BARS (frame))->prev = bar;
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2929 FRAME_CONDEMNED_SCROLL_BARS (frame) = bar;
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2930 }
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2931 #ifdef PIGSFLY
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2932 /* The condemned list should be empty at this point; if it's not,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2933 then the rest of Emacs isn't using the condemn/redeem/judge
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2934 protocol correctly. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2935 if (! NILP (FRAME_CONDEMNED_SCROLL_BARS (frame)))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2936 abort ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2937
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2938 /* Move them all to the "condemned" list. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2939 FRAME_CONDEMNED_SCROLL_BARS (frame) = FRAME_SCROLL_BARS (frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2940 FRAME_SCROLL_BARS (frame) = Qnil;
21614
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2941 #endif
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2942 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2943
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2944 /* Unmark WINDOW's scroll bar for deletion in this judgement cycle.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2945 Note that WINDOW isn't necessarily condemned at all. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2946 static void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
2947 w32_redeem_scroll_bar (window)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2948 struct window *window;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2949 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2950 struct scroll_bar *bar;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2951
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2952 /* We can't redeem this window's scroll bar if it doesn't have one. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2953 if (NILP (window->vertical_scroll_bar))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2954 abort ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2955
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2956 bar = XSCROLL_BAR (window->vertical_scroll_bar);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2957
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2958 /* Unlink it from the condemned list. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2959 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2960 FRAME_PTR f = XFRAME (WINDOW_FRAME (window));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2961
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2962 if (NILP (bar->prev))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2963 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2964 /* If the prev pointer is nil, it must be the first in one of
21614
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2965 the lists. */
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2966 if (EQ (FRAME_SCROLL_BARS (f), window->vertical_scroll_bar))
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2967 /* It's not condemned. Everything's fine. */
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2968 return;
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2969 else if (EQ (FRAME_CONDEMNED_SCROLL_BARS (f),
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2970 window->vertical_scroll_bar))
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2971 FRAME_CONDEMNED_SCROLL_BARS (f) = bar->next;
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2972 else
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2973 /* If its prev pointer is nil, it must be at the front of
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2974 one or the other! */
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2975 abort ();
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2976 }
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2977 else
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2978 XSCROLL_BAR (bar->prev)->next = bar->next;
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2979
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2980 if (! NILP (bar->next))
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2981 XSCROLL_BAR (bar->next)->prev = bar->prev;
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2982
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2983 bar->next = FRAME_SCROLL_BARS (f);
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2984 bar->prev = Qnil;
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2985 XSETVECTOR (FRAME_SCROLL_BARS (f), bar);
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2986 if (! NILP (bar->next))
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2987 XSETVECTOR (XSCROLL_BAR (bar->next)->prev, bar);
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2988 }
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2989 #ifdef PIGSFLY
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2990 struct scroll_bar *bar;
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2991
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2992 /* We can't redeem this window's scroll bar if it doesn't have one. */
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2993 if (NILP (window->vertical_scroll_bar))
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2994 abort ();
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2995
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2996 bar = XSCROLL_BAR (window->vertical_scroll_bar);
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2997
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2998 /* Unlink it from the condemned list. */
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
2999 {
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3000 FRAME_PTR f = XFRAME (WINDOW_FRAME (window));
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3001
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3002 if (NILP (bar->prev))
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3003 {
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3004 /* If the prev pointer is nil, it must be the first in one of
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3005 the lists. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3006 if (EQ (FRAME_SCROLL_BARS (f), window->vertical_scroll_bar))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3007 /* It's not condemned. Everything's fine. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3008 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3009 else if (EQ (FRAME_CONDEMNED_SCROLL_BARS (f),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3010 window->vertical_scroll_bar))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3011 FRAME_CONDEMNED_SCROLL_BARS (f) = bar->next;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3012 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3013 /* If its prev pointer is nil, it must be at the front of
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3014 one or the other! */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3015 abort ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3016 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3017 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3018 XSCROLL_BAR (bar->prev)->next = bar->next;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3019
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3020 if (! NILP (bar->next))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3021 XSCROLL_BAR (bar->next)->prev = bar->prev;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3022
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3023 bar->next = FRAME_SCROLL_BARS (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3024 bar->prev = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3025 XSETVECTOR (FRAME_SCROLL_BARS (f), bar);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3026 if (! NILP (bar->next))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3027 XSETVECTOR (XSCROLL_BAR (bar->next)->prev, bar);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3028 }
21614
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3029 #endif
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3030 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3031
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3032 /* Remove all scroll bars on FRAME that haven't been saved since the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3033 last call to `*condemn_scroll_bars_hook'. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3034 static void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
3035 w32_judge_scroll_bars (f)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3036 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3037 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3038 Lisp_Object bar, next;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3039
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3040 bar = FRAME_CONDEMNED_SCROLL_BARS (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3041
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3042 /* Clear out the condemned list now so we won't try to process any
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3043 more events on the hapless scroll bars. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3044 FRAME_CONDEMNED_SCROLL_BARS (f) = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3045
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3046 for (; ! NILP (bar); bar = next)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3047 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3048 struct scroll_bar *b = XSCROLL_BAR (bar);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3049
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3050 x_scroll_bar_remove (b);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3051
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3052 next = b->next;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3053 b->next = b->prev = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3054 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3055
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3056 /* Now there should be no references to the condemned scroll bars,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3057 and they should get garbage-collected. */
21614
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3058 #ifdef PIGSFLY
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3059 Lisp_Object bar, next;
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3060
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3061 bar = FRAME_CONDEMNED_SCROLL_BARS (f);
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3062
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3063 /* Clear out the condemned list now so we won't try to process any
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3064 more events on the hapless scroll bars. */
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3065 FRAME_CONDEMNED_SCROLL_BARS (f) = Qnil;
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3066
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3067 for (; ! NILP (bar); bar = next)
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3068 {
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3069 struct scroll_bar *b = XSCROLL_BAR (bar);
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3070
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3071 x_scroll_bar_remove (b);
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3072
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3073 next = b->next;
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3074 b->next = b->prev = Qnil;
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3075 }
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3076
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3077 /* Now there should be no references to the condemned scroll bars,
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3078 and they should get garbage-collected. */
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3079 #endif
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3080 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3081
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3082 /* Handle a mouse click on the scroll bar BAR. If *EMACS_EVENT's kind
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3083 is set to something other than no_event, it is enqueued.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3084
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3085 This may be called from a signal handler, so we have to ignore GC
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3086 mark bits. */
15216
f639c5d732a3 (x_scroll_bar_set_handle): Always use start in calling SetScrollPos.
Richard M. Stallman <rms@gnu.org>
parents: 15204
diff changeset
3087
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
3088 static int
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3089 x_scroll_bar_handle_click (bar, msg, emacs_event)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3090 struct scroll_bar *bar;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
3091 W32Msg *msg;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3092 struct input_event *emacs_event;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3093 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3094 if (! GC_WINDOWP (bar->window))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3095 abort ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3096
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
3097 emacs_event->kind = w32_scroll_bar_click;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3098 emacs_event->code = 0;
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
3099 /* not really meaningful to distinguish up/down */
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
3100 emacs_event->modifiers = msg->dwModifiers;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3101 emacs_event->frame_or_window = bar->window;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3102 emacs_event->timestamp = msg->msg.time;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3103
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3104 {
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3105 int top_range = VERTICAL_SCROLL_BAR_TOP_RANGE (XINT (bar->height));
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3106 int y;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3107 int dragging = !NILP (bar->dragging);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3108
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3109 if (pfnGetScrollInfo)
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3110 {
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3111 SCROLLINFO si;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3112
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3113 si.cbSize = sizeof (si);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3114 si.fMask = SIF_POS;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3115
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3116 pfnGetScrollInfo ((HWND) msg->msg.lParam, SB_CTL, &si);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3117 y = si.nPos;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3118 }
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3119 else
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3120 y = GetScrollPos ((HWND) msg->msg.lParam, SB_CTL);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3121
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3122 bar->dragging = Qnil;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3123
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3124 switch (LOWORD (msg->msg.wParam))
15216
f639c5d732a3 (x_scroll_bar_set_handle): Always use start in calling SetScrollPos.
Richard M. Stallman <rms@gnu.org>
parents: 15204
diff changeset
3125 {
f639c5d732a3 (x_scroll_bar_set_handle): Always use start in calling SetScrollPos.
Richard M. Stallman <rms@gnu.org>
parents: 15204
diff changeset
3126 case SB_LINEDOWN:
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
3127 emacs_event->part = scroll_bar_down_arrow;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3128 break;
15216
f639c5d732a3 (x_scroll_bar_set_handle): Always use start in calling SetScrollPos.
Richard M. Stallman <rms@gnu.org>
parents: 15204
diff changeset
3129 case SB_LINEUP:
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
3130 emacs_event->part = scroll_bar_up_arrow;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3131 break;
15216
f639c5d732a3 (x_scroll_bar_set_handle): Always use start in calling SetScrollPos.
Richard M. Stallman <rms@gnu.org>
parents: 15204
diff changeset
3132 case SB_PAGEUP:
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3133 emacs_event->part = scroll_bar_above_handle;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3134 break;
15216
f639c5d732a3 (x_scroll_bar_set_handle): Always use start in calling SetScrollPos.
Richard M. Stallman <rms@gnu.org>
parents: 15204
diff changeset
3135 case SB_PAGEDOWN:
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3136 emacs_event->part = scroll_bar_below_handle;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3137 break;
15216
f639c5d732a3 (x_scroll_bar_set_handle): Always use start in calling SetScrollPos.
Richard M. Stallman <rms@gnu.org>
parents: 15204
diff changeset
3138 case SB_TOP:
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3139 emacs_event->part = scroll_bar_handle;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3140 y = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3141 break;
15216
f639c5d732a3 (x_scroll_bar_set_handle): Always use start in calling SetScrollPos.
Richard M. Stallman <rms@gnu.org>
parents: 15204
diff changeset
3142 case SB_BOTTOM:
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3143 emacs_event->part = scroll_bar_handle;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3144 y = top_range;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3145 break;
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3146 case SB_THUMBTRACK:
15216
f639c5d732a3 (x_scroll_bar_set_handle): Always use start in calling SetScrollPos.
Richard M. Stallman <rms@gnu.org>
parents: 15204
diff changeset
3147 case SB_THUMBPOSITION:
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3148 if (VERTICAL_SCROLL_BAR_TOP_RANGE (XINT (bar->height)) <= 0xffff)
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3149 y = HIWORD (msg->msg.wParam);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3150 bar->dragging = Qt;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3151 emacs_event->part = scroll_bar_handle;
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3152
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3153 /* "Silently" update current position. */
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3154 if (pfnSetScrollInfo)
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3155 {
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3156 SCROLLINFO si;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3157
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3158 si.cbSize = sizeof (si);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3159 si.fMask = SIF_POS;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3160
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3161 #if 0
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3162 /* Shrink handle if necessary to allow full range for position. */
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3163 {
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3164 int start = XINT (bar->start);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3165 int end = XINT (bar->end);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3166 int len = end - start;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3167
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3168 /* If new end is nearly hitting bottom, we must shrink
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3169 handle. How much we shrink it depends on the relative
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3170 sizes of len and top_range. */
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3171 if (y + len > top_range - 2)
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3172 {
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3173 len -= min (top_range / 10, (len / 3) + 2);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3174 if (len < 0)
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3175 len = 0;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3176 }
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3177 si.nPage = len + VERTICAL_SCROLL_BAR_MIN_HANDLE;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3178 si.fMask |= SIF_PAGE;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3179 }
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3180 #endif
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3181 si.nPos = y;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3182 /* Remember apparent position (we actually lag behind the real
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3183 position, so don't set that directly. */
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3184 last_scroll_bar_drag_pos = y;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3185
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3186 pfnSetScrollInfo (SCROLL_BAR_W32_WINDOW (bar), SB_CTL, &si, FALSE);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3187 }
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3188 else
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3189 SetScrollPos (SCROLL_BAR_W32_WINDOW (bar), SB_CTL, y, FALSE);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3190 break;
15216
f639c5d732a3 (x_scroll_bar_set_handle): Always use start in calling SetScrollPos.
Richard M. Stallman <rms@gnu.org>
parents: 15204
diff changeset
3191 case SB_ENDSCROLL:
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3192 /* If this is the end of a drag sequence, then reset the scroll
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3193 handle size to normal and do a final redraw. Otherwise do
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3194 nothing. */
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3195 if (dragging)
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3196 {
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3197 if (pfnSetScrollInfo)
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3198 {
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3199 SCROLLINFO si;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3200 int start = XINT (bar->start);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3201 int end = XINT (bar->end);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3202
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3203 si.cbSize = sizeof (si);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3204 si.fMask = SIF_PAGE | SIF_POS;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3205 si.nPage = end - start + VERTICAL_SCROLL_BAR_MIN_HANDLE;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3206 si.nPos = last_scroll_bar_drag_pos;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3207
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3208 pfnSetScrollInfo (SCROLL_BAR_W32_WINDOW (bar), SB_CTL, &si, TRUE);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3209 }
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3210 else
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3211 SetScrollPos (SCROLL_BAR_W32_WINDOW (bar), SB_CTL, y, TRUE);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3212 }
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3213 /* fall through */
15216
f639c5d732a3 (x_scroll_bar_set_handle): Always use start in calling SetScrollPos.
Richard M. Stallman <rms@gnu.org>
parents: 15204
diff changeset
3214 default:
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3215 emacs_event->kind = no_event;
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
3216 return FALSE;
15216
f639c5d732a3 (x_scroll_bar_set_handle): Always use start in calling SetScrollPos.
Richard M. Stallman <rms@gnu.org>
parents: 15204
diff changeset
3217 }
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
3218
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3219 XSETINT (emacs_event->x, y);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3220 XSETINT (emacs_event->y, top_range);
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
3221
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
3222 return TRUE;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3223 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3224 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3225
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3226 /* Return information to the user about the current position of the mouse
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3227 on the scroll bar. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3228 static void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3229 x_scroll_bar_report_motion (fp, bar_window, part, x, y, time)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3230 FRAME_PTR *fp;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3231 Lisp_Object *bar_window;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3232 enum scroll_bar_part *part;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3233 Lisp_Object *x, *y;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3234 unsigned long *time;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3235 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3236 struct scroll_bar *bar = XSCROLL_BAR (last_mouse_scroll_bar);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
3237 Window w = SCROLL_BAR_W32_WINDOW (bar);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3238 FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window)));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3239 int pos;
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3240 int top_range = VERTICAL_SCROLL_BAR_TOP_RANGE (XINT (bar->height));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3241
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3242 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3243
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3244 *fp = f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3245 *bar_window = bar->window;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3246
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3247 if (pfnGetScrollInfo)
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3248 {
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3249 SCROLLINFO si;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3250
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3251 si.cbSize = sizeof (si);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3252 si.fMask = SIF_POS | SIF_PAGE | SIF_RANGE;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3253
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3254 pfnGetScrollInfo (w, SB_CTL, &si);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3255 pos = si.nPos;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3256 top_range = si.nMax - si.nPage + 1;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3257 }
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3258 else
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3259 pos = GetScrollPos (w, SB_CTL);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3260
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3261 switch (LOWORD (last_mouse_scroll_bar_pos))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3262 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3263 case SB_THUMBPOSITION:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3264 case SB_THUMBTRACK:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3265 *part = scroll_bar_handle;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3266 if (VERTICAL_SCROLL_BAR_TOP_RANGE (XINT (bar->height)) <= 0xffff)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3267 pos = HIWORD (last_mouse_scroll_bar_pos);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3268 break;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3269 case SB_LINEDOWN:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3270 *part = scroll_bar_handle;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3271 pos++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3272 break;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3273 default:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3274 *part = scroll_bar_handle;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3275 break;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3276 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3277
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3278 XSETINT(*x, pos);
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3279 XSETINT(*y, top_range);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3280
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3281 f->mouse_moved = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3282 last_mouse_scroll_bar = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3283
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3284 *time = last_mouse_movement_time;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3285
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3286 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3287 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3288
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3289 /* The screen has been cleared so we may have changed foreground or
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3290 background colors, and the scroll bars may need to be redrawn.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3291 Clear out the scroll bars, and ask for expose events, so we can
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3292 redraw them. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3293
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3294 x_scroll_bar_clear (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3295 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3296 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3297 Lisp_Object bar;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3298
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3299 for (bar = FRAME_SCROLL_BARS (f); VECTORP (bar);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3300 bar = XSCROLL_BAR (bar)->next)
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
3301 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
3302 HWND window = SCROLL_BAR_W32_WINDOW (XSCROLL_BAR (bar));
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
3303 HDC hdc = GetDC (window);
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
3304 RECT rect;
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
3305
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3306 /* Hide scroll bar until ready to repaint. x_scroll_bar_move
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3307 arranges to refresh the scroll bar if hidden. */
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3308 my_show_window (f, window, SW_HIDE);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3309
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
3310 GetClientRect (window, &rect);
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
3311 select_palette (f, hdc);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
3312 w32_clear_rect (f, hdc, &rect);
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
3313 deselect_palette (f, hdc);
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3314
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3315 ReleaseDC (window, hdc);
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
3316 }
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
3317 }
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
3318
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
3319 show_scroll_bars (f, how)
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
3320 FRAME_PTR f;
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
3321 int how;
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
3322 {
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
3323 Lisp_Object bar;
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
3324
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
3325 for (bar = FRAME_SCROLL_BARS (f); VECTORP (bar);
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
3326 bar = XSCROLL_BAR (bar)->next)
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
3327 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
3328 HWND window = SCROLL_BAR_W32_WINDOW (XSCROLL_BAR (bar));
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3329 my_show_window (f, window, how);
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
3330 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3331 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3332
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3333
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
3334 /* The main W32 event-reading loop - w32_read_socket. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3335
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3336 /* Timestamp of enter window event. This is only used by w32_read_socket,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3337 but we have to put it out here, since static variables within functions
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3338 sometimes don't work. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3339 static Time enter_timestamp;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3340
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3341 /* Record the last 100 characters stored
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3342 to help debug the loss-of-chars-during-GC problem. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3343 int temp_index;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3344 short temp_buffer[100];
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3345
14462
599a3ae1e8ea (convert_to_key_event, is_dead_key): New functions.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14351
diff changeset
3346
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
3347 /* Read events coming from the W32 shell.
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3348 This routine is called by the SIGIO handler.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3349 We return as soon as there are no more events to be read.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3350
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3351 Events representing keys are stored in buffer BUFP,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3352 which can hold up to NUMCHARS characters.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3353 We return the number of characters stored into the buffer,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3354 thus pretending to be `read'.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3355
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3356 EXPECTED is nonzero if the caller knows input is available.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3357
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3358 Some of these messages are reposted back to the message queue since the
16884
36babc489b0c Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents: 16588
diff changeset
3359 system calls the windows proc directly in a context where we cannot return
36babc489b0c Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents: 16588
diff changeset
3360 the data nor can we guarantee the state we are in. So if we dispatch them
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3361 we will get into an infinite loop. To prevent this from ever happening we
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3362 will set a variable to indicate we are in the read_socket call and indicate
16884
36babc489b0c Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents: 16588
diff changeset
3363 which message we are processing since the windows proc gets called
36babc489b0c Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents: 16588
diff changeset
3364 recursively with different messages by the system.
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3365 */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3366
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3367 int
16326
a85909645f7a (w32_read_socket): Delete WAITP arg.
Richard M. Stallman <rms@gnu.org>
parents: 16258
diff changeset
3368 w32_read_socket (sd, bufp, numchars, expected)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3369 register int sd;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3370 register struct input_event *bufp;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3371 register int numchars;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3372 int expected;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3373 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3374 int count = 0;
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3375 int check_visibility = 0;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
3376 W32Msg msg;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3377 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3378 Lisp_Object part;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
3379 struct w32_display_info *dpyinfo = &one_w32_display_info;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3380
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3381 if (interrupt_input_blocked)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3382 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3383 interrupt_input_pending = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3384 return -1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3385 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3386
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3387 interrupt_input_pending = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3388 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3389
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3390 /* So people can tell when we have read the available input. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3391 input_signal_count++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3392
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3393 if (numchars <= 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3394 abort (); /* Don't think this happens. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3395
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
3396 while (get_next_msg (&msg, FALSE))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3397 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3398 switch (msg.msg.message)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3399 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3400 case WM_PAINT:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3401 f = x_window_to_frame (dpyinfo, msg.msg.hwnd);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3402
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3403 if (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3404 {
21740
92c501ecca49 (w32_read_socket): Don't misinterpret WM_PAINT message
Geoff Voelker <voelker@cs.washington.edu>
parents: 21614
diff changeset
3405 if (msg.rect.right == msg.rect.left ||
92c501ecca49 (w32_read_socket): Don't misinterpret WM_PAINT message
Geoff Voelker <voelker@cs.washington.edu>
parents: 21614
diff changeset
3406 msg.rect.bottom == msg.rect.top)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3407 {
21740
92c501ecca49 (w32_read_socket): Don't misinterpret WM_PAINT message
Geoff Voelker <voelker@cs.washington.edu>
parents: 21614
diff changeset
3408 /* We may get paint messages even though the client
92c501ecca49 (w32_read_socket): Don't misinterpret WM_PAINT message
Geoff Voelker <voelker@cs.washington.edu>
parents: 21614
diff changeset
3409 area is clipped - these are not expose events. */
92c501ecca49 (w32_read_socket): Don't misinterpret WM_PAINT message
Geoff Voelker <voelker@cs.washington.edu>
parents: 21614
diff changeset
3410 DebPrint (("clipped frame %04x (%s) got WM_PAINT\n", f,
92c501ecca49 (w32_read_socket): Don't misinterpret WM_PAINT message
Geoff Voelker <voelker@cs.washington.edu>
parents: 21614
diff changeset
3411 XSTRING (f->name)->data));
92c501ecca49 (w32_read_socket): Don't misinterpret WM_PAINT message
Geoff Voelker <voelker@cs.washington.edu>
parents: 21614
diff changeset
3412 }
92c501ecca49 (w32_read_socket): Don't misinterpret WM_PAINT message
Geoff Voelker <voelker@cs.washington.edu>
parents: 21614
diff changeset
3413 else if (f->async_visible != 1)
92c501ecca49 (w32_read_socket): Don't misinterpret WM_PAINT message
Geoff Voelker <voelker@cs.washington.edu>
parents: 21614
diff changeset
3414 {
92c501ecca49 (w32_read_socket): Don't misinterpret WM_PAINT message
Geoff Voelker <voelker@cs.washington.edu>
parents: 21614
diff changeset
3415 /* Definitely not obscured, so mark as visible. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3416 f->async_visible = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3417 f->async_iconified = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3418 SET_FRAME_GARBAGED (f);
21740
92c501ecca49 (w32_read_socket): Don't misinterpret WM_PAINT message
Geoff Voelker <voelker@cs.washington.edu>
parents: 21614
diff changeset
3419 DebPrint (("frame %04x (%s) reexposed\n", f,
92c501ecca49 (w32_read_socket): Don't misinterpret WM_PAINT message
Geoff Voelker <voelker@cs.washington.edu>
parents: 21614
diff changeset
3420 XSTRING (f->name)->data));
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3421
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3422 /* WM_PAINT serves as MapNotify as well, so report
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3423 visibility changes properly. */
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3424 if (f->iconified)
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3425 {
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3426 bufp->kind = deiconify_event;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3427 XSETFRAME (bufp->frame_or_window, f);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3428 bufp++;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3429 count++;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3430 numchars--;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3431 }
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3432 else if (! NILP(Vframe_list)
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3433 && ! NILP (XCONS (Vframe_list)->cdr))
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3434 /* Force a redisplay sooner or later to update the
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3435 frame titles in case this is the second frame. */
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3436 record_asynch_buffer_change ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3437 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3438 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3439 {
15723
d2cee951f37e (w32_read_socket): Need to erase background
Karl Heuer <kwzh@gnu.org>
parents: 15651
diff changeset
3440 /* Erase background again for safety. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
3441 w32_clear_rect (f, NULL, &msg.rect);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3442 dumprectangle (f,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3443 msg.rect.left,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3444 msg.rect.top,
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3445 msg.rect.right - msg.rect.left,
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3446 msg.rect.bottom - msg.rect.top);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3447 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3448 }
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
3449 break;
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3450
23677
70999481c915 (convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23639
diff changeset
3451 case WM_INPUTLANGCHANGE:
70999481c915 (convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23639
diff changeset
3452 /* Generate a language change event. */
70999481c915 (convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23639
diff changeset
3453 f = x_window_to_frame (dpyinfo, msg.msg.hwnd);
70999481c915 (convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23639
diff changeset
3454
70999481c915 (convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23639
diff changeset
3455 if (f)
70999481c915 (convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23639
diff changeset
3456 {
70999481c915 (convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23639
diff changeset
3457 if (numchars == 0)
70999481c915 (convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23639
diff changeset
3458 abort ();
70999481c915 (convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23639
diff changeset
3459
70999481c915 (convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23639
diff changeset
3460 bufp->kind = language_change_event;
70999481c915 (convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23639
diff changeset
3461 XSETFRAME (bufp->frame_or_window, f);
70999481c915 (convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23639
diff changeset
3462 bufp->code = msg.msg.wParam;
70999481c915 (convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23639
diff changeset
3463 bufp->modifiers = msg.msg.lParam & 0xffff;
70999481c915 (convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23639
diff changeset
3464 bufp++;
70999481c915 (convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23639
diff changeset
3465 count++;
70999481c915 (convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23639
diff changeset
3466 numchars--;
70999481c915 (convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23639
diff changeset
3467 }
70999481c915 (convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23639
diff changeset
3468 break;
70999481c915 (convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23639
diff changeset
3469
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3470 case WM_KEYDOWN:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3471 case WM_SYSKEYDOWN:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3472 f = x_window_to_frame (dpyinfo, msg.msg.hwnd);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3473
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3474 if (f && !f->iconified)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3475 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3476 if (temp_index == sizeof temp_buffer / sizeof (short))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3477 temp_index = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3478 temp_buffer[temp_index++] = msg.msg.wParam;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3479 bufp->kind = non_ascii_keystroke;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3480 bufp->code = msg.msg.wParam;
23677
70999481c915 (convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23639
diff changeset
3481 bufp->modifiers = msg.dwModifiers;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3482 XSETFRAME (bufp->frame_or_window, f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3483 bufp->timestamp = msg.msg.time;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3484 bufp++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3485 numchars--;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3486 count++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3487 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3488 break;
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3489
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3490 case WM_SYSCHAR:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3491 case WM_CHAR:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3492 f = x_window_to_frame (dpyinfo, msg.msg.hwnd);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3493
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3494 if (f && !f->iconified)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3495 {
23677
70999481c915 (convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23639
diff changeset
3496 if (temp_index == sizeof temp_buffer / sizeof (short))
70999481c915 (convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23639
diff changeset
3497 temp_index = 0;
70999481c915 (convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23639
diff changeset
3498 temp_buffer[temp_index++] = msg.msg.wParam;
70999481c915 (convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23639
diff changeset
3499 bufp->kind = ascii_keystroke;
70999481c915 (convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23639
diff changeset
3500 bufp->code = msg.msg.wParam;
70999481c915 (convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23639
diff changeset
3501 bufp->modifiers = msg.dwModifiers;
70999481c915 (convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23639
diff changeset
3502 XSETFRAME (bufp->frame_or_window, f);
70999481c915 (convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23639
diff changeset
3503 bufp->timestamp = msg.msg.time;
70999481c915 (convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23639
diff changeset
3504 bufp++;
70999481c915 (convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23639
diff changeset
3505 numchars--;
70999481c915 (convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23639
diff changeset
3506 count++;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3507 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3508 break;
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3509
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3510 case WM_MOUSEMOVE:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3511 if (dpyinfo->grabbed && last_mouse_frame
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3512 && FRAME_LIVE_P (last_mouse_frame))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3513 f = last_mouse_frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3514 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3515 f = x_window_to_frame (dpyinfo, msg.msg.hwnd);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3516
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3517 if (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3518 note_mouse_movement (f, &msg.msg);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3519 else
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
3520 clear_mouse_face (FRAME_W32_DISPLAY_INFO (f));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3521
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3522 break;
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3523
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3524 case WM_LBUTTONDOWN:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3525 case WM_LBUTTONUP:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3526 case WM_MBUTTONDOWN:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3527 case WM_MBUTTONUP:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3528 case WM_RBUTTONDOWN:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3529 case WM_RBUTTONUP:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3530 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3531 int button;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3532 int up;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3533
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3534 if (dpyinfo->grabbed && last_mouse_frame
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3535 && FRAME_LIVE_P (last_mouse_frame))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3536 f = last_mouse_frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3537 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3538 f = x_window_to_frame (dpyinfo, msg.msg.hwnd);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3539
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3540 if (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3541 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
3542 if ((!dpyinfo->w32_focus_frame || f == dpyinfo->w32_focus_frame)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3543 && (numchars >= 1))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3544 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3545 construct_mouse_click (bufp, &msg, f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3546 bufp++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3547 count++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3548 numchars--;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3549 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3550 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3551
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3552 parse_button (msg.msg.message, &button, &up);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3553
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3554 if (up)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3555 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3556 dpyinfo->grabbed &= ~ (1 << button);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3557 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3558 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3559 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3560 dpyinfo->grabbed |= (1 << button);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3561 last_mouse_frame = f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3562 }
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3563 break;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3564 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3565
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3566 case WM_MOUSEWHEEL:
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3567 if (dpyinfo->grabbed && last_mouse_frame
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3568 && FRAME_LIVE_P (last_mouse_frame))
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3569 f = last_mouse_frame;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3570 else
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3571 f = x_window_to_frame (dpyinfo, msg.msg.hwnd);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3572
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3573 if (f)
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3574 {
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3575 if ((!dpyinfo->w32_focus_frame
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3576 || f == dpyinfo->w32_focus_frame)
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3577 && (numchars >= 1))
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3578 {
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3579 construct_mouse_wheel (bufp, &msg, f);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3580 bufp++;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3581 count++;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3582 numchars--;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3583 }
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3584 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3585 break;
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3586
21885
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
3587 case WM_DROPFILES:
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
3588 f = x_window_to_frame (dpyinfo, msg.msg.hwnd);
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
3589
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
3590 if (f)
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
3591 {
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
3592 construct_drag_n_drop (bufp, &msg, f);
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
3593 bufp++;
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
3594 count++;
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
3595 numchars--;
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
3596 }
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
3597 break;
40c97499e89a Include shellapi.h.
Richard M. Stallman <rms@gnu.org>
parents: 21875
diff changeset
3598
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3599 case WM_VSCROLL:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3600 {
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3601 struct scroll_bar *bar =
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3602 x_window_to_scroll_bar ((HWND)msg.msg.lParam);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3603
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3604 if (bar && numchars >= 1)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3605 {
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
3606 if (x_scroll_bar_handle_click (bar, &msg, bufp))
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
3607 {
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
3608 bufp++;
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
3609 count++;
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
3610 numchars--;
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
3611 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3612 }
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3613 break;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3614 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3615
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3616 case WM_WINDOWPOSCHANGED:
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3617 case WM_ACTIVATE:
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3618 case WM_ACTIVATEAPP:
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3619 check_visibility = 1;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3620 break;
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3621
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3622 case WM_MOVE:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3623 f = x_window_to_frame (dpyinfo, msg.msg.hwnd);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3624
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3625 if (f && !f->async_iconified)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3626 {
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3627 int x, y;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3628
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3629 x_real_positions (f, &x, &y);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3630 f->output_data.w32->left_pos = x;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3631 f->output_data.w32->top_pos = y;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3632 }
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3633
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3634 check_visibility = 1;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3635 break;
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3636
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3637 case WM_SHOWWINDOW:
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3638 /* If window has been obscured or exposed by another window
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3639 being maximised or minimised/restored, then recheck
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3640 visibility of all frames. Direct changes to our own
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3641 windows get handled by WM_SIZE. */
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3642 #if 0
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3643 if (msg.msg.lParam != 0)
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3644 check_visibility = 1;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3645 else
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3646 {
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3647 f = x_window_to_frame (dpyinfo, msg.msg.hwnd);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3648 f->async_visible = msg.msg.wParam;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3649 }
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3650 #endif
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3651
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3652 check_visibility = 1;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3653 break;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3654
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3655 case WM_SIZE:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3656 f = x_window_to_frame (dpyinfo, msg.msg.hwnd);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3657
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3658 /* Inform lisp of whether frame has been iconified etc. */
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3659 if (f)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3660 {
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3661 switch (msg.msg.wParam)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3662 {
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3663 case SIZE_MINIMIZED:
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3664 f->async_visible = 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3665 f->async_iconified = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3666
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3667 bufp->kind = iconify_event;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3668 XSETFRAME (bufp->frame_or_window, f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3669 bufp++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3670 count++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3671 numchars--;
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3672 break;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3673
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3674 case SIZE_MAXIMIZED:
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3675 case SIZE_RESTORED:
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3676 f->async_visible = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3677 f->async_iconified = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3678
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3679 /* wait_reading_process_input will notice this and update
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3680 the frame's display structures. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3681 SET_FRAME_GARBAGED (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3682
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3683 if (f->iconified)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3684 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3685 bufp->kind = deiconify_event;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3686 XSETFRAME (bufp->frame_or_window, f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3687 bufp++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3688 count++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3689 numchars--;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3690 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3691 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3692 /* Force a redisplay sooner or later
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3693 to update the frame titles
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3694 in case this is the second frame. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3695 record_asynch_buffer_change ();
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3696 break;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3697 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3698 }
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3699
21614
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3700 if (f && !f->async_iconified && msg.msg.wParam != SIZE_MINIMIZED)
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3701 {
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3702 RECT rect;
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3703 int rows;
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3704 int columns;
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3705 int width;
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3706 int height;
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3707
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3708 GetClientRect(msg.msg.hwnd, &rect);
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3709
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3710 height = rect.bottom - rect.top;
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3711 width = rect.right - rect.left;
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3712
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3713 rows = PIXEL_TO_CHAR_HEIGHT (f, height);
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3714 columns = PIXEL_TO_CHAR_WIDTH (f, width);
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3715
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3716 /* TODO: Clip size to the screen dimensions. */
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3717
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3718 /* Even if the number of character rows and columns has
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3719 not changed, the font size may have changed, so we need
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3720 to check the pixel dimensions as well. */
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3721
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3722 if (columns != f->width
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3723 || rows != f->height
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3724 || width != f->output_data.w32->pixel_width
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3725 || height != f->output_data.w32->pixel_height)
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3726 {
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3727 /* I had set this to 0, 0 - I am not sure why?? */
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3728
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3729 change_frame_size (f, rows, columns, 0, 1);
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3730 SET_FRAME_GARBAGED (f);
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3731
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3732 f->output_data.w32->pixel_width = width;
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3733 f->output_data.w32->pixel_height = height;
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3734 f->output_data.w32->win_gravity = NorthWestGravity;
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3735 }
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3736 }
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3737
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3738 check_visibility = 1;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3739 break;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3740
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3741 case WM_SETFOCUS:
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3742 case WM_KILLFOCUS:
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3743 f = x_window_to_frame (dpyinfo, msg.msg.hwnd);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3744
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3745 if (msg.msg.message == WM_SETFOCUS)
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3746 {
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3747 x_new_focus_frame (dpyinfo, f);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3748 }
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3749 else if (f == dpyinfo->w32_focus_frame)
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3750 {
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3751 x_new_focus_frame (dpyinfo, 0);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3752 }
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3753
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3754 check_visibility = 1;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3755 break;
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3756
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3757 case WM_CLOSE:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3758 f = x_window_to_frame (dpyinfo, msg.msg.hwnd);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3759
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3760 if (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3761 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3762 if (numchars == 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3763 abort ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3764
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3765 bufp->kind = delete_window_event;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3766 XSETFRAME (bufp->frame_or_window, f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3767 bufp++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3768 count++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3769 numchars--;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3770 }
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3771 break;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3772
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3773 case WM_INITMENU:
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3774 f = x_window_to_frame (dpyinfo, msg.msg.hwnd);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3775
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3776 if (f)
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3777 {
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3778 if (numchars == 0)
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3779 abort ();
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3780
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3781 bufp->kind = menu_bar_activate_event;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3782 XSETFRAME (bufp->frame_or_window, f);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3783 bufp++;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3784 count++;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3785 numchars--;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3786 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3787 break;
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3788
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3789 case WM_COMMAND:
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3790 f = x_window_to_frame (dpyinfo, msg.msg.hwnd);
21740
92c501ecca49 (w32_read_socket): Don't misinterpret WM_PAINT message
Geoff Voelker <voelker@cs.washington.edu>
parents: 21614
diff changeset
3791
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3792 if (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3793 {
23677
70999481c915 (convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23639
diff changeset
3794 extern void menubar_selection_callback
70999481c915 (convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23639
diff changeset
3795 (FRAME_PTR f, void * client_data);
21740
92c501ecca49 (w32_read_socket): Don't misinterpret WM_PAINT message
Geoff Voelker <voelker@cs.washington.edu>
parents: 21614
diff changeset
3796 menubar_selection_callback (f, (void *)msg.msg.wParam);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3797 }
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3798
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3799 check_visibility = 1;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3800 break;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3801
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3802 case WM_DISPLAYCHANGE:
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3803 f = x_window_to_frame (dpyinfo, msg.msg.hwnd);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3804
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3805 if (f)
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3806 {
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3807 dpyinfo->width = (short) LOWORD (msg.msg.lParam);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3808 dpyinfo->height = (short) HIWORD (msg.msg.lParam);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3809 dpyinfo->n_cbits = msg.msg.wParam;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3810 DebPrint (("display change: %d %d\n", dpyinfo->width,
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3811 dpyinfo->height));
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3812 }
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3813
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3814 check_visibility = 1;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3815 break;
21875
16414f4d07e7 (msh_mousewheel): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21831
diff changeset
3816
16414f4d07e7 (msh_mousewheel): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21831
diff changeset
3817 default:
16414f4d07e7 (msh_mousewheel): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21831
diff changeset
3818 /* Check for messages registered at runtime. */
16414f4d07e7 (msh_mousewheel): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21831
diff changeset
3819 if (msg.msg.message == msh_mousewheel)
16414f4d07e7 (msh_mousewheel): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21831
diff changeset
3820 {
16414f4d07e7 (msh_mousewheel): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21831
diff changeset
3821 if (dpyinfo->grabbed && last_mouse_frame
16414f4d07e7 (msh_mousewheel): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21831
diff changeset
3822 && FRAME_LIVE_P (last_mouse_frame))
16414f4d07e7 (msh_mousewheel): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21831
diff changeset
3823 f = last_mouse_frame;
16414f4d07e7 (msh_mousewheel): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21831
diff changeset
3824 else
16414f4d07e7 (msh_mousewheel): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21831
diff changeset
3825 f = x_window_to_frame (dpyinfo, msg.msg.hwnd);
16414f4d07e7 (msh_mousewheel): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21831
diff changeset
3826
16414f4d07e7 (msh_mousewheel): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21831
diff changeset
3827 if (f)
16414f4d07e7 (msh_mousewheel): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21831
diff changeset
3828 {
16414f4d07e7 (msh_mousewheel): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21831
diff changeset
3829 if ((!dpyinfo->w32_focus_frame
16414f4d07e7 (msh_mousewheel): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21831
diff changeset
3830 || f == dpyinfo->w32_focus_frame)
16414f4d07e7 (msh_mousewheel): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21831
diff changeset
3831 && (numchars >= 1))
16414f4d07e7 (msh_mousewheel): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21831
diff changeset
3832 {
16414f4d07e7 (msh_mousewheel): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21831
diff changeset
3833 construct_mouse_wheel (bufp, &msg, f);
16414f4d07e7 (msh_mousewheel): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21831
diff changeset
3834 bufp++;
16414f4d07e7 (msh_mousewheel): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21831
diff changeset
3835 count++;
16414f4d07e7 (msh_mousewheel): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21831
diff changeset
3836 numchars--;
16414f4d07e7 (msh_mousewheel): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21831
diff changeset
3837 }
16414f4d07e7 (msh_mousewheel): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21831
diff changeset
3838 }
16414f4d07e7 (msh_mousewheel): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21831
diff changeset
3839 }
16414f4d07e7 (msh_mousewheel): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21831
diff changeset
3840 break;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3841 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3842 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3843
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3844 /* If the focus was just given to an autoraising frame,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3845 raise it now. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3846 /* ??? This ought to be able to handle more than one such frame. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3847 if (pending_autoraise_frame)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3848 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3849 x_raise_frame (pending_autoraise_frame);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3850 pending_autoraise_frame = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3851 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3852
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3853 /* Check which frames are still visisble, if we have enqueued any user
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3854 events or been notified of events that may affect visibility. We
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3855 do this here because there doesn't seem to be any direct
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3856 notification from Windows that the visibility of a window has
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3857 changed (at least, not in all cases). */
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3858 if (count > 0 || check_visibility)
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3859 {
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3860 Lisp_Object tail, frame;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3861
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3862 FOR_EACH_FRAME (tail, frame)
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3863 {
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3864 FRAME_PTR f = XFRAME (frame);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3865 /* Check "visible" frames and mark each as obscured or not.
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3866 Note that async_visible is nonzero for unobscured and
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3867 obscured frames, but zero for hidden and iconified frames. */
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3868 if (FRAME_W32_P (f) && f->async_visible)
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3869 {
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3870 RECT clipbox;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3871 HDC hdc = get_frame_dc (f);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3872 GetClipBox (hdc, &clipbox);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3873 release_frame_dc (f, hdc);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3874
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3875 if (clipbox.right == clipbox.left
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3876 || clipbox.bottom == clipbox.top)
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3877 {
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3878 /* Frame has become completely obscured so mark as
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3879 such (we do this by setting async_visible to 2 so
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3880 that FRAME_VISIBLE_P is still true, but redisplay
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3881 will skip it). */
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3882 f->async_visible = 2;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3883
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3884 if (!FRAME_OBSCURED_P (f))
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3885 {
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3886 DebPrint (("frame %04x (%s) obscured\n", f,
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3887 XSTRING (f->name)->data));
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3888 }
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3889 }
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3890 else
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3891 {
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3892 /* Frame is not obscured, so mark it as such. */
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3893 f->async_visible = 1;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3894
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3895 if (FRAME_OBSCURED_P (f))
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3896 {
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3897 SET_FRAME_GARBAGED (f);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3898 DebPrint (("frame %04x (%s) reexposed\n", f,
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3899 XSTRING (f->name)->data));
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3900
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3901 /* Force a redisplay sooner or later. */
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3902 record_asynch_buffer_change ();
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3903 }
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3904 }
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3905 }
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3906 }
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3907 }
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
3908
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3909 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3910 return count;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3911 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3912
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3913 /* Drawing the cursor. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3914
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3915
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3916 /* Draw a hollow box cursor. Don't change the inside of the box. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3917
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3918 static void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3919 x_draw_box (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3920 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3921 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3922 RECT rect;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3923 HBRUSH hb;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3924 HDC hdc;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3925
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
3926 hdc = get_frame_dc (f);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3927
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
3928 hb = CreateSolidBrush (f->output_data.w32->cursor_pixel);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3929
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3930 rect.left = CHAR_TO_PIXEL_COL (f, curs_x);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3931 rect.top = CHAR_TO_PIXEL_ROW (f, curs_y);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
3932 rect.right = rect.left + FONT_WIDTH (f->output_data.w32->font);
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
3933 rect.bottom = rect.top + f->output_data.w32->line_height;
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
3934
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3935 FrameRect (hdc, &rect, hb);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3936 DeleteObject (hb);
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
3937
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
3938 release_frame_dc (f, hdc);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3939 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3940
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3941 /* Clear the cursor of frame F to background color,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3942 and mark the cursor as not shown.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3943 This is used when the text where the cursor is
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3944 is about to be rewritten. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3945
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3946 static void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3947 clear_cursor (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3948 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3949 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3950 if (! FRAME_VISIBLE_P (f)
24674
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
3951 || !f->phys_cursor_on)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3952 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3953
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3954 x_display_cursor (f, 0);
24674
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
3955 f->phys_cursor_on = 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3956 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3957
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3958 /* Redraw the glyph at ROW, COLUMN on frame F, in the style
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3959 HIGHLIGHT. HIGHLIGHT is as defined for dumpglyphs. Return the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3960 glyph drawn. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3961
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3962 static void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3963 x_draw_single_glyph (f, row, column, glyph, highlight)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3964 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3965 int row, column;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3966 GLYPH glyph;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3967 int highlight;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3968 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3969 dumpglyphs (f,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3970 CHAR_TO_PIXEL_COL (f, column),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3971 CHAR_TO_PIXEL_ROW (f, row),
21614
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
3972 &glyph, 1, highlight, 0, NULL);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3973 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3974
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3975 static void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3976 x_display_bar_cursor (f, on)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3977 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3978 int on;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3979 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3980 struct frame_glyphs *current_glyphs = FRAME_CURRENT_GLYPHS (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3981
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3982 /* This is pointless on invisible frames, and dangerous on garbaged
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3983 frames; in the latter case, the frame may be in the midst of
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3984 changing its size, and curs_x and curs_y may be off the frame. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3985 if (! FRAME_VISIBLE_P (f) || FRAME_GARBAGED_P (f))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3986 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3987
24674
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
3988 if (! on && ! f->phys_cursor_on)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3989 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3990
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3991 /* If there is anything wrong with the current cursor state, remove it. */
24674
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
3992 if (f->phys_cursor_on
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3993 && (!on
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3994 || f->phys_cursor_x != curs_x
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3995 || f->phys_cursor_y != curs_y
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
3996 || f->output_data.w32->current_cursor != bar_cursor))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3997 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3998 /* Erase the cursor by redrawing the character underneath it. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3999 x_draw_single_glyph (f, f->phys_cursor_y, f->phys_cursor_x,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4000 f->phys_cursor_glyph,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4001 current_glyphs->highlight[f->phys_cursor_y]);
24674
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
4002 f->phys_cursor_on = 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4003 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4004
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4005 /* If we now need a cursor in the new place or in the new form, do it so. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4006 if (on
24674
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
4007 && (! f->phys_cursor_on
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4008 || (f->output_data.w32->current_cursor != bar_cursor)))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4009 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4010 f->phys_cursor_glyph
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4011 = ((current_glyphs->enable[curs_y]
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4012 && curs_x < current_glyphs->used[curs_y])
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4013 ? current_glyphs->glyphs[curs_y][curs_x]
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4014 : SPACEGLYPH);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4015 w32_fill_area (f, NULL, f->output_data.w32->cursor_pixel,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4016 CHAR_TO_PIXEL_COL (f, curs_x),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4017 CHAR_TO_PIXEL_ROW (f, curs_y),
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4018 max (f->output_data.w32->cursor_width, 1),
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4019 f->output_data.w32->line_height);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4020
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4021 f->phys_cursor_x = curs_x;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4022 f->phys_cursor_y = curs_y;
24674
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
4023 f->phys_cursor_on = 1;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4024
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4025 f->output_data.w32->current_cursor = bar_cursor;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4026 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4027 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4028
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4029
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4030 /* Turn the displayed cursor of frame F on or off according to ON.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4031 If ON is nonzero, where to put the cursor is specified
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4032 by F->cursor_x and F->cursor_y. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4033
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4034 static void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4035 x_display_box_cursor (f, on)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4036 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4037 int on;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4038 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4039 struct frame_glyphs *current_glyphs = FRAME_CURRENT_GLYPHS (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4040
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4041 /* This is pointless on invisible frames, and dangerous on garbaged
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4042 frames; in the latter case, the frame may be in the midst of
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4043 changing its size, and curs_x and curs_y may be off the frame. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4044 if (! FRAME_VISIBLE_P (f) || FRAME_GARBAGED_P (f))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4045 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4046
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4047 /* If cursor is off and we want it off, return quickly. */
24674
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
4048 if (!on && ! f->phys_cursor_on)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4049 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4050
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4051 /* If cursor is currently being shown and we don't want it to be
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4052 or it is in the wrong place,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4053 or we want a hollow box and it's not so, (pout!)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4054 erase it. */
24674
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
4055 if (f->phys_cursor_on
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4056 && (!on
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4057 || f->phys_cursor_x != curs_x
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4058 || f->phys_cursor_y != curs_y
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4059 || (f->output_data.w32->current_cursor != hollow_box_cursor
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4060 && (f != FRAME_W32_DISPLAY_INFO (f)->w32_highlight_frame))))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4061 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4062 int mouse_face_here = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4063 struct frame_glyphs *active_glyphs = FRAME_CURRENT_GLYPHS (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4064
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4065 /* If the cursor is in the mouse face area, redisplay that when
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4066 we clear the cursor. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4067 if (f == FRAME_W32_DISPLAY_INFO (f)->mouse_face_mouse_frame
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4068 && (f->phys_cursor_y > FRAME_W32_DISPLAY_INFO (f)->mouse_face_beg_row
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4069 || (f->phys_cursor_y == FRAME_W32_DISPLAY_INFO (f)->mouse_face_beg_row
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4070 && f->phys_cursor_x >= FRAME_W32_DISPLAY_INFO (f)->mouse_face_beg_col))
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4071 && (f->phys_cursor_y < FRAME_W32_DISPLAY_INFO (f)->mouse_face_end_row
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4072 || (f->phys_cursor_y == FRAME_W32_DISPLAY_INFO (f)->mouse_face_end_row
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4073 && f->phys_cursor_x < FRAME_W32_DISPLAY_INFO (f)->mouse_face_end_col))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4074 /* Don't redraw the cursor's spot in mouse face
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4075 if it is at the end of a line (on a newline).
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4076 The cursor appears there, but mouse highlighting does not. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4077 && active_glyphs->used[f->phys_cursor_y] > f->phys_cursor_x)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4078 mouse_face_here = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4079
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4080 /* If the font is not as tall as a whole line,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4081 we must explicitly clear the line's whole height. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4082 if (FONT_HEIGHT (f->output_data.w32->font) != f->output_data.w32->line_height)
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4083 w32_clear_area (f, NULL,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4084 CHAR_TO_PIXEL_COL (f, f->phys_cursor_x),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4085 CHAR_TO_PIXEL_ROW (f, f->phys_cursor_y),
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4086 FONT_WIDTH (f->output_data.w32->font),
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4087 f->output_data.w32->line_height);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4088 /* Erase the cursor by redrawing the character underneath it. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4089 x_draw_single_glyph (f, f->phys_cursor_y, f->phys_cursor_x,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4090 f->phys_cursor_glyph,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4091 (mouse_face_here
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4092 ? 3
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4093 : current_glyphs->highlight[f->phys_cursor_y]));
24674
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
4094 f->phys_cursor_on = 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4095 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4096
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4097 /* If we want to show a cursor,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4098 or we want a box cursor and it's not so,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4099 write it in the right place. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4100 if (on
24674
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
4101 && (! f->phys_cursor_on
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4102 || (f->output_data.w32->current_cursor != filled_box_cursor
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4103 && f == FRAME_W32_DISPLAY_INFO (f)->w32_highlight_frame)))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4104 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4105 f->phys_cursor_glyph
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4106 = ((current_glyphs->enable[curs_y]
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4107 && curs_x < current_glyphs->used[curs_y])
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4108 ? current_glyphs->glyphs[curs_y][curs_x]
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4109 : SPACEGLYPH);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4110 if (f != FRAME_W32_DISPLAY_INFO (f)->w32_highlight_frame)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4111 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4112 x_draw_box (f);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4113 f->output_data.w32->current_cursor = hollow_box_cursor;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4114 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4115 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4116 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4117 x_draw_single_glyph (f, curs_y, curs_x,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4118 f->phys_cursor_glyph, 2);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4119 f->output_data.w32->current_cursor = filled_box_cursor;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4120 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4121
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4122 f->phys_cursor_x = curs_x;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4123 f->phys_cursor_y = curs_y;
24674
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
4124 f->phys_cursor_on = 1;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4125 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4126 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4127
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4128 /* Display the cursor on frame F, or clear it, according to ON.
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4129 Use the position specified by curs_x and curs_y
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4130 if we are doing an update of frame F now.
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4131 Otherwise use the position in the FRAME_CURSOR_X and FRAME_CURSOR_Y fields
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4132 of F. */
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4133
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4134 x_display_cursor (f, on)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4135 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4136 int on;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4137 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4138 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4139
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4140 /* If we're not updating, then we want to use the current frame's
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4141 cursor position, not our local idea of where the cursor ought to be. */
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4142 if (f != updating_frame)
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4143 {
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4144 curs_x = FRAME_CURSOR_X (f);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4145 curs_y = FRAME_CURSOR_Y (f);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4146 }
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4147
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4148 if (FRAME_DESIRED_CURSOR (f) == filled_box_cursor)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4149 x_display_box_cursor (f, on);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4150 else if (FRAME_DESIRED_CURSOR (f) == bar_cursor)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4151 x_display_bar_cursor (f, on);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4152 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4153 /* Those are the only two we have implemented! */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4154 abort ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4155
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4156 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4157 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4158
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4159 /* Changing the font of the frame. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4160
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4161 /* Give frame F the font named FONTNAME as its default font, and
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4162 return the full name of that font. FONTNAME may be a wildcard
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4163 pattern; in that case, we choose some font that fits the pattern.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4164 The return value shows which font we chose. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4165
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4166 Lisp_Object
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4167 x_new_font (f, fontname)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4168 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4169 register char *fontname;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4170 {
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
4171 struct font_info *fontp
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
4172 = fs_load_font (f, FRAME_W32_FONT_TABLE (f), CHARSET_ASCII,
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
4173 fontname, -1);
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
4174
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
4175 if (!fontp)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4176 return Qnil;
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
4177
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
4178 FRAME_FONT (f) = (XFontStruct *) (fontp->font);
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
4179 f->output_data.w32->font_baseline
24146
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
4180 = FONT_BASE (FRAME_FONT (f)) + fontp->baseline_offset;
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
4181 FRAME_FONTSET (f) = -1;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4182
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4183 /* Compute the scroll bar width in character columns. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4184 if (f->scroll_bar_pixel_width > 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4185 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4186 int wid = FONT_WIDTH (f->output_data.w32->font);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4187 f->scroll_bar_cols = (f->scroll_bar_pixel_width + wid-1) / wid;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4188 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4189 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4190 f->scroll_bar_cols = 2;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4191
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4192 /* Now make the frame display the given font. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4193 if (FRAME_W32_WINDOW (f) != 0)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4194 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4195 frame_update_line_height (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4196 x_set_window_size (f, 0, f->width, f->height);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4197 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4198 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4199 /* If we are setting a new frame's font for the first time,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4200 there are no faces yet, so this font's height is the line height. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4201 f->output_data.w32->line_height = FONT_HEIGHT (f->output_data.w32->font);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4202
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4203 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4204 Lisp_Object lispy_name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4205
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4206 lispy_name = build_string (fontname);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4207
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4208 return lispy_name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4209 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4210 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4211
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
4212 /* Give frame F the fontset named FONTSETNAME as its default font, and
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
4213 return the full name of that fontset. FONTSETNAME may be a wildcard
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
4214 pattern; in that case, we choose some fontset that fits the pattern.
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
4215 The return value shows which fontset we chose. */
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
4216
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
4217 Lisp_Object
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
4218 x_new_fontset (f, fontsetname)
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
4219 struct frame *f;
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
4220 char *fontsetname;
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
4221 {
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
4222 int fontset = fs_query_fontset (f, fontsetname);
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
4223 struct fontset_info *fontsetp;
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
4224 Lisp_Object result;
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
4225
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
4226 if (fontset < 0)
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
4227 return Qnil;
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
4228
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
4229 if (FRAME_FONTSET (f) == fontset)
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
4230 /* This fontset is already set in frame F. There's nothing more
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
4231 to do. */
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
4232 return build_string (fontsetname);
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
4233
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
4234 fontsetp = FRAME_FONTSET_DATA (f)->fontset_table[fontset];
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
4235
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
4236 if (!fontsetp->fontname[CHARSET_ASCII])
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
4237 /* This fontset doesn't contain ASCII font. */
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
4238 return Qnil;
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
4239
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
4240 result = x_new_font (f, fontsetp->fontname[CHARSET_ASCII]);
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
4241
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
4242 if (!STRINGP (result))
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
4243 /* Can't load ASCII font. */
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
4244 return Qnil;
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
4245
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
4246 /* Since x_new_font doesn't update any fontset information, do it now. */
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
4247 FRAME_FONTSET(f) = fontset;
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
4248 FS_LOAD_FONT (f, FRAME_W32_FONT_TABLE (f),
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
4249 CHARSET_ASCII, XSTRING (result)->data, fontset);
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
4250
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
4251 return build_string (fontsetname);
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
4252 }
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
4253
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4254 /* Calculate the absolute position in frame F
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4255 from its current recorded position values and gravity. */
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4256
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4257 x_calc_absolute_position (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4258 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4259 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4260 Window win, child;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4261 POINT pt;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4262 int flags = f->output_data.w32->size_hint_flags;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4263
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4264 pt.x = pt.y = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4265
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4266 /* Find the position of the outside upper-left corner of
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4267 the inner window, with respect to the outer window. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4268 if (f->output_data.w32->parent_desc != FRAME_W32_DISPLAY_INFO (f)->root_window)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4269 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4270 BLOCK_INPUT;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4271 MapWindowPoints (FRAME_W32_WINDOW (f),
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4272 f->output_data.w32->parent_desc,
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4273 &pt, 1);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4274 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4275 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4276
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4277 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4278 RECT rt;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4279 rt.left = rt.right = rt.top = rt.bottom = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4280
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4281 BLOCK_INPUT;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4282 AdjustWindowRect(&rt, f->output_data.w32->dwStyle,
14351
fb2ce4ebc871 ubackout 1.3 and 1.4
Geoff Voelker <voelker@cs.washington.edu>
parents: 14248
diff changeset
4283 FRAME_EXTERNAL_MENU_BAR (f));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4284 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4285
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4286 pt.x += (rt.right - rt.left);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4287 pt.y += (rt.bottom - rt.top);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4288 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4289
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4290 /* Treat negative positions as relative to the leftmost bottommost
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4291 position that fits on the screen. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4292 if (flags & XNegative)
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4293 f->output_data.w32->left_pos = (FRAME_W32_DISPLAY_INFO (f)->width
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4294 - 2 * f->output_data.w32->border_width - pt.x
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4295 - PIXEL_WIDTH (f)
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4296 + f->output_data.w32->left_pos);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4297
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4298 if (flags & YNegative)
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4299 f->output_data.w32->top_pos = (FRAME_W32_DISPLAY_INFO (f)->height
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4300 - 2 * f->output_data.w32->border_width - pt.y
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4301 - PIXEL_HEIGHT (f)
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4302 + f->output_data.w32->top_pos);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4303 /* The left_pos and top_pos
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4304 are now relative to the top and left screen edges,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4305 so the flags should correspond. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4306 f->output_data.w32->size_hint_flags &= ~ (XNegative | YNegative);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4307 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4308
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4309 /* CHANGE_GRAVITY is 1 when calling from Fset_frame_position,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4310 to really change the position, and 0 when calling from
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4311 x_make_frame_visible (in that case, XOFF and YOFF are the current
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4312 position values). It is -1 when calling from x_set_frame_parameters,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4313 which means, do adjust for borders but don't change the gravity. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4314
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4315 x_set_offset (f, xoff, yoff, change_gravity)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4316 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4317 register int xoff, yoff;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4318 int change_gravity;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4319 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4320 int modified_top, modified_left;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4321
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4322 if (change_gravity > 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4323 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4324 f->output_data.w32->top_pos = yoff;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4325 f->output_data.w32->left_pos = xoff;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4326 f->output_data.w32->size_hint_flags &= ~ (XNegative | YNegative);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4327 if (xoff < 0)
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4328 f->output_data.w32->size_hint_flags |= XNegative;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4329 if (yoff < 0)
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4330 f->output_data.w32->size_hint_flags |= YNegative;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4331 f->output_data.w32->win_gravity = NorthWestGravity;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4332 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4333 x_calc_absolute_position (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4334
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4335 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4336 x_wm_set_size_hint (f, (long) 0, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4337
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4338 /* It is a mystery why we need to add the border_width here
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4339 when the frame is already visible, but experiment says we do. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4340 modified_left = f->output_data.w32->left_pos;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4341 modified_top = f->output_data.w32->top_pos;
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4342 #ifndef HAVE_NTGUI
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4343 /* Do not add in border widths under W32. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4344 if (change_gravity != 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4345 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4346 modified_left += f->output_data.w32->border_width;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4347 modified_top += f->output_data.w32->border_width;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4348 }
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4349 #endif
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4350
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4351 my_set_window_pos (FRAME_W32_WINDOW (f),
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
4352 NULL,
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
4353 modified_left, modified_top,
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
4354 0, 0,
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4355 SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4356 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4357 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4358
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4359 /* Call this to change the size of frame F's x-window.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4360 If CHANGE_GRAVITY is 1, we change to top-left-corner window gravity
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4361 for this size change and subsequent size changes.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4362 Otherwise we leave the window gravity unchanged. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4363
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4364 x_set_window_size (f, change_gravity, cols, rows)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4365 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4366 int change_gravity;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4367 int cols, rows;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4368 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4369 int pixelwidth, pixelheight;
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4370 Lisp_Object window;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4371 struct w32_display_info *dpyinfo = &one_w32_display_info;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4372
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4373 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4374
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4375 check_frame_size (f, &rows, &cols);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4376 f->output_data.w32->vertical_scroll_bar_extra
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4377 = (!FRAME_HAS_VERTICAL_SCROLL_BARS (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4378 ? 0
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4379 : FRAME_SCROLL_BAR_PIXEL_WIDTH (f) > 0
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4380 ? FRAME_SCROLL_BAR_PIXEL_WIDTH (f)
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4381 : (FRAME_SCROLL_BAR_COLS (f) * FONT_WIDTH (f->output_data.w32->font)));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4382 pixelwidth = CHAR_TO_PIXEL_WIDTH (f, cols);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4383 pixelheight = CHAR_TO_PIXEL_HEIGHT (f, rows);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4384
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4385 f->output_data.w32->win_gravity = NorthWestGravity;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4386 x_wm_set_size_hint (f, (long) 0, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4387
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4388 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4389 RECT rect;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4390
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4391 rect.left = rect.top = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4392 rect.right = pixelwidth;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4393 rect.bottom = pixelheight;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4394
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4395 AdjustWindowRect(&rect, f->output_data.w32->dwStyle,
14351
fb2ce4ebc871 ubackout 1.3 and 1.4
Geoff Voelker <voelker@cs.washington.edu>
parents: 14248
diff changeset
4396 FRAME_EXTERNAL_MENU_BAR (f));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4397
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4398 my_set_window_pos (FRAME_W32_WINDOW (f),
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
4399 NULL,
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
4400 0, 0,
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4401 rect.right - rect.left,
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4402 rect.bottom - rect.top,
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4403 SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4404 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4405
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4406 /* Now, strictly speaking, we can't be sure that this is accurate,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4407 but the window manager will get around to dealing with the size
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4408 change request eventually, and we'll hear how it went when the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4409 ConfigureNotify event gets here.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4410
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4411 We could just not bother storing any of this information here,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4412 and let the ConfigureNotify event set everything up, but that
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4413 might be kind of confusing to the lisp code, since size changes
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4414 wouldn't be reported in the frame parameters until some random
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4415 point in the future when the ConfigureNotify event arrives. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4416 change_frame_size (f, rows, cols, 0, 0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4417 PIXEL_WIDTH (f) = pixelwidth;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4418 PIXEL_HEIGHT (f) = pixelheight;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4419
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4420 /* We've set {FRAME,PIXEL}_{WIDTH,HEIGHT} to the values we hope to
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4421 receive in the ConfigureNotify event; if we get what we asked
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4422 for, then the event won't cause the screen to become garbaged, so
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4423 we have to make sure to do it here. */
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4424 SET_FRAME_GARBAGED (f);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4425
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4426 /* If cursor was outside the new size, mark it as off. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4427 if (f->phys_cursor_y >= rows
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4428 || f->phys_cursor_x >= cols)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4429 {
24674
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
4430 f->phys_cursor_x = 0;
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
4431 f->phys_cursor_y = 0;
d0dee612f8e3 [andrewi]
Andrew Innes <andrewi@gnu.org>
parents: 24480
diff changeset
4432 f->phys_cursor_on = 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4433 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4434
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4435 /* Clear out any recollection of where the mouse highlighting was,
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4436 since it might be in a place that's outside the new frame size.
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4437 Actually checking whether it is outside is a pain in the neck,
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4438 so don't try--just let the highlighting be done afresh with new size. */
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4439 window = dpyinfo->mouse_face_window;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4440 if (! NILP (window) && XFRAME (window) == f)
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4441 {
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4442 dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4443 dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4444 dpyinfo->mouse_face_window = Qnil;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4445 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4446
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4447 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4448 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4449
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4450 /* Mouse warping. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4451
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4452 void
15616
a73836346910 (x_set_mouse_pixel_position): Adjust coords by frame position.
Miles Bader <miles@gnu.org>
parents: 15435
diff changeset
4453 x_set_mouse_pixel_position (f, pix_x, pix_y)
a73836346910 (x_set_mouse_pixel_position): Adjust coords by frame position.
Miles Bader <miles@gnu.org>
parents: 15435
diff changeset
4454 struct frame *f;
a73836346910 (x_set_mouse_pixel_position): Adjust coords by frame position.
Miles Bader <miles@gnu.org>
parents: 15435
diff changeset
4455 int pix_x, pix_y;
a73836346910 (x_set_mouse_pixel_position): Adjust coords by frame position.
Miles Bader <miles@gnu.org>
parents: 15435
diff changeset
4456 {
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4457 RECT rect;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4458 POINT pt;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4459
15616
a73836346910 (x_set_mouse_pixel_position): Adjust coords by frame position.
Miles Bader <miles@gnu.org>
parents: 15435
diff changeset
4460 BLOCK_INPUT;
a73836346910 (x_set_mouse_pixel_position): Adjust coords by frame position.
Miles Bader <miles@gnu.org>
parents: 15435
diff changeset
4461
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4462 GetClientRect (FRAME_W32_WINDOW (f), &rect);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4463 pt.x = rect.left + pix_x;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4464 pt.y = rect.top + pix_y;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4465 ClientToScreen (FRAME_W32_WINDOW (f), &pt);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4466
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4467 SetCursorPos (pt.x, pt.y);
15616
a73836346910 (x_set_mouse_pixel_position): Adjust coords by frame position.
Miles Bader <miles@gnu.org>
parents: 15435
diff changeset
4468
a73836346910 (x_set_mouse_pixel_position): Adjust coords by frame position.
Miles Bader <miles@gnu.org>
parents: 15435
diff changeset
4469 UNBLOCK_INPUT;
a73836346910 (x_set_mouse_pixel_position): Adjust coords by frame position.
Miles Bader <miles@gnu.org>
parents: 15435
diff changeset
4470 }
a73836346910 (x_set_mouse_pixel_position): Adjust coords by frame position.
Miles Bader <miles@gnu.org>
parents: 15435
diff changeset
4471
a73836346910 (x_set_mouse_pixel_position): Adjust coords by frame position.
Miles Bader <miles@gnu.org>
parents: 15435
diff changeset
4472 void
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4473 x_set_mouse_position (f, x, y)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4474 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4475 int x, y;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4476 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4477 int pix_x, pix_y;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4478
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4479 pix_x = CHAR_TO_PIXEL_COL (f, x) + FONT_WIDTH (f->output_data.w32->font) / 2;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4480 pix_y = CHAR_TO_PIXEL_ROW (f, y) + f->output_data.w32->line_height / 2;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4481
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4482 if (pix_x < 0) pix_x = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4483 if (pix_x > PIXEL_WIDTH (f)) pix_x = PIXEL_WIDTH (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4484
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4485 if (pix_y < 0) pix_y = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4486 if (pix_y > PIXEL_HEIGHT (f)) pix_y = PIXEL_HEIGHT (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4487
15616
a73836346910 (x_set_mouse_pixel_position): Adjust coords by frame position.
Miles Bader <miles@gnu.org>
parents: 15435
diff changeset
4488 x_set_mouse_pixel_position (f, pix_x, pix_y);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4489 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4490
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4491 /* focus shifting, raising and lowering. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4492
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4493 x_focus_on_frame (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4494 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4495 {
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4496 struct w32_display_info *dpyinfo = &one_w32_display_info;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4497
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4498 /* Give input focus to frame. */
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4499 BLOCK_INPUT;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4500 #if 0
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4501 /* Try not to change its Z-order if possible. */
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4502 if (x_window_to_frame (dpyinfo, GetForegroundWindow ()))
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4503 my_set_focus (f, FRAME_W32_WINDOW (f));
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4504 else
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4505 #endif
21614
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
4506 my_set_foreground_window (FRAME_W32_WINDOW (f));
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4507 UNBLOCK_INPUT;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4508 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4509
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4510 x_unfocus_frame (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4511 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4512 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4513 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4514
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4515 /* Raise frame F. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4516
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4517 x_raise_frame (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4518 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4519 {
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4520 BLOCK_INPUT;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4521
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4522 /* Strictly speaking, raise-frame should only change the frame's Z
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4523 order, leaving input focus unchanged. This is reasonable behaviour
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4524 on X where the usual policy is point-to-focus. However, this
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4525 behaviour would be very odd on Windows where the usual policy is
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4526 click-to-focus.
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4527
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4528 On X, if the mouse happens to be over the raised frame, it gets
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4529 input focus anyway (so the window with focus will never be
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4530 completely obscured) - if not, then just moving the mouse over it
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4531 is sufficient to give it focus. On Windows, the user must actually
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4532 click on the frame (preferrably the title bar so as not to move
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4533 point), which is more awkward. Also, no other Windows program
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4534 raises a window to the top but leaves another window (possibly now
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4535 completely obscured) with input focus.
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4536
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4537 Because there is a system setting on Windows that allows the user
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4538 to choose the point to focus policy, we make the strict semantics
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4539 optional, but by default we grab focus when raising. */
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4540
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4541 if (NILP (Vw32_grab_focus_on_raise))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4542 {
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4543 /* The obvious call to my_set_window_pos doesn't work if Emacs is
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4544 not already the foreground application: the frame is raised
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4545 above all other frames belonging to us, but not above the
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4546 current top window. To achieve that, we have to resort to this
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4547 more cumbersome method. */
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4548
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4549 HDWP handle = BeginDeferWindowPos (2);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4550 if (handle)
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4551 {
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4552 DeferWindowPos (handle,
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4553 FRAME_W32_WINDOW (f),
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4554 HWND_TOP,
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4555 0, 0, 0, 0,
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4556 SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4557
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4558 DeferWindowPos (handle,
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4559 GetForegroundWindow (),
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4560 FRAME_W32_WINDOW (f),
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4561 0, 0, 0, 0,
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4562 SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4563
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4564 EndDeferWindowPos (handle);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4565 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4566 }
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4567 else
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4568 {
21614
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
4569 my_set_foreground_window (FRAME_W32_WINDOW (f));
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4570 }
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4571
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4572 UNBLOCK_INPUT;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4573 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4574
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4575 /* Lower frame F. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4576
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4577 x_lower_frame (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4578 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4579 {
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4580 BLOCK_INPUT;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4581 my_set_window_pos (FRAME_W32_WINDOW (f),
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4582 HWND_BOTTOM,
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4583 0, 0, 0, 0,
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4584 SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4585 UNBLOCK_INPUT;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4586 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4587
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4588 static void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4589 w32_frame_raise_lower (f, raise)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4590 FRAME_PTR f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4591 int raise;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4592 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4593 if (raise)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4594 x_raise_frame (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4595 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4596 x_lower_frame (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4597 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4598
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4599 /* Change of visibility. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4600
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4601 /* This tries to wait until the frame is really visible.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4602 However, if the window manager asks the user where to position
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4603 the frame, this will return before the user finishes doing that.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4604 The frame will not actually be visible at that time,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4605 but it will become visible later when the window manager
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4606 finishes with it. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4607
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4608 x_make_frame_visible (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4609 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4610 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4611 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4612
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4613 if (! FRAME_VISIBLE_P (f))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4614 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4615 /* We test FRAME_GARBAGED_P here to make sure we don't
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4616 call x_set_offset a second time
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4617 if we get to x_make_frame_visible a second time
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4618 before the window gets really visible. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4619 if (! FRAME_ICONIFIED_P (f)
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4620 && ! f->output_data.w32->asked_for_visible)
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4621 x_set_offset (f, f->output_data.w32->left_pos, f->output_data.w32->top_pos, 0);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4622
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4623 f->output_data.w32->asked_for_visible = 1;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4624
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4625 // my_show_window (f, FRAME_W32_WINDOW (f), f->async_iconified ? SW_RESTORE : SW_SHOW);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4626 my_show_window (f, FRAME_W32_WINDOW (f), SW_SHOWNORMAL);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4627 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4628
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4629 /* Synchronize to ensure Emacs knows the frame is visible
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4630 before we do anything else. We do this loop with input not blocked
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4631 so that incoming events are handled. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4632 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4633 Lisp_Object frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4634 int count = input_signal_count;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4635
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4636 /* This must come after we set COUNT. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4637 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4638
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4639 XSETFRAME (frame, f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4640
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4641 while (1)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4642 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4643 /* Once we have handled input events,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4644 we should have received the MapNotify if one is coming.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4645 So if we have not got it yet, stop looping.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4646 Some window managers make their own decisions
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4647 about visibility. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4648 if (input_signal_count != count)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4649 break;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4650 /* Machines that do polling rather than SIGIO have been observed
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4651 to go into a busy-wait here. So we'll fake an alarm signal
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4652 to let the handler know that there's something to be read.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4653 We used to raise a real alarm, but it seems that the handler
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4654 isn't always enabled here. This is probably a bug. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4655 if (input_polling_used ())
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4656 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4657 /* It could be confusing if a real alarm arrives while processing
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4658 the fake one. Turn it off and let the handler reset it. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4659 alarm (0);
21831
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
4660 input_poll_signal (0);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4661 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4662 /* Once we have handled input events,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4663 we should have received the MapNotify if one is coming.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4664 So if we have not got it yet, stop looping.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4665 Some window managers make their own decisions
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4666 about visibility. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4667 if (input_signal_count != count)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4668 break;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4669 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4670 FRAME_SAMPLE_VISIBILITY (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4671 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4672 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4673
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4674 /* Change from mapped state to withdrawn state. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4675
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4676 /* Make the frame visible (mapped and not iconified). */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4677
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4678 x_make_frame_invisible (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4679 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4680 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4681 Window window;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4682
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4683 /* Don't keep the highlight on an invisible frame. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4684 if (FRAME_W32_DISPLAY_INFO (f)->w32_highlight_frame == f)
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4685 FRAME_W32_DISPLAY_INFO (f)->w32_highlight_frame = 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4686
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4687 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4688
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4689 my_show_window (f, FRAME_W32_WINDOW (f), SW_HIDE);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4690
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4691 /* We can't distinguish this from iconification
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4692 just by the event that we get from the server.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4693 So we can't win using the usual strategy of letting
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4694 FRAME_SAMPLE_VISIBILITY set this. So do it by hand,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4695 and synchronize with the server to make sure we agree. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4696 f->visible = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4697 FRAME_ICONIFIED_P (f) = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4698 f->async_visible = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4699 f->async_iconified = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4700
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4701 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4702 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4703
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4704 /* Change window state from mapped to iconified. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4705
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
4706 void
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
4707 x_iconify_frame (f)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4708 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4709 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4710 int result;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4711
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4712 /* Don't keep the highlight on an invisible frame. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4713 if (FRAME_W32_DISPLAY_INFO (f)->w32_highlight_frame == f)
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4714 FRAME_W32_DISPLAY_INFO (f)->w32_highlight_frame = 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4715
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4716 if (f->async_iconified)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4717 return;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4718
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4719 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4720
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4721 /* Simulate the user minimizing the frame. */
23951
ef1cba882819 (x_iconify_frame): Wait for frame to be iconified; do
Andrew Innes <andrewi@gnu.org>
parents: 23806
diff changeset
4722 SendMessage (FRAME_W32_WINDOW (f), WM_SYSCOMMAND, SC_MINIMIZE, 0);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4723
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4724 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4725 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4726
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4727 /* Destroy the window of frame F. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4728
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4729 x_destroy_window (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4730 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4731 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4732 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4733
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4734 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4735
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4736 my_destroy_window (f, FRAME_W32_WINDOW (f));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4737 free_frame_menubar (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4738 free_frame_faces (f);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4739
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4740 xfree (f->output_data.w32);
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4741 f->output_data.w32 = 0;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4742 if (f == dpyinfo->w32_focus_frame)
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4743 dpyinfo->w32_focus_frame = 0;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4744 if (f == dpyinfo->w32_focus_event_frame)
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4745 dpyinfo->w32_focus_event_frame = 0;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4746 if (f == dpyinfo->w32_highlight_frame)
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4747 dpyinfo->w32_highlight_frame = 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4748
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4749 dpyinfo->reference_count--;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4750
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4751 if (f == dpyinfo->mouse_face_mouse_frame)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4752 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4753 dpyinfo->mouse_face_beg_row
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4754 = dpyinfo->mouse_face_beg_col = -1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4755 dpyinfo->mouse_face_end_row
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4756 = dpyinfo->mouse_face_end_col = -1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4757 dpyinfo->mouse_face_window = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4758 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4759
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4760 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4761 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4762
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4763 /* Setting window manager hints. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4764
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4765 /* Set the normal size hints for the window manager, for frame F.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4766 FLAGS is the flags word to use--or 0 meaning preserve the flags
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4767 that the window now has.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4768 If USER_POSITION is nonzero, we set the USPosition
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4769 flag (this is useful when FLAGS is 0). */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4770
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4771 x_wm_set_size_hint (f, flags, user_position)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4772 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4773 long flags;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4774 int user_position;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4775 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4776 Window window = FRAME_W32_WINDOW (f);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4777
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4778 flexlines = f->height;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4779
14351
fb2ce4ebc871 ubackout 1.3 and 1.4
Geoff Voelker <voelker@cs.washington.edu>
parents: 14248
diff changeset
4780 enter_crit ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4781
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4782 SetWindowLong (window, WND_FONTWIDTH_INDEX, FONT_WIDTH (f->output_data.w32->font));
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4783 SetWindowLong (window, WND_LINEHEIGHT_INDEX, f->output_data.w32->line_height);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4784 SetWindowLong (window, WND_BORDER_INDEX, f->output_data.w32->internal_border_width);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
4785 SetWindowLong (window, WND_SCROLLBAR_INDEX, f->output_data.w32->vertical_scroll_bar_extra);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4786
14351
fb2ce4ebc871 ubackout 1.3 and 1.4
Geoff Voelker <voelker@cs.washington.edu>
parents: 14248
diff changeset
4787 leave_crit ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4788 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4789
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4790 /* Window manager things */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4791 x_wm_set_icon_position (f, icon_x, icon_y)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4792 struct frame *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4793 int icon_x, icon_y;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4794 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4795 #if 0
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4796 Window window = FRAME_W32_WINDOW (f);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4797
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4798 f->display.x->wm_hints.flags |= IconPositionHint;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4799 f->display.x->wm_hints.icon_x = icon_x;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4800 f->display.x->wm_hints.icon_y = icon_y;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4801
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4802 XSetWMHints (FRAME_X_DISPLAY (f), window, &f->display.x->wm_hints);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4803 #endif
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4804 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4805
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4806
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4807 /* Initialization. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4808
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4809 #ifdef USE_X_TOOLKIT
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4810 static XrmOptionDescRec emacs_options[] = {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4811 {"-geometry", ".geometry", XrmoptionSepArg, NULL},
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4812 {"-iconic", ".iconic", XrmoptionNoArg, (XtPointer) "yes"},
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4813
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4814 {"-internal-border-width", "*EmacsScreen.internalBorderWidth",
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4815 XrmoptionSepArg, NULL},
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4816 {"-ib", "*EmacsScreen.internalBorderWidth", XrmoptionSepArg, NULL},
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4817
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4818 {"-T", "*EmacsShell.title", XrmoptionSepArg, (XtPointer) NULL},
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4819 {"-wn", "*EmacsShell.title", XrmoptionSepArg, (XtPointer) NULL},
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4820 {"-title", "*EmacsShell.title", XrmoptionSepArg, (XtPointer) NULL},
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4821 {"-iconname", "*EmacsShell.iconName", XrmoptionSepArg, (XtPointer) NULL},
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4822 {"-in", "*EmacsShell.iconName", XrmoptionSepArg, (XtPointer) NULL},
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4823 {"-mc", "*pointerColor", XrmoptionSepArg, (XtPointer) NULL},
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4824 {"-cr", "*cursorColor", XrmoptionSepArg, (XtPointer) NULL}
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4825 };
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4826 #endif /* USE_X_TOOLKIT */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4827
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4828 static int w32_initialized = 0;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4829
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4830 struct w32_display_info *
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4831 w32_term_init (display_name, xrm_option, resource_name)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4832 Lisp_Object display_name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4833 char *xrm_option;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4834 char *resource_name;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4835 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4836 Lisp_Object frame;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4837 char *defaultvalue;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4838 struct w32_display_info *dpyinfo;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4839 HDC hdc;
14351
fb2ce4ebc871 ubackout 1.3 and 1.4
Geoff Voelker <voelker@cs.washington.edu>
parents: 14248
diff changeset
4840
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4841 BLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4842
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4843 if (!w32_initialized)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4844 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4845 w32_initialize ();
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4846 w32_initialized = 1;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4847 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4848
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4849 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4850 int argc = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4851 char *argv[3];
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4852
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4853 argv[0] = "";
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4854 argc = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4855 if (xrm_option)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4856 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4857 argv[argc++] = "-xrm";
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4858 argv[argc++] = xrm_option;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4859 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4860 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4861
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4862 dpyinfo = &one_w32_display_info;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4863
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4864 /* Put this display on the chain. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4865 dpyinfo->next = NULL;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4866
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4867 /* Put it on w32_display_name_list as well, to keep them parallel. */
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4868 w32_display_name_list = Fcons (Fcons (display_name, Qnil),
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4869 w32_display_name_list);
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4870 dpyinfo->name_list_element = XCONS (w32_display_name_list)->car;
14351
fb2ce4ebc871 ubackout 1.3 and 1.4
Geoff Voelker <voelker@cs.washington.edu>
parents: 14248
diff changeset
4871
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4872 dpyinfo->w32_id_name
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4873 = (char *) xmalloc (XSTRING (Vinvocation_name)->size
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4874 + XSTRING (Vsystem_name)->size
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4875 + 2);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4876 sprintf (dpyinfo->w32_id_name, "%s@%s",
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4877 XSTRING (Vinvocation_name)->data, XSTRING (Vsystem_name)->data);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4878
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4879 #if 0
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4880 xrdb = x_load_resources (dpyinfo->display, xrm_option,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4881 resource_name, EMACS_CLASS);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4882
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4883 /* Put the rdb where we can find it in a way that works on
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4884 all versions. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4885 dpyinfo->xrdb = xrdb;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4886 #endif
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
4887 hdc = GetDC (GetDesktopWindow ());
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4888
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4889 dpyinfo->height = GetDeviceCaps (hdc, VERTRES);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4890 dpyinfo->width = GetDeviceCaps (hdc, HORZRES);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4891 dpyinfo->root_window = GetDesktopWindow ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4892 dpyinfo->n_planes = GetDeviceCaps (hdc, PLANES);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4893 dpyinfo->n_cbits = GetDeviceCaps (hdc, BITSPIXEL);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4894 dpyinfo->height_in = GetDeviceCaps (hdc, LOGPIXELSX);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4895 dpyinfo->width_in = GetDeviceCaps (hdc, LOGPIXELSY);
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
4896 dpyinfo->has_palette = GetDeviceCaps (hdc, RASTERCAPS) & RC_PALETTE;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4897 dpyinfo->grabbed = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4898 dpyinfo->reference_count = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4899 dpyinfo->n_fonts = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4900 dpyinfo->font_table_size = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4901 dpyinfo->bitmaps = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4902 dpyinfo->bitmaps_size = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4903 dpyinfo->bitmaps_last = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4904 dpyinfo->mouse_face_mouse_frame = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4905 dpyinfo->mouse_face_deferred_gc = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4906 dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4907 dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4908 dpyinfo->mouse_face_face_id = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4909 dpyinfo->mouse_face_window = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4910 dpyinfo->mouse_face_mouse_x = dpyinfo->mouse_face_mouse_y = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4911 dpyinfo->mouse_face_defer = 0;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4912 dpyinfo->w32_focus_frame = 0;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4913 dpyinfo->w32_focus_event_frame = 0;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4914 dpyinfo->w32_highlight_frame = 0;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4915
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4916 ReleaseDC (GetDesktopWindow (), hdc);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4917
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
4918 /* Determine if there is a middle mouse button, to allow parse_button
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
4919 to decide whether right mouse events should be mouse-2 or
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
4920 mouse-3. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4921 XSETINT (Vw32_num_mouse_buttons, GetSystemMetrics (SM_CMOUSEBUTTONS));
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
4922
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
4923 /* initialise palette with white and black */
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
4924 {
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
4925 COLORREF color;
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
4926 defined_color (0, "white", &color, 1);
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
4927 defined_color (0, "black", &color, 1);
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
4928 }
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
4929
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4930 #ifndef F_SETOWN_BUG
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4931 #ifdef F_SETOWN
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4932 #ifdef F_SETOWN_SOCK_NEG
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4933 /* stdin is a socket here */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4934 fcntl (connection, F_SETOWN, -getpid ());
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4935 #else /* ! defined (F_SETOWN_SOCK_NEG) */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4936 fcntl (connection, F_SETOWN, getpid ());
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4937 #endif /* ! defined (F_SETOWN_SOCK_NEG) */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4938 #endif /* ! defined (F_SETOWN) */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4939 #endif /* F_SETOWN_BUG */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4940
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4941 #ifdef SIGIO
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4942 if (interrupt_input)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4943 init_sigio (connection);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4944 #endif /* ! defined (SIGIO) */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4945
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4946 UNBLOCK_INPUT;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4947
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4948 return dpyinfo;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4949 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4950
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4951 /* Get rid of display DPYINFO, assuming all frames are already gone. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4952
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4953 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4954 x_delete_display (dpyinfo)
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4955 struct w32_display_info *dpyinfo;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4956 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4957 /* Discard this display from w32_display_name_list and w32_display_list.
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4958 We can't use Fdelq because that can quit. */
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4959 if (! NILP (w32_display_name_list)
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4960 && EQ (XCONS (w32_display_name_list)->car, dpyinfo->name_list_element))
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4961 w32_display_name_list = XCONS (w32_display_name_list)->cdr;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4962 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4963 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4964 Lisp_Object tail;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4965
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4966 tail = w32_display_name_list;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4967 while (CONSP (tail) && CONSP (XCONS (tail)->cdr))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4968 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4969 if (EQ (XCONS (XCONS (tail)->cdr)->car,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4970 dpyinfo->name_list_element))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4971 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4972 XCONS (tail)->cdr = XCONS (XCONS (tail)->cdr)->cdr;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4973 break;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4974 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4975 tail = XCONS (tail)->cdr;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4976 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4977 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4978
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
4979 /* free palette table */
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
4980 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4981 struct w32_palette_entry * plist;
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
4982
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
4983 plist = dpyinfo->color_list;
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
4984 while (plist)
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
4985 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4986 struct w32_palette_entry * pentry = plist;
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
4987 plist = plist->next;
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
4988 xfree(pentry);
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
4989 }
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
4990 dpyinfo->color_list = NULL;
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
4991 if (dpyinfo->palette)
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
4992 DeleteObject(dpyinfo->palette);
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
4993 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4994 xfree (dpyinfo->font_table);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4995 xfree (dpyinfo->w32_id_name);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4996 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4997
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
4998 /* Set up use of W32. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4999
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
5000 DWORD w32_msg_worker ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5001
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
5002 w32_initialize ()
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5003 {
21831
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
5004 /* MSVC does not type K&R functions with no arguments correctly, and
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
5005 so we must explicitly cast them. */
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
5006 clear_frame_hook = (void (*)(void)) w32_clear_frame;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
5007 clear_end_of_line_hook = w32_clear_end_of_line;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
5008 ins_del_lines_hook = w32_ins_del_lines;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
5009 change_line_highlight_hook = w32_change_line_highlight;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
5010 insert_glyphs_hook = w32_insert_glyphs;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
5011 write_glyphs_hook = w32_write_glyphs;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
5012 delete_glyphs_hook = w32_delete_glyphs;
21831
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
5013 ring_bell_hook = (void (*)(void)) w32_ring_bell;
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
5014 reset_terminal_modes_hook = (void (*)(void)) w32_reset_terminal_modes;
6b659713b90b Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21740
diff changeset
5015 set_terminal_modes_hook = (void (*)(void)) w32_set_terminal_modes;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
5016 update_begin_hook = w32_update_begin;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
5017 update_end_hook = w32_update_end;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
5018 set_terminal_window_hook = w32_set_terminal_window;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5019 read_socket_hook = w32_read_socket;
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
5020 frame_up_to_date_hook = w32_frame_up_to_date;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
5021 cursor_to_hook = w32_cursor_to;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
5022 reassert_line_highlight_hook = w32_reassert_line_highlight;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
5023 mouse_position_hook = w32_mouse_position;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
5024 frame_rehighlight_hook = w32_frame_rehighlight;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
5025 frame_raise_lower_hook = w32_frame_raise_lower;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
5026 set_vertical_scroll_bar_hook = w32_set_vertical_scroll_bar;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
5027 condemn_scroll_bars_hook = w32_condemn_scroll_bars;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
5028 redeem_scroll_bar_hook = w32_redeem_scroll_bar;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
5029 judge_scroll_bars_hook = w32_judge_scroll_bars;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5030
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5031 scroll_region_ok = 1; /* we'll scroll partial frames */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5032 char_ins_del_ok = 0; /* just as fast to write the line */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5033 line_ins_del_ok = 1; /* we'll just blt 'em */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5034 fast_clear_end_of_line = 1; /* X does this well */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5035 memory_below_frame = 0; /* we don't remember what scrolls
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5036 off the bottom */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5037 baud_rate = 19200;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5038
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
5039 /* Initialize input mode: interrupt_input off, no flow control, allow
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
5040 8 bit character input, standard quit char. */
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
5041 Fset_input_mode (Qnil, Qnil, make_number (2), Qnil);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5042
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5043 /* Create the window thread - it will terminate itself or when the app terminates */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5044
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5045 init_crit ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5046
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5047 dwMainThreadId = GetCurrentThreadId ();
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5048 DuplicateHandle (GetCurrentProcess (), GetCurrentThread (),
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5049 GetCurrentProcess (), &hMainThread, 0, TRUE, DUPLICATE_SAME_ACCESS);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5050
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5051 /* Wait for thread to start */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5052
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5053 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5054 MSG msg;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5055
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5056 PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5057
16884
36babc489b0c Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents: 16588
diff changeset
5058 hWindowsThread = CreateThread (NULL, 0,
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
5059 (LPTHREAD_START_ROUTINE) w32_msg_worker,
16884
36babc489b0c Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents: 16588
diff changeset
5060 0, 0, &dwWindowsThreadId);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5061
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5062 GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5063 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5064
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
5065 /* It is desirable that mainThread should have the same notion of
16884
36babc489b0c Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents: 16588
diff changeset
5066 focus window and active window as windowsThread. Unfortunately, the
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
5067 following call to AttachThreadInput, which should do precisely what
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
5068 we need, causes major problems when Emacs is linked as a console
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
5069 program. Unfortunately, we have good reasons for doing that, so
16884
36babc489b0c Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents: 16588
diff changeset
5070 instead we need to send messages to windowsThread to make some API
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
5071 calls for us (ones that affect, or depend on, the active/focus
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
5072 window state. */
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
5073 #ifdef ATTACH_THREADS
16884
36babc489b0c Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents: 16588
diff changeset
5074 AttachThreadInput (dwMainThreadId, dwWindowsThreadId, TRUE);
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
5075 #endif
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
5076
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
5077 /* Dynamically link to optional system components. */
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
5078 {
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
5079 HANDLE user_lib = LoadLibrary ("user32.dll");
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
5080
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
5081 #define LOAD_PROC(fn) pfn##fn = (void *) GetProcAddress (user_lib, #fn)
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
5082
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
5083 /* New proportional scroll bar functions. */
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
5084 LOAD_PROC( SetScrollInfo );
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
5085 LOAD_PROC( GetScrollInfo );
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
5086
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
5087 #undef LOAD_PROC
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
5088
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
5089 FreeLibrary (user_lib);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
5090
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
5091 /* If using proportional scroll bars, ensure handle is at least 5 pixels;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
5092 otherwise use the fixed height. */
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
5093 vertical_scroll_bar_min_handle = (pfnSetScrollInfo != NULL) ? 5 :
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
5094 GetSystemMetrics (SM_CYVTHUMB);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
5095
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
5096 /* For either kind of scroll bar, take account of the arrows; these
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
5097 effectively form the border of the main scroll bar range. */
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
5098 vertical_scroll_bar_top_border = vertical_scroll_bar_bottom_border
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
5099 = GetSystemMetrics (SM_CYVSCROLL);
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
5100 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5101 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5102
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5103 void
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
5104 syms_of_w32term ()
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5105 {
24131
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5106 Lisp_Object codepage;
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5107
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
5108 staticpro (&w32_display_name_list);
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
5109 w32_display_name_list = Qnil;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5110
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5111 staticpro (&last_mouse_scroll_bar);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5112 last_mouse_scroll_bar = Qnil;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5113
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5114 staticpro (&Qvendor_specific_keysyms);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5115 Qvendor_specific_keysyms = intern ("vendor-specific-keysyms");
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
5116
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
5117 DEFVAR_INT ("w32-num-mouse-buttons",
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
5118 &Vw32_num_mouse_buttons,
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
5119 "Number of physical mouse buttons.");
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
5120 Vw32_num_mouse_buttons = Qnil;
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
5121
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
5122 DEFVAR_LISP ("w32-swap-mouse-buttons",
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
5123 &Vw32_swap_mouse_buttons,
15151
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
5124 "Swap the mapping of middle and right mouse buttons.\n\
ed6ddfc0d954 (Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15035
diff changeset
5125 When nil, middle button is mouse-2 and right button is mouse-3.");
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 16326
diff changeset
5126 Vw32_swap_mouse_buttons = Qnil;
19713
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
5127
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
5128 DEFVAR_LISP ("w32-grab-focus-on-raise",
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
5129 &Vw32_grab_focus_on_raise,
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
5130 "Raised frame grabs input focus.\n\
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
5131 When t, `raise-frame' grabs input focus as well. This fits well\n\
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
5132 with the normal Windows click-to-focus policy, but might not be\n\
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
5133 desirable when using a point-to-focus policy.");
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
5134 Vw32_grab_focus_on_raise = Qt;
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
5135
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
5136 DEFVAR_LISP ("w32-capslock-is-shiftlock",
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
5137 &Vw32_capslock_is_shiftlock,
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
5138 "Apply CapsLock state to non character input keys.\n\
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
5139 When nil, CapsLock only affects normal character input keys.");
043ccce224fb (SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents: 18877
diff changeset
5140 Vw32_capslock_is_shiftlock = Qnil;
21614
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
5141
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
5142 DEFVAR_LISP ("w32-recognize-altgr",
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
5143 &Vw32_recognize_altgr,
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
5144 "Recognize right-alt and left-ctrl as AltGr.\n\
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
5145 When nil, the right-alt and left-ctrl key combination is\n\
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
5146 interpreted normally.");
2624d8dcc73f (Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents: 21456
diff changeset
5147 Vw32_recognize_altgr = Qt;
23638
e6fb9ffee4f4 (dumpglyphs): Use FRAME_FONT for w32_fill_area.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23510
diff changeset
5148
23639
516fc58a7b7b (w32_enable_unicode_output): Rename from
Geoff Voelker <voelker@cs.washington.edu>
parents: 23638
diff changeset
5149 DEFVAR_BOOL ("w32-enable-unicode-output",
516fc58a7b7b (w32_enable_unicode_output): Rename from
Geoff Voelker <voelker@cs.washington.edu>
parents: 23638
diff changeset
5150 &w32_enable_unicode_output,
516fc58a7b7b (w32_enable_unicode_output): Rename from
Geoff Voelker <voelker@cs.washington.edu>
parents: 23638
diff changeset
5151 "Enable the use of Unicode for text output if non-nil.\n\
23507
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
5152 Unicode output may prevent some third party applications for displaying\n\
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
5153 Far-East Languages on Windows 95/98 from working properly.\n\
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
5154 NT uses Unicode internally anyway, so this flag will probably have no\n\
8a448630a9b5 Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22059
diff changeset
5155 affect on NT machines.");
23639
516fc58a7b7b (w32_enable_unicode_output): Rename from
Geoff Voelker <voelker@cs.washington.edu>
parents: 23638
diff changeset
5156 w32_enable_unicode_output = 1;
24131
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5157
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5158 DEFVAR_LISP ("w32-charset-to-codepage-alist",
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5159 &Vw32_charset_to_codepage_alist,
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5160 "Alist linking character sets to Windows Codepages.");
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5161 Vw32_charset_to_codepage_alist = Qnil;
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5162 /* Initialise the alist with some defaults. */
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5163 XSETFASTINT (codepage, 936);
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5164 store_in_alist (&Vw32_charset_to_codepage_alist,
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5165 build_string ("gb2312"), codepage);
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5166 XSETFASTINT (codepage, 950);
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5167 store_in_alist (&Vw32_charset_to_codepage_alist,
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5168 build_string ("big5"), codepage);
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5169 XSETFASTINT (codepage, 949);
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5170 store_in_alist (&Vw32_charset_to_codepage_alist,
24146
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
5171 build_string ("ksc5601.1987"), codepage);
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
5172 XSETFASTINT (codepage, 1361);
24131
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5173 store_in_alist (&Vw32_charset_to_codepage_alist,
24146
9ed2245a9b79 (W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents: 24131
diff changeset
5174 build_string ("ksc5601.1992"), codepage);
24131
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5175 XSETFASTINT (codepage, 932);
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5176 store_in_alist (&Vw32_charset_to_codepage_alist,
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5177 build_string ("jisx0208-sjis"), codepage);
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5178 XSETFASTINT (codepage, 874);
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5179 store_in_alist (&Vw32_charset_to_codepage_alist,
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5180 build_string ("tis620"), codepage);
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5181 XSETFASTINT (codepage, 20866);
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5182 store_in_alist (&Vw32_charset_to_codepage_alist,
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5183 build_string ("koi8-r"), codepage);
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5184 /* iso8859-13 is not yet officially adopted, but it is conveniently
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5185 covered by CP 1257. */
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5186 XSETFASTINT (codepage, 1257);
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5187 store_in_alist (&Vw32_charset_to_codepage_alist,
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5188 build_string ("iso8859-13"), codepage);
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5189 XSETFASTINT (codepage, 1254);
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5190 store_in_alist (&Vw32_charset_to_codepage_alist,
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5191 build_string ("iso8859-9"), codepage);
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5192 XSETFASTINT (codepage, 1255);
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5193 store_in_alist (&Vw32_charset_to_codepage_alist,
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5194 build_string ("iso8859-8"), codepage);
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5195 XSETFASTINT (codepage, 28597);
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5196 store_in_alist (&Vw32_charset_to_codepage_alist,
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5197 build_string ("iso8859-7"), codepage);
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5198 XSETFASTINT (codepage, 28596);
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5199 store_in_alist (&Vw32_charset_to_codepage_alist,
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5200 build_string ("iso8859-6"), codepage);
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5201 XSETFASTINT (codepage, 28595);
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5202 store_in_alist (&Vw32_charset_to_codepage_alist,
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5203 build_string ("iso8859-5"), codepage);
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5204 XSETFASTINT (codepage, 28594);
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5205 store_in_alist (&Vw32_charset_to_codepage_alist,
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5206 build_string ("iso8859-4"), codepage);
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5207 XSETFASTINT (codepage, 28593);
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5208 store_in_alist (&Vw32_charset_to_codepage_alist,
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5209 build_string ("iso8859-3"), codepage);
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5210 XSETFASTINT (codepage, 28592);
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5211 store_in_alist (&Vw32_charset_to_codepage_alist,
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5212 build_string ("iso8859-2"), codepage);
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5213 XSETFASTINT (codepage, 1252);
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5214 store_in_alist (&Vw32_charset_to_codepage_alist,
34f6ec762e5e Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents: 23951
diff changeset
5215 build_string ("iso8859-1"), codepage);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5216 }