diff options
| author | Jan Djärv | 2003-03-09 20:43:04 +0000 |
|---|---|---|
| committer | Jan Djärv | 2003-03-09 20:43:04 +0000 |
| commit | 257f40f26707cf9aa825b16c19d601a71bf27d66 (patch) | |
| tree | a44ba2d64baa024327666df9eb5a63354c7adb0c /src | |
| parent | 3a8a22fc3d5817b031cb40febeb000bf33d80a60 (diff) | |
| download | emacs-257f40f26707cf9aa825b16c19d601a71bf27d66.tar.gz emacs-257f40f26707cf9aa825b16c19d601a71bf27d66.zip | |
Implement Ctrl-Mouse-2 (split vertically) for toolkit scrollbars
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 22 | ||||
| -rw-r--r-- | src/gtkutil.h | 2 | ||||
| -rw-r--r-- | src/keyboard.c | 3 | ||||
| -rw-r--r-- | src/xterm.c | 22 |
4 files changed, 46 insertions, 3 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 06ec1b20ad2..76f05fb3806 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,25 @@ | |||
| 1 | 2003-03-09 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | ||
| 2 | |||
| 3 | * keyboard.c (make_lispy_event): Extend mouse_syms if needed for | ||
| 4 | toolkit scrollbar click. | ||
| 5 | |||
| 6 | * xterm.c (x_window_to_scroll_bar): Call xg_get_scroll_id_for_window | ||
| 7 | for USE_GTK. | ||
| 8 | (x_scroll_bar_handle_click): Use this function for toolkit scrollbars | ||
| 9 | also. | ||
| 10 | (handle_one_xevent): ButtonPress/Release: If event is for a toolkit | ||
| 11 | scrollbar and control is pressed, call x_scroll_bar_handle_click. | ||
| 12 | |||
| 13 | * gtkutil.h: Declare xg_get_scroll_id_for_window. | ||
| 14 | |||
| 15 | * gtkutil.c (xg_get_scroll_id_for_window): New function. | ||
| 16 | (xg_tool_bar_item_expose_callback): New function. | ||
| 17 | (xg_tool_bar_expose_callback): Call update_frame_tool_bar. | ||
| 18 | (xg_create_tool_bar): Connect xg_tool_bar_expose_callback to expose | ||
| 19 | on the tool bar widget. | ||
| 20 | (update_frame_tool_bar): Connect xg_tool_bar_item_expose_callback | ||
| 21 | to expose on the tool bar item widgets. | ||
| 22 | |||
| 1 | 2003-03-08 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | 23 | 2003-03-08 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> |
| 2 | 24 | ||
| 3 | * gtkutil.c (update_frame_tool_bar): Compare pixmap ID instead of | 25 | * gtkutil.c (update_frame_tool_bar): Compare pixmap ID instead of |
diff --git a/src/gtkutil.h b/src/gtkutil.h index b6779b465f1..b79b5fde97a 100644 --- a/src/gtkutil.h +++ b/src/gtkutil.h | |||
| @@ -151,6 +151,8 @@ extern int xg_update_frame_menubar P_ ((FRAME_PTR f)); | |||
| 151 | 151 | ||
| 152 | extern void xg_keep_popup P_ ((GtkWidget *menu, GtkWidget *submenu)); | 152 | extern void xg_keep_popup P_ ((GtkWidget *menu, GtkWidget *submenu)); |
| 153 | 153 | ||
| 154 | extern int xg_get_scroll_id_for_window P_ ((Window wid)); | ||
| 155 | |||
| 154 | extern void xg_create_scroll_bar P_ ((FRAME_PTR f, | 156 | extern void xg_create_scroll_bar P_ ((FRAME_PTR f, |
| 155 | struct scroll_bar *bar, | 157 | struct scroll_bar *bar, |
| 156 | GCallback scroll_callback, | 158 | GCallback scroll_callback, |
diff --git a/src/keyboard.c b/src/keyboard.c index 86fdb9a0c40..11e3980324f 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -5431,6 +5431,9 @@ make_lispy_event (event) | |||
| 5431 | event->modifiers |= click_modifier; | 5431 | event->modifiers |= click_modifier; |
| 5432 | event->modifiers &= ~up_modifier; | 5432 | event->modifiers &= ~up_modifier; |
| 5433 | 5433 | ||
| 5434 | if (event->code >= ASIZE (mouse_syms)) | ||
| 5435 | mouse_syms = larger_vector (mouse_syms, event->code + 1, Qnil); | ||
| 5436 | |||
| 5434 | /* Get the symbol we should use for the mouse click. */ | 5437 | /* Get the symbol we should use for the mouse click. */ |
| 5435 | head = modify_event_symbol (event->code, | 5438 | head = modify_event_symbol (event->code, |
| 5436 | event->modifiers, | 5439 | event->modifiers, |
diff --git a/src/xterm.c b/src/xterm.c index 56a57b23b1e..f6566c1b32e 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -8436,6 +8436,10 @@ x_window_to_scroll_bar (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)) |
| @@ -9860,7 +9864,6 @@ x_scroll_bar_expose (bar, event) | |||
| 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) |
| @@ -9914,6 +9917,7 @@ x_scroll_bar_handle_click (bar, event, emacs_event) | |||
| 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)) |
| @@ -9924,6 +9928,7 @@ x_scroll_bar_handle_click (bar, event, emacs_event) | |||
| 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 |
| @@ -9941,6 +9946,8 @@ x_scroll_bar_handle_click (bar, event, emacs_event) | |||
| 9941 | } | 9946 | } |
| 9942 | } | 9947 | } |
| 9943 | 9948 | ||
| 9949 | #ifndef USE_TOOLKIT_SCROLL_BARS | ||
| 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 |
| @@ -11421,10 +11428,18 @@ handle_one_xevent (dpyinfo, eventp, bufp_r, numcharsp, finish) | |||
| 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 */ |
| @@ -11534,7 +11549,8 @@ handle_one_xevent (dpyinfo, eventp, bufp_r, numcharsp, finish) | |||
| 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; |