diff src/frame-tty.c @ 153:25f70ba0133c r20-3b3

Import from CVS: tag r20-3b3
author cvs
date Mon, 13 Aug 2007 09:38:25 +0200
parents 538048ae2ab8
children 43dd3413c7c7
line wrap: on
line diff
--- a/src/frame-tty.c	Mon Aug 13 09:37:21 2007 +0200
+++ b/src/frame-tty.c	Mon Aug 13 09:38:25 2007 +0200
@@ -31,6 +31,10 @@
 #include "console-tty.h"
 #include "frame.h"
 
+#ifdef HAVE_GPM
+#include <gpm.h>
+#endif
+
 
 /* Default properties to use when creating frames.  */
 Lisp_Object Vdefault_tty_frame_plist;
@@ -82,6 +86,33 @@
     call1 (Qinit_post_tty_win, FRAME_CONSOLE (f));
 }
 
+#ifdef HAVE_GPM
+static int
+tty_get_mouse_position (struct device *d, Lisp_Object *frame, int *x, int *y)
+{
+  Gpm_Event ev;
+  int num_buttons;
+
+  num_buttons = Gpm_GetSnapshot(&ev);
+  *x = ev.x;
+  *y = ev.y;
+  *frame = DEVICE_SELECTED_FRAME (d);
+  return (1);
+}
+
+static void
+tty_set_mouse_position (struct window *w, int x, int y)
+{
+  /* XXX
+     I couldn't find any GPM functions that set the mouse position.
+     Mr. Perry had left this function empty; that must be why.
+     karlheg
+  */
+}
+
+#endif
+
+
 /* Change from withdrawn state to mapped state. */
 static void
 tty_make_frame_visible (struct frame *f)
@@ -170,6 +201,10 @@
   CONSOLE_HAS_METHOD (tty, init_frame_1);
   CONSOLE_HAS_METHOD (tty, init_frame_3);
   CONSOLE_HAS_METHOD (tty, after_init_frame);
+#ifdef HAVE_GPM
+  CONSOLE_HAS_METHOD (tty, get_mouse_position);
+  CONSOLE_HAS_METHOD (tty, set_mouse_position);
+#endif
   CONSOLE_HAS_METHOD (tty, make_frame_visible);
   CONSOLE_HAS_METHOD (tty, make_frame_invisible);
   CONSOLE_HAS_METHOD (tty, frame_visible_p);
@@ -190,4 +225,7 @@
 
   tty_console_methods->device_specific_frame_props =
     &Vdefault_tty_frame_plist;
+
+  /* Tty frames are now supported.  Advertise a feature to indicate this. */
+  Fprovide (intern ("tty-frames"));
 }