aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorJean-Sébastien Pédron <dumbbell@FreeBSD.org>2014-08-27 09:34:41 +0000
committerJean-Sébastien Pédron <dumbbell@FreeBSD.org>2014-08-27 09:34:41 +0000
commitd3773c6e8ecd519c985b1647534d970dde3b166d (patch)
tree1283f731489763e1a5b7d7f15f6b96e0952b366f /sys
parent8eac80769b8e3817cea84c2d73e311114c03d938 (diff)
downloadsrc-d3773c6e8ecd519c985b1647534d970dde3b166d.tar.gz
src-d3773c6e8ecd519c985b1647534d970dde3b166d.zip
vt(4): Implement basic support for KDSETMODE ioctl
With the current implementation, this allows an X11 server to tell the console it switches a particular window in "graphics mode". This information is used by the mouse handling code to ignore sysmouse events in the window taken by the X server: only him should receive those events. Reported by: flo@, glebius@, kan@ Tested by: flo@ Reviewed by: kan@ MFC after: 1 week
Notes
Notes: svn path=/head/; revision=270702
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/vt/vt.h1
-rw-r--r--sys/dev/vt/vt_core.c26
2 files changed, 23 insertions, 4 deletions
diff --git a/sys/dev/vt/vt.h b/sys/dev/vt/vt.h
index 89d3de45120c..2108bdfbd916 100644
--- a/sys/dev/vt/vt.h
+++ b/sys/dev/vt/vt.h
@@ -271,6 +271,7 @@ struct vt_window {
#define VWF_VTYLOCK 0x10 /* Prevent window switch. */
#define VWF_MOUSE_HIDE 0x20 /* Disable mouse events processing. */
#define VWF_READY 0x40 /* Window fully initialized. */
+#define VWF_GRAPHICS 0x80 /* Window in graphics mode (KDSETMODE). */
#define VWF_SWWAIT_REL 0x10000 /* Program wait for VT acquire is done. */
#define VWF_SWWAIT_ACQ 0x20000 /* Program wait for VT release is done. */
pid_t vw_pid; /* Terminal holding process */
diff --git a/sys/dev/vt/vt_core.c b/sys/dev/vt/vt_core.c
index 5cc380343f05..d4f71d08b490 100644
--- a/sys/dev/vt/vt_core.c
+++ b/sys/dev/vt/vt_core.c
@@ -1476,8 +1476,13 @@ vt_mouse_event(int type, int x, int y, int event, int cnt, int mlevel)
vf = vw->vw_font;
mark = 0;
- if (vw->vw_flags & VWF_MOUSE_HIDE)
- return; /* Mouse disabled. */
+ if (vw->vw_flags & (VWF_MOUSE_HIDE | VWF_GRAPHICS))
+ /*
+ * Either the mouse is disabled, or the window is in
+ * "graphics mode". The graphics mode is usually set by
+ * an X server, using the KDSETMODE ioctl.
+ */
+ return;
if (vf == NULL) /* Text mode. */
return;
@@ -1509,7 +1514,7 @@ vt_mouse_event(int type, int x, int y, int event, int cnt, int mlevel)
vd->vd_my = y;
if ((vd->vd_mstate & MOUSE_BUTTON1DOWN) &&
(vtbuf_set_mark(&vw->vw_buf, VTB_MARK_MOVE,
- vd->vd_mx / vf->vf_width,
+ vd->vd_mx / vf->vf_width,
vd->vd_my / vf->vf_height) == 1)) {
/*
@@ -1854,7 +1859,20 @@ skip_thunk:
return (0);
}
case KDSETMODE:
- /* XXX */
+ /*
+ * FIXME: This implementation is incomplete compared to
+ * syscons.
+ */
+ switch (*(int *)data) {
+ case KD_TEXT:
+ case KD_TEXT1:
+ case KD_PIXEL:
+ vw->vw_flags &= ~VWF_GRAPHICS;
+ break;
+ case KD_GRAPHICS:
+ vw->vw_flags |= VWF_GRAPHICS;
+ break;
+ }
return (0);
case KDENABIO: /* allow io operations */
error = priv_check(td, PRIV_IO);