annotate src/scrollbar-msw.c @ 5013:ae48681c47fa

changes to VOID_TO_LISP et al. -------------------- ChangeLog entries follow: -------------------- src/ChangeLog addition: 2010-02-08 Ben Wing <ben@xemacs.org> * casetab.c (compute_canon_mapper): * casetab.c (initialize_identity_mapper): * casetab.c (compute_up_or_eqv_mapper): * casetab.c (recompute_case_table): * casetab.c (set_case_table): * chartab.c (copy_mapper): * chartab.c (copy_char_table_range): * chartab.c (get_range_char_table_1): * console.c (find_nonminibuffer_frame_not_on_console_predicate): * console.c (find_nonminibuffer_frame_not_on_console): * console.c (nuke_all_console_slots): * device.c: * device.c (find_nonminibuffer_frame_not_on_device_predicate): * device.c (find_nonminibuffer_frame_not_on_device): * dialog-msw.c (dialog_proc): * dialog-msw.c (handle_question_dialog_box): * dialog-x.c (maybe_run_dbox_text_callback): * eval.c: * eval.c (safe_run_hook_trapping_problems_1): * eval.c (safe_run_hook_trapping_problems): * event-msw.c: * event-msw.c (mswindows_wnd_proc): * event-msw.c (mswindows_find_frame): * faces.c (update_face_inheritance_mapper): * frame-msw.c (mswindows_init_frame_1): * frame-msw.c (mswindows_get_mouse_position): * frame-msw.c (mswindows_get_frame_parent): * glade.c (connector): * glade.c (Fglade_xml_signal_connect): * glade.c (Fglade_xml_signal_autoconnect): * glade.c (Fglade_xml_textdomain): * glyphs-msw.c (mswindows_subwindow_instantiate): * glyphs-msw.c (mswindows_widget_instantiate): * glyphs.c (check_instance_cache_mapper): * glyphs.c (check_window_subwindow_cache): * glyphs.c (check_image_instance_structure): * gui-x.c (snarf_widget_value_mapper): * gui-x.c (popup_selection_callback): * gui-x.c (button_item_to_widget_value): * keymap.c (map_keymap_mapper): * keymap.c (Fmap_keymap): * menubar-gtk.c (__torn_off_sir): * menubar-gtk.c (__activate_menu): * menubar-gtk.c (menu_convert): * menubar-gtk.c (__generic_button_callback): * menubar-gtk.c (menu_descriptor_to_widget_1): * menubar-msw.c: * menubar-msw.c (EMPTY_ITEM_ID): * menubar-x.c (menu_item_descriptor_to_widget_value_1): * menubar-x.c (pre_activate_callback): * menubar-x.c (command_builder_operate_menu_accelerator): * menubar-x.c (command_builder_find_menu_accelerator): * print.c (print_internal): * process-unix.c (close_process_descs_mapfun): * process.c (get_process_from_usid): * process.c (init_process_io_handles): * profile.c (sigprof_handler): * profile.c (get_profiling_info_timing_maphash): * profile.c (Fget_profiling_info): * profile.c (set_profiling_info_timing_maphash): * profile.c (mark_profiling_info_maphash): * scrollbar-msw.c (mswindows_create_scrollbar_instance): * scrollbar-msw.c (mswindows_free_scrollbar_instance): * scrollbar-msw.c (mswindows_handle_scrollbar_event): * specifier.c (recompute_cached_specifier_everywhere_mapfun): * specifier.c (recompute_cached_specifier_everywhere): * syntax.c (copy_to_mirrortab): * syntax.c (copy_if_not_already_present): * syntax.c (update_just_this_syntax_table): * text.c (new_dfc_convert_now_damn_it): * text.h (LISP_STRING_TO_EXTERNAL): * tooltalk.c: * tooltalk.c (tooltalk_message_callback): * tooltalk.c (tooltalk_pattern_callback): * tooltalk.c (Fcreate_tooltalk_message): * tooltalk.c (Fcreate_tooltalk_pattern): * ui-byhand.c (__generic_toolbar_callback): * ui-byhand.c (generic_toolbar_insert_item): * ui-byhand.c (__emacs_gtk_ctree_recurse_internal): * ui-byhand.c (Fgtk_ctree_recurse): * ui-gtk.c (__internal_callback_destroy): * ui-gtk.c (__internal_callback_marshal): * ui-gtk.c (Fgtk_signal_connect): * ui-gtk.c (gtk_type_to_lisp): * ui-gtk.c (lisp_to_gtk_type): * ui-gtk.c (lisp_to_gtk_ret_type): * lisp-disunion.h: * lisp-disunion.h (NON_LVALUE): * lisp-union.h: * lisp.h (LISP_HASH): Rename: LISP_TO_VOID -> STORE_LISP_IN_VOID VOID_TO_LISP -> GET_LISP_FROM_VOID These new names are meant to clearly identify that the Lisp object is the source and void the sink, and that they can't be used the other way around -- they aren't exact opposites despite the old names. The names are also important given the new functions created just below. Also, clarify comments in lisp-union.h and lisp-disunion.h about the use of the functions. * lisp.h: New functions STORE_VOID_IN_LISP and GET_VOID_FROM_LISP. These are different from the above in that the source is a void * (previously, you had to use make_opaque_ptr()). * eval.c (restore_lisp_object): * eval.c (record_unwind_protect_restoring_lisp_object): * eval.c (struct restore_int): * eval.c (restore_int): * eval.c (record_unwind_protect_restoring_int): * eval.c (free_pointer): * eval.c (record_unwind_protect_freeing): * eval.c (free_dynarr): * eval.c (record_unwind_protect_freeing_dynarr): * eval.c (unbind_to_1): Use STORE_VOID_IN_LISP and GET_VOID_FROM_LISP to eliminate the use of make_opaque_ptr() and mostly eliminate Lisp consing entirely in the use of these various record_unwind_protect_* functions as well as internal_bind_* (e.g. internal_bind_int). * tests.c: * tests.c (Ftest_store_void_in_lisp): * tests.c (syms_of_tests): * tests.c (vars_of_tests): Add an C-assert-style test to test STORE_VOID_IN_LISP and GET_VOID_FROM_LISP to make sure the same value comes back that was put in.
author Ben Wing <ben@xemacs.org>
date Mon, 08 Feb 2010 06:42:16 -0600
parents 16112448d484
children 1fae11d56ad2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 /* scrollbar implementation -- mswindows interface.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2 Copyright (C) 1994, 1995 Board of Trustees, University of Illinois.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3 Copyright (C) 1994 Amdahl Corporation.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4 Copyright (C) 1995 Sun Microsystems, Inc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5 Copyright (C) 1995 Darrell Kindred <dkindred+@cmu.edu>.
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
6 Copyright (C) 2001, 2002 Ben Wing.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10 XEmacs is free software; you can redistribute it and/or modify it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11 under the terms of the GNU General Public License as published by the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12 Free Software Foundation; either version 2, or (at your option) any
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15 XEmacs is distributed in the hope that it will be useful, but WITHOUT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 You should have received a copy of the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21 along with XEmacs; see the file COPYING. If not, write to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23 Boston, MA 02111-1307, USA. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25 /* Synched up with: Not in FSF. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
27 /* This file essentially Mule-ized (except perhaps some Unicode splitting).
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
28 5-2000. */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
29
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30 #include <config.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31 #include "lisp.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
33 #include "device.h"
617
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 611
diff changeset
34 #include "elhash.h"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35 #include "events.h"
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 826
diff changeset
36 #include "frame-impl.h"
617
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 611
diff changeset
37 #include "opaque.h"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38 #include "scrollbar.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39 #include "specifier.h"
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 826
diff changeset
40 #include "window-impl.h"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 826
diff changeset
42 #include "console-msw-impl.h"
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
43 #include "scrollbar-msw.h"
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 793
diff changeset
44
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 /* We use a similar sort of vertical scrollbar drag hack for mswindows
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 * scrollbars as is used for Motif or Lucid scrollbars under X.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47 * We do character-based instead of line-based scrolling, which can mean that
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 * without the hack it is impossible to drag to the end of a buffer. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49 #define VERTICAL_SCROLLBAR_DRAG_HACK
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 static int vertical_drag_in_progress = 0;
673
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
52 extern Lisp_Object mswindows_find_frame (HWND hwnd);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53
617
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 611
diff changeset
54 /* As long as the HWND is around, the scrollbar instance must be GC-protected.
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 611
diff changeset
55 We have gotten crashes, apparently from trying to access a dead, freed
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 611
diff changeset
56 frame inside of a window mirror pointed to by the scrollbar structure. */
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 611
diff changeset
57 static Lisp_Object Vmswindows_scrollbar_instance_table;
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 611
diff changeset
58
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
60 mswindows_create_scrollbar_instance (struct frame *f, int vertical,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61 struct scrollbar_instance *sb)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63 int orientation;
617
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 611
diff changeset
64 Lisp_Object ptr;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
65
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66 sb->scrollbar_data = xnew_and_zero (struct mswindows_scrollbar_data);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
67
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 if (vertical)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69 orientation = SBS_VERT;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71 orientation = SBS_HORZ;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
72
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73 SCROLLBAR_MSW_HANDLE (sb) =
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
74 qxeCreateWindowEx (0, XETEXT ("SCROLLBAR"), 0, orientation|WS_CHILD,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
75 CW_USEDEFAULT, CW_USEDEFAULT,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
76 CW_USEDEFAULT, CW_USEDEFAULT,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
77 FRAME_MSWINDOWS_HANDLE (f),
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
78 NULL, NULL, NULL);
546
666d73d6ac56 [xemacs-hg @ 2001-05-20 01:17:07 by ben]
ben
parents: 487
diff changeset
79 SCROLLBAR_MSW_INFO (sb).cbSize = sizeof (SCROLLINFO);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80 SCROLLBAR_MSW_INFO (sb).fMask = SIF_ALL;
617
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 611
diff changeset
81 GetScrollInfo (SCROLLBAR_MSW_HANDLE (sb), SB_CTL,
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 611
diff changeset
82 &SCROLLBAR_MSW_INFO (sb));
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 611
diff changeset
83 ptr = make_opaque_ptr (SCROLLBAR_MSW_HANDLE (sb));
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 611
diff changeset
84 Fputhash (ptr, wrap_scrollbar_instance (sb),
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 611
diff changeset
85 Vmswindows_scrollbar_instance_table);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
86 qxeSetWindowLong (SCROLLBAR_MSW_HANDLE (sb), GWL_USERDATA,
5013
ae48681c47fa changes to VOID_TO_LISP et al.
Ben Wing <ben@xemacs.org>
parents: 4976
diff changeset
87 (LONG) STORE_LISP_IN_VOID (ptr));
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91 mswindows_free_scrollbar_instance (struct scrollbar_instance *sb)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92 {
3482
20773f9b7bc0 [xemacs-hg @ 2006-06-29 16:58:59 by james]
james
parents: 3024
diff changeset
93 if (sb->scrollbar_data)
20773f9b7bc0 [xemacs-hg @ 2006-06-29 16:58:59 by james]
james
parents: 3024
diff changeset
94 {
20773f9b7bc0 [xemacs-hg @ 2006-06-29 16:58:59 by james]
james
parents: 3024
diff changeset
95 void *opaque =
20773f9b7bc0 [xemacs-hg @ 2006-06-29 16:58:59 by james]
james
parents: 3024
diff changeset
96 (void *) qxeGetWindowLong (SCROLLBAR_MSW_HANDLE (sb), GWL_USERDATA);
20773f9b7bc0 [xemacs-hg @ 2006-06-29 16:58:59 by james]
james
parents: 3024
diff changeset
97 Lisp_Object ptr;
617
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 611
diff changeset
98
5013
ae48681c47fa changes to VOID_TO_LISP et al.
Ben Wing <ben@xemacs.org>
parents: 4976
diff changeset
99 ptr = GET_LISP_FROM_VOID (opaque);
3482
20773f9b7bc0 [xemacs-hg @ 2006-06-29 16:58:59 by james]
james
parents: 3024
diff changeset
100 assert (OPAQUE_PTRP (ptr));
20773f9b7bc0 [xemacs-hg @ 2006-06-29 16:58:59 by james]
james
parents: 3024
diff changeset
101 ptr = Fremhash (ptr, Vmswindows_scrollbar_instance_table);
20773f9b7bc0 [xemacs-hg @ 2006-06-29 16:58:59 by james]
james
parents: 3024
diff changeset
102 assert (!NILP (ptr));
20773f9b7bc0 [xemacs-hg @ 2006-06-29 16:58:59 by james]
james
parents: 3024
diff changeset
103 DestroyWindow (SCROLLBAR_MSW_HANDLE (sb));
4976
16112448d484 Rename xfree(FOO, TYPE) -> xfree(FOO)
Ben Wing <ben@xemacs.org>
parents: 3482
diff changeset
104 xfree (sb->scrollbar_data);
3482
20773f9b7bc0 [xemacs-hg @ 2006-06-29 16:58:59 by james]
james
parents: 3024
diff changeset
105 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 static void
611
38db05db9cb5 [xemacs-hg @ 2001-06-08 12:21:09 by ben]
ben
parents: 546
diff changeset
109 unshow_that_mofo (void *handle)
38db05db9cb5 [xemacs-hg @ 2001-06-08 12:21:09 by ben]
ben
parents: 546
diff changeset
110 {
38db05db9cb5 [xemacs-hg @ 2001-06-08 12:21:09 by ben]
ben
parents: 546
diff changeset
111 ShowScrollBar ((HWND) handle, SB_CTL, 0);
38db05db9cb5 [xemacs-hg @ 2001-06-08 12:21:09 by ben]
ben
parents: 546
diff changeset
112 }
38db05db9cb5 [xemacs-hg @ 2001-06-08 12:21:09 by ben]
ben
parents: 546
diff changeset
113
38db05db9cb5 [xemacs-hg @ 2001-06-08 12:21:09 by ben]
ben
parents: 546
diff changeset
114 static void
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115 mswindows_release_scrollbar_instance (struct scrollbar_instance *sb)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
116 {
611
38db05db9cb5 [xemacs-hg @ 2001-06-08 12:21:09 by ben]
ben
parents: 546
diff changeset
117 if (gc_in_progress)
38db05db9cb5 [xemacs-hg @ 2001-06-08 12:21:09 by ben]
ben
parents: 546
diff changeset
118 /* #### way bogus! need to remove the offending call.
38db05db9cb5 [xemacs-hg @ 2001-06-08 12:21:09 by ben]
ben
parents: 546
diff changeset
119 see mark_redisplay(). */
38db05db9cb5 [xemacs-hg @ 2001-06-08 12:21:09 by ben]
ben
parents: 546
diff changeset
120 register_post_gc_action (unshow_that_mofo,
38db05db9cb5 [xemacs-hg @ 2001-06-08 12:21:09 by ben]
ben
parents: 546
diff changeset
121 (void *) SCROLLBAR_MSW_HANDLE (sb));
38db05db9cb5 [xemacs-hg @ 2001-06-08 12:21:09 by ben]
ben
parents: 546
diff changeset
122 else
38db05db9cb5 [xemacs-hg @ 2001-06-08 12:21:09 by ben]
ben
parents: 546
diff changeset
123 ShowScrollBar (SCROLLBAR_MSW_HANDLE (sb), SB_CTL, 0);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
124 SCROLLBAR_MSW_SIZE (sb) = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
127 #define UPDATE_POS_FIELD(field) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
128 if (new_##field >= 0 && SCROLLBAR_MSW_DATA (sb)->field != new_##field) { \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
129 SCROLLBAR_MSW_DATA (sb)->field = new_##field; \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
130 pos_changed = 1; \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
131 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
132
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
133 static void
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1726
diff changeset
134 mswindows_update_scrollbar_instance_values (struct window *UNUSED (w),
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
135 struct scrollbar_instance *sb,
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1726
diff changeset
136 int UNUSED (new_line_increment),
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1726
diff changeset
137 int UNUSED (new_page_increment),
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
138 int new_minimum, int new_maximum,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
139 int new_slider_size,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
140 int new_slider_position,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
141 int new_scrollbar_width,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
142 int new_scrollbar_height,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
143 int new_scrollbar_x,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
144 int new_scrollbar_y)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
145 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
146 int pos_changed = 0;
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
147 int vert = qxeGetWindowLong (SCROLLBAR_MSW_HANDLE (sb), GWL_STYLE) & SBS_VERT;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
148
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
149 #if 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
150 stderr_out ("[%d, %d], page = %d, pos = %d, inhibit = %d\n", new_minimum, new_maximum,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
151 new_slider_size, new_slider_position,inhibit_slider_size_change);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
152 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
153
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
154 /* These might be optimized, but since at least one will change at each
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
155 call, it's probably not worth it. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
156 SCROLLBAR_MSW_INFO (sb).nMin = new_minimum;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
157 SCROLLBAR_MSW_INFO (sb).nMax = new_maximum;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
158 SCROLLBAR_MSW_INFO (sb).nPage = new_slider_size + 1; /* +1 for DISABLENOSCROLL */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
159 SCROLLBAR_MSW_INFO (sb).nPos = new_slider_position;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
160 #ifndef VERTICAL_SCROLLBAR_DRAG_HACK
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
161 SCROLLBAR_MSW_INFO (sb).fMask = ((vert && vertical_drag_in_progress)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
162 ? SIF_RANGE | SIF_POS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
163 : SIF_ALL | SIF_DISABLENOSCROLL);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
164 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
165 SCROLLBAR_MSW_INFO (sb).fMask = SIF_ALL | SIF_DISABLENOSCROLL;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
166
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
167 /* Ignore XEmacs' requests to update the thumb position and size; they don't
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
168 * bear any relation to reality because we're reporting made-up positions */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
169 if (!(vert && vertical_drag_in_progress))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
170 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
171 SetScrollInfo (SCROLLBAR_MSW_HANDLE (sb), SB_CTL, &SCROLLBAR_MSW_INFO (sb),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
172 TRUE);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
173
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
174 UPDATE_POS_FIELD (scrollbar_x);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
175 UPDATE_POS_FIELD (scrollbar_y);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
176 UPDATE_POS_FIELD (scrollbar_width);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
177 UPDATE_POS_FIELD (scrollbar_height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
178
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
179 if (pos_changed)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
180 {
617
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 611
diff changeset
181 MoveWindow (SCROLLBAR_MSW_HANDLE (sb),
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 611
diff changeset
182 new_scrollbar_x, new_scrollbar_y,
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 611
diff changeset
183 new_scrollbar_width, new_scrollbar_height,
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 611
diff changeset
184 TRUE);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
185 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
186 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
187
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
188 static void
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1726
diff changeset
189 mswindows_update_scrollbar_instance_status (struct window *UNUSED (w),
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1726
diff changeset
190 int UNUSED (active), int size,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
191 struct scrollbar_instance *sb)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
192 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
193 if (SCROLLBAR_MSW_SIZE (sb) != size)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
194 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
195 SCROLLBAR_MSW_SIZE (sb) = size;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
196 ShowScrollBar (SCROLLBAR_MSW_HANDLE (sb), SB_CTL,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
197 SCROLLBAR_MSW_SIZE (sb));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
198 SCROLLBAR_MSW_INFO(sb).fMask |= SIF_DISABLENOSCROLL;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
199 SetScrollInfo(SCROLLBAR_MSW_HANDLE (sb), SB_CTL, &SCROLLBAR_MSW_INFO (sb), TRUE);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
200 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
201 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
202
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
203 void
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1726
diff changeset
204 mswindows_handle_scrollbar_event (HWND hwnd, int code, int UNUSED (pos))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
205 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
206 struct frame *f;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
207 Lisp_Object win, frame;
617
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 611
diff changeset
208 struct scrollbar_instance *sb = 0;
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 611
diff changeset
209 void *v;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
210 SCROLLINFO scrollinfo;
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
211 int vert = qxeGetWindowLong (hwnd, GWL_STYLE) & SBS_VERT;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
212 int value;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
213
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
214 v = (void *) qxeGetWindowLong (hwnd, GWL_USERDATA);
617
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 611
diff changeset
215 if (!v)
546
666d73d6ac56 [xemacs-hg @ 2001-05-20 01:17:07 by ben]
ben
parents: 487
diff changeset
216 {
617
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 611
diff changeset
217 /* apparently this can happen, as it was definitely necessary
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 611
diff changeset
218 to put the check in for sb below (VERTICAL_SCROLLBAR_DRAG_HACK) */
546
666d73d6ac56 [xemacs-hg @ 2001-05-20 01:17:07 by ben]
ben
parents: 487
diff changeset
219 frame = mswindows_find_frame (hwnd);
666d73d6ac56 [xemacs-hg @ 2001-05-20 01:17:07 by ben]
ben
parents: 487
diff changeset
220 f = XFRAME (frame);
666d73d6ac56 [xemacs-hg @ 2001-05-20 01:17:07 by ben]
ben
parents: 487
diff changeset
221 win = FRAME_SELECTED_WINDOW (f);
666d73d6ac56 [xemacs-hg @ 2001-05-20 01:17:07 by ben]
ben
parents: 487
diff changeset
222 }
666d73d6ac56 [xemacs-hg @ 2001-05-20 01:17:07 by ben]
ben
parents: 487
diff changeset
223 else
666d73d6ac56 [xemacs-hg @ 2001-05-20 01:17:07 by ben]
ben
parents: 487
diff changeset
224 {
617
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 611
diff changeset
225 Lisp_Object ptr;
5013
ae48681c47fa changes to VOID_TO_LISP et al.
Ben Wing <ben@xemacs.org>
parents: 4976
diff changeset
226 ptr = GET_LISP_FROM_VOID (v);
617
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 611
diff changeset
227 assert (OPAQUE_PTRP (ptr));
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 611
diff changeset
228 ptr = Fgethash (ptr, Vmswindows_scrollbar_instance_table, Qnil);
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 611
diff changeset
229 sb = XSCROLLBAR_INSTANCE (ptr);
664
6e99cc8c6ca5 [xemacs-hg @ 2001-09-18 05:04:26 by ben]
ben
parents: 617
diff changeset
230 /* #### we're still hitting an abort here with 0 as the second
6e99cc8c6ca5 [xemacs-hg @ 2001-09-18 05:04:26 by ben]
ben
parents: 617
diff changeset
231 parameter, although only occasionally. It seems that sometimes we
6e99cc8c6ca5 [xemacs-hg @ 2001-09-18 05:04:26 by ben]
ben
parents: 617
diff changeset
232 receive events for scrollbars that don't exist anymore. I assume
6e99cc8c6ca5 [xemacs-hg @ 2001-09-18 05:04:26 by ben]
ben
parents: 617
diff changeset
233 it must happen like this: The user does something that causes a
6e99cc8c6ca5 [xemacs-hg @ 2001-09-18 05:04:26 by ben]
ben
parents: 617
diff changeset
234 scrollbar to disappear (e.g. Alt-TAB, causing recomputation of
6e99cc8c6ca5 [xemacs-hg @ 2001-09-18 05:04:26 by ben]
ben
parents: 617
diff changeset
235 everything in the new frame) and then immediately uses the mouse
6e99cc8c6ca5 [xemacs-hg @ 2001-09-18 05:04:26 by ben]
ben
parents: 617
diff changeset
236 wheel, generating scrollbar events. Both events get posted before
6e99cc8c6ca5 [xemacs-hg @ 2001-09-18 05:04:26 by ben]
ben
parents: 617
diff changeset
237 we have a chance to process them, and in processing the first, the
6e99cc8c6ca5 [xemacs-hg @ 2001-09-18 05:04:26 by ben]
ben
parents: 617
diff changeset
238 scrollbar mentioned in the second disappears. */
6e99cc8c6ca5 [xemacs-hg @ 2001-09-18 05:04:26 by ben]
ben
parents: 617
diff changeset
239 win = real_window (sb->mirror, 1);
6e99cc8c6ca5 [xemacs-hg @ 2001-09-18 05:04:26 by ben]
ben
parents: 617
diff changeset
240 if (NILP (win))
6e99cc8c6ca5 [xemacs-hg @ 2001-09-18 05:04:26 by ben]
ben
parents: 617
diff changeset
241 return;
617
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 611
diff changeset
242 frame = WINDOW_FRAME (XWINDOW (win));
546
666d73d6ac56 [xemacs-hg @ 2001-05-20 01:17:07 by ben]
ben
parents: 487
diff changeset
243 f = XFRAME (frame);
666d73d6ac56 [xemacs-hg @ 2001-05-20 01:17:07 by ben]
ben
parents: 487
diff changeset
244 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
245
673
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
246 /* SB_LINEDOWN == SB_CHARLEFT etc. This is the way they will
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
247 always be - any Windows is binary compatible backward with
685b588e92d8 [xemacs-hg @ 2001-10-30 05:13:26 by andyp]
andyp
parents: 665
diff changeset
248 old programs */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
249
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
250 switch (code)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
251 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
252 case SB_LINEDOWN:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
253 mswindows_enqueue_misc_user_event
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
254 (frame, vert ? Qscrollbar_line_down : Qscrollbar_char_right, win);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
255 break;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
256
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
257 case SB_LINEUP:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
258 mswindows_enqueue_misc_user_event
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
259 (frame, vert ? Qscrollbar_line_up : Qscrollbar_char_left, win);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
260 break;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
261
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
262 case SB_PAGEDOWN:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
263 mswindows_enqueue_misc_user_event
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
264 (win, vert ? Qscrollbar_page_down : Qscrollbar_page_right,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
265 vert ? Fcons (win, Qnil) : win);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
266 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
267
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
268 case SB_PAGEUP:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
269 mswindows_enqueue_misc_user_event
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
270 (frame,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
271 vert ? Qscrollbar_page_up : Qscrollbar_page_left,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
272 vert ? Fcons (win, Qnil) : win);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
273 break;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
274
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
275 case SB_BOTTOM:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
276 mswindows_enqueue_misc_user_event
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
277 (frame, vert ? Qscrollbar_to_bottom : Qscrollbar_to_right, win);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
278 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
279
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
280 case SB_TOP:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
281 mswindows_enqueue_misc_user_event
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
282 (frame, vert ? Qscrollbar_to_top : Qscrollbar_to_left, win);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
283 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
284
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
285 case SB_THUMBTRACK:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
286 case SB_THUMBPOSITION:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
287 scrollinfo.cbSize = sizeof(SCROLLINFO);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
288 scrollinfo.fMask = SIF_ALL;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
289 GetScrollInfo (hwnd, SB_CTL, &scrollinfo);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
290 vertical_drag_in_progress = vert;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
291 #ifdef VERTICAL_SCROLLBAR_DRAG_HACK
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
292 if (vert && (scrollinfo.nTrackPos > scrollinfo.nPos))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
293 /* new buffer position =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
294 * buffer position at start of drag +
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
295 * ((text remaining in buffer at start of drag) *
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
296 * (amount that the thumb has been moved) /
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
297 * (space that remained past end of the thumb at start of drag)) */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
298 value = (int)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
299 (scrollinfo.nPos
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
300 + (((double)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
301 (scrollinfo.nMax - scrollinfo.nPos)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
302 * (scrollinfo.nTrackPos - scrollinfo.nPos))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
303 / (scrollinfo.nMax - scrollinfo.nPage - scrollinfo.nPos)))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
304 - 2; /* ensure that the last line doesn't disappear off screen */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
305 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
306 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
307 value = scrollinfo.nTrackPos;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
308 mswindows_enqueue_misc_user_event
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
309 (frame,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
310 vert ? Qscrollbar_vertical_drag : Qscrollbar_horizontal_drag,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
311 Fcons (win, make_int (value)));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
312 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
313
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
314 case SB_ENDSCROLL:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
315 #ifdef VERTICAL_SCROLLBAR_DRAG_HACK
546
666d73d6ac56 [xemacs-hg @ 2001-05-20 01:17:07 by ben]
ben
parents: 487
diff changeset
316 if (vertical_drag_in_progress && sb)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
317 /* User has just dropped the thumb - finally update it */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
318 SetScrollInfo (SCROLLBAR_MSW_HANDLE (sb), SB_CTL,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
319 &SCROLLBAR_MSW_INFO (sb), TRUE);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
320 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
321 vertical_drag_in_progress = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
322 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
323 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
324 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
325
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
326 static int
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
327 can_scroll (struct scrollbar_instance *scrollbar)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
328 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
329 return scrollbar != NULL
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
330 && IsWindowVisible (SCROLLBAR_MSW_HANDLE (scrollbar))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
331 && IsWindowEnabled (SCROLLBAR_MSW_HANDLE (scrollbar));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
332 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
333
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
334 int
464
5aa1854ad537 Import from CVS: tag r21-2-47
cvs
parents: 442
diff changeset
335 mswindows_handle_mousewheel_event (Lisp_Object frame, int keys, int delta,
5aa1854ad537 Import from CVS: tag r21-2-47
cvs
parents: 442
diff changeset
336 POINTS where)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
337 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
338 int hasVertBar, hasHorzBar; /* Indicates presence of scroll bars */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
339 unsigned wheelScrollLines = 0; /* Number of lines per wheel notch */
826
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 819
diff changeset
340 Lisp_Object win = Qnil, corpore, sano;
464
5aa1854ad537 Import from CVS: tag r21-2-47
cvs
parents: 442
diff changeset
341 struct window_mirror *mirror;
707
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 673
diff changeset
342 int mene, _mene, tekel, upharsin;
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 673
diff changeset
343 Charbpos mens, sana;
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 673
diff changeset
344 Charcount in;
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 673
diff changeset
345 struct window *needle_in_haystack = 0;
464
5aa1854ad537 Import from CVS: tag r21-2-47
cvs
parents: 442
diff changeset
346 POINT donde_esta;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
347
464
5aa1854ad537 Import from CVS: tag r21-2-47
cvs
parents: 442
diff changeset
348 donde_esta.x = where.x;
5aa1854ad537 Import from CVS: tag r21-2-47
cvs
parents: 442
diff changeset
349 donde_esta.y = where.y;
5aa1854ad537 Import from CVS: tag r21-2-47
cvs
parents: 442
diff changeset
350
5aa1854ad537 Import from CVS: tag r21-2-47
cvs
parents: 442
diff changeset
351 /* Find the window to scroll */
5aa1854ad537 Import from CVS: tag r21-2-47
cvs
parents: 442
diff changeset
352
707
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 673
diff changeset
353 /* The mouse event could actually occur outside of the emacs
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 673
diff changeset
354 frame. */
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 673
diff changeset
355 if (ScreenToClient (FRAME_MSWINDOWS_HANDLE (XFRAME (frame)),
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 673
diff changeset
356 &donde_esta) != 0)
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 673
diff changeset
357 {
819
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 814
diff changeset
358 /* stderr_out ("donde_esta: %d %d\n", donde_esta.x, donde_esta.y); */
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 814
diff changeset
359 pixel_to_glyph_translation (XFRAME (frame), donde_esta.x, donde_esta.y,
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 814
diff changeset
360 &mene, &_mene, &tekel, &upharsin,
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 814
diff changeset
361 &needle_in_haystack,
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 814
diff changeset
362 &mens, &sana, &in, &corpore, &sano);
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 814
diff changeset
363
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 814
diff changeset
364 if (needle_in_haystack)
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 814
diff changeset
365 {
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 814
diff changeset
366 win = wrap_window (needle_in_haystack);
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 814
diff changeset
367 /* stderr_out ("found needle\n");
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 814
diff changeset
368 debug_print (win); */
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 814
diff changeset
369 }
707
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 673
diff changeset
370 }
819
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 814
diff changeset
371
6504113e7c2d [xemacs-hg @ 2002-04-25 18:03:23 by andyp]
andyp
parents: 814
diff changeset
372 if (!needle_in_haystack)
707
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 673
diff changeset
373 {
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 673
diff changeset
374 win = FRAME_SELECTED_WINDOW (XFRAME (frame));
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 673
diff changeset
375 needle_in_haystack = XWINDOW (win);
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 673
diff changeset
376 }
464
5aa1854ad537 Import from CVS: tag r21-2-47
cvs
parents: 442
diff changeset
377
707
a307f9a2021d [xemacs-hg @ 2001-12-20 05:49:28 by andyp]
andyp
parents: 673
diff changeset
378 mirror = find_window_mirror (needle_in_haystack);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
379
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
380 /* Check that there is something to scroll */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
381 hasVertBar = can_scroll (mirror->scrollbar_vertical_instance);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
382 hasHorzBar = can_scroll (mirror->scrollbar_horizontal_instance);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
383 if (!hasVertBar && !hasHorzBar)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
384 return FALSE;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
385
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
386 /* No support for panning and zooming, so ignore */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
387 if (keys & (MK_SHIFT | MK_CONTROL))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
388 return FALSE;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
389
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
390 /* Get the number of lines per wheel delta */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 707
diff changeset
391 qxeSystemParametersInfo (SPI_GETWHEELSCROLLLINES, 0, &wheelScrollLines, 0);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
392
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
393 /* Calculate the amount to scroll */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
394 if (wheelScrollLines == WHEEL_PAGESCROLL)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
395 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
396 /* Scroll by a page */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
397 Lisp_Object function;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
398 if (hasVertBar)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
399 function = delta > 0 ? Qscrollbar_page_up : Qscrollbar_page_down;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
400 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
401 function = delta > 0 ? Qscrollbar_page_left : Qscrollbar_page_right;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
402 mswindows_enqueue_misc_user_event (frame, function, Fcons (win, Qnil));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
403 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
404 else /* Scroll by a number of lines */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
405 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
406 /* Calc the number of lines to scroll */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
407 int toScroll = MulDiv (delta, wheelScrollLines, WHEEL_DELTA);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
408
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
409 /* Do the scroll */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
410 Lisp_Object function;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
411 if (hasVertBar)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
412 function = delta > 0 ? Qscrollbar_line_up : Qscrollbar_line_down;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
413 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
414 function = delta > 0 ? Qscrollbar_char_left : Qscrollbar_char_right;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
415 if (toScroll < 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
416 toScroll = -toScroll;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
417 while (toScroll--)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
418 mswindows_enqueue_misc_user_event (frame, function, win);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
419 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
420
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
421 return TRUE;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
422 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
423
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
424 #ifdef MEMORY_USAGE_STATS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
425
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
426 static int
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1726
diff changeset
427 mswindows_compute_scrollbar_instance_usage (struct device *UNUSED (d),
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1726
diff changeset
428 struct scrollbar_instance *inst,
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1726
diff changeset
429 struct overhead_stats *ovstats)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
430 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
431 int total = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
432
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
433 while (inst)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
434 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
435 struct mswindows_scrollbar_data *data =
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
436 (struct mswindows_scrollbar_data *) inst->scrollbar_data;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
437
3024
b7f26b2f78bd [xemacs-hg @ 2005-10-25 08:32:40 by ben]
ben
parents: 3017
diff changeset
438 total += malloced_storage_size (data, sizeof (*data), ovstats);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
439 inst = inst->next;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
440 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
441
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
442 return total;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
443 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
444
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
445 #endif /* MEMORY_USAGE_STATS */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
446
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
447 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
448 /* Device-specific ghost specifiers initialization */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
449 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
450
617
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 611
diff changeset
451 DEFUN ("mswindows-init-scrollbar-metrics", Fmswindows_init_scrollbar_metrics,
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 611
diff changeset
452 1, 1, 0, /*
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
453 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
454 (locale))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
455 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
456 if (DEVICEP (locale))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
457 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
458 add_spec_to_ghost_specifier (Vscrollbar_width,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
459 make_int (GetSystemMetrics (SM_CXVSCROLL)),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
460 locale, Qmswindows, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
461 add_spec_to_ghost_specifier (Vscrollbar_height,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
462 make_int (GetSystemMetrics (SM_CYHSCROLL)),
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
463 locale, Qmswindows, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
464 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
465 return Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
466 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
467
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
468
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
469 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
470 /* initialization */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
471 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
472
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
473 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
474 console_type_create_scrollbar_mswindows (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
475 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
476 CONSOLE_HAS_METHOD (mswindows, create_scrollbar_instance);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
477 CONSOLE_HAS_METHOD (mswindows, free_scrollbar_instance);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
478 CONSOLE_HAS_METHOD (mswindows, release_scrollbar_instance);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
479 CONSOLE_HAS_METHOD (mswindows, update_scrollbar_instance_values);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
480 CONSOLE_HAS_METHOD (mswindows, update_scrollbar_instance_status);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
481 /* CONSOLE_HAS_METHOD (mswindows, scrollbar_width_changed_in_frame); */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
482 #ifdef MEMORY_USAGE_STATS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
483 CONSOLE_HAS_METHOD (mswindows, compute_scrollbar_instance_usage);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
484 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
485 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
486
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
487 void
617
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 611
diff changeset
488 syms_of_scrollbar_mswindows (void)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
489 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
490 DEFSUBR (Fmswindows_init_scrollbar_metrics);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
491 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
492
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
493 void
617
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 611
diff changeset
494 vars_of_scrollbar_mswindows (void)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
495 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
496 Fprovide (intern ("mswindows-scrollbars"));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
497
617
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 611
diff changeset
498 staticpro (&Vmswindows_scrollbar_instance_table);
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 611
diff changeset
499 Vmswindows_scrollbar_instance_table =
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 611
diff changeset
500 make_lisp_hash_table (100, HASH_TABLE_NON_WEAK, HASH_TABLE_EQ);
af57a77cbc92 [xemacs-hg @ 2001-06-18 07:09:50 by ben]
ben
parents: 611
diff changeset
501 }