Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
wayland
wayland
Commits
3c6f4211
Commit
3c6f4211
authored
Feb 18, 2012
by
Kristian Høgsberg
Browse files
Split pointer_focus and keyboard_focus into enter and leave events
parent
ab3b5cd7
Changes
2
Hide whitespace changes
Inline
Side-by-side
protocol/wayland.xml
View file @
3c6f4211
...
...
@@ -624,8 +624,8 @@
<arg
name=
"state"
type=
"uint"
/>
</event>
<event
name=
"pointer_
focus
"
>
<description
summary=
"pointer
focus change
event"
>
<event
name=
"pointer_
enter
"
>
<description
summary=
"pointer
enter
event"
>
Notification that this input device's pointer is focused on
certain surface. When an input_device enters a surface, the
pointer image is undefined and a client should respond to this
...
...
@@ -638,12 +638,24 @@
<arg
name=
"surface_y"
type=
"int"
/>
</event>
<event
name=
"keyboard_focus"
>
<event
name=
"pointer_leave"
>
<description
summary=
"pointer leave event"
>
</description>
<arg
name=
"time"
type=
"uint"
/>
<arg
name=
"surface"
type=
"object"
interface=
"wl_surface"
/>
</event>
<event
name=
"keyboard_enter"
>
<arg
name=
"time"
type=
"uint"
/>
<arg
name=
"surface"
type=
"object"
interface=
"wl_surface"
/>
<arg
name=
"keys"
type=
"array"
/>
</event>
<event
name=
"keyboard_leave"
>
<arg
name=
"time"
type=
"uint"
/>
<arg
name=
"surface"
type=
"object"
interface=
"wl_surface"
/>
</event>
<event
name=
"touch_down"
>
<arg
name=
"time"
type=
"uint"
/>
<arg
name=
"surface"
type=
"object"
interface=
"wl_surface"
/>
...
...
src/wayland-server.c
View file @
3c6f4211
...
...
@@ -568,19 +568,17 @@ wl_input_device_set_pointer_focus(struct wl_input_device *device,
if
(
device
->
pointer_focus
==
surface
)
return
;
if
(
device
->
pointer_focus_resource
&&
(
!
surface
||
device
->
pointer_focus
->
resource
.
client
!=
surface
->
resource
.
client
))
if
(
device
->
pointer_focus_resource
)
{
wl_resource_post_event
(
device
->
pointer_focus_resource
,
WL_INPUT_DEVICE_POINTER_FOCUS
,
time
,
NULL
,
0
,
0
);
if
(
device
->
pointer_focus_resource
)
WL_INPUT_DEVICE_POINTER_LEAVE
,
time
,
device
->
pointer_focus
);
wl_list_remove
(
&
device
->
pointer_focus_listener
.
link
);
}
resource
=
find_resource_for_surface
(
&
device
->
resource_list
,
surface
);
if
(
resource
)
{
wl_resource_post_event
(
resource
,
WL_INPUT_DEVICE_POINTER_
FOCUS
,
WL_INPUT_DEVICE_POINTER_
ENTER
,
time
,
surface
,
sx
,
sy
);
wl_list_insert
(
resource
->
destroy_listener_list
.
prev
,
&
device
->
pointer_focus_listener
.
link
);
...
...
@@ -602,19 +600,17 @@ wl_input_device_set_keyboard_focus(struct wl_input_device *device,
if
(
device
->
keyboard_focus
==
surface
)
return
;
if
(
device
->
keyboard_focus_resource
&&
(
!
surface
||
device
->
keyboard_focus
->
resource
.
client
!=
surface
->
resource
.
client
))
if
(
device
->
keyboard_focus_resource
)
{
wl_resource_post_event
(
device
->
keyboard_focus_resource
,
WL_INPUT_DEVICE_KEYBOARD_FOCUS
,
time
,
NULL
,
&
device
->
keys
);
if
(
device
->
keyboard_focus_resource
)
WL_INPUT_DEVICE_KEYBOARD_LEAVE
,
time
,
device
->
keyboard_focus
);
wl_list_remove
(
&
device
->
keyboard_focus_listener
.
link
);
}
resource
=
find_resource_for_surface
(
&
device
->
resource_list
,
surface
);
if
(
resource
)
{
wl_resource_post_event
(
resource
,
WL_INPUT_DEVICE_KEYBOARD_
FOCUS
,
WL_INPUT_DEVICE_KEYBOARD_
ENTER
,
time
,
surface
,
&
device
->
keys
);
wl_list_insert
(
resource
->
destroy_listener_list
.
prev
,
&
device
->
keyboard_focus_listener
.
link
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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