mirror of
https://github.com/labwc/labwc.git
synced 2025-11-03 09:01:51 -05:00
xdg,xwl: rename functions
This commit is contained in:
parent
1b65456f8c
commit
d831743b25
2 changed files with 37 additions and 37 deletions
20
src/xdg.c
20
src/xdg.c
|
|
@ -72,26 +72,26 @@ static void handle_commit(struct wl_listener *listener, void *data)
|
||||||
view->h = view->surface->current.height;
|
view->h = view->surface->current.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
void xdg_surface_map(struct wl_listener *listener, void *data)
|
static void handle_map(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
struct view *view = wl_container_of(listener, view, map);
|
struct view *view = wl_container_of(listener, view, map);
|
||||||
view->impl->map(view);
|
view->impl->map(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
void xdg_surface_unmap(struct wl_listener *listener, void *data)
|
static void handle_unmap(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
struct view *view = wl_container_of(listener, view, unmap);
|
struct view *view = wl_container_of(listener, view, unmap);
|
||||||
view->impl->unmap(view);
|
view->impl->unmap(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
void xdg_surface_destroy(struct wl_listener *listener, void *data)
|
static void handle_destroy(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
struct view *view = wl_container_of(listener, view, destroy);
|
struct view *view = wl_container_of(listener, view, destroy);
|
||||||
wl_list_remove(&view->link);
|
wl_list_remove(&view->link);
|
||||||
free(view);
|
free(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
void xdg_toplevel_request_move(struct wl_listener *listener, void *data)
|
static void handle_request_move(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
/* This event is raised when a client would like to begin an interactive
|
/* This event is raised when a client would like to begin an interactive
|
||||||
* move, typically because the user clicked on their client-side
|
* move, typically because the user clicked on their client-side
|
||||||
|
|
@ -104,7 +104,7 @@ void xdg_toplevel_request_move(struct wl_listener *listener, void *data)
|
||||||
interactive_begin(view, LAB_CURSOR_MOVE, 0);
|
interactive_begin(view, LAB_CURSOR_MOVE, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void xdg_toplevel_request_resize(struct wl_listener *listener, void *data)
|
static void handle_request_resize(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
/* This event is raised when a client would like to begin an interactive
|
/* This event is raised when a client would like to begin an interactive
|
||||||
* resize, typically because the user clicked on their client-side
|
* resize, typically because the user clicked on their client-side
|
||||||
|
|
@ -172,17 +172,17 @@ void xdg_surface_new(struct wl_listener *listener, void *data)
|
||||||
view->impl = &xdg_toplevel_view_impl;
|
view->impl = &xdg_toplevel_view_impl;
|
||||||
view->xdg_surface = xdg_surface;
|
view->xdg_surface = xdg_surface;
|
||||||
|
|
||||||
view->map.notify = xdg_surface_map;
|
view->map.notify = handle_map;
|
||||||
wl_signal_add(&xdg_surface->events.map, &view->map);
|
wl_signal_add(&xdg_surface->events.map, &view->map);
|
||||||
view->unmap.notify = xdg_surface_unmap;
|
view->unmap.notify = handle_unmap;
|
||||||
wl_signal_add(&xdg_surface->events.unmap, &view->unmap);
|
wl_signal_add(&xdg_surface->events.unmap, &view->unmap);
|
||||||
view->destroy.notify = xdg_surface_destroy;
|
view->destroy.notify = handle_destroy;
|
||||||
wl_signal_add(&xdg_surface->events.destroy, &view->destroy);
|
wl_signal_add(&xdg_surface->events.destroy, &view->destroy);
|
||||||
|
|
||||||
struct wlr_xdg_toplevel *toplevel = xdg_surface->toplevel;
|
struct wlr_xdg_toplevel *toplevel = xdg_surface->toplevel;
|
||||||
view->request_move.notify = xdg_toplevel_request_move;
|
view->request_move.notify = handle_request_move;
|
||||||
wl_signal_add(&toplevel->events.request_move, &view->request_move);
|
wl_signal_add(&toplevel->events.request_move, &view->request_move);
|
||||||
view->request_resize.notify = xdg_toplevel_request_resize;
|
view->request_resize.notify = handle_request_resize;
|
||||||
wl_signal_add(&toplevel->events.request_resize, &view->request_resize);
|
wl_signal_add(&toplevel->events.request_resize, &view->request_resize);
|
||||||
|
|
||||||
wl_list_insert(&server->views, &view->link);
|
wl_list_insert(&server->views, &view->link);
|
||||||
|
|
|
||||||
54
src/xwl.c
54
src/xwl.c
|
|
@ -2,16 +2,6 @@
|
||||||
#include "common/log.h"
|
#include "common/log.h"
|
||||||
#include "common/bug-on.h"
|
#include "common/bug-on.h"
|
||||||
|
|
||||||
static bool has_ssd(struct view *view)
|
|
||||||
{
|
|
||||||
if (view->xwayland_surface->override_redirect)
|
|
||||||
return false;
|
|
||||||
if (view->xwayland_surface->decorations !=
|
|
||||||
WLR_XWAYLAND_SURFACE_DECORATIONS_ALL)
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void handle_commit(struct wl_listener *listener, void *data)
|
static void handle_commit(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
struct view *view = wl_container_of(listener, view, commit);
|
struct view *view = wl_container_of(listener, view, commit);
|
||||||
|
|
@ -22,19 +12,19 @@ static void handle_commit(struct wl_listener *listener, void *data)
|
||||||
view->h = view->surface->current.height;
|
view->h = view->surface->current.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
void xwl_surface_map(struct wl_listener *listener, void *data)
|
static void handle_map(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
struct view *view = wl_container_of(listener, view, map);
|
struct view *view = wl_container_of(listener, view, map);
|
||||||
view->impl->map(view);
|
view->impl->map(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
void xwl_surface_unmap(struct wl_listener *listener, void *data)
|
static void handle_unmap(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
struct view *view = wl_container_of(listener, view, unmap);
|
struct view *view = wl_container_of(listener, view, unmap);
|
||||||
view->impl->unmap(view);
|
view->impl->unmap(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
void xwl_surface_destroy(struct wl_listener *listener, void *data)
|
static void handle_destroy(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
struct view *view = wl_container_of(listener, view, destroy);
|
struct view *view = wl_container_of(listener, view, destroy);
|
||||||
if (view->been_mapped)
|
if (view->been_mapped)
|
||||||
|
|
@ -46,7 +36,7 @@ void xwl_surface_destroy(struct wl_listener *listener, void *data)
|
||||||
free(view);
|
free(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
void xwl_surface_configure(struct wl_listener *listener, void *data)
|
static void handle_request_configure(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
struct view *view = wl_container_of(listener, view, request_configure);
|
struct view *view = wl_container_of(listener, view, request_configure);
|
||||||
struct wlr_xwayland_surface_configure_event *event = data;
|
struct wlr_xwayland_surface_configure_event *event = data;
|
||||||
|
|
@ -54,26 +44,36 @@ void xwl_surface_configure(struct wl_listener *listener, void *data)
|
||||||
event->y, event->width, event->height);
|
event->y, event->width, event->height);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xwl_view_configure(struct view *view, struct wlr_box geo)
|
static void configure(struct view *view, struct wlr_box geo)
|
||||||
{
|
{
|
||||||
wlr_xwayland_surface_configure(view->xwayland_surface, (int16_t)geo.x,
|
wlr_xwayland_surface_configure(view->xwayland_surface, (int16_t)geo.x,
|
||||||
(int16_t)geo.y, (uint16_t)geo.width,
|
(int16_t)geo.y, (uint16_t)geo.width,
|
||||||
(uint16_t)geo.height);
|
(uint16_t)geo.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xwl_view_close(struct view *view)
|
static void _close(struct view *view)
|
||||||
{
|
{
|
||||||
wlr_xwayland_surface_close(view->xwayland_surface);
|
wlr_xwayland_surface_close(view->xwayland_surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xwl_view_map(struct view *view)
|
static bool want_ssd(struct view *view)
|
||||||
|
{
|
||||||
|
if (view->xwayland_surface->override_redirect)
|
||||||
|
return false;
|
||||||
|
if (view->xwayland_surface->decorations !=
|
||||||
|
WLR_XWAYLAND_SURFACE_DECORATIONS_ALL)
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void map(struct view *view)
|
||||||
{
|
{
|
||||||
view->mapped = true;
|
view->mapped = true;
|
||||||
view->x = view->xwayland_surface->x;
|
view->x = view->xwayland_surface->x;
|
||||||
view->y = view->xwayland_surface->y;
|
view->y = view->xwayland_surface->y;
|
||||||
view->surface = view->xwayland_surface->surface;
|
view->surface = view->xwayland_surface->surface;
|
||||||
if (!view->been_mapped) {
|
if (!view->been_mapped) {
|
||||||
view->show_server_side_deco = has_ssd(view);
|
view->show_server_side_deco = want_ssd(view);
|
||||||
view_init_position(view);
|
view_init_position(view);
|
||||||
wl_list_insert(&view->server->views, &view->link);
|
wl_list_insert(&view->server->views, &view->link);
|
||||||
}
|
}
|
||||||
|
|
@ -90,7 +90,7 @@ static void xwl_view_map(struct view *view)
|
||||||
view_focus(view);
|
view_focus(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xwl_view_unmap(struct view *view)
|
static void unmap(struct view *view)
|
||||||
{
|
{
|
||||||
view->mapped = false;
|
view->mapped = false;
|
||||||
wl_list_remove(&view->commit.link);
|
wl_list_remove(&view->commit.link);
|
||||||
|
|
@ -98,10 +98,10 @@ static void xwl_view_unmap(struct view *view)
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct view_impl xwl_view_impl = {
|
static const struct view_impl xwl_view_impl = {
|
||||||
.configure = xwl_view_configure,
|
.configure = configure,
|
||||||
.close = xwl_view_close,
|
.close = _close,
|
||||||
.map = xwl_view_map,
|
.map = map,
|
||||||
.unmap = xwl_view_unmap,
|
.unmap = unmap,
|
||||||
};
|
};
|
||||||
|
|
||||||
void xwl_surface_new(struct wl_listener *listener, void *data)
|
void xwl_surface_new(struct wl_listener *listener, void *data)
|
||||||
|
|
@ -117,13 +117,13 @@ void xwl_surface_new(struct wl_listener *listener, void *data)
|
||||||
view->impl = &xwl_view_impl;
|
view->impl = &xwl_view_impl;
|
||||||
view->xwayland_surface = xwayland_surface;
|
view->xwayland_surface = xwayland_surface;
|
||||||
|
|
||||||
view->map.notify = xwl_surface_map;
|
view->map.notify = handle_map;
|
||||||
wl_signal_add(&xwayland_surface->events.map, &view->map);
|
wl_signal_add(&xwayland_surface->events.map, &view->map);
|
||||||
view->unmap.notify = xwl_surface_unmap;
|
view->unmap.notify = handle_unmap;
|
||||||
wl_signal_add(&xwayland_surface->events.unmap, &view->unmap);
|
wl_signal_add(&xwayland_surface->events.unmap, &view->unmap);
|
||||||
view->destroy.notify = xwl_surface_destroy;
|
view->destroy.notify = handle_destroy;
|
||||||
wl_signal_add(&xwayland_surface->events.destroy, &view->destroy);
|
wl_signal_add(&xwayland_surface->events.destroy, &view->destroy);
|
||||||
view->request_configure.notify = xwl_surface_configure;
|
view->request_configure.notify = handle_request_configure;
|
||||||
wl_signal_add(&xwayland_surface->events.request_configure,
|
wl_signal_add(&xwayland_surface->events.request_configure,
|
||||||
&view->request_configure);
|
&view->request_configure);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue