mirror of
https://github.com/labwc/labwc.git
synced 2025-11-03 09:01:51 -05:00
Add view_impl .close
This commit is contained in:
parent
b99977368d
commit
625722cb66
4 changed files with 19 additions and 4 deletions
|
|
@ -106,6 +106,7 @@ enum deco_part {
|
|||
|
||||
struct view_impl {
|
||||
void (*configure)(struct view *view, struct wlr_box geo);
|
||||
void (*close)(struct view *view);
|
||||
};
|
||||
|
||||
struct view {
|
||||
|
|
|
|||
|
|
@ -198,6 +198,9 @@ void cursor_button(struct wl_listener *listener, void *data)
|
|||
/* Focus that client if the button was _pressed_ */
|
||||
view_focus(view);
|
||||
switch (view_area) {
|
||||
case LAB_DECO_BUTTON_CLOSE:
|
||||
view->impl->close(view);
|
||||
break;
|
||||
case LAB_DECO_PART_TITLE:
|
||||
interactive_begin(view, LAB_CURSOR_MOVE, 0);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -137,8 +137,14 @@ static void xdg_toplevel_view_configure(struct view *view, struct wlr_box geo)
|
|||
(uint32_t)geo.height);
|
||||
}
|
||||
|
||||
static void xdg_toplevel_view_close(struct view *view)
|
||||
{
|
||||
wlr_xdg_toplevel_send_close(view->xdg_surface);
|
||||
}
|
||||
|
||||
static const struct view_impl xdg_toplevel_view_impl = {
|
||||
.configure = xdg_toplevel_view_configure,
|
||||
.close = xdg_toplevel_view_close,
|
||||
};
|
||||
|
||||
void xdg_surface_new(struct wl_listener *listener, void *data)
|
||||
|
|
|
|||
13
src/xwl.c
13
src/xwl.c
|
|
@ -82,14 +82,19 @@ void xwl_surface_configure(struct wl_listener *listener, void *data)
|
|||
|
||||
static void xwl_view_configure(struct view *view, struct wlr_box geo)
|
||||
{
|
||||
return wlr_xwayland_surface_configure(view->xwayland_surface,
|
||||
(int16_t)geo.x, (int16_t)geo.y,
|
||||
(uint16_t)geo.width,
|
||||
(uint16_t)geo.height);
|
||||
wlr_xwayland_surface_configure(view->xwayland_surface, (int16_t)geo.x,
|
||||
(int16_t)geo.y, (uint16_t)geo.width,
|
||||
(uint16_t)geo.height);
|
||||
}
|
||||
|
||||
static void xwl_view_close(struct view *view)
|
||||
{
|
||||
wlr_xwayland_surface_close(view->xwayland_surface);
|
||||
}
|
||||
|
||||
static const struct view_impl xwl_view_impl = {
|
||||
.configure = xwl_view_configure,
|
||||
.close = xwl_view_close,
|
||||
};
|
||||
|
||||
void xwl_surface_new(struct wl_listener *listener, void *data)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue