mirror of
https://github.com/labwc/labwc.git
synced 2026-04-10 08:21:07 -04:00
wip: Update for wlroots-git (0.16.0)
This commit is contained in:
parent
ae15be8555
commit
a893d7854d
11 changed files with 80 additions and 76 deletions
|
|
@ -33,6 +33,7 @@
|
||||||
#include <wlr/types/wlr_pointer_gestures_v1.h>
|
#include <wlr/types/wlr_pointer_gestures_v1.h>
|
||||||
#include <wlr/types/wlr_seat.h>
|
#include <wlr/types/wlr_seat.h>
|
||||||
#include <wlr/types/wlr_server_decoration.h>
|
#include <wlr/types/wlr_server_decoration.h>
|
||||||
|
#include <wlr/types/wlr_subcompositor.h>
|
||||||
#include <wlr/types/wlr_xcursor_manager.h>
|
#include <wlr/types/wlr_xcursor_manager.h>
|
||||||
#include <wlr/types/wlr_xdg_decoration_v1.h>
|
#include <wlr/types/wlr_xdg_decoration_v1.h>
|
||||||
#include <wlr/types/wlr_xdg_shell.h>
|
#include <wlr/types/wlr_xdg_shell.h>
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
#ifndef __LABWC_LAYERS_H
|
#ifndef __LABWC_LAYERS_H
|
||||||
#define __LABWC_LAYERS_H
|
#define __LABWC_LAYERS_H
|
||||||
#include <wayland-server.h>
|
#include <wayland-server.h>
|
||||||
#include <wlr/types/wlr_surface.h>
|
|
||||||
#include <wlr/types/wlr_layer_shell_v1.h>
|
#include <wlr/types/wlr_layer_shell_v1.h>
|
||||||
|
|
||||||
struct server;
|
struct server;
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ add_project_arguments('-DLABWC_VERSION=@0@'.format(version), language: 'c')
|
||||||
wlroots = dependency(
|
wlroots = dependency(
|
||||||
'wlroots',
|
'wlroots',
|
||||||
default_options: ['default_library=static', 'examples=false'],
|
default_options: ['default_library=static', 'examples=false'],
|
||||||
version: ['>=0.15.0', '<0.16.0'],
|
version: ['>=0.15.0'],
|
||||||
)
|
)
|
||||||
|
|
||||||
wlroots_has_xwayland = wlroots.get_variable('have_xwayland') == 'true'
|
wlroots_has_xwayland = wlroots.get_variable('have_xwayland') == 'true'
|
||||||
|
|
|
||||||
35
src/cursor.c
35
src/cursor.c
|
|
@ -451,7 +451,7 @@ cursor_motion(struct wl_listener *listener, void *data)
|
||||||
*/
|
*/
|
||||||
struct seat *seat = wl_container_of(listener, seat, cursor_motion);
|
struct seat *seat = wl_container_of(listener, seat, cursor_motion);
|
||||||
struct server *server = seat->server;
|
struct server *server = seat->server;
|
||||||
struct wlr_event_pointer_motion *event = data;
|
struct wlr_pointer_motion_event *event = data;
|
||||||
wlr_idle_notify_activity(seat->wlr_idle, seat->seat);
|
wlr_idle_notify_activity(seat->wlr_idle, seat->seat);
|
||||||
|
|
||||||
wlr_relative_pointer_manager_v1_send_relative_motion(
|
wlr_relative_pointer_manager_v1_send_relative_motion(
|
||||||
|
|
@ -468,8 +468,8 @@ cursor_motion(struct wl_listener *listener, void *data)
|
||||||
* NULL for the device if you want to move the cursor around
|
* NULL for the device if you want to move the cursor around
|
||||||
* without any input.
|
* without any input.
|
||||||
*/
|
*/
|
||||||
wlr_cursor_move(seat->cursor, event->device, event->delta_x,
|
wlr_cursor_move(seat->cursor, &event->pointer->base,
|
||||||
event->delta_y);
|
event->delta_x, event->delta_y);
|
||||||
}
|
}
|
||||||
process_cursor_motion(seat->server, event->time_msec);
|
process_cursor_motion(seat->server, event->time_msec);
|
||||||
}
|
}
|
||||||
|
|
@ -499,12 +499,12 @@ cursor_motion_absolute(struct wl_listener *listener, void *data)
|
||||||
*/
|
*/
|
||||||
struct seat *seat = wl_container_of(
|
struct seat *seat = wl_container_of(
|
||||||
listener, seat, cursor_motion_absolute);
|
listener, seat, cursor_motion_absolute);
|
||||||
struct wlr_event_pointer_motion_absolute *event = data;
|
struct wlr_pointer_motion_absolute_event *event = data;
|
||||||
wlr_idle_notify_activity(seat->wlr_idle, seat->seat);
|
wlr_idle_notify_activity(seat->wlr_idle, seat->seat);
|
||||||
|
|
||||||
double lx, ly;
|
double lx, ly;
|
||||||
wlr_cursor_absolute_to_layout_coords(seat->cursor, event->device,
|
wlr_cursor_absolute_to_layout_coords(seat->cursor,
|
||||||
event->x, event->y, &lx, &ly);
|
&event->pointer->base, event->x, event->y, &lx, &ly);
|
||||||
|
|
||||||
double dx = lx - seat->cursor->x;
|
double dx = lx - seat->cursor->x;
|
||||||
double dy = ly - seat->cursor->y;
|
double dy = ly - seat->cursor->y;
|
||||||
|
|
@ -523,7 +523,8 @@ cursor_motion_absolute(struct wl_listener *listener, void *data)
|
||||||
* NULL for the device if you want to move the cursor around
|
* NULL for the device if you want to move the cursor around
|
||||||
* without any input.
|
* without any input.
|
||||||
*/
|
*/
|
||||||
wlr_cursor_move(seat->cursor, event->device, dx, dy); }
|
wlr_cursor_move(seat->cursor, &event->pointer->base, dx, dy);
|
||||||
|
}
|
||||||
|
|
||||||
process_cursor_motion(seat->server, event->time_msec);
|
process_cursor_motion(seat->server, event->time_msec);
|
||||||
}
|
}
|
||||||
|
|
@ -648,7 +649,7 @@ cursor_button(struct wl_listener *listener, void *data)
|
||||||
*/
|
*/
|
||||||
struct seat *seat = wl_container_of(listener, seat, cursor_button);
|
struct seat *seat = wl_container_of(listener, seat, cursor_button);
|
||||||
struct server *server = seat->server;
|
struct server *server = seat->server;
|
||||||
struct wlr_event_pointer_button *event = data;
|
struct wlr_pointer_button_event *event = data;
|
||||||
wlr_idle_notify_activity(seat->wlr_idle, seat->seat);
|
wlr_idle_notify_activity(seat->wlr_idle, seat->seat);
|
||||||
|
|
||||||
double sx, sy;
|
double sx, sy;
|
||||||
|
|
@ -664,8 +665,8 @@ cursor_button(struct wl_listener *listener, void *data)
|
||||||
&sx, &sy, &view_area);
|
&sx, &sy, &view_area);
|
||||||
|
|
||||||
/* get modifiers */
|
/* get modifiers */
|
||||||
struct wlr_input_device *device = seat->keyboard_group->input_device;
|
struct wlr_keyboard *keyboard = &seat->keyboard_group->keyboard;
|
||||||
uint32_t modifiers = wlr_keyboard_get_modifiers(device->keyboard);
|
uint32_t modifiers = wlr_keyboard_get_modifiers(keyboard);
|
||||||
|
|
||||||
/* handle _release_ */
|
/* handle _release_ */
|
||||||
if (event->state == WLR_BUTTON_RELEASED) {
|
if (event->state == WLR_BUTTON_RELEASED) {
|
||||||
|
|
@ -784,7 +785,7 @@ cursor_axis(struct wl_listener *listener, void *data)
|
||||||
* event, for example when you move the scroll wheel.
|
* event, for example when you move the scroll wheel.
|
||||||
*/
|
*/
|
||||||
struct seat *seat = wl_container_of(listener, seat, cursor_axis);
|
struct seat *seat = wl_container_of(listener, seat, cursor_axis);
|
||||||
struct wlr_event_pointer_axis *event = data;
|
struct wlr_pointer_axis_event *event = data;
|
||||||
wlr_idle_notify_activity(seat->wlr_idle, seat->seat);
|
wlr_idle_notify_activity(seat->wlr_idle, seat->seat);
|
||||||
|
|
||||||
/* Notify the client with pointer focus of the axis event. */
|
/* Notify the client with pointer focus of the axis event. */
|
||||||
|
|
@ -811,7 +812,7 @@ cursor_frame(struct wl_listener *listener, void *data)
|
||||||
static void handle_pointer_pinch_begin(struct wl_listener *listener, void *data)
|
static void handle_pointer_pinch_begin(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
struct seat *seat = wl_container_of(listener, seat, pinch_begin);
|
struct seat *seat = wl_container_of(listener, seat, pinch_begin);
|
||||||
struct wlr_event_pointer_pinch_begin *event = data;
|
struct wlr_pointer_pinch_begin_event *event = data;
|
||||||
wlr_pointer_gestures_v1_send_pinch_begin(seat->pointer_gestures,
|
wlr_pointer_gestures_v1_send_pinch_begin(seat->pointer_gestures,
|
||||||
seat->seat, event->time_msec, event->fingers);
|
seat->seat, event->time_msec, event->fingers);
|
||||||
}
|
}
|
||||||
|
|
@ -819,7 +820,7 @@ static void handle_pointer_pinch_begin(struct wl_listener *listener, void *data)
|
||||||
static void handle_pointer_pinch_update(struct wl_listener *listener, void *data)
|
static void handle_pointer_pinch_update(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
struct seat *seat = wl_container_of(listener, seat, pinch_update);
|
struct seat *seat = wl_container_of(listener, seat, pinch_update);
|
||||||
struct wlr_event_pointer_pinch_update *event = data;
|
struct wlr_pointer_pinch_update_event *event = data;
|
||||||
wlr_pointer_gestures_v1_send_pinch_update(seat->pointer_gestures,
|
wlr_pointer_gestures_v1_send_pinch_update(seat->pointer_gestures,
|
||||||
seat->seat, event->time_msec, event->dx, event->dy,
|
seat->seat, event->time_msec, event->dx, event->dy,
|
||||||
event->scale, event->rotation);
|
event->scale, event->rotation);
|
||||||
|
|
@ -828,7 +829,7 @@ static void handle_pointer_pinch_update(struct wl_listener *listener, void *data
|
||||||
static void handle_pointer_pinch_end(struct wl_listener *listener, void *data)
|
static void handle_pointer_pinch_end(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
struct seat *seat = wl_container_of(listener, seat, pinch_end);
|
struct seat *seat = wl_container_of(listener, seat, pinch_end);
|
||||||
struct wlr_event_pointer_pinch_end *event = data;
|
struct wlr_pointer_pinch_end_event *event = data;
|
||||||
wlr_pointer_gestures_v1_send_pinch_end(seat->pointer_gestures,
|
wlr_pointer_gestures_v1_send_pinch_end(seat->pointer_gestures,
|
||||||
seat->seat, event->time_msec, event->cancelled);
|
seat->seat, event->time_msec, event->cancelled);
|
||||||
}
|
}
|
||||||
|
|
@ -836,7 +837,7 @@ static void handle_pointer_pinch_end(struct wl_listener *listener, void *data)
|
||||||
static void handle_pointer_swipe_begin(struct wl_listener *listener, void *data)
|
static void handle_pointer_swipe_begin(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
struct seat *seat = wl_container_of(listener, seat, swipe_begin);
|
struct seat *seat = wl_container_of(listener, seat, swipe_begin);
|
||||||
struct wlr_event_pointer_swipe_begin *event = data;
|
struct wlr_pointer_swipe_begin_event *event = data;
|
||||||
wlr_pointer_gestures_v1_send_swipe_begin(seat->pointer_gestures,
|
wlr_pointer_gestures_v1_send_swipe_begin(seat->pointer_gestures,
|
||||||
seat->seat, event->time_msec, event->fingers);
|
seat->seat, event->time_msec, event->fingers);
|
||||||
}
|
}
|
||||||
|
|
@ -844,7 +845,7 @@ static void handle_pointer_swipe_begin(struct wl_listener *listener, void *data)
|
||||||
static void handle_pointer_swipe_update(struct wl_listener *listener, void *data)
|
static void handle_pointer_swipe_update(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
struct seat *seat = wl_container_of(listener, seat, swipe_update);
|
struct seat *seat = wl_container_of(listener, seat, swipe_update);
|
||||||
struct wlr_event_pointer_swipe_update *event = data;
|
struct wlr_pointer_swipe_update_event *event = data;
|
||||||
wlr_pointer_gestures_v1_send_swipe_update(seat->pointer_gestures,
|
wlr_pointer_gestures_v1_send_swipe_update(seat->pointer_gestures,
|
||||||
seat->seat, event->time_msec, event->dx, event->dy);
|
seat->seat, event->time_msec, event->dx, event->dy);
|
||||||
}
|
}
|
||||||
|
|
@ -852,7 +853,7 @@ static void handle_pointer_swipe_update(struct wl_listener *listener, void *data
|
||||||
static void handle_pointer_swipe_end(struct wl_listener *listener, void *data)
|
static void handle_pointer_swipe_end(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
struct seat *seat = wl_container_of(listener, seat, swipe_end);
|
struct seat *seat = wl_container_of(listener, seat, swipe_end);
|
||||||
struct wlr_event_pointer_swipe_end *event = data;
|
struct wlr_pointer_swipe_end_event *event = data;
|
||||||
wlr_pointer_gestures_v1_send_swipe_end(seat->pointer_gestures,
|
wlr_pointer_gestures_v1_send_swipe_end(seat->pointer_gestures,
|
||||||
seat->seat, event->time_msec, event->cancelled);
|
seat->seat, event->time_msec, event->cancelled);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -39,11 +39,11 @@ keyboard_modifiers_notify(struct wl_listener *listener, void *data)
|
||||||
struct server *server = seat->server;
|
struct server *server = seat->server;
|
||||||
|
|
||||||
if (server->cycle_view) {
|
if (server->cycle_view) {
|
||||||
struct wlr_event_keyboard_key *event = data;
|
struct wlr_keyboard_key_event *event = data;
|
||||||
struct wlr_input_device *device = seat->keyboard_group->input_device;
|
struct wlr_keyboard *keyboard = &seat->keyboard_group->keyboard;
|
||||||
damage_all_outputs(server);
|
damage_all_outputs(server);
|
||||||
if ((event->state == WL_KEYBOARD_KEY_STATE_RELEASED)
|
if ((event->state == WL_KEYBOARD_KEY_STATE_RELEASED)
|
||||||
&& !any_modifiers_pressed(device->keyboard)) {
|
&& !any_modifiers_pressed(keyboard)) {
|
||||||
/* end cycle */
|
/* end cycle */
|
||||||
desktop_focus_and_activate_view(&server->seat,
|
desktop_focus_and_activate_view(&server->seat,
|
||||||
server->cycle_view);
|
server->cycle_view);
|
||||||
|
|
@ -90,17 +90,17 @@ static bool is_modifier_key(xkb_keysym_t sym)
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
handle_compositor_keybindings(struct wl_listener *listener,
|
handle_compositor_keybindings(struct wl_listener *listener,
|
||||||
struct wlr_event_keyboard_key *event)
|
struct wlr_keyboard_key_event *event)
|
||||||
{
|
{
|
||||||
struct seat *seat = wl_container_of(listener, seat, keyboard_key);
|
struct seat *seat = wl_container_of(listener, seat, keyboard_key);
|
||||||
struct server *server = seat->server;
|
struct server *server = seat->server;
|
||||||
struct wlr_input_device *device = seat->keyboard_group->input_device;
|
struct wlr_keyboard *keyboard = &seat->keyboard_group->keyboard;
|
||||||
|
|
||||||
/* Translate libinput keycode -> xkbcommon */
|
/* Translate libinput keycode -> xkbcommon */
|
||||||
uint32_t keycode = event->keycode + 8;
|
uint32_t keycode = event->keycode + 8;
|
||||||
/* Get a list of keysyms based on the keymap for this keyboard */
|
/* Get a list of keysyms based on the keymap for this keyboard */
|
||||||
const xkb_keysym_t *syms;
|
const xkb_keysym_t *syms;
|
||||||
int nsyms = xkb_state_key_get_syms(device->keyboard->xkb_state, keycode, &syms);
|
int nsyms = xkb_state_key_get_syms(keyboard->xkb_state, keycode, &syms);
|
||||||
|
|
||||||
bool handled = false;
|
bool handled = false;
|
||||||
|
|
||||||
|
|
@ -115,14 +115,13 @@ handle_compositor_keybindings(struct wl_listener *listener,
|
||||||
&& event->state == WL_KEYBOARD_KEY_STATE_RELEASED) {
|
&& event->state == WL_KEYBOARD_KEY_STATE_RELEASED) {
|
||||||
int nr_bound_keys = key_state_bound_key_remove(keycode);
|
int nr_bound_keys = key_state_bound_key_remove(keycode);
|
||||||
if (!nr_bound_keys) {
|
if (!nr_bound_keys) {
|
||||||
wlr_keyboard_set_repeat_info(device->keyboard,
|
wlr_keyboard_set_repeat_info(keyboard,
|
||||||
rc.repeat_rate, rc.repeat_delay);
|
rc.repeat_rate, rc.repeat_delay);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t modifiers =
|
uint32_t modifiers = wlr_keyboard_get_modifiers(keyboard);
|
||||||
wlr_keyboard_get_modifiers(device->keyboard);
|
|
||||||
|
|
||||||
/* Catch C-A-F1 to C-A-F12 to change tty */
|
/* Catch C-A-F1 to C-A-F12 to change tty */
|
||||||
if (event->state == WL_KEYBOARD_KEY_STATE_PRESSED) {
|
if (event->state == WL_KEYBOARD_KEY_STATE_PRESSED) {
|
||||||
|
|
@ -186,9 +185,9 @@ keyboard_key_notify(struct wl_listener *listener, void *data)
|
||||||
/* This event is raised when a key is pressed or released. */
|
/* This event is raised when a key is pressed or released. */
|
||||||
struct seat *seat = wl_container_of(listener, seat, keyboard_key);
|
struct seat *seat = wl_container_of(listener, seat, keyboard_key);
|
||||||
struct server *server = seat->server;
|
struct server *server = seat->server;
|
||||||
struct wlr_event_keyboard_key *event = data;
|
struct wlr_keyboard_key_event *event = data;
|
||||||
struct wlr_seat *wlr_seat = server->seat.seat;
|
struct wlr_seat *wlr_seat = server->seat.seat;
|
||||||
struct wlr_input_device *device = seat->keyboard_group->input_device;
|
struct wlr_keyboard *keyboard = &seat->keyboard_group->keyboard;
|
||||||
wlr_idle_notify_activity(seat->wlr_idle, seat->seat);
|
wlr_idle_notify_activity(seat->wlr_idle, seat->seat);
|
||||||
|
|
||||||
bool handled = false;
|
bool handled = false;
|
||||||
|
|
@ -199,7 +198,7 @@ keyboard_key_notify(struct wl_listener *listener, void *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!handled) {
|
if (!handled) {
|
||||||
wlr_seat_set_keyboard(wlr_seat, device);
|
wlr_seat_set_keyboard(wlr_seat, keyboard);
|
||||||
wlr_seat_keyboard_notify_key(wlr_seat, event->time_msec,
|
wlr_seat_keyboard_notify_key(wlr_seat, event->time_msec,
|
||||||
event->keycode, event->state);
|
event->keycode, event->state);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
12
src/output.c
12
src/output.c
|
|
@ -1199,15 +1199,11 @@ wlr_output_configuration_v1 *create_output_config(struct server *server)
|
||||||
wlr_output_configuration_v1_destroy(config);
|
wlr_output_configuration_v1_destroy(config);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
struct wlr_box *box =
|
struct wlr_box box = {0};
|
||||||
wlr_output_layout_get_box(server->output_layout,
|
wlr_output_layout_get_box(server->output_layout,
|
||||||
output->wlr_output);
|
output->wlr_output, &box);
|
||||||
if (box) {
|
head->state.x = box.x;
|
||||||
head->state.x = box->x;
|
head->state.y = box.y;
|
||||||
head->state.y = box->y;
|
|
||||||
} else {
|
|
||||||
wlr_log(WLR_ERROR, "failed to get output layout box");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
37
src/seat.c
37
src/seat.c
|
|
@ -1,7 +1,9 @@
|
||||||
// SPDX-License-Identifier: GPL-2.0-only
|
// SPDX-License-Identifier: GPL-2.0-only
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <stdbool.h>
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#include <wlr/backend/libinput.h>
|
#include <wlr/backend/libinput.h>
|
||||||
|
#include <wlr/types/wlr_input_device.h>
|
||||||
#include <wlr/util/log.h>
|
#include <wlr/util/log.h>
|
||||||
#include "labwc.h"
|
#include "labwc.h"
|
||||||
|
|
||||||
|
|
@ -14,6 +16,18 @@ input_device_destroy(struct wl_listener *listener, void *data)
|
||||||
free(input);
|
free(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool
|
||||||
|
is_touch_device(struct wlr_input_device *wlr_input_device)
|
||||||
|
{
|
||||||
|
switch (wlr_input_device->type) {
|
||||||
|
case WLR_INPUT_DEVICE_TOUCH:
|
||||||
|
case WLR_INPUT_DEVICE_TABLET_TOOL:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
configure_libinput(struct wlr_input_device *wlr_input_device)
|
configure_libinput(struct wlr_input_device *wlr_input_device)
|
||||||
{
|
{
|
||||||
|
|
@ -29,16 +43,14 @@ configure_libinput(struct wlr_input_device *wlr_input_device)
|
||||||
}
|
}
|
||||||
|
|
||||||
enum device_type current_type;
|
enum device_type current_type;
|
||||||
if (wlr_input_device->width_mm) {
|
current_type = is_touch_device(wlr_input_device)
|
||||||
current_type = TOUCH_DEVICE;
|
? TOUCH_DEVICE : NON_TOUCH_DEVICE;
|
||||||
} else {
|
|
||||||
current_type = NON_TOUCH_DEVICE;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct libinput_category *device_category, *dc = NULL;
|
struct libinput_category *device_category, *dc = NULL;
|
||||||
wl_list_for_each(device_category, &rc.libinput_categories, link) {
|
wl_list_for_each(device_category, &rc.libinput_categories, link) {
|
||||||
if (device_category->name) {
|
if (device_category->name) {
|
||||||
if (!strcasecmp(wlr_input_device->name, device_category->name)) {
|
if (!strcasecmp(wlr_input_device->name,
|
||||||
|
device_category->name)) {
|
||||||
dc = device_category;
|
dc = device_category;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -134,10 +146,13 @@ new_pointer(struct seat *seat, struct input *input)
|
||||||
wlr_cursor_attach_input_device(seat->cursor, dev);
|
wlr_cursor_attach_input_device(seat->cursor, dev);
|
||||||
|
|
||||||
/* In support of running with WLR_WL_OUTPUTS set to >=2 */
|
/* In support of running with WLR_WL_OUTPUTS set to >=2 */
|
||||||
if (dev->output_name) {
|
if (dev->type == WLR_INPUT_DEVICE_POINTER) {
|
||||||
wlr_log(WLR_INFO, "map pointer to output %s\n", dev->output_name);
|
wlr_log(WLR_INFO, "map pointer to output %s\n",
|
||||||
struct wlr_output *output =
|
dev->pointer->output_name);
|
||||||
output_by_name(seat->server, dev->output_name);
|
struct wlr_output *output = NULL;
|
||||||
|
if (dev->pointer->output_name != NULL) {
|
||||||
|
output = output_by_name(seat->server, dev->pointer->output_name);
|
||||||
|
}
|
||||||
wlr_cursor_map_input_to_output(seat->cursor, dev, output);
|
wlr_cursor_map_input_to_output(seat->cursor, dev, output);
|
||||||
wlr_cursor_map_input_to_region(seat->cursor, dev, NULL);
|
wlr_cursor_map_input_to_region(seat->cursor, dev, NULL);
|
||||||
}
|
}
|
||||||
|
|
@ -149,7 +164,7 @@ new_keyboard(struct seat *seat, struct input *input)
|
||||||
struct wlr_keyboard *kb = input->wlr_input_device->keyboard;
|
struct wlr_keyboard *kb = input->wlr_input_device->keyboard;
|
||||||
wlr_keyboard_set_keymap(kb, seat->keyboard_group->keyboard.keymap);
|
wlr_keyboard_set_keymap(kb, seat->keyboard_group->keyboard.keymap);
|
||||||
wlr_keyboard_group_add_keyboard(seat->keyboard_group, kb);
|
wlr_keyboard_group_add_keyboard(seat->keyboard_group, kb);
|
||||||
wlr_seat_set_keyboard(seat->seat, input->wlr_input_device);
|
wlr_seat_set_keyboard(seat->seat, kb);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
||||||
|
|
@ -253,7 +253,7 @@ server_init(struct server *server)
|
||||||
seat_init(server);
|
seat_init(server);
|
||||||
|
|
||||||
/* Init xdg-shell */
|
/* Init xdg-shell */
|
||||||
server->xdg_shell = wlr_xdg_shell_create(server->wl_display);
|
server->xdg_shell = wlr_xdg_shell_create(server->wl_display, 2);
|
||||||
if (!server->xdg_shell) {
|
if (!server->xdg_shell) {
|
||||||
wlr_log(WLR_ERROR, "unable to create the XDG shell interface");
|
wlr_log(WLR_ERROR, "unable to create the XDG shell interface");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ view_adjust_size(struct view *view, int *w, int *h)
|
||||||
int min_height = MIN_VIEW_HEIGHT;
|
int min_height = MIN_VIEW_HEIGHT;
|
||||||
#if HAVE_XWAYLAND
|
#if HAVE_XWAYLAND
|
||||||
if (view->type == LAB_XWAYLAND_VIEW) {
|
if (view->type == LAB_XWAYLAND_VIEW) {
|
||||||
struct wlr_xwayland_surface_size_hints *hints =
|
xcb_size_hints_t *hints =
|
||||||
view->xwayland_surface->size_hints;
|
view->xwayland_surface->size_hints;
|
||||||
if (hints) {
|
if (hints) {
|
||||||
*w = round_to_increment(*w, hints->base_width,
|
*w = round_to_increment(*w, hints->base_width,
|
||||||
|
|
|
||||||
|
|
@ -63,14 +63,14 @@ popup_unconstrain(struct xdg_popup *popup)
|
||||||
struct wlr_output_layout *output_layout = server->output_layout;
|
struct wlr_output_layout *output_layout = server->output_layout;
|
||||||
struct wlr_output *wlr_output = wlr_output_layout_output_at(
|
struct wlr_output *wlr_output = wlr_output_layout_output_at(
|
||||||
output_layout, view->x + popup_box->x, view->y + popup_box->y);
|
output_layout, view->x + popup_box->x, view->y + popup_box->y);
|
||||||
struct wlr_box *output_box = wlr_output_layout_get_box(
|
struct wlr_box output_box = {0};
|
||||||
output_layout, wlr_output);
|
wlr_output_layout_get_box(output_layout, wlr_output, &output_box);
|
||||||
|
|
||||||
struct wlr_box output_toplevel_box = {
|
struct wlr_box output_toplevel_box = {
|
||||||
.x = output_box->x - view->x,
|
.x = output_box.x - view->x,
|
||||||
.y = output_box->y - view->y,
|
.y = output_box.y - view->y,
|
||||||
.width = output_box->width,
|
.width = output_box.width,
|
||||||
.height = output_box->height,
|
.height = output_box.height,
|
||||||
};
|
};
|
||||||
wlr_xdg_popup_unconstrain_from_box(
|
wlr_xdg_popup_unconstrain_from_box(
|
||||||
popup->wlr_popup, &output_toplevel_box);
|
popup->wlr_popup, &output_toplevel_box);
|
||||||
|
|
|
||||||
27
src/xdg.c
27
src/xdg.c
|
|
@ -142,29 +142,22 @@ static void
|
||||||
handle_request_minimize(struct wl_listener *listener, void *data)
|
handle_request_minimize(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
struct view *view = wl_container_of(listener, view, request_minimize);
|
struct view *view = wl_container_of(listener, view, request_minimize);
|
||||||
struct wlr_xdg_surface *surface = data;
|
view_minimize(view, view->xdg_surface->toplevel->requested.minimized);
|
||||||
if (view) {
|
|
||||||
view_minimize(view, surface->toplevel->requested.minimized);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
handle_request_maximize(struct wl_listener *listener, void *data)
|
handle_request_maximize(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
struct view *view = wl_container_of(listener, view, request_maximize);
|
struct view *view = wl_container_of(listener, view, request_maximize);
|
||||||
struct wlr_xdg_surface *surface = data;
|
view_maximize(view, view->xdg_surface->toplevel->requested.maximized);
|
||||||
if (view) {
|
|
||||||
view_maximize(view, surface->toplevel->requested.maximized);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
handle_request_fullscreen(struct wl_listener *listener, void *data)
|
handle_request_fullscreen(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
struct view *view = wl_container_of(listener, view, request_fullscreen);
|
struct view *view = wl_container_of(listener, view, request_fullscreen);
|
||||||
struct wlr_xdg_toplevel_set_fullscreen_event *e = data;
|
view_set_fullscreen(view, view->xdg_surface->toplevel->requested.fullscreen,
|
||||||
view_set_fullscreen(view, e->fullscreen, e->output);
|
view->xdg_surface->toplevel->requested.fullscreen_output);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -195,7 +188,7 @@ xdg_toplevel_view_configure(struct view *view, struct wlr_box geo)
|
||||||
view->pending_move_resize.width = geo.width;
|
view->pending_move_resize.width = geo.width;
|
||||||
view->pending_move_resize.height = geo.height;
|
view->pending_move_resize.height = geo.height;
|
||||||
|
|
||||||
uint32_t serial = wlr_xdg_toplevel_set_size(view->xdg_surface,
|
uint32_t serial = wlr_xdg_toplevel_set_size(view->xdg_surface->toplevel,
|
||||||
(uint32_t)geo.width, (uint32_t)geo.height);
|
(uint32_t)geo.width, (uint32_t)geo.height);
|
||||||
if (serial > 0) {
|
if (serial > 0) {
|
||||||
view->pending_move_resize.configure_serial = serial;
|
view->pending_move_resize.configure_serial = serial;
|
||||||
|
|
@ -219,7 +212,7 @@ xdg_toplevel_view_move(struct view *view, double x, double y)
|
||||||
static void
|
static void
|
||||||
xdg_toplevel_view_close(struct view *view)
|
xdg_toplevel_view_close(struct view *view)
|
||||||
{
|
{
|
||||||
wlr_xdg_toplevel_send_close(view->xdg_surface);
|
wlr_xdg_toplevel_send_close(view->xdg_surface->toplevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -248,7 +241,7 @@ update_padding(struct view *view)
|
||||||
static void
|
static void
|
||||||
xdg_toplevel_view_maximize(struct view *view, bool maximized)
|
xdg_toplevel_view_maximize(struct view *view, bool maximized)
|
||||||
{
|
{
|
||||||
wlr_xdg_toplevel_set_maximized(view->xdg_surface, maximized);
|
wlr_xdg_toplevel_set_maximized(view->xdg_surface->toplevel, maximized);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -256,14 +249,14 @@ xdg_toplevel_view_set_activated(struct view *view, bool activated)
|
||||||
{
|
{
|
||||||
struct wlr_xdg_surface *surface = view->xdg_surface;
|
struct wlr_xdg_surface *surface = view->xdg_surface;
|
||||||
if (surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL) {
|
if (surface->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL) {
|
||||||
wlr_xdg_toplevel_set_activated(surface, activated);
|
wlr_xdg_toplevel_set_activated(surface->toplevel, activated);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
xdg_toplevel_view_set_fullscreen(struct view *view, bool fullscreen)
|
xdg_toplevel_view_set_fullscreen(struct view *view, bool fullscreen)
|
||||||
{
|
{
|
||||||
wlr_xdg_toplevel_set_fullscreen(view->xdg_surface, fullscreen);
|
wlr_xdg_toplevel_set_fullscreen(view->xdg_surface->toplevel, fullscreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
|
|
@ -277,7 +270,7 @@ parent_of(struct view *view)
|
||||||
{
|
{
|
||||||
struct view *p;
|
struct view *p;
|
||||||
wl_list_for_each (p, &view->server->views, link) {
|
wl_list_for_each (p, &view->server->views, link) {
|
||||||
if (p->xdg_surface == view->xdg_surface->toplevel->parent) {
|
if (p->xdg_surface->toplevel == view->xdg_surface->toplevel->parent) {
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue