Share code to to classify pointer location in frame
diff --git a/src/xwayland/window-manager.c b/src/xwayland/window-manager.c
index 36270d1..a2f392b 100644
--- a/src/xwayland/window-manager.c
+++ b/src/xwayland/window-manager.c
@@ -779,6 +779,8 @@
 	struct weston_shell_interface *shell_interface =
 		&wm->server->compositor->shell_interface;
 	struct weston_wm_window *window;
+	enum theme_location location;
+	struct theme *t = wm->theme;
 
 	fprintf(stderr, "XCB_BUTTON_%s (detail %d)\n",
 		button->response_type == XCB_BUTTON_PRESS ?
@@ -786,9 +788,22 @@
 
 	window = hash_table_lookup(wm->window_hash, button->event);
 	if (button->response_type == XCB_BUTTON_PRESS &&
-	    button->detail == 1)
-		shell_interface->move(window->shsurf,
-				      wm->server->compositor->seat);
+	    button->detail == 1) {
+		location = theme_get_location(t,
+					      button->event_x,
+					      button->event_y,
+					      window->width,
+					      window->height);
+
+		switch (location) {
+		case THEME_LOCATION_TITLEBAR:
+			shell_interface->move(window->shsurf,
+					      wm->server->compositor->seat);
+			break;
+		default:
+			break;
+		}
+	}
 }
 
 static int