Mercurial > hg > xemacs-beta
comparison src/scrollbar-x.c @ 82:6a378aca36af r20-0b91
Import from CVS: tag r20-0b91
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:07:36 +0200 |
parents | 131b0175ea99 |
children | ac0620f6398e |
comparison
equal
deleted
inserted
replaced
81:ebca3d831cea | 82:6a378aca36af |
---|---|
44 /* Used to prevent changing the size of the thumb while drag | 44 /* Used to prevent changing the size of the thumb 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 thumb 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_thumb_size_change; |
49 | 49 int stupid_vertical_scrollbar_drag_hack = 1; |
50 | |
51 /* Doesn't work with athena */ | |
50 #if defined (LWLIB_SCROLLBARS_MOTIF) || defined (LWLIB_SCROLLBARS_LUCID) | 52 #if defined (LWLIB_SCROLLBARS_MOTIF) || defined (LWLIB_SCROLLBARS_LUCID) |
51 static int vertical_drag_in_progress; | 53 static int vertical_drag_in_progress; |
52 #endif | 54 #endif |
53 | 55 |
54 | 56 |
55 /* A device method. */ | 57 /* A device method. */ |
56 static int | 58 static int |
57 x_inhibit_scrollbar_thumb_size_change (void) | 59 x_inhibit_scrollbar_thumb_size_change (void) |
58 { | 60 { |
61 /* Doeesn't work with Athena */ | |
59 #if defined (LWLIB_SCROLLBARS_MOTIF) || defined (LWLIB_SCROLLBARS_LUCID) | 62 #if defined (LWLIB_SCROLLBARS_MOTIF) || defined (LWLIB_SCROLLBARS_LUCID) |
60 return inhibit_thumb_size_change; | 63 return inhibit_thumb_size_change; |
61 #else | 64 #else |
62 return 0; | 65 return 0; |
63 #endif | 66 #endif |
101 instance->scrollbar_data = malloc_type_and_zero (struct x_scrollbar_data); | 104 instance->scrollbar_data = malloc_type_and_zero (struct x_scrollbar_data); |
102 | 105 |
103 SCROLLBAR_X_ID (instance) = new_lwlib_id (); | 106 SCROLLBAR_X_ID (instance) = new_lwlib_id (); |
104 sprintf (buffer, "scrollbar_%d", SCROLLBAR_X_ID (instance)); | 107 sprintf (buffer, "scrollbar_%d", SCROLLBAR_X_ID (instance)); |
105 SCROLLBAR_X_NAME (instance) = xstrdup (buffer); | 108 SCROLLBAR_X_NAME (instance) = xstrdup (buffer); |
106 #if defined (LWLIB_SCROLLBARS_MOTIF) || defined (LWLIB_SCROLLBARS_LUCID) | 109 #if defined (LWLIB_SCROLLBARS_MOTIF) || defined (LWLIB_SCROLLBARS_LUCID) || \ |
110 defined (LWLIB_SCROLLBARS_ATHENA3D) | |
107 SCROLLBAR_X_VDRAG_ORIG_VALUE (instance) = -1; | 111 SCROLLBAR_X_VDRAG_ORIG_VALUE (instance) = -1; |
108 #endif | 112 #endif |
109 | 113 |
110 if (vertical) | 114 if (vertical) |
111 { | 115 { |
155 UPDATE_DATA_FIELD (scrollbar_width); | 159 UPDATE_DATA_FIELD (scrollbar_width); |
156 UPDATE_DATA_FIELD (scrollbar_height); | 160 UPDATE_DATA_FIELD (scrollbar_height); |
157 UPDATE_DATA_FIELD (scrollbar_x); | 161 UPDATE_DATA_FIELD (scrollbar_x); |
158 UPDATE_DATA_FIELD (scrollbar_y); | 162 UPDATE_DATA_FIELD (scrollbar_y); |
159 | 163 |
164 /* This doesn't work with Athena, why? */ | |
160 #if defined (LWLIB_SCROLLBARS_MOTIF) || defined (LWLIB_SCROLLBARS_LUCID) | 165 #if defined (LWLIB_SCROLLBARS_MOTIF) || defined (LWLIB_SCROLLBARS_LUCID) |
161 if (w && !vertical_drag_in_progress) | 166 if (w && !vertical_drag_in_progress) |
162 { | 167 { |
163 int new_vov = SCROLLBAR_X_POS_DATA (inst).slider_position; | 168 int new_vov = SCROLLBAR_X_POS_DATA (inst).slider_position; |
164 int new_vows = marker_position (w->start[CURRENT_DISP]); | 169 int new_vows = marker_position (w->start[CURRENT_DISP]); |
530 | 535 |
531 /* The Athena scrollbar paging behavior is that of xterms. | 536 /* The Athena scrollbar paging behavior is that of xterms. |
532 Depending on where you click the size of the page varies. | 537 Depending on where you click the size of the page varies. |
533 Motif always does a standard Emacs page. */ | 538 Motif always does a standard Emacs page. */ |
534 case SCROLLBAR_PAGE_UP: | 539 case SCROLLBAR_PAGE_UP: |
535 #if !defined (LWLIB_SCROLLBARS_MOTIF) && !defined (LWLIB_SCROLLBARS_LUCID) | 540 #if !defined (LWLIB_SCROLLBARS_MOTIF) && !defined (LWLIB_SCROLLBARS_LUCID) && \ |
541 !defined (LWLIB_SCROLLBARS_ATHENA3D) | |
536 { | 542 { |
537 double tmp = ((double) data->slider_value / | 543 double tmp = ((double) data->slider_value / |
538 (double) SCROLLBAR_X_POS_DATA(instance).scrollbar_height); | 544 (double) SCROLLBAR_X_POS_DATA(instance).scrollbar_height); |
539 double line = tmp * | 545 double line = tmp * |
540 (double) window_displayed_height (XWINDOW (win)); | 546 (double) window_displayed_height (XWINDOW (win)); |
549 Fcons (win, Qnil)); | 555 Fcons (win, Qnil)); |
550 #endif | 556 #endif |
551 break; | 557 break; |
552 | 558 |
553 case SCROLLBAR_PAGE_DOWN: | 559 case SCROLLBAR_PAGE_DOWN: |
554 #if !defined (LWLIB_SCROLLBARS_MOTIF) && !defined (LWLIB_SCROLLBARS_LUCID) | 560 #if !defined (LWLIB_SCROLLBARS_MOTIF) && !defined (LWLIB_SCROLLBARS_LUCID) && \ |
561 !defined (LWLIB_SCROLLBARS_ATHENA3D) | |
555 { | 562 { |
556 double tmp = ((double) data->slider_value / | 563 double tmp = ((double) data->slider_value / |
557 (double) SCROLLBAR_X_POS_DATA(instance).scrollbar_height); | 564 (double) SCROLLBAR_X_POS_DATA(instance).scrollbar_height); |
558 double line = tmp * | 565 double line = tmp * |
559 (double) window_displayed_height (XWINDOW (win)); | 566 (double) window_displayed_height (XWINDOW (win)); |
589 vertical_drag_in_progress = 0; | 596 vertical_drag_in_progress = 0; |
590 SCROLLBAR_X_VDRAG_ORIG_VALUE (instance) = data->slider_value; | 597 SCROLLBAR_X_VDRAG_ORIG_VALUE (instance) = data->slider_value; |
591 SCROLLBAR_X_VDRAG_ORIG_WINDOW_START (instance) = | 598 SCROLLBAR_X_VDRAG_ORIG_WINDOW_START (instance) = |
592 XINT (Fwindow_start (win)); | 599 XINT (Fwindow_start (win)); |
593 #endif | 600 #endif |
601 stupid_vertical_scrollbar_drag_hack = 0; | |
594 break; | 602 break; |
595 | 603 |
596 case SCROLLBAR_DRAG: | 604 case SCROLLBAR_DRAG: |
597 { | 605 { |
598 int value; | 606 int value; |
665 - SCROLLBAR_X_POS_DATA (instance).slider_size | 673 - SCROLLBAR_X_POS_DATA (instance).slider_size |
666 - SCROLLBAR_X_VDRAG_ORIG_VALUE (instance)))); | 674 - SCROLLBAR_X_VDRAG_ORIG_VALUE (instance)))); |
667 } | 675 } |
668 } | 676 } |
669 #else | 677 #else |
678 stupid_vertical_scrollbar_drag_hack = 0; | |
670 value = data->slider_value; | 679 value = data->slider_value; |
671 #endif | 680 #endif |
672 | 681 |
673 if (value >= SCROLLBAR_X_POS_DATA (instance).maximum) | 682 if (value >= SCROLLBAR_X_POS_DATA (instance).maximum) |
674 value = SCROLLBAR_X_POS_DATA (instance).maximum - 1; | 683 value = SCROLLBAR_X_POS_DATA (instance).maximum - 1; |
736 break; | 745 break; |
737 case SCROLLBAR_DRAG: | 746 case SCROLLBAR_DRAG: |
738 inhibit_thumb_size_change = 1; | 747 inhibit_thumb_size_change = 1; |
739 /* #### Fix the damn toolkit code so they all work the same way. | 748 /* #### Fix the damn toolkit code so they all work the same way. |
740 Lucid is the one mostly wrong.*/ | 749 Lucid is the one mostly wrong.*/ |
741 #if defined (LWLIB_SCROLLBARS_LUCID) | 750 #if defined (LWLIB_SCROLLBARS_LUCID) || defined (LWLIB_SCROLLBARS_ATHENA3D) |
742 signal_special_Xt_user_event (win, Qscrollbar_horizontal_drag, | 751 signal_special_Xt_user_event (win, Qscrollbar_horizontal_drag, |
743 (Fcons | 752 (Fcons |
744 (win, make_int (data->slider_value)))); | 753 (win, make_int (data->slider_value)))); |
745 #else | 754 #else |
746 signal_special_Xt_user_event (win, Qscrollbar_horizontal_drag, | 755 signal_special_Xt_user_event (win, Qscrollbar_horizontal_drag, |