comparison src/scrollbar-msw.c @ 464:5aa1854ad537 r21-2-47

Import from CVS: tag r21-2-47
author cvs
date Mon, 13 Aug 2007 11:45:51 +0200
parents abe6d1db359e
children 54fa1a5c2d12
comparison
equal deleted inserted replaced
463:a158004111cd 464:5aa1854ad537
264 break; 264 break;
265 } 265 }
266 } 266 }
267 267
268 static int 268 static int
269 can_scroll(struct scrollbar_instance* scrollbar) 269 can_scroll (struct scrollbar_instance* scrollbar)
270 { 270 {
271 return scrollbar != NULL 271 return scrollbar != NULL
272 && IsWindowVisible (SCROLLBAR_MSW_HANDLE (scrollbar)) 272 && IsWindowVisible (SCROLLBAR_MSW_HANDLE (scrollbar))
273 && IsWindowEnabled (SCROLLBAR_MSW_HANDLE (scrollbar)); 273 && IsWindowEnabled (SCROLLBAR_MSW_HANDLE (scrollbar));
274 } 274 }
275 275
276 int 276 int
277 mswindows_handle_mousewheel_event (Lisp_Object frame, int keys, int delta) 277 mswindows_handle_mousewheel_event (Lisp_Object frame, int keys, int delta,
278 POINTS where)
278 { 279 {
279 int hasVertBar, hasHorzBar; /* Indicates presence of scroll bars */ 280 int hasVertBar, hasHorzBar; /* Indicates presence of scroll bars */
280 unsigned wheelScrollLines = 0; /* Number of lines per wheel notch */ 281 unsigned wheelScrollLines = 0; /* Number of lines per wheel notch */
281 282 Lisp_Object win;
282 /* Find the currently selected window */ 283 struct window_mirror *mirror;
283 Lisp_Object win = FRAME_SELECTED_WINDOW (XFRAME (frame)); 284 POINT donde_esta;
284 struct window* w = XWINDOW (win); 285
285 struct window_mirror* mirror = find_window_mirror (w); 286 donde_esta.x = where.x;
287 donde_esta.y = where.y;
288
289 ScreenToClient (FRAME_MSWINDOWS_HANDLE (XFRAME (frame)), &donde_esta);
290
291 /* Find the window to scroll */
292 {
293 int mene, _mene, tekel, upharsin;
294 Bufpos mens, sana;
295 Charcount in;
296 Lisp_Object corpore, sano;
297 struct window *needle_in_haystack;
298
299 // stderr_out ("donde_esta: %d %d\n", donde_esta.x, donde_esta.y);
300 pixel_to_glyph_translation (XFRAME (frame), donde_esta.x, donde_esta.y,
301 &mene, &_mene, &tekel, &upharsin,
302 &needle_in_haystack,
303 &mens, &sana, &in, &corpore, &sano);
304
305 if (needle_in_haystack)
306 {
307 XSETWINDOW (win, needle_in_haystack);
308 // stderr_out ("found needle\n");
309 // debug_print (win);
310 }
311 else
312 {
313 win = FRAME_SELECTED_WINDOW (XFRAME (frame));
314 needle_in_haystack = XWINDOW (win);
315 }
316
317 mirror = find_window_mirror (needle_in_haystack);
318 }
286 319
287 /* Check that there is something to scroll */ 320 /* Check that there is something to scroll */
288 hasVertBar = can_scroll (mirror->scrollbar_vertical_instance); 321 hasVertBar = can_scroll (mirror->scrollbar_vertical_instance);
289 hasHorzBar = can_scroll (mirror->scrollbar_horizontal_instance); 322 hasHorzBar = can_scroll (mirror->scrollbar_horizontal_instance);
290 if (!hasVertBar && !hasHorzBar) 323 if (!hasVertBar && !hasHorzBar)