switch to meson build + refactor code to remove compile warning
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@ -139,7 +139,5 @@ m4/lt~obsolete.m4
|
|||||||
# can automatically generate from config.status script
|
# can automatically generate from config.status script
|
||||||
# (which is called by configure script))
|
# (which is called by configure script))
|
||||||
# Makefile
|
# Makefile
|
||||||
xdg-shell-protocol.*
|
build
|
||||||
diyac
|
|
||||||
.vscode
|
.vscode
|
||||||
wlr-layer-shell-unstable-v1-protocol*
|
|
53
Makefile
53
Makefile
@ -1,53 +0,0 @@
|
|||||||
WAYLAND_PROTOCOLS=$(shell pkg-config --variable=pkgdatadir wayland-protocols)
|
|
||||||
WAYLAND_SCANNER=$(shell pkg-config --variable=wayland_scanner wayland-scanner)
|
|
||||||
LIBS=\
|
|
||||||
$(shell pkg-config --cflags --libs wlroots) \
|
|
||||||
$(shell pkg-config --cflags --libs wayland-server) \
|
|
||||||
$(shell pkg-config --cflags --libs xkbcommon)
|
|
||||||
|
|
||||||
OBJS=\
|
|
||||||
diyac.c \
|
|
||||||
cursor.c \
|
|
||||||
output.c \
|
|
||||||
seat.c \
|
|
||||||
node.c \
|
|
||||||
view.c \
|
|
||||||
foreign.c \
|
|
||||||
xdg.c \
|
|
||||||
xdg-shell-protocol.c \
|
|
||||||
layer.c \
|
|
||||||
session.c \
|
|
||||||
wlr-layer-shell-unstable-v1-protocol.c
|
|
||||||
|
|
||||||
# wayland-scanner is a tool which generates C headers and rigging for Wayland
|
|
||||||
# protocols, which are specified in XML. wlroots requires you to rig these up
|
|
||||||
# to your build system yourself and provide them in the include path.
|
|
||||||
xdg-shell-protocol.h:
|
|
||||||
$(WAYLAND_SCANNER) server-header \
|
|
||||||
$(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml $@
|
|
||||||
|
|
||||||
xdg-shell-protocol.c: xdg-shell-protocol.h
|
|
||||||
$(WAYLAND_SCANNER) private-code \
|
|
||||||
$(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml $@
|
|
||||||
|
|
||||||
wlr-layer-shell-unstable-v1-protocol.c: wlr-layer-shell-unstable-v1-protocol.h
|
|
||||||
$(WAYLAND_SCANNER) private-code \
|
|
||||||
protocol/wlr-layer-shell-unstable-v1.xml $@
|
|
||||||
|
|
||||||
wlr-layer-shell-unstable-v1-protocol.h:
|
|
||||||
$(WAYLAND_SCANNER) server-header \
|
|
||||||
protocol/wlr-layer-shell-unstable-v1.xml $@
|
|
||||||
|
|
||||||
diyac: $(OBJS)
|
|
||||||
echo "Object is $(OBJS)"
|
|
||||||
$(CC) $(CFLAGS) \
|
|
||||||
-g -Werror -I. \
|
|
||||||
-DWLR_USE_UNSTABLE \
|
|
||||||
-o $@ $(OBJS) \
|
|
||||||
$(LIBS)
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f diyac xdg-shell-protocol.* wlr-layer-shell-unstable-v1-protocol.*
|
|
||||||
|
|
||||||
.DEFAULT_GOAL=diyac
|
|
||||||
.PHONY: clean
|
|
7
cursor.c
7
cursor.c
@ -13,7 +13,7 @@ void diyac_cursor_focus(struct diyac_server *server)
|
|||||||
struct diyac_node_descriptor *desc = diyac_node_at(server,
|
struct diyac_node_descriptor *desc = diyac_node_at(server,
|
||||||
server->seat.cursor->x, server->seat.cursor->y, &surface, &sx, &sy);
|
server->seat.cursor->x, server->seat.cursor->y, &surface, &sx, &sy);
|
||||||
struct diyac_layer_surface *layer;
|
struct diyac_layer_surface *layer;
|
||||||
struct diyac_view *root = NULL;
|
// struct diyac_view *root = NULL;
|
||||||
if (!desc)
|
if (!desc)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -55,6 +55,7 @@ void diyac_reset_cursor_mode(struct diyac_server *server)
|
|||||||
|
|
||||||
static void process_cursor_move(struct diyac_server *server, uint32_t time)
|
static void process_cursor_move(struct diyac_server *server, uint32_t time)
|
||||||
{
|
{
|
||||||
|
(void) time;
|
||||||
struct diyac_view *toplevel = server->grabbed_view;
|
struct diyac_view *toplevel = server->grabbed_view;
|
||||||
/* Move the grabbed toplevel to the new position. */
|
/* Move the grabbed toplevel to the new position. */
|
||||||
if(!toplevel->output)
|
if(!toplevel->output)
|
||||||
@ -84,6 +85,7 @@ static void process_cursor_move(struct diyac_server *server, uint32_t time)
|
|||||||
|
|
||||||
static void process_cursor_resize(struct diyac_server *server, uint32_t time)
|
static void process_cursor_resize(struct diyac_server *server, uint32_t time)
|
||||||
{
|
{
|
||||||
|
(void) time;
|
||||||
/*
|
/*
|
||||||
* Resizing the grabbed toplevel can be a little bit complicated, because we
|
* Resizing the grabbed toplevel can be a little bit complicated, because we
|
||||||
* could be resizing from any corner or edge. This not only resizes the
|
* could be resizing from any corner or edge. This not only resizes the
|
||||||
@ -252,7 +254,7 @@ static void server_cursor_button(struct wl_listener *listener, void *data)
|
|||||||
wlr_seat_pointer_notify_button(seat->wlr_seat,
|
wlr_seat_pointer_notify_button(seat->wlr_seat,
|
||||||
event->time_msec, event->button, event->state);
|
event->time_msec, event->button, event->state);
|
||||||
|
|
||||||
if (event->state == WLR_BUTTON_RELEASED)
|
if (event->state == WL_POINTER_BUTTON_STATE_RELEASED)
|
||||||
{
|
{
|
||||||
/* If you released any buttons, we exit interactive move/resize mode. */
|
/* If you released any buttons, we exit interactive move/resize mode. */
|
||||||
diyac_reset_cursor_mode(seat->server);
|
diyac_reset_cursor_mode(seat->server);
|
||||||
@ -278,6 +280,7 @@ static void server_cursor_axis(struct wl_listener *listener, void *data)
|
|||||||
|
|
||||||
static void server_cursor_frame(struct wl_listener *listener, void *data)
|
static void server_cursor_frame(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
|
(void) data;
|
||||||
/* This event is forwarded by the cursor when a pointer emits an frame
|
/* This event is forwarded by the cursor when a pointer emits an frame
|
||||||
* event. Frame events are sent after regular pointer events to group
|
* event. Frame events are sent after regular pointer events to group
|
||||||
* multiple events together. For instance, two axis events may happen at the
|
* multiple events together. For instance, two axis events may happen at the
|
||||||
|
6
diyac.c
6
diyac.c
@ -24,9 +24,15 @@
|
|||||||
|
|
||||||
void help()
|
void help()
|
||||||
{
|
{
|
||||||
|
printf("diyac - a simple Wayland compositor\n");
|
||||||
printf("Usage: diyac [-x] [startup command]\n");
|
printf("Usage: diyac [-x] [startup command]\n");
|
||||||
printf("Options:\n");
|
printf("Options:\n");
|
||||||
printf(" -x exit with the session\n");
|
printf(" -x exit with the session\n");
|
||||||
|
printf(" -v increase log level\n");
|
||||||
|
printf(" -h show this help message\n");
|
||||||
|
#ifdef __COMPOSITOR_VERSION__
|
||||||
|
printf("Version: %s\n", __COMPOSITOR_VERSION__);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -29,6 +29,7 @@ static void handle_request_fullscreen(struct wl_listener *listener, void *data)
|
|||||||
|
|
||||||
static void handle_request_activate(struct wl_listener *listener, void *data)
|
static void handle_request_activate(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
|
(void) data;
|
||||||
struct diyac_view *view = wl_container_of(listener, view, toplevel.activate);
|
struct diyac_view *view = wl_container_of(listener, view, toplevel.activate);
|
||||||
// struct wlr_foreign_toplevel_handle_v1_activated_event *event = data;
|
// struct wlr_foreign_toplevel_handle_v1_activated_event *event = data;
|
||||||
/* In a multi-seat world we would select seat based on event->seat here. */
|
/* In a multi-seat world we would select seat based on event->seat here. */
|
||||||
@ -39,6 +40,7 @@ static void handle_request_activate(struct wl_listener *listener, void *data)
|
|||||||
static void
|
static void
|
||||||
handle_request_close(struct wl_listener *listener, void *data)
|
handle_request_close(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
|
(void) data;
|
||||||
struct diyac_view *view = wl_container_of(listener, view, toplevel.close);
|
struct diyac_view *view = wl_container_of(listener, view, toplevel.close);
|
||||||
wlr_xdg_toplevel_send_close(view->xdg_toplevel);
|
wlr_xdg_toplevel_send_close(view->xdg_toplevel);
|
||||||
}
|
}
|
||||||
@ -46,6 +48,7 @@ handle_request_close(struct wl_listener *listener, void *data)
|
|||||||
static void
|
static void
|
||||||
handle_destroy(struct wl_listener *listener, void *data)
|
handle_destroy(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
|
(void) data;
|
||||||
struct diyac_view *view = wl_container_of(listener, view, toplevel.destroy);
|
struct diyac_view *view = wl_container_of(listener, view, toplevel.destroy);
|
||||||
struct foreign_toplevel *toplevel = &view->toplevel;
|
struct foreign_toplevel *toplevel = &view->toplevel;
|
||||||
wl_list_remove(&toplevel->maximize.link);
|
wl_list_remove(&toplevel->maximize.link);
|
||||||
|
7
layer.c
7
layer.c
@ -53,6 +53,7 @@ static void process_keyboard_interactivity(struct diyac_layer_surface *layer)
|
|||||||
}
|
}
|
||||||
static void layer_surface_commit(struct wl_listener *listener, void *data)
|
static void layer_surface_commit(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
|
(void) data;
|
||||||
struct diyac_layer_surface *layer =
|
struct diyac_layer_surface *layer =
|
||||||
wl_container_of(listener, layer, surface_commit);
|
wl_container_of(listener, layer, surface_commit);
|
||||||
struct wlr_layer_surface_v1 *layer_surface =
|
struct wlr_layer_surface_v1 *layer_surface =
|
||||||
@ -94,6 +95,7 @@ static void layer_surface_commit(struct wl_listener *listener, void *data)
|
|||||||
}
|
}
|
||||||
static void layer_surface_unmap(struct wl_listener *listener, void *data)
|
static void layer_surface_unmap(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
|
(void) data;
|
||||||
struct diyac_layer_surface *layer = wl_container_of(listener, layer, unmap);
|
struct diyac_layer_surface *layer = wl_container_of(listener, layer, unmap);
|
||||||
struct wlr_layer_surface_v1 *layer_surface =
|
struct wlr_layer_surface_v1 *layer_surface =
|
||||||
layer->scene_layer_surface->layer_surface;
|
layer->scene_layer_surface->layer_surface;
|
||||||
@ -109,6 +111,7 @@ static void layer_surface_unmap(struct wl_listener *listener, void *data)
|
|||||||
|
|
||||||
static void layer_surface_map(struct wl_listener *listener, void *data)
|
static void layer_surface_map(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
|
(void) data;
|
||||||
struct diyac_layer_surface *layer = wl_container_of(listener, layer, map);
|
struct diyac_layer_surface *layer = wl_container_of(listener, layer, map);
|
||||||
struct wlr_output *wlr_output =
|
struct wlr_output *wlr_output =
|
||||||
layer->scene_layer_surface->layer_surface->output;
|
layer->scene_layer_surface->layer_surface->output;
|
||||||
@ -127,6 +130,7 @@ static void layer_surface_map(struct wl_listener *listener, void *data)
|
|||||||
}
|
}
|
||||||
static void layer_surface_node_destroy(struct wl_listener *listener, void *data)
|
static void layer_surface_node_destroy(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
|
(void) data;
|
||||||
struct diyac_layer_surface *layer =
|
struct diyac_layer_surface *layer =
|
||||||
wl_container_of(listener, layer, node_destroy);
|
wl_container_of(listener, layer, node_destroy);
|
||||||
|
|
||||||
@ -142,6 +146,7 @@ static void layer_surface_node_destroy(struct wl_listener *listener, void *data)
|
|||||||
}
|
}
|
||||||
static void layer_surface_output_destroy(struct wl_listener *listener, void *data)
|
static void layer_surface_output_destroy(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
|
(void) data;
|
||||||
struct diyac_layer_surface *layer =
|
struct diyac_layer_surface *layer =
|
||||||
wl_container_of(listener, layer, output_destroy);
|
wl_container_of(listener, layer, output_destroy);
|
||||||
layer->scene_layer_surface->layer_surface->output = NULL;
|
layer->scene_layer_surface->layer_surface->output = NULL;
|
||||||
@ -150,6 +155,7 @@ static void layer_surface_output_destroy(struct wl_listener *listener, void *dat
|
|||||||
static void
|
static void
|
||||||
popup_handle_destroy(struct wl_listener *listener, void *data)
|
popup_handle_destroy(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
|
(void)data;
|
||||||
struct diyac_popup *popup = wl_container_of(listener, popup, destroy);
|
struct diyac_popup *popup = wl_container_of(listener, popup, destroy);
|
||||||
wl_list_remove(&popup->destroy.link);
|
wl_list_remove(&popup->destroy.link);
|
||||||
wl_list_remove(&popup->new_popup.link);
|
wl_list_remove(&popup->new_popup.link);
|
||||||
@ -165,6 +171,7 @@ popup_handle_destroy(struct wl_listener *listener, void *data)
|
|||||||
|
|
||||||
static void popup_handle_commit(struct wl_listener *listener, void *data)
|
static void popup_handle_commit(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
|
(void)data;
|
||||||
struct diyac_popup *popup =
|
struct diyac_popup *popup =
|
||||||
wl_container_of(listener, popup, commit);
|
wl_container_of(listener, popup, commit);
|
||||||
struct wlr_box popup_box ;
|
struct wlr_box popup_box ;
|
||||||
|
73
meson.build
Normal file
73
meson.build
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
project('diyac',
|
||||||
|
['c'],
|
||||||
|
version: '0.1.0',
|
||||||
|
license: 'MIT',
|
||||||
|
meson_version: '>=0.58.0',
|
||||||
|
default_options: ['c_std=gnu11', 'warning_level=3'])
|
||||||
|
|
||||||
|
lib_so_version = '0'
|
||||||
|
|
||||||
|
add_project_arguments(
|
||||||
|
[
|
||||||
|
'-Wno-pedantic',
|
||||||
|
'-Werror=implicit-function-declaration',
|
||||||
|
'-Werror=return-type',
|
||||||
|
'-DWLR_USE_UNSTABLE',
|
||||||
|
'-D__COMPOSITOR_VERSION__="@0@"'.format(meson.project_version())
|
||||||
|
],
|
||||||
|
language: 'c')
|
||||||
|
|
||||||
|
wlroots = dependency('wlroots')
|
||||||
|
wayland_server = dependency('wayland-server', version: '>=1.10.0')
|
||||||
|
xkbcommon = dependency('xkbcommon')
|
||||||
|
|
||||||
|
# wayland_scanner is required, but we can find it without pkg-config
|
||||||
|
wayland_scanner = find_program('wayland-scanner')
|
||||||
|
|
||||||
|
wayland_protocols = dependency('wayland-protocols', version: '>=1.16')
|
||||||
|
|
||||||
|
wl_protocol_dir = wayland_protocols.get_variable('pkgdatadir')
|
||||||
|
|
||||||
|
|
||||||
|
wayland_targets=[]
|
||||||
|
|
||||||
|
wl_protocols = [
|
||||||
|
wl_protocol_dir / 'stable/xdg-shell/xdg-shell',
|
||||||
|
'protocol/wlr-layer-shell-unstable-v1',
|
||||||
|
]
|
||||||
|
|
||||||
|
foreach proto : wl_protocols
|
||||||
|
xml = ''.join([proto,'.xml'])
|
||||||
|
header = ''.join([proto.split('/').get(-1),'.h'])
|
||||||
|
cfile = ''.join([proto.split('/').get(-1),'.c'])
|
||||||
|
wayland_targets += custom_target(header,output:header,input:xml,
|
||||||
|
command: [ wayland_scanner, 'server-header', '@INPUT@', '@OUTPUT@' ] )
|
||||||
|
wayland_targets += custom_target(cfile,output:cfile,input:xml,
|
||||||
|
command: [ wayland_scanner, 'private-code', '@INPUT@', '@OUTPUT@' ] )
|
||||||
|
endforeach
|
||||||
|
|
||||||
|
|
||||||
|
incdir = include_directories([
|
||||||
|
])
|
||||||
|
|
||||||
|
src = [
|
||||||
|
'diyac.c',
|
||||||
|
'cursor.c',
|
||||||
|
'output.c',
|
||||||
|
'seat.c',
|
||||||
|
'node.c',
|
||||||
|
'view.c',
|
||||||
|
'foreign.c',
|
||||||
|
'xdg.c',
|
||||||
|
'layer.c',
|
||||||
|
'session.c',
|
||||||
|
wayland_targets
|
||||||
|
]
|
||||||
|
|
||||||
|
buil_dep = [wlroots, wayland_server, xkbcommon]
|
||||||
|
|
||||||
|
executable(
|
||||||
|
'diyac',
|
||||||
|
src,
|
||||||
|
dependencies: buil_dep,
|
||||||
|
include_directories : incdir)
|
1
node.c
1
node.c
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
static void destroy_notify(struct wl_listener *listener, void *data)
|
static void destroy_notify(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
|
(void)data;
|
||||||
struct diyac_node_descriptor *node_descriptor =
|
struct diyac_node_descriptor *node_descriptor =
|
||||||
wl_container_of(listener, node_descriptor, destroy);
|
wl_container_of(listener, node_descriptor, destroy);
|
||||||
wl_list_remove(&node_descriptor->destroy.link);
|
wl_list_remove(&node_descriptor->destroy.link);
|
||||||
|
2
output.c
2
output.c
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
static void output_frame(struct wl_listener *listener, void *data)
|
static void output_frame(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
|
(void) data;
|
||||||
/* This function is called every time an output is ready to display a frame,
|
/* This function is called every time an output is ready to display a frame,
|
||||||
* generally at the output's refresh rate (e.g. 60Hz). */
|
* generally at the output's refresh rate (e.g. 60Hz). */
|
||||||
struct diyac_output *output = wl_container_of(listener, output, frame);
|
struct diyac_output *output = wl_container_of(listener, output, frame);
|
||||||
@ -39,6 +40,7 @@ static void output_request_state(struct wl_listener *listener, void *data)
|
|||||||
|
|
||||||
static void output_destroy(struct wl_listener *listener, void *data)
|
static void output_destroy(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
|
(void)data;
|
||||||
struct diyac_output *output = wl_container_of(listener, output, destroy);
|
struct diyac_output *output = wl_container_of(listener, output, destroy);
|
||||||
if(output->lock_handle)
|
if(output->lock_handle)
|
||||||
{
|
{
|
||||||
|
3
seat.c
3
seat.c
@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
static void configure_keyboard(struct diyac_seat* seat, struct diyac_input* input, bool force)
|
static void configure_keyboard(struct diyac_seat* seat, struct diyac_input* input, bool force)
|
||||||
{
|
{
|
||||||
|
(void) seat;
|
||||||
struct wlr_input_device *device = input->device;
|
struct wlr_input_device *device = input->device;
|
||||||
assert(device->type == WLR_INPUT_DEVICE_KEYBOARD);
|
assert(device->type == WLR_INPUT_DEVICE_KEYBOARD);
|
||||||
struct diyac_keyboard *keyboard = (struct diyac_keyboard *)input;
|
struct diyac_keyboard *keyboard = (struct diyac_keyboard *)input;
|
||||||
@ -41,6 +42,7 @@ static void configure_keyboard(struct diyac_seat* seat, struct diyac_input* inpu
|
|||||||
static void keyboard_handle_modifiers(
|
static void keyboard_handle_modifiers(
|
||||||
struct wl_listener *listener, void *data)
|
struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
|
(void) data;
|
||||||
/* This event is raised when a modifier key, such as shift or alt, is
|
/* This event is raised when a modifier key, such as shift or alt, is
|
||||||
* pressed. We simply communicate this to the client. */
|
* pressed. We simply communicate this to the client. */
|
||||||
struct diyac_keyboard *keyboard =
|
struct diyac_keyboard *keyboard =
|
||||||
@ -128,6 +130,7 @@ static void keyboard_handle_key(
|
|||||||
|
|
||||||
static void input_handle_destroy(struct wl_listener *listener, void *data)
|
static void input_handle_destroy(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
|
(void) data;
|
||||||
/* This event is raised by the keyboard base wlr_input_device to signal
|
/* This event is raised by the keyboard base wlr_input_device to signal
|
||||||
* the destruction of the wlr_keyboard. It will no longer receive events
|
* the destruction of the wlr_keyboard. It will no longer receive events
|
||||||
* and should be destroyed.
|
* and should be destroyed.
|
||||||
|
@ -39,6 +39,7 @@ static void session_lock_update_geometry(struct diyac_output *output, bool align
|
|||||||
|
|
||||||
static void handle_surface_map(struct wl_listener *listener, void *data)
|
static void handle_surface_map(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
|
(void) data;
|
||||||
struct diyac_output_lock_handle *handle = wl_container_of(listener, handle, surface_map);
|
struct diyac_output_lock_handle *handle = wl_container_of(listener, handle, surface_map);
|
||||||
if (!g_server->lock->focused)
|
if (!g_server->lock->focused)
|
||||||
{
|
{
|
||||||
@ -49,6 +50,7 @@ static void handle_surface_map(struct wl_listener *listener, void *data)
|
|||||||
|
|
||||||
static void handle_surface_destroy(struct wl_listener *listener, void *data)
|
static void handle_surface_destroy(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
|
(void) data;
|
||||||
struct diyac_output_lock_handle *handle = wl_container_of(listener, handle, surface_destroy);
|
struct diyac_output_lock_handle *handle = wl_container_of(listener, handle, surface_destroy);
|
||||||
|
|
||||||
if (g_server->lock->focused == handle->surface->surface)
|
if (g_server->lock->focused == handle->surface->surface)
|
||||||
@ -123,6 +125,7 @@ static void session_lock_destroy(struct diyac_session_lock *lock)
|
|||||||
|
|
||||||
static void handle_unlock(struct wl_listener *listener, void *data)
|
static void handle_unlock(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
|
(void) data;
|
||||||
struct diyac_session_lock *lock = wl_container_of(listener, lock, unlock);
|
struct diyac_session_lock *lock = wl_container_of(listener, lock, unlock);
|
||||||
wlr_log(WLR_INFO, "handle_unlock: Lock session is unlocked");
|
wlr_log(WLR_INFO, "handle_unlock: Lock session is unlocked");
|
||||||
session_lock_destroy(lock);
|
session_lock_destroy(lock);
|
||||||
@ -131,6 +134,7 @@ static void handle_unlock(struct wl_listener *listener, void *data)
|
|||||||
|
|
||||||
static void handle_session_lock_destroy(struct wl_listener *listener, void *data)
|
static void handle_session_lock_destroy(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
|
(void) data;
|
||||||
struct diyac_session_lock *lock = wl_container_of(listener, lock, destroy);
|
struct diyac_session_lock *lock = wl_container_of(listener, lock, destroy);
|
||||||
lock->abandoned = true;
|
lock->abandoned = true;
|
||||||
wlr_log(WLR_INFO, "handle_session_lock_destroy: Lock session is destroyed without unlocking, session abandoned");
|
wlr_log(WLR_INFO, "handle_session_lock_destroy: Lock session is destroyed without unlocking, session abandoned");
|
||||||
@ -141,6 +145,7 @@ static void handle_session_lock_destroy(struct wl_listener *listener, void *data
|
|||||||
|
|
||||||
static void handle_new_session_lock(struct wl_listener *listener, void *data)
|
static void handle_new_session_lock(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
|
(void) listener;
|
||||||
struct wlr_session_lock_v1 *lock = data;
|
struct wlr_session_lock_v1 *lock = data;
|
||||||
if (g_server->lock)
|
if (g_server->lock)
|
||||||
{
|
{
|
||||||
@ -200,6 +205,8 @@ static void handle_commit(struct wl_listener *listener, void *data)
|
|||||||
|
|
||||||
static void handle_lock_manager_destroy(struct wl_listener *listener, void *data)
|
static void handle_lock_manager_destroy(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
|
(void) data;
|
||||||
|
(void) listener;
|
||||||
if (g_server->lock)
|
if (g_server->lock)
|
||||||
{
|
{
|
||||||
session_lock_destroy(g_server->lock);
|
session_lock_destroy(g_server->lock);
|
||||||
@ -245,9 +252,9 @@ void diyac_session_lock_output(struct diyac_output *output)
|
|||||||
handle->background = wlr_scene_rect_create(handle->tree, 0, 0, black);
|
handle->background = wlr_scene_rect_create(handle->tree, 0, 0, black);
|
||||||
if (!handle->background)
|
if (!handle->background)
|
||||||
{
|
{
|
||||||
|
wlr_scene_node_destroy(&handle->tree->node);
|
||||||
free(handle);
|
free(handle);
|
||||||
wlr_log(WLR_ERROR, "diyac_session_lock_output:Unable to create lock background");
|
wlr_log(WLR_ERROR, "diyac_session_lock_output:Unable to create lock background");
|
||||||
wlr_scene_node_destroy(&handle->tree->node);
|
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
handle->surface = NULL;
|
handle->surface = NULL;
|
||||||
|
4
view.c
4
view.c
@ -183,8 +183,8 @@ void diyac_focus_topmost_view(struct diyac_server *server, bool raise)
|
|||||||
|
|
||||||
struct diyac_view *diyac_topmost_focusable_view(struct diyac_server *server)
|
struct diyac_view *diyac_topmost_focusable_view(struct diyac_server *server)
|
||||||
{
|
{
|
||||||
struct wlr_surface *prev =
|
//struct wlr_surface *prev =
|
||||||
server->seat.wlr_seat->keyboard_state.focused_surface;
|
// server->seat.wlr_seat->keyboard_state.focused_surface;
|
||||||
struct diyac_view *view;
|
struct diyac_view *view;
|
||||||
struct wl_list *node_list;
|
struct wl_list *node_list;
|
||||||
struct wlr_scene_node *node;
|
struct wlr_scene_node *node;
|
||||||
|
20
xdg.c
20
xdg.c
@ -55,6 +55,7 @@ static void begin_interactive(struct diyac_view *toplevel,
|
|||||||
}
|
}
|
||||||
static void xdg_toplevel_commit(struct wl_listener *listener, void *data)
|
static void xdg_toplevel_commit(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
|
(void)data;
|
||||||
struct diyac_view *toplevel = wl_container_of(listener, toplevel, commit);
|
struct diyac_view *toplevel = wl_container_of(listener, toplevel, commit);
|
||||||
uint32_t serial = toplevel->configuration_serial;
|
uint32_t serial = toplevel->configuration_serial;
|
||||||
|
|
||||||
@ -84,6 +85,7 @@ static void xdg_toplevel_commit(struct wl_listener *listener, void *data)
|
|||||||
}
|
}
|
||||||
static void xdg_toplevel_map(struct wl_listener *listener, void *data)
|
static void xdg_toplevel_map(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
|
(void)data;
|
||||||
wlr_log(WLR_INFO, "xdg_toplevel_map: %p", listener);
|
wlr_log(WLR_INFO, "xdg_toplevel_map: %p", listener);
|
||||||
/* Called when the surface is mapped, or ready to display on-screen. */
|
/* Called when the surface is mapped, or ready to display on-screen. */
|
||||||
struct diyac_view *toplevel = wl_container_of(listener, toplevel, map);
|
struct diyac_view *toplevel = wl_container_of(listener, toplevel, map);
|
||||||
@ -120,6 +122,7 @@ static void xdg_toplevel_map(struct wl_listener *listener, void *data)
|
|||||||
|
|
||||||
static void xdg_toplevel_unmap(struct wl_listener *listener, void *data)
|
static void xdg_toplevel_unmap(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
|
(void)data;
|
||||||
/* Called when the surface is unmapped, and should no longer be shown. */
|
/* Called when the surface is unmapped, and should no longer be shown. */
|
||||||
struct diyac_view *toplevel = wl_container_of(listener, toplevel, unmap);
|
struct diyac_view *toplevel = wl_container_of(listener, toplevel, unmap);
|
||||||
toplevel->mapped = false;
|
toplevel->mapped = false;
|
||||||
@ -158,6 +161,7 @@ static void xdg_toplevel_unmap(struct wl_listener *listener, void *data)
|
|||||||
static void xdg_toplevel_request_move(
|
static void xdg_toplevel_request_move(
|
||||||
struct wl_listener *listener, void *data)
|
struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
|
(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
|
||||||
* decorations. Note that a more sophisticated compositor should check the
|
* decorations. Note that a more sophisticated compositor should check the
|
||||||
@ -184,6 +188,7 @@ static void xdg_toplevel_request_resize(
|
|||||||
static void xdg_toplevel_request_maximize(
|
static void xdg_toplevel_request_maximize(
|
||||||
struct wl_listener *listener, void *data)
|
struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
|
(void)data;
|
||||||
/* This event is raised when a client would like to maximize itself,
|
/* This event is raised when a client would like to maximize itself,
|
||||||
* typically because the user clicked on the maximize button on
|
* typically because the user clicked on the maximize button on
|
||||||
* client-side decorations. diyac doesn't support maximization, but
|
* client-side decorations. diyac doesn't support maximization, but
|
||||||
@ -197,6 +202,7 @@ static void xdg_toplevel_request_maximize(
|
|||||||
|
|
||||||
static void xdg_toplevel_request_fullscreen(struct wl_listener *listener, void *data)
|
static void xdg_toplevel_request_fullscreen(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
|
(void)data;
|
||||||
struct diyac_view *toplevel =
|
struct diyac_view *toplevel =
|
||||||
wl_container_of(listener, toplevel, request_fullscreen);
|
wl_container_of(listener, toplevel, request_fullscreen);
|
||||||
diyac_view_set_fullscreen(toplevel, toplevel->xdg_toplevel->requested.fullscreen);
|
diyac_view_set_fullscreen(toplevel, toplevel->xdg_toplevel->requested.fullscreen);
|
||||||
@ -204,6 +210,7 @@ static void xdg_toplevel_request_fullscreen(struct wl_listener *listener, void *
|
|||||||
|
|
||||||
static void xdg_toplevel_request_minimize(struct wl_listener *listener, void *data)
|
static void xdg_toplevel_request_minimize(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
|
(void)data;
|
||||||
struct diyac_view *toplevel =
|
struct diyac_view *toplevel =
|
||||||
wl_container_of(listener, toplevel, request_minimize);
|
wl_container_of(listener, toplevel, request_minimize);
|
||||||
diyac_view_set_mimimize(toplevel, toplevel->xdg_toplevel->requested.minimized);
|
diyac_view_set_mimimize(toplevel, toplevel->xdg_toplevel->requested.minimized);
|
||||||
@ -211,6 +218,7 @@ static void xdg_toplevel_request_minimize(struct wl_listener *listener, void *da
|
|||||||
|
|
||||||
static void xdg_toplevel_destroy(struct wl_listener *listener, void *data)
|
static void xdg_toplevel_destroy(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
|
(void)data;
|
||||||
/* Called when the xdg_toplevel is destroyed. */
|
/* Called when the xdg_toplevel is destroyed. */
|
||||||
struct diyac_view *toplevel = wl_container_of(listener, toplevel, destroy);
|
struct diyac_view *toplevel = wl_container_of(listener, toplevel, destroy);
|
||||||
if (toplevel->toplevel.handle)
|
if (toplevel->toplevel.handle)
|
||||||
@ -243,6 +251,7 @@ static void xdg_toplevel_destroy(struct wl_listener *listener, void *data)
|
|||||||
|
|
||||||
static void handle_xdg_popup_destroy(struct wl_listener *listener, void *data)
|
static void handle_xdg_popup_destroy(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
|
(void)data;
|
||||||
struct diyac_popup *popup = wl_container_of(listener, popup, destroy);
|
struct diyac_popup *popup = wl_container_of(listener, popup, destroy);
|
||||||
wl_list_remove(&popup->destroy.link);
|
wl_list_remove(&popup->destroy.link);
|
||||||
wl_list_remove(&popup->new_popup.link);
|
wl_list_remove(&popup->new_popup.link);
|
||||||
@ -262,9 +271,9 @@ static void popup_unconstrain(struct diyac_popup *popup)
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
struct diyac_server *server = view->server;
|
// struct diyac_server *server = view->server;
|
||||||
struct wlr_output_layout *output_layout = server->output_layout;
|
//struct wlr_output_layout *output_layout = server->output_layout;
|
||||||
struct wlr_output *wlr_output = view->output->wlr_output;
|
//struct wlr_output *wlr_output = view->output->wlr_output;
|
||||||
struct wlr_box usable = {
|
struct wlr_box usable = {
|
||||||
.x = 0,
|
.x = 0,
|
||||||
.y = 0,
|
.y = 0,
|
||||||
@ -287,6 +296,7 @@ static void popup_unconstrain(struct diyac_popup *popup)
|
|||||||
|
|
||||||
static void handle_xdg_popup_commit(struct wl_listener *listener, void *data)
|
static void handle_xdg_popup_commit(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
|
(void)data;
|
||||||
struct diyac_popup *popup = wl_container_of(listener, popup, commit);
|
struct diyac_popup *popup = wl_container_of(listener, popup, commit);
|
||||||
struct wlr_box popup_box;
|
struct wlr_box popup_box;
|
||||||
wlr_xdg_surface_get_geometry(popup->wlr_popup->base, &popup_box);
|
wlr_xdg_surface_get_geometry(popup->wlr_popup->base, &popup_box);
|
||||||
@ -294,7 +304,7 @@ static void handle_xdg_popup_commit(struct wl_listener *listener, void *data)
|
|||||||
if (!wlr_box_empty(&popup_box))
|
if (!wlr_box_empty(&popup_box))
|
||||||
// if (popup->wlr_popup->base->initial_commit)
|
// if (popup->wlr_popup->base->initial_commit)
|
||||||
{
|
{
|
||||||
struct diyac_view *view = popup->parent;
|
// struct diyac_view *view = popup->parent;
|
||||||
// wlr_output_commit(view->output->wlr_output);
|
// wlr_output_commit(view->output->wlr_output);
|
||||||
/* Prevent getting called over and over again */
|
/* Prevent getting called over and over again */
|
||||||
wl_list_remove(&popup->commit.link);
|
wl_list_remove(&popup->commit.link);
|
||||||
@ -366,12 +376,14 @@ static void xdg_popup_create(struct diyac_view *view, struct wlr_xdg_popup *wlr_
|
|||||||
|
|
||||||
static void xdg_set_appid_notify(struct wl_listener *listener, void *data)
|
static void xdg_set_appid_notify(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
|
(void)data;
|
||||||
struct diyac_view *view = wl_container_of(listener, view, set_app_id);
|
struct diyac_view *view = wl_container_of(listener, view, set_app_id);
|
||||||
diyac_view_update_app_id(view);
|
diyac_view_update_app_id(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void xdg_set_title_notify(struct wl_listener *listener, void *data)
|
static void xdg_set_title_notify(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
|
(void)data;
|
||||||
struct diyac_view *view = wl_container_of(listener, view, set_title);
|
struct diyac_view *view = wl_container_of(listener, view, set_title);
|
||||||
diyac_view_update_title(view);
|
diyac_view_update_title(view);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user