Re: [PATCH 2/2 weston] toytoolkit: Don't draw shadows for maximized windows.

2012-08-11 Thread Scott Moreau
On Fri, Aug 10, 2012 at 7:47 PM, Bill Spitzak spit...@gmail.com wrote:

 This looks really messy and still makes the assumption that the only
 reason for edges to be removed is because of maximize. It is also
 completely different than how fullscreen is done, even though that should
 be identical except the titlebar is also removed for fullscreen.

 Based on the latest changes to the shell api, I feel the following must be
 added:

 1. The content region. This is the part of the window that does not
 include the edges. However it *does* include the titlebar. Imagine the
 part of the window you see when it is maximized. This is different and
 smaller than the input region


No it isn't. The input region and your theoretical content region are
exactly the same.


 and should be specified by clients using a new api very similar to how the
 input and opaque regions are specified. Shells need this information to
 property implement snap-to-edge (where the edge is of another window, a
 panel, or an output),


No it doesn't. We can do snap-to-edge for any edge with the input and
surface areas known already.


 and to implement maximizes other than the full-screen maximize (ie
 vertically-only). It also means maximize is not a special state, instead
 the shell just resizes the surface so that the contents fill the output.


This doesn't really have anything to do with what we're talking about here.



 2. When the shell tells a client to configure a window, it should
 communicate both a size for the surface image, and the bounding box of the
 content region in this new size.


It already does this and it's called the input region.


 This bounding box will always be the same distance or closer to the edges
 of the surface (ie it is only used to clip edges, not to make them
 thicker). This allows clients to know that edges are clipped so they do not
 place any important controls there, and they can adjust their graphics to
 take into account the clipping (for instance not drawing rounded-corner
 shading for a clipped-off rounded corner). It will also save some memory
 and rendering time by clipping these off the allocated image buffer.


You are over-thinking this far too much. We don't need any of this.



 Ideally this new box should be added to the configure event and we should
 just require clients to obey it. If this is not allowed due to the api
 being frozen, it could be a different event, but it suffers from the ugly
 fact that the size sent with configure is not the actual size the surface
 should be (because that would make a client that does not clip the edges
 make the window too small when maximized).


It's the same as the input region which we already have.



 3. Fullscreen: somewhat unrelated, but the shell should be able to
 directly tell clients to remove all decorations. Currently this is tied
 into the fullscreen request from a client. This is necessary so shells can
 force a client to fullscreen. It is also needed for embedding one wayland
 client in another. It may also be useful for displaying wayland clients on
 legacy window systems that make it very difficult to remove their own
 decorations.


This sounds like a bunch of stuff we don't need. The client will have
special cases for decoration flags such as maximized and none.


To make your point more specific, why not submit a patch implementing what
you think should happen? I'm not really sure why you're doing this whole
write up without any code to show. Further, we should strive to make
initial implementations as simple as possible and not try to over
complicate it. That said, there is a bug where the input or opaque region
may be invalid at any given time. My snap implementation built on top of
the v3 patch here works around the issue but we still need to restructure
the way input and opaque regions are handled before advancing on this.



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


[PATCH 2/2] keyboard: fix to make it work in the presence of multiple seats

2012-08-11 Thread Philipp Brüschweiler
If a certain seat causes a button click, send the commit_string to the
input method that is assigned to the same seat.
---
 clients/keyboard.c | 81 --
 1 Datei geändert, 72 Zeilen hinzugefügt(+), 9 Zeilen entfernt(-)

diff --git a/clients/keyboard.c b/clients/keyboard.c
index 9fdd8cc..fc8d5ae 100644
--- a/clients/keyboard.c
+++ b/clients/keyboard.c
@@ -20,6 +20,8 @@
  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
+#include assert.h
+#include stdbool.h
 #include stdio.h
 #include stdlib.h
 #include string.h
@@ -33,11 +35,12 @@
 
 struct virtual_keyboard {
struct input_panel *input_panel;
-   struct input_method *input_method;
struct display *display;
+
+   struct wl_list input_methods;
 };
 
-struct keyboard {
+struct keyboard_window {
struct virtual_keyboard *keyboard;
struct window *window;
struct widget *widget;
@@ -45,10 +48,18 @@ struct keyboard {
int cy;
 };
 
+struct keyboard_input_method {
+   struct virtual_keyboard *keyboard;
+   struct input_method *input_method;
+   struct wl_seat *seat;
+
+   struct wl_list link;
+};
+
 static void
 redraw_handler(struct widget *widget, void *data)
 {
-   struct keyboard *keyboard = data;
+   struct keyboard_window *keyboard = data;
cairo_surface_t *surface;
struct rectangle allocation;
cairo_t *cr;
@@ -107,12 +118,30 @@ resize_handler(struct widget *widget,
 }
 
 static void
+commit_to_seat(struct virtual_keyboard *keyboard,
+  struct wl_seat *seat,
+  char *text,
+  int32_t index)
+{
+   struct keyboard_input_method *im;
+   wl_list_for_each(im, keyboard-input_methods, link)
+   if (seat == im-seat) {
+   input_method_commit_string(im-input_method,
+  text, index);
+   return;
+   }
+
+   assert(false  no input method for seat);
+}
+
+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 keyboard *keyboard = data;
+   struct keyboard_window *keyboard = data;
+   struct wl_seat *seat = input_get_seat(input);
struct rectangle allocation;
int32_t x, y;   
char text[] = { '0', '\0' };
@@ -129,28 +158,60 @@ button_handler(struct widget *widget,
 
text[0] = y / keyboard-cy * 10 + x / keyboard-cx + '0';
 
-   input_method_commit_string(keyboard-keyboard-input_method, text, -1);
+   commit_to_seat(keyboard-keyboard, seat, text, -1);
 
widget_schedule_redraw(widget);
 }
 
 static void
+input_method_assigned_seat(void *data,
+  struct input_method *input_method,
+  struct wl_seat *seat)
+{
+   struct keyboard_input_method *im = data;
+   im-seat = seat;
+}
+
+static const struct input_method_listener input_method_listener = {
+   input_method_assigned_seat,
+};
+
+static void
+keyboard_input_method_create(struct virtual_keyboard *keyboard,
+struct input_method *input_method)
+{
+   struct keyboard_input_method *im = malloc(sizeof *im);
+   im-keyboard = keyboard;
+   im-input_method = input_method;
+   im-seat = NULL;
+
+   wl_list_insert(keyboard-input_methods, im-link);
+
+   input_method_add_listener(im-input_method,
+ input_method_listener,
+ im);
+}
+
+static void
 global_handler(struct wl_display *display, uint32_t id,
   const char *interface, uint32_t version, void *data)
 {
struct virtual_keyboard *keyboard = data;
+   struct input_method *input_method;
 
if (!strcmp(interface, input_panel)) {
keyboard-input_panel = wl_display_bind(display, id, 
input_panel_interface);
} else if (!strcmp(interface, input_method)) {
-   keyboard-input_method = wl_display_bind(display, id, 
input_method_interface);
+   input_method = wl_display_bind(display, id, 
input_method_interface);
+   keyboard_input_method_create(keyboard, input_method);
}
 }
 
 static void
-keyboard_create(struct output *output, struct virtual_keyboard 
*virtual_keyboard)
+keyboard_window_create(struct output *output,
+  struct virtual_keyboard *virtual_keyboard)
 {
-   struct keyboard *keyboard;
+   struct keyboard_window *keyboard;
 
keyboard = malloc(sizeof *keyboard);
memset(keyboard, 0, sizeof *keyboard);
@@ -187,7 +248,7 @@ handle_output_configure(struct output *output, void *data)
 
output_set_user_data(output, virtual_keyboard);
 
-   keyboard_create(output, virtual_keyboard);
+   keyboard_window_create(output, 

[PATCH] wl-server: add wl_client_get_object_for_interface

2012-08-11 Thread Philipp Brüschweiler
This method makes it possible to get access to an object assigned to a
client that implements a certain interface and has a certain data.
---
 src/wayland-server.c | 34 ++
 src/wayland-server.h |  4 
 2 Dateien geändert, 38 Zeilen hinzugefügt(+)

diff --git a/src/wayland-server.c b/src/wayland-server.c
index 88e8433..55b2f04 100644
--- a/src/wayland-server.c
+++ b/src/wayland-server.c
@@ -412,6 +412,40 @@ wl_client_get_object(struct wl_client *client, uint32_t id)
return wl_map_lookup(client-objects, id);
 }
 
+struct wl_client_get_object_data {
+   const struct wl_interface *interface;
+   void *data;
+   struct wl_resource *result;
+};
+
+static void
+wl_client_get_object_for_interface_helper(void *element, void *data)
+{
+   struct wl_resource *resource = element;
+   struct wl_client_get_object_data *search_data = data;
+
+   if (resource-object.interface == search_data-interface
+resource-data == search_data-data)
+   search_data-result = resource;
+}
+
+WL_EXPORT struct wl_resource *
+wl_client_get_object_for_interface(struct wl_client *client,
+  const struct wl_interface *interface,
+  void *data)
+{
+   struct wl_client_get_object_data search_data;
+   search_data.interface = interface;
+   search_data.data = data;
+   search_data.result = NULL;
+
+   wl_map_for_each(client-objects,
+   wl_client_get_object_for_interface_helper,
+   search_data);
+
+   return search_data.result;
+}
+
 WL_EXPORT void
 wl_resource_post_no_memory(struct wl_resource *resource)
 {
diff --git a/src/wayland-server.h b/src/wayland-server.h
index f092145..9d743bc 100644
--- a/src/wayland-server.h
+++ b/src/wayland-server.h
@@ -123,6 +123,10 @@ wl_client_new_object(struct wl_client *client,
 const void *implementation, void *data);
 struct wl_resource *
 wl_client_get_object(struct wl_client *client, uint32_t id);
+struct wl_resource *
+wl_client_get_object_for_interface(struct wl_client *client,
+  const struct wl_interface *interface,
+  void *data);
 
 struct wl_listener {
struct wl_list link;
-- 
1.7.11.4

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


[PATCH 1/2] text: add assigned_seat event to the input_method interface

2012-08-11 Thread Philipp Brüschweiler
This event notifies the input method to which seat it is assigned. This
is necessary to distinguish multiple input methods when multiple seats
are used.
---
 protocol/text.xml  |  4 
 src/text-backend.c | 23 +--
 2 Dateien geändert, 21 Zeilen hinzugefügt(+), 6 Zeilen entfernt(-)

diff --git a/protocol/text.xml b/protocol/text.xml
index e73cacb..8dbb9fb 100644
--- a/protocol/text.xml
+++ b/protocol/text.xml
@@ -55,5 +55,9 @@
   arg name=text type=string/
   arg name=index type=uint/
 /request
+
+event name=assigned_seat
+  arg name=seat type=object interface=wl_seat/
+/event
   /interface
 /protocol
diff --git a/src/text-backend.c b/src/text-backend.c
index ddeec20..9c78018 100644
--- a/src/text-backend.c
+++ b/src/text-backend.c
@@ -20,6 +20,7 @@
  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
+#include assert.h
 #include stdlib.h
 
 #include compositor.h
@@ -44,6 +45,7 @@ struct input_method {
struct wl_listener destroy_listener;
 
struct weston_compositor *ec;
+   struct weston_seat *seat;
struct text_model *model;
 
struct wl_list link;
@@ -257,20 +259,28 @@ bind_input_method(struct wl_client *client,
 {
struct input_method *input_method = data;
struct wl_resource *resource;
+   struct wl_resource *seat_resource;
 
resource = wl_client_add_object(client, input_method_interface,
input_method_implementation,
id, input_method);
 
-   if (input_method-input_method_binding == NULL) {
-   resource-destroy = unbind_input_method;
-   input_method-input_method_binding = resource;
+   if (input_method-input_method_binding != NULL) {
+   wl_resource_post_error(resource,
+  WL_DISPLAY_ERROR_INVALID_OBJECT,
+  interface object already bound);
+   wl_resource_destroy(resource);
return;
}
 
-   wl_resource_post_error(resource, WL_DISPLAY_ERROR_INVALID_OBJECT,
-  interface object already bound);
-   wl_resource_destroy(resource);
+   resource-destroy = unbind_input_method;
+   input_method-input_method_binding = resource;
+
+   seat_resource = wl_client_get_object_for_interface(client,
+  wl_seat_interface,
+  input_method-seat);
+   assert(seat_resource);
+   input_method_send_assigned_seat(resource, seat_resource);
 }
 
 static void
@@ -325,6 +335,7 @@ input_method_create(struct weston_compositor *ec,
input_method = calloc(1, sizeof *input_method);
 
input_method-ec = ec;
+   input_method-seat = seat;
input_method-model = NULL;
input_method-focus_listener_initialized = 0;
 
-- 
1.7.11.4

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


Re: Weston doesn't work with gl enabled cairo on radeon

2012-08-11 Thread jegde jedge
On Fri, Aug 10, 2012 at 9:54 PM, Nerdopolis
bluescreen_aven...@verizon.net wrote:
  darxus@... writes:


 Is this a bug in weston or cairo?



 IIt's a bug in Mesa. Try reverting mesa to commit
 102617bc5206e459bb1743d2d72341dbfe77bc58
 That's what I had to do.

Fixed my issue here
http://lists.freedesktop.org/archives/wayland-devel/2012-August/004843.html
on i915 thank you.
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: weston 0.95 on 945GME using i915 drm

2012-08-11 Thread jegde jedge
SOLVED here: 
http://lists.freedesktop.org/archives/wayland-devel/2012-August/004854.html
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: Weston doesn't work with gl enabled cairo on radeon

2012-08-11 Thread darxus
On 08/11, Nerdopolis wrote:
  darxus@... writes:
 
  Is this a bug in weston or cairo?
 
 IIt's a bug in Mesa. Try reverting mesa to commit
 102617bc5206e459bb1743d2d72341dbfe77bc58
 That's what I had to do.

Bug:  https://bugs.freedesktop.org/show_bug.cgi?id=53361

-- 
It is the first responsibility of every citizen to question authority.
- Benjamin Franklin
http://www.ChaosReigns.com
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Cursor themes

2012-08-11 Thread Christopher Michael

Hi All,

I have attached a couple of patches for both Wayland and Weston.

The first patche fixes Wayland to also look in the xorg cursor theme 
directories for pointer images.


The second patch adds the ability in Weston for specifying an xorg 
cursor theme to use for windows. You can specify a theme in the 
weston.ini file:


[cursors]
theme=THEME_NAME

Cheers,
devilhorns
From 17d6500757be4184a0cb11c2a8d8c331ef18a1e6 Mon Sep 17 00:00:00 2001
From: Christopher Michael cpmicha...@comcast.net
Date: Sat, 11 Aug 2012 15:09:02 +0100
Subject: [PATCH] Add support for X cursor themes.

This patch adds a few more directories to search for xcursor themes.

Along with the weston patch, this adds the ability to configure weston
to use an X11 cursor theme. Previously, wayland cursor would just look
in the icons and pixmaps directories for cursor images to load. This
adds the ability to also search in the x cursors directory.
---
 cursor/xcursor.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/cursor/xcursor.c b/cursor/xcursor.c
index f08225c..1f66bce 100644
--- a/cursor/xcursor.c
+++ b/cursor/xcursor.c
@@ -606,7 +606,7 @@ XcursorFileLoadImages (FILE *file, int size)
 #endif
 
 #ifndef XCURSORPATH
-#define XCURSORPATH ~/.icons:/usr/share/icons:/usr/share/pixmaps:ICONDIR
+#define XCURSORPATH ~/.icons:/usr/share/icons:/usr/share/pixmaps:~/.cursors:/usr/share/cursors/xorg-x11:ICONDIR
 #endif
 
 static const char *
-- 
1.7.8.6

From 2bae51c9320a9c10d1a21edcc57b9ed1716823a2 Mon Sep 17 00:00:00 2001
From: Christopher Michael cpmicha...@comcast.net
Date: Sat, 11 Aug 2012 15:12:09 +0100
Subject: [PATCH] Add support in Weston for X cursor themes.

This patch, along with the wayland patch, adds the ability to specify
a cursor theme in the weston.ini file:

[cursors]
theme=THEME_NAME

If specified, than Weston can use a specific X cursor theme for the
pointer. This relies on the 0001-Add-support-for-X-cursor-themes.patch
for wayland.
---
 clients/window.c |   18 +-
 1 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/clients/window.c b/clients/window.c
index d0b7a7d..b7ea94e 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -646,9 +646,25 @@ static const char *cursors[] = {
 static void
 create_cursors(struct display *display)
 {
+char *config_file;
+char *theme = NULL;
 	unsigned int i;
+struct config_key cursor_keys[] = {
+   { theme, CONFIG_KEY_STRING, theme },
+};
+struct config_section cs[] = {
+   { cursors, cursor_keys, ARRAY_LENGTH(cursor_keys), NULL },
+};
+
+config_file = config_file_path(weston.ini);
+parse_config_file(config_file, cs, ARRAY_LENGTH(cs), NULL);
+free(config_file);
+   
+if (theme)
+display-cursor_theme = wl_cursor_theme_load(theme, 32, display-shm);
+else
+display-cursor_theme = wl_cursor_theme_load(NULL, 32, display-shm);
 
-	display-cursor_theme = wl_cursor_theme_load(NULL, 32, display-shm);
 	display-cursors =
 		malloc(ARRAY_LENGTH(cursors) * sizeof display-cursors[0]);
 
-- 
1.7.8.6

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


Documentation grammar

2012-08-11 Thread Christopher Michael

Hi All,

A small patch to fix a grammar mistake in the docs.

Cheers,
devilhorns
From 5b8fac0899cc3ca9db953d455594b6cafb8cd2d8 Mon Sep 17 00:00:00 2001
From: Christopher Michael cpmicha...@comcast.net
Date: Sat, 11 Aug 2012 15:35:47 +0100
Subject: [PATCH 2/2] Fix grammar in the rendering section.

Upon reading some docs, I found a small grammar mistake in the
rendering section. This patch fixes that.
---
 doc/Wayland/en_US/Architecture.xml |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/doc/Wayland/en_US/Architecture.xml b/doc/Wayland/en_US/Architecture.xml
index a982176..d5488b8 100644
--- a/doc/Wayland/en_US/Architecture.xml
+++ b/doc/Wayland/en_US/Architecture.xml
@@ -255,7 +255,7 @@
 para
   In either case, the application must tell the compositor
   which area of the surface holds new contents. When the
-  application renders directly the to shared buffer, the
+  application renders directly to the shared buffer, the
   compositor needs to be noticed that there is new content.
   But also when exchanging buffers, the compositor doesn't
   assume anything changed, and needs a request from the
-- 
1.7.8.6

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


[PATCH weston 1/2] compositor: Update surface transform before assigning output.

2012-08-11 Thread Scott Moreau
If weston_surface_assign_output() is called for a surface without calling
weston_surface_update_transform() first, the transform region will be empty
ultimately causing output assignment failure. Here we check if the region
is empty and update it accordingly before using code that relies on it.

This bug was exposed by 982387011ff. The problem case was that tooltips did not
show while the compositor was idle until other damage happens, such as moving
the mouse.
---
 src/compositor.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/compositor.c b/src/compositor.c
index 30a1f4f..7c161d0 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -1381,6 +1381,9 @@ weston_surface_assign_output(struct weston_surface *es)
uint32_t max, area, mask;
pixman_box32_t *e;
 
+   if (!pixman_region32_not_empty(es-transform.boundingbox))
+   weston_surface_update_transform(es);
+
new_output = NULL;
max = 0;
mask = 0;
-- 
1.7.11.2

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