From: Jan Djärv Date: Sun, 9 Mar 2003 20:43:04 +0000 (+0000) Subject: Implement Ctrl-Mouse-2 (split vertically) for toolkit scrollbars X-Git-Tag: ttn-vms-21-2-B4~10961 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=257f40f26707cf9aa825b16c19d601a71bf27d66;p=emacs.git Implement Ctrl-Mouse-2 (split vertically) for toolkit scrollbars --- diff --git a/src/ChangeLog b/src/ChangeLog index 06ec1b20ad2..76f05fb3806 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,25 @@ +2003-03-09 Jan Dj,Ad(Brv + + * keyboard.c (make_lispy_event): Extend mouse_syms if needed for + toolkit scrollbar click. + + * xterm.c (x_window_to_scroll_bar): Call xg_get_scroll_id_for_window + for USE_GTK. + (x_scroll_bar_handle_click): Use this function for toolkit scrollbars + also. + (handle_one_xevent): ButtonPress/Release: If event is for a toolkit + scrollbar and control is pressed, call x_scroll_bar_handle_click. + + * gtkutil.h: Declare xg_get_scroll_id_for_window. + + * gtkutil.c (xg_get_scroll_id_for_window): New function. + (xg_tool_bar_item_expose_callback): New function. + (xg_tool_bar_expose_callback): Call update_frame_tool_bar. + (xg_create_tool_bar): Connect xg_tool_bar_expose_callback to expose + on the tool bar widget. + (update_frame_tool_bar): Connect xg_tool_bar_item_expose_callback + to expose on the tool bar item widgets. + 2003-03-08 Jan Dj,Ad(Brv * 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)); extern void xg_keep_popup P_ ((GtkWidget *menu, GtkWidget *submenu)); +extern int xg_get_scroll_id_for_window P_ ((Window wid)); + extern void xg_create_scroll_bar P_ ((FRAME_PTR f, struct scroll_bar *bar, 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) event->modifiers |= click_modifier; event->modifiers &= ~up_modifier; + if (event->code >= ASIZE (mouse_syms)) + mouse_syms = larger_vector (mouse_syms, event->code + 1, Qnil); + /* Get the symbol we should use for the mouse click. */ head = modify_event_symbol (event->code, 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) { Lisp_Object tail; +#ifdef USE_GTK + window_id = (Window) xg_get_scroll_id_for_window (window_id); +#endif /* USE_GTK */ + for (tail = Vframe_list; XGCTYPE (tail) == Lisp_Cons; tail = XCDR (tail)) @@ -9860,7 +9864,6 @@ x_scroll_bar_expose (bar, event) This may be called from a signal handler, so we have to ignore GC mark bits. */ -#ifndef USE_TOOLKIT_SCROLL_BARS static void x_scroll_bar_handle_click (bar, event, emacs_event) @@ -9914,6 +9917,7 @@ x_scroll_bar_handle_click (bar, event, emacs_event) XSETINT (bar->dragging, y - XINT (bar->start)); #endif +#ifndef USE_TOOLKIT_SCROLL_BARS /* If the user has released the handle, set it to its final position. */ if (event->type == ButtonRelease && ! NILP (bar->dragging)) @@ -9924,6 +9928,7 @@ x_scroll_bar_handle_click (bar, event, emacs_event) x_scroll_bar_set_handle (bar, new_start, new_end, 0); bar->dragging = Qnil; } +#endif /* Same deal here as the other #if 0. */ #if 0 @@ -9941,6 +9946,8 @@ x_scroll_bar_handle_click (bar, event, emacs_event) } } +#ifndef USE_TOOLKIT_SCROLL_BARS + /* Handle some mouse motion while someone is dragging the scroll bar. 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) } else { -#ifndef USE_TOOLKIT_SCROLL_BARS struct scroll_bar *bar = x_window_to_scroll_bar (event.xbutton.window); +#ifdef USE_TOOLKIT_SCROLL_BARS + /* Make the "Ctrl-Mouse-2 splits window" work for toolkit + scroll bars. */ + if (bar && event.xbutton.state & ControlMask) + { + x_scroll_bar_handle_click (bar, &event, &emacs_event); + *finish = X_EVENT_DROP; + } +#else /* not USE_TOOLKIT_SCROLL_BARS */ if (bar) x_scroll_bar_handle_click (bar, &event, &emacs_event); #endif /* not USE_TOOLKIT_SCROLL_BARS */ @@ -11534,7 +11549,8 @@ handle_one_xevent (dpyinfo, eventp, bufp_r, numcharsp, finish) OTHER: #ifdef USE_X_TOOLKIT BLOCK_INPUT; - XtDispatchEvent (&event); + if (*finish != X_EVENT_DROP) + XtDispatchEvent (&event); UNBLOCK_INPUT; #endif /* USE_X_TOOLKIT */ break;