Connection setup field "num visualtypes" differ from number actual getting records

2015-12-01 Thread Andrzej Borucki
In standard documentation xproto\x11protocol.pdf on page 141 is described
connection setup reply and field "number of visualtypes". It was 119 but If
i read whole reply, is 122 visualtypes (Commands xdpyinfo show 120).
Last three records have small visual-id (1,15,and 80) whereas other have
about 370. Last 3 records are correct.
I must read 119 or 122 records?
___
xorg@lists.x.org: X.Org support
Archives: http://lists.freedesktop.org/archives/xorg
Info: http://lists.x.org/mailman/listinfo/xorg
Your subscription address: %(user_address)s

[Xorg-driver-geode] [Bug 80825] Output is disabled on VT switch

2015-12-01 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=80825

--- Comment #3 from Connor Behan  ---
s/explicity/explicit/ in my commit summary.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
___
Xorg-driver-geode mailing list
Xorg-driver-geode@lists.x.org
http://lists.x.org/mailman/listinfo/xorg-driver-geode


[Xorg-driver-geode] [Bug 80825] Output is disabled on VT switch

2015-12-01 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=80825

Connor Behan  changed:

   What|Removed |Added

 CC||connor.be...@gmail.com

--- Comment #2 from Connor Behan  ---
Created attachment 120250
  --> https://bugs.freedesktop.org/attachment.cgi?id=120250=edit
Possible fix

If there isn't some deep reason why these calls were removed, then they can
certainly be added back.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
___
Xorg-driver-geode mailing list
Xorg-driver-geode@lists.x.org
http://lists.x.org/mailman/listinfo/xorg-driver-geode


[PATCH/WIP xf86-input-libinput 3/3] Hotplug a new tablet tool device on proximity in

2015-12-01 Thread Peter Hutterer
Use two new internal capabilities, CAP_TABLET and CAP_TABLET_TOOL. If a
libinput tablet device is added, add an X device without any classes. This
device will not send events, but once we have buttonset support in libinput we
can make this the buttonset device.

When a tool comes into proximity, create a new X device for that serial number
and start sending events through it. Since the X device only represents a
single serial number/type combination, some of the wacom-specific
configuration options fall away. This only matters in the case of multiple
tools, in which case a per-tool configuration is preferable anyway, so we
don't lose anything here.

Gesture support only applied to the touch parts on the device, we don't
deal with this here specifically - that event node is handled by libinput as
touchscreen or touchpad.

This already works with GIMP and clients that don't rely on any
wacom-driver-specific properties. Configuration clients like
gnome-settings-daemon will need to change to handle new properties, to be
added as we go along.

Signed-off-by: Peter Hutterer 
---
 src/xf86libinput.c | 366 -
 1 file changed, 360 insertions(+), 6 deletions(-)

diff --git a/src/xf86libinput.c b/src/xf86libinput.c
index 5ff80e4..36bef21 100644
--- a/src/xf86libinput.c
+++ b/src/xf86libinput.c
@@ -55,6 +55,8 @@
 #endif
 
 #define TOUCHPAD_NUM_AXES 4 /* x, y, hscroll, vscroll */
+#define TABLET_NUM_BUTTONS 7 /* because really, we need scroll buttons
+   anyway */
 #define TOUCH_MAX_SLOTS 15
 #define XORG_KEYCODE_OFFSET 8
 
@@ -65,10 +67,13 @@
do the scaling it usually does.
  */
 #define TOUCH_AXIS_MAX 0x
+#define TABLET_AXIS_MAX 0xff
 
 #define CAP_KEYBOARD   0x1
 #define CAP_POINTER0x2
 #define CAP_TOUCH  0x4
+#define CAP_TABLET 0x8
+#define CAP_TABLET_TOOL0x10
 
 struct xf86libinput_driver {
struct libinput *libinput;
@@ -84,6 +89,13 @@ struct xf86libinput_device {
struct libinput_device *device;
struct xorg_list device_list;
int server_fd;
+
+   struct xorg_list unclaimed_tablet_tool_list;
+};
+
+struct xf86libinput_tablet_tool {
+   struct xorg_list node;
+   struct libinput_tablet_tool *tool;
 };
 
 struct xf86libinput {
@@ -134,6 +146,8 @@ struct xf86libinput {
 
struct xf86libinput_device *shared_device;
struct xorg_list shared_device_link;
+
+   struct libinput_tablet_tool *tablet_tool;
 };
 
 enum hotplug_when {
@@ -141,6 +155,12 @@ enum hotplug_when {
HOTPLUG_NOW,
 };
 
+static DeviceIntPtr
+xf86libinput_create_subdevice(InputInfoPtr pInfo,
+ uint32_t capabilities,
+ enum hotplug_when,
+ XF86OptionPtr extra_opts);
+
 static inline int
 use_server_fd(const InputInfoPtr pInfo) {
return pInfo->fd > -1 && (pInfo->flags & XI86_SERVER_FD);
@@ -156,6 +176,9 @@ btn_linux2xorg(unsigned int b)
case BTN_LEFT: button = 1; break;
case BTN_MIDDLE: button = 2; break;
case BTN_RIGHT: button = 3; break;
+   /* tablet button range */
+   case BTN_STYLUS: button = 2; break;
+   case BTN_STYLUS2: button = 3; break;
default:
button = 8 + b - BTN_SIDE;
break;
@@ -216,6 +239,7 @@ xf86libinput_shared_create(struct libinput_device *device)
shared_device->refcount = 1;
shared_device->id = ++next_shared_device_id;
xorg_list_init(_device->device_list);
+   xorg_list_init(_device->unclaimed_tablet_tool_list);
 
return shared_device;
 }
@@ -758,6 +782,75 @@ xf86libinput_init_touch(InputInfoPtr pInfo)
 
 }
 
+static void
+xf86libinput_init_tablet(InputInfoPtr pInfo)
+{
+   DeviceIntPtr dev = pInfo->dev;
+   struct xf86libinput *driver_data = pInfo->private;
+   struct libinput_tablet_tool *tool;
+   int min, max, res;
+   unsigned char btnmap[TABLET_NUM_BUTTONS];
+   Atom btnlabels[TABLET_NUM_BUTTONS] = {0};
+   Atom axislabels[TOUCHPAD_NUM_AXES] = {0};
+   int nbuttons = TABLET_NUM_BUTTONS;
+   int axis;
+   int naxes = 2;
+
+   BUG_RETURN(driver_data->tablet_tool == NULL);
+
+   tool = driver_data->tablet_tool;
+
+   init_button_map(btnmap, ARRAY_SIZE(btnmap));
+
+   if (libinput_tablet_tool_has_axis(tool,
+ LIBINPUT_TABLET_TOOL_AXIS_PRESSURE))
+   naxes++;
+   if (libinput_tablet_tool_has_axis(tool,
+ LIBINPUT_TABLET_TOOL_AXIS_TILT_X))
+   naxes++;
+   if (libinput_tablet_tool_has_axis(tool,
+ LIBINPUT_TABLET_TOOL_AXIS_TILT_Y))
+   naxes++;
+
+   InitPointerDeviceStruct((DevicePtr)dev,
+   driver_data->options.btnmap,
+   nbuttons,
+  

[PATCH/WIP xf86-input-libinput 1/3] Change creating subdevices to something more generic

2015-12-01 Thread Peter Hutterer
Signed-off-by: Peter Hutterer 
---
 src/xf86libinput.c | 29 +
 1 file changed, 25 insertions(+), 4 deletions(-)

diff --git a/src/xf86libinput.c b/src/xf86libinput.c
index ee2165a..e20d821 100644
--- a/src/xf86libinput.c
+++ b/src/xf86libinput.c
@@ -1753,7 +1753,7 @@ xf86libinput_hotplug_device(ClientPtr client, pointer 
closure)
 }
 
 static void
-xf86libinput_create_keyboard_subdevice(InputInfoPtr pInfo)
+xf86libinput_create_subdevice(InputInfoPtr pInfo, uint32_t capabilities)
 {
struct xf86libinput *driver_data = pInfo->private;
struct xf86libinput_device *shared_device;
@@ -1768,7 +1768,13 @@ xf86libinput_create_keyboard_subdevice(InputInfoPtr 
pInfo)
 
options = xf86OptionListDuplicate(pInfo->options);
options = xf86ReplaceStrOption(options, "_source", "_driver/libinput");
-   options = xf86ReplaceStrOption(options, "_libinput/caps", "keyboard");
+
+   if (capabilities & CAP_KEYBOARD)
+   options = xf86ReplaceBoolOption(options, 
"_libinput/cap-keyboard", 1);
+   if (capabilities & CAP_POINTER)
+   options = xf86ReplaceBoolOption(options, 
"_libinput/cap-pointer", 1);
+   if (capabilities & CAP_TOUCH)
+   options = xf86ReplaceBoolOption(options, "_libinput/cap-touch", 
1);
 
/* need convert from one option list to the other. woohoo. */
o = options;
@@ -1804,6 +1810,21 @@ xf86libinput_is_subdevice(InputInfoPtr pInfo)
return is_subdevice;
 }
 
+static inline uint32_t
+caps_from_options(InputInfoPtr pInfo)
+{
+   uint32_t capabilities = 0;
+
+   if (xf86CheckBoolOption(pInfo->options, "_libinput/cap-keyboard", 0))
+   capabilities |= CAP_KEYBOARD;
+   if (xf86CheckBoolOption(pInfo->options, "_libinput/cap-pointer", 0))
+   capabilities |= CAP_POINTER;
+   if (xf86CheckBoolOption(pInfo->options, "_libinput/cap-touch", 0))
+   capabilities |= CAP_TOUCH;
+
+   return capabilities;
+}
+
 static int
 xf86libinput_pre_init(InputDriverPtr drv,
  InputInfoPtr pInfo,
@@ -1898,7 +1919,7 @@ xf86libinput_pre_init(InputDriverPtr drv,
if (libinput_device_has_capability(device, 
LIBINPUT_DEVICE_CAP_TOUCH))
driver_data->capabilities |= CAP_TOUCH;
} else {
-   driver_data->capabilities = CAP_KEYBOARD;
+   driver_data->capabilities = caps_from_options(pInfo);
}
 
/* Disable acceleration in the server, libinput does it for us */
@@ -1913,7 +1934,7 @@ xf86libinput_pre_init(InputDriverPtr drv,
driver_data->capabilities & CAP_KEYBOARD &&
driver_data->capabilities & (CAP_POINTER|CAP_TOUCH)) {
driver_data->capabilities &= ~CAP_KEYBOARD;
-   xf86libinput_create_keyboard_subdevice(pInfo);
+   xf86libinput_create_subdevice(pInfo, CAP_KEYBOARD);
}
 
pInfo->type_name = xf86libinput_get_type_name(device, driver_data);
-- 
2.5.0

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

[PATCH/WIP xf86-input-libinput 2/3] Allow hotplugging a device immediately

2015-12-01 Thread Peter Hutterer
This splits the hotplugging code up so we can use it through a callback but
also as an immediate call that gives us back the device just hotplugged. Also
added is the ability to add extra options to the device.

Signed-off-by: Peter Hutterer 
---
 src/xf86libinput.c | 51 +++
 1 file changed, 39 insertions(+), 12 deletions(-)

diff --git a/src/xf86libinput.c b/src/xf86libinput.c
index e20d821..5ff80e4 100644
--- a/src/xf86libinput.c
+++ b/src/xf86libinput.c
@@ -136,6 +136,11 @@ struct xf86libinput {
struct xorg_list shared_device_link;
 };
 
+enum hotplug_when {
+   HOTPLUG_LATER,
+   HOTPLUG_NOW,
+};
+
 static inline int
 use_server_fd(const InputInfoPtr pInfo) {
return pInfo->fd > -1 && (pInfo->flags & XI86_SERVER_FD);
@@ -1735,25 +1740,38 @@ struct xf86libinput_hotplug_info {
InputOption *input_options;
 };
 
-static Bool
-xf86libinput_hotplug_device(ClientPtr client, pointer closure)
+static DeviceIntPtr
+xf86libinput_hotplug_device(struct xf86libinput_hotplug_info *hotplug)
 {
-   struct xf86libinput_hotplug_info *hotplug = closure;
-   DeviceIntPtr unused;
+   DeviceIntPtr dev;
 
-   NewInputDeviceRequest(hotplug->input_options,
- hotplug->attrs,
- );
+   if (NewInputDeviceRequest(hotplug->input_options,
+ hotplug->attrs,
+ ) != Success)
+   dev = NULL;
 
input_option_free_list(>input_options);
FreeInputAttributes(hotplug->attrs);
free(hotplug);
 
+   return dev;
+}
+
+static Bool
+xf86libinput_hotplug_device_cb(ClientPtr client, pointer closure)
+{
+   struct xf86libinput_hotplug_info *hotplug = closure;
+
+   xf86libinput_hotplug_device(hotplug);
+
return TRUE;
 }
 
-static void
-xf86libinput_create_subdevice(InputInfoPtr pInfo, uint32_t capabilities)
+static DeviceIntPtr
+xf86libinput_create_subdevice(InputInfoPtr pInfo,
+ uint32_t capabilities,
+ enum hotplug_when when,
+ XF86OptionPtr extra_options)
 {
struct xf86libinput *driver_data = pInfo->private;
struct xf86libinput_device *shared_device;
@@ -1768,6 +1786,7 @@ xf86libinput_create_subdevice(InputInfoPtr pInfo, 
uint32_t capabilities)
 
options = xf86OptionListDuplicate(pInfo->options);
options = xf86ReplaceStrOption(options, "_source", "_driver/libinput");
+   options = xf86OptionListMerge(options, extra_options);
 
if (capabilities & CAP_KEYBOARD)
options = xf86ReplaceBoolOption(options, 
"_libinput/cap-keyboard", 1);
@@ -1788,13 +1807,18 @@ xf86libinput_create_subdevice(InputInfoPtr pInfo, 
uint32_t capabilities)
 
hotplug = calloc(1, sizeof(*hotplug));
if (!hotplug)
-   return;
+   return NULL;
 
hotplug->input_options = iopts;
hotplug->attrs = DuplicateInputAttributes(pInfo->attrs);
 
xf86IDrvMsg(pInfo, X_INFO, "needs a virtual subdevice\n");
-   QueueWorkProc(xf86libinput_hotplug_device, serverClient, hotplug);
+   if (when == HOTPLUG_LATER)
+   QueueWorkProc(xf86libinput_hotplug_device_cb, serverClient, 
hotplug);
+   else
+   return xf86libinput_hotplug_device(hotplug);
+
+   return NULL;
 }
 
 static BOOL
@@ -1934,7 +1958,10 @@ xf86libinput_pre_init(InputDriverPtr drv,
driver_data->capabilities & CAP_KEYBOARD &&
driver_data->capabilities & (CAP_POINTER|CAP_TOUCH)) {
driver_data->capabilities &= ~CAP_KEYBOARD;
-   xf86libinput_create_subdevice(pInfo, CAP_KEYBOARD);
+   xf86libinput_create_subdevice(pInfo,
+ CAP_KEYBOARD,
+ HOTPLUG_LATER,
+ NULL);
}
 
pInfo->type_name = xf86libinput_get_type_name(device, driver_data);
-- 
2.5.0

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH xwayland v3] xwayland: Always update the wl_pointer cursor on pointer focus

2015-12-01 Thread Adam Jackson
On Mon, 2015-11-09 at 09:32 -0500, Olivier Fourdan wrote:
> Hi Jonas,
> 
> - Original Message -
> > On Mon, Oct 12, 2015 at 05:35:20AM -0400, Olivier Fourdan wrote:
> > > Hi Jonas,
> > > 
> > > Out of curiosity, why not simply using NULL here?
> > 
> > Unsetting the cursor in mipointer (setting it to NULL) would not trigger
> > the unsetting in xwayland if we just use NULL here.
> 
> Do you know where we stand wit hregard to this patch?
> 
> I believe there are quite a few downstream bugs that would benefit from this 
> patch (if acceptable).

Merged:

remote: I: patch #61201 updated using rev 
07941a50a547f2ca094e242588298695f48903ed.
remote: I: 1 patch(es) updated to state Accepted.
To ssh://git.freedesktop.org/git/xorg/xserver
   51a4399..07941a5  master -> master

- ajax
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

unifdef INET6 ?

2015-12-01 Thread Matthieu Herrb
Hi,

Does X.Org support systems that don't support IPv6 and don't always
define  INET6  ?

I would like to unifdef the IPv6 code if possible... There are a
number of places where optional IPv6 code create nice unreadable
mazes of ifdefs.

Opinions/objections ?
-- 
Matthieu Herrb


pgpcHwchcxdOg.pgp
Description: PGP signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH 03/11] xf86: Bump ABI version to 21

2015-12-01 Thread Adam Jackson
On Wed, 2015-11-25 at 18:39 -0800, Alex Goins wrote:
> Signed-off-by: Alex Goins 
> ---
>  hw/xfree86/common/xf86Module.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/xfree86/common/xf86Module.h
> b/hw/xfree86/common/xf86Module.h
> index 9e5dc6d..7a8b7ab 100644
> --- a/hw/xfree86/common/xf86Module.h
> +++ b/hw/xfree86/common/xf86Module.h
> @@ -80,7 +80,7 @@ typedef enum {
>   * mask is 0x.
>   */
>  #define ABI_ANSIC_VERSIONSET_ABI_VERSION(0, 4)
> -#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(20, 0)
> +#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(21, 0)
>  #define ABI_XINPUT_VERSION   SET_ABI_VERSION(22, 1)
>  #define ABI_EXTENSION_VERSIONSET_ABI_VERSION(9, 0)
>  #define ABI_FONT_VERSION SET_ABI_VERSION(0, 6)

These first three are uncontroversial, merged:

remote: I: patch #66274 updated using rev 
cf5d6414e0c21140f763d618bde1e91ad2b1cb49.
remote: I: patch #66273 updated using rev 
7006b4e7ff759c899d5391b7d12db889cbc0b535.
remote: I: patch #66275 updated using rev 
8d3f0e964e399dcfa8eb5e85d405217fdc5dbcd4.
remote: I: 3 patch(es) updated to state Accepted.
To ssh://git.freedesktop.org/git/xorg/xserver
   ab9837c..8d3f0e9  master -> master

- ajax
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Re: xserver: Branch 'master' - 16 commits

2015-12-01 Thread Michel Dänzer
On 02.12.2015 03:56, Adam Jackson wrote:
> 
> commit 1df07dc36ca145c59f51176d9ab2651112506d75
> Author: Keith Packard 
> Date:   Wed Nov 11 22:02:16 2015 -0800
> 
> hw/xfree86: Use NotifyFd for device and other input fd wakeups
> 
> Remove code in xf86Wakeup for dealing with device and other input and
> switch to using the new NotifyFd interface.
> 
> Reviewed-by: Adam Jackson 
> Signed-off-by: Keith Packard 

This commit broke input for me with xf86-input-libinput. No keyboard or
mouse input is received. There are no errors in the log file.

xf86-input-evdev works.


-- 
Earthling Michel Dänzer   |   http://www.amd.com
Libre software enthusiast | Mesa and X developer
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Re: unifdef INET6 ?

2015-12-01 Thread Keith Packard
Adam Jackson  writes:

> --disable-ipv6 seems to save you all of 5k of binary size, which really
> isn't enough for me to care.  I'd be fine with making that code
> unconditional if we also silenced the warning chirp from xtrans when
> running on a v6-less kernel.

Yeah, seems like a reasonable plan; ipv6 shouldn't really be considered
optional these days.

-- 
-keith


signature.asc
Description: PGP signature
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Re: Disabling RECORD by default

2015-12-01 Thread Peter Hutterer
On Mon, Nov 23, 2015 at 04:28:08PM -0800, Keith Packard wrote:
> Alan Coopersmith  writes:
> 
> > You need to make a similar update to xserver/man/Xserver.man, which
> > currently says:
> >
> > -tstdisables all testing extensions (e.g., XTEST,  XTrap,  
> > XTestEx-
> > tension1, RECORD).
> 
> Changed to:
> 
> .TP 8
> .B \-tst
> disables XTEST extension.

disable _the_ XTEST extension? in at least two places. One comment, just to
be annoying: I'd prefer this split in two patches, with the second one just
toggling the true/false switch for RECORD and having the git subject line of
"Disable RECORD by default". Makes it much easier to find in the log than
hiding it in the first paragraph.
Reviewed-by: Peter Hutterer  otherwise

but note that syndaemon is a common user of RECORD, if it is disabled we
fall back to regular querying of the keyboard state with all its
drawbacks (unnecessary wakeups, missing of some key events, etc.)

with the two other patches you're breaking the backup option, so anyone not
using libinput will lose the disable-while-typing feature.

Cheers,
   Peter

> From ff5b0d12391932b13cd93fddc802a01bd5e52f2b Mon Sep 17 00:00:00 2001
> From: Keith Packard 
> Date: Mon, 23 Nov 2015 14:49:33 -0800
> Subject: [PATCH xserver 2/3] Allow RECORD and XTEST to be controlled
>  separately [v3]
> 
> RECORD and XTEST were both controlled by the -tst server option and
> XTEST extension selection. Split these out and then make RECORD be
> disabled by default.
> 
> [v2] Remove -record/+record options (Alan Coopersmith)
> [v3] Update man page description of -tst option (Alan Coopersmith)
> 
> Signed-off-by: Keith Packard 
> ---
>  hw/xquartz/X11Application.m |  8 
>  include/globals.h   |  5 -
>  man/Xserver.man |  2 +-
>  mi/miinitext.c  |  9 ++---
>  os/utils.c  | 10 +++---
>  5 files changed, 22 insertions(+), 12 deletions(-)
> 
> diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m
> index d2c5d30..1348480 100644
> --- a/hw/xquartz/X11Application.m
> +++ b/hw/xquartz/X11Application.m
> @@ -82,7 +82,7 @@ static dispatch_queue_t eventTranslationQueue;
>  #endif
>  #endif
>  
> -extern Bool noTestExtensions;
> +extern Bool noXTestExtension;
>  extern Bool noRenderExtension;
>  extern BOOL serverRunning;
>  
> @@ -901,7 +901,7 @@ cfarray_to_nsarray(CFArrayRef in)
>  darwinDesiredDepth = [self prefs_get_integer:@PREFS_DEPTH
>default   :darwinDesiredDepth];
>  
> -noTestExtensions = ![self prefs_get_boolean:@PREFS_TEST_EXTENSIONS
> +noXTestExtension = ![self prefs_get_boolean:@PREFS_TEST_EXTENSIONS
>   default   :FALSE];
>  
>  noRenderExtension = ![self prefs_get_boolean:@PREFS_RENDER_EXTENSION
> @@ -1592,7 +1592,7 @@ handle_mouse:
>  }
>  }
>  
> -if (!XQuartzServerVisible && noTestExtensions) {
> +if (!XQuartzServerVisible && noXTestExtension) {
>  #if defined(XPLUGIN_VERSION) && XPLUGIN_VERSION > 0
>  /* Older libXplugin (Tiger/"Stock" Leopard) aren't thread safe, 
> so we can't call xp_find_window from the Appkit thread */
>  xp_window_id wid = 0;
> @@ -1695,7 +1695,7 @@ handle_mouse:
>  /* If we're in the background, we need to send a MotionNotify event
>   * first, since we aren't getting them on background mouse motion
>   */
> -if (!XQuartzServerVisible && noTestExtensions) {
> +if (!XQuartzServerVisible && noXTestExtension) {
>  bgMouseLocationUpdated = FALSE;
>  DarwinSendPointerEvents(darwinPointer, MotionNotify, 0,
>  location.x, location.y,
> diff --git a/include/globals.h b/include/globals.h
> index 858c9a3..42f21ce 100644
> --- a/include/globals.h
> +++ b/include/globals.h
> @@ -23,7 +23,10 @@ extern _X_EXPORT int monitorResolution;
>  extern _X_EXPORT int defaultColorVisualClass;
>  
>  extern _X_EXPORT int GrabInProgress;
> -extern _X_EXPORT Bool noTestExtensions;
> +extern _X_EXPORT Bool noXTestExtension;
> +#ifdef XRECORD
> +extern _X_EXPORT Bool noRecordExtension;
> +#endif
>  extern _X_EXPORT char *SeatId;
>  extern _X_EXPORT char *ConnectionInfo;
>  extern _X_EXPORT sig_atomic_t inSignalContext;
> diff --git a/man/Xserver.man b/man/Xserver.man
> index 506e5bb..55a8d5b 100644
> --- a/man/Xserver.man
> +++ b/man/Xserver.man
> @@ -278,7 +278,7 @@ command line option.
>  sets default connection timeout in seconds.
>  .TP 8
>  .B \-tst
> -disables all testing extensions (e.g., XTEST, XTrap, XTestExtension1, 
> RECORD).
> +disables XTEST extension.
>  .TP 8
>  .B tty\fIxx\fP
>  ignored, for servers started the ancient way (from init).
> diff --git a/mi/miinitext.c b/mi/miinitext.c
> index 5fc44e3..a089a2c 100644
> --- a/mi/miinitext.c
> +++ 

Re: Deliver input events only to window owner

2015-12-01 Thread Peter Hutterer
On Mon, Nov 23, 2015 at 04:20:05PM -0800, Keith Packard wrote:
> 
> X allows multiple clients to select for keyboard, motion and button
> release events (button press events generate implicit grabs, and are
> only selectable by one client). This means that a client receiving an
> input event has no way of knowing if some other client has received the
> same event, allowing snooping of the keyboard input stream by selecting
> for keyboard input on the right windows in the system.
> 
> Here's a patch which says that if the owner of the window receives a
> core input event, then don't go try and send it to other clients. Other
> clients can still ask for events, they will simply never receive
> them.
> 
> This has no effect on key grabbing; a grabbed key will still be
> delivered to the grabbing client, even if that is not the owner of the
> window and if the owner has selected for non-grabbed key events.
> 
> -keith
> 
> From 8c84031b5f33fa4574c5c9db6b1257ff0e34c8a9 Mon Sep 17 00:00:00 2001
> From: Keith Packard 
> Date: Mon, 23 Nov 2015 16:04:54 -0800
> Subject: [PATCH xserver] Deliver input events exclusively to window owner
> 
> When the window owner selects for core keyboard and mouse events,
> don't go looking for other clients to deliver those events to.  This
> means that if the window owner receives a key or mouse event, then it
> can know that no other client could have also received the same event.
> 
> This could be generalized to deliver input events to only one client,
> but which client would receive the event is less well defined as it
> would depend on the order that clients selected for input on
> particular windows.
> 
> Signed-off-by: Keith Packard 
> ---
>  dix/events.c | 11 ++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/dix/events.c b/dix/events.c
> index 4114471..d223e97 100644
> --- a/dix/events.c
> +++ b/dix/events.c
> @@ -160,6 +160,12 @@ Equipment Corporation.
>  #define PropagateMask ( \
>   KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | \
>   MotionMask )
> +
> +/* Deliver these events only to the owner if the owner selects them */
> +#define OwnerPriorityMask (\
> +KeyPressMask | KeyReleaseMask | \
> +ButtonPressMask | ButtonReleaseMask | PointerMotionMask)
> +
>  #define PointerGrabMask ( \
>   ButtonPressMask | ButtonReleaseMask | \
>   EnterWindowMask | LeaveWindowMask | \
> @@ -2253,6 +2259,7 @@ DeliverEventsToWindow(DeviceIntPtr pDev, WindowPtr 
> pWin, xEvent
>  Mask deliveryMask = 0;  /* If a grab occurs due to a button press, 
> then
> this mask is the mask of the grab. */
>  int type = pEvents->u.u.type;
> +Bool deliver_other_clients = TRUE;
>  
>  /* Deliver to window owner */
>  if ((filter == CantBeFiltered) || core_get_type(pEvents) != 0) {
> @@ -2269,6 +2276,8 @@ DeliverEventsToWindow(DeviceIntPtr pDev, WindowPtr 
> pWin, xEvent
>  case EVENT_DELIVERED:
>  /* We delivered to the owner, with our event mask */
>  deliveries++;
> +if (filter & OwnerPriorityMask)
> +deliver_other_clients = FALSE;
>  client = wClient(pWin);
>  deliveryMask = pWin->eventMask;
>  break;
> @@ -2278,7 +2287,7 @@ DeliverEventsToWindow(DeviceIntPtr pDev, WindowPtr 
> pWin, xEvent
>  }
>  
>  /* CantBeFiltered means only window owner gets the event */
> -if (filter != CantBeFiltered) {
> +if (filter != CantBeFiltered && deliver_other_clients) {
>  enum EventDeliveryState rc;
>  
>  rc = DeliverEventToWindowMask(pDev, pWin, pEvents, count, filter,
> -- 
> 2.6.1
 
looks correct, and it would also be fairly trivial to add test cases for
this to XIT. I didn't check the spec for the exact wording, but either way
we should add it.
Reviewed-by: Peter Hutterer 

note that this does not handle XI2 raw keyboard events, they will need to be
handled as well.

Cheers,
   Peter

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Re: Hiding keyboard state

2015-12-01 Thread Peter Hutterer
On Mon, Nov 23, 2015 at 11:04:10AM -0800, Keith Packard wrote:
> 
> One of the many security holes in X is that any application can monitor
> the state of the keyboard device by querying the list of pressed keys on
> a regular basis. Here's a simple patch which makes that request report
> only key state which the client itself has already seen through X
> events.
> 
> With this patch in place, grabbing the keyboard should be sufficient to
> hide key presses from other clients.
> 
> I think we need to try to fix some of these issues, even if the fixes
> break existing applications. The next thing I'd like to try is to to
> deliver input events to only one client (owner first, then
> others). After that, apply the same rules to the input extension.
> 
> In general, there are three areas that I'm wondering if we can fix:
> 
>  1) input monitoring. This seems fairly "safe" as far as existing apps
> go.
> 
>  2) output monitoring. This seems much harder as so many useful hacks
> and extensions take advantage of being able to get contents from
> other windows.
> 
>  3) breaking screen saver security. We've got an extension, let's make
> it work.
> 
> -keith
> 
> From 627815391d2d6845f7e0a66d447c6b379be9d3cb Mon Sep 17 00:00:00 2001
> From: Keith Packard 
> Date: Mon, 23 Nov 2015 10:01:10 -0800
> Subject: [PATCH xserver] Track keystate per client for QueryKeymap
> 
> This adds a per-client key state vector and uses that for
> ProcQueryKeymap instead of the device keymap.
> 
> Signed-off-by: Keith Packard 

I _think_ this is correct, but you really want a lot of test cases for this
to make sure you're not missing out on any shortcuts the event delivery code
may take somewhere. I don't think there are any, but...

Reviewed-by: Peter Hutterer 

also, as I wrote in the other email this breaks syndaemon's
disable-while-typing feature, especially together with RECORD disabled.

Cheers,
   Peter

> ---
>  dix/devices.c   |  2 +-
>  dix/events.c| 13 +
>  include/dixstruct.h |  1 +
>  3 files changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/dix/devices.c b/dix/devices.c
> index 9b0c7d2..49b6994 100644
> --- a/dix/devices.c
> +++ b/dix/devices.c
> @@ -2405,7 +2405,7 @@ ProcQueryKeymap(ClientPtr client)
>  xQueryKeymapReply rep;
>  int rc, i;
>  DeviceIntPtr keybd = PickKeyboard(client);
> -CARD8 *down = keybd->key->down;
> +CARD8 *down = client->down;
>  
>  REQUEST_SIZE_MATCH(xReq);
>  rep = (xQueryKeymapReply) {
> diff --git a/dix/events.c b/dix/events.c
> index efaf91d..4114471 100644
> --- a/dix/events.c
> +++ b/dix/events.c
> @@ -2006,6 +2006,19 @@ TryClientEvents(ClientPtr client, DeviceIntPtr dev, 
> xEvent *pEvents,
>  }
>  }
>  
> +/* Track keyboard state per client */
> +switch (type) {
> +case KeyPress:
> +SetBit(client->down, pEvents->u.u.detail);
> +break;
> +case KeyRelease:
> +ClearBit(client->down, pEvents->u.u.detail);
> +break;
> +case KeymapNotify:
> +memcpy(client->down+1, ((xKeymapEvent *) pEvents)->map, 31);
> +break;
> +}
> +
>  if (BitIsOn(criticalEvents, type)) {
>  if (client->smart_priority < SMART_MAX_PRIORITY)
>  client->smart_priority++;
> diff --git a/include/dixstruct.h b/include/dixstruct.h
> index 8e70ae1..1e9f69e 100644
> --- a/include/dixstruct.h
> +++ b/include/dixstruct.h
> @@ -103,6 +103,7 @@ typedef struct _Client {
>  unsigned short newKeyboardNotifyMask;
>  unsigned short vMajor, vMinor;
>  KeyCode minKC, maxKC;
> +CARD8 down[DOWN_LENGTH];/* track key state for QueryKeymap */
>  
>  int smart_start_tick;
>  int smart_stop_tick;
> -- 
> 2.6.1

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH 07/11] randr: Cleanup rrSetupPixmapSharing()

2015-12-01 Thread Adam Jackson
On Wed, 2015-11-25 at 18:39 -0800, Alex Goins wrote:
> protopix is completely redundant with mscreenpix. Get rid of it.
> 
> We don't need rrScrPriv, so remove it.
> 
> Signed-off-by: Alex Goins 

Merged this (more or less) to squash the unused variable warnings
(which I should have caught before merging the first few, tsk):

   8d3f0e9..c7f4aef  master -> master

5/11 of this series will need to be fixed up to reintroduce a variable.

- ajax
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Re: bad karma between mouse and ati6 driver

2015-12-01 Thread Adam Jackson
On Tue, 2015-11-24 at 17:36 +0100, Richard PALO wrote:

> > [  4175.678] (II) RADEON(1): Setting screen physical size to 270 x 203
> 
> I must say that the screen size '270 x 203' is a bit weird...

Physical size here meaning "in millimeters", as opposed to logical size
in pixels.

- ajax
___
xorg@lists.x.org: X.Org support
Archives: http://lists.freedesktop.org/archives/xorg
Info: http://lists.x.org/mailman/listinfo/xorg
Your subscription address: %(user_address)s

[PATCH] xwayland: Group multiple cursor buffers per shm pool

2015-12-01 Thread Rui Matos
Each shm pool implies a file descriptor which means that currently, we
can quickly exhaust the available FDs since we create a shm pool per
cursor buffer. Instead, this patch creates shm pools big enough to
contain multiple cursor buffers to avoid hitting the FD limit on
reasonable workloads.

On my testing, most cursors require 2304 bytes so I made the pools be
256 kB meaning that each can hold around 100 buffers.

Signed-off-by: Rui Matos 
---

This fixes bug https://bugzilla.gnome.org/show_bug.cgi?id=758255 . The
use case reported there, which is running two instances of
ImageMagick's display tool, makes xwayland realize exactly 1024
cursors which breaks due to FD exhaustion before this patch.

Note that there's no smart allocation algorithm here, it just
allocates more pools as needed and only frees them after all cursors
inside a pool are freed which, I'm afraid, will lead to terrible
fragmentation over time.

Our shm pixmap usage suffers from the same problem of using one pool
per pixmap which seems problematic too but since most setups should be
able to use drm for pixmaps it's not as pressing a problem to fix. At
first I attempted to use drm buffers for cursors too but failed to get
it working since I got lost finding a way to copy the cursor data into
the buffers. I'm happy to do that instead if someone points me to how
to do it.

 hw/xwayland/xwayland-cursor.c | 68 +++---
 hw/xwayland/xwayland-shm.c| 76 +++
 hw/xwayland/xwayland.h|  6 
 3 files changed, 138 insertions(+), 12 deletions(-)

diff --git a/hw/xwayland/xwayland-cursor.c b/hw/xwayland/xwayland-cursor.c
index 76729db..e5b88a5 100644
--- a/hw/xwayland/xwayland-cursor.c
+++ b/hw/xwayland/xwayland-cursor.c
@@ -28,7 +28,17 @@
 
 #include 
 
+#define SHM_POOL_SIZE (1 << 18) /* 256 kB */
+
+struct xwl_cursor {
+struct xorg_list link;
+struct xwl_shm_pool *pool;
+struct wl_buffer *buffer;
+char *data;
+};
+
 static DevPrivateKeyRec xwl_cursor_private_key;
+static struct xorg_list xwl_cursor_list;
 
 static void
 expand_source_and_mask(CursorPtr cursor, CARD32 *data)
@@ -63,23 +73,55 @@ expand_source_and_mask(CursorPtr cursor, CARD32 *data)
 static Bool
 xwl_realize_cursor(DeviceIntPtr device, ScreenPtr screen, CursorPtr cursor)
 {
-PixmapPtr pixmap;
+struct xwl_cursor *xwl_cursor;
+struct xwl_shm_pool *pool = NULL;
+
+xwl_cursor = malloc(sizeof *xwl_cursor);
+if (!xwl_cursor)
+return FALSE;
+
+if (!xorg_list_is_empty(_cursor_list)) {
+pool = (xorg_list_first_entry(_cursor_list, struct xwl_cursor, 
link))->pool;
+xwl_cursor->buffer = xwl_shm_pool_allocate(pool, cursor->bits->width,
+   cursor->bits->height, 
_cursor->data);
+if (!xwl_cursor->buffer)
+pool = NULL;
+}
 
-pixmap = xwl_shm_create_pixmap(screen, cursor->bits->width,
-   cursor->bits->height, 32, 0);
-dixSetPrivate(>devPrivates, _cursor_private_key, pixmap);
+if (!pool) {
+pool = xwl_shm_pool_create(xwl_screen_get(screen)->shm, SHM_POOL_SIZE);
+if (!pool)
+goto err_free;
+xwl_cursor->buffer = xwl_shm_pool_allocate(pool, cursor->bits->width,
+   cursor->bits->height, 
_cursor->data);
+if (!xwl_cursor->buffer)
+goto err_free;
+}
+
+xwl_cursor->pool = pool;
+
+xorg_list_add(_cursor->link, _cursor_list);
+dixSetPrivate(>devPrivates, _cursor_private_key, xwl_cursor);
 
 return TRUE;
+
+ err_free:
+free(xwl_cursor);
+return FALSE;
 }
 
 static Bool
 xwl_unrealize_cursor(DeviceIntPtr device, ScreenPtr screen, CursorPtr cursor)
 {
-PixmapPtr pixmap;
+struct xwl_cursor *xwl_cursor;
 
-pixmap = dixGetPrivate(>devPrivates, _cursor_private_key);
+xwl_cursor = dixGetPrivate(>devPrivates, _cursor_private_key);
+wl_buffer_destroy(xwl_cursor->buffer);
+xwl_shm_pool_unref(xwl_cursor->pool);
+xorg_list_del(_cursor->link);
+free(xwl_cursor);
 
-return xwl_shm_destroy_pixmap(pixmap);
+return TRUE;
 }
 
 static void
@@ -102,7 +144,7 @@ static const struct wl_callback_listener frame_listener = {
 void
 xwl_seat_set_cursor(struct xwl_seat *xwl_seat)
 {
-PixmapPtr pixmap;
+struct xwl_cursor *xwl_cursor;
 CursorPtr cursor;
 int stride;
 
@@ -121,13 +163,13 @@ xwl_seat_set_cursor(struct xwl_seat *xwl_seat)
 }
 
 cursor = xwl_seat->x_cursor;
-pixmap = dixGetPrivate(>devPrivates, _cursor_private_key);
+xwl_cursor = dixGetPrivate(>devPrivates, _cursor_private_key);
 stride = cursor->bits->width * 4;
 if (cursor->bits->argb)
-memcpy(pixmap->devPrivate.ptr,
+memcpy(xwl_cursor->data,
cursor->bits->argb, cursor->bits->height * stride);
 else
-expand_source_and_mask(cursor, 

[PATCH v4] xwayland: Update screen size on output removal

2015-12-01 Thread Olivier Fourdan
When unplugging an output, it's still listed in xrandr and the size
of the root window still includes the removed output.

The RR output should be destroyed when its Wayland counterpart is
destroyed and the screen dimensions must be updated in both the done
and the destroy handlers.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92914
Signed-off-by: Olivier Fourdan 
Reviewed-by: Marek Chalupa 
---
v2: Less intrusive patch
v3: Simpler patch, no need to skip the output being removed, simply
remove it from the list prior to walk the list.
v4: rebased

 hw/xwayland/xwayland-output.c | 64 +++
 1 file changed, 41 insertions(+), 23 deletions(-)

diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c
index 8b2f8cb..e9ec190 100644
--- a/hw/xwayland/xwayland-output.c
+++ b/hw/xwayland/xwayland-output.c
@@ -159,33 +159,11 @@ approximate_mmpd(struct xwl_screen *xwl_screen)
 }
 
 static void
-output_handle_done(void *data, struct wl_output *wl_output)
+update_screen_size(struct xwl_output *xwl_output, int width, int height)
 {
-struct xwl_output *it, *xwl_output = data;
 struct xwl_screen *xwl_screen = xwl_output->xwl_screen;
-int width = 0, height = 0, has_this_output = 0;
 double mmpd;
 
-xorg_list_for_each_entry(it, _screen->output_list, link) {
-/* output done event is sent even when some property
- * of output is changed. That means that we may already
- * have this output. If it is true, we must not add it
- * into the output_list otherwise we'll corrupt it */
-if (it == xwl_output)
-has_this_output = 1;
-
-output_get_new_size(it, , );
-}
-
-if (!has_this_output) {
-xorg_list_append(_output->link, _screen->output_list);
-
-/* we did not check this output for new screen size, do it now */
-output_get_new_size(xwl_output, , );
-
-   --xwl_screen->expecting_event;
-}
-
 if (!xwl_screen->rootless)
 SetRootClip(xwl_screen->screen, FALSE);
 
@@ -216,6 +194,36 @@ output_handle_done(void *data, struct wl_output *wl_output)
 }
 
 static void
+output_handle_done(void *data, struct wl_output *wl_output)
+{
+struct xwl_output *it, *xwl_output = data;
+struct xwl_screen *xwl_screen = xwl_output->xwl_screen;
+int width = 0, height = 0, has_this_output = 0;
+
+xorg_list_for_each_entry(it, _screen->output_list, link) {
+/* output done event is sent even when some property
+ * of output is changed. That means that we may already
+ * have this output. If it is true, we must not add it
+ * into the output_list otherwise we'll corrupt it */
+if (it == xwl_output)
+has_this_output = 1;
+
+output_get_new_size(it, , );
+}
+
+if (!has_this_output) {
+xorg_list_append(_output->link, _screen->output_list);
+
+/* we did not check this output for new screen size, do it now */
+output_get_new_size(xwl_output, , );
+
+   --xwl_screen->expecting_event;
+}
+
+update_screen_size(xwl_output, width, height);
+}
+
+static void
 output_handle_scale(void *data, struct wl_output *wl_output, int32_t factor)
 {
 }
@@ -284,8 +292,18 @@ err:
 void
 xwl_output_destroy(struct xwl_output *xwl_output)
 {
+struct xwl_output *it;
+struct xwl_screen *xwl_screen = xwl_output->xwl_screen;
+int width = 0, height = 0;
+
 wl_output_destroy(xwl_output->output);
 xorg_list_del(_output->link);
+RROutputDestroy(xwl_output->randr_output);
+
+xorg_list_for_each_entry(it, _screen->output_list, link)
+output_get_new_size(it, , );
+update_screen_size(xwl_output, width, height);
+
 free(xwl_output);
 }
 
-- 
2.5.0

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Re: bad karma between mouse and ati6 driver

2015-12-01 Thread walter harms


Am 01.12.2015 16:22, schrieb Adam Jackson:
> On Tue, 2015-11-24 at 17:36 +0100, Richard PALO wrote:
> 
>>> [  4175.678] (II) RADEON(1): Setting screen physical size to 270 x 203
>>
>> I must say that the screen size '270 x 203' is a bit weird...
> 
> Physical size here meaning "in millimeters", as opposed to logical size
> in pixels.
> 


I guess it would help everyone to add the units to the output like

"Setting screen physical size to 270 mm x 203 mm"

re,
 wh
___
xorg@lists.x.org: X.Org support
Archives: http://lists.freedesktop.org/archives/xorg
Info: http://lists.x.org/mailman/listinfo/xorg
Your subscription address: %(user_address)s