comparison src/scrollbar-msw.c @ 546:666d73d6ac56

[xemacs-hg @ 2001-05-20 01:17:07 by ben] fixes so MinGW compiles. console-msw.h, scrollbar-msw.c, event-msw.c: we might receive scrollbar events on windows without scrollbars (e.g. holding down and moving the wheel button). dired.c: win9x support. eval.c: doc comment about gcpro'ing in record_unwind_protect. frame-msw.c: typo. frame.c: avoid problems with errors during init_frame_3. process-nt.c: remove unused mswindows-quote-process-args. rec for 21.4. unexcw.c: use do/while. autoload.el: Oops, off by one argument. mouse.el: Add an argument to mouse-track so that hooks can be overridden. (let-binding doesn't work when the hooks have been made local.) modify mouse-track-run-hook accordingly, and fix mouse-track-default and mouse-track-insert to use the new functionality. printer.el: Oops, off by one paren.
author ben
date Sun, 20 May 2001 01:17:16 +0000
parents 54fa1a5c2d12
children 38db05db9cb5
comparison
equal deleted inserted replaced
545:9a775fb11bb7 546:666d73d6ac56
54 orientation = SBS_VERT; 54 orientation = SBS_VERT;
55 else 55 else
56 orientation = SBS_HORZ; 56 orientation = SBS_HORZ;
57 57
58 SCROLLBAR_MSW_HANDLE (sb) = 58 SCROLLBAR_MSW_HANDLE (sb) =
59 CreateWindowEx(0, "SCROLLBAR", 0, orientation|WS_CHILD, 59 CreateWindowEx (0, "SCROLLBAR", 0, orientation|WS_CHILD,
60 CW_USEDEFAULT, CW_USEDEFAULT, 60 CW_USEDEFAULT, CW_USEDEFAULT,
61 CW_USEDEFAULT, CW_USEDEFAULT, 61 CW_USEDEFAULT, CW_USEDEFAULT,
62 FRAME_MSWINDOWS_HANDLE (f), 62 FRAME_MSWINDOWS_HANDLE (f),
63 NULL, NULL, NULL); 63 NULL, NULL, NULL);
64 SCROLLBAR_MSW_INFO (sb).cbSize = sizeof(SCROLLINFO); 64 SCROLLBAR_MSW_INFO (sb).cbSize = sizeof (SCROLLINFO);
65 SCROLLBAR_MSW_INFO (sb).fMask = SIF_ALL; 65 SCROLLBAR_MSW_INFO (sb).fMask = SIF_ALL;
66 GetScrollInfo(SCROLLBAR_MSW_HANDLE (sb), SB_CTL, 66 GetScrollInfo(SCROLLBAR_MSW_HANDLE (sb), SB_CTL,
67 &SCROLLBAR_MSW_INFO (sb)); 67 &SCROLLBAR_MSW_INFO (sb));
68 SetWindowLong (SCROLLBAR_MSW_HANDLE(sb), GWL_USERDATA, (LONG)sb); 68 SetWindowLong (SCROLLBAR_MSW_HANDLE (sb), GWL_USERDATA, (LONG) sb);
69 69
70 #if 0 70 #if 0
71 { 71 {
72 HWND h = SCROLLBAR_MSW_HANDLE (sb); 72 HWND h = SCROLLBAR_MSW_HANDLE (sb);
73 int x = SetWindowLong (SCROLLBAR_MSW_HANDLE(sb), GWL_USERDATA, (LONG)sb); 73 int x = SetWindowLong (SCROLLBAR_MSW_HANDLE(sb), GWL_USERDATA, (LONG)sb);
74 int y = GetLastError(); 74 int y = GetLastError();
75 struct scrollbar_instance *z = (struct scrollbar_instance *)GetWindowLong (SCROLLBAR_MSW_HANDLE(sb), 75 struct scrollbar_instance *z =
76 GWL_USERDATA); 76 (struct scrollbar_instance *)GetWindowLong (SCROLLBAR_MSW_HANDLE(sb),
77 *z = *z; 77 GWL_USERDATA);
78 *z = *z;
78 } 79 }
79 #endif 80 #endif
80 } 81 }
81 82
82 static void 83 static void
178 struct scrollbar_instance *sb; 179 struct scrollbar_instance *sb;
179 SCROLLINFO scrollinfo; 180 SCROLLINFO scrollinfo;
180 int vert = GetWindowLong (hwnd, GWL_STYLE) & SBS_VERT; 181 int vert = GetWindowLong (hwnd, GWL_STYLE) & SBS_VERT;
181 int value; 182 int value;
182 183
183 sb = (struct scrollbar_instance *)GetWindowLong (hwnd, GWL_USERDATA); 184 sb = (struct scrollbar_instance *) GetWindowLong (hwnd, GWL_USERDATA);
184 win = real_window (sb->mirror, 1); 185 if (!sb)
185 frame = XWINDOW (win)->frame; 186 {
186 f = XFRAME (frame); 187 frame = mswindows_find_frame (hwnd);
188 f = XFRAME (frame);
189 win = FRAME_SELECTED_WINDOW (f);
190 }
191 else
192 {
193 win = real_window (sb->mirror, 0);
194 frame = XWINDOW (win)->frame;
195 f = XFRAME (frame);
196 }
187 197
188 /* SB_LINEDOWN == SB_CHARLEFT etc. This is the way they will 198 /* SB_LINEDOWN == SB_CHARLEFT etc. This is the way they will
189 always be - any Windows is binary compatible backward with 199 always be - any Windows is binary compatible backward with
190 old programs */ 200 old programs */
191 201
253 Fcons (win, make_int (value))); 263 Fcons (win, make_int (value)));
254 break; 264 break;
255 265
256 case SB_ENDSCROLL: 266 case SB_ENDSCROLL:
257 #ifdef VERTICAL_SCROLLBAR_DRAG_HACK 267 #ifdef VERTICAL_SCROLLBAR_DRAG_HACK
258 if (vertical_drag_in_progress) 268 if (vertical_drag_in_progress && sb)
259 /* User has just dropped the thumb - finally update it */ 269 /* User has just dropped the thumb - finally update it */
260 SetScrollInfo (SCROLLBAR_MSW_HANDLE (sb), SB_CTL, 270 SetScrollInfo (SCROLLBAR_MSW_HANDLE (sb), SB_CTL,
261 &SCROLLBAR_MSW_INFO (sb), TRUE); 271 &SCROLLBAR_MSW_INFO (sb), TRUE);
262 #endif 272 #endif
263 vertical_drag_in_progress = 0; 273 vertical_drag_in_progress = 0;