Mercurial > hg > xemacs-beta
comparison src/scrollbar-x.c @ 102:a145efe76779 r20-1b3
Import from CVS: tag r20-1b3
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:15:49 +0200 |
parents | 364816949b59 |
children | 0132846995bd |
comparison
equal
deleted
inserted
replaced
101:a0ec055d74dd | 102:a145efe76779 |
---|---|
39 static void x_update_vertical_scrollbar_callback (Widget widget, LWLIB_ID id, | 39 static void x_update_vertical_scrollbar_callback (Widget widget, LWLIB_ID id, |
40 XtPointer client_data); | 40 XtPointer client_data); |
41 static void x_update_horizontal_scrollbar_callback (Widget widget, LWLIB_ID id, | 41 static void x_update_horizontal_scrollbar_callback (Widget widget, LWLIB_ID id, |
42 XtPointer client_data); | 42 XtPointer client_data); |
43 | 43 |
44 /* Used to prevent changing the size of the thumb while drag | 44 /* Used to prevent changing the size of the slider while drag |
45 scrolling, under Motif. This is necessary because the Motif | 45 scrolling, under Motif. This is necessary because the Motif |
46 scrollbar is incredibly stupid about updating the thumb and causes | 46 scrollbar is incredibly stupid about updating the slider and causes |
47 lots of flicker if it is done too often. */ | 47 lots of flicker if it is done too often. */ |
48 static int inhibit_thumb_size_change; | 48 static int inhibit_slider_size_change; |
49 int stupid_vertical_scrollbar_drag_hack; | 49 int stupid_vertical_scrollbar_drag_hack; |
50 | 50 |
51 /* Doesn't work with athena */ | 51 /* Doesn't work with athena */ |
52 #if defined (LWLIB_SCROLLBARS_MOTIF) || defined (LWLIB_SCROLLBARS_LUCID) | 52 #if defined (LWLIB_SCROLLBARS_MOTIF) || defined (LWLIB_SCROLLBARS_LUCID) |
53 static int vertical_drag_in_progress; | 53 static int vertical_drag_in_progress; |
54 #endif | 54 #endif |
55 | 55 |
56 | 56 |
57 /* A device method. */ | 57 /* A device method. */ |
58 static int | 58 static int |
59 x_inhibit_scrollbar_thumb_size_change (void) | 59 x_inhibit_scrollbar_slider_size_change (void) |
60 { | 60 { |
61 /* Doesn't work with Athena */ | 61 /* Doesn't work with Athena */ |
62 #if defined (LWLIB_SCROLLBARS_MOTIF) || defined (LWLIB_SCROLLBARS_LUCID) | 62 #if defined (LWLIB_SCROLLBARS_MOTIF) || defined (LWLIB_SCROLLBARS_LUCID) |
63 return inhibit_thumb_size_change; | 63 return inhibit_slider_size_change; |
64 #else | 64 #else |
65 return 0; | 65 return 0; |
66 #endif | 66 #endif |
67 } | 67 } |
68 | 68 |
127 NULL, FRAME_X_CONTAINER_WIDGET (f), 0, | 127 NULL, FRAME_X_CONTAINER_WIDGET (f), 0, |
128 x_update_horizontal_scrollbar_callback, NULL, NULL); | 128 x_update_horizontal_scrollbar_callback, NULL, NULL); |
129 } | 129 } |
130 } | 130 } |
131 | 131 |
132 #define UPDATE_DATA_FIELD(field) \ | 132 #define UPDATE_DATA_FIELD(field) \ |
133 if (new_##field >= 0 && \ | 133 if (new_##field >= 0 && \ |
134 SCROLLBAR_X_POS_DATA (inst).field != new_##field) { \ | 134 SCROLLBAR_X_POS_DATA (inst).field != new_##field) { \ |
135 SCROLLBAR_X_POS_DATA (inst).field = new_##field; \ | 135 SCROLLBAR_X_POS_DATA (inst).field = new_##field; \ |
136 inst->scrollbar_instance_changed = 1; \ | 136 inst->scrollbar_instance_changed = 1; \ |
137 } | 137 } |
138 | 138 |
139 /* A device method. */ | 139 /* A device method. */ |
140 /* #### The -1 check is such a hack. */ | 140 /* #### The -1 check is such a hack. */ |
141 static void | 141 static void |
247 static void | 247 static void |
248 x_update_scrollbar_instance_status (struct window *w, int active, int size, | 248 x_update_scrollbar_instance_status (struct window *w, int active, int size, |
249 struct scrollbar_instance *instance) | 249 struct scrollbar_instance *instance) |
250 { | 250 { |
251 struct frame *f = XFRAME (w->frame); | 251 struct frame *f = XFRAME (w->frame); |
252 char managed = XtIsManaged (SCROLLBAR_X_WIDGET (instance)); | 252 Boolean managed = XtIsManaged (SCROLLBAR_X_WIDGET (instance)); |
253 | 253 |
254 if (active && size) | 254 if (active && size) |
255 { | 255 { |
256 widget_value *wv = scrollbar_instance_to_widget_value (instance); | 256 widget_value *wv = scrollbar_instance_to_widget_value (instance); |
257 | 257 |
589 signal_special_Xt_user_event (win, Qscrollbar_to_bottom, win); | 589 signal_special_Xt_user_event (win, Qscrollbar_to_bottom, win); |
590 break; | 590 break; |
591 | 591 |
592 | 592 |
593 case SCROLLBAR_CHANGE: | 593 case SCROLLBAR_CHANGE: |
594 inhibit_thumb_size_change = 0; | 594 inhibit_slider_size_change = 0; |
595 #if defined (LWLIB_SCROLLBARS_MOTIF) || defined (LWLIB_SCROLLBARS_LUCID) | 595 #if defined (LWLIB_SCROLLBARS_MOTIF) || defined (LWLIB_SCROLLBARS_LUCID) |
596 vertical_drag_in_progress = 0; | 596 vertical_drag_in_progress = 0; |
597 SCROLLBAR_X_VDRAG_ORIG_VALUE (instance) = data->slider_value; | 597 SCROLLBAR_X_VDRAG_ORIG_VALUE (instance) = data->slider_value; |
598 SCROLLBAR_X_VDRAG_ORIG_WINDOW_START (instance) = | 598 SCROLLBAR_X_VDRAG_ORIG_WINDOW_START (instance) = |
599 XINT (Fwindow_start (win)); | 599 XINT (Fwindow_start (win)); |
604 | 604 |
605 case SCROLLBAR_DRAG: | 605 case SCROLLBAR_DRAG: |
606 { | 606 { |
607 int value; | 607 int value; |
608 | 608 |
609 inhibit_thumb_size_change = 1; | 609 inhibit_slider_size_change = 1; |
610 | 610 |
611 #if defined (LWLIB_SCROLLBARS_MOTIF) || defined (LWLIB_SCROLLBARS_LUCID) | 611 #if defined (LWLIB_SCROLLBARS_MOTIF) || defined (LWLIB_SCROLLBARS_LUCID) |
612 /* Doing drags with Motif-like scrollbars is a mess, since we | 612 /* Doing drags with Motif-like scrollbars is a mess, since we |
613 want to avoid having the window position jump when you | 613 want to avoid having the window position jump when you |
614 first grab the scrollbar, but we also want to ensure that | 614 first grab the scrollbar, but we also want to ensure that |
740 break; | 740 break; |
741 case SCROLLBAR_BOTTOM: | 741 case SCROLLBAR_BOTTOM: |
742 signal_special_Xt_user_event (win, Qscrollbar_to_right, win); | 742 signal_special_Xt_user_event (win, Qscrollbar_to_right, win); |
743 break; | 743 break; |
744 case SCROLLBAR_CHANGE: | 744 case SCROLLBAR_CHANGE: |
745 inhibit_thumb_size_change = 0; | 745 inhibit_slider_size_change = 0; |
746 break; | 746 break; |
747 case SCROLLBAR_DRAG: | 747 case SCROLLBAR_DRAG: |
748 inhibit_thumb_size_change = 1; | 748 inhibit_slider_size_change = 1; |
749 /* #### Fix the damn toolkit code so they all work the same way. | 749 /* #### Fix the damn toolkit code so they all work the same way. |
750 Lucid is the one mostly wrong.*/ | 750 Lucid is the one mostly wrong.*/ |
751 #if defined (LWLIB_SCROLLBARS_LUCID) || defined (LWLIB_SCROLLBARS_ATHENA3D) | 751 #if defined (LWLIB_SCROLLBARS_LUCID) || defined (LWLIB_SCROLLBARS_ATHENA3D) |
752 signal_special_Xt_user_event (win, Qscrollbar_horizontal_drag, | 752 signal_special_Xt_user_event (win, Qscrollbar_horizontal_drag, |
753 (Fcons | 753 (Fcons |
832 /************************************************************************/ | 832 /************************************************************************/ |
833 | 833 |
834 void | 834 void |
835 console_type_create_scrollbar_x (void) | 835 console_type_create_scrollbar_x (void) |
836 { | 836 { |
837 CONSOLE_HAS_METHOD (x, inhibit_scrollbar_thumb_size_change); | 837 CONSOLE_HAS_METHOD (x, inhibit_scrollbar_slider_size_change); |
838 CONSOLE_HAS_METHOD (x, free_scrollbar_instance); | 838 CONSOLE_HAS_METHOD (x, free_scrollbar_instance); |
839 CONSOLE_HAS_METHOD (x, release_scrollbar_instance); | 839 CONSOLE_HAS_METHOD (x, release_scrollbar_instance); |
840 CONSOLE_HAS_METHOD (x, create_scrollbar_instance); | 840 CONSOLE_HAS_METHOD (x, create_scrollbar_instance); |
841 CONSOLE_HAS_METHOD (x, update_scrollbar_instance_values); | 841 CONSOLE_HAS_METHOD (x, update_scrollbar_instance_values); |
842 CONSOLE_HAS_METHOD (x, update_scrollbar_instance_status); | 842 CONSOLE_HAS_METHOD (x, update_scrollbar_instance_status); |