Commit a59571f5 authored by Guido Gunther's avatar Guido Gunther
Browse files

Merge branch 'master' into librem5

parents 4853f285 8d03bc91
......@@ -12,6 +12,8 @@ wlroots specific
wayland, x11, headless)
* *WLR_WL_OUTPUTS*: when using the wayland backend specifies the number of outputs
* *WLR_X11_OUTPUTS*: when using the X11 backend specifies the number of outputs
* *WLR_HEADLESS_OUTPUTS*: when using the headless backend specifies the number
of outputs
rootston specific
------------------
......
......@@ -8,7 +8,7 @@
#include <wlr/types/wlr_idle.h>
#include <wlr/types/wlr_input_inhibitor.h>
#include <wlr/types/wlr_layer_shell.h>
#include <wlr/types/wlr_linux_dmabuf.h>
#include <wlr/types/wlr_linux_dmabuf_v1.h>
#include <wlr/types/wlr_list.h>
#include <wlr/types/wlr_output_layout.h>
#include <wlr/types/wlr_output.h>
......@@ -53,7 +53,7 @@ struct roots_desktop {
struct wlr_idle *idle;
struct wlr_idle_inhibit_manager_v1 *idle_inhibit;
struct wlr_input_inhibit_manager *input_inhibit;
struct wlr_linux_dmabuf *linux_dmabuf;
struct wlr_linux_dmabuf_v1 *linux_dmabuf;
struct wlr_layer_shell *layer_shell;
struct wlr_virtual_keyboard_manager_v1 *virtual_keyboard;
struct wlr_screencopy_manager_v1 *screencopy;
......
......@@ -5,7 +5,7 @@
#include <wayland-server-protocol.h>
#include <wlr/render/dmabuf.h>
struct wlr_dmabuf_buffer {
struct wlr_dmabuf_v1_buffer {
struct wlr_renderer *renderer;
struct wl_resource *buffer_resource;
struct wl_resource *params_resource;
......@@ -17,24 +17,24 @@ struct wlr_dmabuf_buffer {
* Returns true if the given resource was created via the linux-dmabuf
* buffer protocol, false otherwise
*/
bool wlr_dmabuf_resource_is_buffer(struct wl_resource *buffer_resource);
bool wlr_dmabuf_v1_resource_is_buffer(struct wl_resource *buffer_resource);
/**
* Returns the wlr_dmabuf_buffer if the given resource was created
* via the linux-dmabuf buffer protocol
*/
struct wlr_dmabuf_buffer *wlr_dmabuf_buffer_from_buffer_resource(
struct wlr_dmabuf_v1_buffer *wlr_dmabuf_v1_buffer_from_buffer_resource(
struct wl_resource *buffer_resource);
/**
* Returns the wlr_dmabuf_buffer if the given resource was created
* via the linux-dmabuf params protocol
*/
struct wlr_dmabuf_buffer *wlr_dmabuf_buffer_from_params_resource(
struct wlr_dmabuf_v1_buffer *wlr_dmabuf_v1_buffer_from_params_resource(
struct wl_resource *params_resource);
/* the protocol interface */
struct wlr_linux_dmabuf {
struct wlr_linux_dmabuf_v1 {
struct wl_global *global;
struct wlr_renderer *renderer;
struct wl_list resources;
......@@ -50,18 +50,18 @@ struct wlr_linux_dmabuf {
/**
* Create linux-dmabuf interface
*/
struct wlr_linux_dmabuf *wlr_linux_dmabuf_create(struct wl_display *display,
struct wlr_linux_dmabuf_v1 *wlr_linux_dmabuf_v1_create(struct wl_display *display,
struct wlr_renderer *renderer);
/**
* Destroy the linux-dmabuf interface
*/
void wlr_linux_dmabuf_destroy(struct wlr_linux_dmabuf *linux_dmabuf);
void wlr_linux_dmabuf_v1_destroy(struct wlr_linux_dmabuf_v1 *linux_dmabuf);
/**
* Returns the wlr_linux_dmabuf if the given resource was created
* via the linux_dmabuf protocol
*/
struct wlr_linux_dmabuf *wlr_linux_dmabuf_from_resource(
struct wlr_linux_dmabuf_v1 *wlr_linux_dmabuf_v1_from_resource(
struct wl_resource *resource);
#endif
......@@ -6,7 +6,7 @@
#include <time.h>
#include <wayland-server.h>
#include <wayland-util.h>
#include <wlr/types/wlr_linux_dmabuf.h>
#include <wlr/render/dmabuf.h>
struct wlr_output_mode {
uint32_t flags; // enum wl_output_mode
......
......@@ -150,6 +150,8 @@ struct wlr_xwayland_surface {
struct wl_signal set_parent;
struct wl_signal set_pid;
struct wl_signal set_window_type;
struct wl_signal set_hints;
struct wl_signal set_override_redirect;
struct wl_signal ping_timeout;
} events;
......@@ -200,9 +202,6 @@ void wlr_xwayland_surface_set_fullscreen(struct wlr_xwayland_surface *surface,
void wlr_xwayland_set_seat(struct wlr_xwayland *xwayland,
struct wlr_seat *seat);
bool wlr_xwayland_surface_is_unmanaged(
const struct wlr_xwayland_surface *surface);
bool wlr_surface_is_xwayland_surface(struct wlr_surface *surface);
struct wlr_xwayland_surface *wlr_xwayland_surface_from_wlr_surface(
......
......@@ -13,7 +13,7 @@
#include <wlr/types/wlr_idle.h>
#include <wlr/types/wlr_input_inhibitor.h>
#include <wlr/types/wlr_layer_shell.h>
#include <wlr/types/wlr_linux_dmabuf.h>
#include <wlr/types/wlr_linux_dmabuf_v1.h>
#include <wlr/types/wlr_output_layout.h>
#include <wlr/types/wlr_primary_selection.h>
#include <wlr/types/wlr_server_decoration.h>
......@@ -874,7 +874,7 @@ struct roots_desktop *desktop_create(struct roots_server *server,
wl_signal_add(&desktop->input_inhibit->events.deactivate,
&desktop->input_inhibit_deactivate);
desktop->linux_dmabuf = wlr_linux_dmabuf_create(server->wl_display,
desktop->linux_dmabuf = wlr_linux_dmabuf_v1_create(server->wl_display,
server->renderer);
desktop->phosh = phosh_create(desktop, server->wl_display);
......
......@@ -127,13 +127,13 @@ static void handle_tablet_tool_position(struct roots_cursor *cursor,
struct wlr_surface *surface = desktop_surface_at(desktop,
cursor->cursor->x, cursor->cursor->y, &sx, &sy, &view);
struct roots_tablet_tool *roots_tool = tool->data;
if (!surface) {
wlr_send_tablet_v2_tablet_tool_proximity_out(roots_tool->tablet_v2_tool);
/* XXX: TODO: Fallback pointer semantics */
return;
}
if (!wlr_surface_accepts_tablet_v2(tablet->tablet_v2, surface)) {
wlr_send_tablet_v2_tablet_tool_proximity_out(roots_tool->tablet_v2_tool);
/* XXX: TODO: Fallback pointer semantics */
......@@ -217,7 +217,7 @@ static void handle_tool_tip(struct wl_listener *listener, void *data) {
static void handle_tablet_tool_destroy(struct wl_listener *listener, void *data) {
struct roots_tablet_tool *tool =
wl_container_of(listener, tool, tool_destroy);
wl_list_remove(&tool->link);
wl_list_remove(&tool->tool_link);
......@@ -1124,7 +1124,7 @@ void roots_seat_set_focus(struct roots_seat *seat, struct roots_view *view) {
#ifdef WLR_HAS_XWAYLAND
if (view && view->type == ROOTS_XWAYLAND_VIEW &&
wlr_xwayland_surface_is_unmanaged(view->xwayland_surface)) {
view->xwayland_surface->override_redirect) {
return;
}
#endif
......
......@@ -31,7 +31,7 @@ lib_wlr_types = static_library(
'wlr_input_inhibitor.c',
'wlr_keyboard.c',
'wlr_layer_shell.c',
'wlr_linux_dmabuf.c',
'wlr_linux_dmabuf_v1.c',
'wlr_list.c',
'wlr_matrix.c',
'wlr_output_damage.c',
......
#include <assert.h>
#include <stdlib.h>
#include <wlr/types/wlr_buffer.h>
#include <wlr/types/wlr_linux_dmabuf.h>
#include <wlr/render/wlr_renderer.h>
#include <wlr/types/wlr_buffer.h>
#include <wlr/types/wlr_linux_dmabuf_v1.h>
#include <wlr/util/log.h>
bool wlr_resource_is_buffer(struct wl_resource *resource) {
......@@ -21,9 +21,9 @@ bool wlr_buffer_get_resource_size(struct wl_resource *resource,
resource)) {
wlr_renderer_wl_drm_buffer_get_size(renderer, resource,
width, height);
} else if (wlr_dmabuf_resource_is_buffer(resource)) {
struct wlr_dmabuf_buffer *dmabuf =
wlr_dmabuf_buffer_from_buffer_resource(resource);
} else if (wlr_dmabuf_v1_resource_is_buffer(resource)) {
struct wlr_dmabuf_v1_buffer *dmabuf =
wlr_dmabuf_v1_buffer_from_buffer_resource(resource);
*width = dmabuf->attributes.width;
*height = dmabuf->attributes.height;
} else {
......@@ -77,9 +77,9 @@ struct wlr_buffer *wlr_buffer_create(struct wlr_renderer *renderer,
released = true;
} else if (wlr_renderer_resource_is_wl_drm_buffer(renderer, resource)) {
texture = wlr_texture_from_wl_drm(renderer, resource);
} else if (wlr_dmabuf_resource_is_buffer(resource)) {
struct wlr_dmabuf_buffer *dmabuf =
wlr_dmabuf_buffer_from_buffer_resource(resource);
} else if (wlr_dmabuf_v1_resource_is_buffer(resource)) {
struct wlr_dmabuf_v1_buffer *dmabuf =
wlr_dmabuf_v1_buffer_from_buffer_resource(resource);
texture = wlr_texture_from_dmabuf(renderer, &dmabuf->attributes);
// We have imported the DMA-BUF, but we need to prevent the client from
......
......@@ -2,8 +2,8 @@
#include <stdlib.h>
#include <unistd.h>
#include <wlr/interfaces/wlr_output.h>
#include <wlr/render/dmabuf.h>
#include <wlr/types/wlr_export_dmabuf_v1.h>
#include <wlr/types/wlr_linux_dmabuf.h>
#include <wlr/types/wlr_output.h>
#include "wlr-export-dmabuf-unstable-v1-protocol.h"
#include <wlr/util/log.h>
......
......@@ -4,7 +4,7 @@
#include <unistd.h>
#include <wayland-server.h>
#include <wlr/render/wlr_renderer.h>
#include <wlr/types/wlr_linux_dmabuf.h>
#include <wlr/types/wlr_linux_dmabuf_v1.h>
#include <wlr/util/log.h>
#include "linux-dmabuf-unstable-v1-protocol.h"
#include "util/signal.h"
......@@ -20,13 +20,13 @@ static const struct wl_buffer_interface buffer_impl = {
.destroy = buffer_handle_destroy,
};
bool wlr_dmabuf_resource_is_buffer(struct wl_resource *buffer_resource) {
bool wlr_dmabuf_v1_resource_is_buffer(struct wl_resource *buffer_resource) {
if (!wl_resource_instance_of(buffer_resource, &wl_buffer_interface,
&buffer_impl)) {
return false;
}
struct wlr_dmabuf_buffer *buffer =
struct wlr_dmabuf_v1_buffer *buffer =
wl_resource_get_user_data(buffer_resource);
if (buffer && buffer->buffer_resource && !buffer->params_resource &&
buffer->buffer_resource == buffer_resource) {
......@@ -36,12 +36,12 @@ bool wlr_dmabuf_resource_is_buffer(struct wl_resource *buffer_resource) {
return false;
}
struct wlr_dmabuf_buffer *wlr_dmabuf_buffer_from_buffer_resource(
struct wlr_dmabuf_v1_buffer *wlr_dmabuf_v1_buffer_from_buffer_resource(
struct wl_resource *buffer_resource) {
assert(wl_resource_instance_of(buffer_resource, &wl_buffer_interface,
&buffer_impl));
struct wlr_dmabuf_buffer *buffer =
struct wlr_dmabuf_v1_buffer *buffer =
wl_resource_get_user_data(buffer_resource);
assert(buffer);
assert(buffer->buffer_resource);
......@@ -51,7 +51,7 @@ struct wlr_dmabuf_buffer *wlr_dmabuf_buffer_from_buffer_resource(
return buffer;
}
static void linux_dmabuf_buffer_destroy(struct wlr_dmabuf_buffer *buffer) {
static void linux_dmabuf_buffer_destroy(struct wlr_dmabuf_v1_buffer *buffer) {
wlr_dmabuf_attributes_finish(&buffer->attributes);
free(buffer);
}
......@@ -65,8 +65,8 @@ static void params_add(struct wl_client *client,
struct wl_resource *params_resource, int32_t fd,
uint32_t plane_idx, uint32_t offset, uint32_t stride,
uint32_t modifier_hi, uint32_t modifier_lo) {
struct wlr_dmabuf_buffer *buffer =
wlr_dmabuf_buffer_from_params_resource(params_resource);
struct wlr_dmabuf_v1_buffer *buffer =
wlr_dmabuf_v1_buffer_from_params_resource(params_resource);
if (!buffer) {
wl_resource_post_error(params_resource,
......@@ -113,12 +113,12 @@ static void params_add(struct wl_client *client,
}
static void buffer_handle_resource_destroy(struct wl_resource *buffer_resource) {
struct wlr_dmabuf_buffer *buffer =
wlr_dmabuf_buffer_from_buffer_resource(buffer_resource);
struct wlr_dmabuf_v1_buffer *buffer =
wlr_dmabuf_v1_buffer_from_buffer_resource(buffer_resource);
linux_dmabuf_buffer_destroy(buffer);
}
static bool check_import_dmabuf(struct wlr_dmabuf_buffer *buffer) {
static bool check_import_dmabuf(struct wlr_dmabuf_v1_buffer *buffer) {
struct wlr_texture *texture =
wlr_texture_from_dmabuf(buffer->renderer, &buffer->attributes);
if (texture == NULL) {
......@@ -140,8 +140,8 @@ static void params_create_common(struct wl_client *client,
"params was already used to create a wl_buffer");
return;
}
struct wlr_dmabuf_buffer *buffer =
wlr_dmabuf_buffer_from_params_resource(params_resource);
struct wlr_dmabuf_v1_buffer *buffer =
wlr_dmabuf_v1_buffer_from_params_resource(params_resource);
/* Switch the linux_dmabuf_buffer object from params resource to
* eventually wl_buffer resource. */
......@@ -302,13 +302,13 @@ static const struct zwp_linux_buffer_params_v1_interface
.create_immed = params_create_immed,
};
struct wlr_dmabuf_buffer *wlr_dmabuf_buffer_from_params_resource(
struct wlr_dmabuf_v1_buffer *wlr_dmabuf_v1_buffer_from_params_resource(
struct wl_resource *params_resource) {
assert(wl_resource_instance_of(params_resource,
&zwp_linux_buffer_params_v1_interface,
&linux_buffer_params_impl));
struct wlr_dmabuf_buffer *buffer =
struct wlr_dmabuf_v1_buffer *buffer =
wl_resource_get_user_data(params_resource);
assert(buffer);
assert(buffer->params_resource);
......@@ -319,24 +319,24 @@ struct wlr_dmabuf_buffer *wlr_dmabuf_buffer_from_params_resource(
}
static void handle_params_destroy(struct wl_resource *params_resource) {
/* Check for NULL since wlr_dmabuf_buffer_from_params_resource will choke */
/* Check for NULL since wlr_dmabuf_v1_buffer_from_params_resource will choke */
if (!wl_resource_get_user_data(params_resource)) {
return;
}
struct wlr_dmabuf_buffer *buffer =
wlr_dmabuf_buffer_from_params_resource(params_resource);
struct wlr_dmabuf_v1_buffer *buffer =
wlr_dmabuf_v1_buffer_from_params_resource(params_resource);
linux_dmabuf_buffer_destroy(buffer);
}
static void linux_dmabuf_create_params(struct wl_client *client,
struct wl_resource *linux_dmabuf_resource,
uint32_t params_id) {
struct wlr_linux_dmabuf *linux_dmabuf =
wlr_linux_dmabuf_from_resource(linux_dmabuf_resource);
struct wlr_linux_dmabuf_v1 *linux_dmabuf =
wlr_linux_dmabuf_v1_from_resource(linux_dmabuf_resource);
uint32_t version = wl_resource_get_version(linux_dmabuf_resource);
struct wlr_dmabuf_buffer *buffer = calloc(1, sizeof *buffer);
struct wlr_dmabuf_v1_buffer *buffer = calloc(1, sizeof *buffer);
if (!buffer) {
goto err;
}
......@@ -372,17 +372,17 @@ static const struct zwp_linux_dmabuf_v1_interface linux_dmabuf_impl = {
.create_params = linux_dmabuf_create_params,
};
struct wlr_linux_dmabuf *wlr_linux_dmabuf_from_resource(
struct wlr_linux_dmabuf_v1 *wlr_linux_dmabuf_v1_from_resource(
struct wl_resource *resource) {
assert(wl_resource_instance_of(resource, &zwp_linux_dmabuf_v1_interface,
&linux_dmabuf_impl));
struct wlr_linux_dmabuf *dmabuf = wl_resource_get_user_data(resource);
struct wlr_linux_dmabuf_v1 *dmabuf = wl_resource_get_user_data(resource);
assert(dmabuf);
return dmabuf;
}
static void linux_dmabuf_send_modifiers(struct wlr_linux_dmabuf *linux_dmabuf,
static void linux_dmabuf_send_modifiers(struct wlr_linux_dmabuf_v1 *linux_dmabuf,
struct wl_resource *resource) {
struct wlr_renderer *renderer = linux_dmabuf->renderer;
/*
......@@ -428,7 +428,7 @@ static void linux_dmabuf_resource_destroy(struct wl_resource *resource) {
static void linux_dmabuf_bind(struct wl_client *client, void *data,
uint32_t version, uint32_t id) {
struct wlr_linux_dmabuf *linux_dmabuf = data;
struct wlr_linux_dmabuf_v1 *linux_dmabuf = data;
struct wl_resource *resource = wl_resource_create(client,
&zwp_linux_dmabuf_v1_interface, version, id);
......@@ -445,7 +445,7 @@ static void linux_dmabuf_bind(struct wl_client *client, void *data,
}
}
void wlr_linux_dmabuf_destroy(struct wlr_linux_dmabuf *linux_dmabuf) {
void wlr_linux_dmabuf_v1_destroy(struct wlr_linux_dmabuf_v1 *linux_dmabuf) {
if (!linux_dmabuf) {
return;
}
......@@ -465,21 +465,21 @@ void wlr_linux_dmabuf_destroy(struct wlr_linux_dmabuf *linux_dmabuf) {
}
static void handle_display_destroy(struct wl_listener *listener, void *data) {
struct wlr_linux_dmabuf *linux_dmabuf =
struct wlr_linux_dmabuf_v1 *linux_dmabuf =
wl_container_of(listener, linux_dmabuf, display_destroy);
wlr_linux_dmabuf_destroy(linux_dmabuf);
wlr_linux_dmabuf_v1_destroy(linux_dmabuf);
}
static void handle_renderer_destroy(struct wl_listener *listener, void *data) {
struct wlr_linux_dmabuf *linux_dmabuf =
struct wlr_linux_dmabuf_v1 *linux_dmabuf =
wl_container_of(listener, linux_dmabuf, renderer_destroy);
wlr_linux_dmabuf_destroy(linux_dmabuf);
wlr_linux_dmabuf_v1_destroy(linux_dmabuf);
}
struct wlr_linux_dmabuf *wlr_linux_dmabuf_create(struct wl_display *display,
struct wlr_linux_dmabuf_v1 *wlr_linux_dmabuf_v1_create(struct wl_display *display,
struct wlr_renderer *renderer) {
struct wlr_linux_dmabuf *linux_dmabuf =
calloc(1, sizeof(struct wlr_linux_dmabuf));
struct wlr_linux_dmabuf_v1 *linux_dmabuf =
calloc(1, sizeof(struct wlr_linux_dmabuf_v1));
if (linux_dmabuf == NULL) {
wlr_log(WLR_ERROR, "could not create simple dmabuf manager");
return NULL;
......
......@@ -154,6 +154,8 @@ static struct wlr_xwayland_surface *xwayland_surface_create(
wl_signal_init(&surface->events.set_parent);
wl_signal_init(&surface->events.set_pid);
wl_signal_init(&surface->events.set_window_type);
wl_signal_init(&surface->events.set_hints);
wl_signal_init(&surface->events.set_override_redirect);
wl_signal_init(&surface->events.ping_timeout);
xcb_get_geometry_reply_t *geometry_reply =
......@@ -240,8 +242,7 @@ static void xwm_send_focus_window(struct wlr_xwm *xwm,
XCB_CONFIG_WINDOW_STACK_MODE, values);
}
void xwm_surface_activate(struct wlr_xwm *xwm,
static void xwm_surface_activate(struct wlr_xwm *xwm,
struct wlr_xwayland_surface *xsurface) {
if (xwm->focus_surface == xsurface ||
(xsurface && xsurface->override_redirect)) {
......@@ -492,6 +493,7 @@ static void read_surface_hints(struct wlr_xwm *xwm,
xsurface->hints_urgency = xcb_icccm_wm_hints_get_urgency(&hints);
wlr_log(WLR_DEBUG, "WM_HINTS (%d)", reply->value_len);
wlr_signal_emit_safe(&xsurface->events.set_hints, xsurface);
}
#else
static void read_surface_hints(struct wlr_xwm *xwm,
......@@ -764,9 +766,7 @@ static void xwm_handle_configure_request(struct wlr_xwm *xwm,
static void xwm_handle_configure_notify(struct wlr_xwm *xwm,
xcb_configure_notify_event_t *ev) {
struct wlr_xwayland_surface *xsurface =
lookup_surface(xwm, ev->window);
struct wlr_xwayland_surface *xsurface = lookup_surface(xwm, ev->window);
if (!xsurface) {
return;
}
......@@ -775,6 +775,11 @@ static void xwm_handle_configure_notify(struct wlr_xwm *xwm,
xsurface->y = ev->y;
xsurface->width = ev->width;
xsurface->height = ev->height;
if (xsurface->override_redirect != ev->override_redirect) {
xsurface->override_redirect = ev->override_redirect;
wlr_signal_emit_safe(&xsurface->events.set_override_redirect, xsurface);
}
}
#define ICCCM_WITHDRAWN_STATE 0
......@@ -814,6 +819,15 @@ static void xwm_handle_map_request(struct wlr_xwm *xwm,
static void xwm_handle_map_notify(struct wlr_xwm *xwm,
xcb_map_notify_event_t *ev) {
wlr_log(WLR_DEBUG, "XCB_MAP_NOTIFY (%u)", ev->window);
struct wlr_xwayland_surface *xsurface = lookup_surface(xwm, ev->window);
if (!xsurface) {
return;
}
if (xsurface->override_redirect != ev->override_redirect) {
xsurface->override_redirect = ev->override_redirect;
wlr_signal_emit_safe(&xsurface->events.set_override_redirect, xsurface);
}
}
static void xwm_handle_unmap_notify(struct wlr_xwm *xwm,
......@@ -1659,30 +1673,6 @@ bool xwm_atoms_contains(struct wlr_xwm *xwm, xcb_atom_t *atoms,
return false;
}
bool wlr_xwayland_surface_is_unmanaged(
const struct wlr_xwayland_surface *surface) {
static enum atom_name needles[] = {
NET_WM_WINDOW_TYPE_COMBO,
NET_WM_WINDOW_TYPE_DND,
NET_WM_WINDOW_TYPE_DROPDOWN_MENU,
NET_WM_WINDOW_TYPE_MENU,
NET_WM_WINDOW_TYPE_NOTIFICATION,
NET_WM_WINDOW_TYPE_POPUP_MENU,
NET_WM_WINDOW_TYPE_SPLASH,
NET_WM_WINDOW_TYPE_TOOLTIP,
NET_WM_WINDOW_TYPE_UTILITY,
};
for (size_t i = 0; i < sizeof(needles) / sizeof(needles[0]); ++i) {
if (xwm_atoms_contains(surface->xwm, surface->window_type,
surface->window_type_len, needles[i])) {
return true;
}
}
return false;
}
void wlr_xwayland_surface_ping(struct wlr_xwayland_surface *surface) {
xcb_client_message_data_t data = { 0 };
data.data32[0] = surface->xwm->atoms[_NET_WM_PING];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment