Re: [PATCH wayland 1/4] doc: Improve Wire Format section

2012-10-08 Thread Pekka Paalanen
On Mon,  8 Oct 2012 18:39:57 +0300
Tiago Vignatti  wrote:

> Fixed the wayland socket name and added documentation for fixed format.
> 
> Signed-off-by: Tiago Vignatti 

Hi Tiago,

nice!

> ---
>  doc/Wayland/en_US/Protocol.xml |   22 +-
>  1 file changed, 17 insertions(+), 5 deletions(-)
> 
> diff --git a/doc/Wayland/en_US/Protocol.xml b/doc/Wayland/en_US/Protocol.xml
> index 9a7db53..8927837 100644
> --- a/doc/Wayland/en_US/Protocol.xml
> +++ b/doc/Wayland/en_US/Protocol.xml
> @@ -59,9 +59,10 @@
>
>  Wire Format
>  
> -  The protocol is sent over a UNIX domain stream socket.  Currently, the
> -  endpoint is named \wayland,
> -  but it is subject to change.  The protocol is message-based.  A
> +  The protocol is sent over a UNIX domain stream socket, where the 
> endpoint
> +  usually is named wayland-0
> +  (although it can be changed via WAYLAND_DISPLAY
> +  in the environment).  The protocol is message-based.  A
>message sent by a client to the server is called request.  A message
>from the server to a client is called event.  Every message is
>structured as 32-bit words, values are represented in the host's
> @@ -102,12 +103,23 @@
> 
>   
>   
> +   fixed
> +   
> + 
> +   Signed 24.8 decimal numbers. It is a signed decimal type which
> +   offers a sign bit, 23 bits of integer precision and 8 bits of
> +   decimal precision. This is exposed as an opaque struct with
> +   conversion helpers to and from double and int on the C API side.

I don't think there is such thing as a decimal number, unless it's
maybe a BCD or a string. More proper terms are a fixed point value, and
8 bits of fractional precision, IMO.

It's not an (opaque) struct, either. It's just a typedef from int32_t.

> + 
> +   
> + 
> + 
> string
> 
>   
> Starts with an unsigned 32-bit length, followed by the
> -   string contents, including terminating NUL byte, then padding to a
> -   32-bit boundary.
> +   string contents, including terminating null byte, then padding
> +   to a 32-bit boundary.
>   
> 
>   

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


[PATCH weston] window: Initialize workspace state before first roundtrip

2012-10-08 Thread Jonas Ådahl
The workspace state parameters were initialized after the first
roundtrip. If a workspace manager state event was received during this
roundtrip the state parameters were cleared leaving an incorrect state.

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

diff --git a/clients/window.c b/clients/window.c
index 9a75a46..aba1254 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -3772,6 +3772,9 @@ display_create(int argc, char *argv[])
return NULL;
}
 
+   d->workspace = 0;
+   d->workspace_count = 1;
+
/* Set up listener so we'll catch all events. */
wl_display_add_global_listener(d->display,
   display_handle_global, d);
@@ -3794,9 +3797,6 @@ display_create(int argc, char *argv[])
 
wl_list_init(&d->window_list);
 
-   d->workspace = 0;
-   d->workspace_count = 1;
-
return d;
 }
 
-- 
1.7.9.5

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


[PATCH] wayland util: Handle malloc failure in wl_array_copy()

2012-10-08 Thread Martin Minarik
If the malloc in wl_array_add() fails, we are memcpy-ing to bad memory.
This can happen only when copying array to smaller array.
---
 src/wayland-util.c |   11 ---
 src/wayland-util.h |2 +-
 tests/array-test.c |8 ++--
 3 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/src/wayland-util.c b/src/wayland-util.c
index a8c03ad..4e02f95 100644
--- a/src/wayland-util.c
+++ b/src/wayland-util.c
@@ -135,12 +135,17 @@ wl_array_add(struct wl_array *array, size_t size)
return p;
 }
 
-WL_EXPORT void
+WL_EXPORT int
 wl_array_copy(struct wl_array *array, struct wl_array *source)
 {
-   array->size = 0;
-   wl_array_add(array, source->size);
+   if (source->size > array->size) {
+   if (NULL == wl_array_add(array, source->size - array->size))
+   return -1;
+   } else {
+   array->size = source->size;
+   }
memcpy(array->data, source->data, source->size);
+   return 0;
 }
 
 union map_entry {
diff --git a/src/wayland-util.h b/src/wayland-util.h
index b588505..f54077e 100644
--- a/src/wayland-util.h
+++ b/src/wayland-util.h
@@ -165,7 +165,7 @@ struct wl_array {
 void wl_array_init(struct wl_array *array);
 void wl_array_release(struct wl_array *array);
 void *wl_array_add(struct wl_array *array, size_t size);
-void wl_array_copy(struct wl_array *array, struct wl_array *source);
+int wl_array_copy(struct wl_array *array, struct wl_array *source);
 
 typedef int32_t wl_fixed_t;
 
diff --git a/tests/array-test.c b/tests/array-test.c
index 7639878..ff5bb8c 100644
--- a/tests/array-test.c
+++ b/tests/array-test.c
@@ -60,7 +60,9 @@ TEST(array_add)
 
/* add some data */
for (i = 0; i < iterations; i++) {
-   struct mydata* ptr = wl_array_add(&array, datasize);
+   struct mydata* ptr = NULL;
+   while (ptr == NULL)
+   ptr = wl_array_add(&array, datasize);
assert((i + 1) * datasize == array.size);
 
ptr->a = i * 3;
@@ -94,7 +96,9 @@ TEST(array_copy)
 
/* add some data */
for (i = 0; i < iterations; i++) {
-   int *p = wl_array_add(&source, sizeof(int));
+   int *p = NULL;
+   while (p == NULL)
+   p = wl_array_add(&source, sizeof(int));
*p = i * 2 + i;
}
 
-- 
1.7.0.4

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


[PATCH] Weston: weston.ini man page

2012-10-08 Thread Martin Minarik
The man page is not very detailed and exceptionally accurate, but
it mentions the configuration options.
---
 man/weston.ini.5 |  184 ++
 1 files changed, 184 insertions(+), 0 deletions(-)
 create mode 100644 man/weston.ini.5

diff --git a/man/weston.ini.5 b/man/weston.ini.5
new file mode 100644
index 000..2b121de
--- /dev/null
+++ b/man/weston.ini.5
@@ -0,0 +1,184 @@
+.\" shorthand for double quote that works everywhere.
+.ds q \N'34'
+.TH weston.ini 5 "weston 0.95.0" "Wayland "
+.SH NAME
+weston.ini \- configuration file for
+.B Weston
+the reference Wayland compositor
+.SH INTRODUCTION
+.B Weston
+obtains configuration from its command line parameters and the configuration
+file described here.
+.SH DESCRIPTION
+.B Weston
+uses a configuration file called
+.I weston.ini
+for its setup.
+The
+.I weston.ini
+configuration file is searched for in the following places when the
+server is started:
+.PP
+.RS 4
+.nf
+.IR $HOME/.config/weston.ini
+.IR $XDG_CONFIG_HOME/weston.ini
+.fi
+.RE
+.PP
+where enviroment variable
+.B $HOME
+is the user's home directory, and
+.B $XDG_CONFIG_HOME
+is the user specific configuration directory.
+.PP
+The
+.I weston.ini
+file is composed of a number of sections which may be present in any order,
+or omitted to use default configuration values.
+Each section has the form:
+.PP
+.RS 4
+.nf
+.BI [ SectionHeader ]
+.RI "" Option1=Value1
+.RI "" Option2=Value2
+...
+.fi
+.RE
+.PP
+Comment lines are ignored:
+.PP
+.RS 4
+.nf
+.IR "#comment"
+.fi
+.RE
+.PP
+The section headers are:
+.PP
+.RS 4
+.nf
+.BR "shell  " "Desktop customisation"
+.BR "launcher   " "Add launcher to the panel"
+.BR "screensaver" "Screensaver selection"
+.BR "output " "Monitors setup"
+.fi
+.RE
+.PP
+Values are: string, integer and boolean.
+.SH "SHELL SECTION"
+The
+.B shell
+section is used to customise the compositor.
+.PP
+The entries that can appear in this section are:
+.TP 7
+.BI "type=" desktop-shell.so 
+sets the file name of the desired desktop shell plugin. The desktop shell
+provides the basic user enviroment consisting of one or several predefined
+screens. Available shells in the
+.IR /lib/weston/
+directory are:
+.PP
+.RS 11
+.nf
+.IR desktop-shell.so
+.fi
+.IR tablet-shell.so
+.RE
+.RE
+.TP 7
+.BI "background-image=" file
+sets the path for the background image file. 
+.TP 7
+.BI "background-color=" 0xAARRGGBB
+sets the color of the background. The hexadecimal
+digit pairs are in order alpha, red, green, and blue.
+.TP 7
+.BI "panel-color=" 0xAARRGGBB
+sets the color of the panel. The hexadecimal
+digit pairs are in order alpha, red, green, and blue. The panel can be
+transparent.
+.TP 7
+.BI "locking=" true
+enables screen locking.
+.TP 7
+.BI "animation=" zoom
+sets the effect used for switching workspaces
+.TP 7
+.BI "binding-modifier=" ctrl
+Blabalbalba
+.TP 7
+.BI "num-workspaces=" 6
+defines the number of workspaces. The user can switch workspaces by using the
+Super+W shortcut. If this option 
+.TP 7
+.BI "lockscreen-icon=" path
+sets the path to lock screen icon image.
+.TP 7
+.BI "lockscreen=" path
+sets the path to lock screen background image.
+.TP 7
+.BI "homescreen=" path
+sets the path to home screen background image.
+.RE
+.SH "LAUNCHER SECTION"
+.TP 7
+.BI "icon=" icon
+sets the path to icon image. 
+.TP 7
+.BI "path=" program
+sets the path to program that is run by clicking on this launcher.
+.SH "SCREENSAVER SECTION"
+The
+.B screensaver
+section is used to select and schedule a screensaver.
+The
+.B screensaver
+section is optional, as are all of the entries that may be specified in
+it.
+.TP 7
+.BI "path=" /usr/libexec/weston-screensaver
+This instructs the compositor to use the selected screensaver client on
+a given path. If
+this line is missing or commented out, the screensaver in
+.B weston
+is disabled.
+.RE
+.TP 7
+.BI "duration=" 600
+The idle time in seconds until the screensaver appears.
+.SH "OUTPUT SECTION"
+There can be multiple output sections, one for each computer screen.
+.TP 7
+.BI "name=" /usr/libexec/weston-screensaver
+sets a name for the screen. Can be arbitrary string.
+.RE
+.TP 7
+.BI "mode=" 
+173.00  1920 2048 2248 2576  1080 1083 1088 1120 -hsync +vsync
+sets the resolution and the configuration of the monitor. In case of a LCD
+screen, the resolution e.g. 800x600 may be enough. Users of CRT displays are
+encouraged to provide a modeline string. This string consists of the refresh
+rate in Hz, horisontal and vertical resolution, options to disable/enable
+horisontal and vertical synchronisation. 
+.RE
+.TP 7
+.BI "transform=" flipped
+The transformation applied to screen output. It is done by shaders.
+.SH "KEYBOARD SECTION"
+Each
+.B [keyboard]
+has it's own keyboard layout. The keyboard layouts are provided by the 
+libxkbcommon library. This section contains the following option: 
+.TP 7
+.BI "keymap_layout=" en
+sets the keyboard layout code. The keymap 

gstreamer-vaapi and wayland

2012-10-08 Thread Eoff, Ullysses A
This is the general stack I've been using to get accelerated video playback on 
Wayland/Weston thanks to krh and gb:

git clone git://anongit.freedesktop.org/vaapi/libva
git clone git://anongit.freedesktop.org/vaapi/intel-driver
git clone git://anongit.freedesktop.org/gstreamer/gstreamer --branch 0.10
git clone git://anongit.freedesktop.org/gstreamer/gst-plugins-base --branch 0.10
git clone git://anongit.freedesktop.org/gstreamer/gst-plugins-bad --branch 0.10
git clone git://anongit.freedesktop.org/gstreamer/gst-plugins-good --branch 0.10
git clone git://gitorious.org/vaapi/gstreamer-vaapi.git

You may need to pass '--disable-glx' to gstreamer-vaapi when you build it (to 
work around a compile issue we had recently--- it might be fixed now).  I also 
pass "--disable-wayland" to gst-plugins-bad configure... I'm not sure what that 
plugin is for... but it's not the one we use.

After launching weston, execute as:

gst-launch playbin2 video-sink=vaapisink uri=file://path/to/video

U. Artie

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


[PATCH wayland 4/4] wayland: Fix typos

2012-10-08 Thread Tiago Vignatti
My vim spell checker is able to find typos of xml files after adding "syn spell
toplevel" to ~/.vim/after/syntax/xml.vim

aah, and Wayland is capital letter :)

Signed-off-by: Tiago Vignatti 
---
 protocol/wayland.xml |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/protocol/wayland.xml b/protocol/wayland.xml
index e9f8034..efd71dd 100644
--- a/protocol/wayland.xml
+++ b/protocol/wayland.xml
@@ -30,7 +30,7 @@
   
 
   The core global object.  This is a special singleton object.  It
-  is used for internal wayland protocol features.
+  is used for internal Wayland protocol features.
 
 
   
@@ -138,7 +138,7 @@
   
 
   The wl_shm_pool object encapsulates a piece of memory shared
-  between the compsitor and client.  Through the wl_shm_pool
+  between the compositor and client.  Through the wl_shm_pool
   object, the client can allocate shared memory wl_buffer objects.
   The objects will share the same underlying mapped memory.
   Reusing the mapped memory avoids the setup/teardown overhead and
@@ -156,7 +156,7 @@
those advertised through the wl_shm.format event.
 
A buffer will keep a reference to the pool it was created from
-   so it is valid to destroy the pool immediatedly after creating
+   so it is valid to destroy the pool immediately after creating
a buffer from it.
   
 
-- 
1.7.9.5

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


[PATCH wayland 3/4] doc: Remove Shared Object Cache section

2012-10-08 Thread Tiago Vignatti
We don't support anything like that yet.

Signed-off-by: Tiago Vignatti 
---

I'm not sure now about the Compositor, Surface, Input and Output sections.
Maybe we could remove those also and expand the descriptions on wayland.xml
instead. Ideas here? And Drag and drop seems quite outdated.

 doc/Wayland/en_US/Protocol.xml |   55 
 1 file changed, 55 deletions(-)

diff --git a/doc/Wayland/en_US/Protocol.xml b/doc/Wayland/en_US/Protocol.xml
index 943dd3b..1c22e0e 100644
--- a/doc/Wayland/en_US/Protocol.xml
+++ b/doc/Wayland/en_US/Protocol.xml
@@ -341,61 +341,6 @@
   
 
   
-  
-Shared Object Cache
-
-  Cache for sharing glyphs, icons, cursors across clients.  Lets clients
-  share identical objects.  The cache is a global object, advertised at
-  connect time.
-  
-Interface:  cache
-Requests:   upload(key, visual, bo, stride, width, height)
-Events:item(key, bo, x, y, stride)
-retire(bo)
-  
-
-
-  
-   
- 
-   Upload by passing a visual, bo, stride, width, height to the
-   cache.
- 
-   
-   
- 
-   Upload returns a bo name, stride, and x, y location of object in
-   the buffer.  Clients take a reference on the atlas bo.
- 
-   
-   
- 
-   Shared objects are refcounted, freed by client (when purging
-   glyphs from the local cache) or when a client exits.
- 
-   
-   
- 
-   Server can't delete individual items from an atlas, but it can
-   throw out an entire atlas bo if it becomes too sparse.  The server
-   sends out an retire event when this happens, and 
clients
-   must throw away any objects from that bo and reupload.  Between the
-   server dropping the atlas and the client receiving the retire event,
-   clients can still legally use the old atlas since they have a ref on
-   the bo.
- 
-   
-   
- 
-   cairo needs to hook into the glyph cache, and maybe also a way
-   to create a read-only surface based on an object form the cache
-   (icons).
-   
cairo_wayland_create_cached_surface(surface-data)
- 
-   
-  
-
-  
   
 Drag and Drop
 
-- 
1.7.9.5

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


[PATCH wayland 1/4] doc: Improve Wire Format section

2012-10-08 Thread Tiago Vignatti
Fixed the wayland socket name and added documentation for fixed format.

Signed-off-by: Tiago Vignatti 
---
 doc/Wayland/en_US/Protocol.xml |   22 +-
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/doc/Wayland/en_US/Protocol.xml b/doc/Wayland/en_US/Protocol.xml
index 9a7db53..8927837 100644
--- a/doc/Wayland/en_US/Protocol.xml
+++ b/doc/Wayland/en_US/Protocol.xml
@@ -59,9 +59,10 @@
   
 Wire Format
 
-  The protocol is sent over a UNIX domain stream socket.  Currently, the
-  endpoint is named \wayland,
-  but it is subject to change.  The protocol is message-based.  A
+  The protocol is sent over a UNIX domain stream socket, where the endpoint
+  usually is named wayland-0
+  (although it can be changed via WAYLAND_DISPLAY
+  in the environment).  The protocol is message-based.  A
   message sent by a client to the server is called request.  A message
   from the server to a client is called event.  Every message is
   structured as 32-bit words, values are represented in the host's
@@ -102,12 +103,23 @@
  


+ fixed
+ 
+   
+ Signed 24.8 decimal numbers. It is a signed decimal type which
+ offers a sign bit, 23 bits of integer precision and 8 bits of
+ decimal precision. This is exposed as an opaque struct with
+ conversion helpers to and from double and int on the C API side.
+   
+ 
+   
+   
  string
  

  Starts with an unsigned 32-bit length, followed by the
- string contents, including terminating NUL byte, then padding to a
- 32-bit boundary.
+ string contents, including terminating null byte, then padding
+ to a 32-bit boundary.

  

-- 
1.7.9.5

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


[PATCH wayland 2/4] doc: Auto-generate Protocol/Interfaces section instead

2012-10-08 Thread Tiago Vignatti
Signed-off-by: Tiago Vignatti 
---
 doc/Wayland/Makefile.am|   12 ++-
 doc/Wayland/en_US/Protocol.xml |  126 +---
 doc/Wayland/protocol-interfaces-to-docbook.xsl |   56 +++
 3 files changed, 66 insertions(+), 128 deletions(-)
 create mode 100644 doc/Wayland/protocol-interfaces-to-docbook.xsl

diff --git a/doc/Wayland/Makefile.am b/doc/Wayland/Makefile.am
index 6d73de8..600bf86 100644
--- a/doc/Wayland/Makefile.am
+++ b/doc/Wayland/Makefile.am
@@ -17,7 +17,7 @@ noinst_DATA = Wayland $(publican_targets)
 pubdir = $(docdir)/Wayland/en-US
 
 publican_targets = $(publican_sources:$(srcdir)/en_US%=$(builddir)/en-US%) \
-   en-US/ProtocolSpec.xml
+   en-US/ProtocolSpec.xml en-US/ProtocolInterfaces.xml
 
 # The Protocol.xml is purely generated and required before running publican
 en-US/ProtocolSpec.xml: $(top_srcdir)/protocol/wayland.xml 
$(srcdir)/protocol-to-docbook.xsl
@@ -25,10 +25,16 @@ en-US/ProtocolSpec.xml: $(top_srcdir)/protocol/wayland.xml 
$(srcdir)/protocol-to
$(AM_V_GEN)$(XSLTPROC) $(srcdir)/protocol-to-docbook.xsl \
$(top_srcdir)/protocol/wayland.xml > en-US/ProtocolSpec.xml
 
+en-US/ProtocolInterfaces.xml: $(top_srcdir)/protocol/wayland.xml 
$(srcdir)/protocol-interfaces-to-docbook.xsl
+   $(AM_V_GEN)$(MKDIR_P) en-US/images
+   $(AM_V_GEN)$(XSLTPROC) $(srcdir)/protocol-interfaces-to-docbook.xsl \
+   $(top_srcdir)/protocol/wayland.xml > 
en-US/ProtocolInterfaces.xml
+
+
 # Copy the en_US source files into en-US destination
 # This is required for out-of-source-tree build as publican does not allow us
 # to specify the location of the source code.
-$(builddir)/en-US/%: $(srcdir)/en_US/% en-US/ProtocolSpec.xml 
$(publican_sources)
+$(builddir)/en-US/%: $(srcdir)/en_US/% en-US/ProtocolSpec.xml 
en-US/ProtocolInterfaces.xml $(publican_sources)
$(AM_V_GEN)cp -f $< $@
 
 # Run publican for the builddir on the generated (or copied) source
@@ -38,7 +44,7 @@ Wayland: $(publican_targets)
--config $(srcdir)/publican.cfg
@touch Wayland
 
-CLEANFILES = en-US/ProtocolSpec.xml $(publican_targets)
+CLEANFILES = en-US/ProtocolSpec.xml en-US/ProtocolInterfaces.xml 
$(publican_targets)
 
 clean-local:
$(AM_V_at)rm -fr en-US
diff --git a/doc/Wayland/en_US/Protocol.xml b/doc/Wayland/en_US/Protocol.xml
index 8927837..943dd3b 100644
--- a/doc/Wayland/en_US/Protocol.xml
+++ b/doc/Wayland/en_US/Protocol.xml
@@ -163,131 +163,7 @@
   
 
   
-  
-Interfaces
-
-  The protocol includes several interfaces which are used for
-  interacting with the server.  Each interface provides requests,
-  events, and errors (which are really just special events) as described
-  above.  Specific compositor implementations may have their own
-  interfaces provided as extensions, but there are several which are
-  always expected to be present.
-
-
-  Core interfaces:
-  
-   
- wl_display
- 
-   
- provides global functionality like object binding and
- fatal error events
-   
- 
-   
-   
- wl_callback
- 
-   
- callback interface for done events
-   
- 
-   
-   
- wl_compositor
- 
-   
- core compositor interface, allows surface creation
-   
- 
-   
-   
- wl_shm
- 
-   
- buffer management interface with buffer creation and format
- handling
-   
- 
-   
-   
- wl_buffer
- 
-   
- buffer handling interface for indicating damage and object
- destruction, also provides buffer release events from the
- server
-   
- 
-   
-   
- wl_data_offer
- 
-   
- for accepting and receiving specific mime types
-   
- 
-   
-   
- wl_data_source
- 
-   
- for offering specific mime types
-   
- 
-   
-   
- wl_data_device
- 
-   
- lets clients manage drag & drop, provides pointer enter/leave 
events and motion
-   
- 
-   
-   
- wl_data_device_manager
- 
-   
- for managing data sources and devices
-   
- 
-   
-   
- wl_shell
- 
-   
- shell surface handling
-   
- 
-   
-   
- wl_shell_surface
- 
-   
- shell surface handling and desktop-like events (e.g. set a
- surface to fullscreen, display a popup, etc.)
-   
- 
-   
-   
- wl_seat
- 
-   
- cursor setting, motion, button, and key events,

Re: [PATCH libxkbcommon v4 2/2] Add xkb_keysym_from_casename() helper for case-insensitive search

2012-10-08 Thread David Herrmann
Hi Ran

On Mon, Oct 8, 2012 at 10:00 AM, Ran Benita  wrote:
> On Sun, Oct 07, 2012 at 03:59:09PM +0200, David Herrmann wrote:
>>
>>  makekeys.py   |  6 
>>  src/keysym.c  | 94 
>> +++
>>  test/keysym.c | 29 
>>  xkbcommon/xkbcommon.h | 15 
>>  4 files changed, 144 insertions(+)
>>
>> diff --git a/makekeys.py b/makekeys.py
>> index 94885c0..ab75cce 100644
>> --- a/makekeys.py
>> +++ b/makekeys.py
>> @@ -5,6 +5,7 @@ import re, sys, itertools
>>  pattern = 
>> re.compile(r'^#define\s+XKB_KEY_(?P\w+)\s+(?P0x[0-9a-fA-F]+)\s')
>>  matches = [pattern.match(line) for line in open(sys.argv[1])]
>>  entries = [(m.group("name"), int(m.group("value"), 16)) for m in matches if 
>> m]
>> +lentries = [(m.group("name").lower(), m.group("name")) for m in matches if 
>> m]
>>
>>  print('''struct name_keysym {
>>  const char *name;
>> @@ -16,6 +17,11 @@ for (name, _) in sorted(entries, key=lambda e: e[0]):
>>  print('{{ "{name}", XKB_KEY_{name} }},'.format(name=name))
>>  print('};\n')
>>
>> +print('static const struct name_keysym case_to_keysym[] = {');
>> +for (lname, name) in sorted(lentries, key=lambda e: e[0]):
>> +print('{{ "{lname}", XKB_KEY_{name} }},'.format(lname=lname, 
>> name=name))
>> +print('};\n')
>
> I think it would be more space efficient if we don't use a new 'lentries'
> list like above, but reuse the (original-cased) 'entries' list and
> change the sort key from 'lambda e: e[0]' to 'lambda e: e[0].lower()'.
> This will result in a table with the same strings being generated but
> ordered by lowercase. If I'm reading your code correctly, it would work
> nonetheless, but any half-decent compiler/linker would only store the
> strings once, e.g. instead of this:
> $ strings libxkbcommon.so | grep -i lambda
> Greek_LAMBDA
> Greek_lambda
> greek_lambda
> You get this:
> $ strings libxkbcommon.so | grep -i lambda
> Greek_LAMBDA
> Greek_lambda
>
> Also maybe we want to stick a:
> locale.setlocle(locale.LC_ALL, "C")
> or "en_us.UTF-8" there? I don't know if the python2/3 functions are
> locale sensitive, but why not to be safe I guess.

Both changes make sense, I will fix them.

>> +
>>  # *.sort() is stable so we always get the first keysym for duplicate
>>  print('static const struct name_keysym keysym_to_name[] = {');
>>  for (name, _) in (next(g[1]) for g in itertools.groupby(sorted(entries, 
>> key=lambda e: e[1]), key=lambda e: e[1])):
>> diff --git a/src/keysym.c b/src/keysym.c
>> index 85d4386..d320055 100644
>> --- a/src/keysym.c
>> +++ b/src/keysym.c
>> @@ -65,6 +65,12 @@ static int compare_by_name(const void *a, const void *b)
>>  return strcmp(key->name, entry->name);
>>  }
>>
>> +static int compare_by_casename(const void *a, const void *b)
>> +{
>> +const struct name_keysym *key = a, *entry = b;
>> +return strcasecmp(key->name, entry->name);
>> +}
>> +
>>  XKB_EXPORT int
>>  xkb_keysym_get_name(xkb_keysym_t ks, char *buffer, size_t size)
>>  {
>> @@ -144,6 +150,94 @@ xkb_keysym_from_name(const char *s)
>>  return XKB_KEY_NoSymbol;
>>  }
>>
>> +/*
>> + * Find the lower-case keysym of any keysym entry.
>> + * If we use bsearch() to find a keysym based on a case-insensitive search, 
>> we
>> + * may get _any_ of all possible duplicates back. This function looks at all
>> + * entries before and after @entry which have the same name (case 
>> insensitive)
>> + * and then returns the _best_ match of all.
>> + * The _best_ match is the lower-case keysym which we find with the help of
>> + * xkb_keysym_is_lower().
>> + */
>> +static const struct name_keysym *find_lcase(const struct name_keysym *entry)
>> +{
>> +const struct name_keysym *iter, *last;
>> +size_t len = sizeof(case_to_keysym) / sizeof(*case_to_keysym);
>> +
>> +if (xkb_keysym_is_lower(entry->keysym))
>> +return entry;
>
> xkb_keysym_is_lower is pretty lousy right now, it doesn't handle unicode
> keysysm at all. But I will fix this later (I think we're going to have
> to copy XConvertCase and UCSConvertCase from libX11:src/KeyBind.c - kind
> of ugly).

That's actually no problem at all. The Unicode keysyms have different
keysym-names so I will never call is_lower() for them. I only call
this for keysyms that have the same name (case-insensitive) and these
are all handled pretty well I think.
Nevertheless, it would still be nice to have is_lower() handle them, too.

I will wait until Daniel comments on these patches before sending the
final revision (I will try to catch him on IRC).

Thanks for the review!
David
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH weston 1/2] Clip pointer input to menu surface.

2012-10-08 Thread Pekka Paalanen
On Sun, 7 Oct 2012 15:53:44 -0600
Scott Moreau  wrote:

> On Sun, Oct 7, 2012 at 3:46 PM, Pekka Vuorela  wrote:
> 
> > On su, 2012-10-07 at 15:12 -0600, Scott Moreau wrote:
> > >
> > >
> > > On Sun, Oct 7, 2012 at 12:21 PM, Pekka Vuorela 
> > > wrote:
> > > On su, 2012-10-07 at 04:28 -0600, Scott Moreau wrote:
> > > > Don't send motion events to the surface when the pointer is
> > > not over the menu.
> > > > This was also causing items to be selected when clicking
> > > outside of the menu.
> > >
> > >
> > > Wouldn't it be quite a lousy grab if only events on top of the
> > > grabbing
> > > window would be delivered?
> > >
> > >
> > > Is there another way to determine this information from client side?
> > >
> > >
> > Client knows the width of the menu and can ignore events based on that.
> >
> > I was actually checking out why menu handling doesn't work properly a
> > week ago and came across few other issues. First, it's not doing a real
> > grab even though wl_shell_surface::set_popup defines one. Events only
> > passed on top of client's surfaces. Second, mouse on top of main window
> > passes events with coordinates relative to that.
> 
> 
> The x/y we get when outside of the menu surface are relative to the parent.
> So
> there's no way currently to tell from client side whether or not the motion
> event
> is on the parent or child. I'm not sure why you'd need a grab here, unless
> you
> wanted to be able to drag a menu for some reason.

The grab is needed, so that the menu will be dismissed, when you click
anywhere, even on another client's surface. This dismissing click needs
to go to the menu surface if anywhere.

You're right in your patch description, that coordinates during the menu
grab should always be relative to the menu surface, I believe.

> > Created a bug report
> > for those https://bugs.freedesktop.org/show_bug.cgi?id=55325


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


Re: [PATCH libxkbcommon v4 2/2] Add xkb_keysym_from_casename() helper for case-insensitive search

2012-10-08 Thread Ran Benita
On Sun, Oct 07, 2012 at 03:59:09PM +0200, David Herrmann wrote:
> This adds another helper that allows finding a keysym based on a
> case-insensitive search. This should really be supported as many keysyms
> have really weird capitalization-rules.
> 
> However, as this may produce conflicts, users must be warned to only use
> this for fallback paths or error-recovery. This is also the reason why the
> internal XKB parsers still use the case-sensitive search.
> 
> This also adds some test-cases so the expected results are really
> produced.
> 
> Signed-off-by: David Herrmann 
> ---
> Ran, could you check whether the new binary-size is acceptable? I get about 
> 350K
> for the new search-arrays.
> 
> Regards
> David

Hi David,
The patch looks good to me, thanks for going through all of these
revisions! The first patch is an improvement regardless of the feature,
and the second is nice to have IMO.

A couple of comments below.

> 
>  makekeys.py   |  6 
>  src/keysym.c  | 94 
> +++
>  test/keysym.c | 29 
>  xkbcommon/xkbcommon.h | 15 
>  4 files changed, 144 insertions(+)
> 
> diff --git a/makekeys.py b/makekeys.py
> index 94885c0..ab75cce 100644
> --- a/makekeys.py
> +++ b/makekeys.py
> @@ -5,6 +5,7 @@ import re, sys, itertools
>  pattern = 
> re.compile(r'^#define\s+XKB_KEY_(?P\w+)\s+(?P0x[0-9a-fA-F]+)\s')
>  matches = [pattern.match(line) for line in open(sys.argv[1])]
>  entries = [(m.group("name"), int(m.group("value"), 16)) for m in matches if 
> m]
> +lentries = [(m.group("name").lower(), m.group("name")) for m in matches if m]
>  
>  print('''struct name_keysym {
>  const char *name;
> @@ -16,6 +17,11 @@ for (name, _) in sorted(entries, key=lambda e: e[0]):
>  print('{{ "{name}", XKB_KEY_{name} }},'.format(name=name))
>  print('};\n')
>  
> +print('static const struct name_keysym case_to_keysym[] = {');
> +for (lname, name) in sorted(lentries, key=lambda e: e[0]):
> +print('{{ "{lname}", XKB_KEY_{name} }},'.format(lname=lname, 
> name=name))
> +print('};\n')

I think it would be more space efficient if we don't use a new 'lentries'
list like above, but reuse the (original-cased) 'entries' list and
change the sort key from 'lambda e: e[0]' to 'lambda e: e[0].lower()'.
This will result in a table with the same strings being generated but
ordered by lowercase. If I'm reading your code correctly, it would work
nonetheless, but any half-decent compiler/linker would only store the
strings once, e.g. instead of this:
$ strings libxkbcommon.so | grep -i lambda
Greek_LAMBDA
Greek_lambda
greek_lambda
You get this:
$ strings libxkbcommon.so | grep -i lambda
Greek_LAMBDA
Greek_lambda

Also maybe we want to stick a:
locale.setlocle(locale.LC_ALL, "C")
or "en_us.UTF-8" there? I don't know if the python2/3 functions are
locale sensitive, but why not to be safe I guess.

> +
>  # *.sort() is stable so we always get the first keysym for duplicate
>  print('static const struct name_keysym keysym_to_name[] = {');
>  for (name, _) in (next(g[1]) for g in itertools.groupby(sorted(entries, 
> key=lambda e: e[1]), key=lambda e: e[1])):
> diff --git a/src/keysym.c b/src/keysym.c
> index 85d4386..d320055 100644
> --- a/src/keysym.c
> +++ b/src/keysym.c
> @@ -65,6 +65,12 @@ static int compare_by_name(const void *a, const void *b)
>  return strcmp(key->name, entry->name);
>  }
>  
> +static int compare_by_casename(const void *a, const void *b)
> +{
> +const struct name_keysym *key = a, *entry = b;
> +return strcasecmp(key->name, entry->name);
> +}
> +
>  XKB_EXPORT int
>  xkb_keysym_get_name(xkb_keysym_t ks, char *buffer, size_t size)
>  {
> @@ -144,6 +150,94 @@ xkb_keysym_from_name(const char *s)
>  return XKB_KEY_NoSymbol;
>  }
>  
> +/*
> + * Find the lower-case keysym of any keysym entry.
> + * If we use bsearch() to find a keysym based on a case-insensitive search, 
> we
> + * may get _any_ of all possible duplicates back. This function looks at all
> + * entries before and after @entry which have the same name (case 
> insensitive)
> + * and then returns the _best_ match of all.
> + * The _best_ match is the lower-case keysym which we find with the help of
> + * xkb_keysym_is_lower().
> + */
> +static const struct name_keysym *find_lcase(const struct name_keysym *entry)
> +{
> +const struct name_keysym *iter, *last;
> +size_t len = sizeof(case_to_keysym) / sizeof(*case_to_keysym);
> +
> +if (xkb_keysym_is_lower(entry->keysym))
> +return entry;

xkb_keysym_is_lower is pretty lousy right now, it doesn't handle unicode
keysysm at all. But I will fix this later (I think we're going to have
to copy XConvertCase and UCSConvertCase from libX11:src/KeyBind.c - kind
of ugly).

Thanks,
Ran

> +
> +for (iter = entry - 1; iter >= case_to_keysym; --iter) {
> +if (strcasecmp(iter->name, entry->name))
> +break;
> +if (xk

Re: [PATCH weston 1/2 v2] Clip pointer input to menu surface.

2012-10-08 Thread Scott Moreau
Now that I look into it more, it seems these patches break input/leave
handlers because of the way they work. Will require further investigation.


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