[PATCH 01/14] tablet-shell: add weston-tablet.ini file for tablet shell configuration.

2012-08-21 Thread tecton69
From: Ning Tang ning.t...@intel.com

 Signed-off-by: Ning Tang tecto...@gmail.com

---
 weston-tablet.ini | 64 +++
 1 file changed, 64 insertions(+)
 create mode 100644 weston-tablet.ini

diff --git a/weston-tablet.ini b/weston-tablet.ini
new file mode 100644
index 000..9387bab
--- /dev/null
+++ b/weston-tablet.ini
@@ -0,0 +1,64 @@
+[shell]
+type=tablet-shell.so
+lockscreen-icon=/usr/share/weston/org.tizen.gallery.png
+lockscreen=/usr/share/backgrounds/gnome/Garden.jpg
+homescreen=/usr/share/backgrounds/gnome/Aqua.jpg
+animation=zoom
+
+[launcher]
+icon=/usr/share/weston/org.tizen.browser.png
+path=/home/wayland-packages/weston/clients/simple-egl
+
+[launcher]
+icon=/usr/share/weston/org.tizen.calculator.png
+path=/home/wayland-packages/weston/clients/flower
+
+
+[launcher]
+icon=/usr/share/weston/org.tizen.clock.png
+path=/home/wayland-packages/weston/clients/dnd
+
+
+#===
+[launcher]
+icon=/usr/share/weston/org.tizen.efl-calendar.png
+path=/home/wayland-packages/weston/clients/simple-shm
+
+[launcher]
+icon=/usr/share/weston/org.tizen.gallery.png
+path=/usr/bin/elementary_test
+
+[launcher]
+icon=/usr/share/weston/org.tizen.memo.png
+path=/usr/bin/elementary_test
+
+[launcher]
+icon=/usr/share/weston/org.tizen.setting.png
+path=/usr/bin/elementary_config
+
+[launcher]
+icon=/usr/share/weston/org.tizen.message.png
+path=/usr/bin/elementary_test
+
+#===
+[launcher]
+icon=/usr/share/weston/org.tizen.music-player.png
+path=/usr/bin/elementary_test
+
+[launcher]
+icon=/usr/share/weston/org.tizen.phone.png
+path=/usr/bin/elementary_test
+
+
+[launcher]
+icon=/usr/share/weston/org.tizen.smartsearch.png
+path=/usr/bin/elementary_test
+
+[launcher]
+icon=/usr/share/weston/org.tizen.contacts.png
+path=/usr/bin/elementary_test
+
+[screensaver]
+#path=./clients/wscreensaver
+duration=600
+#binding-modifier=ctrl
-- 
1.7.11.5

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


[PATCH 05/14] tablet-shell: add motion handler to launchers.

2012-08-21 Thread tecton69
From: Ning Tang ning.t...@intel.com

Enable dragging launchers. Use the drag and drop mechanism, the
launcher's icon is provided as cursor image. Currently ignore all drop
events.

 Signed-off-by: Ning Tang tecto...@gmail.com

---
 clients/tablet-shell.c | 234 ++---
 1 file changed, 223 insertions(+), 11 deletions(-)

diff --git a/clients/tablet-shell.c b/clients/tablet-shell.c
index 515d198..eaaa8d7 100644
--- a/clients/tablet-shell.c
+++ b/clients/tablet-shell.c
@@ -27,6 +27,7 @@
 #include unistd.h
 #include sys/wait.h
 
+#include wayland-cursor.h
 #include window.h
 #include ../shared/cairo-util.h
 #include ../shared/config-parser.h
@@ -82,6 +83,17 @@ struct launcher {
int focused, pressed;
char *path;
struct wl_list link;
+
+   cairo_surface_t *opaque;
+   cairo_surface_t *translucent;
+   int dragging;
+   int hotspot_x, hotspot_y;
+   uint32_t click_time;
+   int index;
+
+   const char *mime_type;
+   struct wl_surface *drag_surface;
+   struct wl_data_source *data_source;
 };
 
 static char *key_lockscreen_icon;
@@ -91,6 +103,8 @@ static char *key_launcher_icon;
 static char *key_launcher_path;
 static void launcher_section_done(void *data);
 static void layout_section_done(void *data);
+/* launcher drag */
+struct launcher *gl_launcher_drag = NULL;
 static int launcher_size;
 static int key_layout_rows;
 static int key_layout_columns;
@@ -194,6 +208,37 @@ homescreen_draw(struct widget *widget, void *data)
 }
 
 static void
+data_source_target(void *data,
+  struct wl_data_source *source, const char *mime_type)
+{
+   struct launcher *launcher = data;
+   cairo_surface_t *surface;
+   struct wl_buffer *buffer;
+   struct display *display =
+   window_get_display(launcher-layout-homescreen-window);
+   struct wl_cursor_image *pointer =
+   display_get_pointer_image(display, CURSOR_DRAGGING);
+
+   launcher-mime_type = mime_type;
+   if (mime_type)
+   surface = launcher-opaque;
+   else
+   surface = launcher-translucent;
+
+   buffer = display_get_buffer_for_surface(display, surface);
+   wl_surface_attach(launcher-drag_surface, buffer, 0, 0);
+   wl_surface_damage(launcher-drag_surface, 0, 0,
+ launcher_size + 2 * pointer-width,
+ launcher_size + 2 * pointer-height);
+}
+
+static const struct wl_data_source_listener data_source_listener = {
+   data_source_target,
+   NULL,
+   NULL,
+};
+
+static void
 lockscreen_draw(struct widget *widget, void *data)
 {
struct lockscreen *lockscreen = data;
@@ -242,6 +287,156 @@ lockscreen_button_handler(struct widget *widget,
}
 }
 
+static cairo_surface_t *
+create_drag_cursor(struct launcher *launcher,
+  int32_t x, int32_t y, double opacity)
+{
+   cairo_surface_t *surface;
+   struct wl_cursor_image *pointer;
+   struct rectangle rectangle;
+   cairo_pattern_t *pattern;
+   cairo_t *cr;
+   struct display *display;
+   struct rectangle allocation;
+
+   widget_get_allocation(launcher-widget, allocation);
+   display = window_get_display(launcher-layout-homescreen-window);
+   pointer = display_get_pointer_image(display, CURSOR_DRAGGING);
+
+   rectangle.width = launcher_size + 2 * pointer-width;
+   rectangle.height = launcher_size + 2 * pointer-height;
+
+   surface = display_create_surface(display, NULL, rectangle,
+SURFACE_SHM);
+
+   cr = cairo_create(surface);
+   cairo_translate(cr, pointer-width, pointer-height);
+
+   cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
+   cairo_set_source_rgba(cr, 0, 0, 0, 0);
+   cairo_paint(cr);
+
+   cairo_set_operator(cr, CAIRO_OPERATOR_OVER);
+   cairo_set_source_surface(cr, launcher-icon,0, 0);
+   pattern = cairo_pattern_create_rgba(0, 0, 0, opacity);
+   cairo_mask(cr, pattern);
+   cairo_pattern_destroy(pattern);
+
+   /* FIXME: more cairo-gl brokeness */
+   surface_flush_device(surface);
+   cairo_destroy(cr);
+
+   launcher-hotspot_x = pointer-width + x - allocation.x;
+   launcher-hotspot_y = pointer-height + y - allocation.y;
+
+   return surface;
+}
+
+static int
+launcher_motion_handler(struct widget *widget, struct input *input,
+   uint32_t time, float x, float y, void *data)
+{
+   struct launcher *launcher = data;
+   struct display *display;
+   struct rectangle allocation;
+   struct wl_compositor *compositor;
+   struct wl_buffer *buffer;
+   struct wl_cursor_image *pointer;
+   uint32_t serial;
+
+   widget_get_allocation(widget, allocation);
+   widget_set_tooltip(widget, basename(launcher-path),
+  x, allocation.y + allocation.height);
+
+   if 

[PATCH 06/14] tablet-shell: add trash function when dragging launcher icon.

2012-08-21 Thread tecton69
From: Ning Tang ning.t...@intel.com

Determine whether to accpet the data by the allocation of trash area. If
the icon is in it, then drop event will delete either the icon image as
well as tag in ini file.

 Signed-off-by: Ning Tang tecto...@gmail.com

---
 clients/tablet-shell.c | 153 -
 weston-tablet.ini  |   1 +
 2 files changed, 151 insertions(+), 3 deletions(-)

diff --git a/clients/tablet-shell.c b/clients/tablet-shell.c
index eaaa8d7..860bba8 100644
--- a/clients/tablet-shell.c
+++ b/clients/tablet-shell.c
@@ -103,17 +103,22 @@ static char *key_launcher_icon;
 static char *key_launcher_path;
 static void launcher_section_done(void *data);
 static void layout_section_done(void *data);
+static char *key_trash_image;
 /* launcher drag */
 struct launcher *gl_launcher_drag = NULL;
 static int launcher_size;
 static int key_layout_rows;
 static int key_layout_columns;
 static int layout_moving;
+/* trash parameters */
+static cairo_surface_t *trash_surface = NULL;
+struct rectangle *trash_allocation = NULL;
 
 static const struct config_key shell_config_keys[] = {
{ lockscreen-icon, CONFIG_KEY_STRING, key_lockscreen_icon },
{ lockscreen, CONFIG_KEY_STRING, key_lockscreen_background },
{ homescreen, CONFIG_KEY_STRING, key_homescreen_background },
+   { trash-image, CONFIG_KEY_STRING, key_trash_image },
{ layout-rows, CONFIG_KEY_UNSIGNED_INTEGER, key_layout_rows },
{ layout-columns, CONFIG_KEY_UNSIGNED_INTEGER, key_layout_columns },
{ icon-size, CONFIG_KEY_UNSIGNED_INTEGER, launcher_size },
@@ -175,6 +180,49 @@ paint_background(cairo_t *cr, const char *path, struct 
rectangle *allocation)
}
 }
 
+/*simple draw trash function*/
+static void
+homescreen_draw_trash(void *data, int x, int y)
+{
+   cairo_t *cr;
+   cairo_surface_t *surface;
+   struct homescreen *homescreen = data;
+
+   if (key_trash_image) {
+   if (!trash_surface) {
+   trash_surface = load_cairo_surface(key_trash_image);
+   }
+   } else {
+   trash_surface = NULL;
+   }
+
+   if (!trash_surface) {
+   fprintf(stderr, no trash image.\n);
+   return;
+   }
+
+   // set up trash allocation
+   if (!trash_allocation) {
+   trash_allocation = malloc(sizeof *trash_allocation);
+   trash_allocation-x = x;
+   trash_allocation-y = y;
+   trash_allocation-width =
+   cairo_image_surface_get_width(trash_surface);
+   trash_allocation-height =
+   cairo_image_surface_get_height(trash_surface);
+   }
+   surface = window_get_surface(homescreen-window);
+   cr = cairo_create(surface);
+
+   cairo_set_source_surface(cr, trash_surface,
+trash_allocation-x,
+trash_allocation-y);
+   cairo_paint(cr);
+
+   cairo_destroy(cr);
+   cairo_surface_destroy(surface);
+}
+
 static void
 homescreen_draw(struct widget *widget, void *data)
 {
@@ -203,6 +251,13 @@ homescreen_draw(struct widget *widget, void *data)
}
}
 
+   /* draw trash if dragging*/
+   if(gl_launcher_drag  gl_launcher_drag-widget) {
+   homescreen_draw_trash(homescreen,
+ allocation.width * 0.6,
+ allocation.height * 0.6);
+   }
+
cairo_destroy(cr);
cairo_surface_destroy(surface);
 }
@@ -404,17 +459,83 @@ launcher_motion_handler(struct widget *widget, struct 
input *input,
return CURSOR_HAND1;
 }
 
+static int
+layout_delete_launcher(struct launcher *launcher) {
+   char *config_file = config_file_path(weston-tablet.ini);
+   FILE *fp;
+   char line[512];
+   uint32_t found_pos = 0;
+   uint32_t next_pos = 0;
+   uint32_t end_length = 0;
+   uint32_t layout_num = launcher-layout-index;
+   uint32_t launcher_num = launcher-index;
+
+   fp = fopen(config_file, r);
+   if (fp == NULL) {
+   fprintf(stderr, couldn't open %s.\n, config_file);
+   return -1;
+   }
+   while (fgets(line, sizeof line, fp)) {
+   if (strcmp([layout]\n, line) == 0)
+   layout_num--;
+   if (layout_num == 0  strcmp([launcher]\n, line) == 0) {
+   launcher_num--;
+   if (launcher_num == 0) {
+   found_pos = ftell(fp) - 11;
+   break;
+   }
+   }
+   }
+   fseek(fp, found_pos, SEEK_SET);
+   if (!fread(line, 1, 511, fp))
+   {
+   fprintf(stderr, read ini file error.\n);
+   }
+   char *next = strchr(line + 10, '[');
+   next_pos = next - line + found_pos;
+
+   char *start_content = 

[PATCH 07/14] tablet-shell: add layout indicator on homescreen.

2012-08-21 Thread tecton69
From: Ning Tang ning.t...@intel.com

We could know how many layouts in total and our current layout.
Keyword in ini file is the path to indicator images, use the format of
1-f.png(focus) 1.png 2-f.png...

 Signed-off-by: Ning Tang tecto...@gmail.com

---
 clients/tablet-shell.c | 51 ++
 weston-tablet.ini  |  1 +
 2 files changed, 52 insertions(+)

diff --git a/clients/tablet-shell.c b/clients/tablet-shell.c
index 860bba8..abf0e7c 100644
--- a/clients/tablet-shell.c
+++ b/clients/tablet-shell.c
@@ -63,6 +63,7 @@ struct layout {
struct wl_list launcher_list;
struct wl_list link;
int index;
+   int active;
int pressed;
int showing;
int offset;
@@ -74,6 +75,8 @@ struct layout {
int switching;  /* 0-no 1-right -1-left*/
int s_speed;/* switching speed */
struct wl_list *layout_list;/* we need know the number of list */
+   cairo_surface_t *active_indicator;
+   cairo_surface_t *inactive_indicator;
 };
 
 struct launcher {
@@ -103,6 +106,7 @@ static char *key_launcher_icon;
 static char *key_launcher_path;
 static void launcher_section_done(void *data);
 static void layout_section_done(void *data);
+static char *key_layout_indicator_path;
 static char *key_trash_image;
 /* launcher drag */
 struct launcher *gl_launcher_drag = NULL;
@@ -119,6 +123,7 @@ static const struct config_key shell_config_keys[] = {
{ lockscreen, CONFIG_KEY_STRING, key_lockscreen_background },
{ homescreen, CONFIG_KEY_STRING, key_homescreen_background },
{ trash-image, CONFIG_KEY_STRING, key_trash_image },
+   { layout-indicator, CONFIG_KEY_STRING, key_layout_indicator_path },
{ layout-rows, CONFIG_KEY_UNSIGNED_INTEGER, key_layout_rows },
{ layout-columns, CONFIG_KEY_UNSIGNED_INTEGER, key_layout_columns },
{ icon-size, CONFIG_KEY_UNSIGNED_INTEGER, launcher_size },
@@ -224,6 +229,31 @@ homescreen_draw_trash(void *data, int x, int y)
 }
 
 static void
+layout_draw_indicator(struct layout *layout, int y, int x_center)
+{
+   const int index_size = 40;
+   int total_layout = wl_list_length(layout-layout_list) - 1;
+   int current_index = layout-index;
+   int odd = (total_layout % 2 == 0)? 1: 0;
+   int offset = current_index - (total_layout / 2) - (odd ? 0: 1);
+   int x;
+   cairo_surface_t *surface;
+   surface = window_get_surface(layout-homescreen-window);
+   cairo_t *cr = cairo_create(surface);
+
+   x = x_center + (offset * index_size) - (odd? index_size / 2: 0);
+   if (layout-active) {
+   cairo_set_source_surface(cr, layout-active_indicator, x, y);
+   } else {
+   cairo_set_source_surface(cr, layout-inactive_indicator, x, y);
+   }
+   cairo_paint(cr);
+   
+   cairo_destroy(cr);
+   cairo_surface_destroy(surface);
+}
+
+static void
 homescreen_draw(struct widget *widget, void *data)
 {
struct homescreen *homescreen = data;
@@ -249,6 +279,9 @@ homescreen_draw(struct widget *widget, void *data)
  allocation.height
  - 2 * layout-vmargin);
}
+   layout_draw_indicator(layout,
+ allocation.height - layout-vmargin,
+ allocation.width / 2);
}
 
/* draw trash if dragging*/
@@ -785,7 +818,9 @@ layout_frame_callback(void *data, struct wl_callback 
*callback, uint32_t time)
layout-showing = 0;
widget_set_allocation(layout-widget,
  0, 0, 0, 0);
+   layout-active = 0;
} else {
+   layout-active = 1;
widget_set_allocation(layout-widget,
  layout-hmargin,
  layout-vmargin,
@@ -1027,6 +1062,7 @@ tablet_shell_add_layout(struct tablet *tablet)
struct layout *layout;
struct homescreen *homescreen = tablet-homescreen;
struct rectangle allocation;
+   char *index_image;
widget_get_allocation(homescreen-widget, allocation);
 
layout = malloc(sizeof *layout);
@@ -1039,6 +1075,7 @@ tablet_shell_add_layout(struct tablet *tablet)
layout-switching = 0;
layout-s_speed = 30;
if (wl_list_empty(homescreen-layout_list)) {
+   layout-active = 1;
layout-showing = 1;
}
layout-offset = 0;
@@ -1048,6 +1085,20 @@ tablet_shell_add_layout(struct tablet *tablet)
layout-index = wl_list_length(layout-layout_list);
 
wl_list_insert(homescreen-layout_list.prev, layout-link);
+   if (layout-inactive_indicator == NULL  key_layout_indicator_path) {
+   

[PATCH 09/14] tablet-shell: add shell_surface in tablet-shell.

2012-08-21 Thread tecton69
From: Ning Tang ning.t...@intel.com

Since now toytoolkit and simple programs use shell_surface to show on
screen, we add it in tablet-shell to let them show.
But we only need serveral feature in tablet shell, the wl_shell is too
big and not suitable for tablet-shell. 

And it is helpful to fill in the interface of wl_shell for now. Then we
could make toytoolkit, efl applications run against tablet-shell.
And this won't influence our work to differenciate tablet-shell to
dekstop-shell. Once wl_shell was modified in wayland protocol, we will
change this part too. We will add tablet_shell interface when it is necessary.

Now once a shell_surface is requested, it will be centered on screen and
have a black background surface.
We reserve the set_fullscreen method and all other implementation is
just return.

 Signed-off-by: Ning Tang tecto...@gmail.com

---
 src/tablet-shell.c | 379 +
 1 file changed, 379 insertions(+)

diff --git a/src/tablet-shell.c b/src/tablet-shell.c
index 4a77681..89f84bf 100644
--- a/src/tablet-shell.c
+++ b/src/tablet-shell.c
@@ -75,6 +75,28 @@ struct tablet_shell {
struct wl_event_source *long_press_source;
 };
 
+struct shell_surface {
+   struct wl_resource resource;
+
+   struct weston_surface *surface;
+   struct weston_surface *parent_surface;
+   struct weston_surface *black_surface;
+   struct wl_listener surface_destroy_listener;
+   struct tablet_shell *shell;
+
+   struct weston_output *output;
+   struct wl_list link;
+
+   int is_fullscreen;
+   struct {
+   enum wl_shell_surface_fullscreen_method type;
+   struct weston_transform transform;
+   uint32_t framerate;
+   } fullscreen;
+
+   const struct weston_shell_client *client;
+};
+
 struct tablet_client {
struct wl_resource resource;
struct tablet_shell *shell;
@@ -84,6 +106,273 @@ struct tablet_client {
 };
 
 static void
+shell_surface_configure(struct weston_surface *surface,
+   int32_t sx, int32_t sy);
+
+static void
+black_surface_configure(struct weston_surface *es,
+   int32_t sx, int32_t sy);
+
+static struct shell_surface *
+get_shell_surface(struct weston_surface *surface)
+{
+   if (surface-configure == shell_surface_configure)
+   return surface-private;
+   else if (surface-configure == black_surface_configure)
+   return get_shell_surface(surface-private);
+   else
+   return NULL;
+}
+
+static void
+destroy_shell_surface(struct shell_surface *shsurf)
+{
+   wl_list_remove(shsurf-surface_destroy_listener.link);
+   shsurf-surface-configure = NULL;
+
+   if (shsurf-black_surface)
+   {
+   wl_list_remove(shsurf-black_surface-layer_link);
+   weston_surface_destroy(shsurf-black_surface);
+   }
+   wl_list_remove(shsurf-link);
+   free(shsurf);
+   weston_surface_damage(shsurf-shell-home_surface);
+}
+
+static void
+shell_destroy_shell_surface(struct wl_resource *resource)
+{
+   struct shell_surface *shsurf = resource-data;
+   destroy_shell_surface(shsurf);
+}
+
+static void
+shell_handle_surface_destroy(struct wl_listener *listener, void *data)
+{
+   struct shell_surface *shsurf =
+   container_of(listener, struct shell_surface,
+surface_destroy_listener);
+   if (shsurf-resource.client) {
+   wl_resource_destroy(shsurf-resource);
+   } else {
+   wl_signal_emit(shsurf-resource.destroy_signal,
+  shsurf-resource);
+   destroy_shell_surface(shsurf);
+   }
+}
+static void
+shell_surface_pong(struct wl_client *client, struct wl_resource *resource,
+   uint32_t serial)
+{
+   return;
+}
+
+static void
+shell_surface_set_title(struct wl_client *client,
+   struct wl_resource *resource, const char *title)
+{
+   return;
+}
+
+static void
+shell_surface_set_class(struct wl_client *client,
+   struct wl_resource *resource, const char *class)
+{
+   return;
+}
+
+static void
+shell_surface_move(struct wl_client *client, struct wl_resource *resource,
+   struct wl_resource *seat_resource, uint32_t serial)
+{
+   return;
+}
+
+static void
+shell_surface_resize(struct wl_client *client, struct wl_resource *resource,
+   struct wl_resource *seat_resource, uint32_t serial,
+   uint32_t edges)
+{
+   return;
+}
+
+static void
+shell_surface_set_toplevel(struct wl_client *client,
+   struct wl_resource *resource)
+{
+   return;
+}
+
+static void
+shell_surface_set_transient(struct wl_client *client,
+   struct wl_resource *resource,
+   struct wl_resource *parent_resource,
+   int 

[PATCH 10/14] tablet-shell: add event in tablet-client protocol.

2012-08-21 Thread tecton69
From: Ning Tang ning.t...@intel.com

When a client is binded, the server side will send an event to let the
client set fullscreen.
If the client don't response, it will remain centered.

 Signed-off-by: Ning Tang tecto...@gmail.com

---
 protocol/tablet-shell.xml |  2 ++
 src/tablet-shell.c| 90 ---
 2 files changed, 87 insertions(+), 5 deletions(-)

diff --git a/protocol/tablet-shell.xml b/protocol/tablet-shell.xml
index 10f1756..f226c01 100644
--- a/protocol/tablet-shell.xml
+++ b/protocol/tablet-shell.xml
@@ -35,6 +35,8 @@
   interface name=tablet_client version=1
 request name=destroy type=destructor/
 request name=activate/
+
+event name=set_fullscreen/
   /interface
 
 /protocol
diff --git a/src/tablet-shell.c b/src/tablet-shell.c
index 89f84bf..d7ce01f 100644
--- a/src/tablet-shell.c
+++ b/src/tablet-shell.c
@@ -45,6 +45,7 @@ enum {
 
 struct tablet_shell {
struct wl_resource resource;
+   struct wl_resource client_resource;
 
struct wl_listener lock_listener;
struct wl_listener unlock_listener;
@@ -153,6 +154,11 @@ shell_handle_surface_destroy(struct wl_listener *listener, 
void *data)
struct shell_surface *shsurf =
container_of(listener, struct shell_surface,
 surface_destroy_listener);
+   struct tablet_shell *shell = shsurf-shell;
+   if (shell-client_resource.client) {
+   wl_resource_destroy(shell-client_resource);
+   shell-client_resource.client = NULL;
+   }
if (shsurf-resource.client) {
wl_resource_destroy(shsurf-resource);
} else {
@@ -211,6 +217,11 @@ shell_surface_set_transient(struct wl_client *client,
int x, int y, uint32_t flags)
 {
struct shell_surface *shsurf = resource-data;
+   struct tablet_shell *shell = shsurf-shell;
+   if (shell-client_resource.client) {
+   wl_resource_destroy(shell-client_resource);
+   shell-client_resource.client = NULL;
+   }
if (shsurf-resource.client) {
wl_resource_destroy(shsurf-resource);
} else {
@@ -546,6 +557,24 @@ shell_stack_fullscreen(struct shell_surface *shsurf)
 }
 
 static void
+configure(struct tablet_shell *shell, struct weston_surface *surface,
+ GLfloat x, GLfloat y, int32_t width, int32_t height)
+{
+   struct shell_surface *shsurf;
+
+   shsurf = get_shell_surface(surface);
+   surface-geometry.x = x;
+   surface-geometry.y = y;
+   surface-geometry.width = width;
+   surface-geometry.height = height;
+   surface-geometry.dirty = 1;
+
+   shell_stack_fullscreen(shsurf);
+   center_on_output(surface, surface-output);
+   weston_surface_assign_output(surface);
+}
+
+static void
 shell_surface_configure(struct weston_surface *surface,
int32_t sx, int32_t sy)
 {
@@ -558,12 +587,44 @@ shell_surface_configure(struct weston_surface *surface,
 
wl_list_insert(shell-application_layer.surface_list,
   surface-layer_link);
-   weston_surface_assign_output(surface);
-   center_on_output(surface, surface-output);
-   shell_stack_fullscreen(shsurf);
-   wl_list_for_each(seat, surface-compositor-seat_list, link)
+   if (shell-client_resource.client) {
+   weston_surface_assign_output(surface);
+   center_on_output(surface, surface-output);
+   shell_stack_fullscreen(shsurf);
+   wl_list_for_each(seat,
+surface-compositor-seat_list,
+link)
weston_surface_activate(surface, seat);
-   weston_compositor_schedule_repaint(shell-compositor);
+   weston_compositor_schedule_repaint(surface-compositor);
+   tablet_client_send_set_fullscreen(
+   shell-client_resource);
+
+   return;
+   } else {
+   weston_surface_assign_output(surface);
+   center_on_output(surface, surface-output);
+   shell_stack_fullscreen(shsurf);
+   wl_list_for_each(seat, surface-compositor-seat_list,
+link)
+   weston_surface_activate(surface, seat);
+   weston_compositor_schedule_repaint(shell-compositor);
+   }
+   }
+   if (sx != 0 || sy != 0 ||
+   surface-geometry.width != surface-buffer-width ||
+   surface-geometry.height != surface-buffer-height) {
+   GLfloat from_x, from_y;
+   GLfloat to_x, to_y;
+
+   weston_surface_to_global_float(surface, 0, 0,
+ 

[PATCH 11/14] tablet-shell: add key binding for kill and activate surface.

2012-08-21 Thread tecton69
From: Ning Tang ning.t...@intel.com

Send kill signal to client in order to exit. After the client ends, the
surface below it would get focus.

 Signed-off-by: Ning Tang tecto...@gmail.com

---
 src/tablet-shell.c | 73 ++
 1 file changed, 73 insertions(+)

diff --git a/src/tablet-shell.c b/src/tablet-shell.c
index d7ce01f..695f7d3 100644
--- a/src/tablet-shell.c
+++ b/src/tablet-shell.c
@@ -924,6 +924,70 @@ home_key_binding(struct wl_seat *seat, uint32_t time, 
uint32_t key, void *data)
 }
 
 static void
+terminate_binding(struct wl_seat *seat, uint32_t time, uint32_t key,
+ void *data)
+{
+   struct weston_compositor *compositor = data;
+   wl_display_terminate(compositor-wl_display);
+}
+
+static void
+click_to_activate_binding(struct wl_seat *seat, uint32_t time, uint32_t button,
+ void *data)
+{
+   struct weston_surface * focus;
+   struct shell_surface * shsurf;
+   focus = (struct weston_surface *) seat-pointer-focus;
+
+   shsurf = get_shell_surface(focus);
+
+   if (shsurf)
+   weston_surface_activate(shsurf-surface, seat);
+
+}
+
+static void
+force_kill_binding(struct wl_seat *seat, uint32_t time, uint32_t key,
+  void *data)
+{
+   struct tablet_shell *shell = data;
+   struct wl_client *client;
+   struct weston_surface * focus;
+   struct shell_surface * shsurf;
+   pid_t pid;
+   uid_t uid;
+   gid_t gid;
+   int client_cnt;
+
+   if (!seat-keyboard-focus)
+   return;
+   client = seat-keyboard-focus-resource.client;
+   shsurf = get_shell_surface(seat-keyboard-focus);
+   if (!shsurf)
+   return;
+
+   wl_client_get_credentials(client, pid, uid, gid);
+   client_cnt = wl_list_length(shell-application_layer.surface_list);
+   if (client_cnt  2) {
+   wl_list_for_each(focus, shell-application_layer.surface_list,
+layer_link) {
+   client_cnt--;
+   if (client_cnt  2) {
+   weston_surface_activate(focus, seat);
+   break;
+   }
+   }
+   }
+   else
+   focus = NULL;
+   kill(pid, SIGKILL);
+   tablet_shell_set_state(shell, STATE_HOME);
+   if (focus == NULL)
+   weston_surface_activate(shell-home_surface, seat);
+   weston_compositor_schedule_repaint(shell-compositor);
+}
+
+static void
 destroy_tablet_shell(struct wl_resource *resource)
 {
 }
@@ -1031,6 +1095,15 @@ shell_init(struct weston_compositor *compositor)
weston_compositor_add_key_binding(compositor, KEY_COMPOSE, 0,
  menu_key_binding, shell);
 
+   /* Use keyboard to simulate events */
+   weston_compositor_add_key_binding(compositor, KEY_BACKSPACE,
+ MODIFIER_CTRL | MODIFIER_ALT,
+ terminate_binding, compositor);
+   weston_compositor_add_button_binding(compositor, BTN_LEFT, 0,
+click_to_activate_binding,
+shell);
+   weston_compositor_add_key_binding(compositor, KEY_ESC, 0,
+ force_kill_binding, shell);
weston_layer_init(shell-homescreen_layer,
  compositor-cursor_layer.link);
weston_layer_init(shell-application_layer,
-- 
1.7.11.5

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


[PATCH 14/14] tablet-shell: a workaround to prevent memory leak in drawing background.

2012-08-21 Thread tecton69
From: Ning Tang ning.t...@intel.com

 The origin method is to create a surface every time paint background
 and destroy it. But load_cairo_surface(1) and cairo_surface_destroy(1)
 will cause memory leak. Since sliding effect will cause background to
 be drawn many times, use this workaround to avoid out of memory.

 Signed-off-by: Ning Tang tecto...@gmail.com

---
 clients/tablet-shell.c | 16 +---
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/clients/tablet-shell.c b/clients/tablet-shell.c
index 0294396..f96b3a2 100644
--- a/clients/tablet-shell.c
+++ b/clients/tablet-shell.c
@@ -48,6 +48,7 @@ struct homescreen {
struct widget *widget;
struct wl_list layout_list;
struct input *input;
+   cairo_surface_t *image;
 };
 
 /* container of launchers on background */
@@ -148,16 +149,14 @@ sigchild_handler(int s)
 }
 
 static void
-paint_background(cairo_t *cr, const char *path, struct rectangle *allocation)
+paint_background(cairo_t *cr, cairo_surface_t *image,
+struct rectangle *allocation)
 {
-   cairo_surface_t *image = NULL;
cairo_pattern_t *pattern;
cairo_matrix_t matrix;
double sx, sy;
 
cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
-   if (path)
-   image = load_cairo_surface(path);
if (image) {
pattern = cairo_pattern_create_for_surface(image);
sx = (double) cairo_image_surface_get_width(image) /
@@ -168,10 +167,9 @@ paint_background(cairo_t *cr, const char *path, struct 
rectangle *allocation)
cairo_pattern_set_matrix(pattern, matrix);
cairo_set_source(cr, pattern);
cairo_pattern_destroy (pattern);
-   cairo_surface_destroy(image);
cairo_paint(cr);
} else {
-   fprintf(stderr, couldn't load background image: %s\n, path);
+   fprintf(stderr, no background image.\n);
cairo_set_source_rgb(cr, 0.2, 0, 0);
cairo_paint(cr);
}
@@ -258,7 +256,11 @@ homescreen_draw(struct widget *widget, void *data)
cr = cairo_create(surface);
 
widget_get_allocation(widget, allocation);
-   paint_background(cr, key_homescreen_background, allocation);
+   if (homescreen-image == NULL  key_homescreen_background) {
+   homescreen-image =
+   load_cairo_surface(key_homescreen_background);
+   }
+   paint_background(cr, homescreen-image, allocation);
 
/* draw current layout */
wl_list_for_each(layout, homescreen-layout_list, link) {
-- 
1.7.11.5

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


Q: xwayland overt Qt-compositor?

2012-08-21 Thread jegde jedge
Please forgive the 'user' post in a devel list.

I am porting a fundamentally Qt system but still need some X backward
compatability?

I am unclear of the Qt/X/Weston/Wayland interoperability.

Does the weston compositor work with Qt5 apps?
Can the Qt5-compositor run the Weston apps?
Will the Qt compositor host the xwayland server?

Am I asking the right questions?

Please help me understand the vision as it relates to future Qt and
past X both running on Wayland.
Respectfully
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH 03/14] tablet-shell: break the connection between launcher and homescreen.

2012-08-21 Thread Philipp Brüschweiler
On Tue, Aug 21, 2012 at 1:49 PM,  tecto...@gmail.com wrote:
 From: Ning Tang ning.t...@intel.com

 Launcher is totally depend on layout and add layout
 redraw function to manage drawing launchers.

  Signed-off-by: Ning Tang tecto...@gmail.com

 ---
  clients/tablet-shell.c | 133 
 +
  weston-tablet.ini  |   3 ++
  2 files changed, 94 insertions(+), 42 deletions(-)

 diff --git a/clients/tablet-shell.c b/clients/tablet-shell.c
 index c4ec5e7..3a0f04c 100644
 --- a/clients/tablet-shell.c
 +++ b/clients/tablet-shell.c
 @@ -46,7 +46,6 @@ struct tablet {
  struct homescreen {
 struct window *window;
 struct widget *widget;
 -   struct wl_list launcher_list;
 struct wl_list layout_list;
  };

 @@ -63,6 +62,7 @@ struct layout {
 struct wl_list link;
 int pressed;
 int showing;
 +   int offset;
 int hmargin;
 int vmargin;

 @@ -71,7 +71,6 @@ struct layout {

  struct launcher {
 struct widget *widget;
 -   struct homescreen *homescreen;
 struct layout *layout;
 cairo_surface_t *icon;
 int focused, pressed;
 @@ -86,11 +85,17 @@ static char *key_launcher_icon;
  static char *key_launcher_path;
  static void launcher_section_done(void *data);
  static void layout_section_done(void *data);
 +static int launcher_size;
 +static int key_layout_rows;
 +static int key_layout_columns;

  static const struct config_key shell_config_keys[] = {
 { lockscreen-icon, CONFIG_KEY_STRING, key_lockscreen_icon },
 { lockscreen, CONFIG_KEY_STRING, key_lockscreen_background },
 { homescreen, CONFIG_KEY_STRING, key_homescreen_background },
 +   { layout-rows, CONFIG_KEY_UNSIGNED_INTEGER, key_layout_rows },
 +   { layout-columns, CONFIG_KEY_UNSIGNED_INTEGER, key_layout_columns 
 },
 +   { icon-size, CONFIG_KEY_UNSIGNED_INTEGER, launcher_size },
  };

  static const struct config_key launcher_config_keys[] = {
 @@ -156,9 +161,7 @@ homescreen_draw(struct widget *widget, void *data)
 cairo_surface_t *surface;
 struct rectangle allocation;
 cairo_t *cr;
 -   struct launcher *launcher;
 -   const int rows = 4, columns = 5, icon_width = 128, icon_height = 128;
 -   int x, y, i, width, height, vmargin, hmargin, vpadding, hpadding;
 +   struct layout *layout;

 surface = window_get_surface(homescreen-window);
 cr = cairo_create(surface);
 @@ -166,29 +169,16 @@ homescreen_draw(struct widget *widget, void *data)
 widget_get_allocation(widget, allocation);
 paint_background(cr, key_homescreen_background, allocation);

 -   cairo_set_operator(cr, CAIRO_OPERATOR_OVER);
 -
 -   width = allocation.width - columns * icon_width;
 -   hpadding = width / (columns + 1);
 -   hmargin = (width - hpadding * (columns - 1)) / 2;
 -
 -   height = allocation.height - rows * icon_height;
 -   vpadding = height / (rows + 1);
 -   vmargin = (height - vpadding * (rows - 1)) / 2;
 -
 -   x = hmargin;
 -   y = vmargin;
 -   i = 0;
 -
 -   wl_list_for_each(launcher, homescreen-launcher_list, link) {
 -   widget_set_allocation(launcher-widget,
 - x, y, icon_width, icon_height);
 -   x += icon_width + hpadding;
 -   i++;
 -   if (i == columns) {
 -   x = hmargin;
 -   y += icon_height + vpadding;
 -   i = 0;
 +   /* draw current layout */
 +   wl_list_for_each(layout, homescreen-layout_list, link) {
 +   if (layout-showing) {
 +   widget_set_allocation(layout-widget,
 + layout-hmargin,
 + layout-vmargin,
 + allocation.width
 + - 2 * layout-hmargin,
 + allocation.height
 + - 2 * layout-vmargin);
 }
 }

 @@ -375,7 +365,7 @@ launcher_button_handler(struct widget *widget,
 if (state == WL_POINTER_BUTTON_STATE_RELEASED) {
 launcher_activate(launcher);
 launcher-pressed = 0;
 -   } else if (state == WL_POINTER_BUTTON_STATE_PRESSED)
 +   } else if (state == WL_POINTER_BUTTON_STATE_PRESSED)
 launcher-pressed = 1;
  }

 @@ -385,12 +375,20 @@ launcher_redraw_handler(struct widget *widget, void 
 *data)
 struct launcher *launcher = data;
 cairo_surface_t *surface;
 struct rectangle allocation;
 +   struct rectangle layout_allocation;
 cairo_t *cr;

 -   surface = window_get_surface(launcher-homescreen-window);
 -   cr = cairo_create(surface);
 -
 widget_get_allocation(widget, allocation);
 +   

Re: Q: xwayland overt Qt-compositor?

2012-08-21 Thread darxus
On 08/21, jegde jedge wrote:
 Please forgive the 'user' post in a devel list.

This post seems entirely appropriate to me.

 I am porting a fundamentally Qt system but still need some X backward
 compatability?

You consider porting to be a user subject?

 I am unclear of the Qt/X/Weston/Wayland interoperability.
 
 Does the weston compositor work with Qt5 apps?
 Can the Qt5-compositor run the Weston apps?

I haven't tested them lately, but I believe the answers should be yes.  

 Will the Qt compositor host the xwayland server?

I haven't heard.  I'm still not entirely sure what the relationship between
xwayland and different compositors is expected to be.

It may be better to ask the Qt folks.  #qt-labs on irc.freenode.net in
particular.  I'm not sure which mailing list is most appropriate.  

 Am I asking the right questions?

They seem appropriate.

 Please help me understand the vision as it relates to future Qt and
 past X both running on Wayland.
 Respectfully

Qt apps don't even know which backend they're using, it's all nice and
magical.  And last time I tested, the Qt5 apps worked with the weston
compositor, but the Qt5 demo wayland compositors crashed, but were expected
to work with wayland apps.  I suspect xwayland stuff hasn't been handled
with the Qt compositors.

There's some info here:  http://wayland.freedesktop.org/qt5.html

The build instructions are old, you'll at least need a couple more modules
to build it.  The porting section may be useful to you.  

If you find better info, please report back.

-- 
I'd rather be happy than right any day.
- Slartiblartfast, The Hitchhiker's Guide to the Galaxy
http://www.ChaosReigns.com
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: Q: xwayland overt Qt-compositor?

2012-08-21 Thread jegde jedge
On Tue, Aug 21, 2012 at 9:28 AM, Jørgen Lind jorgen.l...@nokia.com wrote:
 Hi,

 On Tue, Aug 21, 2012 at 09:15:54AM -0400, ext jegde jedge wrote:
 Please forgive the 'user' post in a devel list.


 Does the weston compositor work with Qt5 apps?
 Yes
 Can the Qt5-compositor run the Weston apps?
 Yes
 Am I asking the right questions?
 I don't know, are you getting the answers you want :)

yes :)
Thank you so much.
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: [PATCH 09/14] tablet-shell: add shell_surface in tablet-shell.

2012-08-21 Thread Pekka Paalanen
On Tue, 21 Aug 2012 19:49:23 +0800
tecto...@gmail.com wrote:

 From: Ning Tang ning.t...@intel.com
 
 Since now toytoolkit and simple programs use shell_surface to show on
 screen, we add it in tablet-shell to let them show.
 But we only need serveral feature in tablet shell, the wl_shell is too
 big and not suitable for tablet-shell. 
 
 And it is helpful to fill in the interface of wl_shell for now. Then we
 could make toytoolkit, efl applications run against tablet-shell.
 And this won't influence our work to differenciate tablet-shell to
 dekstop-shell. Once wl_shell was modified in wayland protocol, we will
 change this part too. We will add tablet_shell interface when it is necessary.
 
 Now once a shell_surface is requested, it will be centered on screen and
 have a black background surface.
 We reserve the set_fullscreen method and all other implementation is
 just return.

Hi,

referring to the conversation around
http://lists.freedesktop.org/archives/wayland-devel/2012-August/004765.html ,
have you decided whether you want:
- a tablet-shell for tablet applications, or
- a desktop-shell for tablets, that can run desktop applications?

Or put in other words, are you developing a window manager for tablets
running desktop applications, or are you aiming for a completely
different kind of user interface paradigms that fit tablets well?

Note, that these goals are conflicting from the client and user
perspective. Mixing them produces an inconsistent user interface at
best, when some applications follow the desktop UI conventions, and
some the tablet UI conventions.


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


Re: [PATCH 06/14] tablet-shell: add trash function when dragging launcher icon.

2012-08-21 Thread Philipp Brüschweiler
On Tue, Aug 21, 2012 at 1:49 PM,  tecto...@gmail.com wrote:
 From: Ning Tang ning.t...@intel.com

 Determine whether to accpet the data by the allocation of trash area. If
 the icon is in it, then drop event will delete either the icon image as
 well as tag in ini file.

  Signed-off-by: Ning Tang tecto...@gmail.com

 ---
  clients/tablet-shell.c | 153 
 -
  weston-tablet.ini  |   1 +
  2 files changed, 151 insertions(+), 3 deletions(-)

 diff --git a/clients/tablet-shell.c b/clients/tablet-shell.c
 index eaaa8d7..860bba8 100644
 --- a/clients/tablet-shell.c
 +++ b/clients/tablet-shell.c
 @@ -103,17 +103,22 @@ static char *key_launcher_icon;
  static char *key_launcher_path;
  static void launcher_section_done(void *data);
  static void layout_section_done(void *data);
 +static char *key_trash_image;
  /* launcher drag */
  struct launcher *gl_launcher_drag = NULL;
  static int launcher_size;
  static int key_layout_rows;
  static int key_layout_columns;
  static int layout_moving;
 +/* trash parameters */
 +static cairo_surface_t *trash_surface = NULL;
 +struct rectangle *trash_allocation = NULL;

  static const struct config_key shell_config_keys[] = {
 { lockscreen-icon, CONFIG_KEY_STRING, key_lockscreen_icon },
 { lockscreen, CONFIG_KEY_STRING, key_lockscreen_background },
 { homescreen, CONFIG_KEY_STRING, key_homescreen_background },
 +   { trash-image, CONFIG_KEY_STRING, key_trash_image },
 { layout-rows, CONFIG_KEY_UNSIGNED_INTEGER, key_layout_rows },
 { layout-columns, CONFIG_KEY_UNSIGNED_INTEGER, key_layout_columns 
 },
 { icon-size, CONFIG_KEY_UNSIGNED_INTEGER, launcher_size },
 @@ -175,6 +180,49 @@ paint_background(cairo_t *cr, const char *path, struct 
 rectangle *allocation)
 }
  }

 +/*simple draw trash function*/
 +static void
 +homescreen_draw_trash(void *data, int x, int y)
 +{
 +   cairo_t *cr;
 +   cairo_surface_t *surface;
 +   struct homescreen *homescreen = data;

Why don't you call this function with a struct homescreen* argument?
AFAICS it's only called by you directly.

 +
 +   if (key_trash_image) {
 +   if (!trash_surface) {
 +   trash_surface = load_cairo_surface(key_trash_image);
 +   }
 +   } else {
 +   trash_surface = NULL;
 +   }
 +
 +   if (!trash_surface) {
 +   fprintf(stderr, no trash image.\n);
 +   return;
 +   }
 +
 +   // set up trash allocation
 +   if (!trash_allocation) {
 +   trash_allocation = malloc(sizeof *trash_allocation);
 +   trash_allocation-x = x;
 +   trash_allocation-y = y;
 +   trash_allocation-width =
 +   cairo_image_surface_get_width(trash_surface);
 +   trash_allocation-height =
 +   cairo_image_surface_get_height(trash_surface);
 +   }

Could you do this initialization at startup instead on each redraw?

 +   surface = window_get_surface(homescreen-window);
 +   cr = cairo_create(surface);
 +
 +   cairo_set_source_surface(cr, trash_surface,
 +trash_allocation-x,
 +trash_allocation-y);
 +   cairo_paint(cr);
 +
 +   cairo_destroy(cr);
 +   cairo_surface_destroy(surface);
 +}
 +
  static void
  homescreen_draw(struct widget *widget, void *data)
  {
 @@ -203,6 +251,13 @@ homescreen_draw(struct widget *widget, void *data)
 }
 }

 +   /* draw trash if dragging*/
 +   if(gl_launcher_drag  gl_launcher_drag-widget) {
 +   homescreen_draw_trash(homescreen,
 + allocation.width * 0.6,
 + allocation.height * 0.6);
 +   }
 +
 cairo_destroy(cr);
 cairo_surface_destroy(surface);
  }
 @@ -404,17 +459,83 @@ launcher_motion_handler(struct widget *widget, struct 
 input *input,
 return CURSOR_HAND1;
  }

 +static int
 +layout_delete_launcher(struct launcher *launcher) {
 +   char *config_file = config_file_path(weston-tablet.ini);
 +   FILE *fp;
 +   char line[512];
 +   uint32_t found_pos = 0;
 +   uint32_t next_pos = 0;
 +   uint32_t end_length = 0;
 +   uint32_t layout_num = launcher-layout-index;
 +   uint32_t launcher_num = launcher-index;
 +
 +   fp = fopen(config_file, r);
 +   if (fp == NULL) {
 +   fprintf(stderr, couldn't open %s.\n, config_file);
 +   return -1;

You test the return value of this function against 0, so you should
return 0 on error, not -1. But I think this function is generally kind
of hacky... And I think it should be moved to shared/config-parser.c
together with the other config handling functions.

 +   }
 +   while (fgets(line, sizeof line, fp)) {
 +   if (strcmp([layout]\n, line) == 0)
 + 

Re: [PATCH 09/14] tablet-shell: add shell_surface in tablet-shell.

2012-08-21 Thread Philipp Brüschweiler
On Tue, Aug 21, 2012 at 1:49 PM,  tecto...@gmail.com wrote:
 From: Ning Tang ning.t...@intel.com

 Since now toytoolkit and simple programs use shell_surface to show on
 screen, we add it in tablet-shell to let them show.
 But we only need serveral feature in tablet shell, the wl_shell is too
 big and not suitable for tablet-shell.

 And it is helpful to fill in the interface of wl_shell for now. Then we
 could make toytoolkit, efl applications run against tablet-shell.
 And this won't influence our work to differenciate tablet-shell to
 dekstop-shell. Once wl_shell was modified in wayland protocol, we will
 change this part too. We will add tablet_shell interface when it is necessary.

 Now once a shell_surface is requested, it will be centered on screen and
 have a black background surface.
 We reserve the set_fullscreen method and all other implementation is
 just return.

  Signed-off-by: Ning Tang tecto...@gmail.com

 ---
  src/tablet-shell.c | 379 
 +
  1 file changed, 379 insertions(+)

 diff --git a/src/tablet-shell.c b/src/tablet-shell.c
 index 4a77681..89f84bf 100644
 --- a/src/tablet-shell.c
 +++ b/src/tablet-shell.c
 @@ -75,6 +75,28 @@ struct tablet_shell {
 struct wl_event_source *long_press_source;
  };

 +struct shell_surface {
 +   struct wl_resource resource;
 +
 +   struct weston_surface *surface;
 +   struct weston_surface *parent_surface;
 +   struct weston_surface *black_surface;
 +   struct wl_listener surface_destroy_listener;
 +   struct tablet_shell *shell;
 +
 +   struct weston_output *output;
 +   struct wl_list link;
 +
 +   int is_fullscreen;
 +   struct {
 +   enum wl_shell_surface_fullscreen_method type;
 +   struct weston_transform transform;
 +   uint32_t framerate;
 +   } fullscreen;
 +
 +   const struct weston_shell_client *client;
 +};
 +
  struct tablet_client {
 struct wl_resource resource;
 struct tablet_shell *shell;
 @@ -84,6 +106,273 @@ struct tablet_client {
  };

  static void
 +shell_surface_configure(struct weston_surface *surface,
 +   int32_t sx, int32_t sy);
 +
 +static void
 +black_surface_configure(struct weston_surface *es,
 +   int32_t sx, int32_t sy);
 +
 +static struct shell_surface *
 +get_shell_surface(struct weston_surface *surface)
 +{
 +   if (surface-configure == shell_surface_configure)
 +   return surface-private;
 +   else if (surface-configure == black_surface_configure)
 +   return get_shell_surface(surface-private);
 +   else
 +   return NULL;
 +}
 +
 +static void
 +destroy_shell_surface(struct shell_surface *shsurf)
 +{
 +   wl_list_remove(shsurf-surface_destroy_listener.link);
 +   shsurf-surface-configure = NULL;
 +
 +   if (shsurf-black_surface)
 +   {
 +   wl_list_remove(shsurf-black_surface-layer_link);
 +   weston_surface_destroy(shsurf-black_surface);
 +   }
 +   wl_list_remove(shsurf-link);
 +   free(shsurf);
 +   weston_surface_damage(shsurf-shell-home_surface);

It is undefined behaviour to access a pointer once its data has been
free()'d (IIRC?).

 +}
 +
 +static void
 +shell_destroy_shell_surface(struct wl_resource *resource)
 +{
 +   struct shell_surface *shsurf = resource-data;
 +   destroy_shell_surface(shsurf);
 +}
 +
 +static void
 +shell_handle_surface_destroy(struct wl_listener *listener, void *data)
 +{
 +   struct shell_surface *shsurf =
 +   container_of(listener, struct shell_surface,
 +surface_destroy_listener);
 +   if (shsurf-resource.client) {
 +   wl_resource_destroy(shsurf-resource);
 +   } else {
 +   wl_signal_emit(shsurf-resource.destroy_signal,
 +  shsurf-resource);
 +   destroy_shell_surface(shsurf);
 +   }
 +}
 +static void
 +shell_surface_pong(struct wl_client *client, struct wl_resource *resource,
 +   uint32_t serial)
 +{
 +   return;
 +}
 +
 +static void
 +shell_surface_set_title(struct wl_client *client,
 +   struct wl_resource *resource, const char *title)
 +{
 +   return;
 +}
 +
 +static void
 +shell_surface_set_class(struct wl_client *client,
 +   struct wl_resource *resource, const char *class)
 +{
 +   return;
 +}
 +
 +static void
 +shell_surface_move(struct wl_client *client, struct wl_resource *resource,
 +   struct wl_resource *seat_resource, uint32_t serial)
 +{
 +   return;
 +}
 +
 +static void
 +shell_surface_resize(struct wl_client *client, struct wl_resource *resource,
 +   struct wl_resource *seat_resource, uint32_t serial,
 +   uint32_t edges)
 +{
 +   return;
 +}
 +
 +static void
 +shell_surface_set_toplevel(struct wl_client 

Re: Q: xwayland overt Qt-compositor?

2012-08-21 Thread Thiago Macieira
On terça-feira, 21 de agosto de 2012 10.07.57, dar...@chaosreigns.com wrote:
  I am unclear of the Qt/X/Weston/Wayland interoperability.
 
  Does the weston compositor work with Qt5 apps?
  Can the Qt5-compositor run the Weston apps?

 I haven't tested them lately, but I believe the answers should be yes.

If, by Weston apps, you mean Wayland apps, yes. There's nothing special about
them.

  Will the Qt compositor host the xwayland server?

 I haven't heard.  I'm still not entirely sure what the relationship between
 xwayland and different compositors is expected to be.

 It may be better to ask the Qt folks.  #qt-labs on irc.freenode.net in
 particular.  I'm not sure which mailing list is most appropriate.

That would be developm...@qt-project.org, since Wayland support and the
compositors are really in development right now.


 Qt apps don't even know which backend they're using, it's all nice and

Qt apps _can_ know the backend if they really want to.
http://qt-project.org/doc/qt-5.0/qguiapplication.html#platformName-prop

But applications should be written not to depend on the platform.

 magical.  And last time I tested, the Qt5 apps worked with the weston
 compositor, but the Qt5 demo wayland compositors crashed, but were expected
 to work with wayland apps.  I suspect xwayland stuff hasn't been handled
 with the Qt compositors.

The compositors are all experimental and just examples of what can be done.
They are not meant to be used in a production environment.

Running Weston is recommended.

--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
  PGP/GPG: 0x6EF45358; fingerprint:
  E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358


signature.asc
Description: This is a digitally signed message part.
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: Q: xwayland overt Qt-compositor?

2012-08-21 Thread Jørgen Lind
Hi,

On Tue, Aug 21, 2012 at 09:15:54AM -0400, ext jegde jedge wrote:
 Please forgive the 'user' post in a devel list.
 
 I am porting a fundamentally Qt system but still need some X backward
 compatability?
 
 I am unclear of the Qt/X/Weston/Wayland interoperability.
 
 Does the weston compositor work with Qt5 apps?
Yes
 Can the Qt5-compositor run the Weston apps?
Yes
 Will the Qt compositor host the xwayland server?
I have to admit that we haven't focused much on this. Technically its
possible, but you have to do some work yourself I suppose. Or you can
wait untill we have done it. 
 
 Am I asking the right questions?
I don't know, are you getting the answers you want :)

 Please help me understand the vision as it relates to future Qt and
 past X both running on Wayland.

QtCompositor is suppose to be an api that enables you to write your own
specialised compositor. It came to be because of the clear synergies
between the platform abstraction which has been developed for the
interfaces you would need when you write a windowing system. 

QtCompositor is essentially about making it easy to write a
Wayland compositor. However, it has advanced features like direct
rendering support, and full touch support. 

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


Re: [PATCH 10/14] tablet-shell: add event in tablet-client protocol.

2012-08-21 Thread Philipp Brüschweiler
On Tue, Aug 21, 2012 at 1:49 PM,  tecto...@gmail.com wrote:
 From: Ning Tang ning.t...@intel.com

 When a client is binded, the server side will send an event to let the
 client set fullscreen.
 If the client don't response, it will remain centered.

  Signed-off-by: Ning Tang tecto...@gmail.com

 ---
  protocol/tablet-shell.xml |  2 ++
  src/tablet-shell.c| 90 
 ---
  2 files changed, 87 insertions(+), 5 deletions(-)

 diff --git a/protocol/tablet-shell.xml b/protocol/tablet-shell.xml
 index 10f1756..f226c01 100644
 --- a/protocol/tablet-shell.xml
 +++ b/protocol/tablet-shell.xml
 @@ -35,6 +35,8 @@
interface name=tablet_client version=1
  request name=destroy type=destructor/
  request name=activate/
 +
 +event name=set_fullscreen/
/interface

  /protocol
 diff --git a/src/tablet-shell.c b/src/tablet-shell.c
 index 89f84bf..d7ce01f 100644
 --- a/src/tablet-shell.c
 +++ b/src/tablet-shell.c
 @@ -45,6 +45,7 @@ enum {

  struct tablet_shell {
 struct wl_resource resource;
 +   struct wl_resource client_resource;

 struct wl_listener lock_listener;
 struct wl_listener unlock_listener;
 @@ -153,6 +154,11 @@ shell_handle_surface_destroy(struct wl_listener 
 *listener, void *data)
 struct shell_surface *shsurf =
 container_of(listener, struct shell_surface,
  surface_destroy_listener);
 +   struct tablet_shell *shell = shsurf-shell;
 +   if (shell-client_resource.client) {
 +   wl_resource_destroy(shell-client_resource);
 +   shell-client_resource.client = NULL;
 +   }
 if (shsurf-resource.client) {
 wl_resource_destroy(shsurf-resource);
 } else {
 @@ -211,6 +217,11 @@ shell_surface_set_transient(struct wl_client *client,
 int x, int y, uint32_t flags)
  {
 struct shell_surface *shsurf = resource-data;
 +   struct tablet_shell *shell = shsurf-shell;
 +   if (shell-client_resource.client) {
 +   wl_resource_destroy(shell-client_resource);
 +   shell-client_resource.client = NULL;
 +   }
 if (shsurf-resource.client) {
 wl_resource_destroy(shsurf-resource);
 } else {
 @@ -546,6 +557,24 @@ shell_stack_fullscreen(struct shell_surface *shsurf)
  }

  static void
 +configure(struct tablet_shell *shell, struct weston_surface *surface,
 + GLfloat x, GLfloat y, int32_t width, int32_t height)
 +{
 +   struct shell_surface *shsurf;
 +
 +   shsurf = get_shell_surface(surface);
 +   surface-geometry.x = x;
 +   surface-geometry.y = y;
 +   surface-geometry.width = width;
 +   surface-geometry.height = height;
 +   surface-geometry.dirty = 1;
 +
 +   shell_stack_fullscreen(shsurf);
 +   center_on_output(surface, surface-output);
 +   weston_surface_assign_output(surface);
 +}
 +
 +static void
  shell_surface_configure(struct weston_surface *surface,
 int32_t sx, int32_t sy)
  {
 @@ -558,12 +587,44 @@ shell_surface_configure(struct weston_surface *surface,

 wl_list_insert(shell-application_layer.surface_list,
surface-layer_link);
 -   weston_surface_assign_output(surface);
 -   center_on_output(surface, surface-output);
 -   shell_stack_fullscreen(shsurf);
 -   wl_list_for_each(seat, surface-compositor-seat_list, link)
 +   if (shell-client_resource.client) {
 +   weston_surface_assign_output(surface);
 +   center_on_output(surface, surface-output);
 +   shell_stack_fullscreen(shsurf);
 +   wl_list_for_each(seat,
 +surface-compositor-seat_list,
 +link)
 weston_surface_activate(surface, seat);

Please indent this line.

 -   weston_compositor_schedule_repaint(shell-compositor);
 +   
 weston_compositor_schedule_repaint(surface-compositor);
 +   tablet_client_send_set_fullscreen(
 +   shell-client_resource);
 +
 +   return;
 +   } else {
 +   weston_surface_assign_output(surface);
 +   center_on_output(surface, surface-output);
 +   shell_stack_fullscreen(shsurf);
 +   wl_list_for_each(seat, 
 surface-compositor-seat_list,
 +link)
 +   weston_surface_activate(surface, seat);
 +   weston_compositor_schedule_repaint(shell-compositor);

This else branch is exactly the same as the beginning of the if
branch. Why not move this code outside of the if?

 +   }
 +   

[PATCH 0/3] Add tests and documentation for text protocol

2012-08-21 Thread Jan Arne Petersen
From: Jan Arne Petersen jpeter...@openismus.com

Add tests for text_model (activate/deactivate/surface focus lost)
and documentation for text protocol.

Jan Arne Petersen (3):
  tests: Explicitly define the test client to launch
  tests: Add unit test for text model
  text: Add some documentation to the text protocol.

 protocol/text.xml|  70 -
 tests/.gitignore |   2 +-
 tests/Makefile.am|   8 +-
 tests/client-test.c  |   2 +-
 tests/event-test.c   |   2 +-
 tests/test-runner.c  |   4 +-
 tests/test-runner.h  |   2 +-
 tests/test-text-client.c | 260 +++
 tests/text-test.c| 213 ++
 9 files changed, 552 insertions(+), 11 deletions(-)
 create mode 100644 tests/test-text-client.c
 create mode 100644 tests/text-test.c

-- 
1.7.11.4

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


[PATCH 3/3] text: Add some documentation to the text protocol.

2012-08-21 Thread Jan Arne Petersen
From: Jan Arne Petersen jpeter...@openismus.com

---
 protocol/text.xml | 70 ---
 1 file changed, 67 insertions(+), 3 deletions(-)

diff --git a/protocol/text.xml b/protocol/text.xml
index 7554167..3d7b92d 100644
--- a/protocol/text.xml
+++ b/protocol/text.xml
@@ -1,5 +1,13 @@
 protocol name=text
-   interface name=text_model version=1
+  interface name=text_model version=1
+description summary=text model
+  A model for text input. Adds support for text input and input methods to
+  applications. A text_model object is created from a text_model_factory 
and
+  corresponds typically to a text entry in an application. Requests are 
used
+  to activate/deactivate the model and set informations like surrounding 
and
+  selected text or the content type. The information about entered text is
+  sent to the model via the preedit and commit events.
+/description
 request name=set_surrounding_text
   arg name=text type=string/
 /request
@@ -7,10 +15,21 @@
   arg name=index type=uint/
 /request
 request name=activate
+  description summary=request activation
+Requests the model to be activated (typically when the text entry gets
+focus). The seat argument is a wl_seat which maintains the focus for
+this activation. The surface argument is a wl_surface assigned to the
+model and tracked for focus lost.
+  /description
   arg name=seat type=object interface=wl_seat/
   arg name=surface type=object interface=wl_surface/
 /request
 request name=deactivate
+  description summary=request activation
+Requests the model to be deactivated (typically when the text entry
+lost focus). The seat argument is a wl_seat which was used for
+activation.
+  /description
   arg name=seat type=object interface=wl_seat/
 /request
 request name=set_selected_text
@@ -39,32 +58,77 @@
 event name=selection_replacement/
 event name=direction/
 event name=locale/
-event name=activated/
-event name=deactivated/
+event name=activated
+  description summary=activated event
+Notify the model when it is activated. Typically in response to an
+activate request.
+  /description
+/event
+event name=deactivated
+  description summary=deactivated event
+Notify the model when it is deactivated. Either in response to a
+deactivate request or when the assigned surface lost focus or was
+   destroyed.
+  /description
+/event
   /interface
 
   interface name=text_model_factory version=1
+description summary=text model factory
+  A factory for text models. This object is a singleton global.
+/description
 request name=create_text_model
+  description summary=create text model
+   Creates a new text model object.
+  /description
   arg name=id type=new_id interface=text_model/
 /request
   /interface
 
   interface name=input_method_context version=1
+description summary=input method context
+  Corresponds to a text model on input method side. An input method context
+  is created on text mode activation on the input method side. It allows to
+  receive information about the text model from the application via events.
+  Input method contexts do not keep state after deactivation and should be
+  destroyed after deactivation is handled.
+/description
 request name=destroy type=destructor/
 request name=commit_string
+  description summary=commit string
+Send the commit string text to the applications text model.
+  /description
   arg name=text type=string/
   arg name=index type=uint/
 /request
 event name=set_surrounding_text
+  description summary=surrounding text event
+The surrounding text from the model.
+  /description
   arg name=text type=string/
 /event
   /interface
 
   interface name=input_method version=1
+description summary=input method
+  An input method object is responsible to compose text in repsonse to
+  input from hardware or virtual keyboards. There is one input method
+  object per seat. On activate there is a new input method context object
+  created which allows the input method to communicate with the text model.
+/description
 event name=activate
+  description summary=activate event
+A text model was activated. Creates an input method context object
+which allows communication with the text model.
+  /description
   arg name=id type=new_id interface=input_method_context/
 /event
 event name=deactivate
+  description summary=activate event
+The text model corresponding to the context argument was deactivated.
+The input method context should be destroyed after deactivation is
+handled.
+  /description
   arg 

[PATCH 1/3] tests: Explicitly define the test client to launch

2012-08-21 Thread Jan Arne Petersen
From: Jan Arne Petersen jpeter...@openismus.com

Allow different test clients to launch. The test client is defined by
an argument in the test_client_launch() function.
---
 tests/client-test.c | 2 +-
 tests/event-test.c  | 2 +-
 tests/test-runner.c | 4 ++--
 tests/test-runner.h | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/tests/client-test.c b/tests/client-test.c
index 623163e..979b564 100644
--- a/tests/client-test.c
+++ b/tests/client-test.c
@@ -60,7 +60,7 @@ TEST(client_test)
assert(context);
context-compositor = compositor;
context-done = 0;
-   context-client = test_client_launch(compositor);
+   context-client = test_client_launch(compositor, test-client);
context-client-terminate = 1;
 
context-compositor_destroy_listener.notify = compositor_destroy;
diff --git a/tests/event-test.c b/tests/event-test.c
index ba048d6..e137213 100644
--- a/tests/event-test.c
+++ b/tests/event-test.c
@@ -70,7 +70,7 @@ TEST(event_test)
struct test_client *client;
struct weston_layer *layer;
 
-   client = test_client_launch(compositor);
+   client = test_client_launch(compositor, test-client);
client-terminate = 1;
 
test_client_send(client, create-surface\n);
diff --git a/tests/test-runner.c b/tests/test-runner.c
index e60e006..09c2b1f 100644
--- a/tests/test-runner.c
+++ b/tests/test-runner.c
@@ -71,7 +71,7 @@ test_client_data(int fd, uint32_t mask, void *data)
 }
 
 struct test_client *
-test_client_launch(struct weston_compositor *compositor)
+test_client_launch(struct weston_compositor *compositor, const char *file_name)
 {
struct test_client *client;
struct wl_event_loop *loop;
@@ -87,7 +87,7 @@ test_client_launch(struct weston_compositor *compositor)
assert(client_fd = 0);
snprintf(buf, sizeof buf, %d, client_fd);
setenv(TEST_SOCKET, buf, 1);
-   snprintf(buf, sizeof buf, %s/test-client, getenv(abs_builddir));
+   snprintf(buf, sizeof buf, %s/%s, getenv(abs_builddir), file_name);
fprintf(stderr, launching %s\n, buf);
 
client-terminate = 0;
diff --git a/tests/test-runner.h b/tests/test-runner.h
index ea353bc..88a08cf 100644
--- a/tests/test-runner.h
+++ b/tests/test-runner.h
@@ -36,7 +36,7 @@ struct test_client {
void *data;
 };
 
-struct test_client *test_client_launch(struct weston_compositor *compositor);
+struct test_client *test_client_launch(struct weston_compositor *compositor, 
const char *file_name);
 void test_client_send(struct test_client *client, const char *fmt, ...);
 
 #endif
-- 
1.7.11.4

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


[PATCH 2/3] tests: Add unit test for text model

2012-08-21 Thread Jan Arne Petersen
From: Jan Arne Petersen jpeter...@openismus.com

Add tests for activate/deactivate and unfocusing of the assigned
surface.
---
 tests/.gitignore |   2 +-
 tests/Makefile.am|   8 +-
 tests/test-text-client.c | 260 +++
 tests/text-test.c| 213 ++
 4 files changed, 480 insertions(+), 3 deletions(-)
 create mode 100644 tests/test-text-client.c
 create mode 100644 tests/text-test.c

diff --git a/tests/.gitignore b/tests/.gitignore
index 45f7735..f46c8d2 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -1,4 +1,4 @@
 matrix-test
 setbacklight
 test-client
-
+test-text-client
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 80f6db8..b471cc4 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,4 +1,4 @@
-TESTS = surface-test.la client-test.la event-test.la
+TESTS = surface-test.la client-test.la event-test.la text-test.la
 
 TESTS_ENVIRONMENT = $(SHELL) $(top_srcdir)/tests/weston-test
 
@@ -9,7 +9,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/src -DUNIT_TEST 
$(COMPOSITOR_CFLAGS)
 
 
 check_LTLIBRARIES = $(TESTS)
-check_PROGRAMS = test-client
+check_PROGRAMS = test-client test-text-client
 
 AM_LDFLAGS = -module -avoid-version -rpath $(libdir)
 
@@ -18,10 +18,14 @@ test_runner_src = test-runner.c test-runner.h
 surface_test_la_SOURCES = surface-test.c $(test_runner_src)
 client_test_la_SOURCES = client-test.c $(test_runner_src)
 event_test_la_SOURCES = event-test.c $(test_runner_src)
+text_test_la_SOURCES = text-test.c $(test_runner_src)
 
 test_client_SOURCES = test-client.c
 test_client_LDADD = $(SIMPLE_CLIENT_LIBS)
 
+test_text_client_SOURCES = test-text-client.c  ../clients/text-protocol.c
+test_text_client_LDADD = $(SIMPLE_CLIENT_LIBS)
+
 noinst_PROGRAMS = $(setbacklight) matrix-test
 
 matrix_test_SOURCES =  \
diff --git a/tests/test-text-client.c b/tests/test-text-client.c
new file mode 100644
index 000..877fbc6
--- /dev/null
+++ b/tests/test-text-client.c
@@ -0,0 +1,260 @@
+/*
+ * Copyright © 2012 Openismus GmbH
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that copyright
+ * notice and this permission notice appear in supporting documentation, and
+ * that the name of the copyright holders not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no representations
+ * about the suitability of this software for any purpose.  It is provided as
+ * is without express or implied warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+ * OF THIS SOFTWARE.
+ */
+
+#include stdio.h
+#include stdlib.h
+#include string.h
+#include unistd.h
+#include assert.h
+#include poll.h
+#include wayland-client.h
+#include ../clients/text-client-protocol.h
+
+struct display {
+   struct wl_display *display;
+   struct wl_compositor *compositor;
+
+   struct wl_surface *surface;
+   struct wl_seat *seat;
+
+   struct text_model_factory *factory;
+   struct text_model *text_model;
+
+   unsigned int activated;
+   unsigned int deactivated;
+};
+
+static void 
+text_model_commit_string(void *data,
+struct text_model *text_model,
+const char *text,
+uint32_t index)
+{
+}
+
+static void
+text_model_preedit_string(void *data,
+ struct text_model *text_model,
+ const char *text,
+ uint32_t index)
+{
+}
+
+static void
+text_model_preedit_styling(void *data,
+  struct text_model *text_model)
+{
+}
+
+static void 
+text_model_key(void *data,
+  struct text_model *text_model)
+{
+}
+   
+static void
+text_model_selection_replacement(void *data,
+struct text_model *text_model)
+{
+}
+
+static void
+text_model_direction(void *data,
+struct text_model *text_model)
+{
+}
+
+static void
+text_model_locale(void *data,
+ struct text_model *text_model)
+{
+}
+
+static void
+text_model_activated(void *data,
+struct text_model *text_model)
+{
+   struct display *display = data;
+
+   fprintf(stderr, %s\n, __FUNCTION__);
+
+   display-activated += 1;
+}
+
+static void

Re: Q: xwayland overt Qt-compositor?

2012-08-21 Thread darxus
On 08/21, Jørgen Lind wrote:
  Will the Qt compositor host the xwayland server?
 I have to admit that we haven't focused much on this. Technically its
 possible, but you have to do some work yourself I suppose. Or you can
 wait untill we have done it. 

How is that likely to end up working?

I'm kind of afraid of effort / code duplication between wayland
compositors.

-- 
You will need: a big heavy rock, something with a bit of a swing to it...
perhaps Mars - How to destroy the Earth
http://www.ChaosReigns.com
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel


Re: Q: xwayland overt Qt-compositor?

2012-08-21 Thread Scott Moreau
On Tue, Aug 21, 2012 at 10:31 AM, dar...@chaosreigns.com wrote:

 On 08/21, Jørgen Lind wrote:
   Will the Qt compositor host the xwayland server?
  I have to admit that we haven't focused much on this. Technically its
  possible, but you have to do some work yourself I suppose. Or you can
  wait untill we have done it.

 How is that likely to end up working?

 I'm kind of afraid of effort / code duplication between wayland
 compositors.


I doubt the qt devs are working under a rock. xwm might move to
client-space at which point, any wayland compositor that can run weston
clients gets xwayland for free.

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


Re: Compiling xserver on Ubuntu 12.04 Precise

2012-08-21 Thread Bill Spitzak

On 07/25/2012 12:44 AM, Tiago Vignatti wrote:

On 07/25/2012 09:25 AM, Bill Spitzak wrote:


xwayland failed to build:

checking for SHA1 implementation... configure: error: No suitable SHA1
implementation found


I'm using gcrypt in my system ('sudo apt-get install libgcrypt11-dev').
But X does let you choose among a bunch of SHA1 libraries. Check
yourself which one suits better for your system using ./configure --help
(libc|libmd|libgcrypt|libcrypto|libsha1|CommonCrypto).


Got a little further having installed libgcrypt11-dev and 
--with-sha1=libgcrypt on the configure of xserver.


However xserver now fails with the following error:

xwayland-input.c: In function 'create_input_device':
xwayland-input.c:499:51: error: 'wl_input_device_interface' undeclared 
(first use in this function)


I did a pull on all the repositories and this symbol does not appear 
anywhere.


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


Re: Compiling xserver on Ubuntu 12.04 Precise

2012-08-21 Thread Scott Moreau
 Got a little further having installed libgcrypt11-dev and
 --with-sha1=libgcrypt on the configure of xserver.

 However xserver now fails with the following error:

 xwayland-input.c: In function 'create_input_device':
 xwayland-input.c:499:51: error: 'wl_input_device_interface' undeclared
 (first use in this function)

 I did a pull on all the repositories and this symbol does not appear
 anywhere.


You probably have the wrong xserver code. Make sure you get it from the
xwayland-1.12 branch of git://anongit.freedesktop.org/xorg/xserver with
latest here http://cgit.freedesktop.org/xorg/xserver/log/?h=xwayland-1.12

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


Re: [PATCH 09/14] tablet-shell: add shell_surface in tablet-shell.

2012-08-21 Thread Juan Zhao
On Tue, 2012-08-21 at 17:35 +0300, Pekka Paalanen wrote: 
 On Tue, 21 Aug 2012 19:49:23 +0800
 tecto...@gmail.com wrote:
 
  From: Ning Tang ning.t...@intel.com
  
  Since now toytoolkit and simple programs use shell_surface to show on
  screen, we add it in tablet-shell to let them show.
  But we only need serveral feature in tablet shell, the wl_shell is too
  big and not suitable for tablet-shell. 
  
  And it is helpful to fill in the interface of wl_shell for now. Then we
  could make toytoolkit, efl applications run against tablet-shell.
  And this won't influence our work to differenciate tablet-shell to
  dekstop-shell. Once wl_shell was modified in wayland protocol, we will
  change this part too. We will add tablet_shell interface when it is 
  necessary.
  
  Now once a shell_surface is requested, it will be centered on screen and
  have a black background surface.
  We reserve the set_fullscreen method and all other implementation is
  just return.
 
 Hi,
 
 referring to the conversation around
 http://lists.freedesktop.org/archives/wayland-devel/2012-August/004765.html ,
 have you decided whether you want:
 - a tablet-shell for tablet applications, or
 - a desktop-shell for tablets, that can run desktop applications?


Hi,

Thanks for your reply.:)

Of course we are developing tablet-shell, keeping some wl_shell
interface is just to let toolkits application to run well.
Once wl_shell is modified, we will change these parts, as I said.
We do hope to differciate tablet-shell than desktop-shell. 
When it is necessary, tablet_shell interfaces will be added.

 
 Or put in other words, are you developing a window manager for tablets
 running desktop applications, or are you aiming for a completely
 different kind of user interface paradigms that fit tablets well?

I don't agree that tablet-shell should refuse all current desktop
applications. If so, we would not have applications running on tablet
shell. 
And I believe, once wl_shell was settled down, this concern would be
resolved.


 Note, that these goals are conflicting from the client and user
 perspective. Mixing them produces an inconsistent user interface at
 best, when some applications follow the desktop UI conventions, and
 some the tablet UI conventions.

Not at all, because for the client who don't response the request, it
will add a black surface under it. 



Thanks,
Juan

 
 
 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


RE: [PATCH 04/14] tablet-shell: add sliding effect of layout.

2012-08-21 Thread Tang, Ning


 -Original Message-
 From: Philipp Brüschweiler [mailto:ble...@gmail.com]
 Sent: Tuesday, August 21, 2012 9:59 PM
 To: tecto...@gmail.com
 Cc: wayland-devel@lists.freedesktop.org; juan.j.z...@linux.intel.com; Tang,
 Ning
 Subject: Re: [PATCH 04/14] tablet-shell: add sliding effect of layout.
 
 On Tue, Aug 21, 2012 at 1:49 PM,  tecto...@gmail.com wrote:
  From: Ning Tang ning.t...@intel.com
 
  Use frame callback to enable layout moving, so dragging layout will
  cause layout's offset changes.
  And redraw function will allocate corresponding positions to launchers.
  The allocation of layout won't change until sliding ends.
 
   Signed-off-by: Ning Tang tecto...@gmail.com
 
  ---
   clients/tablet-shell.c | 225
  -
   1 file changed, 224 insertions(+), 1 deletion(-)
 
  diff --git a/clients/tablet-shell.c b/clients/tablet-shell.c index
  3a0f04c..515d198 100644
  --- a/clients/tablet-shell.c
  +++ b/clients/tablet-shell.c
  @@ -47,6 +47,7 @@ struct homescreen {
  struct window *window;
  struct widget *widget;
  struct wl_list layout_list;
  +   struct input *input;
   };
 
   struct lockscreen {
  @@ -60,12 +61,17 @@ struct layout {
  struct homescreen *homescreen;
  struct wl_list launcher_list;
  struct wl_list link;
  +   int index;
  int pressed;
  int showing;
  int offset;
  +   int to_offset;
  +   int last_x;
  int hmargin;
  int vmargin;
  -
  +   uint32_t click_time;/* ms */
  +   int switching;  /* 0-no 1-right -1-left*/
  +   int s_speed;/* switching speed */
  struct wl_list *layout_list;/* we need know the number of list
 */
   };
 
  @@ -88,6 +94,7 @@ static void layout_section_done(void *data);  static
  int launcher_size;  static int key_layout_rows;  static int
  key_layout_columns;
  +static int layout_moving;
 
   static const struct config_key shell_config_keys[] = {
  { lockscreen-icon, CONFIG_KEY_STRING, key_lockscreen_icon
  }, @@ -251,6 +258,7 @@ homescreen_create(struct tablet *tablet)
  widget_set_redraw_handler(homescreen-widget,
  homescreen_draw);
 
  wl_list_init(homescreen-layout_list);
  +   layout_moving = 1;
  return homescreen;
   }
 
  @@ -408,13 +416,54 @@ launcher_redraw_handler(struct widget *widget,
  void *data)  }
 
   static void
  +layout_frame_callback(void *data, struct wl_callback *callback,
  +uint32_t time) {
  +   struct layout *layout = data;
  +   struct rectangle allocation;
  +
  +   if (abs(layout-offset - layout-to_offset)  layout-s_speed) {
  +   /* stop switching */
  +   layout-offset = 0;
  +   layout-switching = 0;
  +   widget_get_allocation(layout-homescreen-widget,
 allocation);
  +   if (layout-to_offset) {
  +   layout-showing = 0;
  +   widget_set_allocation(layout-widget,
  + 0, 0, 0, 0);
  +   } else {
  +   widget_set_allocation(layout-widget,
  + layout-hmargin,
  + layout-vmargin,
  + allocation.width - 2
 *
  + layout-hmargin,
  + allocation.height - 2
 *
  + layout-vmargin);
  +   input_ungrab(layout-homescreen-input);
 
 Why is this input_ungrab() necessary here? You don't seem to grab the input
 yourself anywhere.
 
There was a bug that when I dragged to slide layout, a layout is moved out of 
screen
and the next layout is shown. But the pointer's focus is still on previous 
layout, if
click again without moving the mouse will cause bug.
So here I use input_ungrab() to let pointer find correct focus.

Thanks.

  +   }
  +   } else if (layout_moving) {
  +   layout-offset += layout-switching * layout-s_speed;
  +   }
  +
  +   widget_schedule_redraw(layout-widget);
  +
  +   if (callback)
  +   wl_callback_destroy(callback); }
  +
  +static const struct wl_callback_listener layout_listener = {
  +   layout_frame_callback
  +};
  +
  +static void
   layout_redraw_handler(struct widget *widget, void *data)  {
  struct layout *layout = data;
  +   struct layout *current = data;
  struct launcher *launcher;
  struct rectangle allocation;
  const int icon_width = launcher_size, icon_height = launcher_size;
  int x, y, i, width, height, vpadding, hpadding;
  +   struct wl_callback *callback;
 
  if (layout-showing != 1)
  return;
  @@ -447,6 +496,174 @@ layout_redraw_handler(struct 

RE: [PATCH 06/14] tablet-shell: add trash function when dragging launcher icon.

2012-08-21 Thread Tang, Ning

 -Original Message-
 From: Philipp Brüschweiler [mailto:ble...@gmail.com]
 Sent: Tuesday, August 21, 2012 11:01 PM
 To: tecto...@gmail.com
 Cc: wayland-devel@lists.freedesktop.org; juan.j.z...@linux.intel.com; Tang,
 Ning
 Subject: Re: [PATCH 06/14] tablet-shell: add trash function when dragging
 launcher icon.
 
 On Tue, Aug 21, 2012 at 1:49 PM,  tecto...@gmail.com wrote:
  From: Ning Tang ning.t...@intel.com
 
  Determine whether to accpet the data by the allocation of trash area.
  If the icon is in it, then drop event will delete either the icon
  image as well as tag in ini file.
 
   Signed-off-by: Ning Tang tecto...@gmail.com
 
  ---
   clients/tablet-shell.c | 153
 -
   weston-tablet.ini  |   1 +
   2 files changed, 151 insertions(+), 3 deletions(-)
 
  diff --git a/clients/tablet-shell.c b/clients/tablet-shell.c index
  eaaa8d7..860bba8 100644
  --- a/clients/tablet-shell.c
  +++ b/clients/tablet-shell.c
  @@ -103,17 +103,22 @@ static char *key_launcher_icon;  static char
  *key_launcher_path;  static void launcher_section_done(void *data);
  static void layout_section_done(void *data);
  +static char *key_trash_image;
   /* launcher drag */
   struct launcher *gl_launcher_drag = NULL;  static int launcher_size;
  static int key_layout_rows;  static int key_layout_columns;  static
  int layout_moving;
  +/* trash parameters */
  +static cairo_surface_t *trash_surface = NULL; struct rectangle
  +*trash_allocation = NULL;
 
   static const struct config_key shell_config_keys[] = {
  { lockscreen-icon, CONFIG_KEY_STRING,
 key_lockscreen_icon },
  { lockscreen, CONFIG_KEY_STRING,
 key_lockscreen_background },
  { homescreen, CONFIG_KEY_STRING,
 key_homescreen_background
  },
  +   { trash-image, CONFIG_KEY_STRING, key_trash_image },
  { layout-rows, CONFIG_KEY_UNSIGNED_INTEGER,
 key_layout_rows },
  { layout-columns, CONFIG_KEY_UNSIGNED_INTEGER,
 key_layout_columns },
  { icon-size, CONFIG_KEY_UNSIGNED_INTEGER,
 launcher_size },
  @@ -175,6 +180,49 @@ paint_background(cairo_t *cr, const char *path,
 struct rectangle *allocation)
  }
   }
 
  +/*simple draw trash function*/
  +static void
  +homescreen_draw_trash(void *data, int x, int y) {
  +   cairo_t *cr;
  +   cairo_surface_t *surface;
  +   struct homescreen *homescreen = data;
 
 Why don't you call this function with a struct homescreen* argument?
 AFAICS it's only called by you directly.
 
I will change that, thank you. :)

  +
  +   if (key_trash_image) {
  +   if (!trash_surface) {
  +   trash_surface =
 load_cairo_surface(key_trash_image);
  +   }
  +   } else {
  +   trash_surface = NULL;
  +   }
  +
  +   if (!trash_surface) {
  +   fprintf(stderr, no trash image.\n);
  +   return;
  +   }
  +
  +   // set up trash allocation
  +   if (!trash_allocation) {
  +   trash_allocation = malloc(sizeof *trash_allocation);
  +   trash_allocation-x = x;
  +   trash_allocation-y = y;
  +   trash_allocation-width =
  +
 cairo_image_surface_get_width(trash_surface);
  +   trash_allocation-height =
  +
 cairo_image_surface_get_height(trash_surface);
  +   }
 
 Could you do this initialization at startup instead on each redraw?
 
Yeah, that would be better.

  +   surface = window_get_surface(homescreen-window);
  +   cr = cairo_create(surface);
  +
  +   cairo_set_source_surface(cr, trash_surface,
  +trash_allocation-x,
  +trash_allocation-y);
  +   cairo_paint(cr);
  +
  +   cairo_destroy(cr);
  +   cairo_surface_destroy(surface); }
  +
   static void
   homescreen_draw(struct widget *widget, void *data)  { @@ -203,6
  +251,13 @@ homescreen_draw(struct widget *widget, void *data)
  }
  }
 
  +   /* draw trash if dragging*/
  +   if(gl_launcher_drag  gl_launcher_drag-widget) {
  +   homescreen_draw_trash(homescreen,
  + allocation.width * 0.6,
  + allocation.height * 0.6);
  +   }
  +
  cairo_destroy(cr);
  cairo_surface_destroy(surface);  } @@ -404,17 +459,83 @@
  launcher_motion_handler(struct widget *widget, struct input *input,
  return CURSOR_HAND1;
   }
 
  +static int
  +layout_delete_launcher(struct launcher *launcher) {
  +   char *config_file = config_file_path(weston-tablet.ini);
  +   FILE *fp;
  +   char line[512];
  +   uint32_t found_pos = 0;
  +   uint32_t next_pos = 0;
  +   uint32_t end_length = 0;
  +   uint32_t layout_num = launcher-layout-index;
  +   uint32_t launcher_num = launcher-index;
  +
  +   fp = fopen(config_file, r);
  +   if (fp == NULL) {
  +

Re: Compiling xserver on Ubuntu 12.04 Precise

2012-08-21 Thread Bill Spitzak

On 08/21/2012 10:17 AM, Scott Moreau wrote:


Got a little further having installed libgcrypt11-dev and
--with-sha1=libgcrypt on the configure of xserver.

However xserver now fails with the following error:

xwayland-input.c: In function 'create_input_device':
xwayland-input.c:499:51: error: 'wl_input_device_interface'
undeclared (first use in this function)

I did a pull on all the repositories and this symbol does not appear
anywhere.


You probably have the wrong xserver code. Make sure you get it from the
xwayland-1.12 branch of git://anongit.freedesktop.org/xorg/xserver
http://anongit.freedesktop.org/xorg/xserver with latest here
http://cgit.freedesktop.org/xorg/xserver/log/?h=xwayland-1.12


I seem to be on 1.12:

% git status
# On branch xwayland-1.12
# Untracked files:
#   (use git add file... to include in what will be committed)
#
#   hw/xfree86/xwayland/drm-client-protocol.h
#   hw/xfree86/xwayland/drm-protocol.c
#   hw/xfree86/xwayland/xserver-client-protocol.h
#   hw/xfree86/xwayland/xserver-protocol.c
nothing added to commit but untracked files present (use git add to track)

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


Re: Compiling xserver on Ubuntu 12.04 Precise

2012-08-21 Thread Scott Moreau

 You probably have the wrong xserver code. Make sure you get it from the
 xwayland-1.12 branch of 
 git://anongit.freedesktop.org/**xorg/xserverhttp://anongit.freedesktop.org/xorg/xserver
 http://anongit.freedesktop.**org/xorg/xserverhttp://anongit.freedesktop.org/xorg/xserver
 with latest here
 http://cgit.freedesktop.org/**xorg/xserver/log/?h=xwayland-**1.12http://cgit.freedesktop.org/xorg/xserver/log/?h=xwayland-1.12


 I seem to be on 1.12:




git clone git://anongit.freedesktop.org/xorg/xserver -b xwayland-1.12
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel