Mercurial > hg > xemacs-beta
annotate src/scrollbar-msw.c @ 5676:dede3f658f8e
Sanity check package roots in configure.
| author | Stephen J. Turnbull <stephen@xemacs.org> |
|---|---|
| date | Sat, 04 Aug 2012 23:26:26 +0900 |
| parents | 56144c8593a8 |
| children | 0f2338afbabf |
| rev | line source |
|---|---|
| 428 | 1 /* scrollbar implementation -- mswindows interface. |
| 2 Copyright (C) 1994, 1995 Board of Trustees, University of Illinois. | |
| 3 Copyright (C) 1994 Amdahl Corporation. | |
| 4 Copyright (C) 1995 Sun Microsystems, Inc. | |
| 5 Copyright (C) 1995 Darrell Kindred <dkindred+@cmu.edu>. | |
|
5169
6c6d78781d59
cleanup of code related to xfree(), better KKCC backtrace capabilities, document XD_INLINE_LISP_OBJECT_BLOCK_PTR, fix some memory leaks, other code cleanup
Ben Wing <ben@xemacs.org>
parents:
5157
diff
changeset
|
6 Copyright (C) 2001, 2002, 2010 Ben Wing. |
| 428 | 7 |
| 8 This file is part of XEmacs. | |
| 9 | |
|
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5191
diff
changeset
|
10 XEmacs is free software: you can redistribute it and/or modify it |
| 428 | 11 under the terms of the GNU General Public License as published by the |
|
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5191
diff
changeset
|
12 Free Software Foundation, either version 3 of the License, or (at your |
|
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5191
diff
changeset
|
13 option) any later version. |
| 428 | 14 |
| 15 XEmacs is distributed in the hope that it will be useful, but WITHOUT | |
| 16 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
| 17 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
| 18 for more details. | |
| 19 | |
| 20 You should have received a copy of the GNU General Public License | |
|
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
5191
diff
changeset
|
21 along with XEmacs. If not, see <http://www.gnu.org/licenses/>. */ |
| 428 | 22 |
| 23 /* Synched up with: Not in FSF. */ | |
| 24 | |
| 771 | 25 /* This file essentially Mule-ized (except perhaps some Unicode splitting). |
| 26 5-2000. */ | |
| 27 | |
| 428 | 28 #include <config.h> |
| 29 #include "lisp.h" | |
| 30 | |
| 800 | 31 #include "device.h" |
| 617 | 32 #include "elhash.h" |
| 428 | 33 #include "events.h" |
| 872 | 34 #include "frame-impl.h" |
| 617 | 35 #include "opaque.h" |
| 428 | 36 #include "scrollbar.h" |
| 37 #include "specifier.h" | |
| 872 | 38 #include "window-impl.h" |
| 428 | 39 |
| 872 | 40 #include "console-msw-impl.h" |
| 800 | 41 #include "scrollbar-msw.h" |
| 42 | |
| 428 | 43 /* We use a similar sort of vertical scrollbar drag hack for mswindows |
| 44 * scrollbars as is used for Motif or Lucid scrollbars under X. | |
| 45 * We do character-based instead of line-based scrolling, which can mean that | |
| 46 * without the hack it is impossible to drag to the end of a buffer. */ | |
| 47 #define VERTICAL_SCROLLBAR_DRAG_HACK | |
| 48 | |
| 49 static int vertical_drag_in_progress = 0; | |
| 673 | 50 extern Lisp_Object mswindows_find_frame (HWND hwnd); |
| 428 | 51 |
| 617 | 52 /* As long as the HWND is around, the scrollbar instance must be GC-protected. |
| 53 We have gotten crashes, apparently from trying to access a dead, freed | |
| 54 frame inside of a window mirror pointed to by the scrollbar structure. */ | |
| 55 static Lisp_Object Vmswindows_scrollbar_instance_table; | |
| 56 | |
| 428 | 57 static void |
| 58 mswindows_create_scrollbar_instance (struct frame *f, int vertical, | |
| 59 struct scrollbar_instance *sb) | |
| 60 { | |
| 61 int orientation; | |
| 617 | 62 Lisp_Object ptr; |
| 442 | 63 |
| 428 | 64 sb->scrollbar_data = xnew_and_zero (struct mswindows_scrollbar_data); |
| 442 | 65 |
| 428 | 66 if (vertical) |
| 67 orientation = SBS_VERT; | |
| 68 else | |
| 69 orientation = SBS_HORZ; | |
| 442 | 70 |
| 428 | 71 SCROLLBAR_MSW_HANDLE (sb) = |
| 771 | 72 qxeCreateWindowEx (0, XETEXT ("SCROLLBAR"), 0, orientation|WS_CHILD, |
| 73 CW_USEDEFAULT, CW_USEDEFAULT, | |
| 74 CW_USEDEFAULT, CW_USEDEFAULT, | |
| 75 FRAME_MSWINDOWS_HANDLE (f), | |
| 76 NULL, NULL, NULL); | |
| 546 | 77 SCROLLBAR_MSW_INFO (sb).cbSize = sizeof (SCROLLINFO); |
| 428 | 78 SCROLLBAR_MSW_INFO (sb).fMask = SIF_ALL; |
| 617 | 79 GetScrollInfo (SCROLLBAR_MSW_HANDLE (sb), SB_CTL, |
| 80 &SCROLLBAR_MSW_INFO (sb)); | |
| 81 ptr = make_opaque_ptr (SCROLLBAR_MSW_HANDLE (sb)); | |
| 82 Fputhash (ptr, wrap_scrollbar_instance (sb), | |
| 83 Vmswindows_scrollbar_instance_table); | |
| 771 | 84 qxeSetWindowLong (SCROLLBAR_MSW_HANDLE (sb), GWL_USERDATA, |
| 5013 | 85 (LONG) STORE_LISP_IN_VOID (ptr)); |
| 428 | 86 } |
| 87 | |
| 88 static void | |
| 89 mswindows_free_scrollbar_instance (struct scrollbar_instance *sb) | |
| 90 { | |
| 3482 | 91 if (sb->scrollbar_data) |
| 92 { | |
| 93 void *opaque = | |
| 94 (void *) qxeGetWindowLong (SCROLLBAR_MSW_HANDLE (sb), GWL_USERDATA); | |
| 95 Lisp_Object ptr; | |
| 617 | 96 |
| 5013 | 97 ptr = GET_LISP_FROM_VOID (opaque); |
| 3482 | 98 assert (OPAQUE_PTRP (ptr)); |
| 99 ptr = Fremhash (ptr, Vmswindows_scrollbar_instance_table); | |
| 100 assert (!NILP (ptr)); | |
| 101 DestroyWindow (SCROLLBAR_MSW_HANDLE (sb)); | |
|
4976
16112448d484
Rename xfree(FOO, TYPE) -> xfree(FOO)
Ben Wing <ben@xemacs.org>
parents:
3482
diff
changeset
|
102 xfree (sb->scrollbar_data); |
|
5169
6c6d78781d59
cleanup of code related to xfree(), better KKCC backtrace capabilities, document XD_INLINE_LISP_OBJECT_BLOCK_PTR, fix some memory leaks, other code cleanup
Ben Wing <ben@xemacs.org>
parents:
5157
diff
changeset
|
103 sb->scrollbar_data = 0; |
| 3482 | 104 } |
| 428 | 105 } |
| 106 | |
| 107 static void | |
| 611 | 108 unshow_that_mofo (void *handle) |
| 109 { | |
| 110 ShowScrollBar ((HWND) handle, SB_CTL, 0); | |
| 111 } | |
| 112 | |
| 113 static void | |
| 428 | 114 mswindows_release_scrollbar_instance (struct scrollbar_instance *sb) |
| 115 { | |
| 611 | 116 if (gc_in_progress) |
| 117 /* #### way bogus! need to remove the offending call. | |
| 118 see mark_redisplay(). */ | |
| 119 register_post_gc_action (unshow_that_mofo, | |
| 120 (void *) SCROLLBAR_MSW_HANDLE (sb)); | |
| 121 else | |
| 122 ShowScrollBar (SCROLLBAR_MSW_HANDLE (sb), SB_CTL, 0); | |
| 428 | 123 SCROLLBAR_MSW_SIZE (sb) = 0; |
| 124 } | |
| 125 | |
| 126 #define UPDATE_POS_FIELD(field) \ | |
| 127 if (new_##field >= 0 && SCROLLBAR_MSW_DATA (sb)->field != new_##field) { \ | |
| 128 SCROLLBAR_MSW_DATA (sb)->field = new_##field; \ | |
| 129 pos_changed = 1; \ | |
| 130 } | |
| 131 | |
| 132 static void | |
| 2286 | 133 mswindows_update_scrollbar_instance_values (struct window *UNUSED (w), |
| 428 | 134 struct scrollbar_instance *sb, |
| 2286 | 135 int UNUSED (new_line_increment), |
| 136 int UNUSED (new_page_increment), | |
| 428 | 137 int new_minimum, int new_maximum, |
| 138 int new_slider_size, | |
| 139 int new_slider_position, | |
| 140 int new_scrollbar_width, | |
| 141 int new_scrollbar_height, | |
| 142 int new_scrollbar_x, | |
| 143 int new_scrollbar_y) | |
| 144 { | |
| 145 int pos_changed = 0; | |
| 771 | 146 int vert = qxeGetWindowLong (SCROLLBAR_MSW_HANDLE (sb), GWL_STYLE) & SBS_VERT; |
| 428 | 147 |
| 148 #if 0 | |
| 149 stderr_out ("[%d, %d], page = %d, pos = %d, inhibit = %d\n", new_minimum, new_maximum, | |
| 150 new_slider_size, new_slider_position,inhibit_slider_size_change); | |
| 151 #endif | |
| 152 | |
| 153 /* These might be optimized, but since at least one will change at each | |
| 154 call, it's probably not worth it. */ | |
| 155 SCROLLBAR_MSW_INFO (sb).nMin = new_minimum; | |
| 156 SCROLLBAR_MSW_INFO (sb).nMax = new_maximum; | |
| 157 SCROLLBAR_MSW_INFO (sb).nPage = new_slider_size + 1; /* +1 for DISABLENOSCROLL */ | |
| 158 SCROLLBAR_MSW_INFO (sb).nPos = new_slider_position; | |
| 159 #ifndef VERTICAL_SCROLLBAR_DRAG_HACK | |
| 160 SCROLLBAR_MSW_INFO (sb).fMask = ((vert && vertical_drag_in_progress) | |
| 161 ? SIF_RANGE | SIF_POS | |
| 162 : SIF_ALL | SIF_DISABLENOSCROLL); | |
| 163 #else | |
| 164 SCROLLBAR_MSW_INFO (sb).fMask = SIF_ALL | SIF_DISABLENOSCROLL; | |
| 165 | |
| 166 /* Ignore XEmacs' requests to update the thumb position and size; they don't | |
| 167 * bear any relation to reality because we're reporting made-up positions */ | |
| 168 if (!(vert && vertical_drag_in_progress)) | |
| 169 #endif | |
| 170 SetScrollInfo (SCROLLBAR_MSW_HANDLE (sb), SB_CTL, &SCROLLBAR_MSW_INFO (sb), | |
| 171 TRUE); | |
| 172 | |
| 173 UPDATE_POS_FIELD (scrollbar_x); | |
| 174 UPDATE_POS_FIELD (scrollbar_y); | |
| 175 UPDATE_POS_FIELD (scrollbar_width); | |
| 176 UPDATE_POS_FIELD (scrollbar_height); | |
| 177 | |
| 442 | 178 if (pos_changed) |
| 428 | 179 { |
| 617 | 180 MoveWindow (SCROLLBAR_MSW_HANDLE (sb), |
| 181 new_scrollbar_x, new_scrollbar_y, | |
| 182 new_scrollbar_width, new_scrollbar_height, | |
| 183 TRUE); | |
| 428 | 184 } |
| 185 } | |
| 186 | |
| 187 static void | |
| 2286 | 188 mswindows_update_scrollbar_instance_status (struct window *UNUSED (w), |
| 189 int UNUSED (active), int size, | |
| 428 | 190 struct scrollbar_instance *sb) |
| 191 { | |
| 192 if (SCROLLBAR_MSW_SIZE (sb) != size) | |
| 193 { | |
| 194 SCROLLBAR_MSW_SIZE (sb) = size; | |
| 195 ShowScrollBar (SCROLLBAR_MSW_HANDLE (sb), SB_CTL, | |
| 196 SCROLLBAR_MSW_SIZE (sb)); | |
| 197 SCROLLBAR_MSW_INFO(sb).fMask |= SIF_DISABLENOSCROLL; | |
| 198 SetScrollInfo(SCROLLBAR_MSW_HANDLE (sb), SB_CTL, &SCROLLBAR_MSW_INFO (sb), TRUE); | |
| 199 } | |
| 200 } | |
| 201 | |
| 202 void | |
| 2286 | 203 mswindows_handle_scrollbar_event (HWND hwnd, int code, int UNUSED (pos)) |
| 428 | 204 { |
| 205 struct frame *f; | |
| 206 Lisp_Object win, frame; | |
| 617 | 207 struct scrollbar_instance *sb = 0; |
| 208 void *v; | |
| 428 | 209 SCROLLINFO scrollinfo; |
| 771 | 210 int vert = qxeGetWindowLong (hwnd, GWL_STYLE) & SBS_VERT; |
| 428 | 211 int value; |
| 212 | |
| 771 | 213 v = (void *) qxeGetWindowLong (hwnd, GWL_USERDATA); |
| 617 | 214 if (!v) |
| 546 | 215 { |
| 617 | 216 /* apparently this can happen, as it was definitely necessary |
| 217 to put the check in for sb below (VERTICAL_SCROLLBAR_DRAG_HACK) */ | |
| 546 | 218 frame = mswindows_find_frame (hwnd); |
| 219 f = XFRAME (frame); | |
| 220 win = FRAME_SELECTED_WINDOW (f); | |
| 221 } | |
| 222 else | |
| 223 { | |
| 617 | 224 Lisp_Object ptr; |
| 5013 | 225 ptr = GET_LISP_FROM_VOID (v); |
| 617 | 226 assert (OPAQUE_PTRP (ptr)); |
| 227 ptr = Fgethash (ptr, Vmswindows_scrollbar_instance_table, Qnil); | |
| 228 sb = XSCROLLBAR_INSTANCE (ptr); | |
| 664 | 229 /* #### we're still hitting an abort here with 0 as the second |
| 230 parameter, although only occasionally. It seems that sometimes we | |
| 231 receive events for scrollbars that don't exist anymore. I assume | |
| 232 it must happen like this: The user does something that causes a | |
| 233 scrollbar to disappear (e.g. Alt-TAB, causing recomputation of | |
| 234 everything in the new frame) and then immediately uses the mouse | |
| 235 wheel, generating scrollbar events. Both events get posted before | |
| 236 we have a chance to process them, and in processing the first, the | |
| 237 scrollbar mentioned in the second disappears. */ | |
| 238 win = real_window (sb->mirror, 1); | |
| 239 if (NILP (win)) | |
| 240 return; | |
| 617 | 241 frame = WINDOW_FRAME (XWINDOW (win)); |
| 546 | 242 f = XFRAME (frame); |
| 243 } | |
| 428 | 244 |
| 673 | 245 /* SB_LINEDOWN == SB_CHARLEFT etc. This is the way they will |
| 246 always be - any Windows is binary compatible backward with | |
| 247 old programs */ | |
| 428 | 248 |
| 249 switch (code) | |
| 250 { | |
| 251 case SB_LINEDOWN: | |
| 252 mswindows_enqueue_misc_user_event | |
| 253 (frame, vert ? Qscrollbar_line_down : Qscrollbar_char_right, win); | |
| 254 break; | |
| 442 | 255 |
| 428 | 256 case SB_LINEUP: |
| 257 mswindows_enqueue_misc_user_event | |
| 258 (frame, vert ? Qscrollbar_line_up : Qscrollbar_char_left, win); | |
| 259 break; | |
| 442 | 260 |
| 428 | 261 case SB_PAGEDOWN: |
| 262 mswindows_enqueue_misc_user_event | |
| 263 (win, vert ? Qscrollbar_page_down : Qscrollbar_page_right, | |
| 264 vert ? Fcons (win, Qnil) : win); | |
| 265 break; | |
| 266 | |
| 267 case SB_PAGEUP: | |
| 268 mswindows_enqueue_misc_user_event | |
| 269 (frame, | |
| 270 vert ? Qscrollbar_page_up : Qscrollbar_page_left, | |
| 271 vert ? Fcons (win, Qnil) : win); | |
| 272 break; | |
| 442 | 273 |
| 428 | 274 case SB_BOTTOM: |
| 275 mswindows_enqueue_misc_user_event | |
| 276 (frame, vert ? Qscrollbar_to_bottom : Qscrollbar_to_right, win); | |
| 277 break; | |
| 278 | |
| 279 case SB_TOP: | |
| 280 mswindows_enqueue_misc_user_event | |
| 281 (frame, vert ? Qscrollbar_to_top : Qscrollbar_to_left, win); | |
| 282 break; | |
| 283 | |
| 284 case SB_THUMBTRACK: | |
| 285 case SB_THUMBPOSITION: | |
| 286 scrollinfo.cbSize = sizeof(SCROLLINFO); | |
| 287 scrollinfo.fMask = SIF_ALL; | |
| 288 GetScrollInfo (hwnd, SB_CTL, &scrollinfo); | |
| 289 vertical_drag_in_progress = vert; | |
| 290 #ifdef VERTICAL_SCROLLBAR_DRAG_HACK | |
| 291 if (vert && (scrollinfo.nTrackPos > scrollinfo.nPos)) | |
| 292 /* new buffer position = | |
| 293 * buffer position at start of drag + | |
| 294 * ((text remaining in buffer at start of drag) * | |
| 295 * (amount that the thumb has been moved) / | |
| 296 * (space that remained past end of the thumb at start of drag)) */ | |
| 297 value = (int) | |
| 298 (scrollinfo.nPos | |
| 299 + (((double) | |
| 300 (scrollinfo.nMax - scrollinfo.nPos) | |
| 301 * (scrollinfo.nTrackPos - scrollinfo.nPos)) | |
| 302 / (scrollinfo.nMax - scrollinfo.nPage - scrollinfo.nPos))) | |
| 303 - 2; /* ensure that the last line doesn't disappear off screen */ | |
| 304 else | |
| 305 #endif | |
| 306 value = scrollinfo.nTrackPos; | |
| 307 mswindows_enqueue_misc_user_event | |
| 308 (frame, | |
| 309 vert ? Qscrollbar_vertical_drag : Qscrollbar_horizontal_drag, | |
|
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
310 Fcons (win, make_fixnum (value))); |
| 428 | 311 break; |
| 312 | |
| 313 case SB_ENDSCROLL: | |
| 314 #ifdef VERTICAL_SCROLLBAR_DRAG_HACK | |
| 546 | 315 if (vertical_drag_in_progress && sb) |
| 428 | 316 /* User has just dropped the thumb - finally update it */ |
| 317 SetScrollInfo (SCROLLBAR_MSW_HANDLE (sb), SB_CTL, | |
| 318 &SCROLLBAR_MSW_INFO (sb), TRUE); | |
| 319 #endif | |
| 320 vertical_drag_in_progress = 0; | |
| 321 break; | |
| 322 } | |
| 323 } | |
| 324 | |
| 325 static int | |
| 771 | 326 can_scroll (struct scrollbar_instance *scrollbar) |
| 428 | 327 { |
| 328 return scrollbar != NULL | |
| 329 && IsWindowVisible (SCROLLBAR_MSW_HANDLE (scrollbar)) | |
| 330 && IsWindowEnabled (SCROLLBAR_MSW_HANDLE (scrollbar)); | |
| 331 } | |
| 332 | |
| 333 int | |
| 464 | 334 mswindows_handle_mousewheel_event (Lisp_Object frame, int keys, int delta, |
| 335 POINTS where) | |
| 428 | 336 { |
| 442 | 337 int hasVertBar, hasHorzBar; /* Indicates presence of scroll bars */ |
| 428 | 338 unsigned wheelScrollLines = 0; /* Number of lines per wheel notch */ |
| 826 | 339 Lisp_Object win = Qnil, corpore, sano; |
| 464 | 340 struct window_mirror *mirror; |
| 707 | 341 int mene, _mene, tekel, upharsin; |
| 342 Charbpos mens, sana; | |
| 343 Charcount in; | |
| 344 struct window *needle_in_haystack = 0; | |
| 464 | 345 POINT donde_esta; |
| 428 | 346 |
| 464 | 347 donde_esta.x = where.x; |
| 348 donde_esta.y = where.y; | |
| 349 | |
| 350 /* Find the window to scroll */ | |
| 351 | |
| 707 | 352 /* The mouse event could actually occur outside of the emacs |
| 353 frame. */ | |
| 354 if (ScreenToClient (FRAME_MSWINDOWS_HANDLE (XFRAME (frame)), | |
| 355 &donde_esta) != 0) | |
| 356 { | |
| 819 | 357 /* stderr_out ("donde_esta: %d %d\n", donde_esta.x, donde_esta.y); */ |
| 358 pixel_to_glyph_translation (XFRAME (frame), donde_esta.x, donde_esta.y, | |
| 359 &mene, &_mene, &tekel, &upharsin, | |
| 360 &needle_in_haystack, | |
| 361 &mens, &sana, &in, &corpore, &sano); | |
| 362 | |
| 363 if (needle_in_haystack) | |
| 364 { | |
| 365 win = wrap_window (needle_in_haystack); | |
| 366 /* stderr_out ("found needle\n"); | |
| 367 debug_print (win); */ | |
| 368 } | |
| 707 | 369 } |
| 819 | 370 |
| 371 if (!needle_in_haystack) | |
| 707 | 372 { |
| 373 win = FRAME_SELECTED_WINDOW (XFRAME (frame)); | |
| 374 needle_in_haystack = XWINDOW (win); | |
| 375 } | |
| 464 | 376 |
| 707 | 377 mirror = find_window_mirror (needle_in_haystack); |
| 428 | 378 |
| 379 /* Check that there is something to scroll */ | |
| 380 hasVertBar = can_scroll (mirror->scrollbar_vertical_instance); | |
| 381 hasHorzBar = can_scroll (mirror->scrollbar_horizontal_instance); | |
| 382 if (!hasVertBar && !hasHorzBar) | |
| 383 return FALSE; | |
| 384 | |
| 385 /* No support for panning and zooming, so ignore */ | |
| 386 if (keys & (MK_SHIFT | MK_CONTROL)) | |
| 387 return FALSE; | |
| 388 | |
| 389 /* Get the number of lines per wheel delta */ | |
| 771 | 390 qxeSystemParametersInfo (SPI_GETWHEELSCROLLLINES, 0, &wheelScrollLines, 0); |
| 428 | 391 |
| 392 /* Calculate the amount to scroll */ | |
| 393 if (wheelScrollLines == WHEEL_PAGESCROLL) | |
| 394 { | |
| 395 /* Scroll by a page */ | |
| 396 Lisp_Object function; | |
| 397 if (hasVertBar) | |
| 398 function = delta > 0 ? Qscrollbar_page_up : Qscrollbar_page_down; | |
| 399 else | |
| 400 function = delta > 0 ? Qscrollbar_page_left : Qscrollbar_page_right; | |
| 401 mswindows_enqueue_misc_user_event (frame, function, Fcons (win, Qnil)); | |
| 402 } | |
| 403 else /* Scroll by a number of lines */ | |
| 404 { | |
| 405 /* Calc the number of lines to scroll */ | |
| 406 int toScroll = MulDiv (delta, wheelScrollLines, WHEEL_DELTA); | |
| 407 | |
| 408 /* Do the scroll */ | |
| 409 Lisp_Object function; | |
| 410 if (hasVertBar) | |
| 411 function = delta > 0 ? Qscrollbar_line_up : Qscrollbar_line_down; | |
| 412 else | |
| 413 function = delta > 0 ? Qscrollbar_char_left : Qscrollbar_char_right; | |
| 414 if (toScroll < 0) | |
| 415 toScroll = -toScroll; | |
| 416 while (toScroll--) | |
| 417 mswindows_enqueue_misc_user_event (frame, function, win); | |
| 418 } | |
| 419 | |
| 420 return TRUE; | |
| 421 } | |
| 422 | |
| 423 #ifdef MEMORY_USAGE_STATS | |
| 424 | |
|
5170
5ddbab03b0e6
various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents:
5169
diff
changeset
|
425 static Bytecount |
| 2286 | 426 mswindows_compute_scrollbar_instance_usage (struct device *UNUSED (d), |
| 427 struct scrollbar_instance *inst, | |
|
5157
1fae11d56ad2
redo memory-usage mechanism, add way of dynamically initializing Lisp objects
Ben Wing <ben@xemacs.org>
parents:
5013
diff
changeset
|
428 struct usage_stats *ustats) |
| 428 | 429 { |
|
5170
5ddbab03b0e6
various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents:
5169
diff
changeset
|
430 struct mswindows_scrollbar_data *data = |
|
5ddbab03b0e6
various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents:
5169
diff
changeset
|
431 (struct mswindows_scrollbar_data *) inst->scrollbar_data; |
| 428 | 432 |
|
5170
5ddbab03b0e6
various fixes to memory-usage stats
Ben Wing <ben@xemacs.org>
parents:
5169
diff
changeset
|
433 return malloced_storage_size (data, sizeof (*data), ustats); |
| 428 | 434 } |
| 435 | |
| 436 #endif /* MEMORY_USAGE_STATS */ | |
| 437 | |
| 438 /************************************************************************/ | |
| 439 /* Device-specific ghost specifiers initialization */ | |
| 440 /************************************************************************/ | |
| 441 | |
| 617 | 442 DEFUN ("mswindows-init-scrollbar-metrics", Fmswindows_init_scrollbar_metrics, |
| 443 1, 1, 0, /* | |
| 428 | 444 */ |
| 445 (locale)) | |
| 446 { | |
| 447 if (DEVICEP (locale)) | |
| 448 { | |
| 449 add_spec_to_ghost_specifier (Vscrollbar_width, | |
|
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
450 make_fixnum (GetSystemMetrics (SM_CXVSCROLL)), |
| 428 | 451 locale, Qmswindows, Qnil); |
| 452 add_spec_to_ghost_specifier (Vscrollbar_height, | |
|
5581
56144c8593a8
Mechanically change INT to FIXNUM in our sources.
Aidan Kehoe <kehoea@parhasard.net>
parents:
5402
diff
changeset
|
453 make_fixnum (GetSystemMetrics (SM_CYHSCROLL)), |
| 428 | 454 locale, Qmswindows, Qnil); |
| 455 } | |
| 456 return Qnil; | |
| 457 } | |
| 458 | |
| 459 | |
| 460 /************************************************************************/ | |
| 461 /* initialization */ | |
| 462 /************************************************************************/ | |
| 463 | |
| 464 void | |
| 465 console_type_create_scrollbar_mswindows (void) | |
| 466 { | |
| 467 CONSOLE_HAS_METHOD (mswindows, create_scrollbar_instance); | |
| 468 CONSOLE_HAS_METHOD (mswindows, free_scrollbar_instance); | |
| 469 CONSOLE_HAS_METHOD (mswindows, release_scrollbar_instance); | |
| 470 CONSOLE_HAS_METHOD (mswindows, update_scrollbar_instance_values); | |
| 471 CONSOLE_HAS_METHOD (mswindows, update_scrollbar_instance_status); | |
| 472 /* CONSOLE_HAS_METHOD (mswindows, scrollbar_width_changed_in_frame); */ | |
| 473 #ifdef MEMORY_USAGE_STATS | |
| 474 CONSOLE_HAS_METHOD (mswindows, compute_scrollbar_instance_usage); | |
| 475 #endif | |
| 476 } | |
| 477 | |
| 478 void | |
| 617 | 479 syms_of_scrollbar_mswindows (void) |
| 428 | 480 { |
| 481 DEFSUBR (Fmswindows_init_scrollbar_metrics); | |
| 482 } | |
| 483 | |
| 484 void | |
| 617 | 485 vars_of_scrollbar_mswindows (void) |
| 428 | 486 { |
| 487 Fprovide (intern ("mswindows-scrollbars")); | |
| 488 | |
| 617 | 489 staticpro (&Vmswindows_scrollbar_instance_table); |
| 490 Vmswindows_scrollbar_instance_table = | |
|
5191
71ee43b8a74d
Add #'equalp as a hash test by default; add #'define-hash-table-test, GNU API
Aidan Kehoe <kehoea@parhasard.net>
parents:
5170
diff
changeset
|
491 make_lisp_hash_table (100, HASH_TABLE_NON_WEAK, Qeq); |
| 617 | 492 } |
