changeset 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 464ffd8b9e33
children 747150fd554a
files src/ChangeLog src/gtkutil.h src/keyboard.c src/xterm.c
diffstat 4 files changed, 46 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Sun Mar 09 20:41:39 2003 +0000
+++ b/src/ChangeLog	Sun Mar 09 20:43:04 2003 +0000
@@ -1,3 +1,25 @@
+2003-03-09  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
+
+	* 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  <jan.h.d@swipnet.se>
 
 	* gtkutil.c (update_frame_tool_bar): Compare pixmap ID instead of
--- a/src/gtkutil.h	Sun Mar 09 20:41:39 2003 +0000
+++ b/src/gtkutil.h	Sun Mar 09 20:43:04 2003 +0000
@@ -151,6 +151,8 @@
 
 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,
--- a/src/keyboard.c	Sun Mar 09 20:41:39 2003 +0000
+++ b/src/keyboard.c	Sun Mar 09 20:43:04 2003 +0000
@@ -5431,6 +5431,9 @@
 	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,
--- a/src/xterm.c	Sun Mar 09 20:41:39 2003 +0000
+++ b/src/xterm.c	Sun Mar 09 20:43:04 2003 +0000
@@ -8436,6 +8436,10 @@
 {
   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 @@
    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 @@
       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_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 @@
   }
 }
 
+#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 @@
           }
         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 @@
     OTHER:
 #ifdef USE_X_TOOLKIT
     BLOCK_INPUT;
-    XtDispatchEvent (&event);
+    if (*finish != X_EVENT_DROP)
+      XtDispatchEvent (&event);
     UNBLOCK_INPUT;
 #endif /* USE_X_TOOLKIT */
     break;