From owner-svn-src-head@FreeBSD.ORG Wed Aug 27 09:34:42 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 84CD6DF5; Wed, 27 Aug 2014 09:34:42 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5627E39D8; Wed, 27 Aug 2014 09:34:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s7R9YglJ062585; Wed, 27 Aug 2014 09:34:42 GMT (envelope-from dumbbell@FreeBSD.org) Received: (from dumbbell@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s7R9Yf1O062583; Wed, 27 Aug 2014 09:34:41 GMT (envelope-from dumbbell@FreeBSD.org) Message-Id: <201408270934.s7R9Yf1O062583@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dumbbell set sender to dumbbell@FreeBSD.org using -f From: Jean-Sebastien Pedron Date: Wed, 27 Aug 2014 09:34:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r270702 - head/sys/dev/vt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Aug 2014 09:34:42 -0000 Author: dumbbell Date: Wed Aug 27 09:34:41 2014 New Revision: 270702 URL: http://svnweb.freebsd.org/changeset/base/270702 Log: 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 Modified: head/sys/dev/vt/vt.h head/sys/dev/vt/vt_core.c Modified: head/sys/dev/vt/vt.h ============================================================================== --- head/sys/dev/vt/vt.h Wed Aug 27 09:26:33 2014 (r270701) +++ head/sys/dev/vt/vt.h Wed Aug 27 09:34:41 2014 (r270702) @@ -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 */ Modified: head/sys/dev/vt/vt_core.c ============================================================================== --- head/sys/dev/vt/vt_core.c Wed Aug 27 09:26:33 2014 (r270701) +++ head/sys/dev/vt/vt_core.c Wed Aug 27 09:34:41 2014 (r270702) @@ -1476,8 +1476,13 @@ vt_mouse_event(int type, int x, int y, i 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, i 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);