[PATCH 12/12] tablet-shell: row and column number could be manageable

juan.j.zhao at linux.intel.com juan.j.zhao at linux.intel.com
Fri Aug 3 04:22:58 PDT 2012


From: Ning Tang <tecton69 at gmail.com>

Making icon-size, layout's row and column number manageable in
 weston-tablet.ini. Removing click restriction when mouse
 dragging.

Signed-off-by: Tang Ning <tecton69 at gmail.com>
---
 clients/tablet-shell.c | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/clients/tablet-shell.c b/clients/tablet-shell.c
index d3d1738..d5ba05e 100644
--- a/clients/tablet-shell.c
+++ b/clients/tablet-shell.c
@@ -108,7 +108,9 @@ static char *key_trash_image;
 /* launcher drag */
 struct launcher *gl_launcher_drag = NULL;
 /* launcher size */
-static int launcher_size = 64;
+static int launcher_size;
+static int key_layout_rows;
+static int key_layout_columns;
 /* trash parameters */
 static cairo_surface_t *trash_surface = NULL;
 static int trash_x, trash_y;
@@ -120,6 +122,9 @@ 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-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[] = {
@@ -461,9 +466,6 @@ launcher_motion_handler(struct widget *widget, struct input *input,
 				  launcher_size + 2 * pointer->height);
 
 		launcher->dragging = 1;
-	} else if (!launcher->dragging && launcher->pressed == 1) {
-		launcher->pressed = 0;
-		widget_schedule_redraw(launcher->widget);
 	}
 
 	return CURSOR_HAND1;
@@ -811,8 +813,7 @@ layout_redraw_handler(struct widget *widget, void *data)
 	struct layout *current = data;
 	struct launcher *launcher;
 	struct rectangle allocation;
-	const int rows = 3, columns = 4, icon_width = launcher_size,
-	icon_height = launcher_size;
+	const int icon_width = launcher_size, icon_height = launcher_size;
 	int x, y, i, width, height, vpadding, hpadding;
 	struct wl_callback *callback;
 
@@ -821,12 +822,12 @@ layout_redraw_handler(struct widget *widget, void *data)
 
 	widget_get_allocation(widget, &allocation);
 
-	width = allocation.width - columns * icon_width;
+	width = allocation.width - key_layout_columns * icon_width;
 	/* width between icons */
-	hpadding = width / (columns - 1);
+	hpadding = width / (key_layout_columns - 1);
 
-	height = allocation.height - rows * icon_height;
-	vpadding = height / (rows - 1);
+	height = allocation.height - key_layout_rows * icon_height;
+	vpadding = height / (key_layout_rows - 1);
 
 	x = allocation.x;
 	y = allocation.y;
@@ -837,7 +838,7 @@ layout_redraw_handler(struct widget *widget, void *data)
 				      y, icon_width, icon_height);
 		x += icon_width + hpadding;
 		i++;
-		if (i == columns) {
+		if (i == key_layout_columns) {
 			x = allocation.x;
 			y += icon_height + vpadding;
 			i = 0;
@@ -866,7 +867,7 @@ layout_redraw_handler(struct widget *widget, void *data)
 			}
 			x += icon_width + hpadding;
 			i++;
-			if (i == columns) {
+			if (i == key_layout_columns) {
 				x = allocation.x + layout->offset
 				+ allocation.width + 2 * layout->hmargin;
 				y += icon_height + vpadding;
@@ -895,7 +896,7 @@ layout_redraw_handler(struct widget *widget, void *data)
 			}
 			x += icon_width + hpadding;
 			i++;
-			if (i == columns) {
+			if (i == key_layout_columns) {
 				x = width - allocation.width;
 				y += icon_height + vpadding;
 				i = 0;
-- 
1.7.11



More information about the wayland-devel mailing list