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
orbea
wayland
Commits
359d6676
Commit
359d6676
authored
Dec 07, 2010
by
Kristian Høgsberg
Browse files
Add grab object infrastructure
parent
4be2ed96
Changes
2
Hide whitespace changes
Inline
Side-by-side
compositor/compositor.c
View file @
359d6676
...
...
@@ -727,6 +727,7 @@ notify_motion(struct wlsc_input_device *device, uint32_t time, int x, int y)
struct
wlsc_surface
*
es
;
struct
wlsc_compositor
*
ec
=
device
->
ec
;
struct
wlsc_output
*
output
;
struct
wl_grab_interface
*
interface
;
int32_t
sx
,
sy
,
width
,
height
;
/* FIXME: We need some multi head love here. */
...
...
@@ -743,7 +744,10 @@ notify_motion(struct wlsc_input_device *device, uint32_t time, int x, int y)
device
->
x
=
x
;
device
->
y
=
y
;
switch
(
device
->
grab
)
{
if
(
device
->
grab_object
)
{
interface
=
device
->
grab_object
->
interface
;
interface
->
motion
(
device
->
grab_object
,
time
,
x
,
y
);
}
else
switch
(
device
->
grab
)
{
case
WLSC_DEVICE_GRAB_NONE
:
es
=
pick_surface
(
device
,
&
sx
,
&
sy
);
wl_input_device_set_pointer_focus
(
&
device
->
input_device
,
...
...
@@ -868,6 +872,7 @@ notify_button(struct wlsc_input_device *device,
{
struct
wlsc_surface
*
surface
;
struct
wlsc_compositor
*
compositor
=
device
->
ec
;
struct
wl_grab_interface
*
interface
;
struct
wl_drag
*
drag
=
device
->
drag
;
surface
=
(
struct
wlsc_surface
*
)
device
->
input_device
.
pointer_focus
;
...
...
@@ -908,8 +913,14 @@ notify_button(struct wlsc_input_device *device,
time
,
button
,
state
);
if
(
!
state
&&
device
->
grab
!=
WLSC_DEVICE_GRAB_NONE
&&
device
->
grab
_object
&&
device
->
grab_button
==
button
)
{
interface
=
device
->
grab_object
->
interface
;
interface
->
end
(
device
->
grab_object
);
}
else
if
(
!
state
&&
device
->
grab
!=
WLSC_DEVICE_GRAB_NONE
&&
device
->
grab_button
==
button
)
{
drag
=
device
->
drag
;
if
(
drag
&&
drag
->
target
)
wl_client_post_event
(
drag
->
target
,
...
...
compositor/compositor.h
View file @
359d6676
...
...
@@ -81,6 +81,18 @@ enum wlsc_pointer_type {
WLSC_POINTER_IBEAM
,
};
struct
wl_grab
;
struct
wl_grab_interface
{
void
(
*
motion
)(
struct
wl_grab
*
grab
,
uint32_t
time
,
int32_t
x
,
int32_t
y
);
void
(
*
end
)(
struct
wl_grab
*
grab
);
};
struct
wl_grab
{
struct
wl_grab_interface
*
interface
;
struct
wl_input_device
*
input_device
;
};
struct
wlsc_input_device
{
struct
wl_input_device
input_device
;
int32_t
x
,
y
;
...
...
@@ -91,6 +103,7 @@ struct wlsc_input_device {
uint32_t
modifier_state
;
struct
wl_grab
*
grab_object
;
enum
wlsc_grab_type
grab
;
uint32_t
grab_time
;
int32_t
grab_x
,
grab_y
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment