Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Simon Zeni
wlroots
Commits
84103103
Commit
84103103
authored
May 16, 2019
by
Scott Anderson
Browse files
Update wlr_seat and friends to new compositor
parent
8630988e
Changes
12
Hide whitespace changes
Inline
Side-by-side
include/wlr/types/wlr_data_device.h
View file @
84103103
...
...
@@ -12,6 +12,8 @@
#include <wayland-server.h>
#include <wlr/types/wlr_seat.h>
struct
wlr_surface_2
;
extern
const
struct
wlr_pointer_grab_interface
wlr_data_device_pointer_drag_interface
;
...
...
@@ -93,7 +95,7 @@ struct wlr_drag;
struct
wlr_drag_icon
{
struct
wlr_drag
*
drag
;
struct
wlr_surface
*
surface
;
struct
wlr_surface
_2
*
surface
;
bool
mapped
;
struct
{
...
...
@@ -102,6 +104,7 @@ struct wlr_drag_icon {
struct
wl_signal
destroy
;
}
events
;
struct
wl_listener
surface_commit
;
struct
wl_listener
surface_destroy
;
void
*
data
;
...
...
@@ -124,7 +127,7 @@ struct wlr_drag {
struct
wlr_seat_client
*
focus_client
;
struct
wlr_drag_icon
*
icon
;
// can be NULL
struct
wlr_surface
*
focus
;
// can be NULL
struct
wlr_surface
_2
*
focus
;
// can be NULL
struct
wlr_data_source
*
source
;
// can be NULL
bool
started
,
dropped
,
cancelling
;
...
...
@@ -187,13 +190,13 @@ void wlr_seat_set_selection(struct wlr_seat *seat,
* `wlr_seat_request_start_drag`.
*/
struct
wlr_drag
*
wlr_drag_create
(
struct
wlr_seat_client
*
seat_client
,
struct
wlr_data_source
*
source
,
struct
wlr_surface
*
icon_surface
);
struct
wlr_data_source
*
source
,
struct
wlr_surface
_2
*
icon_surface
);
/**
* Requests a drag to be started on the seat.
*/
void
wlr_seat_request_start_drag
(
struct
wlr_seat
*
seat
,
struct
wlr_drag
*
drag
,
struct
wlr_surface
*
origin
,
uint32_t
serial
);
struct
wlr_surface
_2
*
origin
,
uint32_t
serial
);
/**
* Starts a drag on the seat. This starts an implicit keyboard grab, but doesn't
...
...
include/wlr/types/wlr_seat.h
View file @
84103103
...
...
@@ -13,7 +13,8 @@
#include <wayland-server.h>
#include <wlr/types/wlr_input_device.h>
#include <wlr/types/wlr_keyboard.h>
#include <wlr/types/wlr_surface.h>
struct
wlr_surface_2
;
/**
* Contains state for a single client's bound wl_seat resource and can be used
...
...
@@ -39,10 +40,10 @@ struct wlr_seat_client {
struct
wlr_touch_point
{
int32_t
touch_id
;
struct
wlr_surface
*
surface
;
struct
wlr_surface
_2
*
surface
;
struct
wlr_seat_client
*
client
;
struct
wlr_surface
*
focus_surface
;
struct
wlr_surface
_2
*
focus_surface
;
struct
wlr_seat_client
*
focus_client
;
double
sx
,
sy
;
...
...
@@ -60,7 +61,7 @@ struct wlr_seat_pointer_grab;
struct
wlr_pointer_grab_interface
{
void
(
*
enter
)(
struct
wlr_seat_pointer_grab
*
grab
,
struct
wlr_surface
*
surface
,
double
sx
,
double
sy
);
struct
wlr_surface
_2
*
surface
,
double
sx
,
double
sy
);
void
(
*
motion
)(
struct
wlr_seat_pointer_grab
*
grab
,
uint32_t
time_msec
,
double
sx
,
double
sy
);
uint32_t
(
*
button
)(
struct
wlr_seat_pointer_grab
*
grab
,
uint32_t
time_msec
,
...
...
@@ -76,7 +77,7 @@ struct wlr_seat_keyboard_grab;
struct
wlr_keyboard_grab_interface
{
void
(
*
enter
)(
struct
wlr_seat_keyboard_grab
*
grab
,
struct
wlr_surface
*
surface
,
uint32_t
keycodes
[],
struct
wlr_surface
_2
*
surface
,
uint32_t
keycodes
[],
size_t
num_keycodes
,
struct
wlr_keyboard_modifiers
*
modifiers
);
void
(
*
key
)(
struct
wlr_seat_keyboard_grab
*
grab
,
uint32_t
time_msec
,
uint32_t
key
,
uint32_t
state
);
...
...
@@ -134,7 +135,7 @@ struct wlr_seat_pointer_grab {
struct
wlr_seat_pointer_state
{
struct
wlr_seat
*
seat
;
struct
wlr_seat_client
*
focused_client
;
struct
wlr_surface
*
focused_surface
;
struct
wlr_surface
_2
*
focused_surface
;
double
sx
,
sy
;
struct
wlr_seat_pointer_grab
*
grab
;
...
...
@@ -158,7 +159,7 @@ struct wlr_seat_keyboard_state {
struct
wlr_keyboard
*
keyboard
;
struct
wlr_seat_client
*
focused_client
;
struct
wlr_surface
*
focused_surface
;
struct
wlr_surface
_2
*
focused_surface
;
struct
wl_listener
keyboard_destroy
;
struct
wl_listener
keyboard_keymap
;
...
...
@@ -250,7 +251,7 @@ struct wlr_seat {
struct
wlr_seat_pointer_request_set_cursor_event
{
struct
wlr_seat_client
*
seat_client
;
struct
wlr_surface
*
surface
;
struct
wlr_surface
_2
*
surface
;
uint32_t
serial
;
int32_t
hotspot_x
,
hotspot_y
;
};
...
...
@@ -267,19 +268,19 @@ struct wlr_seat_request_set_primary_selection_event {
struct
wlr_seat_request_start_drag_event
{
struct
wlr_drag
*
drag
;
struct
wlr_surface
*
origin
;
struct
wlr_surface
_2
*
origin
;
uint32_t
serial
;
};
struct
wlr_seat_pointer_focus_change_event
{
struct
wlr_seat
*
seat
;
struct
wlr_surface
*
old_surface
,
*
new_surface
;
struct
wlr_surface
_2
*
old_surface
,
*
new_surface
;
double
sx
,
sy
;
};
struct
wlr_seat_keyboard_focus_change_event
{
struct
wlr_seat
*
seat
;
struct
wlr_surface
*
old_surface
,
*
new_surface
;
struct
wlr_surface
_2
*
old_surface
,
*
new_surface
;
};
/**
...
...
@@ -312,7 +313,7 @@ void wlr_seat_set_name(struct wlr_seat *wlr_seat, const char *name);
* Whether or not the surface has pointer focus
*/
bool
wlr_seat_pointer_surface_has_focus
(
struct
wlr_seat
*
wlr_seat
,
struct
wlr_surface
*
surface
);
struct
wlr_surface
_2
*
surface
);
/**
* Send a pointer enter event to the given surface and consider it to be the
...
...
@@ -322,7 +323,7 @@ bool wlr_seat_pointer_surface_has_focus(struct wlr_seat *wlr_seat,
* focus to respect pointer grabs.
*/
void
wlr_seat_pointer_enter
(
struct
wlr_seat
*
wlr_seat
,
struct
wlr_surface
*
surface
,
double
sx
,
double
sy
);
struct
wlr_surface
_2
*
surface
,
double
sx
,
double
sy
);
/**
* Clear the focused surface for the pointer and leave all entered surfaces.
...
...
@@ -382,7 +383,7 @@ void wlr_seat_pointer_end_grab(struct wlr_seat *wlr_seat);
* where the enter occurred.
*/
void
wlr_seat_pointer_notify_enter
(
struct
wlr_seat
*
wlr_seat
,
struct
wlr_surface
*
surface
,
double
sx
,
double
sy
);
struct
wlr_surface
_2
*
surface
,
double
sx
,
double
sy
);
/**
* Notify the seat of motion over the given surface. Pass surface-local
...
...
@@ -474,7 +475,7 @@ void wlr_seat_keyboard_notify_modifiers(struct wlr_seat *seat,
* keyboard.
*/
void
wlr_seat_keyboard_notify_enter
(
struct
wlr_seat
*
seat
,
struct
wlr_surface
*
surface
,
uint32_t
keycodes
[],
size_t
num_keycodes
,
struct
wlr_surface
_2
*
surface
,
uint32_t
keycodes
[],
size_t
num_keycodes
,
struct
wlr_keyboard_modifiers
*
modifiers
);
/**
...
...
@@ -485,7 +486,7 @@ void wlr_seat_keyboard_notify_enter(struct wlr_seat *seat,
* keyboard grabs.
*/
void
wlr_seat_keyboard_enter
(
struct
wlr_seat
*
seat
,
struct
wlr_surface
*
surface
,
uint32_t
keycodes
[],
size_t
num_keycodes
,
struct
wlr_surface
_2
*
surface
,
uint32_t
keycodes
[],
size_t
num_keycodes
,
struct
wlr_keyboard_modifiers
*
modifiers
);
/**
...
...
@@ -523,7 +524,7 @@ struct wlr_touch_point *wlr_seat_touch_get_point(struct wlr_seat *seat,
* the touch device.
*/
uint32_t
wlr_seat_touch_notify_down
(
struct
wlr_seat
*
seat
,
struct
wlr_surface
*
surface
,
uint32_t
time_msec
,
struct
wlr_surface
_2
*
surface
,
uint32_t
time_msec
,
int32_t
touch_id
,
double
sx
,
double
sy
);
/**
...
...
@@ -548,7 +549,7 @@ void wlr_seat_touch_notify_motion(struct wlr_seat *seat, uint32_t time_msec,
* `wlr_seat_touch_point_clear_focus()`.
*/
void
wlr_seat_touch_point_focus
(
struct
wlr_seat
*
seat
,
struct
wlr_surface
*
surface
,
uint32_t
time_msec
,
struct
wlr_surface
_2
*
surface
,
uint32_t
time_msec
,
int32_t
touch_id
,
double
sx
,
double
sy
);
/**
...
...
@@ -566,7 +567,7 @@ void wlr_seat_touch_point_clear_focus(struct wlr_seat *seat, uint32_t time_msec,
* `wlr_seat_touch_notify_down()` to respect any grabs of the touch device.
*/
uint32_t
wlr_seat_touch_send_down
(
struct
wlr_seat
*
seat
,
struct
wlr_surface
*
surface
,
uint32_t
time_msec
,
struct
wlr_surface
_2
*
surface
,
uint32_t
time_msec
,
int32_t
touch_id
,
double
sx
,
double
sy
);
/**
...
...
@@ -607,7 +608,7 @@ bool wlr_seat_validate_grab_serial(struct wlr_seat *seat, uint32_t serial);
* Check whether this serial is valid to start a pointer grab action.
*/
bool
wlr_seat_validate_pointer_grab_serial
(
struct
wlr_seat
*
seat
,
struct
wlr_surface
*
origin
,
uint32_t
serial
);
struct
wlr_surface
_2
*
origin
,
uint32_t
serial
);
/**
* Check whether this serial is valid to start a touch grab action. If it's the
...
...
@@ -615,7 +616,7 @@ bool wlr_seat_validate_pointer_grab_serial(struct wlr_seat *seat,
* the serial.
*/
bool
wlr_seat_validate_touch_grab_serial
(
struct
wlr_seat
*
seat
,
struct
wlr_surface
*
origin
,
uint32_t
serial
,
struct
wlr_surface
_2
*
origin
,
uint32_t
serial
,
struct
wlr_touch_point
**
point_ptr
);
/**
...
...
include/wlr/types/wlr_tablet_v2.h
View file @
84103103
...
...
@@ -19,6 +19,7 @@
#define WLR_TABLET_V2_TOOL_BUTTONS_CAP 16
struct
wlr_tablet_pad_v2_grab_interface
;
struct
wlr_surface_2
;
struct
wlr_tablet_pad_v2_grab
{
const
struct
wlr_tablet_pad_v2_grab_interface
*
interface
;
...
...
@@ -71,7 +72,7 @@ struct wlr_tablet_v2_tablet_tool {
struct
wl_listener
tool_destroy
;
struct
wlr_tablet_tool_client_v2
*
current_client
;
struct
wlr_surface
*
focused_surface
;
struct
wlr_surface
_2
*
focused_surface
;
struct
wl_listener
surface_destroy
;
struct
wlr_tablet_tool_v2_grab
*
grab
;
...
...
@@ -112,7 +113,7 @@ struct wlr_tablet_v2_tablet_pad {
};
struct
wlr_tablet_v2_event_cursor
{
struct
wlr_surface
*
surface
;
struct
wlr_surface
_2
*
surface
;
uint32_t
serial
;
int32_t
hotspot_x
;
int32_t
hotspot_y
;
...
...
@@ -146,7 +147,7 @@ void wlr_tablet_v2_destroy(struct wlr_tablet_manager_v2 *manager);
void
wlr_send_tablet_v2_tablet_tool_proximity_in
(
struct
wlr_tablet_v2_tablet_tool
*
tool
,
struct
wlr_tablet_v2_tablet
*
tablet
,
struct
wlr_surface
*
surface
);
struct
wlr_surface
_2
*
surface
);
void
wlr_send_tablet_v2_tablet_tool_down
(
struct
wlr_tablet_v2_tablet_tool
*
tool
);
void
wlr_send_tablet_v2_tablet_tool_up
(
struct
wlr_tablet_v2_tablet_tool
*
tool
);
...
...
@@ -184,7 +185,7 @@ void wlr_send_tablet_v2_tablet_tool_button(
void
wlr_tablet_v2_tablet_tool_notify_proximity_in
(
struct
wlr_tablet_v2_tablet_tool
*
tool
,
struct
wlr_tablet_v2_tablet
*
tablet
,
struct
wlr_surface
*
surface
);
struct
wlr_surface
_2
*
surface
);
void
wlr_tablet_v2_tablet_tool_notify_down
(
struct
wlr_tablet_v2_tablet_tool
*
tool
);
void
wlr_tablet_v2_tablet_tool_notify_up
(
struct
wlr_tablet_v2_tablet_tool
*
tool
);
...
...
@@ -222,7 +223,7 @@ struct wlr_tablet_tool_v2_grab_interface {
void
(
*
proximity_in
)(
struct
wlr_tablet_tool_v2_grab
*
grab
,
struct
wlr_tablet_v2_tablet
*
tablet
,
struct
wlr_surface
*
surface
);
struct
wlr_surface
_2
*
surface
);
void
(
*
down
)(
struct
wlr_tablet_tool_v2_grab
*
grab
);
void
(
*
up
)(
struct
wlr_tablet_tool_v2_grab
*
grab
);
...
...
@@ -258,7 +259,7 @@ void wlr_tablet_tool_v2_start_implicit_grab(struct wlr_tablet_v2_tablet_tool *to
uint32_t
wlr_send_tablet_v2_tablet_pad_enter
(
struct
wlr_tablet_v2_tablet_pad
*
pad
,
struct
wlr_tablet_v2_tablet
*
tablet
,
struct
wlr_surface
*
surface
);
struct
wlr_surface
_2
*
surface
);
void
wlr_send_tablet_v2_tablet_pad_button
(
struct
wlr_tablet_v2_tablet_pad
*
pad
,
size_t
button
,
...
...
@@ -270,7 +271,7 @@ void wlr_send_tablet_v2_tablet_pad_ring(struct wlr_tablet_v2_tablet_pad *pad,
uint32_t
ring
,
double
position
,
bool
finger
,
uint32_t
time
);
uint32_t
wlr_send_tablet_v2_tablet_pad_leave
(
struct
wlr_tablet_v2_tablet_pad
*
pad
,
struct
wlr_surface
*
surface
);
struct
wlr_surface
_2
*
surface
);
uint32_t
wlr_send_tablet_v2_tablet_pad_mode
(
struct
wlr_tablet_v2_tablet_pad
*
pad
,
size_t
group
,
uint32_t
mode
,
uint32_t
time
);
...
...
@@ -279,7 +280,7 @@ uint32_t wlr_send_tablet_v2_tablet_pad_mode(struct wlr_tablet_v2_tablet_pad *pad
uint32_t
wlr_tablet_v2_tablet_pad_notify_enter
(
struct
wlr_tablet_v2_tablet_pad
*
pad
,
struct
wlr_tablet_v2_tablet
*
tablet
,
struct
wlr_surface
*
surface
);
struct
wlr_surface
_2
*
surface
);
void
wlr_tablet_v2_tablet_pad_notify_button
(
struct
wlr_tablet_v2_tablet_pad
*
pad
,
size_t
button
,
...
...
@@ -293,7 +294,7 @@ void wlr_tablet_v2_tablet_pad_notify_ring(
uint32_t
ring
,
double
position
,
bool
finger
,
uint32_t
time
);
uint32_t
wlr_tablet_v2_tablet_pad_notify_leave
(
struct
wlr_tablet_v2_tablet_pad
*
pad
,
struct
wlr_surface
*
surface
);
struct
wlr_tablet_v2_tablet_pad
*
pad
,
struct
wlr_surface
_2
*
surface
);
uint32_t
wlr_tablet_v2_tablet_pad_notify_mode
(
struct
wlr_tablet_v2_tablet_pad
*
pad
,
...
...
@@ -303,7 +304,7 @@ struct wlr_tablet_pad_v2_grab_interface {
uint32_t
(
*
enter
)(
struct
wlr_tablet_pad_v2_grab
*
grab
,
struct
wlr_tablet_v2_tablet
*
tablet
,
struct
wlr_surface
*
surface
);
struct
wlr_surface
_2
*
surface
);
void
(
*
button
)(
struct
wlr_tablet_pad_v2_grab
*
grab
,
size_t
button
,
uint32_t
time
,
enum
zwp_tablet_pad_v2_button_state
state
);
...
...
@@ -314,7 +315,7 @@ struct wlr_tablet_pad_v2_grab_interface {
uint32_t
ring
,
double
position
,
bool
finger
,
uint32_t
time
);
uint32_t
(
*
leave
)(
struct
wlr_tablet_pad_v2_grab
*
grab
,
struct
wlr_surface
*
surface
);
struct
wlr_surface
_2
*
surface
);
uint32_t
(
*
mode
)(
struct
wlr_tablet_pad_v2_grab
*
grab
,
size_t
group
,
uint32_t
mode
,
uint32_t
time
);
...
...
@@ -326,5 +327,5 @@ void wlr_tablet_v2_end_grab(struct wlr_tablet_v2_tablet_pad *pad);
void
wlr_tablet_v2_start_grab
(
struct
wlr_tablet_v2_tablet_pad
*
pad
,
struct
wlr_tablet_pad_v2_grab
*
grab
);
bool
wlr_surface_accepts_tablet_v2
(
struct
wlr_tablet_v2_tablet
*
tablet
,
struct
wlr_surface
*
surface
);
struct
wlr_surface
_2
*
surface
);
#endif
/* WLR_TYPES_WLR_TABLET_V2_H */
types/data_device/wlr_data_device.c
View file @
84103103
...
...
@@ -6,6 +6,7 @@
#include <wayland-server.h>
#include <wlr/types/wlr_data_device.h>
#include <wlr/types/wlr_seat.h>
#include <wlr/types/wlr_compositor.h>
#include <wlr/util/log.h>
#include "types/wlr_data_device.h"
#include "util/signal.h"
...
...
@@ -55,18 +56,19 @@ static void data_device_start_drag(struct wl_client *client,
return
;
}
struct
wlr_surface
*
origin
=
wlr_surface_from_resource
(
origin_resource
);
struct
wlr_surface
_2
*
origin
=
wlr_surface_from_resource
_2
(
origin_resource
);
struct
wlr_client_data_source
*
source
=
NULL
;
if
(
source_resource
!=
NULL
)
{
source
=
client_data_source_from_resource
(
source_resource
);
}
struct
wlr_surface
*
icon
=
NULL
;
struct
wlr_surface
_2
*
icon
=
NULL
;
if
(
icon_resource
)
{
icon
=
wlr_surface_from_resource
(
icon_resource
);
if
(
!
wlr_surface_set_role
(
icon
,
&
drag_icon_surface_role
,
NULL
,
icon_resource
,
WL_DATA_DEVICE_ERROR_ROLE
))
{
icon
=
wlr_surface_from_resource_2
(
icon_resource
);
if
(
!
wlr_surface_set_role_2
(
icon
,
"wl_data_device"
))
{
wl_resource_post_error
(
icon_resource
,
WL_DATA_DEVICE_ERROR_ROLE
,
"surface already has role"
);
return
;
}
}
...
...
types/data_device/wlr_drag.c
View file @
84103103
...
...
@@ -5,6 +5,7 @@
#include <unistd.h>
#include <wayland-server.h>
#include <wlr/types/wlr_data_device.h>
#include <wlr/types/wlr_compositor.h>
#include <wlr/types/wlr_seat.h>
#include <wlr/util/log.h>
#include "types/wlr_data_device.h"
...
...
@@ -20,7 +21,7 @@ static void drag_handle_seat_client_destroy(struct wl_listener *listener,
}
static
void
drag_set_focus
(
struct
wlr_drag
*
drag
,
struct
wlr_surface
*
surface
,
double
sx
,
double
sy
)
{
struct
wlr_surface
_2
*
surface
,
double
sx
,
double
sy
)
{
if
(
drag
->
focus
==
surface
)
{
return
;
}
...
...
@@ -154,7 +155,7 @@ static void drag_destroy(struct wlr_drag *drag) {
}
static
void
drag_handle_pointer_enter
(
struct
wlr_seat_pointer_grab
*
grab
,
struct
wlr_surface
*
surface
,
double
sx
,
double
sy
)
{
struct
wlr_surface
_2
*
surface
,
double
sx
,
double
sy
)
{
struct
wlr_drag
*
drag
=
grab
->
data
;
drag_set_focus
(
drag
,
surface
,
sx
,
sy
);
}
...
...
@@ -298,7 +299,7 @@ static const struct wlr_touch_grab_interface
};
static
void
drag_handle_keyboard_enter
(
struct
wlr_seat_keyboard_grab
*
grab
,
struct
wlr_surface
*
surface
,
uint32_t
keycodes
[],
size_t
num_keycodes
,
struct
wlr_surface
_2
*
surface
,
uint32_t
keycodes
[],
size_t
num_keycodes
,
struct
wlr_keyboard_modifiers
*
modifiers
)
{
// nothing has keyboard focus during drags
}
...
...
@@ -347,34 +348,34 @@ static void drag_icon_destroy(struct wlr_drag_icon *icon) {
drag_icon_set_mapped
(
icon
,
false
);
wlr_signal_emit_safe
(
&
icon
->
events
.
destroy
,
icon
);
icon
->
surface
->
role_data
=
NULL
;
wl_list_remove
(
&
icon
->
surface_commit
.
link
);
wl_list_remove
(
&
icon
->
surface_destroy
.
link
);
free
(
icon
);
}
static
void
drag_icon_handle_surface_
destroy
(
struct
wl_listener
*
listener
,
static
void
drag_icon_handle_surface_
commit
(
struct
wl_listener
*
listener
,
void
*
data
)
{
struct
wlr_drag_icon
*
icon
=
wl_container_of
(
listener
,
icon
,
surface_destroy
);
drag_icon_destroy
(
icon
);
}
wl_container_of
(
listener
,
icon
,
surface_commit
);
static
void
drag_icon_surface_role_commit
(
struct
wlr_surface
*
surface
)
{
assert
(
surface
->
role
==
&
drag_icon_surface_role
);
struct
wlr_drag_icon
*
icon
=
surface
->
role_data
;
if
(
icon
==
NULL
)
{
return
;
}
struct
wlr_commit
*
commit
=
wlr_surface_get_commit
(
icon
->
surface
);
bool
has_buffer
=
commit
->
buffer
;
wlr_commit_unref
(
commit
);
drag_icon_set_mapped
(
icon
,
wlr_surface_has_buffer
(
surface
));
if
(
has_buffer
)
{
drag_icon_set_mapped
(
icon
,
true
);
}
}
const
struct
wlr_surface_role
drag_icon_surface_role
=
{
.
name
=
"wl_data_device-icon"
,
.
commit
=
drag_icon_surface_role_commit
,
};
static
void
drag_icon_handle_surface_destroy
(
struct
wl_listener
*
listener
,
void
*
data
)
{
struct
wlr_drag_icon
*
icon
=
wl_container_of
(
listener
,
icon
,
surface_destroy
);
drag_icon_destroy
(
icon
);
}
static
struct
wlr_drag_icon
*
drag_icon_create
(
struct
wlr_drag
*
drag
,
struct
wlr_surface
*
surface
)
{
struct
wlr_surface
_2
*
surface
)
{
struct
wlr_drag_icon
*
icon
=
calloc
(
1
,
sizeof
(
struct
wlr_drag_icon
));
if
(
!
icon
)
{
return
NULL
;
...
...
@@ -387,13 +388,21 @@ static struct wlr_drag_icon *drag_icon_create(struct wlr_drag *drag,
wl_signal_init
(
&
icon
->
events
.
unmap
);
wl_signal_init
(
&
icon
->
events
.
destroy
);
wl_signal_add
(
&
icon
->
surface
->
events
.
commit
,
&
icon
->
surface_commit
);
icon
->
surface_commit
.
notify
=
drag_icon_handle_surface_commit
;
wl_signal_add
(
&
icon
->
surface
->
events
.
destroy
,
&
icon
->
surface_destroy
);
icon
->
surface_destroy
.
notify
=
drag_icon_handle_surface_destroy
;
icon
->
surface
->
role_data
=
icon
;
if
(
wlr_surface_has_buffer
(
surface
))
{
drag_icon_set_mapped
(
icon
,
true
);
struct
wlr_commit
*
commit
=
wlr_surface_get_commit
(
icon
->
surface
);
if
(
commit
)
{
bool
has_buffer
=
commit
->
buffer
;
wlr_commit_unref
(
commit
);
if
(
has_buffer
)
{
drag_icon_set_mapped
(
icon
,
true
);
}
}
return
icon
;
...
...
@@ -401,7 +410,7 @@ static struct wlr_drag_icon *drag_icon_create(struct wlr_drag *drag,
struct
wlr_drag
*
wlr_drag_create
(
struct
wlr_seat_client
*
seat_client
,
struct
wlr_data_source
*
source
,
struct
wlr_surface
*
icon_surface
)
{
struct
wlr_data_source
*
source
,
struct
wlr_surface
_2
*
icon_surface
)
{
struct
wlr_drag
*
drag
=
calloc
(
1
,
sizeof
(
struct
wlr_drag
));
if
(
drag
==
NULL
)
{
return
NULL
;
...
...
@@ -447,7 +456,7 @@ struct wlr_drag *wlr_drag_create(struct wlr_seat_client *seat_client,
}
void
wlr_seat_request_start_drag
(
struct
wlr_seat
*
seat
,
struct
wlr_drag
*
drag
,
struct
wlr_surface
*
origin
,
uint32_t
serial
)
{
struct
wlr_surface
_2
*
origin
,
uint32_t
serial
)
{
assert
(
drag
->
seat
==
seat
);
if
(
seat
->
drag
!=
NULL
)
{
...
...
types/meson.build
View file @
84103103
lib_wlr_types = static_library(
'wlr_types',
files(
#
'data_device/wlr_data_device.c',
#
'data_device/wlr_data_offer.c',
#
'data_device/wlr_data_source.c',
#
'data_device/wlr_drag.c',
#
'seat/wlr_seat_keyboard.c',
#
'seat/wlr_seat_pointer.c',
#
'seat/wlr_seat_touch.c',
#
'seat/wlr_seat.c',
#
'tablet_v2/wlr_tablet_v2_pad.c',
#
'tablet_v2/wlr_tablet_v2_tablet.c',
#
'tablet_v2/wlr_tablet_v2_tool.c',
#
'tablet_v2/wlr_tablet_v2.c',
'data_device/wlr_data_device.c',
'data_device/wlr_data_offer.c',
'data_device/wlr_data_source.c',
'data_device/wlr_drag.c',
'seat/wlr_seat_keyboard.c',
'seat/wlr_seat_pointer.c',
'seat/wlr_seat_touch.c',
'seat/wlr_seat.c',
'tablet_v2/wlr_tablet_v2_pad.c',
'tablet_v2/wlr_tablet_v2_tablet.c',
'tablet_v2/wlr_tablet_v2_tool.c',
'tablet_v2/wlr_tablet_v2.c',
#'xdg_shell_v6/wlr_xdg_popup_v6.c',
#'xdg_shell_v6/wlr_xdg_positioner_v6.c',
#'xdg_shell_v6/wlr_xdg_shell_v6.c',
...
...
@@ -27,18 +27,18 @@ lib_wlr_types = static_library(
'wlr_compositor.c',
'wlr_subcompositor.c',
#'wlr_cursor.c',
#
'wlr_data_control_v1.c',
'wlr_data_control_v1.c',
#'wlr_export_dmabuf_v1.c',
#'wlr_foreign_toplevel_management_v1.c',
#'wlr_fullscreen_shell_v1.c',
#'wlr_gamma_control_v1.c',
#'wlr_gamma_control.c',
#
'wlr_gtk_primary_selection.c',
'wlr_gtk_primary_selection.c',
#'wlr_idle_inhibit_v1.c',
#
'wlr_idle.c',
#
'wlr_input_device.c',
#
'wlr_input_inhibitor.c',
#
'wlr_input_method_v2.c',
'wlr_idle.c',
'wlr_input_device.c',
'wlr_input_inhibitor.c',
'wlr_input_method_v2.c',
'wlr_keyboard.c',
#'wlr_layer_shell_v1.c',
'wlr_linux_dmabuf_v1.c',
...
...
@@ -49,22 +49,22 @@ lib_wlr_types = static_library(
'wlr_output_management_v1.c',
#'wlr_output.c',
#'wlr_pointer_constraints_v1.c',
#
'wlr_pointer_gestures_v1.c',
'wlr_pointer_gestures_v1.c',
'wlr_pointer.c',
#'wlr_presentation_time.c',
#
'wlr_primary_selection_v1.c',
#
'wlr_primary_selection.c',
#
'wlr_relative_pointer_v1.c',
'wlr_primary_selection_v1.c',
'wlr_primary_selection.c',
'wlr_relative_pointer_v1.c',
#'wlr_screencopy_v1.c',
#'wlr_screenshooter.c',
#'wlr_server_decoration.c',
#'wlr_surface.c',
'wlr_switch.c',
'wlr_tablet_pad.c',
#
'wlr_tablet_tool.c',
#
'wlr_text_input_v3.c',
'wlr_tablet_tool.c',
'wlr_text_input_v3.c',
'wlr_touch.c',
#
'wlr_virtual_keyboard_v1.c',
'wlr_virtual_keyboard_v1.c',
#'wlr_xcursor_manager.c',
#'wlr_xdg_decoration_v1.c',
#'wlr_xdg_output_v1.c',
...
...
types/seat/wlr_seat_keyboard.c
View file @
84103103
...
...
@@ -9,6 +9,7 @@
#include <wlr/types/wlr_data_device.h>
#include <wlr/types/wlr_gtk_primary_selection.h>
#include <wlr/types/wlr_input_device.h>
#include <wlr/types/wlr_compositor.h>
#include <wlr/util/log.h>
#include "types/wlr_data_device.h"
#include "types/wlr_seat.h"
...
...
@@ -16,7 +17,7 @@
#include "util/signal.h"
static
void
default_keyboard_enter
(
struct
wlr_seat_keyboard_grab
*
grab
,
struct
wlr_surface
*
surface
,
uint32_t
keycodes
[],
size_t
num_keycodes
,
struct
wlr_surface
_2
*
surface
,
uint32_t
keycodes
[],
size_t
num_keycodes
,
struct
wlr_keyboard_modifiers
*
modifiers
)
{
wlr_seat_keyboard_enter
(
grab
->
seat
,
surface
,
keycodes
,
num_keycodes
,
modifiers
);
}
...
...
@@ -219,7 +220,7 @@ void wlr_seat_keyboard_send_modifiers(struct wlr_seat *seat,
}
void
wlr_seat_keyboard_enter
(
struct
wlr_seat
*
seat
,
struct
wlr_surface
*
surface
,
uint32_t
keycodes
[],
size_t
num_keycodes
,
struct
wlr_surface
_2
*
surface
,
uint32_t
keycodes
[],
size_t
num_keycodes
,
struct
wlr_keyboard_modifiers
*
modifiers
)
{
if
(
seat
->
keyboard_state
.
focused_surface
==
surface
)
{
// this surface already got an enter notify
...
...
@@ -235,7 +236,7 @@ void wlr_seat_keyboard_enter(struct wlr_seat *seat,
struct
wlr_seat_client
*
focused_client
=
seat
->
keyboard_state
.
focused_client
;
struct
wlr_surface
*
focused_surface
=
struct
wlr_surface
_2
*
focused_surface
=
seat
->
keyboard_state
.
focused_surface
;
// leave the previously entered surface
...
...
@@ -304,7 +305,7 @@ void wlr_seat_keyboard_enter(struct wlr_seat *seat,
}
void
wlr_seat_keyboard_notify_enter
(
struct
wlr_seat
*
seat
,
struct
wlr_surface
*
surface
,
uint32_t
keycodes
[],
size_t
num_keycodes
,
struct
wlr_surface
_2
*
surface
,
uint32_t
keycodes
[],
size_t
num_keycodes
,
struct
wlr_keyboard_modifiers
*
modifiers
)
{
struct
wlr_seat_keyboard_grab
*
grab
=
seat
->
keyboard_state
.
grab
;
grab
->
interface
->
enter
(
grab
,
surface
,
keycodes
,
num_keycodes
,
modifiers
);
...
...
types/seat/wlr_seat_pointer.c
View file @
84103103
...
...
@@ -5,12 +5,13 @@
#include <time.h>
#include <wayland-server.h>
#include <wlr/types/wlr_input_device.h>
#include <wlr/types/wlr_compositor.h>
#include <wlr/util/log.h>
#include "types/wlr_seat.h"
#include "util/signal.h"
static
void
default_pointer_enter
(
struct
wlr_seat_pointer_grab
*
grab
,
struct
wlr_surface
*
surface
,
double
sx
,
double
sy
)
{
struct
wlr_surface
_2
*
surface
,
double
sx
,
double
sy
)
{
wlr_seat_pointer_enter
(
grab
->
seat
,
surface
,
sx
,
sy
);
}
...
...
@@ -65,10 +66,6 @@ struct wlr_seat_client *wlr_seat_client_from_pointer_resource(
return
wl_resource_get_user_data
(