Mercurial > emacs
comparison src/xterm.c @ 50064:40170697bff1
Implement Ctrl-Mouse-2 (split vertically) for toolkit scrollbars
author | Jan Djärv <jan.h.d@swipnet.se> |
---|---|
date | Sun, 09 Mar 2003 20:43:04 +0000 |
parents | 7933b5de384c |
children | ee703213acfa |
comparison
equal
deleted
inserted
replaced
50063:464ffd8b9e33 | 50064:40170697bff1 |
---|---|
8434 x_window_to_scroll_bar (window_id) | 8434 x_window_to_scroll_bar (window_id) |
8435 Window window_id; | 8435 Window window_id; |
8436 { | 8436 { |
8437 Lisp_Object tail; | 8437 Lisp_Object tail; |
8438 | 8438 |
8439 #ifdef USE_GTK | |
8440 window_id = (Window) xg_get_scroll_id_for_window (window_id); | |
8441 #endif /* USE_GTK */ | |
8442 | |
8439 for (tail = Vframe_list; | 8443 for (tail = Vframe_list; |
8440 XGCTYPE (tail) == Lisp_Cons; | 8444 XGCTYPE (tail) == Lisp_Cons; |
8441 tail = XCDR (tail)) | 8445 tail = XCDR (tail)) |
8442 { | 8446 { |
8443 Lisp_Object frame, bar, condemned; | 8447 Lisp_Object frame, bar, condemned; |
9858 is set to something other than NO_EVENT, it is enqueued. | 9862 is set to something other than NO_EVENT, it is enqueued. |
9859 | 9863 |
9860 This may be called from a signal handler, so we have to ignore GC | 9864 This may be called from a signal handler, so we have to ignore GC |
9861 mark bits. */ | 9865 mark bits. */ |
9862 | 9866 |
9863 #ifndef USE_TOOLKIT_SCROLL_BARS | |
9864 | 9867 |
9865 static void | 9868 static void |
9866 x_scroll_bar_handle_click (bar, event, emacs_event) | 9869 x_scroll_bar_handle_click (bar, event, emacs_event) |
9867 struct scroll_bar *bar; | 9870 struct scroll_bar *bar; |
9868 XEvent *event; | 9871 XEvent *event; |
9912 if (event->type == ButtonPress | 9915 if (event->type == ButtonPress |
9913 && emacs_event->part == scroll_bar_handle) | 9916 && emacs_event->part == scroll_bar_handle) |
9914 XSETINT (bar->dragging, y - XINT (bar->start)); | 9917 XSETINT (bar->dragging, y - XINT (bar->start)); |
9915 #endif | 9918 #endif |
9916 | 9919 |
9920 #ifndef USE_TOOLKIT_SCROLL_BARS | |
9917 /* If the user has released the handle, set it to its final position. */ | 9921 /* If the user has released the handle, set it to its final position. */ |
9918 if (event->type == ButtonRelease | 9922 if (event->type == ButtonRelease |
9919 && ! NILP (bar->dragging)) | 9923 && ! NILP (bar->dragging)) |
9920 { | 9924 { |
9921 int new_start = y - XINT (bar->dragging); | 9925 int new_start = y - XINT (bar->dragging); |
9922 int new_end = new_start + (XINT (bar->end) - XINT (bar->start)); | 9926 int new_end = new_start + (XINT (bar->end) - XINT (bar->start)); |
9923 | 9927 |
9924 x_scroll_bar_set_handle (bar, new_start, new_end, 0); | 9928 x_scroll_bar_set_handle (bar, new_start, new_end, 0); |
9925 bar->dragging = Qnil; | 9929 bar->dragging = Qnil; |
9926 } | 9930 } |
9931 #endif | |
9927 | 9932 |
9928 /* Same deal here as the other #if 0. */ | 9933 /* Same deal here as the other #if 0. */ |
9929 #if 0 | 9934 #if 0 |
9930 /* Clicks on the handle are always reported as occurring at the top of | 9935 /* Clicks on the handle are always reported as occurring at the top of |
9931 the handle. */ | 9936 the handle. */ |
9938 #endif | 9943 #endif |
9939 | 9944 |
9940 XSETINT (emacs_event->y, top_range); | 9945 XSETINT (emacs_event->y, top_range); |
9941 } | 9946 } |
9942 } | 9947 } |
9948 | |
9949 #ifndef USE_TOOLKIT_SCROLL_BARS | |
9943 | 9950 |
9944 /* Handle some mouse motion while someone is dragging the scroll bar. | 9951 /* Handle some mouse motion while someone is dragging the scroll bar. |
9945 | 9952 |
9946 This may be called from a signal handler, so we have to ignore GC | 9953 This may be called from a signal handler, so we have to ignore GC |
9947 mark bits. */ | 9954 mark bits. */ |
11419 construct_mouse_click (&emacs_event, &event, f); | 11426 construct_mouse_click (&emacs_event, &event, f); |
11420 } | 11427 } |
11421 } | 11428 } |
11422 else | 11429 else |
11423 { | 11430 { |
11424 #ifndef USE_TOOLKIT_SCROLL_BARS | |
11425 struct scroll_bar *bar | 11431 struct scroll_bar *bar |
11426 = x_window_to_scroll_bar (event.xbutton.window); | 11432 = x_window_to_scroll_bar (event.xbutton.window); |
11427 | 11433 |
11434 #ifdef USE_TOOLKIT_SCROLL_BARS | |
11435 /* Make the "Ctrl-Mouse-2 splits window" work for toolkit | |
11436 scroll bars. */ | |
11437 if (bar && event.xbutton.state & ControlMask) | |
11438 { | |
11439 x_scroll_bar_handle_click (bar, &event, &emacs_event); | |
11440 *finish = X_EVENT_DROP; | |
11441 } | |
11442 #else /* not USE_TOOLKIT_SCROLL_BARS */ | |
11428 if (bar) | 11443 if (bar) |
11429 x_scroll_bar_handle_click (bar, &event, &emacs_event); | 11444 x_scroll_bar_handle_click (bar, &event, &emacs_event); |
11430 #endif /* not USE_TOOLKIT_SCROLL_BARS */ | 11445 #endif /* not USE_TOOLKIT_SCROLL_BARS */ |
11431 } | 11446 } |
11432 | 11447 |
11532 | 11547 |
11533 default: | 11548 default: |
11534 OTHER: | 11549 OTHER: |
11535 #ifdef USE_X_TOOLKIT | 11550 #ifdef USE_X_TOOLKIT |
11536 BLOCK_INPUT; | 11551 BLOCK_INPUT; |
11537 XtDispatchEvent (&event); | 11552 if (*finish != X_EVENT_DROP) |
11553 XtDispatchEvent (&event); | |
11538 UNBLOCK_INPUT; | 11554 UNBLOCK_INPUT; |
11539 #endif /* USE_X_TOOLKIT */ | 11555 #endif /* USE_X_TOOLKIT */ |
11540 break; | 11556 break; |
11541 } | 11557 } |
11542 | 11558 |