[PATCH libinput 14/14] doc: tablet documentation updates

2015-11-17 Thread Peter Hutterer
Signed-off-by: Peter Hutterer 
---
 doc/svg/tablet.svg | 199 +
 doc/tablet-support.dox |  52 -
 src/libinput.h |   5 +-
 3 files changed, 252 insertions(+), 4 deletions(-)
 create mode 100644 doc/svg/tablet.svg

diff --git a/doc/svg/tablet.svg b/doc/svg/tablet.svg
new file mode 100644
index 000..7a9dda8
--- /dev/null
+++ b/doc/svg/tablet.svg
@@ -0,0 +1,199 @@
+
+
+
+http://purl.org/dc/elements/1.1/";
+   xmlns:cc="http://creativecommons.org/ns#";
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
+   xmlns:svg="http://www.w3.org/2000/svg";
+   xmlns="http://www.w3.org/2000/svg";
+   xmlns:xlink="http://www.w3.org/1999/xlink";
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd";
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape";
+   width="147.67236mm"
+   height="86.663628mm"
+   viewBox="0 0 523.24853 307.07585"
+   id="svg2"
+   version="1.1"
+   inkscape:version="0.91 r13725"
+   sodipodi:docname="tablet.svg">
+  
+
+  
+  
+
+
+  
+  
+
+
+  
+  
+
+  
+image/svg+xml
+http://purl.org/dc/dcmitype/StillImage"; />
+
+  
+
+  
+  
+
+  
+  
+  
+  
+  
+  
+  
+  
+  
+  
+
+  
+  
+
+  
+  
+  
+
+  
+
diff --git a/doc/tablet-support.dox b/doc/tablet-support.dox
index 47ad005..24d08d2 100644
--- a/doc/tablet-support.dox
+++ b/doc/tablet-support.dox
@@ -6,7 +6,53 @@ support in libinput. Note that the term "tablet" in libinput 
refers to
 graphics tablets only (e.g. Wacom Intuos), not to tablet devices like the
 Apple iPad.
 
-@section fake-proximity Handling of proximity events
+@image html tablet.svg "Illustration of a graphics tablet"
+
+@section tablet-tools Tablet buttons vs. tablet tools
+
+Most tablets provide two types of devices. The pysical tablet often provides
+a number of buttons and a touch ring or strip. Interaction on the drawing
+surface of the tablet requires a tool, usually in the shape of a stylus.
+The libinput interface exposed by devices with the @ref
+LIBINPUT_DEVICE_CAP_TABLET_TOOL applies only to events generated by tools.
+
+Touch events on the tablet itself are exposed
+through the @ref LIBINPUT_DEVICE_CAP_TOUCH capability and are often found on
+a separate libinput device. See libinput_device_get_device_group() for
+information on how to associate the touch part with other devices exposed by
+the same physical hardware.
+
+@section tablet-tip Tool tip events vs. button events
+
+The primary use of a tablet tool is to draw on the surface of the tablet.
+When the tool tip comes into contact with the surface, libinput sends an
+event of type @ref LIBINPUT_EVENT_TABLET_TOOL_TIP, and again when the tip
+ceases contact with the surface.
+
+Tablet tools may send button events; these are exclusively for extra buttons
+unrelated to the tip. A button event is independent of the tip and occur
+at any time.
+
+@section tablet-axes Special axes on tablet tools
+
+A tablet tool usually provides additional information beyond x/y positional
+information and the tip state. A tool may provide the distance to the tablet
+surface and the pressure exerted on the tip when in contact. Some tablets
+additionally provide tilt information along the x and y axis.
+
+@image html tablet-axes.svg "Illustration of the distance, pressure and tilt 
axes"
+
+The granularity and precision of these axes varies between tablet devices
+and cannot usually be mapped into a physical unit.
+libinput normalizes distance and pressure into a fixed positive 2-byte
+integer range. The tilt axes are normalized into a signed 2-byte integer
+range.
+
+While the normalization range is identical for these axes, a caller should
+not interpret identical values as identical across axes, i.e. a value V1 on
+the distance axis has no relation to the same value V1 on the pressure axis.
+
+@section tablet-fake-proximity Handling of proximity events
 
 libinput's @ref LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY events represent the
 physical proximity limits of the device. In some cases the caller should
@@ -31,8 +77,8 @@ static bool in_proximity;
 
 double value;
 
-value = libinput_event_pointer_get_axis_value(device,
- LIBINPUT_TABLET_AXIS_DISTANCE);
+value = libinput_event_tablet_tool_get_axis_value(device,
+ 
LIBINPUT_TABLET_TOOL_AXIS_DISTANCE);
 
 if (value < min) {
min = value;
diff --git a/src/libinput.h b/src/libinput.h
index be815e7..a9eee3c 100644
--- a/src/libinput.h
+++ b/src/libinput.h
@@ -139,6 +139,9 @@ enum libinput_pointer_axis_source {
  *
  * Available axis types for a device. It must have the @ref
  * LIBINPUT_DEVICE_CAP_TABLET_TOOL capability.
+ *
+ * For details on the interpretation of these axes see
+ * libinput_event_tablet_tool_get_axis_value().
  */
 enum libinput_tablet_

[PATCH libinput 13/14] tablet: rename the libinput_tool calls to libinput_tablet_tool

2015-11-17 Thread Peter Hutterer
Signed-off-by: Peter Hutterer 
---
 src/evdev-tablet.c  |  2 +-
 src/libinput.c  | 26 ++--
 src/libinput.h  | 34 +--
 src/libinput.sym| 18 +++---
 test/tablet.c   | 68 ++---
 tools/event-debug.c | 50 +++
 6 files changed, 99 insertions(+), 99 deletions(-)

diff --git a/src/evdev-tablet.c b/src/evdev-tablet.c
index c1d69de..7e1c2d0 100644
--- a/src/evdev-tablet.c
+++ b/src/evdev-tablet.c
@@ -1008,7 +1008,7 @@ tablet_destroy(struct evdev_dispatch *dispatch)
struct libinput_tablet_tool *tool, *tmp;
 
list_for_each_safe(tool, tmp, &tablet->tool_list, link) {
-   libinput_tool_unref(tool);
+   libinput_tablet_tool_unref(tool);
}
 
free(tablet);
diff --git a/src/libinput.c b/src/libinput.c
index 338255d..99c009d 100644
--- a/src/libinput.c
+++ b/src/libinput.c
@@ -1165,33 +1165,33 @@ libinput_event_tablet_tool_get_seat_button_count(struct 
libinput_event_tablet_to
 }
 
 LIBINPUT_EXPORT enum libinput_tablet_tool_type
-libinput_tool_get_type(struct libinput_tablet_tool *tool)
+libinput_tablet_tool_get_type(struct libinput_tablet_tool *tool)
 {
return tool->type;
 }
 
 LIBINPUT_EXPORT uint64_t
-libinput_tool_get_tool_id(struct libinput_tablet_tool *tool)
+libinput_tablet_tool_get_tool_id(struct libinput_tablet_tool *tool)
 {
return tool->tool_id;
 }
 
 LIBINPUT_EXPORT uint64_t
-libinput_tool_get_serial(struct libinput_tablet_tool *tool)
+libinput_tablet_tool_get_serial(struct libinput_tablet_tool *tool)
 {
return tool->serial;
 }
 
 LIBINPUT_EXPORT int
-libinput_tool_has_axis(struct libinput_tablet_tool *tool,
-  enum libinput_tablet_tool_axis axis)
+libinput_tablet_tool_has_axis(struct libinput_tablet_tool *tool,
+ enum libinput_tablet_tool_axis axis)
 {
return bit_is_set(tool->axis_caps, axis);
 }
 
 LIBINPUT_EXPORT int
-libinput_tool_has_button(struct libinput_tablet_tool *tool,
-uint32_t code)
+libinput_tablet_tool_has_button(struct libinput_tablet_tool *tool,
+   uint32_t code)
 {
if (NCHARS(code) > sizeof(tool->buttons))
return 0;
@@ -1200,27 +1200,27 @@ libinput_tool_has_button(struct libinput_tablet_tool 
*tool,
 }
 
 LIBINPUT_EXPORT void
-libinput_tool_set_user_data(struct libinput_tablet_tool *tool,
-   void *user_data)
+libinput_tablet_tool_set_user_data(struct libinput_tablet_tool *tool,
+  void *user_data)
 {
tool->user_data = user_data;
 }
 
 LIBINPUT_EXPORT void *
-libinput_tool_get_user_data(struct libinput_tablet_tool *tool)
+libinput_tablet_tool_get_user_data(struct libinput_tablet_tool *tool)
 {
return tool->user_data;
 }
 
 LIBINPUT_EXPORT struct libinput_tablet_tool *
-libinput_tool_ref(struct libinput_tablet_tool *tool)
+libinput_tablet_tool_ref(struct libinput_tablet_tool *tool)
 {
tool->refcount++;
return tool;
 }
 
 LIBINPUT_EXPORT struct libinput_tablet_tool *
-libinput_tool_unref(struct libinput_tablet_tool *tool)
+libinput_tablet_tool_unref(struct libinput_tablet_tool *tool)
 {
assert(tool->refcount > 0);
 
@@ -1374,7 +1374,7 @@ libinput_unref(struct libinput *libinput)
}
 
list_for_each_safe(tool, next_tool, &libinput->tool_list, link) {
-   libinput_tool_unref(tool);
+   libinput_tablet_tool_unref(tool);
}
 
libinput_timer_subsys_destroy(libinput);
diff --git a/src/libinput.h b/src/libinput.h
index 9884cdc..be815e7 100644
--- a/src/libinput.h
+++ b/src/libinput.h
@@ -174,7 +174,7 @@ struct libinput_tablet_tool;
  * physical tools may share the same tool type, e.g. a Wacom Classic Pen,
  * Wacom Pro Pen and a Wacom Grip Pen are all of type @ref
  * LIBINPUT_TABLET_TOOL_TYPE_PEN.
- * Use libinput_tool_get_tool_id() to get a specific model where applicable.
+ * Use libinput_tablet_tool_get_tool_id() to get a specific model where 
applicable.
  *
  * Note that on some device, the eraser tool is on the tail end of a pen
  * device. On other devices, e.g. MS Surface 3, the eraser is the pen tip
@@ -1497,7 +1497,7 @@ libinput_event_tablet_tool_get_y_transformed(struct 
libinput_event_tablet_tool *
  * Returns the tool that was in use during this event.
  * By default, each tool will stay valid for as long as it is being used, and 
is
  * destroyed when another tool comes into proximity. However, the lifetime of
- * the tool may be extended by using libinput_tool_ref() to increment the
+ * the tool may be extended by using libinput_tablet_tool_ref() to increment 
the
  * reference count of the tool. This guarantees that whenever the tool comes
  * back into proximity of the tablet, that the same structure will be used to
  * represent the tool.
@@ -1611,17 +1611,17 @@ libinput_event_tablet_t

[PATCH libinput 12/14] tablet: rename libinput_event_tablet to libinput_event_tablet_tool

2015-11-17 Thread Peter Hutterer
Signed-off-by: Peter Hutterer 
---
 src/libinput.c  |  56 +++
 src/libinput.h  |  66 
 src/libinput.sym|  32 ++--
 test/litest.c   |  30 ++--
 test/litest.h   |   2 +-
 test/misc.c |  16 +-
 test/tablet.c   | 438 ++--
 tools/event-debug.c |  72 -
 tools/event-gui.c   |  26 ++--
 9 files changed, 369 insertions(+), 369 deletions(-)

diff --git a/src/libinput.c b/src/libinput.c
index 79e3832..338255d 100644
--- a/src/libinput.c
+++ b/src/libinput.c
@@ -125,7 +125,7 @@ struct libinput_event_gesture {
double angle;
 };
 
-struct libinput_event_tablet {
+struct libinput_event_tablet_tool {
struct libinput_event base;
uint32_t button;
enum libinput_button_state state;
@@ -306,8 +306,8 @@ libinput_event_get_gesture_event(struct libinput_event 
*event)
return (struct libinput_event_gesture *) event;
 }
 
-LIBINPUT_EXPORT struct libinput_event_tablet *
-libinput_event_get_tablet_event(struct libinput_event *event)
+LIBINPUT_EXPORT struct libinput_event_tablet_tool *
+libinput_event_get_tablet_tool_event(struct libinput_event *event)
 {
require_event_type(libinput_event_get_context(event),
   event->type,
@@ -317,7 +317,7 @@ libinput_event_get_tablet_event(struct libinput_event 
*event)
   LIBINPUT_EVENT_TABLET_TOOL_TIP,
   LIBINPUT_EVENT_TABLET_TOOL_BUTTON);
 
-   return (struct libinput_event_tablet *) event;
+   return (struct libinput_event_tablet_tool *) event;
 }
 
 LIBINPUT_EXPORT struct libinput_event_device_notify *
@@ -913,7 +913,7 @@ libinput_event_gesture_get_angle_delta(struct 
libinput_event_gesture *event)
 }
 
 LIBINPUT_EXPORT int
-libinput_event_tablet_axis_has_changed(struct libinput_event_tablet *event,
+libinput_event_tablet_tool_axis_has_changed(struct libinput_event_tablet_tool 
*event,
   enum libinput_tablet_tool_axis axis)
 {
require_event_type(libinput_event_get_context(&event->base),
@@ -928,7 +928,7 @@ libinput_event_tablet_axis_has_changed(struct 
libinput_event_tablet *event,
 }
 
 LIBINPUT_EXPORT double
-libinput_event_tablet_get_axis_value(struct libinput_event_tablet *event,
+libinput_event_tablet_tool_get_axis_value(struct libinput_event_tablet_tool 
*event,
 enum libinput_tablet_tool_axis axis)
 {
struct evdev_device *device =
@@ -962,7 +962,7 @@ libinput_event_tablet_get_axis_value(struct 
libinput_event_tablet *event,
 }
 
 LIBINPUT_EXPORT double
-libinput_event_tablet_get_axis_delta(struct libinput_event_tablet *event,
+libinput_event_tablet_tool_get_axis_delta(struct libinput_event_tablet_tool 
*event,
 enum libinput_tablet_tool_axis axis)
 {
struct evdev_device *device =
@@ -996,8 +996,8 @@ libinput_event_tablet_get_axis_delta(struct 
libinput_event_tablet *event,
 }
 
 LIBINPUT_EXPORT double
-libinput_event_tablet_get_axis_delta_discrete(
- struct libinput_event_tablet *event,
+libinput_event_tablet_tool_get_axis_delta_discrete(
+ struct libinput_event_tablet_tool *event,
  enum libinput_tablet_tool_axis axis)
 {
require_event_type(libinput_event_get_context(&event->base),
@@ -1024,7 +1024,7 @@ libinput_event_tablet_get_axis_delta_discrete(
 }
 
 LIBINPUT_EXPORT double
-libinput_event_tablet_get_x_transformed(struct libinput_event_tablet *event,
+libinput_event_tablet_tool_get_x_transformed(struct libinput_event_tablet_tool 
*event,
uint32_t width)
 {
struct evdev_device *device =
@@ -1043,7 +1043,7 @@ libinput_event_tablet_get_x_transformed(struct 
libinput_event_tablet *event,
 }
 
 LIBINPUT_EXPORT double
-libinput_event_tablet_get_y_transformed(struct libinput_event_tablet *event,
+libinput_event_tablet_tool_get_y_transformed(struct libinput_event_tablet_tool 
*event,
uint32_t height)
 {
struct evdev_device *device =
@@ -1062,7 +1062,7 @@ libinput_event_tablet_get_y_transformed(struct 
libinput_event_tablet *event,
 }
 
 LIBINPUT_EXPORT struct libinput_tablet_tool *
-libinput_event_tablet_get_tool(struct libinput_event_tablet *event)
+libinput_event_tablet_tool_get_tool(struct libinput_event_tablet_tool *event)
 {
require_event_type(libinput_event_get_context(&event->base),
   event->base.type,
@@ -1076,7 +1076,7 @@ libinput_event_tablet_get_tool(struct 
libinput_event_tablet *event)
 }
 
 LIBINPUT_EXPORT enum libinput_tablet_tool_proximity_state
-libinput_event_tablet_get_proximity_state(struct libinput_event_tablet *event)
+libinput_event_tablet_tool_get_proximity_state(struct 
libinput_event_tablet_tool *event)
 {
require_event_type(libinput_event_get_context(&event->ba

[PATCH libinput 09/14] tablet: rename TOOL_TIP to TABLET_TOOL_TIP

2015-11-17 Thread Peter Hutterer
Signed-off-by: Peter Hutterer 
---
 src/evdev-tablet.c  |  8 
 src/libinput.h  |  4 ++--
 test/tablet.c   | 38 +++---
 tools/event-debug.c |  2 +-
 tools/event-gui.c   |  2 +-
 5 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/src/evdev-tablet.c b/src/evdev-tablet.c
index 871e10e..c1d69de 100644
--- a/src/evdev-tablet.c
+++ b/src/evdev-tablet.c
@@ -410,7 +410,7 @@ tablet_check_notify_axes(struct tablet_dispatch *tablet,
enum libinput_tablet_tool_tip_state tip_state;
 
tip_state = tablet_has_status(tablet, 
TABLET_TOOL_IN_CONTACT) ?
-   LIBINPUT_TOOL_TIP_DOWN : LIBINPUT_TOOL_TIP_UP;
+   LIBINPUT_TABLET_TOOL_TIP_DOWN : 
LIBINPUT_TABLET_TOOL_TIP_UP;
tablet_notify_axis(base,
   time,
   tool,
@@ -795,7 +795,7 @@ tablet_notify_button_mask(struct tablet_dispatch *tablet,
enum libinput_tablet_tool_tip_state tip_state;
 
tip_state = tablet_has_status(tablet, TABLET_TOOL_IN_CONTACT) ?
-   LIBINPUT_TOOL_TIP_DOWN : LIBINPUT_TOOL_TIP_UP;
+   LIBINPUT_TABLET_TOOL_TIP_DOWN : 
LIBINPUT_TABLET_TOOL_TIP_UP;
 
for (i = 0; i < nbits; i++) {
if (!bit_is_set(buttons, i))
@@ -906,7 +906,7 @@ tablet_flush(struct tablet_dispatch *tablet,
tablet_notify_tip(&device->base,
  time,
  tool,
- LIBINPUT_TOOL_TIP_DOWN,
+ LIBINPUT_TABLET_TOOL_TIP_DOWN,
  tablet->axes);
tablet_unset_status(tablet, TABLET_TOOL_ENTERING_CONTACT);
tablet_set_status(tablet, TABLET_TOOL_IN_CONTACT);
@@ -934,7 +934,7 @@ tablet_flush(struct tablet_dispatch *tablet,
tablet_notify_tip(&device->base,
  time,
  tool,
- LIBINPUT_TOOL_TIP_UP,
+ LIBINPUT_TABLET_TOOL_TIP_UP,
  tablet->axes);
tablet_unset_status(tablet, TABLET_TOOL_LEAVING_CONTACT);
tablet_unset_status(tablet, TABLET_TOOL_IN_CONTACT);
diff --git a/src/libinput.h b/src/libinput.h
index a13700f..ff1eaa6 100644
--- a/src/libinput.h
+++ b/src/libinput.h
@@ -226,8 +226,8 @@ enum libinput_tablet_tool_proximity_state {
  * touching the surface of the tablet device.
  */
 enum libinput_tablet_tool_tip_state {
-   LIBINPUT_TOOL_TIP_UP = 0,
-   LIBINPUT_TOOL_TIP_DOWN = 1,
+   LIBINPUT_TABLET_TOOL_TIP_UP = 0,
+   LIBINPUT_TABLET_TOOL_TIP_DOWN = 1,
 };
 
 /**
diff --git a/test/tablet.c b/test/tablet.c
index 50188d5..7aa76b2 100644
--- a/test/tablet.c
+++ b/test/tablet.c
@@ -56,7 +56,7 @@ START_TEST(tip_down_up)
tablet_event = litest_is_tablet_event(event,
  LIBINPUT_EVENT_TABLET_TIP);
ck_assert_int_eq(libinput_event_tablet_get_tip_state(tablet_event),
-LIBINPUT_TOOL_TIP_DOWN);
+LIBINPUT_TABLET_TOOL_TIP_DOWN);
libinput_event_destroy(event);
litest_assert_empty_queue(li);
 
@@ -68,7 +68,7 @@ START_TEST(tip_down_up)
tablet_event = litest_is_tablet_event(event,
  LIBINPUT_EVENT_TABLET_TIP);
ck_assert_int_eq(libinput_event_tablet_get_tip_state(tablet_event),
-LIBINPUT_TOOL_TIP_UP);
+LIBINPUT_TABLET_TOOL_TIP_UP);
libinput_event_destroy(event);
litest_assert_empty_queue(li);
 
@@ -108,7 +108,7 @@ START_TEST(tip_down_prox_in)
tablet_event = litest_is_tablet_event(event,
  LIBINPUT_EVENT_TABLET_TIP);
ck_assert_int_eq(libinput_event_tablet_get_tip_state(tablet_event),
-LIBINPUT_TOOL_TIP_DOWN);
+LIBINPUT_TABLET_TOOL_TIP_DOWN);
libinput_event_destroy(event);
 
litest_assert_empty_queue(li);
@@ -142,7 +142,7 @@ START_TEST(tip_up_prox_out)
tablet_event = litest_is_tablet_event(event,
  LIBINPUT_EVENT_TABLET_TIP);
ck_assert_int_eq(libinput_event_tablet_get_tip_state(tablet_event),
-LIBINPUT_TOOL_TIP_UP);
+LIBINPUT_TABLET_TOOL_TIP_UP);
libinput_event_destroy(event);
 
libinput_dispatch(li);
@@ -193,7 +193,7 @@ START_TEST(tip_up_btn_change)
tablet_event = litest_is_tablet_event(event,
  LIBINPUT_EVENT_TABLET_TIP);
ck_assert_int_eq(libinput_event_tablet_get_tip_state(tablet_event),
-LIBINPUT_TOOL_T

[PATCH libinput 04/14] tablet: rename libinput_tool_type to libinput_tablet_tool_type

2015-11-17 Thread Peter Hutterer
Signed-off-by: Peter Hutterer 
---
 src/evdev-tablet.c | 12 ++--
 src/evdev-tablet.h |  4 ++--
 src/libinput-private.h |  2 +-
 src/libinput.c |  2 +-
 src/libinput.h |  6 +++---
 5 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/evdev-tablet.c b/src/evdev-tablet.c
index 4f9465e..1afc044 100644
--- a/src/evdev-tablet.c
+++ b/src/evdev-tablet.c
@@ -186,7 +186,7 @@ tablet_change_to_left_handed(struct evdev_device *device)
 static void
 tablet_update_tool(struct tablet_dispatch *tablet,
   struct evdev_device *device,
-  enum libinput_tool_type tool,
+  enum libinput_tablet_tool_type tool,
   bool enabled)
 {
assert(tool != LIBINPUT_TOOL_NONE);
@@ -460,10 +460,10 @@ tablet_update_button(struct tablet_dispatch *tablet,
}
 }
 
-static inline enum libinput_tool_type
+static inline enum libinput_tablet_tool_type
 tablet_evcode_to_tool(int code)
 {
-   enum libinput_tool_type type;
+   enum libinput_tablet_tool_type type;
 
switch (code) {
case BTN_TOOL_PEN:  type = LIBINPUT_TOOL_TYPE_PEN;  break;
@@ -670,7 +670,7 @@ static void
 tool_set_bits(const struct tablet_dispatch *tablet,
  struct libinput_tablet_tool *tool)
 {
-   enum libinput_tool_type type = tool->type;
+   enum libinput_tablet_tool_type type = tool->type;
 
 #if HAVE_LIBWACOM
if (tool_set_bits_from_libwacom(tablet, tool) == 0)
@@ -728,7 +728,7 @@ tool_set_bits(const struct tablet_dispatch *tablet,
 
 static struct libinput_tablet_tool *
 tablet_get_tool(struct tablet_dispatch *tablet,
-   enum libinput_tool_type type,
+   enum libinput_tablet_tool_type type,
uint32_t tool_id,
uint32_t serial)
 {
@@ -1020,7 +1020,7 @@ tablet_check_initial_proximity(struct evdev_device 
*device,
 {
bool tool_in_prox = false;
int code, state;
-   enum libinput_tool_type tool;
+   enum libinput_tablet_tool_type tool;
struct tablet_dispatch *tablet = (struct tablet_dispatch*)dispatch;
 
for (tool = LIBINPUT_TOOL_TYPE_PEN; tool <= LIBINPUT_TOOL_TYPE_MAX; 
tool++) {
diff --git a/src/evdev-tablet.h b/src/evdev-tablet.h
index e88d87c..fb5ddb7 100644
--- a/src/evdev-tablet.h
+++ b/src/evdev-tablet.h
@@ -62,7 +62,7 @@ struct tablet_dispatch {
struct button_state button_state;
struct button_state prev_button_state;
 
-   enum libinput_tool_type current_tool_type;
+   enum libinput_tablet_tool_type current_tool_type;
uint32_t current_tool_id;
uint32_t current_tool_serial;
 };
@@ -160,7 +160,7 @@ axis_to_evcode(const enum libinput_tablet_tool_axis axis)
 }
 
 static inline int
-tablet_tool_to_evcode(enum libinput_tool_type type)
+tablet_tool_to_evcode(enum libinput_tablet_tool_type type)
 {
int code;
 
diff --git a/src/libinput-private.h b/src/libinput-private.h
index 96a38d2..394fd9b 100644
--- a/src/libinput-private.h
+++ b/src/libinput-private.h
@@ -254,7 +254,7 @@ struct libinput_tablet_tool {
struct list link;
uint32_t serial;
uint32_t tool_id;
-   enum libinput_tool_type type;
+   enum libinput_tablet_tool_type type;
unsigned char axis_caps[NCHARS(LIBINPUT_TABLET_TOOL_AXIS_MAX + 1)];
unsigned char buttons[NCHARS(KEY_MAX) + 1];
int refcount;
diff --git a/src/libinput.c b/src/libinput.c
index 9d35927..bef02bb 100644
--- a/src/libinput.c
+++ b/src/libinput.c
@@ -1164,7 +1164,7 @@ libinput_event_tablet_get_seat_button_count(struct 
libinput_event_tablet *event)
return event->seat_button_count;
 }
 
-LIBINPUT_EXPORT enum libinput_tool_type
+LIBINPUT_EXPORT enum libinput_tablet_tool_type
 libinput_tool_get_type(struct libinput_tablet_tool *tool)
 {
return tool->type;
diff --git a/src/libinput.h b/src/libinput.h
index 853367c..07b0741 100644
--- a/src/libinput.h
+++ b/src/libinput.h
@@ -180,12 +180,12 @@ struct libinput_tablet_tool;
  * device. On other devices, e.g. MS Surface 3, the eraser is the pen tip
  * while a button is held down.
  *
- * @note The @ref libinput_tool_type can only describe the default physical
+ * @note The @ref libinput_tablet_tool_type can only describe the default 
physical
  * type of the device. For devices with adjustible physical properties
  * the tool type remains the same, i.e. putting a Wacom stroke nib into a
  * classic pen leaves the tool type as @ref LIBINPUT_TOOL_TYPE_PEN.
  */
-enum libinput_tool_type {
+enum libinput_tablet_tool_type {
LIBINPUT_TOOL_TYPE_PEN = 1, /**< A generic pen */
LIBINPUT_TOOL_TYPE_ERASER,  /**< Eraser */
LIBINPUT_TOOL_TYPE_BRUSH,   /**< A paintbrush-like tool */
@@ -1613,7 +1613,7 @@ libinput_event_tablet_get_time_usec(struct 
libinput_event_tablet *event);
  *
  * @see libinput_tool_get_tool_id
  */
-enum libinput_tool_type
+enum libinput_tablet_tool_type
 libinput_tool_get_typ

[PATCH libinput 00/14] tablet: the big "tablet" -> "tablet tool" rename

2015-11-17 Thread Peter Hutterer

The current tablet API is a bit inconsistent, we have various 'tablet'
prefixes (libinput_event_tablet) and 'tool' prefixes
(libinput_tool_get_serial). That made sense in the early stages when the
emphasis on tools wasn't as strong as it is now.

The tablet interface now is aimed solely at tablet tools and we get
inconsistencies in the API, it's not always clear whether something is a
libinput_tool_foo or a libinput_tablet_foo. This patchset renames everything
tablet-related to use 'tablet_tool' as prefix. Makes the API verbose but not
much to do about that unless someone comes up with a better name than
"tablet tool".

The wayland tablet protocol is also tool-focused, so this rename brings it
in line.

Patches are all simple sed renames with a few indentation changes, and
split into 13 patches to avoid overloading reviewer brains :)
Patch 14 is new, and has a bunch of documentation on top.

Cheers,
  Peter
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH libinput 07/14] tablet: rename TOOL_PROXIMITY_ to TABLET_TOOL_PROXIMITY

2015-11-17 Thread Peter Hutterer
Signed-off-by: Peter Hutterer 
---
 src/evdev-tablet.c  | 4 ++--
 src/libinput.c  | 6 +++---
 src/libinput.h  | 8 
 test/tablet.c   | 6 +++---
 tools/event-debug.c | 4 ++--
 tools/event-gui.c   | 2 +-
 6 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/evdev-tablet.c b/src/evdev-tablet.c
index 3dfc005..040582b 100644
--- a/src/evdev-tablet.c
+++ b/src/evdev-tablet.c
@@ -403,7 +403,7 @@ tablet_check_notify_axes(struct tablet_dispatch *tablet,
tablet_notify_proximity(&device->base,
time,
tool,
-   LIBINPUT_TOOL_PROXIMITY_IN,
+   
LIBINPUT_TABLET_TOOL_PROXIMITY_IN,
tablet->changed_axes,
axes);
else {
@@ -945,7 +945,7 @@ tablet_flush(struct tablet_dispatch *tablet,
tablet_notify_proximity(&device->base,
time,
tool,
-   LIBINPUT_TOOL_PROXIMITY_OUT,
+   LIBINPUT_TABLET_TOOL_PROXIMITY_OUT,
tablet->changed_axes,
tablet->axes);
 
diff --git a/src/libinput.c b/src/libinput.c
index ab98d63..bd33b25 100644
--- a/src/libinput.c
+++ b/src/libinput.c
@@ -1988,7 +1988,7 @@ tablet_notify_axis(struct libinput_device *device,
*axis_event = (struct libinput_event_tablet) {
.time = time,
.tool = tool,
-   .proximity_state = LIBINPUT_TOOL_PROXIMITY_IN,
+   .proximity_state = LIBINPUT_TABLET_TOOL_PROXIMITY_IN,
.tip_state = tip_state,
};
 
@@ -2058,7 +2058,7 @@ tablet_notify_tip(struct libinput_device *device,
.time = time,
.tool = tool,
.tip_state = tip_state,
-   .proximity_state = LIBINPUT_TOOL_PROXIMITY_IN,
+   .proximity_state = LIBINPUT_TABLET_TOOL_PROXIMITY_IN,
};
memcpy(tip_event->axes,
   axes,
@@ -2096,7 +2096,7 @@ tablet_notify_button(struct libinput_device *device,
.button = button,
.state = state,
.seat_button_count = seat_button_count,
-   .proximity_state = LIBINPUT_TOOL_PROXIMITY_IN,
+   .proximity_state = LIBINPUT_TABLET_TOOL_PROXIMITY_IN,
.tip_state = tip_state,
};
memcpy(button_event->axes, axes, sizeof(button_event->axes));
diff --git a/src/libinput.h b/src/libinput.h
index ae3006b..2a563f8 100644
--- a/src/libinput.h
+++ b/src/libinput.h
@@ -212,8 +212,8 @@ enum libinput_tablet_tool_type {
  * distance (a few cm) off the surface.
  */
 enum libinput_tablet_tool_proximity_state {
-   LIBINPUT_TOOL_PROXIMITY_OUT = 0,
-   LIBINPUT_TOOL_PROXIMITY_IN = 1,
+   LIBINPUT_TABLET_TOOL_PROXIMITY_OUT = 0,
+   LIBINPUT_TABLET_TOOL_PROXIMITY_IN = 1,
 };
 
 /**
@@ -299,9 +299,9 @@ enum libinput_event_type {
 * with @ref LIBINPUT_EVENT_TABLET_AXIS events.
 *
 * Some tools may always be in proximity. For these tools, events of
-* type @ref LIBINPUT_TOOL_PROXIMITY_IN are sent only once after @ref
+* type @ref LIBINPUT_TABLET_TOOL_PROXIMITY_IN are sent only once after 
@ref
 * LIBINPUT_EVENT_DEVICE_ADDED, and events of type @ref
-* LIBINPUT_TOOL_PROXIMITY_OUT are sent only once before @ref
+* LIBINPUT_TABLET_TOOL_PROXIMITY_OUT are sent only once before @ref
 * LIBINPUT_EVENT_DEVICE_REMOVED.
 *
 * If the tool that comes into proximity supports x/y coordinates,
diff --git a/test/tablet.c b/test/tablet.c
index 0e77a20..50188d5 100644
--- a/test/tablet.c
+++ b/test/tablet.c
@@ -100,7 +100,7 @@ START_TEST(tip_down_prox_in)
tablet_event = litest_is_tablet_event(event,
  LIBINPUT_EVENT_TABLET_PROXIMITY);

ck_assert_int_eq(libinput_event_tablet_get_proximity_state(tablet_event),
-LIBINPUT_TOOL_PROXIMITY_IN);
+LIBINPUT_TABLET_TOOL_PROXIMITY_IN);
libinput_event_destroy(event);
 
libinput_dispatch(li);
@@ -150,7 +150,7 @@ START_TEST(tip_up_prox_out)
tablet_event = litest_is_tablet_event(event,
  LIBINPUT_EVENT_TABLET_PROXIMITY);

ck_assert_int_eq(libinput_event_tablet_get_proximity_state(tablet_event),
-LIBINPUT_TOOL_PROXIMITY_OUT);
+LIBINPUT_TABLET_TOOL_PROXIMITY_OUT);
libinput_event_destroy(event);
 
litest_assert_empty_queue(li);
@@ -609,7 +609,7 @@ START_TEST(proximity_in_out)

[PATCH libinput 10/14] tablet: rename the tablet capability to a tablet_tool capability

2015-11-17 Thread Peter Hutterer
Signed-off-by: Peter Hutterer 
---
 src/evdev.c   |  2 +-
 src/libinput.c|  2 +-
 src/libinput.h| 18 +-
 tools/event-debug.c   |  2 +-
 tools/libinput-list-devices.c |  2 +-
 5 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/evdev.c b/src/evdev.c
index a3a72ef..e2bbdc3 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -2418,7 +2418,7 @@ evdev_device_has_capability(struct evdev_device *device,
return !!(device->seat_caps & EVDEV_DEVICE_TOUCH);
case LIBINPUT_DEVICE_CAP_GESTURE:
return !!(device->seat_caps & EVDEV_DEVICE_GESTURE);
-   case LIBINPUT_DEVICE_CAP_TABLET:
+   case LIBINPUT_DEVICE_CAP_TABLET_TOOL:
return !!(device->seat_caps & EVDEV_DEVICE_TABLET);
default:
return 0;
diff --git a/src/libinput.c b/src/libinput.c
index 5308d8d..708399f 100644
--- a/src/libinput.c
+++ b/src/libinput.c
@@ -1710,7 +1710,7 @@ device_has_cap(struct libinput_device *device,
case LIBINPUT_DEVICE_CAP_GESTURE:
capability = "CAP_GESTURE";
break;
-   case LIBINPUT_DEVICE_CAP_TABLET:
+   case LIBINPUT_DEVICE_CAP_TABLET_TOOL:
capability = "CAP_TABLET";
break;
}
diff --git a/src/libinput.h b/src/libinput.h
index ff1eaa6..8604284 100644
--- a/src/libinput.h
+++ b/src/libinput.h
@@ -58,7 +58,7 @@ enum libinput_device_capability {
LIBINPUT_DEVICE_CAP_KEYBOARD = 0,
LIBINPUT_DEVICE_CAP_POINTER = 1,
LIBINPUT_DEVICE_CAP_TOUCH = 2,
-   LIBINPUT_DEVICE_CAP_TABLET = 3,
+   LIBINPUT_DEVICE_CAP_TABLET_TOOL = 3,
LIBINPUT_DEVICE_CAP_GESTURE = 5,
 };
 
@@ -138,7 +138,7 @@ enum libinput_pointer_axis_source {
  * @ingroup device
  *
  * Available axis types for a device. It must have the @ref
- * LIBINPUT_DEVICE_CAP_TABLET capability.
+ * LIBINPUT_DEVICE_CAP_TABLET_TOOL capability.
  */
 enum libinput_tablet_tool_axis {
LIBINPUT_TABLET_TOOL_AXIS_X = 1,
@@ -156,7 +156,7 @@ enum libinput_tablet_tool_axis {
  * @ingroup device
  *
  * An object representing a tool being used by a device with the @ref
- * LIBINPUT_DEVICE_CAP_TABLET capability.
+ * LIBINPUT_DEVICE_CAP_TABLET_TOOL capability.
  *
  * Tablet events generated by such a device are bound to a specific tool
  * rather than coming from the device directly. Depending on the hardware it
@@ -169,7 +169,7 @@ struct libinput_tablet_tool;
  * @ingroup device
  *
  * Available tool types for a device with the @ref
- * LIBINPUT_DEVICE_CAP_TABLET capability. The tool type defines the default
+ * LIBINPUT_DEVICE_CAP_TABLET_TOOL capability. The tool type defines the 
default
  * usage of the tool as advertised by the manufacturer. Multiple different
  * physical tools may share the same tool type, e.g. a Wacom Classic Pen,
  * Wacom Pro Pen and a Wacom Grip Pen are all of type @ref
@@ -201,7 +201,7 @@ enum libinput_tablet_tool_type {
  * @ingroup device
  *
  * The state of proximity for a tool on a device. The device must have the @ref
- * LIBINPUT_DEVICE_CAP_TABLET capability.
+ * LIBINPUT_DEVICE_CAP_TABLET_TOOL capability.
  *
  * The proximity of a tool is a binary state signalling whether the tool is
  * within detectable distance of the tablet device. A tool that is out of
@@ -220,7 +220,7 @@ enum libinput_tablet_tool_proximity_state {
  * @ingroup device
  *
  * The tip contact state for a tool on a device. The device must have
- * the @ref LIBINPUT_DEVICE_CAP_TABLET capability.
+ * the @ref LIBINPUT_DEVICE_CAP_TABLET_TOOL capability.
  *
  * The tip contact state of a tool is a binary state signalling whether the 
tool is
  * touching the surface of the tablet device.
@@ -278,7 +278,7 @@ enum libinput_event_type {
 
/**
 * One or more axes have changed state on a device with the @ref
-* LIBINPUT_DEVICE_CAP_TABLET capability. This event is only sent
+* LIBINPUT_DEVICE_CAP_TABLET_TOOL capability. This event is only sent
 * when the tool is in proximity, see @ref
 * LIBINPUT_EVENT_TABLET_PROXIMITY for details.
 *
@@ -292,7 +292,7 @@ enum libinput_event_type {
LIBINPUT_EVENT_TABLET_AXIS = 600,
/**
 * Signals that a tool has come in or out of proximity of a device with
-* the @ref LIBINPUT_DEVICE_CAP_TABLET capability.
+* the @ref LIBINPUT_DEVICE_CAP_TABLET_TOOL capability.
 *
 * Proximity events contain each of the current values for each axis,
 * and these values may be extracted from them in the same way they are
@@ -317,7 +317,7 @@ enum libinput_event_type {
LIBINPUT_EVENT_TABLET_PROXIMITY,
/**
 * Signals that a tool has come in contact with the surface of a
-* device with the @ref LIBINPUT_DEVICE_CAP_TABLET capability.
+* device with the @ref LIBINPUT_DEVICE_CAP_TABLET_TOOL capability.
 *
 * On devices without distanc

[PATCH libinput 11/14] tablet: rename LIBINPUT_EVENT_TABLET to LIBINPUT_EVENT_TABLET_TOOL

2015-11-17 Thread Peter Hutterer
Signed-off-by: Peter Hutterer 
---
 doc/tablet-support.dox |   2 +-
 src/libinput.c | 104 +-
 src/libinput.h |  46 +++
 test/litest.c  |  16 +++---
 test/misc.c|   4 +-
 test/tablet.c  | 150 -
 tools/event-debug.c|  16 +++---
 tools/event-gui.c  |  16 +++---
 8 files changed, 177 insertions(+), 177 deletions(-)

diff --git a/doc/tablet-support.dox b/doc/tablet-support.dox
index fb8ea32..47ad005 100644
--- a/doc/tablet-support.dox
+++ b/doc/tablet-support.dox
@@ -8,7 +8,7 @@ Apple iPad.
 
 @section fake-proximity Handling of proximity events
 
-libinput's @ref LIBINPUT_EVENT_TABLET_PROXIMITY events represent the
+libinput's @ref LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY events represent the
 physical proximity limits of the device. In some cases the caller should
 emulate proximity based on the distance events. For example, the Wacom mouse
 and lens cursor tools are usually used in relative mode, lying flat on the
diff --git a/src/libinput.c b/src/libinput.c
index 708399f..79e3832 100644
--- a/src/libinput.c
+++ b/src/libinput.c
@@ -312,10 +312,10 @@ libinput_event_get_tablet_event(struct libinput_event 
*event)
require_event_type(libinput_event_get_context(event),
   event->type,
   NULL,
-  LIBINPUT_EVENT_TABLET_AXIS,
-  LIBINPUT_EVENT_TABLET_PROXIMITY,
-  LIBINPUT_EVENT_TABLET_TIP,
-  LIBINPUT_EVENT_TABLET_BUTTON);
+  LIBINPUT_EVENT_TABLET_TOOL_AXIS,
+  LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY,
+  LIBINPUT_EVENT_TABLET_TOOL_TIP,
+  LIBINPUT_EVENT_TABLET_TOOL_BUTTON);
 
return (struct libinput_event_tablet *) event;
 }
@@ -919,9 +919,9 @@ libinput_event_tablet_axis_has_changed(struct 
libinput_event_tablet *event,
require_event_type(libinput_event_get_context(&event->base),
   event->base.type,
   0,
-  LIBINPUT_EVENT_TABLET_AXIS,
-  LIBINPUT_EVENT_TABLET_TIP,
-  LIBINPUT_EVENT_TABLET_PROXIMITY);
+  LIBINPUT_EVENT_TABLET_TOOL_AXIS,
+  LIBINPUT_EVENT_TABLET_TOOL_TIP,
+  LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
 
return (NCHARS(axis) <= sizeof(event->changed_axes)) ?
bit_is_set(event->changed_axes, axis) : 0;
@@ -937,9 +937,9 @@ libinput_event_tablet_get_axis_value(struct 
libinput_event_tablet *event,
require_event_type(libinput_event_get_context(&event->base),
   event->base.type,
   0,
-  LIBINPUT_EVENT_TABLET_AXIS,
-  LIBINPUT_EVENT_TABLET_TIP,
-  LIBINPUT_EVENT_TABLET_PROXIMITY);
+  LIBINPUT_EVENT_TABLET_TOOL_AXIS,
+  LIBINPUT_EVENT_TABLET_TOOL_TIP,
+  LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
 
switch(axis) {
case LIBINPUT_TABLET_TOOL_AXIS_X:
@@ -971,9 +971,9 @@ libinput_event_tablet_get_axis_delta(struct 
libinput_event_tablet *event,
require_event_type(libinput_event_get_context(&event->base),
   event->base.type,
   0,
-  LIBINPUT_EVENT_TABLET_AXIS,
-  LIBINPUT_EVENT_TABLET_TIP,
-  LIBINPUT_EVENT_TABLET_PROXIMITY);
+  LIBINPUT_EVENT_TABLET_TOOL_AXIS,
+  LIBINPUT_EVENT_TABLET_TOOL_TIP,
+  LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
 
switch(axis) {
case LIBINPUT_TABLET_TOOL_AXIS_X:
@@ -1003,9 +1003,9 @@ libinput_event_tablet_get_axis_delta_discrete(
require_event_type(libinput_event_get_context(&event->base),
   event->base.type,
   0,
-  LIBINPUT_EVENT_TABLET_AXIS,
-  LIBINPUT_EVENT_TABLET_TIP,
-  LIBINPUT_EVENT_TABLET_PROXIMITY);
+  LIBINPUT_EVENT_TABLET_TOOL_AXIS,
+  LIBINPUT_EVENT_TABLET_TOOL_TIP,
+  LIBINPUT_EVENT_TABLET_TOOL_PROXIMITY);
 
switch(axis) {
case LIBINPUT_TABLET_TOOL_AXIS_X:
@@ -1033,9 +1033,9 @@ libinput_event_tablet_get_x_transformed(struct 
libinput_event_tablet *event,
require_event_type(libinput_event_get_context(&event->base),
   event->base.type,
   0,
-  LIBINPUT_EVENT_TABLET_AXIS,
-  LIBINPUT_EVENT_TABLET_TIP,
-   

[PATCH libinput 06/14] tablet: rename tool_proximity_state to tablet_tool_proximity state

2015-11-17 Thread Peter Hutterer
Signed-off-by: Peter Hutterer 
---
 src/libinput-private.h | 2 +-
 src/libinput.c | 6 +++---
 src/libinput.h | 4 ++--
 tools/event-debug.c| 2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/libinput-private.h b/src/libinput-private.h
index 394fd9b..a1f66b1 100644
--- a/src/libinput-private.h
+++ b/src/libinput-private.h
@@ -473,7 +473,7 @@ void
 tablet_notify_proximity(struct libinput_device *device,
uint64_t time,
struct libinput_tablet_tool *tool,
-   enum libinput_tool_proximity_state state,
+   enum libinput_tablet_tool_proximity_state state,
unsigned char *changed_axes,
double *axes);
 
diff --git a/src/libinput.c b/src/libinput.c
index bef02bb..ab98d63 100644
--- a/src/libinput.c
+++ b/src/libinput.c
@@ -136,7 +136,7 @@ struct libinput_event_tablet {
double deltas_discrete[LIBINPUT_TABLET_TOOL_AXIS_MAX + 1];
unsigned char changed_axes[NCHARS(LIBINPUT_TABLET_TOOL_AXIS_MAX + 1)];
struct libinput_tablet_tool *tool;
-   enum libinput_tool_proximity_state proximity_state;
+   enum libinput_tablet_tool_proximity_state proximity_state;
enum libinput_tool_tip_state tip_state;
 };
 
@@ -1075,7 +1075,7 @@ libinput_event_tablet_get_tool(struct 
libinput_event_tablet *event)
return event->tool;
 }
 
-LIBINPUT_EXPORT enum libinput_tool_proximity_state
+LIBINPUT_EXPORT enum libinput_tablet_tool_proximity_state
 libinput_event_tablet_get_proximity_state(struct libinput_event_tablet *event)
 {
require_event_type(libinput_event_get_context(&event->base),
@@ -2011,7 +2011,7 @@ void
 tablet_notify_proximity(struct libinput_device *device,
uint64_t time,
struct libinput_tablet_tool *tool,
-   enum libinput_tool_proximity_state proximity_state,
+   enum libinput_tablet_tool_proximity_state 
proximity_state,
unsigned char *changed_axes,
double *axes)
 {
diff --git a/src/libinput.h b/src/libinput.h
index b83a6fc..ae3006b 100644
--- a/src/libinput.h
+++ b/src/libinput.h
@@ -211,7 +211,7 @@ enum libinput_tablet_tool_type {
  * surface. On other hardware, the tool is still detectable within a short
  * distance (a few cm) off the surface.
  */
-enum libinput_tool_proximity_state {
+enum libinput_tablet_tool_proximity_state {
LIBINPUT_TOOL_PROXIMITY_OUT = 0,
LIBINPUT_TOOL_PROXIMITY_IN = 1,
 };
@@ -1523,7 +1523,7 @@ libinput_event_tablet_get_tool(struct 
libinput_event_tablet *event);
  * @param event The libinput tablet event
  * @return The new proximity state of the tool from the event.
  */
-enum libinput_tool_proximity_state
+enum libinput_tablet_tool_proximity_state
 libinput_event_tablet_get_proximity_state(struct libinput_event_tablet *event);
 
 /**
diff --git a/tools/event-debug.c b/tools/event-debug.c
index e4fe9ab..af67f61 100644
--- a/tools/event-debug.c
+++ b/tools/event-debug.c
@@ -458,7 +458,7 @@ print_proximity_event(struct libinput_event *ev)
 {
struct libinput_event_tablet *t = libinput_event_get_tablet_event(ev);
struct libinput_tablet_tool *tool = libinput_event_tablet_get_tool(t);
-   enum libinput_tool_proximity_state state;
+   enum libinput_tablet_tool_proximity_state state;
const char *tool_str,
   *state_str;
 
-- 
2.5.0

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH libinput 03/14] tablet: rename the tablet axes to "LIBINPUT_TABLET_TOOL_AXIS_..."

2015-11-17 Thread Peter Hutterer
Signed-off-by: Peter Hutterer 
---
 src/evdev-tablet.c | 126 +--
 src/evdev-tablet.h |  48 +--
 src/libinput-private.h |   4 +-
 src/libinput.c |  66 +++---
 src/libinput.h |  36 
 test/tablet.c  | 228 -
 tools/event-debug.c|  82 +-
 tools/event-gui.c  |   8 +-
 8 files changed, 299 insertions(+), 299 deletions(-)

diff --git a/src/evdev-tablet.c b/src/evdev-tablet.c
index d1ffe09..4f9465e 100644
--- a/src/evdev-tablet.c
+++ b/src/evdev-tablet.c
@@ -75,7 +75,7 @@ tablet_device_has_axis(struct tablet_dispatch *tablet,
bool has_axis = false;
unsigned int code;
 
-   if (axis == LIBINPUT_TABLET_AXIS_ROTATION_Z) {
+   if (axis == LIBINPUT_TABLET_TOOL_AXIS_ROTATION_Z) {
has_axis = (libevdev_has_event_code(evdev,
EV_KEY,
BTN_TOOL_MOUSE) &&
@@ -89,7 +89,7 @@ tablet_device_has_axis(struct tablet_dispatch *tablet,
has_axis |= libevdev_has_event_code(evdev,
EV_ABS,
code);
-   } else if (axis == LIBINPUT_TABLET_AXIS_REL_WHEEL) {
+   } else if (axis == LIBINPUT_TABLET_TOOL_AXIS_REL_WHEEL) {
has_axis = libevdev_has_event_code(evdev,
   EV_REL,
   REL_WHEEL);
@@ -121,7 +121,7 @@ tablet_process_absolute(struct tablet_dispatch *tablet,
case ABS_DISTANCE:
case ABS_WHEEL:
axis = evcode_to_axis(e->code);
-   if (axis == LIBINPUT_TABLET_AXIS_NONE) {
+   if (axis == LIBINPUT_TABLET_TOOL_AXIS_NONE) {
log_bug_libinput(device->base.seat->libinput,
 "Invalid ABS event code %#x\n",
 e->code);
@@ -160,7 +160,7 @@ tablet_mark_all_axes_changed(struct tablet_dispatch *tablet,
 {
enum libinput_tablet_tool_axis a;
 
-   for (a = LIBINPUT_TABLET_AXIS_X; a <= LIBINPUT_TABLET_AXIS_MAX; a++) {
+   for (a = LIBINPUT_TABLET_TOOL_AXIS_X; a <= 
LIBINPUT_TABLET_TOOL_AXIS_MAX; a++) {
if (tablet_device_has_axis(tablet, a))
set_bit(tablet->changed_axes, a);
}
@@ -237,10 +237,10 @@ convert_tilt_to_rotation(struct tablet_dispatch *tablet)
   values. The device has a 175 degree CCW hardware offset but since we 
use
   atan2 the effective offset is just 5 degrees.
   */
-   x = tablet->axes[LIBINPUT_TABLET_AXIS_TILT_X];
-   y = tablet->axes[LIBINPUT_TABLET_AXIS_TILT_Y];
-   clear_bit(tablet->changed_axes, LIBINPUT_TABLET_AXIS_TILT_X);
-   clear_bit(tablet->changed_axes, LIBINPUT_TABLET_AXIS_TILT_Y);
+   x = tablet->axes[LIBINPUT_TABLET_TOOL_AXIS_TILT_X];
+   y = tablet->axes[LIBINPUT_TABLET_TOOL_AXIS_TILT_Y];
+   clear_bit(tablet->changed_axes, LIBINPUT_TABLET_TOOL_AXIS_TILT_X);
+   clear_bit(tablet->changed_axes, LIBINPUT_TABLET_TOOL_AXIS_TILT_Y);
 
/* atan2 is CCW, we want CW -> negate x */
if (x || y)
@@ -248,8 +248,8 @@ convert_tilt_to_rotation(struct tablet_dispatch *tablet)
 
angle = fmod(360 + angle - offset, 360);
 
-   tablet->axes[LIBINPUT_TABLET_AXIS_ROTATION_Z] = angle;
-   set_bit(tablet->changed_axes, LIBINPUT_TABLET_AXIS_ROTATION_Z);
+   tablet->axes[LIBINPUT_TABLET_TOOL_AXIS_ROTATION_Z] = angle;
+   set_bit(tablet->changed_axes, LIBINPUT_TABLET_TOOL_AXIS_ROTATION_Z);
 }
 
 static double
@@ -295,16 +295,16 @@ get_delta(enum libinput_tablet_tool_axis axis, double 
current, double old)
double delta = 0;
 
switch (axis) {
-   case LIBINPUT_TABLET_AXIS_X:
-   case LIBINPUT_TABLET_AXIS_Y:
-   case LIBINPUT_TABLET_AXIS_DISTANCE:
-   case LIBINPUT_TABLET_AXIS_PRESSURE:
-   case LIBINPUT_TABLET_AXIS_SLIDER:
-   case LIBINPUT_TABLET_AXIS_TILT_X:
-   case LIBINPUT_TABLET_AXIS_TILT_Y:
+   case LIBINPUT_TABLET_TOOL_AXIS_X:
+   case LIBINPUT_TABLET_TOOL_AXIS_Y:
+   case LIBINPUT_TABLET_TOOL_AXIS_DISTANCE:
+   case LIBINPUT_TABLET_TOOL_AXIS_PRESSURE:
+   case LIBINPUT_TABLET_TOOL_AXIS_SLIDER:
+   case LIBINPUT_TABLET_TOOL_AXIS_TILT_X:
+   case LIBINPUT_TABLET_TOOL_AXIS_TILT_Y:
delta = current - old;
break;
-   case LIBINPUT_TABLET_AXIS_ROTATION_Z:
+   case LIBINPUT_TABLET_TOOL_AXIS_ROTATION_Z:
delta = guess_wheel_delta(current, old);
break;
default:
@@ -322,12 +322,12 @@ tablet_check_notify_axes(struct tablet_dispatch *tablet,
struct libinput_device *base = &device->base;
bool axis_update_needed = false;
int a;
-   double axes[LIBINPUT_

[PATCH libinput 05/14] tablet: rename TOOL_TYPE to TABLET_TOOL_TYPE

2015-11-17 Thread Peter Hutterer
Signed-off-by: Peter Hutterer 
---
 src/evdev-tablet.c  | 54 ++---
 src/evdev-tablet.h  | 18 +-
 src/libinput.h  | 26 +-
 test/tablet.c   |  8 
 tools/event-debug.c | 16 
 5 files changed, 61 insertions(+), 61 deletions(-)

diff --git a/src/evdev-tablet.c b/src/evdev-tablet.c
index 1afc044..3dfc005 100644
--- a/src/evdev-tablet.c
+++ b/src/evdev-tablet.c
@@ -341,8 +341,8 @@ tablet_check_notify_axes(struct tablet_dispatch *tablet,
/* ROTATION_Z is higher than TILT_X/Y so we know that the
   tilt axes are already normalized and set */
if (a == LIBINPUT_TABLET_TOOL_AXIS_ROTATION_Z &&
-  (tablet->current_tool_type == LIBINPUT_TOOL_TYPE_MOUSE ||
-   tablet->current_tool_type == LIBINPUT_TOOL_TYPE_LENS)) {
+  (tablet->current_tool_type == 
LIBINPUT_TABLET_TOOL_TYPE_MOUSE ||
+   tablet->current_tool_type == 
LIBINPUT_TABLET_TOOL_TYPE_LENS)) {
convert_tilt_to_rotation(tablet);
axes[LIBINPUT_TABLET_TOOL_AXIS_TILT_X] = 0;
axes[LIBINPUT_TABLET_TOOL_AXIS_TILT_Y] = 0;
@@ -466,14 +466,14 @@ tablet_evcode_to_tool(int code)
enum libinput_tablet_tool_type type;
 
switch (code) {
-   case BTN_TOOL_PEN:  type = LIBINPUT_TOOL_TYPE_PEN;  break;
-   case BTN_TOOL_RUBBER:   type = LIBINPUT_TOOL_TYPE_ERASER;   break;
-   case BTN_TOOL_BRUSH:type = LIBINPUT_TOOL_TYPE_BRUSH;break;
-   case BTN_TOOL_PENCIL:   type = LIBINPUT_TOOL_TYPE_PENCIL;   break;
-   case BTN_TOOL_AIRBRUSH: type = LIBINPUT_TOOL_TYPE_AIRBRUSH; break;
-   case BTN_TOOL_FINGER:   type = LIBINPUT_TOOL_TYPE_FINGER;   break;
-   case BTN_TOOL_MOUSE:type = LIBINPUT_TOOL_TYPE_MOUSE;break;
-   case BTN_TOOL_LENS: type = LIBINPUT_TOOL_TYPE_LENS; break;
+   case BTN_TOOL_PEN:  type = LIBINPUT_TABLET_TOOL_TYPE_PEN;   
break;
+   case BTN_TOOL_RUBBER:   type = LIBINPUT_TABLET_TOOL_TYPE_ERASER;
break;
+   case BTN_TOOL_BRUSH:type = LIBINPUT_TABLET_TOOL_TYPE_BRUSH; break;
+   case BTN_TOOL_PENCIL:   type = LIBINPUT_TABLET_TOOL_TYPE_PENCIL;
break;
+   case BTN_TOOL_AIRBRUSH: type = LIBINPUT_TABLET_TOOL_TYPE_AIRBRUSH;  
break;
+   case BTN_TOOL_FINGER:   type = LIBINPUT_TABLET_TOOL_TYPE_FINGER;
break;
+   case BTN_TOOL_MOUSE:type = LIBINPUT_TABLET_TOOL_TYPE_MOUSE; break;
+   case BTN_TOOL_LENS: type = LIBINPUT_TABLET_TOOL_TYPE_LENS;  
break;
default:
abort();
}
@@ -681,11 +681,11 @@ tool_set_bits(const struct tablet_dispatch *tablet,
   anyway.
 */
switch (type) {
-   case LIBINPUT_TOOL_TYPE_PEN:
-   case LIBINPUT_TOOL_TYPE_ERASER:
-   case LIBINPUT_TOOL_TYPE_PENCIL:
-   case LIBINPUT_TOOL_TYPE_BRUSH:
-   case LIBINPUT_TOOL_TYPE_AIRBRUSH:
+   case LIBINPUT_TABLET_TOOL_TYPE_PEN:
+   case LIBINPUT_TABLET_TOOL_TYPE_ERASER:
+   case LIBINPUT_TABLET_TOOL_TYPE_PENCIL:
+   case LIBINPUT_TABLET_TOOL_TYPE_BRUSH:
+   case LIBINPUT_TABLET_TOOL_TYPE_AIRBRUSH:
copy_axis_cap(tablet, tool, LIBINPUT_TABLET_TOOL_AXIS_PRESSURE);
copy_axis_cap(tablet, tool, LIBINPUT_TABLET_TOOL_AXIS_DISTANCE);
copy_axis_cap(tablet, tool, LIBINPUT_TABLET_TOOL_AXIS_TILT_X);
@@ -693,8 +693,8 @@ tool_set_bits(const struct tablet_dispatch *tablet,
copy_axis_cap(tablet, tool, LIBINPUT_TABLET_TOOL_AXIS_SLIDER);
copy_axis_cap(tablet, tool, 
LIBINPUT_TABLET_TOOL_AXIS_ROTATION_Z);
break;
-   case LIBINPUT_TOOL_TYPE_MOUSE:
-   case LIBINPUT_TOOL_TYPE_LENS:
+   case LIBINPUT_TABLET_TOOL_TYPE_MOUSE:
+   case LIBINPUT_TABLET_TOOL_TYPE_LENS:
copy_axis_cap(tablet, tool, 
LIBINPUT_TABLET_TOOL_AXIS_ROTATION_Z);
copy_axis_cap(tablet, tool, 
LIBINPUT_TABLET_TOOL_AXIS_REL_WHEEL);
break;
@@ -705,16 +705,16 @@ tool_set_bits(const struct tablet_dispatch *tablet,
/* If we don't have libwacom, copy all pen-related ones from the
   tablet vs all mouse-related ones */
switch (type) {
-   case LIBINPUT_TOOL_TYPE_PEN:
-   case LIBINPUT_TOOL_TYPE_BRUSH:
-   case LIBINPUT_TOOL_TYPE_AIRBRUSH:
-   case LIBINPUT_TOOL_TYPE_PENCIL:
-   case LIBINPUT_TOOL_TYPE_ERASER:
+   case LIBINPUT_TABLET_TOOL_TYPE_PEN:
+   case LIBINPUT_TABLET_TOOL_TYPE_BRUSH:
+   case LIBINPUT_TABLET_TOOL_TYPE_AIRBRUSH:
+   case LIBINPUT_TABLET_TOOL_TYPE_PENCIL:
+   case LIBINPUT_TABLET_TOOL_TYPE_ERASER:
copy_button_cap(tablet, tool, BTN_STYLUS);
copy_button_cap(tablet, tool, BTN_STYLUS2);
break;
-   case LIBINPUT_

[PATCH libinput 08/14] tablet: rename tool_tip_state to tablet_tool_tip_state

2015-11-17 Thread Peter Hutterer
Signed-off-by: Peter Hutterer 
---
 src/evdev-tablet.c |  4 ++--
 src/libinput-private.h |  6 +++---
 src/libinput.c | 10 +-
 src/libinput.h |  4 ++--
 tools/event-debug.c|  2 +-
 5 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/evdev-tablet.c b/src/evdev-tablet.c
index 040582b..871e10e 100644
--- a/src/evdev-tablet.c
+++ b/src/evdev-tablet.c
@@ -407,7 +407,7 @@ tablet_check_notify_axes(struct tablet_dispatch *tablet,
tablet->changed_axes,
axes);
else {
-   enum libinput_tool_tip_state tip_state;
+   enum libinput_tablet_tool_tip_state tip_state;
 
tip_state = tablet_has_status(tablet, 
TABLET_TOOL_IN_CONTACT) ?
LIBINPUT_TOOL_TIP_DOWN : LIBINPUT_TOOL_TIP_UP;
@@ -792,7 +792,7 @@ tablet_notify_button_mask(struct tablet_dispatch *tablet,
struct libinput_device *base = &device->base;
size_t i;
size_t nbits = 8 * sizeof(buttons[0]) * buttons_len;
-   enum libinput_tool_tip_state tip_state;
+   enum libinput_tablet_tool_tip_state tip_state;
 
tip_state = tablet_has_status(tablet, TABLET_TOOL_IN_CONTACT) ?
LIBINPUT_TOOL_TIP_DOWN : LIBINPUT_TOOL_TIP_UP;
diff --git a/src/libinput-private.h b/src/libinput-private.h
index a1f66b1..38a14b8 100644
--- a/src/libinput-private.h
+++ b/src/libinput-private.h
@@ -463,7 +463,7 @@ void
 tablet_notify_axis(struct libinput_device *device,
   uint64_t time,
   struct libinput_tablet_tool *tool,
-  enum libinput_tool_tip_state tip_state,
+  enum libinput_tablet_tool_tip_state tip_state,
   unsigned char *changed_axes,
   double *axes,
   double *deltas,
@@ -481,14 +481,14 @@ void
 tablet_notify_tip(struct libinput_device *device,
  uint64_t time,
  struct libinput_tablet_tool *tool,
- enum libinput_tool_tip_state tip_state,
+ enum libinput_tablet_tool_tip_state tip_state,
  double *axes);
 
 void
 tablet_notify_button(struct libinput_device *device,
 uint64_t time,
 struct libinput_tablet_tool *tool,
-enum libinput_tool_tip_state tip_state,
+enum libinput_tablet_tool_tip_state tip_state,
 double *axes,
 int32_t button,
 enum libinput_button_state state);
diff --git a/src/libinput.c b/src/libinput.c
index bd33b25..5308d8d 100644
--- a/src/libinput.c
+++ b/src/libinput.c
@@ -137,7 +137,7 @@ struct libinput_event_tablet {
unsigned char changed_axes[NCHARS(LIBINPUT_TABLET_TOOL_AXIS_MAX + 1)];
struct libinput_tablet_tool *tool;
enum libinput_tablet_tool_proximity_state proximity_state;
-   enum libinput_tool_tip_state tip_state;
+   enum libinput_tablet_tool_tip_state tip_state;
 };
 
 static void
@@ -1089,7 +1089,7 @@ libinput_event_tablet_get_proximity_state(struct 
libinput_event_tablet *event)
return event->proximity_state;
 }
 
-LIBINPUT_EXPORT enum libinput_tool_tip_state
+LIBINPUT_EXPORT enum libinput_tablet_tool_tip_state
 libinput_event_tablet_get_tip_state(struct libinput_event_tablet *event)
 {
require_event_type(libinput_event_get_context(&event->base),
@@ -1973,7 +1973,7 @@ void
 tablet_notify_axis(struct libinput_device *device,
   uint64_t time,
   struct libinput_tablet_tool *tool,
-  enum libinput_tool_tip_state tip_state,
+  enum libinput_tablet_tool_tip_state tip_state,
   unsigned char *changed_axes,
   double *axes,
   double *deltas,
@@ -2045,7 +2045,7 @@ void
 tablet_notify_tip(struct libinput_device *device,
  uint64_t time,
  struct libinput_tablet_tool *tool,
- enum libinput_tool_tip_state tip_state,
+ enum libinput_tablet_tool_tip_state tip_state,
  double *axes)
 {
struct libinput_event_tablet *tip_event;
@@ -2074,7 +2074,7 @@ void
 tablet_notify_button(struct libinput_device *device,
 uint64_t time,
 struct libinput_tablet_tool *tool,
-enum libinput_tool_tip_state tip_state,
+enum libinput_tablet_tool_tip_state tip_state,
 double *axes,
 int32_t button,
 enum libinput_button_state state)
diff --git a/src/libinput.h b/src/libinput.h
index 2a563f8..a13700f 100644
--- a/src/libinput.h
+++ b/src/libinput.h
@@ -225,7 +225,7 @@ enum libinput_tablet_tool_proximity_state {
  * The tip contact state of a tool is a binary state signalling whe

[PATCH libinput 01/14] tablet: rename libinput_tool to libinput_tablet_tool

2015-11-17 Thread Peter Hutterer
Signed-off-by: Peter Hutterer 
---
 src/evdev-tablet.c | 24 
 src/libinput-private.h | 10 +-
 src/libinput.c | 36 ++--
 src/libinput.h | 26 +-
 test/tablet.c  | 28 ++--
 tools/event-debug.c|  4 ++--
 6 files changed, 64 insertions(+), 64 deletions(-)

diff --git a/src/evdev-tablet.c b/src/evdev-tablet.c
index ed64d55..7537e21 100644
--- a/src/evdev-tablet.c
+++ b/src/evdev-tablet.c
@@ -317,7 +317,7 @@ static void
 tablet_check_notify_axes(struct tablet_dispatch *tablet,
 struct evdev_device *device,
 uint64_t time,
-struct libinput_tool *tool)
+struct libinput_tablet_tool *tool)
 {
struct libinput_device *base = &device->base;
bool axis_update_needed = false;
@@ -576,7 +576,7 @@ tablet_process_misc(struct tablet_dispatch *tablet,
 
 static inline void
 copy_axis_cap(const struct tablet_dispatch *tablet,
- struct libinput_tool *tool,
+ struct libinput_tablet_tool *tool,
  enum libinput_tablet_axis axis)
 {
if (bit_is_set(tablet->axis_caps, axis))
@@ -585,7 +585,7 @@ copy_axis_cap(const struct tablet_dispatch *tablet,
 
 static inline void
 copy_button_cap(const struct tablet_dispatch *tablet,
-   struct libinput_tool *tool,
+   struct libinput_tablet_tool *tool,
uint32_t button)
 {
struct libevdev *evdev = tablet->device->evdev;
@@ -595,7 +595,7 @@ copy_button_cap(const struct tablet_dispatch *tablet,
 
 static inline int
 tool_set_bits_from_libwacom(const struct tablet_dispatch *tablet,
-   struct libinput_tool *tool)
+   struct libinput_tablet_tool *tool)
 {
int rc = 1;
 
@@ -668,7 +668,7 @@ out:
 
 static void
 tool_set_bits(const struct tablet_dispatch *tablet,
- struct libinput_tool *tool)
+ struct libinput_tablet_tool *tool)
 {
enum libinput_tool_type type = tool->type;
 
@@ -726,13 +726,13 @@ tool_set_bits(const struct tablet_dispatch *tablet,
}
 }
 
-static struct libinput_tool *
+static struct libinput_tablet_tool *
 tablet_get_tool(struct tablet_dispatch *tablet,
enum libinput_tool_type type,
uint32_t tool_id,
uint32_t serial)
 {
-   struct libinput_tool *tool = NULL, *t;
+   struct libinput_tablet_tool *tool = NULL, *t;
struct list *tool_list;
 
if (serial) {
@@ -765,7 +765,7 @@ tablet_get_tool(struct tablet_dispatch *tablet,
 * add it */
if (!tool) {
tool = zalloc(sizeof *tool);
-   *tool = (struct libinput_tool) {
+   *tool = (struct libinput_tablet_tool) {
.type = type,
.serial = serial,
.tool_id = tool_id,
@@ -784,7 +784,7 @@ static void
 tablet_notify_button_mask(struct tablet_dispatch *tablet,
  struct evdev_device *device,
  uint64_t time,
- struct libinput_tool *tool,
+ struct libinput_tablet_tool *tool,
  const unsigned char *buttons,
  unsigned int buttons_len,
  enum libinput_button_state state)
@@ -815,7 +815,7 @@ static void
 tablet_notify_buttons(struct tablet_dispatch *tablet,
  struct evdev_device *device,
  uint64_t time,
- struct libinput_tool *tool,
+ struct libinput_tablet_tool *tool,
  enum libinput_button_state state)
 {
unsigned char 
buttons[ARRAY_LENGTH(tablet->button_state.stylus_buttons)];
@@ -876,7 +876,7 @@ tablet_flush(struct tablet_dispatch *tablet,
 struct evdev_device *device,
 uint64_t time)
 {
-   struct libinput_tool *tool =
+   struct libinput_tablet_tool *tool =
tablet_get_tool(tablet,
tablet->current_tool_type,
tablet->current_tool_id,
@@ -1005,7 +1005,7 @@ tablet_destroy(struct evdev_dispatch *dispatch)
 {
struct tablet_dispatch *tablet =
(struct tablet_dispatch*)dispatch;
-   struct libinput_tool *tool, *tmp;
+   struct libinput_tablet_tool *tool, *tmp;
 
list_for_each_safe(tool, tmp, &tablet->tool_list, link) {
libinput_tool_unref(tool);
diff --git a/src/libinput-private.h b/src/libinput-private.h
index 702bf6e..b28e0e1 100644
--- a/src/libinput-private.h
+++ b/src/libinput-private.h
@@ -250,7 +250,7 @@ struct libinput_device {
struct libinput_device_config config;
 };
 
-struct libinput_tool {
+struct libinput_tablet_tool {
struct list link;
uint32_t serial;
 

[PATCH libinput 02/14] tablet: rename libinput_tablet_axis to libinput_tablet_tool_axis

2015-11-17 Thread Peter Hutterer
Signed-off-by: Peter Hutterer 
---
 src/evdev-tablet.c  | 14 +++---
 src/evdev-tablet.h  | 10 +-
 src/libinput.c  | 10 +-
 src/libinput.h  | 12 ++--
 tools/event-debug.c |  2 +-
 5 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/src/evdev-tablet.c b/src/evdev-tablet.c
index 7537e21..d1ffe09 100644
--- a/src/evdev-tablet.c
+++ b/src/evdev-tablet.c
@@ -69,7 +69,7 @@ tablet_get_released_buttons(struct tablet_dispatch *tablet,
 
 static int
 tablet_device_has_axis(struct tablet_dispatch *tablet,
-  enum libinput_tablet_axis axis)
+  enum libinput_tablet_tool_axis axis)
 {
struct libevdev *evdev = tablet->device->evdev;
bool has_axis = false;
@@ -109,7 +109,7 @@ tablet_process_absolute(struct tablet_dispatch *tablet,
struct input_event *e,
uint64_t time)
 {
-   enum libinput_tablet_axis axis;
+   enum libinput_tablet_tool_axis axis;
 
switch (e->code) {
case ABS_X:
@@ -158,7 +158,7 @@ static void
 tablet_mark_all_axes_changed(struct tablet_dispatch *tablet,
 struct evdev_device *device)
 {
-   enum libinput_tablet_axis a;
+   enum libinput_tablet_tool_axis a;
 
for (a = LIBINPUT_TABLET_AXIS_X; a <= LIBINPUT_TABLET_AXIS_MAX; a++) {
if (tablet_device_has_axis(tablet, a))
@@ -290,7 +290,7 @@ guess_wheel_delta(double current, double old)
 }
 
 static inline double
-get_delta(enum libinput_tablet_axis axis, double current, double old)
+get_delta(enum libinput_tablet_tool_axis axis, double current, double old)
 {
double delta = 0;
 
@@ -529,7 +529,7 @@ tablet_process_relative(struct tablet_dispatch *tablet,
struct input_event *e,
uint64_t time)
 {
-   enum libinput_tablet_axis axis;
+   enum libinput_tablet_tool_axis axis;
 
switch (e->code) {
case REL_WHEEL:
@@ -577,7 +577,7 @@ tablet_process_misc(struct tablet_dispatch *tablet,
 static inline void
 copy_axis_cap(const struct tablet_dispatch *tablet,
  struct libinput_tablet_tool *tool,
- enum libinput_tablet_axis axis)
+ enum libinput_tablet_tool_axis axis)
 {
if (bit_is_set(tablet->axis_caps, axis))
set_bit(tool->axis_caps, axis);
@@ -1071,7 +1071,7 @@ static int
 tablet_init(struct tablet_dispatch *tablet,
struct evdev_device *device)
 {
-   enum libinput_tablet_axis axis;
+   enum libinput_tablet_tool_axis axis;
 
tablet->base.interface = &tablet_interface;
tablet->device = device;
diff --git a/src/evdev-tablet.h b/src/evdev-tablet.h
index 9901b2a..36a3cec 100644
--- a/src/evdev-tablet.h
+++ b/src/evdev-tablet.h
@@ -67,10 +67,10 @@ struct tablet_dispatch {
uint32_t current_tool_serial;
 };
 
-static inline enum libinput_tablet_axis
+static inline enum libinput_tablet_tool_axis
 evcode_to_axis(const uint32_t evcode)
 {
-   enum libinput_tablet_axis axis;
+   enum libinput_tablet_tool_axis axis;
 
switch (evcode) {
case ABS_X:
@@ -105,10 +105,10 @@ evcode_to_axis(const uint32_t evcode)
return axis;
 }
 
-static inline enum libinput_tablet_axis
+static inline enum libinput_tablet_tool_axis
 rel_evcode_to_axis(const uint32_t evcode)
 {
-   enum libinput_tablet_axis axis;
+   enum libinput_tablet_tool_axis axis;
 
switch (evcode) {
case REL_WHEEL:
@@ -123,7 +123,7 @@ rel_evcode_to_axis(const uint32_t evcode)
 }
 
 static inline uint32_t
-axis_to_evcode(const enum libinput_tablet_axis axis)
+axis_to_evcode(const enum libinput_tablet_tool_axis axis)
 {
uint32_t evcode;
 
diff --git a/src/libinput.c b/src/libinput.c
index b50f533..4d012d3 100644
--- a/src/libinput.c
+++ b/src/libinput.c
@@ -914,7 +914,7 @@ libinput_event_gesture_get_angle_delta(struct 
libinput_event_gesture *event)
 
 LIBINPUT_EXPORT int
 libinput_event_tablet_axis_has_changed(struct libinput_event_tablet *event,
-  enum libinput_tablet_axis axis)
+  enum libinput_tablet_tool_axis axis)
 {
require_event_type(libinput_event_get_context(&event->base),
   event->base.type,
@@ -929,7 +929,7 @@ libinput_event_tablet_axis_has_changed(struct 
libinput_event_tablet *event,
 
 LIBINPUT_EXPORT double
 libinput_event_tablet_get_axis_value(struct libinput_event_tablet *event,
-enum libinput_tablet_axis axis)
+enum libinput_tablet_tool_axis axis)
 {
struct evdev_device *device =
(struct evdev_device *) event->base.device;
@@ -963,7 +963,7 @@ libinput_event_tablet_get_axis_value(struct 
libinput_event_tablet *event,
 
 LIBINPUT_EXPORT double
 libinput_event_tablet_get_axis_delta(struct libinput_event_tablet *event,
-  

Re: Changing wl_output.transform type to unsigned?

2015-11-17 Thread Jonas Ådahl
On Mon, Nov 16, 2015 at 12:46:21PM +0200, Pekka Paalanen wrote:
> On Sun, 15 Nov 2015 22:17:38 +0100
> "Nils Chr. Brause"  wrote:
> 
> > On Sun, Nov 15, 2015 at 9:48 PM, Auke Booij  wrote:
> > > On 9 November 2015 at 18:17, Bill Spitzak  wrote:
> > >> I really do not see the problem with allowing it to be an int argument as
> > >> long as the enum value 2^31 is not used. Though I am also stumped as to 
> > >> why
> > >> you can't change the current misused ints into uint in the protocol. It 
> > >> will
> > >> not change the bit layout in the messages and therefore is not a protocol
> > >> change.
> > >
> > > I don't really know what to do with this final claim. I like the idea,
> > > and it makes sense. Finally, it will solve this issue and potentially
> > > future ones as well. Is there any chance it could be implemented or is
> > > it a crazy idea?
> > 
> > Bill is absolutely right. And it also doesn't even really change the C API,
> > because nobody is passing negetive numbers or number greater than 2^31-1
> > there anyway. Therefore, I am all for a change. :)
> 
> Hi,
> 
> your logic seems sound at first.
> 
> The things we would need to change in the protocol are:
> - wl_surface.set_buffer_transform
> - wl_output.geometry
> - (possible third party extensions)
> 
> It would break existing bindings for strongly typed languages that do
> not allow implicit conversion between signed and unsigned. (Does Java
> fall into that category?)
> 
> You don't see any change on the wire, but changing the type changes the
> C API, which then changes types of variables used in C programs. I
> can't imagine this having an impact in this particular case, though.
> 
> Weston seems to use mostly 'enum wl_buffer_transform' as the type, but
> struct weston_buffer_viewport already uses uint32_t.
> 
> Ok, I suppose we could try this.
> 
> The next step would be for someone to propose a patch to change the
> ints to uints in wayland.xml. Special attention should be given to the
> commit message: why change this, what benefits it gives, and even
> though it is breaking the protocol, why it cannot break anything in
> practice.
> 
> It is important to write a good commit message, because I expect people
> to be looking at it a lot, since it is changing stable interfaces.
> 
> We'll see how that patch is received. If anyone complains it breaks
> their thing, I think we have to revert it, because it is technically
> breaking the stability rules.

The most obvious thing that would "break" is that every client or server
C implementation will suddenly get new compiler warnings and to be able
to build both the version before and after the change without warnings,
they'd need #if #else #fi macros around every such place.

This is primarily an annoyance anyhow since the warning is mostly
harmless.


Jonas

> 
> 
> Thanks,
> pq



> ___
> wayland-devel mailing list
> wayland-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH weston] releasing.txt: Add step about checking wayland-protocols dependency

2015-11-17 Thread Jonas Ådahl
Signed-off-by: Jonas Ådahl 
Cc: Bryce Harrington 
---

Hi Bryce,

Last time you asked about something like this, but it slipped my mind. Is this
enough of a reminder or should it be more descriptive?


Jonas


 releasing.txt | 20 
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/releasing.txt b/releasing.txt
index 52adaa3..fe6aa59 100644
--- a/releasing.txt
+++ b/releasing.txt
@@ -5,7 +5,11 @@ To make a release of Weston and/or Wayland, follow these steps.
 
   $ make check
 
-  1.  Update the first three lines of configure.ac to the intended
+  1.  Verify that the wayland-protocols version dependency is correct,
+  and that wayland-protocols has had a release with any needed
+  protocol updates.
+
+  2.  Update the first three lines of configure.ac to the intended
   version, commit.  Also note that Weston includes versioned
   dependencies on 'wayland-server' and 'wayland-client' in
   configure.ac which occasionally need updated as well.  Then commit
@@ -17,7 +21,7 @@ To make a release of Weston and/or Wayland, follow these 
steps.
   $ git commit configure.ac -m "configure.ac: bump to version 
$RELEASE_NUMBER for the $RELEASE_NAME release"
   $ git push
 
-  2.  For Weston releases, install Xwayland, either from your distro or
+  3.  For Weston releases, install Xwayland, either from your distro or
   manually (see http://wayland.freedesktop.org/building.html).  If
   you install it to a location other than /usr/bin/Xwayland, specify
   this in the following env var:
@@ -33,7 +37,7 @@ To make a release of Weston and/or Wayland, follow these 
steps.
   export LD_LIBRARY_PATH=$WLD/lib
   export PKG_CONFIG_PATH=$WLD/lib/pkgconfig:$WLD/share/pkgconfig/
 
-  3.  Run the release.sh script to generate the tarballs, sign and
+  4.  Run the release.sh script to generate the tarballs, sign and
   upload them, and generate a release announcement template.
   This script can be obtained from X.org's modular package:
 
@@ -53,19 +57,19 @@ To make a release of Weston and/or Wayland, follow these 
steps.
   $ ./publish-doc
 
 
-  4.  Compose the release announcements.  The script will generate
+  5.  Compose the release announcements.  The script will generate
   *.x.y.0.announce files with a list of changes and tags, one for
   wayland, one for weston.  Prepend these with a human-readable
   listing of the most notable changes.  For x.y.0 releases, indicate
   the schedule for the x.y+1.0 release.
 
-  5.  pgp sign the the release announcements and send them to
+  6.  pgp sign the the release announcements and send them to
   wayland-devel@lists.freedesktop.org
 
-  6.  Get your freshly posted release email URL from
+  7.  Get your freshly posted release email URL from
   http://lists.freedesktop.org/archives/wayland-devel/
 
-  7.  Update releases.html in wayland-web with links to tarballs and
+  8.  Update releases.html in wayland-web with links to tarballs and
   the release email URL.
 
   The register_release script in wayland-web will generate an HTML
@@ -79,7 +83,7 @@ To make a release of Weston and/or Wayland, follow these 
steps.
   $ git push
   $ ./deploy
 
-  8.  Update topic in #wayland to point to the release announcement URL
+  9.  Update topic in #wayland to point to the release announcement URL
 
 For x.y.0 releases, also create the release series x.y branch.  The x.y
 branch is for bug fixes and conservative changes to the x.y.0 release,
-- 
2.4.3

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH v2 3/3 wayland] Validate the protocol xml during scanning

2015-11-17 Thread Pekka Paalanen
On Tue, 17 Nov 2015 14:57:14 +0200
Pekka Paalanen  wrote:

> On Tue, 10 Nov 2015 09:53:08 +1000
> Peter Hutterer  wrote:
> 
> > Embed the wayland.dtd protocol data into the scanner binary so we can 
> > validate
> > external protocol files without requiring makefile changes. Hat-tip to Pekka
> > Paalanen for the embedding trick.
> > The embedding trick doesn't work well if the to-be-embedded file is in a
> > different location than the source file, so copy/link it during configure 
> > and
> > then build it in from the local directory.
> > 
> > The current expat parser is not a validating parser, moving scanner.c to
> > another parser has the risk of breaking compatibility. This patch adds 
> > libxml2
> > as extra (optional) dependency, but that also requires parsing the input
> > twice.
> > 
> > If the protocol fails validation a warning is printed but no error is 
> > returned
> > otherwise.
> > 
> > Signed-off-by: Peter Hutterer 
> > ---
> > Changes to v1:
> > - move the dtddata.S to SOURCES and add AM_PROG_AS to configure. This fixes
> >   distcheck
> > - handle explicit input files, rather than just stdin
> > - changed the warning to refer to a built-in dtd 
> > 
> >  Makefile.am   | 11 ++---
> >  configure.ac  | 13 +++
> >  src/dtddata.S | 40 +
> >  src/scanner.c | 71 
> > +++
> >  4 files changed, 132 insertions(+), 3 deletions(-)
> >  create mode 100644 src/dtddata.S
> 
> Hi Peter,
> 
> this patch R-b me, and so the whole 4-patch series pushed:
>c7bada0..f66e2d5  master -> master
> 
> This causes some noise in Weston as there are some protocols with
> unexpected order of XML elements, but those are trivial to fix.
> xdg-shell.xml uses some doc text that is not according to the DTD and
> I'm not sure the scanner picks it up either, that will need a bit more.
> It's about per-entry docs in enums.

Oh, I just noticed http://patchwork.freedesktop.org/patch/64189/
Nice. :-)

Thanks,
pq

> I think I'll just push the desktop-shell.xml fix soon to Weston. Hmm,
> or maybe after Jason's wayland-protocol migration series, as it renames
> desktop-shell.xml.



signature.asc
Description: PGP signature
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH v2 3/3 wayland] Validate the protocol xml during scanning

2015-11-17 Thread Pekka Paalanen
On Tue, 10 Nov 2015 09:53:08 +1000
Peter Hutterer  wrote:

> Embed the wayland.dtd protocol data into the scanner binary so we can validate
> external protocol files without requiring makefile changes. Hat-tip to Pekka
> Paalanen for the embedding trick.
> The embedding trick doesn't work well if the to-be-embedded file is in a
> different location than the source file, so copy/link it during configure and
> then build it in from the local directory.
> 
> The current expat parser is not a validating parser, moving scanner.c to
> another parser has the risk of breaking compatibility. This patch adds libxml2
> as extra (optional) dependency, but that also requires parsing the input
> twice.
> 
> If the protocol fails validation a warning is printed but no error is returned
> otherwise.
> 
> Signed-off-by: Peter Hutterer 
> ---
> Changes to v1:
> - move the dtddata.S to SOURCES and add AM_PROG_AS to configure. This fixes
>   distcheck
> - handle explicit input files, rather than just stdin
> - changed the warning to refer to a built-in dtd 
> 
>  Makefile.am   | 11 ++---
>  configure.ac  | 13 +++
>  src/dtddata.S | 40 +
>  src/scanner.c | 71 
> +++
>  4 files changed, 132 insertions(+), 3 deletions(-)
>  create mode 100644 src/dtddata.S

Hi Peter,

this patch R-b me, and so the whole 4-patch series pushed:
   c7bada0..f66e2d5  master -> master

This causes some noise in Weston as there are some protocols with
unexpected order of XML elements, but those are trivial to fix.
xdg-shell.xml uses some doc text that is not according to the DTD and
I'm not sure the scanner picks it up either, that will need a bit more.
It's about per-entry docs in enums.

I think I'll just push the desktop-shell.xml fix soon to Weston. Hmm,
or maybe after Jason's wayland-protocol migration series, as it renames
desktop-shell.xml.


Thanks,
pq


signature.asc
Description: PGP signature
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH weston v4 14/20] clients/resizor: Use pointer locking for resizing window

2015-11-17 Thread Jonas Ådahl
Resizes the window using pointer locking when holding the left pointer
button down. The pointer lock cursor position hint is used to warp the
pointer to the same position relative to the bottom right corner.

Signed-off-by: Jonas Ådahl 
---
 clients/resizor.c | 159 --
 1 file changed, 154 insertions(+), 5 deletions(-)

diff --git a/clients/resizor.c b/clients/resizor.c
index d205eb6..95e16ea 100644
--- a/clients/resizor.c
+++ b/clients/resizor.c
@@ -23,6 +23,7 @@
 
 #include "config.h"
 
+#include 
 #include 
 #include 
 #include 
@@ -50,6 +51,10 @@ struct resizor {
struct spring width;
struct spring height;
struct wl_callback *frame_callback;
+   bool pointer_locked;
+   struct input *locked_input;
+   float pointer_x;
+   float pointer_y;
 };
 
 static void
@@ -220,20 +225,158 @@ show_menu(struct resizor *resizor, struct input *input, 
uint32_t time)
 }
 
 static void
+locked_pointer_handle_motion(struct window *window,
+struct input *input,
+uint32_t time,
+float dx,
+float dy,
+void *data)
+{
+   struct resizor *resizor = data;
+
+   resizor->width.current += dx;
+   resizor->width.previous = resizor->width.current;
+   resizor->width.target = resizor->width.current;
+
+   resizor->height.current += dy;
+   resizor->height.previous = resizor->height.current;
+   resizor->height.target = resizor->height.current;
+
+   widget_schedule_resize(resizor->widget,
+  resizor->width.current,
+  resizor->height.current);
+}
+
+static void
+handle_pointer_locked(struct window *window, struct input *input, void *data)
+{
+   struct resizor *resizor = data;
+
+   resizor->pointer_locked = true;
+   input_set_pointer_image(input, CURSOR_BLANK);
+}
+
+static void
+handle_pointer_unlocked(struct window *window, struct input *input, void *data)
+{
+   struct resizor *resizor = data;
+
+   resizor->pointer_locked = false;
+   input_set_pointer_image(input, CURSOR_LEFT_PTR);
+}
+
+static const struct wl_callback_listener locked_pointer_frame_listener;
+
+static void
+locked_pointer_frame_callback(void *data,
+ struct wl_callback *callback,
+ uint32_t time)
+{
+   struct resizor *resizor = data;
+   struct wl_surface *surface;
+   struct rectangle allocation;
+   float x, y;
+
+   if (resizor->pointer_locked) {
+   widget_get_allocation(resizor->widget, &allocation);
+
+   x = resizor->pointer_x + (allocation.width - allocation.x);
+   y = resizor->pointer_y + (allocation.height - allocation.y);
+
+   widget_set_locked_pointer_cursor_hint(resizor->widget, x, y);
+   }
+
+   wl_callback_destroy(callback);
+
+   surface = window_get_wl_surface(resizor->window);
+   callback = wl_surface_frame(surface);
+   wl_callback_add_listener(callback,
+&locked_pointer_frame_listener,
+resizor);
+}
+
+static const struct wl_callback_listener locked_pointer_frame_listener = {
+   locked_pointer_frame_callback
+};
+
+static void
 button_handler(struct widget *widget,
   struct input *input, uint32_t time,
   uint32_t button, enum wl_pointer_button_state state, void *data)
 {
struct resizor *resizor = data;
+   struct rectangle allocation;
+   struct wl_surface *surface;
+   struct wl_callback *callback;
 
-   switch (button) {
-   case BTN_RIGHT:
-   if (state == WL_POINTER_BUTTON_STATE_PRESSED)
-   show_menu(resizor, input, time);
-   break;
+   if (button == BTN_RIGHT && state == WL_POINTER_BUTTON_STATE_PRESSED) {
+   show_menu(resizor, input, time);
+   } else if (button == BTN_LEFT &&
+  state == WL_POINTER_BUTTON_STATE_PRESSED) {
+   window_get_allocation(resizor->window, &allocation);
+
+   resizor->width.current = allocation.width;
+   resizor->width.previous = allocation.width;
+   resizor->width.target = allocation.width;
+
+   resizor->height.current = allocation.height;
+   resizor->height.previous = allocation.height;
+   resizor->height.target = allocation.height;
+
+   window_lock_pointer(resizor->window, input);
+   window_set_pointer_locked_handler(resizor->window,
+ handle_pointer_locked);
+   window_set_pointer_unlocked_handler(resizor->window,
+   handle_pointer_unlocked);
+   resizor->locked_input = input;
+
+  

[PATCH weston v4 20/20] clients/clickdot: Toggle maximized state with 'm'

2015-11-17 Thread Jonas Ådahl
In order to test wapring when pointer confinemen region changes, add
key binding to the maximized state without using the mouse.

Signed-off-by: Jonas Ådahl 
Reviewed-by: Bryce Harrington 
---
 clients/clickdot.c | 14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/clients/clickdot.c b/clients/clickdot.c
index 5054a68..519cc63 100644
--- a/clients/clickdot.c
+++ b/clients/clickdot.c
@@ -311,6 +311,9 @@ key_handler(struct window *window, struct input *input, 
uint32_t time,
clickdot->buffer = NULL;
window_schedule_redraw(clickdot->window);
break;
+   case XKB_KEY_m:
+   window_set_maximized(clickdot->window,
+!window_is_maximized(window));
}
 }
 
@@ -390,8 +393,17 @@ resize_handler(struct widget *widget,
 
clickdot->reset = 1;
 
-   if (clickdot->complex_confine_region_enabled)
+   if (clickdot->complex_confine_region_enabled) {
clickdot->complex_confine_region_dirty = true;
+
+   if (clickdot->pointer_confined) {
+   calculate_complex_confine_region(clickdot);
+   window_update_confine_rectangles(
+   clickdot->window,
+   clickdot->complex_confine_region,
+   NUM_COMPLEX_REGION_RECTS);
+   }
+   }
 }
 
 static void
-- 
2.4.3

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH weston v4 15/20] clients/clickdot: Use pointer confinement to confine drawed line

2015-11-17 Thread Jonas Ådahl
Use pointer confinement to make the line drawing not go outside the
drawing area. It is toggled with the right pointer button.

Signed-off-by: Jonas Ådahl 
---
 clients/clickdot.c | 33 +++--
 1 file changed, 31 insertions(+), 2 deletions(-)

diff --git a/clients/clickdot.c b/clients/clickdot.c
index 776f8da..1597e11 100644
--- a/clients/clickdot.c
+++ b/clients/clickdot.c
@@ -25,6 +25,7 @@
 
 #include "config.h"
 
+#include 
 #include 
 #include 
 #include 
@@ -63,6 +64,8 @@ struct clickdot {
struct input *cursor_timeout_input;
int cursor_timeout_fd;
struct task cursor_timeout_task;
+
+   bool pointer_confined;
 };
 
 static void
@@ -207,16 +210,32 @@ key_handler(struct window *window, struct input *input, 
uint32_t time,
 }
 
 static void
+toggle_pointer_confine(struct clickdot *clickdot, struct input *input)
+{
+   if (clickdot->pointer_confined) {
+   window_unconfine_pointer(clickdot->window);
+   } else {
+   window_confine_pointer_to_widget(clickdot->window,
+clickdot->widget,
+input);
+   }
+
+   clickdot->pointer_confined = !clickdot->pointer_confined;
+}
+
+static void
 button_handler(struct widget *widget,
   struct input *input, uint32_t time,
   uint32_t button,
   enum wl_pointer_button_state state, void *data)
 {
struct clickdot *clickdot = data;
+   bool is_pressed = state == WL_POINTER_BUTTON_STATE_PRESSED;
 
-   if (state == WL_POINTER_BUTTON_STATE_PRESSED && button == BTN_LEFT)
+   if (is_pressed && button == BTN_LEFT)
input_get_position(input, &clickdot->dot.x, &clickdot->dot.y);
-
+   else if (is_pressed && button == BTN_RIGHT)
+   toggle_pointer_confine(clickdot, input);
widget_schedule_redraw(widget);
 }
 
@@ -284,6 +303,14 @@ cursor_timeout_func(struct task *task, uint32_t events)
CURSOR_LEFT_PTR);
 }
 
+static void
+pointer_unconfined(struct window *window, struct input *input, void *data)
+{
+   struct clickdot *clickdot = data;
+
+   clickdot->pointer_confined = false;
+}
+
 static struct clickdot *
 clickdot_create(struct display *display)
 {
@@ -300,6 +327,8 @@ clickdot_create(struct display *display)
window_set_user_data(clickdot->window, clickdot);
window_set_keyboard_focus_handler(clickdot->window,
  keyboard_focus_handler);
+   window_set_pointer_unconfined_handler(clickdot->window,
+ pointer_unconfined);
 
widget_set_redraw_handler(clickdot->widget, redraw_handler);
widget_set_button_handler(clickdot->widget, button_handler);
-- 
2.4.3

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH weston v4 17/20] clients/clickdot: Reset motion lines on Backspace

2015-11-17 Thread Jonas Ådahl
Clear the white lines that is drawn by pointer motions. It makes it
easier to debug pointer movements as one won't need to restart clickdot
just to get a clean plate.

Signed-off-by: Jonas Ådahl 
---
 clients/clickdot.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/clients/clickdot.c b/clients/clickdot.c
index 1597e11..130a166 100644
--- a/clients/clickdot.c
+++ b/clients/clickdot.c
@@ -58,6 +58,7 @@ struct clickdot {
int32_t x, y;
int32_t old_x, old_y;
} line;
+   bool clear_lines;
 
int reset;
 
@@ -206,6 +207,11 @@ key_handler(struct window *window, struct input *input, 
uint32_t time,
case XKB_KEY_Escape:
display_exit(clickdot->display);
break;
+   case XKB_KEY_BackSpace:
+   cairo_surface_destroy(clickdot->buffer);
+   clickdot->buffer = NULL;
+   window_schedule_redraw(clickdot->window);
+   break;
}
 }
 
-- 
2.4.3

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH weston v4 19/20] clients/clickdot: Add option for using a more complex confine region

2015-11-17 Thread Jonas Ådahl
By passing --complex-confine-region clickdot will draw an area looking
like a strange H in half transparent gray. This region will act as the
confine region when pointer confinement is activated (by right clicking).

Signed-off-by: Jonas Ådahl 
---
 clients/clickdot.c | 133 +
 1 file changed, 133 insertions(+)

diff --git a/clients/clickdot.c b/clients/clickdot.c
index 130a166..5054a68 100644
--- a/clients/clickdot.c
+++ b/clients/clickdot.c
@@ -43,6 +43,11 @@
 #include "window.h"
 #include "shared/helpers.h"
 
+#define NUM_COMPLEX_REGION_RECTS 9
+
+static int32_t option_complex_confine_region;
+static int32_t option_help;
+
 struct clickdot {
struct display *display;
struct window *window;
@@ -67,6 +72,10 @@ struct clickdot {
struct task cursor_timeout_task;
 
bool pointer_confined;
+
+   bool complex_confine_region_enabled;
+   bool complex_confine_region_dirty;
+   struct rectangle complex_confine_region[NUM_COMPLEX_REGION_RECTS];
 };
 
 static void
@@ -145,6 +154,92 @@ draw_line(struct clickdot *clickdot, cairo_t *cr,
 }
 
 static void
+calculate_complex_confine_region(struct clickdot *clickdot)
+{
+   struct rectangle allocation;
+   struct rectangle *rs = clickdot->complex_confine_region;
+
+   if (!clickdot->complex_confine_region_dirty)
+   return;
+
+   widget_get_allocation(clickdot->widget, &allocation);
+
+   /*
+* The code below constructs a region made up of rectangles that
+* is then used to set up both an illustrative shaded region in the
+* widget and a confine region used when confining the pointer.
+*/
+
+   rs[0].x = allocation.x + (int)round(allocation.width * 0.05);
+   rs[0].y = allocation.y + (int)round(allocation.height * 0.15);
+   rs[0].width = (int)round(allocation.width * 0.35);
+   rs[0].height = (int)round(allocation.height * 0.7);
+
+   rs[1].x = rs[0].x + rs[0].width;
+   rs[1].y = allocation.y + (int)round(allocation.height * 0.45);
+   rs[1].width = (int)round(allocation.width * 0.09);
+   rs[1].height = (int)round(allocation.height * 0.1);
+
+   rs[2].x = rs[1].x + rs[1].width;
+   rs[2].y = allocation.y + (int)round(allocation.height * 0.48);
+   rs[2].width = (int)round(allocation.width * 0.02);
+   rs[2].height = (int)round(allocation.height * 0.04);
+
+   rs[3].x = rs[2].x + rs[2].width;
+   rs[3].y = allocation.y + (int)round(allocation.height * 0.45);
+   rs[3].width = (int)round(allocation.width * 0.09);
+   rs[3].height = (int)round(allocation.height * 0.1);
+
+   rs[4].x = rs[3].x + rs[3].width;
+   rs[4].y = allocation.y + (int)round(allocation.height * 0.15);
+   rs[4].width = (int)round(allocation.width * 0.35);
+   rs[4].height = (int)round(allocation.height * 0.7);
+
+   rs[5].x = allocation.x + (int)round(allocation.width * 0.05);
+   rs[5].y = allocation.y + (int)round(allocation.height * 0.05);
+   rs[5].width = rs[0].width + rs[1].width + rs[2].width +
+   rs[3].width + rs[4].width;
+   rs[5].height = (int)round(allocation.height * 0.10);
+
+   rs[6].x = allocation.x + (int)round(allocation.width * 0.1);
+   rs[6].y = rs[4].y + rs[4].height + (int)round(allocation.height * 0.02);
+   rs[6].width = (int)round(allocation.width * 0.8);
+   rs[6].height = (int)round(allocation.height * 0.03);
+
+   rs[7].x = allocation.x + (int)round(allocation.width * 0.05);
+   rs[7].y = rs[6].y + rs[6].height;
+   rs[7].width = (int)round(allocation.width * 0.9);
+   rs[7].height = (int)round(allocation.height * 0.03);
+
+   rs[8].x = allocation.x + (int)round(allocation.width * 0.1);
+   rs[8].y = rs[7].y + rs[7].height;
+   rs[8].width = (int)round(allocation.width * 0.8);
+   rs[8].height = (int)round(allocation.height * 0.03);
+
+   clickdot->complex_confine_region_dirty = false;
+}
+
+static void
+draw_complex_confine_region_mask(struct clickdot *clickdot, cairo_t *cr)
+{
+   int i;
+
+   calculate_complex_confine_region(clickdot);
+
+   cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
+
+   for (i = 0; i < NUM_COMPLEX_REGION_RECTS; i++) {
+   cairo_rectangle(cr,
+   clickdot->complex_confine_region[i].x,
+   clickdot->complex_confine_region[i].y,
+   clickdot->complex_confine_region[i].width,
+   clickdot->complex_confine_region[i].height);
+   cairo_set_source_rgba(cr, 0.14, 0.14, 0.14, 0.9);
+   cairo_fill(cr);
+   }
+}
+
+static void
 redraw_handler(struct widget *widget, void *data)
 {
static const double r = 10.0;
@@ -167,6 +262,10 @@ redraw_handler(struct widget *widget, void *data)
cairo_set_source_rgba(cr, 0, 0, 0, 0.8);
cairo_fill(cr);
 
+   if (clickd

[PATCH weston v4 18/20] window: Add API for manually set confine region

2015-11-17 Thread Jonas Ådahl
We can use this to test more complex confine regions.

Signed-off-by: Jonas Ådahl 
---
 clients/window.c | 69 
 clients/window.h | 11 +
 2 files changed, 70 insertions(+), 10 deletions(-)

diff --git a/clients/window.c b/clients/window.c
index 6f5ca85..c911bc1 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -4734,15 +4734,17 @@ static const struct zwp_confined_pointer_v1_listener 
confined_pointer_listener =
 };
 
 int
-window_confine_pointer_to_widget(struct window *window,
-struct widget *widget,
-struct input *input)
+window_confine_pointer_to_rectangles(struct window *window,
+struct input *input,
+struct rectangle *rectangles,
+int num_rectangles)
 {
struct zwp_pointer_constraints_v1 *pointer_constraints =
window->display->pointer_constraints;
struct zwp_confined_pointer_v1 *confined_pointer;
struct wl_compositor *compositor = window->display->compositor;
struct wl_region *region = NULL;
+   int i;
 
if (!window->display->pointer_constraints)
return -1;
@@ -4756,13 +4758,15 @@ window_confine_pointer_to_widget(struct window *window,
if (!input->pointer)
return -1;
 
-   if (widget) {
+   if (num_rectangles >= 1) {
region = wl_compositor_create_region(compositor);
-   wl_region_add(region,
- widget->allocation.x,
- widget->allocation.y,
- widget->allocation.width,
- widget->allocation.height);
+   for (i = 0; i < num_rectangles; i++) {
+   wl_region_add(region,
+ rectangles[i].x,
+ rectangles[i].y,
+ rectangles[i].width,
+ rectangles[i].height);
+   }
}
 
confined_pointer =
@@ -4778,12 +4782,57 @@ window_confine_pointer_to_widget(struct window *window,
 input);
 
window->confined_pointer = confined_pointer;
-   window->confined_widget = widget;
+   window->confined_widget = NULL;
 
return 0;
 }
 
 void
+window_update_confine_rectangles(struct window *window,
+struct rectangle *rectangles,
+int num_rectangles)
+{
+   struct wl_compositor *compositor = window->display->compositor;
+   struct wl_region *region;
+   int i;
+
+   region = wl_compositor_create_region(compositor);
+   for (i = 0; i < num_rectangles; i++) {
+   wl_region_add(region,
+ rectangles[i].x,
+ rectangles[i].y,
+ rectangles[i].width,
+ rectangles[i].height);
+   }
+
+   zwp_confined_pointer_v1_set_region(window->confined_pointer, region);
+
+   wl_region_destroy(region);
+}
+
+int
+window_confine_pointer_to_widget(struct window *window,
+struct widget *widget,
+struct input *input)
+{
+   int ret;
+
+   if (widget) {
+   ret = window_confine_pointer_to_rectangles(window,
+  input,
+  &widget->allocation,
+  1);
+   window->confined_widget = widget;
+   return ret;
+   } else {
+   return window_confine_pointer_to_rectangles(window,
+   input,
+   NULL,
+   0);
+   }
+}
+
+void
 window_unconfine_pointer(struct window *window)
 {
if (!window->confined_pointer)
diff --git a/clients/window.h b/clients/window.h
index 42cf492..724e3a2 100644
--- a/clients/window.h
+++ b/clients/window.h
@@ -381,6 +381,17 @@ widget_set_locked_pointer_cursor_hint(struct widget 
*widget,
  float x, float y);
 
 int
+window_confine_pointer_to_rectangles(struct window *window,
+struct input *input,
+struct rectangle *rectangles,
+int num_rectangles);
+
+void
+window_update_confine_rectangles(struct window *window,
+struct rectangle *rectangles,
+int num_rectangles);
+
+int
 window_confine_pointer_to_widget(struct window *window,
  

[PATCH weston v4 16/20] input: Support non-rectangular pointer confine regions

2015-11-17 Thread Jonas Ådahl
This patch adds support for when the resulting pointer confinement region
is not a rectangle.

Support for this is implemented by converting the rectangles of the
region into the regions outer border. Pointer motions are then clamped
to these borders in order to not escape the confinement region.

Signed-off-by: Jonas Ådahl 
---
 src/input.c | 644 +---
 1 file changed, 615 insertions(+), 29 deletions(-)

diff --git a/src/input.c b/src/input.c
index 81cdd6f..28b36b0 100644
--- a/src/input.c
+++ b/src/input.c
@@ -32,6 +32,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -46,6 +47,27 @@ enum pointer_constraint_type {
POINTER_CONSTRAINT_TYPE_CONFINE,
 };
 
+enum motion_direction {
+   MOTION_DIRECTION_POSITIVE_X = 1 << 0,
+   MOTION_DIRECTION_NEGATIVE_X = 1 << 1,
+   MOTION_DIRECTION_POSITIVE_Y = 1 << 2,
+   MOTION_DIRECTION_NEGATIVE_Y = 1 << 3,
+};
+
+struct vec2d {
+   double x, y;
+};
+
+struct line {
+   struct vec2d a;
+   struct vec2d b;
+};
+
+struct border {
+   struct line line;
+   enum motion_direction blocking_dir;
+};
+
 static void
 maybe_warp_confined_pointer(struct weston_pointer_constraint *constraint);
 
@@ -3350,6 +3372,464 @@ confined_pointer_grab_pointer_focus(struct 
weston_pointer_grab *grab)
 {
 }
 
+static double
+vec2d_cross_product(struct vec2d a, struct vec2d b)
+{
+   return a.x * b.y - a.y * b.x;
+}
+
+static struct vec2d
+vec2d_add(struct vec2d a, struct vec2d b)
+{
+   return (struct vec2d) {
+   .x = a.x + b.x,
+   .y = a.y + b.y,
+   };
+}
+
+static struct vec2d
+vec2d_subtract(struct vec2d a, struct vec2d b)
+{
+   return (struct vec2d) {
+   .x = a.x - b.x,
+   .y = a.y - b.y,
+   };
+}
+
+static struct vec2d
+vec2d_multiply_constant(double c, struct vec2d a)
+{
+   return (struct vec2d) {
+   .x = c * a.x,
+   .y = c * a.y,
+   };
+}
+
+static bool
+lines_intersect(struct line *line1, struct line *line2,
+   struct vec2d *intersection)
+{
+   struct vec2d p = line1->a;
+   struct vec2d r = vec2d_subtract(line1->b, line1->a);
+   struct vec2d q = line2->a;
+   struct vec2d s = vec2d_subtract(line2->b, line2->a);
+   double rxs;
+   double sxr;
+   double t;
+   double u;
+
+   /*
+* The line (p, r) and (q, s) intersects where
+*
+*   p + t r = q + u s
+*
+* Calculate t:
+*
+*   (p + t r) × s = (q + u s) × s
+*   p × s + t (r × s) = q × s + u (s × s)
+*   p × s + t (r × s) = q × s
+*   t (r × s) = q × s - p × s
+*   t (r × s) = (q - p) × s
+*   t = ((q - p) × s) / (r × s)
+*
+* Using the same method, for u we get:
+*
+*   u = ((p - q) × r) / (s × r)
+*/
+
+   rxs = vec2d_cross_product(r, s);
+   sxr = vec2d_cross_product(s, r);
+
+   /* If r × s = 0 then the lines are either parallel or collinear. */
+   if (fabs(rxs) < DBL_MIN)
+   return false;
+
+   t = vec2d_cross_product(vec2d_subtract(q, p), s) / rxs;
+   u = vec2d_cross_product(vec2d_subtract(p, q), r) / sxr;
+
+   /* The lines only intersect if 0 ≤ t ≤ 1 and 0 ≤ u ≤ 1. */
+   if (t < 0.0 || t > 1.0 || u < 0.0 || u > 1.0)
+   return false;
+
+   *intersection = vec2d_add(p, vec2d_multiply_constant(t, r));
+   return true;
+}
+
+static struct border *
+add_border(struct wl_array *array,
+  double x1, double y1,
+  double x2, double y2,
+  enum motion_direction blocking_dir)
+{
+   struct border *border = wl_array_add(array, sizeof *border);
+
+   *border = (struct border) {
+   .line = (struct line) {
+   .a = (struct vec2d) {
+   .x = x1,
+   .y = y1,
+   },
+   .b = (struct vec2d) {
+   .x = x2,
+   .y = y2,
+   },
+   },
+   .blocking_dir = blocking_dir,
+   };
+
+   return border;
+}
+
+static int
+compare_lines_x(const void *a, const void *b)
+{
+   const struct border *border_a = a;
+   const struct border *border_b = b;
+
+
+   if (border_a->line.a.x == border_b->line.a.x)
+   return border_a->line.b.x < border_b->line.b.x;
+   else
+   return border_a->line.a.x > border_b->line.a.x;
+}
+
+static void
+add_non_overlapping_edges(pixman_box32_t *boxes,
+ int band_above_start,
+ int band_below_start,
+ int band_below_end,
+ struct wl_array *borders)
+{
+   int i;
+   struct wl_array band_merge;
+   struct border *border;
+   struct border

[PATCH weston v4 04/20] desktop-shell: Make activate() take a view instead of surface

2015-11-17 Thread Jonas Ådahl
In preparation for further refactorings.

Signed-off-by: Jonas Ådahl 
---
 desktop-shell/exposay.c |  6 +++---
 desktop-shell/shell.c   | 20 +++-
 desktop-shell/shell.h   |  2 +-
 3 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/desktop-shell/exposay.c b/desktop-shell/exposay.c
index 8bd55fb..1e43240 100644
--- a/desktop-shell/exposay.c
+++ b/desktop-shell/exposay.c
@@ -162,7 +162,7 @@ exposay_highlight_surface(struct desktop_shell *shell,
shell->exposay.column_current = esurface->column;
shell->exposay.cur_output = esurface->eoutput;
 
-   activate(shell, view->surface, shell->exposay.seat, false);
+   activate(shell, view, shell->exposay.seat, false);
shell->exposay.focus_current = view;
 }
 
@@ -558,10 +558,10 @@ exposay_transition_inactive(struct desktop_shell *shell, 
int switch_focus)
 * animating back the old state and then immediately transitioning
 * to the new. */
if (switch_focus && shell->exposay.focus_current)
-   activate(shell, shell->exposay.focus_current->surface,
+   activate(shell, shell->exposay.focus_current,
 shell->exposay.seat, true);
else if (shell->exposay.focus_prev)
-   activate(shell, shell->exposay.focus_prev->surface,
+   activate(shell, shell->exposay.focus_prev,
 shell->exposay.seat, true);
 
wl_list_for_each(esurface, &shell->exposay.surface_list, link)
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index 0f473f8..1c84a88 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -807,7 +807,8 @@ focus_state_surface_destroy(struct wl_listener *listener, 
void *data)
 struct focus_state,
 surface_destroy_listener);
struct desktop_shell *shell;
-   struct weston_surface *main_surface, *next;
+   struct weston_surface *main_surface;
+   struct weston_view *next;
struct weston_view *view;
 
main_surface = weston_surface_get_main_surface(state->keyboard_focus);
@@ -820,13 +821,13 @@ focus_state_surface_destroy(struct wl_listener *listener, 
void *data)
if (is_focus_view(view))
continue;
 
-   next = view->surface;
+   next = view;
break;
}
 
/* if the focus was a sub-surface, activate its main surface */
if (main_surface != state->keyboard_focus)
-   next = main_surface;
+   next = get_default_view(main_surface);
 
shell = state->seat->compositor->shell_interface.shell;
if (next) {
@@ -1988,10 +1989,10 @@ busy_cursor_grab_button(struct weston_pointer_grab 
*base,
struct weston_seat *seat = pointer->seat;
 
if (shsurf && button == BTN_LEFT && state) {
-   activate(shsurf->shell, shsurf->surface, seat, true);
+   activate(shsurf->shell, shsurf->view, seat, true);
surface_move(shsurf, pointer, false);
} else if (shsurf && button == BTN_RIGHT && state) {
-   activate(shsurf->shell, shsurf->surface, seat, true);
+   activate(shsurf->shell, shsurf->view, seat, true);
surface_rotate(shsurf, pointer);
}
 }
@@ -5033,9 +5034,10 @@ lower_fullscreen_layer(struct desktop_shell *shell,
 }
 
 void
-activate(struct desktop_shell *shell, struct weston_surface *es,
+activate(struct desktop_shell *shell, struct weston_view *view,
 struct weston_seat *seat, bool configure)
 {
+   struct weston_surface *es = view->surface;
struct weston_surface *main_surface;
struct focus_state *state;
struct workspace *ws;
@@ -5111,7 +5113,7 @@ activate_binding(struct weston_seat *seat,
if (get_shell_surface_type(main_surface) == SHELL_SURFACE_NONE)
return;
 
-   activate(shell, focus_view->surface, seat, true);
+   activate(shell, focus_view, seat, true);
 }
 
 static void
@@ -5561,7 +5563,7 @@ map(struct desktop_shell *shell, struct shell_surface 
*shsurf,
if (shell->locked)
break;
wl_list_for_each(seat, &compositor->seat_list, link)
-   activate(shell, shsurf->surface, seat, true);
+   activate(shell, shsurf->view, seat, true);
break;
case SHELL_SURFACE_POPUP:
case SHELL_SURFACE_NONE:
@@ -5970,7 +5972,7 @@ switcher_destroy(struct switcher *switcher)
}
 
if (switcher->current)
-   activate(switcher->shell, switcher->current->surface,
+   activate(switcher->shell, switcher->current,
 keyboard->seat, true);
wl_list_remove(&switcher->listener.link);
weston_keyboard_end_grab(keyboard);
diff --git a/desktop-shell/shell.h b/desktop-shell/shell.h
index 

[PATCH weston v4 06/20] compositor: Keep track of what views were activated by clicking

2015-11-17 Thread Jonas Ådahl
Adds a weston_view_activate() that can be passed an additional active
flag WESTON_ACTIVATE_CLICKED, that the shell passes when a view was
activated by clicking.

This allows shell independent components implement heuristics depending
on how a view was activated.

Signed-off-by: Jonas Ådahl 
---
 desktop-shell/shell.c |  3 ++-
 src/compositor.c  |  2 ++
 src/compositor.h  | 11 +++
 src/input.c   | 30 ++
 4 files changed, 45 insertions(+), 1 deletion(-)

diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index 3b34529..ab5be7a 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -5055,7 +5055,7 @@ activate(struct desktop_shell *shell, struct weston_view 
*view,
 * Leave fullscreen surfaces on unrelated outputs alone. */
lower_fullscreen_layer(shell, shsurf->output);
 
-   weston_surface_activate(es, seat);
+   weston_view_activate(view, seat, flags);
 
state = ensure_focus_state(shell, seat);
if (state == NULL)
@@ -5130,6 +5130,7 @@ click_to_activate_binding(struct weston_pointer *pointer, 
uint32_t time,
return;
 
activate_binding(pointer->seat, data, pointer->focus,
+WESTON_ACTIVATE_FLAG_CLICKED |
 WESTON_ACTIVATE_FLAG_CONFIGURE);
 }
 
diff --git a/src/compositor.c b/src/compositor.c
index f8437e8..6f8d769 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -4490,6 +4490,8 @@ weston_compositor_create(struct wl_display *display, void 
*user_data)
ec->output_id_pool = 0;
ec->repaint_msec = DEFAULT_REPAINT_WINDOW;
 
+   ec->activate_serial = 1;
+
if (!wl_global_create(ec->wl_display, &wl_compositor_interface, 3,
  ec, compositor_bind))
goto fail;
diff --git a/src/compositor.h b/src/compositor.h
index d1f7b04..032c637 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -750,6 +750,8 @@ struct weston_compositor {
clockid_t presentation_clock;
int32_t repaint_msec;
 
+   unsigned int activate_serial;
+
int exit_code;
 
void *user_data;
@@ -848,6 +850,8 @@ struct weston_view {
/* For weston_layer inheritance from another view */
struct weston_view *parent_view;
 
+   unsigned int click_to_activate_serial;
+
pixman_region32_t clip;  /* See weston_view_damage_below() */
float alpha; /* part of geometry, see below */
 
@@ -1067,6 +1071,7 @@ enum weston_key_state_update {
 enum weston_activate_flag {
WESTON_ACTIVATE_FLAG_NONE = 0,
WESTON_ACTIVATE_FLAG_CONFIGURE = 1 << 0,
+   WESTON_ACTIVATE_FLAG_CLICKED = 1 << 1,
 };
 
 void
@@ -1123,6 +1128,12 @@ weston_spring_done(struct weston_spring *spring);
 void
 weston_surface_activate(struct weston_surface *surface,
struct weston_seat *seat);
+
+void
+weston_view_activate(struct weston_view *view,
+struct weston_seat *seat,
+enum weston_activate_flag flags);
+
 void
 notify_motion(struct weston_seat *seat, uint32_t time,
  struct weston_pointer_motion_event *event);
diff --git a/src/input.c b/src/input.c
index 53e84a0..0a567da 100644
--- a/src/input.c
+++ b/src/input.c
@@ -1102,6 +1102,20 @@ notify_motion_absolute(struct weston_seat *seat,
pointer->grab->interface->motion(pointer->grab, time, &event);
 }
 
+static unsigned int
+peek_next_activate_serial(struct weston_compositor *c)
+{
+   unsigned serial = c->activate_serial + 1;
+
+   return serial == 0 ? 1 : serial;
+}
+
+static void
+inc_activate_serial(struct weston_compositor *c)
+{
+   c->activate_serial = peek_next_activate_serial (c);
+}
+
 WL_EXPORT void
 weston_surface_activate(struct weston_surface *surface,
struct weston_seat *seat)
@@ -1109,6 +1123,8 @@ weston_surface_activate(struct weston_surface *surface,
struct weston_compositor *compositor = seat->compositor;
struct weston_keyboard *keyboard = weston_seat_get_keyboard(seat);
 
+   inc_activate_serial(compositor);
+
if (keyboard) {
weston_keyboard_set_focus(keyboard, surface);
wl_data_device_set_keyboard_focus(seat);
@@ -1118,6 +1134,20 @@ weston_surface_activate(struct weston_surface *surface,
 }
 
 WL_EXPORT void
+weston_view_activate(struct weston_view *view,
+struct weston_seat *seat,
+uint32_t flags)
+{
+   struct weston_compositor *compositor = seat->compositor;
+
+   if (flags & WESTON_ACTIVATE_FLAG_CLICKED) {
+   view->click_to_activate_serial =
+   peek_next_activate_serial(compositor);
+   }
+   weston_surface_activate(view->surface, seat);
+}
+
+WL_EXPORT void
 notify_button(struct weston_seat *seat, uint32_t time, int32_t button,
  enum wl_pointer_button_state state)
 {
-- 
2.4.3

_

[PATCH weston v4 03/20] desktop-shell: Change switcher to track views

2015-11-17 Thread Jonas Ådahl
Preparation for future refactorings.

Signed-off-by: Jonas Ådahl 
---
 desktop-shell/shell.c | 22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index bdabcbf..0f473f8 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -5881,7 +5881,7 @@ bind_desktop_shell(struct wl_client *client,
 
 struct switcher {
struct desktop_shell *shell;
-   struct weston_surface *current;
+   struct weston_view *current;
struct wl_listener listener;
struct weston_keyboard_grab grab;
struct wl_array minimized_array;
@@ -5891,7 +5891,7 @@ static void
 switcher_next(struct switcher *switcher)
 {
struct weston_view *view;
-   struct weston_surface *first = NULL, *prev = NULL, *next = NULL;
+   struct weston_view *first = NULL, *prev = NULL, *next = NULL;
struct shell_surface *shsurf;
struct workspace *ws = get_current_workspace(switcher->shell);
 
@@ -5911,10 +5911,10 @@ switcher_next(struct switcher *switcher)
shsurf->type == SHELL_SURFACE_TOPLEVEL &&
shsurf->parent == NULL) {
if (first == NULL)
-   first = view->surface;
+   first = view;
if (prev == switcher->current)
-   next = view->surface;
-   prev = view->surface;
+   next = view;
+   prev = view;
view->alpha = 0.25;
weston_view_geometry_dirty(view);
weston_surface_damage(view->surface);
@@ -5937,16 +5937,16 @@ switcher_next(struct switcher *switcher)
wl_signal_add(&next->destroy_signal, &switcher->listener);
 
switcher->current = next;
-   wl_list_for_each(view, &next->views, surface_link)
+   wl_list_for_each(view, &next->surface->views, surface_link)
view->alpha = 1.0;
 
-   shsurf = get_shell_surface(switcher->current);
+   shsurf = get_shell_surface(switcher->current->surface);
if (shsurf && shsurf->state.fullscreen)
shsurf->fullscreen.black_view->alpha = 1.0;
 }
 
 static void
-switcher_handle_surface_destroy(struct wl_listener *listener, void *data)
+switcher_handle_view_destroy(struct wl_listener *listener, void *data)
 {
struct switcher *switcher =
container_of(listener, struct switcher, listener);
@@ -5970,7 +5970,7 @@ switcher_destroy(struct switcher *switcher)
}
 
if (switcher->current)
-   activate(switcher->shell, switcher->current,
+   activate(switcher->shell, switcher->current->surface,
 keyboard->seat, true);
wl_list_remove(&switcher->listener.link);
weston_keyboard_end_grab(keyboard);
@@ -5981,7 +5981,7 @@ switcher_destroy(struct switcher *switcher)
struct weston_view **minimized;
wl_array_for_each(minimized, &switcher->minimized_array) {
/* with the exception of the current selected */
-   if ((*minimized)->surface != switcher->current) {
+   if ((*minimized)->surface != switcher->current->surface) {
weston_layer_entry_remove(&(*minimized)->layer_link);

weston_layer_entry_insert(&switcher->shell->minimized_layer.view_list, 
&(*minimized)->layer_link);
weston_view_damage_below(*minimized);
@@ -6039,7 +6039,7 @@ switcher_binding(struct weston_keyboard *keyboard, 
uint32_t time,
switcher = malloc(sizeof *switcher);
switcher->shell = shell;
switcher->current = NULL;
-   switcher->listener.notify = switcher_handle_surface_destroy;
+   switcher->listener.notify = switcher_handle_view_destroy;
wl_list_init(&switcher->listener.link);
wl_array_init(&switcher->minimized_array);
 
-- 
2.4.3

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH weston v4 05/20] desktop-shell: Pass a flag bitmask instead of bool to activate()

2015-11-17 Thread Jonas Ådahl
Although it currently only has one available flag, but that'll change.

Signed-off-by: Jonas Ådahl 
---
 desktop-shell/exposay.c |  9 ++---
 desktop-shell/shell.c   | 34 ++
 desktop-shell/shell.h   |  2 +-
 src/compositor.h|  5 +
 4 files changed, 34 insertions(+), 16 deletions(-)

diff --git a/desktop-shell/exposay.c b/desktop-shell/exposay.c
index 1e43240..99a14e0 100644
--- a/desktop-shell/exposay.c
+++ b/desktop-shell/exposay.c
@@ -162,7 +162,8 @@ exposay_highlight_surface(struct desktop_shell *shell,
shell->exposay.column_current = esurface->column;
shell->exposay.cur_output = esurface->eoutput;
 
-   activate(shell, view, shell->exposay.seat, false);
+   activate(shell, view, shell->exposay.seat,
+WESTON_ACTIVATE_FLAG_NONE);
shell->exposay.focus_current = view;
 }
 
@@ -559,10 +560,12 @@ exposay_transition_inactive(struct desktop_shell *shell, 
int switch_focus)
 * to the new. */
if (switch_focus && shell->exposay.focus_current)
activate(shell, shell->exposay.focus_current,
-shell->exposay.seat, true);
+shell->exposay.seat,
+WESTON_ACTIVATE_FLAG_CONFIGURE);
else if (shell->exposay.focus_prev)
activate(shell, shell->exposay.focus_prev,
-shell->exposay.seat, true);
+shell->exposay.seat,
+WESTON_ACTIVATE_FLAG_CONFIGURE);
 
wl_list_for_each(esurface, &shell->exposay.surface_list, link)
exposay_animate_out(esurface);
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index 1c84a88..3b34529 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -832,7 +832,8 @@ focus_state_surface_destroy(struct wl_listener *listener, 
void *data)
shell = state->seat->compositor->shell_interface.shell;
if (next) {
state->keyboard_focus = NULL;
-   activate(shell, next, state->seat, true);
+   activate(shell, next, state->seat,
+WESTON_ACTIVATE_FLAG_CONFIGURE);
} else {
if (shell->focus_animation_type == ANIMATION_DIM_LAYER) {
if (state->ws->focus_animation)
@@ -1989,10 +1990,12 @@ busy_cursor_grab_button(struct weston_pointer_grab 
*base,
struct weston_seat *seat = pointer->seat;
 
if (shsurf && button == BTN_LEFT && state) {
-   activate(shsurf->shell, shsurf->view, seat, true);
+   activate(shsurf->shell, shsurf->view, seat,
+WESTON_ACTIVATE_FLAG_CONFIGURE);
surface_move(shsurf, pointer, false);
} else if (shsurf && button == BTN_RIGHT && state) {
-   activate(shsurf->shell, shsurf->view, seat, true);
+   activate(shsurf->shell, shsurf->view, seat,
+WESTON_ACTIVATE_FLAG_CONFIGURE);
surface_rotate(shsurf, pointer);
}
 }
@@ -5035,7 +5038,7 @@ lower_fullscreen_layer(struct desktop_shell *shell,
 
 void
 activate(struct desktop_shell *shell, struct weston_view *view,
-struct weston_seat *seat, bool configure)
+struct weston_seat *seat, enum weston_activate_flag flags)
 {
struct weston_surface *es = view->surface;
struct weston_surface *main_surface;
@@ -5061,7 +5064,7 @@ activate(struct desktop_shell *shell, struct weston_view 
*view,
old_es = state->keyboard_focus;
focus_state_set_focus(state, es);
 
-   if (shsurf->state.fullscreen && configure)
+   if (shsurf->state.fullscreen && flags & WESTON_ACTIVATE_FLAG_CONFIGURE)
shell_configure_fullscreen(shsurf);
else
restore_output_mode(shsurf->output);
@@ -5098,7 +5101,8 @@ is_black_surface_view(struct weston_view *view, struct 
weston_view **fs_view)
 static void
 activate_binding(struct weston_seat *seat,
 struct desktop_shell *shell,
-struct weston_view *focus_view)
+struct weston_view *focus_view,
+enum weston_activate_flag flags)
 {
struct weston_view *main_view;
struct weston_surface *main_surface;
@@ -5113,7 +5117,7 @@ activate_binding(struct weston_seat *seat,
if (get_shell_surface_type(main_surface) == SHELL_SURFACE_NONE)
return;
 
-   activate(shell, focus_view, seat, true);
+   activate(shell, focus_view, seat, flags);
 }
 
 static void
@@ -5125,7 +5129,8 @@ click_to_activate_binding(struct weston_pointer *pointer, 
uint32_t time,
if (pointer->focus == NULL)
return;
 
-   activate_binding(pointer->seat, data, pointer->focus);
+   activate_binding(pointer->seat, data, pointer->focus,
+WESTON_ACTIVATE_FLAG_CONFIGURE);
 }
 
 static void
@@ -5137,7 +5142,8 @@ touch_to_activate_binding(struct weston

[PATCH weston v4 12/20] Implement pointer locking and confinement

2015-11-17 Thread Jonas Ådahl
This patch implements the wp_pointer_constraints protocol used for
locking or confining a pointer. It consists of a new global object with
two requests; one for locking the surface to a position, one for
confining the pointer to a given region.

In this patch, only the locking part is fully implemented as in
specified in the protocol, while confinement is only implemented for
when the union of the passed region and the input region of the confined
surface is a single rectangle.

Note that the pointer constraints protocol is still unstable and as
such has the unstable protocol naming conventions applied.

Signed-off-by: Jonas Ådahl 
---

Changes since v3:

Uses the XML file from wayland-protocols.

Updated implementation given interface renaming.

Updated implementation given protocol changes (see protocol patch).


 Makefile.am   |   4 +-
 src/compositor.c  |  11 +
 src/compositor.h  |  41 +++
 src/input.c   | 794 --
 xwayland/window-manager.c |   3 +-
 5 files changed, 829 insertions(+), 24 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 08a3444..a640d74 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -128,7 +128,9 @@ nodist_weston_SOURCES = 
\
protocol/linux-dmabuf-unstable-v1-protocol.c\
protocol/linux-dmabuf-unstable-v1-server-protocol.h \
protocol/relative-pointer-unstable-v1-protocol.c\
-   protocol/relative-pointer-unstable-v1-server-protocol.h
+   protocol/relative-pointer-unstable-v1-server-protocol.h \
+   protocol/pointer-constraints-unstable-v1-protocol.c \
+   protocol/pointer-constraints-unstable-v1-server-protocol.h
 
 BUILT_SOURCES += $(nodist_weston_SOURCES)
 
diff --git a/src/compositor.c b/src/compositor.c
index 12bd18e..23f54de 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -584,6 +584,7 @@ weston_surface_create(struct weston_compositor *compositor)
return NULL;
 
wl_signal_init(&surface->destroy_signal);
+   wl_signal_init(&surface->commit_signal);
 
surface->compositor = compositor;
surface->ref_count = 1;
@@ -610,6 +611,8 @@ weston_surface_create(struct weston_compositor *compositor)
weston_matrix_init(&surface->buffer_to_surface_matrix);
weston_matrix_init(&surface->surface_to_buffer_matrix);
 
+   wl_list_init(&surface->pointer_constraints);
+
return surface;
 }
 
@@ -1820,6 +1823,7 @@ weston_surface_destroy(struct weston_surface *surface)
 {
struct weston_frame_callback *cb, *next;
struct weston_view *ev, *nv;
+   struct weston_pointer_constraint *constraint, *next_constraint;
 
if (--surface->ref_count > 0)
return;
@@ -1847,6 +1851,11 @@ weston_surface_destroy(struct weston_surface *surface)
 
weston_presentation_feedback_discard_list(&surface->feedback_list);
 
+   wl_list_for_each_safe(constraint, next_constraint,
+ &surface->pointer_constraints,
+ link)
+   weston_pointer_constraint_destroy(constraint);
+
free(surface);
 }
 
@@ -2761,6 +2770,8 @@ weston_surface_commit_state(struct weston_surface 
*surface,
wl_list_insert_list(&surface->feedback_list,
&state->feedback_list);
wl_list_init(&state->feedback_list);
+
+   wl_signal_emit(&surface->commit_signal, surface);
 }
 
 static void
diff --git a/src/compositor.h b/src/compositor.h
index 46a4d1f..4b27197 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -58,6 +58,7 @@ struct weston_output;
 struct input_method;
 struct weston_pointer;
 struct linux_dmabuf_buffer;
+struct weston_pointer_constraint;
 
 enum weston_keyboard_modifier {
MODIFIER_CTRL = (1 << 0),
@@ -350,6 +351,7 @@ struct weston_pointer {
struct wl_listener focus_resource_listener;
struct wl_signal focus_signal;
struct wl_signal motion_signal;
+   struct wl_signal destroy_signal;
 
struct weston_view *sprite;
struct wl_listener sprite_destroy_listener;
@@ -424,6 +426,9 @@ void
 weston_pointer_set_default_grab(struct weston_pointer *pointer,
const struct weston_pointer_grab_interface *interface);
 
+void
+weston_pointer_constraint_destroy(struct weston_pointer_constraint 
*constraint);
+
 struct weston_keyboard *
 weston_keyboard_create(void);
 void
@@ -764,6 +769,8 @@ struct weston_compositor {
 
unsigned int activate_serial;
 
+   struct wl_global *pointer_constraints;
+
int exit_code;
 
void *user_data;
@@ -961,10 +968,41 @@ struct weston_surface_state {
struct weston_buffer_viewport buffer_viewport;
 };
 
+struct weston_surface_activation_data {
+   struct weston_surface *surface;
+   struct weston_seat *seat;
+};
+
+struct weston_pointer_constraint {
+   struct wl_list 

[PATCH weston v4 10/20] input: Provide microsecond timestamps in motion events

2015-11-17 Thread Jonas Ådahl
Provide timestamps with microsecond granularity if the backend can
provide it. Backends that can't should set it to 0.

Signed-off-by: Jonas Ådahl 
---
 src/compositor.h  | 1 +
 src/libinput-device.c | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/src/compositor.h b/src/compositor.h
index 1f5d89b..bd0d134 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -248,6 +248,7 @@ enum weston_pointer_motion_mask {
 
 struct weston_pointer_motion_event {
uint32_t mask;
+   uint64_t time_usec;
double x;
double y;
double dx;
diff --git a/src/libinput-device.c b/src/libinput-device.c
index f60d1e0..918541c 100644
--- a/src/libinput-device.c
+++ b/src/libinput-device.c
@@ -87,6 +87,8 @@ handle_pointer_motion(struct libinput_device *libinput_device,
struct evdev_device *device =
libinput_device_get_user_data(libinput_device);
struct weston_pointer_motion_event event = { 0 };
+   uint64_t time_usec =
+   libinput_event_pointer_get_time_usec(pointer_event);
double dx_unaccel, dy_unaccel;
 
dx_unaccel = libinput_event_pointer_get_dx_unaccelerated(pointer_event);
@@ -95,6 +97,7 @@ handle_pointer_motion(struct libinput_device *libinput_device,
event = (struct weston_pointer_motion_event) {
.mask = WESTON_POINTER_MOTION_REL |
WESTON_POINTER_MOTION_REL_UNACCEL,
+   .time_usec = time_usec,
.dx = libinput_event_pointer_get_dx(pointer_event),
.dy = libinput_event_pointer_get_dy(pointer_event),
.dx_unaccel = dx_unaccel,
-- 
2.4.3

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH weston v4 07/20] libinput: Expose unaccelerated motion deltas in motion event struct

2015-11-17 Thread Jonas Ådahl
Signed-off-by: Jonas Ådahl 
---
 src/compositor.h  | 3 +++
 src/libinput-device.c | 9 -
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/compositor.h b/src/compositor.h
index 032c637..3b1f63e 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -243,6 +243,7 @@ struct weston_output {
 enum weston_pointer_motion_mask {
WESTON_POINTER_MOTION_ABS = 1 << 0,
WESTON_POINTER_MOTION_REL = 1 << 1,
+   WESTON_POINTER_MOTION_REL_UNACCEL = 1 << 2,
 };
 
 struct weston_pointer_motion_event {
@@ -251,6 +252,8 @@ struct weston_pointer_motion_event {
double y;
double dx;
double dy;
+   double dx_unaccel;
+   double dy_unaccel;
 };
 
 struct weston_pointer_grab;
diff --git a/src/libinput-device.c b/src/libinput-device.c
index 7cc6a35..f60d1e0 100644
--- a/src/libinput-device.c
+++ b/src/libinput-device.c
@@ -87,11 +87,18 @@ handle_pointer_motion(struct libinput_device 
*libinput_device,
struct evdev_device *device =
libinput_device_get_user_data(libinput_device);
struct weston_pointer_motion_event event = { 0 };
+   double dx_unaccel, dy_unaccel;
+
+   dx_unaccel = libinput_event_pointer_get_dx_unaccelerated(pointer_event);
+   dy_unaccel = libinput_event_pointer_get_dy_unaccelerated(pointer_event);
 
event = (struct weston_pointer_motion_event) {
-   .mask = WESTON_POINTER_MOTION_REL,
+   .mask = WESTON_POINTER_MOTION_REL |
+   WESTON_POINTER_MOTION_REL_UNACCEL,
.dx = libinput_event_pointer_get_dx(pointer_event),
.dy = libinput_event_pointer_get_dy(pointer_event),
+   .dx_unaccel = dx_unaccel,
+   .dy_unaccel = dy_unaccel,
};
 
notify_motion(device->seat,
-- 
2.4.3

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH weston v4 13/20] clients: Add API for pointer locking and pointer confinement

2015-11-17 Thread Jonas Ådahl
Signed-off-by: Jonas Ådahl 
Reviewed-by: Bryce Harrington 
---

Changes since v3:

Uses the XML file from wayland-protocols.

Updated implementation given interface renaming.

Updated implementation given protocol changes (see protocol patch).


 Makefile.am  |   6 +-
 clients/window.c | 326 +++
 clients/window.h |  62 +++
 3 files changed, 393 insertions(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index a640d74..42e91cb 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -559,7 +559,11 @@ nodist_libtoytoolkit_la_SOURCES =  \
protocol/xdg-shell-unstable-v5-protocol.c   \
protocol/xdg-shell-unstable-v5-client-protocol.h\
protocol/ivi-application-protocol.c \
-   protocol/ivi-application-client-protocol.h
+   protocol/ivi-application-client-protocol.h  \
+   protocol/pointer-constraints-unstable-v1-protocol.c \
+   protocol/pointer-constraints-unstable-v1-client-protocol.h  \
+   protocol/relative-pointer-unstable-v1-protocol.c\
+   protocol/relative-pointer-unstable-v1-client-protocol.h
 
 BUILT_SOURCES += $(nodist_libtoytoolkit_la_SOURCES)
 
diff --git a/clients/window.c b/clients/window.c
index f9797a2..6f5ca85 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -24,6 +24,7 @@
 
 #include "config.h"
 
+#include 
 #include 
 #include 
 #include 
@@ -70,6 +71,8 @@ typedef void *EGLContext;
 #include "shared/helpers.h"
 #include "xdg-shell-unstable-v5-client-protocol.h"
 #include "text-cursor-position-client-protocol.h"
+#include "pointer-constraints-unstable-v1-client-protocol.h"
+#include "relative-pointer-unstable-v1-client-protocol.h"
 #include "shared/os-compatibility.h"
 
 #include "window.h"
@@ -78,6 +81,9 @@ typedef void *EGLContext;
 #include "ivi-application-client-protocol.h"
 #define IVI_SURFACE_ID 9000
 
+#define ZWP_RELATIVE_POINTER_MANAGER_V1_VERSION 1
+#define ZWP_POINTER_CONSTRAINTS_V1_VERSION 1
+
 struct shm_pool;
 
 struct global {
@@ -97,6 +103,8 @@ struct display {
struct text_cursor_position *text_cursor_position;
struct xdg_shell *xdg_shell;
struct ivi_application *ivi_application; /* ivi style shell */
+   struct zwp_relative_pointer_manager_v1 *relative_pointer_manager;
+   struct zwp_pointer_constraints_v1 *pointer_constraints;
EGLDisplay dpy;
EGLConfig argb_config;
EGLContext argb_ctx;
@@ -245,6 +253,8 @@ struct window {
window_output_handler_t output_handler;
window_state_changed_handler_t state_changed_handler;
 
+   window_locked_pointer_motion_handler_t locked_pointer_motion_handler;
+
struct surface *main_surface;
struct xdg_surface *xdg_surface;
struct xdg_popup *xdg_popup;
@@ -259,6 +269,19 @@ struct window {
/* struct surface::link, contains also main_surface */
struct wl_list subsurface_list;
 
+   struct zwp_relative_pointer_v1 *relative_pointer;
+   struct zwp_locked_pointer_v1 *locked_pointer;
+   struct input *locked_input;
+   bool pointer_locked;
+   locked_pointer_locked_handler_t pointer_locked_handler;
+   locked_pointer_unlocked_handler_t pointer_unlocked_handler;
+   confined_pointer_confined_handler_t pointer_confined_handler;
+   confined_pointer_unconfined_handler_t pointer_unconfined_handler;
+
+   struct zwp_confined_pointer_v1 *confined_pointer;
+   struct widget *confined_widget;
+   bool confined;
+
void *user_data;
struct wl_list link;
 };
@@ -3911,6 +3934,22 @@ window_do_resize(struct window *window)
 
if (!window->fullscreen && !window->maximized)
window->saved_allocation = window->pending_allocation;
+
+   if (window->confined && window->confined_widget) {
+   struct wl_compositor *compositor = window->display->compositor;
+   struct wl_region *region;
+   struct widget *widget = window->confined_widget;
+
+   region = wl_compositor_create_region(compositor);
+   wl_region_add(region,
+ widget->allocation.x,
+ widget->allocation.y,
+ widget->allocation.width,
+ widget->allocation.height);
+   zwp_confined_pointer_v1_set_region(window->confined_pointer,
+  region);
+   wl_region_destroy(region);
+   }
 }
 
 static void
@@ -4440,6 +4479,43 @@ window_set_state_changed_handler(struct window *window,
 }
 
 void
+window_set_pointer_locked_handler(struct window *window,
+ locked_pointer_locked_handler_t locked)
+{
+   window->pointer_locked_handler = locked;
+}
+
+void
+window_set_pointer_unlocked_handler(struct window *window,
+  

[PATCH weston v4 08/20] input: Don't send wl_pointer.motion if position didn't change

2015-11-17 Thread Jonas Ådahl
Signed-off-by: Jonas Ådahl 
---
 src/input.c | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/input.c b/src/input.c
index 0a567da..3fd4dae 100644
--- a/src/input.c
+++ b/src/input.c
@@ -173,6 +173,8 @@ default_grab_pointer_motion(struct weston_pointer_grab 
*grab, uint32_t time,
struct wl_list *resource_list;
struct wl_resource *resource;
wl_fixed_t x, y;
+   wl_fixed_t old_sx = pointer->sx;
+   wl_fixed_t old_sy = pointer->sy;
 
if (pointer->focus) {
weston_pointer_motion_to_abs(pointer, event, &x, &y);
@@ -182,10 +184,12 @@ default_grab_pointer_motion(struct weston_pointer_grab 
*grab, uint32_t time,
 
weston_pointer_move(pointer, event);
 
-   resource_list = &pointer->focus_resource_list;
-   wl_resource_for_each(resource, resource_list) {
-   wl_pointer_send_motion(resource, time,
-  pointer->sx, pointer->sy);
+   if (old_sx != pointer->sx || old_sy != pointer->sy) {
+   resource_list = &pointer->focus_resource_list;
+   wl_resource_for_each(resource, resource_list) {
+   wl_pointer_send_motion(resource, time,
+  pointer->sx, pointer->sy);
+   }
}
 }
 
-- 
2.4.3

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH weston v4 11/20] Implement the relative pointer protocol

2015-11-17 Thread Jonas Ådahl
A wp_relative_pointer object is an extension to the wl_pointer interface
only used for emitting relative pointer events. It will only emit events
when the parent pointer has focus.

To get a relative pointer object, use the get_relative_pointer request
of the global wp_relative_pointer_manager object.

The relative pointer protocol is currently an unstable protocol, so
unstable protocol naming conventions has been applied.

Signed-off-by: Jonas Ådahl 
---

Changes since v3:

Uses the XML file from wayland-protocols.

Updated implementation given interface renaming.

Updated implementation given protocol changes (see protocol patch).



 Makefile.am  |   4 +-
 src/compositor.c |   3 +
 src/compositor.h |   4 ++
 src/input.c  | 188 +--
 4 files changed, 180 insertions(+), 19 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index cbb3b57..08a3444 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -126,7 +126,9 @@ nodist_weston_SOURCES = 
\
protocol/scaler-protocol.c  \
protocol/scaler-server-protocol.h   \
protocol/linux-dmabuf-unstable-v1-protocol.c\
-   protocol/linux-dmabuf-unstable-v1-server-protocol.h
+   protocol/linux-dmabuf-unstable-v1-server-protocol.h \
+   protocol/relative-pointer-unstable-v1-protocol.c\
+   protocol/relative-pointer-unstable-v1-server-protocol.h
 
 BUILT_SOURCES += $(nodist_weston_SOURCES)
 
diff --git a/src/compositor.c b/src/compositor.c
index 6f8d769..12bd18e 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -4508,6 +4508,9 @@ weston_compositor_create(struct wl_display *display, void 
*user_data)
  ec, bind_presentation))
goto fail;
 
+   if (weston_input_init(ec) != 0)
+   goto fail;
+
wl_list_init(&ec->view_list);
wl_list_init(&ec->plane_list);
wl_list_init(&ec->layer_list);
diff --git a/src/compositor.h b/src/compositor.h
index bd0d134..46a4d1f 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -335,6 +335,7 @@ struct weston_pointer_client {
struct wl_list link;
struct wl_client *client;
struct wl_list pointer_resources;
+   struct wl_list relative_pointer_resources;
 };
 
 struct weston_pointer {
@@ -1647,6 +1648,9 @@ int
 noop_renderer_init(struct weston_compositor *ec);
 
 int
+weston_input_init(struct weston_compositor *compositor);
+
+int
 backend_init(struct weston_compositor *c,
 int *argc, char *argv[],
 struct weston_config *config,
diff --git a/src/input.c b/src/input.c
index e9723fc..97bffab 100644
--- a/src/input.c
+++ b/src/input.c
@@ -37,6 +37,7 @@
 #include "shared/helpers.h"
 #include "shared/os-compatibility.h"
 #include "compositor.h"
+#include "protocol/relative-pointer-unstable-v1-server-protocol.h"
 
 static void
 empty_region(pixman_region32_t *region)
@@ -56,6 +57,7 @@ weston_pointer_client_create(struct wl_client *client)
 
pointer_client->client = client;
wl_list_init(&pointer_client->pointer_resources);
+   wl_list_init(&pointer_client->relative_pointer_resources);
 
return pointer_client;
 }
@@ -69,7 +71,9 @@ weston_pointer_client_destroy(struct weston_pointer_client 
*pointer_client)
 static bool
 weston_pointer_client_is_empty(struct weston_pointer_client *pointer_client)
 {
-   return wl_list_empty(&pointer_client->pointer_resources);
+   return
+   wl_list_empty(&pointer_client->pointer_resources) &&
+   wl_list_empty(&pointer_client->relative_pointer_resources);
 }
 
 static struct weston_pointer_client *
@@ -140,6 +144,49 @@ static void unbind_resource(struct wl_resource *resource)
 }
 
 WL_EXPORT void
+weston_pointer_motion_to_abs(struct weston_pointer *pointer,
+struct weston_pointer_motion_event *event,
+wl_fixed_t *x, wl_fixed_t *y)
+{
+   if (event->mask & WESTON_POINTER_MOTION_ABS) {
+   *x = wl_fixed_from_double(event->x);
+   *y = wl_fixed_from_double(event->y);
+   } else if (event->mask & WESTON_POINTER_MOTION_REL) {
+   *x = pointer->x + wl_fixed_from_double(event->dx);
+   *y = pointer->y + wl_fixed_from_double(event->dy);
+   } else {
+   assert(!"invalid motion event");
+   *x = *y = 0;
+   }
+}
+
+static bool
+weston_pointer_motion_to_rel(struct weston_pointer *pointer,
+struct weston_pointer_motion_event *event,
+double *dx, double *dy,
+double *dx_unaccel, double *dy_unaccel)
+{
+   if (event->mask & WESTON_POINTER_MOTION_REL &&
+   event->mask & WESTON_POINTER_MOTION_REL_UNACCEL) {
+   *dx = event->dx;
+   *dy = event->dy;
+   *dx_unaccel = event->dx_unac

[PATCH weston v4 09/20] input: Keep per client pointer resources in their own structs

2015-11-17 Thread Jonas Ådahl
Keep all per client wl_pointer resources in a new struct called
'weston_pointer_client'. When focus changes, instead of moving a list
of resources between different lists, just change the focused pointer
client.

The intention with this is to make it easier to add wl_pointer
extensions that share the same focus as the corresponding wl_pointer.

Signed-off-by: Jonas Ådahl 
---
 desktop-shell/shell.c |  14 ++--
 src/compositor.h  |  11 ++-
 src/input.c   | 187 --
 3 files changed, 170 insertions(+), 42 deletions(-)

diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index ab5be7a..c6b1f5c 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -3150,6 +3150,7 @@ popup_grab_motion(struct weston_pointer_grab *grab, 
uint32_t time,
 {
struct weston_pointer *pointer = grab->pointer;
struct wl_resource *resource;
+   struct wl_list *resource_list;
wl_fixed_t x, y;
wl_fixed_t sx, sy;
 
@@ -3161,7 +3162,11 @@ popup_grab_motion(struct weston_pointer_grab *grab, 
uint32_t time,
 
weston_pointer_move(pointer, event);
 
-   wl_resource_for_each(resource, &pointer->focus_resource_list) {
+   if (!pointer->focus_client)
+   return;
+
+   resource_list = &pointer->focus_client->pointer_resources;
+   wl_resource_for_each(resource, resource_list) {
weston_view_from_global_fixed(pointer->focus,
  pointer->x, pointer->y,
  &sx, &sy);
@@ -3179,10 +3184,11 @@ popup_grab_button(struct weston_pointer_grab *grab,
struct wl_display *display = shseat->seat->compositor->wl_display;
enum wl_pointer_button_state state = state_w;
uint32_t serial;
-   struct wl_list *resource_list;
+   struct wl_list *resource_list = NULL;
 
-   resource_list = &grab->pointer->focus_resource_list;
-   if (!wl_list_empty(resource_list)) {
+   if (grab->pointer->focus_client)
+   resource_list = &grab->pointer->focus_client->pointer_resources;
+   if (resource_list && !wl_list_empty(resource_list)) {
serial = wl_display_get_serial(display);
wl_resource_for_each(resource, resource_list) {
wl_pointer_send_button(resource, serial,
diff --git a/src/compositor.h b/src/compositor.h
index 3b1f63e..1f5d89b 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -330,12 +330,19 @@ struct weston_data_source {
void (*cancel)(struct weston_data_source *source);
 };
 
+struct weston_pointer_client {
+   struct wl_list link;
+   struct wl_client *client;
+   struct wl_list pointer_resources;
+};
+
 struct weston_pointer {
struct weston_seat *seat;
 
-   struct wl_list resource_list;
-   struct wl_list focus_resource_list;
+   struct wl_list pointer_clients;
+
struct weston_view *focus;
+   struct weston_pointer_client *focus_client;
uint32_t focus_serial;
struct wl_listener focus_view_listener;
struct wl_listener focus_resource_listener;
diff --git a/src/input.c b/src/input.c
index 3fd4dae..e9723fc 100644
--- a/src/input.c
+++ b/src/input.c
@@ -45,6 +45,95 @@ empty_region(pixman_region32_t *region)
pixman_region32_init(region);
 }
 
+static struct weston_pointer_client *
+weston_pointer_client_create(struct wl_client *client)
+{
+   struct weston_pointer_client *pointer_client;
+
+   pointer_client = zalloc(sizeof *pointer_client);
+   if (!pointer_client)
+   return NULL;
+
+   pointer_client->client = client;
+   wl_list_init(&pointer_client->pointer_resources);
+
+   return pointer_client;
+}
+
+static void
+weston_pointer_client_destroy(struct weston_pointer_client *pointer_client)
+{
+   free(pointer_client);
+}
+
+static bool
+weston_pointer_client_is_empty(struct weston_pointer_client *pointer_client)
+{
+   return wl_list_empty(&pointer_client->pointer_resources);
+}
+
+static struct weston_pointer_client *
+weston_pointer_get_pointer_client(struct weston_pointer *pointer,
+ struct wl_client *client)
+{
+   struct weston_pointer_client *pointer_client;
+
+   wl_list_for_each(pointer_client, &pointer->pointer_clients, link) {
+   if (pointer_client->client == client)
+   return pointer_client;
+   }
+
+   return NULL;
+}
+
+static struct weston_pointer_client *
+weston_pointer_ensure_pointer_client(struct weston_pointer *pointer,
+struct wl_client *client)
+{
+   struct weston_pointer_client *pointer_client;
+
+   pointer_client = weston_pointer_get_pointer_client(pointer, client);
+   if (pointer_client)
+   return pointer_client;
+
+   pointer_client = weston_pointer_client_create(client);
+   wl_list_insert(&pointer->pointer_

[PATCH weston v4 01/20] input: Make pointer grab motion callbacks take an event struct

2015-11-17 Thread Jonas Ådahl
Instead of only passing absolute pointer coordinates, effectively
loosing motion event data, pass a struct that can potentially contain
different types of motion events, currently being absolute and relative.

A helper function to get resulting absolute coordinates was added for
when previous callbacks simply used the (x, y) coordinates.

Signed-off-by: Jonas Ådahl 
---
 desktop-shell/exposay.c|  4 +--
 desktop-shell/shell.c  | 22 +
 ivi-shell/hmi-controller.c |  8 +++---
 src/compositor-x11.c   |  9 ++-
 src/compositor.h   | 24 +++---
 src/data-device.c  |  4 +--
 src/input.c| 61 +-
 src/libinput-device.c  | 13 ++
 tests/weston-test.c| 11 ++---
 9 files changed, 116 insertions(+), 40 deletions(-)

diff --git a/desktop-shell/exposay.c b/desktop-shell/exposay.c
index eb4070e..8bd55fb 100644
--- a/desktop-shell/exposay.c
+++ b/desktop-shell/exposay.c
@@ -348,12 +348,12 @@ exposay_focus(struct weston_pointer_grab *grab)
 
 static void
 exposay_motion(struct weston_pointer_grab *grab, uint32_t time,
-  wl_fixed_t x, wl_fixed_t y)
+  struct weston_pointer_motion_event *event)
 {
struct desktop_shell *shell =
container_of(grab, struct desktop_shell, exposay.grab_ptr);
 
-   weston_pointer_move(grab->pointer, x, y);
+   weston_pointer_move(grab->pointer, event);
 
exposay_pick(shell,
 wl_fixed_to_int(grab->pointer->x),
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index 00c3260..d58a830 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -1632,14 +1632,14 @@ constrain_position(struct weston_move_grab *move, int 
*cx, int *cy)
 
 static void
 move_grab_motion(struct weston_pointer_grab *grab, uint32_t time,
-wl_fixed_t x, wl_fixed_t y)
+struct weston_pointer_motion_event *event)
 {
struct weston_move_grab *move = (struct weston_move_grab *) grab;
struct weston_pointer *pointer = grab->pointer;
struct shell_surface *shsurf = move->base.shsurf;
int cx, cy;
 
-   weston_pointer_move(pointer, x, y);
+   weston_pointer_move(pointer, event);
if (!shsurf)
return;
 
@@ -1758,7 +1758,7 @@ struct weston_resize_grab {
 
 static void
 resize_grab_motion(struct weston_pointer_grab *grab, uint32_t time,
-  wl_fixed_t x, wl_fixed_t y)
+  struct weston_pointer_motion_event *event)
 {
struct weston_resize_grab *resize = (struct weston_resize_grab *) grab;
struct weston_pointer *pointer = grab->pointer;
@@ -1767,7 +1767,7 @@ resize_grab_motion(struct weston_pointer_grab *grab, 
uint32_t time,
wl_fixed_t from_x, from_y;
wl_fixed_t to_x, to_y;
 
-   weston_pointer_move(pointer, x, y);
+   weston_pointer_move(pointer, event);
 
if (!shsurf)
return;
@@ -1973,9 +1973,9 @@ busy_cursor_grab_focus(struct weston_pointer_grab *base)
 
 static void
 busy_cursor_grab_motion(struct weston_pointer_grab *grab, uint32_t time,
-   wl_fixed_t x, wl_fixed_t y)
+   struct weston_pointer_motion_event *event)
 {
-   weston_pointer_move(grab->pointer, x, y);
+   weston_pointer_move(grab->pointer, event);
 }
 
 static void
@@ -3141,18 +3141,20 @@ popup_grab_focus(struct weston_pointer_grab *grab)
 
 static void
 popup_grab_motion(struct weston_pointer_grab *grab, uint32_t time,
- wl_fixed_t x, wl_fixed_t y)
+ struct weston_pointer_motion_event *event)
 {
struct weston_pointer *pointer = grab->pointer;
struct wl_resource *resource;
+   wl_fixed_t x, y;
wl_fixed_t sx, sy;
 
if (pointer->focus) {
+   weston_pointer_motion_to_abs(pointer, event, &x, &y);
weston_view_from_global_fixed(pointer->focus, x, y,
  &pointer->sx, &pointer->sy);
}
 
-   weston_pointer_move(pointer, x, y);
+   weston_pointer_move(pointer, event);
 
wl_resource_for_each(resource, &pointer->focus_resource_list) {
weston_view_from_global_fixed(pointer->focus,
@@ -4812,7 +4814,7 @@ terminate_binding(struct weston_keyboard *keyboard, 
uint32_t time,
 
 static void
 rotate_grab_motion(struct weston_pointer_grab *grab, uint32_t time,
-  wl_fixed_t x, wl_fixed_t y)
+  struct weston_pointer_motion_event *event)
 {
struct rotate_grab *rotate =
container_of(grab, struct rotate_grab, base.grab);
@@ -4820,7 +4822,7 @@ rotate_grab_motion(struct weston_pointer_grab *grab, 
uint32_t time,
struct shell_surface *shsurf = rotate->base.shsurf;
float cx, cy, dx, dy, cposx, cposy, dposx, dposy, r;
 
-   weston_pointer_move(pointer, x, y);
+   weston_pointer_move(point

[PATCH weston v4 02/20] desktop-shell: Track the black surface by its view

2015-11-17 Thread Jonas Ådahl
In preparation for further refactoring.

Signed-off-by: Jonas Ådahl 
Signed-off-by: Arnaud Vrac 
---
 desktop-shell/shell.c | 34 +++---
 1 file changed, 19 insertions(+), 15 deletions(-)

diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index d58a830..bdabcbf 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -2737,7 +2737,8 @@ shell_surface_get_shell(struct shell_surface *shsurf)
 static int
 black_surface_get_label(struct weston_surface *surface, char *buf, size_t len)
 {
-   struct weston_surface *fs_surface = surface->configure_private;
+   struct weston_view *fs_view = surface->configure_private;
+   struct weston_surface *fs_surface = fs_view->surface;
int n;
int rem;
int ret;
@@ -2766,7 +2767,7 @@ black_surface_configure(struct weston_surface *es, 
int32_t sx, int32_t sy);
 
 static struct weston_view *
 create_black_surface(struct weston_compositor *ec,
-struct weston_surface *fs_surface,
+struct weston_view *fs_view,
 float x, float y, int w, int h)
 {
struct weston_surface *surface = NULL;
@@ -2785,7 +2786,7 @@ create_black_surface(struct weston_compositor *ec,
}
 
surface->configure = black_surface_configure;
-   surface->configure_private = fs_surface;
+   surface->configure_private = fs_view;
weston_surface_set_label_func(surface, black_surface_get_label);
weston_surface_set_color(surface, 0.0, 0.0, 0.0, 1);
pixman_region32_fini(&surface->opaque);
@@ -2809,7 +2810,7 @@ shell_ensure_fullscreen_black_view(struct shell_surface 
*shsurf)
if (!shsurf->fullscreen.black_view)
shsurf->fullscreen.black_view =
create_black_surface(shsurf->surface->compositor,
-shsurf->surface,
+shsurf->view,
 output->x, output->y,
 output->width,
 output->height);
@@ -5080,11 +5081,13 @@ black_surface_configure(struct weston_surface *es, 
int32_t sx, int32_t sy)
 }
 
 static bool
-is_black_surface (struct weston_surface *es, struct weston_surface 
**fs_surface)
+is_black_surface_view(struct weston_view *view, struct weston_view **fs_view)
 {
-   if (es->configure == black_surface_configure) {
-   if (fs_surface)
-   *fs_surface = (struct weston_surface 
*)es->configure_private;
+   struct weston_surface *surface = view->surface;
+
+   if (surface->configure == black_surface_configure) {
+   if (fs_view)
+   *fs_view = surface->configure_private;
return true;
}
return false;
@@ -5095,19 +5098,20 @@ activate_binding(struct weston_seat *seat,
 struct desktop_shell *shell,
 struct weston_view *focus_view)
 {
-   struct weston_surface *focus;
+   struct weston_view *main_view;
struct weston_surface *main_surface;
 
-   focus = focus_view->surface;
+   if (!focus_view)
+   return;
 
-   if (is_black_surface(focus, &main_surface))
-   focus = main_surface;
+   if (is_black_surface_view(focus_view, &main_view))
+   focus_view = main_view;
 
-   main_surface = weston_surface_get_main_surface(focus);
+   main_surface = weston_surface_get_main_surface(focus_view->surface);
if (get_shell_surface_type(main_surface) == SHELL_SURFACE_NONE)
return;
 
-   activate(shell, focus, seat, true);
+   activate(shell, focus_view->surface, seat, true);
 }
 
 static void
@@ -5916,7 +5920,7 @@ switcher_next(struct switcher *switcher)
weston_surface_damage(view->surface);
}
 
-   if (is_black_surface(view->surface, NULL)) {
+   if (is_black_surface_view(view, NULL)) {
view->alpha = 0.25;
weston_view_geometry_dirty(view);
weston_surface_damage(view->surface);
-- 
2.4.3

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH wayland-protocols 2/2] Introduce pointer locking and confinement protocol

2015-11-17 Thread Jonas Ådahl
This patch introduces a new protocol for locking and confining a
pointer. It consists of a new global object with two requests; one for
locking the surface to a position, one for confining the pointer to a
given region.

Signed-off-by: Jonas Ådahl 
---

Changes since last version sent as weston patches:

Interfaces and protocol renamed according to wayland-protocols naming
conventions.

The global interface is now called wl_pointer_constraints instead of
wl_pointer_lock.

The position hint is now double buffered.

Various other minor changes.


Jonas


 Makefile.am|   1 +
 unstable/pointer-constraints/README|   4 +
 .../pointer-constraints-unstable-v1.xml| 283 +
 3 files changed, 288 insertions(+)
 create mode 100644 unstable/pointer-constraints/README
 create mode 100644 
unstable/pointer-constraints/pointer-constraints-unstable-v1.xml

diff --git a/Makefile.am b/Makefile.am
index 2db6bd5..983ae1b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -6,6 +6,7 @@ nobase_dist_pkgdata_DATA =  
\
unstable/input-method/input-method-unstable-v1.xml  
\
unstable/xdg-shell/xdg-shell-unstable-v5.xml
\
unstable/relative-pointer/relative-pointer-unstable-v1.xml  
\
+   unstable/pointer-constraints/pointer-constraints-unstable-v1.xml
\
$(NULL)
 
 pkgconfigdir = $(libdir)/pkgconfig
diff --git a/unstable/pointer-constraints/README 
b/unstable/pointer-constraints/README
new file mode 100644
index 000..8a242f8
--- /dev/null
+++ b/unstable/pointer-constraints/README
@@ -0,0 +1,4 @@
+Pointer constraints protocol
+
+Maintainers:
+Jonas Ådahl 
diff --git a/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml 
b/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml
new file mode 100644
index 000..c71d6d5
--- /dev/null
+++ b/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml
@@ -0,0 +1,283 @@
+
+
+
+  
+Copyright © 2014  Jonas Ådahl
+Copyright © 2015  Red Hat Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice (including the next
+paragraph) shall be included in all copies or substantial portions of the
+Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+  
+
+  
+
+  The global interface exposing pointer constraining functionality. It
+  exposes two requests; lock_pointer for locking the pointer to its
+  position, and confine_pointer for locking the pointer to a region.
+
+  The lock_pointer and confine_pointer creates the objects 
wp_locked_pointer
+  and wp_confined_pointer respectively, and the client can use these 
objects
+  to interact with the lock.
+
+  For any surface, only one lock or confinement per seat may be active at
+  any time. If a lock or confinement is requested when another lock or
+  confinement is active or requested on that surface and seat, an
+  'already_constrained' error will be raised.
+
+  Warning! The protocol described in this file is experimental and
+  backward incompatible changes may be made. Backward compatible changes
+  may be added together with the corresponding interface version bump.
+  Backward incompatible changes are done by bumping the version number in
+  the protocol and interface names and resetting the interface version.
+  Once the protocol is to be declared stable, the 'z' prefix and the
+  version number in the protocol and interface names are removed and the
+  interface version number is reset.
+
+
+
+  
+These errors can be emitted in response to wp_pointer_constraints
+requests.
+  
+  
+
+
+
+  
+   The lock_pointer request lets the client disable absolute pointer
+   movements, locking the pointer to a position. In the future, when the
+   compositor deems implementation specific constraints are satisfied, the
+ 

[PATCH wayland-protocols 1/2] Introduce wp_relative_pointer interface

2015-11-17 Thread Jonas Ådahl
The wp_relative_pointer interface is an extension to the wl_pointer
interface created from wl_seat. It has the same focus, but adds the
functionality of sending relative pointer motions unhindered by
constraints such as monitor edges or other barriers. It also contains
unaccelerated pointer motion information.

Signed-off-by: Jonas Ådahl 
---

There has alreay been RBs on this protocol, but I'd like to get them
explicitly re-RB:ed considering that the protocol has changed some, even
though the changes have not been major ones.


Changes since the last version sent as weston patches:

Interfaces and protocol renamed according to wayland-protocols naming
conventions.

Accelerated and unaccelerated motion deltas have the data type
wl_fixed_t now again. 64 bit fixed point deltas was deemed unnecessary,
and wl_double_fixed_t was dropped.

64 bit timestamp argument name suffix changed from msb/lsb to hi/lo.

Various other minor changes.


Jonas


 Makefile.am|   1 +
 unstable/relative-pointer/README   |   4 +
 .../relative-pointer-unstable-v1.xml   | 122 +
 3 files changed, 127 insertions(+)
 create mode 100644 unstable/relative-pointer/README
 create mode 100644 unstable/relative-pointer/relative-pointer-unstable-v1.xml

diff --git a/Makefile.am b/Makefile.am
index f1bac16..2db6bd5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -5,6 +5,7 @@ nobase_dist_pkgdata_DATA =  
\
unstable/text-input/text-input-unstable-v1.xml  
\
unstable/input-method/input-method-unstable-v1.xml  
\
unstable/xdg-shell/xdg-shell-unstable-v5.xml
\
+   unstable/relative-pointer/relative-pointer-unstable-v1.xml  
\
$(NULL)
 
 pkgconfigdir = $(libdir)/pkgconfig
diff --git a/unstable/relative-pointer/README b/unstable/relative-pointer/README
new file mode 100644
index 000..64c42a1
--- /dev/null
+++ b/unstable/relative-pointer/README
@@ -0,0 +1,4 @@
+Relative pointer protocol
+
+Maintainers:
+Jonas Ådahl 
diff --git a/unstable/relative-pointer/relative-pointer-unstable-v1.xml 
b/unstable/relative-pointer/relative-pointer-unstable-v1.xml
new file mode 100644
index 000..0411d1f
--- /dev/null
+++ b/unstable/relative-pointer/relative-pointer-unstable-v1.xml
@@ -0,0 +1,122 @@
+
+
+
+  
+Copyright © 2014  Jonas Ådahl
+Copyright © 2015  Red Hat Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice (including the next
+paragraph) shall be included in all copies or substantial portions of the
+Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
+  
+
+  
+
+  A global interface used for getting the relative pointer object for a
+  given seat.
+
+  Warning! The protocol described in this file is experimental and backward
+  incompatible changes may be made. Backward compatible changes may be 
added
+  together with the corresponding interface version bump.  Backward
+  incompatible changes are done by bumping the version number in the
+  protocol and interface names and resetting the interface version.  Once
+  the protocol is to be declared stable, the 'z' prefix and the version
+  number in the protocol and interface names are removed and the interface
+  version number is reset.
+
+
+
+  
+   Used by the client to notify the server that it will no longer use this
+   relative pointer manager object.
+  
+
+
+
+  
+   Create a relative pointer interface given a wl_pointer object. See the
+   wp_relative_pointer interface for more details.
+  
+
+  
+  
+
+  
+
+  
+
+  A wp_relative_pointer object is an extension to the wl_pointer interface
+  used for emitting relative pointer events. It shares the same focus as
+  wl_pointer objects of the same seat and will only emit events when it has
+  focus.
+
+
+
+  
+
+

[PATCH weston v2 4/9] Use input method protocol from wayland-protocols

2015-11-17 Thread Jonas Ådahl
Signed-off-by: Jonas Ådahl 
Reviewed-by: Mariusz Ceier 
Reviewed-by: Jan Arne Petersen 
---
 Makefile.am |  17 ++-
 clients/keyboard.c  | 174 +-
 clients/weston-simple-im.c  | 130 ++--
 desktop-shell/input-panel.c |  14 ++-
 ivi-shell/input-panel-ivi.c |  14 ++-
 protocol/input-method.xml   | 291 
 src/text-backend.c  |  29 +++--
 7 files changed, 199 insertions(+), 470 deletions(-)
 delete mode 100644 protocol/input-method.xml

diff --git a/Makefile.am b/Makefile.am
index cd6b3fc..4c70559 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -119,8 +119,8 @@ nodist_weston_SOURCES = 
\
protocol/text-cursor-position-server-protocol.h \
protocol/text-input-unstable-v1-protocol.c  \
protocol/text-input-unstable-v1-server-protocol.h   \
-   protocol/input-method-protocol.c\
-   protocol/input-method-server-protocol.h \
+   protocol/input-method-unstable-v1-protocol.c\
+   protocol/input-method-unstable-v1-server-protocol.h \
protocol/workspaces-protocol.c  \
protocol/workspaces-server-protocol.h   \
protocol/presentation_timing-protocol.c \
@@ -696,15 +696,15 @@ weston_keyboard_SOURCES = clients/keyboard.c
 nodist_weston_keyboard_SOURCES =   \
protocol/desktop-shell-client-protocol.h\
protocol/desktop-shell-protocol.c   \
-   protocol/input-method-protocol.c\
-   protocol/input-method-client-protocol.h
+   protocol/input-method-unstable-v1-protocol.c\
+   protocol/input-method-unstable-v1-client-protocol.h
 weston_keyboard_LDADD = libtoytoolkit.la
 weston_keyboard_CFLAGS = $(AM_CFLAGS) $(CLIENT_CFLAGS)
 
 weston_simple_im_SOURCES = clients/weston-simple-im.c
 nodist_weston_simple_im_SOURCES =  \
-   protocol/input-method-protocol.c\
-   protocol/input-method-client-protocol.h
+   protocol/input-method-unstable-v1-protocol.c\
+   protocol/input-method-unstable-v1-client-protocol.h
 weston_simple_im_LDADD = $(CLIENT_LIBS)
 weston_simple_im_CFLAGS = $(AM_CFLAGS) $(CLIENT_CFLAGS)
 
@@ -755,8 +755,8 @@ BUILT_SOURCES +=\
protocol/text-cursor-position-protocol.c\
protocol/text-input-unstable-v1-protocol.c  \
protocol/text-input-unstable-v1-client-protocol.h   \
-   protocol/input-method-protocol.c\
-   protocol/input-method-client-protocol.h \
+   protocol/input-method-unstable-v1-protocol.c\
+   protocol/input-method-unstable-v1-client-protocol.h \
protocol/desktop-shell-client-protocol.h\
protocol/desktop-shell-protocol.c   \
protocol/scaler-client-protocol.h   \
@@ -1342,7 +1342,6 @@ BUILT_SOURCES +=  \
 EXTRA_DIST +=  \
protocol/desktop-shell.xml  \
protocol/screenshooter.xml  \
-   protocol/input-method.xml   \
protocol/workspaces.xml \
protocol/text-cursor-position.xml   \
protocol/weston-test.xml\
diff --git a/clients/keyboard.c b/clients/keyboard.c
index e1f8ad3..b843fda 100644
--- a/clients/keyboard.c
+++ b/clients/keyboard.c
@@ -32,15 +32,15 @@
 #include 
 
 #include "window.h"
-#include "input-method-client-protocol.h"
+#include "input-method-unstable-v1-client-protocol.h"
 #include "text-input-unstable-v1-client-protocol.h"
 
 struct keyboard;
 
 struct virtual_keyboard {
-   struct wl_input_panel *input_panel;
-   struct wl_input_method *input_method;
-   struct wl_input_method_context *context;
+   struct zwp_input_panel_v1 *input_panel;
+   struct zwp_input_method_v1 *input_method;
+   struct zwp_input_method_context_v1 *context;
struct display *display;
struct output *output;
char *preedit_string;
@@ -427,11 +427,11 @@ virtual_keyboard_commit_preedit(struct virtual_keyboard 
*keyboard)
strlen(keyboard->preedit_string) == 0)
return;
 
-   wl_input_method_context_cursor_position(keyboard->context,
-   0, 0);
-   wl_input_method_context_commit_string(keyboard->context,
- keyboard->serial,
- keyboard->preedit_string);
+   zwp_input_method_context_v1_cursor_position(keyboard->context,
+   0, 0);
+   zwp_input_method_context_v1_commit_string(keyboard->context,
+

[PATCH weston v2 1/9] Use fullscreen-shell.xml from wayland-protocols

2015-11-17 Thread Jonas Ådahl
Use the fullscreen-shell protocol XML from the wayland-protocols
installation, and remove the one we provide ourself.

Signed-off-by: Jonas Ådahl 
Reviewed-by: Mariusz Ceier 
Acked-by: Jason Ekstrand 
---
 Makefile.am |  44 +---
 clients/fullscreen.c|  60 +--
 clients/simple-damage.c |  18 ++--
 clients/simple-dmabuf.c |  18 ++--
 clients/simple-shm.c|  18 ++--
 configure.ac|   4 +
 fullscreen-shell/fullscreen-shell.c |  55 +-
 protocol/fullscreen-shell.xml   | 206 
 src/compositor-wayland.c|  58 +-
 src/screen-share.c  |  36 ---
 10 files changed, 164 insertions(+), 353 deletions(-)
 delete mode 100644 protocol/fullscreen-shell.xml

diff --git a/Makefile.am b/Makefile.am
index 55e3bcb..2524591 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -309,8 +309,8 @@ wayland_backend_la_SOURCES =\
src/compositor-wayland.c\
shared/helpers.h
 nodist_wayland_backend_la_SOURCES =\
-   protocol/fullscreen-shell-protocol.c\
-   protocol/fullscreen-shell-client-protocol.h
+   protocol/fullscreen-shell-unstable-v1-protocol.c\
+   protocol/fullscreen-shell-unstable-v1-client-protocol.h
 endif
 
 if ENABLE_RPI_COMPOSITOR
@@ -475,8 +475,8 @@ weston_simple_shm_SOURCES = clients/simple-shm.c
 nodist_weston_simple_shm_SOURCES = \
protocol/xdg-shell-protocol.c   \
protocol/xdg-shell-client-protocol.h\
-   protocol/fullscreen-shell-protocol.c\
-   protocol/fullscreen-shell-client-protocol.h \
+   protocol/fullscreen-shell-unstable-v1-protocol.c\
+   protocol/fullscreen-shell-unstable-v1-client-protocol.h \
protocol/ivi-application-protocol.c \
protocol/ivi-application-client-protocol.h
 weston_simple_shm_CFLAGS = $(AM_CFLAGS) $(SIMPLE_CLIENT_CFLAGS)
@@ -488,8 +488,8 @@ nodist_weston_simple_damage_SOURCES =   \
protocol/scaler-client-protocol.h   \
protocol/xdg-shell-protocol.c   \
protocol/xdg-shell-client-protocol.h\
-   protocol/fullscreen-shell-protocol.c\
-   protocol/fullscreen-shell-client-protocol.h
+   protocol/fullscreen-shell-unstable-v1-protocol.c\
+   protocol/fullscreen-shell-unstable-v1-client-protocol.h
 weston_simple_damage_CFLAGS = $(AM_CFLAGS) $(SIMPLE_CLIENT_CFLAGS)
 weston_simple_damage_LDADD = $(SIMPLE_CLIENT_LIBS) libshared.la
 
@@ -531,8 +531,8 @@ weston_simple_dmabuf_SOURCES = clients/simple-dmabuf.c
 nodist_weston_simple_dmabuf_SOURCES =  \
protocol/xdg-shell-protocol.c   \
protocol/xdg-shell-client-protocol.h\
-   protocol/fullscreen-shell-protocol.c\
-   protocol/fullscreen-shell-client-protocol.h \
+   protocol/fullscreen-shell-unstable-v1-protocol.c\
+   protocol/fullscreen-shell-unstable-v1-client-protocol.h \
protocol/linux-dmabuf-protocol.c \
protocol/linux-dmabuf-client-protocol.h
 weston_simple_dmabuf_CFLAGS = $(AM_CFLAGS) $(SIMPLE_DMABUF_CLIENT_CFLAGS)
@@ -649,8 +649,8 @@ weston_transformed_CFLAGS = $(AM_CFLAGS) $(CLIENT_CFLAGS)
 
 weston_fullscreen_SOURCES = clients/fullscreen.c
 nodist_weston_fullscreen_SOURCES = \
-   protocol/fullscreen-shell-protocol.c\
-   protocol/fullscreen-shell-client-protocol.h
+   protocol/fullscreen-shell-unstable-v1-protocol.c\
+   protocol/fullscreen-shell-unstable-v1-client-protocol.h
 weston_fullscreen_LDADD = libtoytoolkit.la
 weston_fullscreen_CFLAGS = $(AM_CFLAGS) $(CLIENT_CFLAGS)
 
@@ -763,8 +763,8 @@ BUILT_SOURCES +=\
protocol/scaler-protocol.c  \
protocol/workspaces-client-protocol.h   \
protocol/workspaces-protocol.c  \
-   protocol/fullscreen-shell-protocol.c\
-   protocol/fullscreen-shell-client-protocol.h \
+   protocol/fullscreen-shell-unstable-v1-protocol.c\
+   protocol/fullscreen-shell-unstable-v1-client-protocol.h \
protocol/xdg-shell-protocol.c   \
protocol/xdg-shell-client-protocol.h\
protocol/ivi-hmi-controller-protocol.c  \
@@ -865,8 +865,8 @@ fullscreen_shell_la_SOURCES =   \
fullscreen-shell/fullscreen-shell.c \
shared/helpers.h
 nodist_fullscreen_shell_la_SOURCES =   \
-   protocol/fullscreen-shell-protocol.c\
-   protocol/fullscreen-shell-server-protocol.h
+   protocol/fullscreen-shell-unstable-v1-protocol.c\
+   protocol/fullscreen-shell-unstable-v1-server-protocol.h
 
 BUILT_SOURCES += $(nodist_fulls

[PATCH weston v2 8/9] Rename screenshooter protocol to weston_screenshooter

2015-11-17 Thread Jonas Ådahl
Due to the effort of moving a way from non-prefixed protocols, rename
the weston specific screenshooter protocol to weston_screenshooter.

Signed-off-by: Jonas Ådahl 
Reviewed-by: Mariusz Ceier 
Acked-by: Pekka Paalanen 
---
 Makefile.am   | 14 +++---
 clients/screenshot.c  | 21 +
 protocol/screenshooter.xml| 12 
 protocol/weston-screenshooter.xml | 12 
 src/screenshooter.c   | 10 +-
 5 files changed, 37 insertions(+), 32 deletions(-)
 delete mode 100644 protocol/screenshooter.xml
 create mode 100644 protocol/weston-screenshooter.xml

diff --git a/Makefile.am b/Makefile.am
index 1bced97..bbd504f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -113,8 +113,8 @@ systemd_notify_la_SOURCES = \
 endif
 
 nodist_weston_SOURCES =\
-   protocol/screenshooter-protocol.c   \
-   protocol/screenshooter-server-protocol.h\
+   protocol/weston-screenshooter-protocol.c\
+   protocol/weston-screenshooter-server-protocol.h \
protocol/text-cursor-position-protocol.c\
protocol/text-cursor-position-server-protocol.h \
protocol/text-input-unstable-v1-protocol.c  \
@@ -577,8 +577,8 @@ weston_flower_CFLAGS = $(AM_CFLAGS) $(CLIENT_CFLAGS)
 weston_screenshooter_SOURCES = \
clients/screenshot.c
 nodist_weston_screenshooter_SOURCES =  \
-   protocol/screenshooter-protocol.c   \
-   protocol/screenshooter-client-protocol.h
+   protocol/weston-screenshooter-protocol.c\
+   protocol/weston-screenshooter-client-protocol.h
 weston_screenshooter_LDADD = $(CLIENT_LIBS) libshared.la
 weston_screenshooter_CFLAGS = $(AM_CFLAGS) $(CLIENT_CFLAGS)
 
@@ -749,8 +749,8 @@ endif
 endif
 
 BUILT_SOURCES +=   \
-   protocol/screenshooter-protocol.c   \
-   protocol/screenshooter-client-protocol.h\
+   protocol/weston-screenshooter-protocol.c\
+   protocol/weston-screenshooter-client-protocol.h \
protocol/text-cursor-position-client-protocol.h \
protocol/text-cursor-position-protocol.c\
protocol/text-input-unstable-v1-protocol.c  \
@@ -1341,7 +1341,7 @@ BUILT_SOURCES +=  \
 
 EXTRA_DIST +=  \
protocol/weston-desktop-shell.xml   \
-   protocol/screenshooter.xml  \
+   protocol/weston-screenshooter.xml   \
protocol/workspaces.xml \
protocol/text-cursor-position.xml   \
protocol/weston-test.xml\
diff --git a/clients/screenshot.c b/clients/screenshot.c
index f11e3ba..18b5f88 100644
--- a/clients/screenshot.c
+++ b/clients/screenshot.c
@@ -36,7 +36,7 @@
 #include 
 
 #include 
-#include "screenshooter-client-protocol.h"
+#include "weston-screenshooter-client-protocol.h"
 #include "shared/os-compatibility.h"
 
 /* The screenshooter is a good example of a custom object exposed by
@@ -44,7 +44,7 @@
  * side marshalling outside libwayland.so */
 
 static struct wl_shm *shm;
-static struct screenshooter *screenshooter;
+static struct weston_screenshooter *screenshooter;
 static struct wl_list output_list;
 int min_x, min_y, max_x, max_y;
 int buffer_copy_done;
@@ -118,12 +118,12 @@ static const struct wl_output_listener output_listener = {
 };
 
 static void
-screenshot_done(void *data, struct screenshooter *screenshooter)
+screenshot_done(void *data, struct weston_screenshooter *screenshooter)
 {
buffer_copy_done = 1;
 }
 
-static const struct screenshooter_listener screenshooter_listener = {
+static const struct weston_screenshooter_listener screenshooter_listener = {
screenshot_done
 };
 
@@ -141,9 +141,10 @@ handle_global(void *data, struct wl_registry *registry,
wl_output_add_listener(output->output, &output_listener, 
output);
} else if (strcmp(interface, "wl_shm") == 0) {
shm = wl_registry_bind(registry, name, &wl_shm_interface, 1);
-   } else if (strcmp(interface, "screenshooter") == 0) {
+   } else if (strcmp(interface, "weston_screenshooter") == 0) {
screenshooter = wl_registry_bind(registry, name,
-&screenshooter_interface, 1);
+
&weston_screenshooter_interface,
+1);
}
 }
 
@@ -290,7 +291,9 @@ int main(int argc, char *argv[])
return -1;
}
 
-   screenshooter_add_listener(screenshooter, &screenshooter_listener, 
screenshooter);
+   weston_screenshooter_add_listener(screenshooter,
+ 

[PATCH weston v2 3/9] Use text input protocol from wayland-protocols

2015-11-17 Thread Jonas Ådahl
Signed-off-by: Jonas Ådahl 
Reviewed-by: Mariusz Ceier 
Reviewed-by: Jan Arne Petersen 
---
 Makefile.am|  21 ++-
 clients/editor.c   | 119 +
 clients/keyboard.c |  12 +-
 protocol/text.xml  | 374 -
 src/text-backend.c |  56 
 tests/text-test.c  |  54 
 6 files changed, 135 insertions(+), 501 deletions(-)
 delete mode 100644 protocol/text.xml

diff --git a/Makefile.am b/Makefile.am
index 9f7cc9d..cd6b3fc 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -117,8 +117,8 @@ nodist_weston_SOURCES = 
\
protocol/screenshooter-server-protocol.h\
protocol/text-cursor-position-protocol.c\
protocol/text-cursor-position-server-protocol.h \
-   protocol/text-protocol.c\
-   protocol/text-server-protocol.h \
+   protocol/text-input-unstable-v1-protocol.c  \
+   protocol/text-input-unstable-v1-server-protocol.h   \
protocol/input-method-protocol.c\
protocol/input-method-server-protocol.h \
protocol/workspaces-protocol.c  \
@@ -686,8 +686,8 @@ weston_editor_SOURCES = \
clients/editor.c\
shared/helpers.h
 nodist_weston_editor_SOURCES = \
-   protocol/text-protocol.c\
-   protocol/text-client-protocol.h
+   protocol/text-input-unstable-v1-protocol.c  \
+   protocol/text-input-unstable-v1-client-protocol.h
 weston_editor_LDADD = libtoytoolkit.la $(PANGO_LIBS)
 weston_editor_CFLAGS = $(AM_CFLAGS) $(CLIENT_CFLAGS) $(PANGO_CFLAGS)
 endif
@@ -753,8 +753,8 @@ BUILT_SOURCES +=\
protocol/screenshooter-client-protocol.h\
protocol/text-cursor-position-client-protocol.h \
protocol/text-cursor-position-protocol.c\
-   protocol/text-protocol.c\
-   protocol/text-client-protocol.h \
+   protocol/text-input-unstable-v1-protocol.c  \
+   protocol/text-input-unstable-v1-client-protocol.h   \
protocol/input-method-protocol.c\
protocol/input-method-client-protocol.h \
protocol/desktop-shell-client-protocol.h\
@@ -1212,8 +1212,8 @@ devices_weston_LDADD = libtest-client.la
 
 text_weston_SOURCES = tests/text-test.c
 nodist_text_weston_SOURCES =   \
-   protocol/text-protocol.c\
-   protocol/text-client-protocol.h
+   protocol/text-input-unstable-v1-protocol.c  \
+   protocol/text-input-unstable-v1-client-protocol.h
 text_weston_CFLAGS = $(AM_CFLAGS) $(TEST_CLIENT_CFLAGS)
 text_weston_LDADD = libtest-client.la
 
@@ -1336,13 +1336,12 @@ BUILT_SOURCES +=\
protocol/weston-test-protocol.c \
protocol/weston-test-server-protocol.h  \
protocol/weston-test-client-protocol.h  \
-   protocol/text-protocol.c\
-   protocol/text-client-protocol.h
+   protocol/text-input-unstable-v1-protocol.c  \
+   protocol/text-input-unstable-v1-client-protocol.h
 
 EXTRA_DIST +=  \
protocol/desktop-shell.xml  \
protocol/screenshooter.xml  \
-   protocol/text.xml   \
protocol/input-method.xml   \
protocol/workspaces.xml \
protocol/text-cursor-position.xml   \
diff --git a/clients/editor.c b/clients/editor.c
index 7d388a4..311bdb5 100644
--- a/clients/editor.c
+++ b/clients/editor.c
@@ -38,7 +38,7 @@
 
 #include "shared/helpers.h"
 #include "window.h"
-#include "text-client-protocol.h"
+#include "text-input-unstable-v1-client-protocol.h"
 
 struct text_entry {
struct widget *widget;
@@ -64,7 +64,7 @@ struct text_entry {
uint32_t delete_length;
bool invalid_delete;
} pending_commit;
-   struct wl_text_input *text_input;
+   struct zwp_text_input_v1 *text_input;
PangoLayout *layout;
struct {
xkb_mod_mask_t shift_mask;
@@ -78,7 +78,7 @@ struct text_entry {
 };
 
 struct editor {
-   struct wl_text_input_manager *text_input_manager;
+   struct zwp_text_input_manager_v1 *text_input_manager;
struct wl_data_source *selection;
char *selected_text;
struct display *display;
@@ -182,7 +182,7 @@ static void text_entry_update(struct text_entry *entry);
 
 static void
 text_input_commit_string(void *data,
-struct wl_text_input *text_input,
+struct zwp_text_input_v1 *text_input,
 uint32_t serial,
 const char *text)
 {
@@ -234,7

[PATCH weston v2 5/9] Makefile.am: Make the external xml scanning rule version generic

2015-11-17 Thread Jonas Ådahl
Signed-off-by: Jonas Ådahl 
Reviewed-by: Mariusz Ceier 
---
 Makefile.am | 14 +++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 4c70559..0435702 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1415,13 +1415,21 @@ doc: $(DOXYGEN_INDICES)
 
 .SECONDEXPANSION:
 
-protocol/%-unstable-v1-protocol.c : 
$(WAYLAND_PROTOCOLS_DATADIR)/unstable/$$*/$$*-unstable-v1.xml
+define protostability
+$(shell echo $1 | sed 's/.*\(\\|\\).*/\1/')
+endef
+
+define protoname
+$(shell echo $1 | sed 's/\([a-z\-]\+\)-[a-z]\+-v[0-9]\+/\1/')
+endef
+
+protocol/%-protocol.c : $(WAYLAND_PROTOCOLS_DATADIR)/$$(call 
protostability,$$*)/$$(call protoname,$$*)/$$*.xml
$(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(wayland_scanner) code < $< > $@
 
-protocol/%-unstable-v1-server-protocol.h : 
$(WAYLAND_PROTOCOLS_DATADIR)/unstable/$$*/$$*-unstable-v1.xml
+protocol/%-server-protocol.h : $(WAYLAND_PROTOCOLS_DATADIR)/$$(call 
protostability,$$*)/$$(call protoname,$$*)/$$*.xml
$(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(wayland_scanner) server-header < 
$< > $@
 
-protocol/%-unstable-v1-client-protocol.h : 
$(WAYLAND_PROTOCOLS_DATADIR)/unstable/$$*/$$*-unstable-v1.xml
+protocol/%-client-protocol.h : $(WAYLAND_PROTOCOLS_DATADIR)/$$(call 
protostability,$$*)/$$(call protoname,$$*)/$$*.xml
$(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(wayland_scanner) client-header < 
$< > $@
 
 protocol/%-protocol.c : $(top_srcdir)/protocol/%.xml
-- 
2.4.3

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH weston v2 2/9] Use linux-dmabuf protocol from wayland-protocols

2015-11-17 Thread Jonas Ådahl
Signed-off-by: Jonas Ådahl 
Reviewed-by: Mariusz Ceier 
Acked-by: Pekka Paalanen 
---
 Makefile.am   |  13 +--
 clients/simple-dmabuf.c   |  60 +-
 protocol/linux-dmabuf.xml | 274 --
 src/gl-renderer.c |   6 +-
 src/linux-dmabuf.c|  48 
 5 files changed, 63 insertions(+), 338 deletions(-)
 delete mode 100644 protocol/linux-dmabuf.xml

diff --git a/Makefile.am b/Makefile.am
index 2524591..9f7cc9d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -127,8 +127,8 @@ nodist_weston_SOURCES = 
\
protocol/presentation_timing-server-protocol.h  \
protocol/scaler-protocol.c  \
protocol/scaler-server-protocol.h   \
-   protocol/linux-dmabuf-protocol.c\
-   protocol/linux-dmabuf-server-protocol.h
+   protocol/linux-dmabuf-unstable-v1-protocol.c\
+   protocol/linux-dmabuf-unstable-v1-server-protocol.h
 
 BUILT_SOURCES += $(nodist_weston_SOURCES)
 
@@ -533,11 +533,11 @@ nodist_weston_simple_dmabuf_SOURCES = \
protocol/xdg-shell-client-protocol.h\
protocol/fullscreen-shell-unstable-v1-protocol.c\
protocol/fullscreen-shell-unstable-v1-client-protocol.h \
-   protocol/linux-dmabuf-protocol.c \
-   protocol/linux-dmabuf-client-protocol.h
+   protocol/linux-dmabuf-unstable-v1-protocol.c \
+   protocol/linux-dmabuf-unstable-v1-client-protocol.h
 weston_simple_dmabuf_CFLAGS = $(AM_CFLAGS) $(SIMPLE_DMABUF_CLIENT_CFLAGS)
 weston_simple_dmabuf_LDADD = $(SIMPLE_DMABUF_CLIENT_LIBS) libshared.la
-BUILT_SOURCES += protocol/linux-dmabuf-client-protocol.h
+BUILT_SOURCES += protocol/linux-dmabuf-unstable-v1-client-protocol.h
 endif
 
 noinst_LTLIBRARIES += libtoytoolkit.la
@@ -1351,8 +1351,7 @@ EXTRA_DIST += \
protocol/presentation_timing.xml\
protocol/scaler.xml \
protocol/ivi-application.xml\
-   protocol/ivi-hmi-controller.xml \
-   protocol/linux-dmabuf.xml
+   protocol/ivi-hmi-controller.xml
 
 #
 # manual test modules in tests subdirectory
diff --git a/clients/simple-dmabuf.c b/clients/simple-dmabuf.c
index 354af7b..1751dc4 100644
--- a/clients/simple-dmabuf.c
+++ b/clients/simple-dmabuf.c
@@ -42,7 +42,7 @@
 #include 
 #include "xdg-shell-client-protocol.h"
 #include "fullscreen-shell-unstable-v1-client-protocol.h"
-#include "linux-dmabuf-client-protocol.h"
+#include "linux-dmabuf-unstable-v1-client-protocol.h"
 
 struct display {
struct wl_display *display;
@@ -50,7 +50,7 @@ struct display {
struct wl_compositor *compositor;
struct xdg_shell *shell;
struct zwp_fullscreen_shell_v1 *fshell;
-   struct zlinux_dmabuf *dmabuf;
+   struct zwp_linux_dmabuf_v1 *dmabuf;
int xrgb_format_found;
 };
 
@@ -187,7 +187,7 @@ unmap_bo(struct buffer *my_buf)
 
 static void
 create_succeeded(void *data,
-struct zlinux_buffer_params *params,
+struct zwp_linux_buffer_params_v1 *params,
 struct wl_buffer *new_buffer)
 {
struct buffer *buffer = data;
@@ -195,22 +195,22 @@ create_succeeded(void *data,
buffer->buffer = new_buffer;
wl_buffer_add_listener(buffer->buffer, &buffer_listener, buffer);
 
-   zlinux_buffer_params_destroy(params);
+   zwp_linux_buffer_params_v1_destroy(params);
 }
 
 static void
-create_failed(void *data, struct zlinux_buffer_params *params)
+create_failed(void *data, struct zwp_linux_buffer_params_v1 *params)
 {
struct buffer *buffer = data;
 
buffer->buffer = NULL;
 
-   zlinux_buffer_params_destroy(params);
+   zwp_linux_buffer_params_v1_destroy(params);
 
-   fprintf(stderr, "Error: zlinux_buffer_params.create failed.\n");
+   fprintf(stderr, "Error: zwp_linux_buffer_params.create failed.\n");
 }
 
-static const struct zlinux_buffer_params_listener params_listener = {
+static const struct zwp_linux_buffer_params_v1_listener params_listener = {
create_succeeded,
create_failed
 };
@@ -219,7 +219,7 @@ static int
 create_dmabuf_buffer(struct display *display, struct buffer *buffer,
 int width, int height)
 {
-   struct zlinux_buffer_params *params;
+   struct zwp_linux_buffer_params_v1 *params;
uint64_t modifier;
uint32_t flags;
 
@@ -259,20 +259,20 @@ create_dmabuf_buffer(struct display *display, struct 
buffer *buffer,
modifier = 0;
flags = 0;
 
-   params = zlinux_dmabuf_create_params(display->dmabuf);
-   zlinux_buffer_params_add(params,
-buffer->dmabuf_fd,
-0, /* plane_idx */
-0, /* offset */
-buffer->stride,
-modifier >> 32,
-  

[PATCH weston v2 9/9] Remove workspaces protocol

2015-11-17 Thread Jonas Ådahl
It doesn't fill a useful function and is not intended to be continued.
If there is need for workspace manipulation from clients a protocol
based on those future needs need to be properly designed.
workspaces.xml is probably not very relevant since it did the bare
minimum.

Signed-off-by: Jonas Ådahl 
Reviewed-by: Mariusz Ceier 
Acked-by: Pekka Paalanen 
---
 Makefile.am |   7 ---
 clients/window.c|  58 +
 desktop-shell/shell.c   | 113 
 protocol/workspaces.xml |  27 
 4 files changed, 1 insertion(+), 204 deletions(-)
 delete mode 100644 protocol/workspaces.xml

diff --git a/Makefile.am b/Makefile.am
index bbd504f..cbb3b57 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -121,8 +121,6 @@ nodist_weston_SOURCES = 
\
protocol/text-input-unstable-v1-server-protocol.h   \
protocol/input-method-unstable-v1-protocol.c\
protocol/input-method-unstable-v1-server-protocol.h \
-   protocol/workspaces-protocol.c  \
-   protocol/workspaces-server-protocol.h   \
protocol/presentation_timing-protocol.c \
protocol/presentation_timing-server-protocol.h  \
protocol/scaler-protocol.c  \
@@ -552,8 +550,6 @@ nodist_libtoytoolkit_la_SOURCES =   \
protocol/text-cursor-position-client-protocol.h \
protocol/scaler-protocol.c  \
protocol/scaler-client-protocol.h   \
-   protocol/workspaces-protocol.c  \
-   protocol/workspaces-client-protocol.h   \
protocol/presentation_timing-protocol.c \
protocol/presentation_timing-client-protocol.h  \
protocol/xdg-shell-unstable-v5-protocol.c   \
@@ -761,8 +757,6 @@ BUILT_SOURCES +=\
protocol/weston-desktop-shell-protocol.c\
protocol/scaler-client-protocol.h   \
protocol/scaler-protocol.c  \
-   protocol/workspaces-client-protocol.h   \
-   protocol/workspaces-protocol.c  \
protocol/fullscreen-shell-unstable-v1-protocol.c\
protocol/fullscreen-shell-unstable-v1-client-protocol.h \
protocol/xdg-shell-unstable-v5-protocol.c   \
@@ -1342,7 +1336,6 @@ BUILT_SOURCES +=  \
 EXTRA_DIST +=  \
protocol/weston-desktop-shell.xml   \
protocol/weston-screenshooter.xml   \
-   protocol/workspaces.xml \
protocol/text-cursor-position.xml   \
protocol/weston-test.xml\
protocol/presentation_timing.xml\
diff --git a/clients/window.c b/clients/window.c
index 4b62988..f9797a2 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -70,7 +70,6 @@ typedef void *EGLContext;
 #include "shared/helpers.h"
 #include "xdg-shell-unstable-v5-client-protocol.h"
 #include "text-cursor-position-client-protocol.h"
-#include "workspaces-client-protocol.h"
 #include "shared/os-compatibility.h"
 
 #include "window.h"
@@ -96,7 +95,6 @@ struct display {
struct wl_shm *shm;
struct wl_data_device_manager *data_device_manager;
struct text_cursor_position *text_cursor_position;
-   struct workspace_manager *workspace_manager;
struct xdg_shell *xdg_shell;
struct ivi_application *ivi_application; /* ivi style shell */
EGLDisplay dpy;
@@ -132,9 +130,6 @@ struct display {
 
struct xkb_context *xkb_context;
 
-   uint32_t workspace;
-   uint32_t workspace_count;
-
/* A hack to get text extents for tooltips */
cairo_surface_t *dummy_surface;
void *dummy_surface_data;
@@ -2130,22 +2125,6 @@ widget_set_tooltip(struct widget *parent, char *entry, 
float x, float y)
 }
 
 static void
-workspace_manager_state(void *data,
-   struct workspace_manager *workspace_manager,
-   uint32_t current,
-   uint32_t count)
-{
-   struct display *display = data;
-
-   display->workspace = current;
-   display->workspace_count = count;
-}
-
-static const struct workspace_manager_listener workspace_manager_listener = {
-   workspace_manager_state
-};
-
-static void
 frame_resize_handler(struct widget *widget,
 int32_t width, int32_t height, void *data)
 {
@@ -2272,29 +2251,12 @@ static void
 frame_menu_func(void *data, struct input *input, int index)
 {
struct window *window = data;
-   struct display *display;
 
switch (index) {
case 0: /* close */
window_close(window);
break;
-   case 1: /* move to workspace above */
-  

[PATCH weston v2 7/9] desktop-shell: Rename protocol weston_desktop_shell

2015-11-17 Thread Jonas Ådahl
In the effort of going away from generic names of protocols only
relevant for weston, rename the weston desktop shell
weston_desktop_shell.

This also resets the version to 1, as there will be no prior versions
to weston_desktop_shell.

Signed-off-by: Jonas Ådahl 
Reviewed-by: Mariusz Ceier 
Acked-by: Pekka Paalanen 
---
 Makefile.am   |  20 +++---
 clients/desktop-shell.c   |  79 +++---
 desktop-shell/input-panel.c   |   1 -
 desktop-shell/shell.c |  76 ++---
 desktop-shell/shell.h |   4 +-
 protocol/desktop-shell.xml| 138 --
 protocol/weston-desktop-shell.xml | 134 
 7 files changed, 224 insertions(+), 228 deletions(-)
 delete mode 100644 protocol/desktop-shell.xml
 create mode 100644 protocol/weston-desktop-shell.xml

diff --git a/Makefile.am b/Makefile.am
index 217c730..1bced97 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -693,9 +693,9 @@ weston_editor_CFLAGS = $(AM_CFLAGS) $(CLIENT_CFLAGS) 
$(PANGO_CFLAGS)
 endif
 
 weston_keyboard_SOURCES = clients/keyboard.c
-nodist_weston_keyboard_SOURCES =   \
-   protocol/desktop-shell-client-protocol.h\
-   protocol/desktop-shell-protocol.c   \
+nodist_weston_keyboard_SOURCES =   \
+   protocol/weston-desktop-shell-client-protocol.h \
+   protocol/weston-desktop-shell-protocol.c\
protocol/input-method-unstable-v1-protocol.c\
protocol/input-method-unstable-v1-client-protocol.h
 weston_keyboard_LDADD = libtoytoolkit.la
@@ -721,8 +721,8 @@ weston_desktop_shell_SOURCES =  
\
clients/desktop-shell.c \
shared/helpers.h
 nodist_weston_desktop_shell_SOURCES =  \
-   protocol/desktop-shell-client-protocol.h\
-   protocol/desktop-shell-protocol.c
+   protocol/weston-desktop-shell-client-protocol.h \
+   protocol/weston-desktop-shell-protocol.c
 weston_desktop_shell_LDADD = libtoytoolkit.la
 weston_desktop_shell_CFLAGS = $(AM_CFLAGS) $(CLIENT_CFLAGS)
 
@@ -757,8 +757,8 @@ BUILT_SOURCES +=\
protocol/text-input-unstable-v1-client-protocol.h   \
protocol/input-method-unstable-v1-protocol.c\
protocol/input-method-unstable-v1-client-protocol.h \
-   protocol/desktop-shell-client-protocol.h\
-   protocol/desktop-shell-protocol.c   \
+   protocol/weston-desktop-shell-client-protocol.h \
+   protocol/weston-desktop-shell-protocol.c\
protocol/scaler-client-protocol.h   \
protocol/scaler-protocol.c  \
protocol/workspaces-client-protocol.h   \
@@ -839,8 +839,8 @@ desktop_shell_la_SOURCES =  \
desktop-shell/input-panel.c \
shared/helpers.h
 nodist_desktop_shell_la_SOURCES =  \
-   protocol/desktop-shell-protocol.c   \
-   protocol/desktop-shell-server-protocol.h\
+   protocol/weston-desktop-shell-protocol.c\
+   protocol/weston-desktop-shell-server-protocol.h \
protocol/xdg-shell-unstable-v5-protocol.c   \
protocol/xdg-shell-unstable-v5-server-protocol.h
 
@@ -1340,7 +1340,7 @@ BUILT_SOURCES +=  \
protocol/text-input-unstable-v1-client-protocol.h
 
 EXTRA_DIST +=  \
-   protocol/desktop-shell.xml  \
+   protocol/weston-desktop-shell.xml   \
protocol/screenshooter.xml  \
protocol/workspaces.xml \
protocol/text-cursor-position.xml   \
diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c
index 9cf3d68..6ab76dc 100644
--- a/clients/desktop-shell.c
+++ b/clients/desktop-shell.c
@@ -47,14 +47,13 @@
 #include "shared/config-parser.h"
 #include "shared/helpers.h"
 
-#include "desktop-shell-client-protocol.h"
+#include "weston-desktop-shell-client-protocol.h"
 
 extern char **environ; /* defined by libc */
 
 struct desktop {
struct display *display;
-   struct desktop_shell *shell;
-   uint32_t interface_version;
+   struct weston_desktop_shell *shell;
struct unlock_dialog *unlock_dialog;
struct task unlock_task;
struct wl_list outputs;
@@ -72,7 +71,7 @@ struct desktop {
 
 struct surface {
void (*configure)(void *data,
- struct desktop_shell *desktop_shell,
+ struct weston_desktop_shell *desktop_shell,
  uint32_t edges, struct window *window,
  int32_t width, int32_t height);
 };
@@ -174,8 +173,7 @@ check_desk

[PATCH weston v2 0/9] weston wayland-protocols migration

2015-11-17 Thread Jonas Ådahl
Hi again,

This is the second version of the weston wayland-protocols migration
patch series.

Overall, it's pretty much the same, but here are the differences:

Naming is updated to new naming (wl -> wp, N -> _vN).

The presentation timing protocol is dropped. Pekka said he'd like to
avoid the rename dance and just go stable directly. So I'm leaving that
protocol where it is for now.

desktop_shell -> weston_desktop_shell had a couple of minor fixes
related to left over version things.

There are Acks and RBs on all patches already, but I'll leave this series
here before pushing anything so people have another chance on providing
input.


Jonas


Jonas Ådahl (9):
  Use fullscreen-shell.xml from wayland-protocols
  Use linux-dmabuf protocol from wayland-protocols
  Use text input protocol from wayland-protocols
  Use input method protocol from wayland-protocols
  Makefile.am: Make the external xml scanning rule version generic
  Use xdg_shell protocol from wayland-protocols
  desktop-shell: Rename protocol weston_desktop_shell
  Rename screenshooter protocol to weston_screenshooter
  Remove workspaces protocol

 Makefile.am | 173 +-
 clients/desktop-shell.c |  79 ++---
 clients/editor.c| 119 +++
 clients/fullscreen.c|  60 ++--
 clients/keyboard.c  | 186 +--
 clients/screenshot.c|  21 +-
 clients/simple-damage.c |  20 +-
 clients/simple-dmabuf.c |  80 ++---
 clients/simple-egl.c|   2 +-
 clients/simple-shm.c|  20 +-
 clients/weston-simple-im.c  | 130 
 clients/window.c|  60 +---
 configure.ac|   4 +
 desktop-shell/input-panel.c |  15 +-
 desktop-shell/shell.c   | 191 +++
 desktop-shell/shell.h   |   4 +-
 fullscreen-shell/fullscreen-shell.c |  55 ++--
 ivi-shell/input-panel-ivi.c |  14 +-
 protocol/desktop-shell.xml  | 138 
 protocol/fullscreen-shell.xml   | 206 
 protocol/input-method.xml   | 291 -
 protocol/linux-dmabuf.xml   | 274 
 protocol/screenshooter.xml  |  12 -
 protocol/text.xml   | 374 --
 protocol/weston-desktop-shell.xml   | 134 
 protocol/weston-screenshooter.xml   |  12 +
 protocol/workspaces.xml |  27 --
 protocol/xdg-shell.xml  | 616 
 src/compositor-wayland.c|  58 ++--
 src/gl-renderer.c   |   6 +-
 src/linux-dmabuf.c  |  48 +--
 src/screen-share.c  |  36 ++-
 src/screenshooter.c |  10 +-
 src/text-backend.c  |  85 ++---
 tests/text-test.c   |  54 ++--
 35 files changed, 851 insertions(+), 2763 deletions(-)
 delete mode 100644 protocol/desktop-shell.xml
 delete mode 100644 protocol/fullscreen-shell.xml
 delete mode 100644 protocol/input-method.xml
 delete mode 100644 protocol/linux-dmabuf.xml
 delete mode 100644 protocol/screenshooter.xml
 delete mode 100644 protocol/text.xml
 create mode 100644 protocol/weston-desktop-shell.xml
 create mode 100644 protocol/weston-screenshooter.xml
 delete mode 100644 protocol/workspaces.xml
 delete mode 100644 protocol/xdg-shell.xml

-- 
2.4.3

___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH weston v2 6/9] Use xdg_shell protocol from wayland-protocols

2015-11-17 Thread Jonas Ådahl
Signed-off-by: Jonas Ådahl 
Reviewed-by: Mariusz Ceier 
Acked-by: Pekka Paalanen 
Acked-by: Jasper St. Pierre 
---
 Makefile.am |  29 ++-
 clients/simple-damage.c |   2 +-
 clients/simple-dmabuf.c |   2 +-
 clients/simple-egl.c|   2 +-
 clients/simple-shm.c|   2 +-
 clients/window.c|   2 +-
 desktop-shell/shell.c   |   2 +-
 protocol/xdg-shell.xml  | 616 
 8 files changed, 20 insertions(+), 637 deletions(-)
 delete mode 100644 protocol/xdg-shell.xml

diff --git a/Makefile.am b/Makefile.am
index 0435702..217c730 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -473,8 +473,8 @@ demo_clients += \
 
 weston_simple_shm_SOURCES = clients/simple-shm.c
 nodist_weston_simple_shm_SOURCES = \
-   protocol/xdg-shell-protocol.c   \
-   protocol/xdg-shell-client-protocol.h\
+   protocol/xdg-shell-unstable-v5-protocol.c   \
+   protocol/xdg-shell-unstable-v5-client-protocol.h\
protocol/fullscreen-shell-unstable-v1-protocol.c\
protocol/fullscreen-shell-unstable-v1-client-protocol.h \
protocol/ivi-application-protocol.c \
@@ -486,8 +486,8 @@ weston_simple_damage_SOURCES = clients/simple-damage.c
 nodist_weston_simple_damage_SOURCES =  \
protocol/scaler-protocol.c  \
protocol/scaler-client-protocol.h   \
-   protocol/xdg-shell-protocol.c   \
-   protocol/xdg-shell-client-protocol.h\
+   protocol/xdg-shell-unstable-v5-protocol.c   \
+   protocol/xdg-shell-unstable-v5-client-protocol.h\
protocol/fullscreen-shell-unstable-v1-protocol.c\
protocol/fullscreen-shell-unstable-v1-client-protocol.h
 weston_simple_damage_CFLAGS = $(AM_CFLAGS) $(SIMPLE_CLIENT_CFLAGS)
@@ -517,8 +517,8 @@ if BUILD_SIMPLE_EGL_CLIENTS
 demo_clients += weston-simple-egl
 weston_simple_egl_SOURCES = clients/simple-egl.c
 nodist_weston_simple_egl_SOURCES = \
-   protocol/xdg-shell-protocol.c   \
-   protocol/xdg-shell-client-protocol.h\
+   protocol/xdg-shell-unstable-v5-protocol.c   \
+   protocol/xdg-shell-unstable-v5-client-protocol.h\
protocol/ivi-application-protocol.c \
protocol/ivi-application-client-protocol.h
 weston_simple_egl_CFLAGS = $(AM_CFLAGS) $(SIMPLE_EGL_CLIENT_CFLAGS)
@@ -529,8 +529,8 @@ if BUILD_SIMPLE_INTEL_DMABUF_CLIENT
 demo_clients += weston-simple-dmabuf
 weston_simple_dmabuf_SOURCES = clients/simple-dmabuf.c
 nodist_weston_simple_dmabuf_SOURCES =  \
-   protocol/xdg-shell-protocol.c   \
-   protocol/xdg-shell-client-protocol.h\
+   protocol/xdg-shell-unstable-v5-protocol.c   \
+   protocol/xdg-shell-unstable-v5-client-protocol.h\
protocol/fullscreen-shell-unstable-v1-protocol.c\
protocol/fullscreen-shell-unstable-v1-client-protocol.h \
protocol/linux-dmabuf-unstable-v1-protocol.c \
@@ -556,8 +556,8 @@ nodist_libtoytoolkit_la_SOURCES =   \
protocol/workspaces-client-protocol.h   \
protocol/presentation_timing-protocol.c \
protocol/presentation_timing-client-protocol.h  \
-   protocol/xdg-shell-protocol.c   \
-   protocol/xdg-shell-client-protocol.h\
+   protocol/xdg-shell-unstable-v5-protocol.c   \
+   protocol/xdg-shell-unstable-v5-client-protocol.h\
protocol/ivi-application-protocol.c \
protocol/ivi-application-client-protocol.h
 
@@ -765,8 +765,8 @@ BUILT_SOURCES +=\
protocol/workspaces-protocol.c  \
protocol/fullscreen-shell-unstable-v1-protocol.c\
protocol/fullscreen-shell-unstable-v1-client-protocol.h \
-   protocol/xdg-shell-protocol.c   \
-   protocol/xdg-shell-client-protocol.h\
+   protocol/xdg-shell-unstable-v5-protocol.c   \
+   protocol/xdg-shell-unstable-v5-client-protocol.h\
protocol/ivi-hmi-controller-protocol.c  \
protocol/ivi-hmi-controller-client-protocol.h   \
protocol/ivi-application-protocol.c \
@@ -841,8 +841,8 @@ desktop_shell_la_SOURCES =  \
 nodist_desktop_shell_la_SOURCES =  \
protocol/desktop-shell-protocol.c   \
protocol/desktop-shell-server-protocol.h\
-   protocol/xdg-shell-protocol.c   \
-   protocol/xdg-shell-server-protocol.h
+   protocol/xdg-shell-unstable-v5-protocol.c   \
+   protocol/xdg-shell-unstable-v5-server-protocol.h
 
 BUILT_SOURCES += $(nodist_desktop_shell_la_SOURCES)
 endif
@@ -1345,7 +1345,6 @@ EXTRA_D