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
88b2d6fe
Commit
88b2d6fe
authored
Nov 11, 2018
by
Scott Anderson
Browse files
backend/x11: Check for xinput extension
parent
9c1b87f2
Changes
4
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
88b2d6fe
...
@@ -62,6 +62,7 @@ If you choose to enable X11 support:
...
@@ -62,6 +62,7 @@ If you choose to enable X11 support:
*
xcb
*
xcb
*
xcb-composite
*
xcb-composite
*
xcb-xfixes
*
xcb-xfixes
*
xcb-xinput
*
xcb-image
*
xcb-image
*
xcb-render
*
xcb-render
*
x11-xcb
*
x11-xcb
...
...
backend/x11/backend.c
View file @
88b2d6fe
...
@@ -12,6 +12,7 @@
...
@@ -12,6 +12,7 @@
#include
<X11/Xlib-xcb.h>
#include
<X11/Xlib-xcb.h>
#include
<wayland-server.h>
#include
<wayland-server.h>
#include
<xcb/xcb.h>
#include
<xcb/xcb.h>
#include
<xcb/xinput.h>
#if WLR_HAS_XCB_XKB
#if WLR_HAS_XCB_XKB
#include
<xcb/xkb.h>
#include
<xcb/xkb.h>
#endif
#endif
...
@@ -74,6 +75,12 @@ static void handle_x11_event(struct wlr_x11_backend *x11,
...
@@ -74,6 +75,12 @@ static void handle_x11_event(struct wlr_x11_backend *x11,
}
}
break
;
break
;
}
}
case
XCB_GE_GENERIC
:
{
xcb_ge_generic_event_t
*
ev
=
(
xcb_ge_generic_event_t
*
)
event
;
if
(
ev
->
extension
==
x11
->
xinput_opcode
)
{
handle_x11_xinput_event
(
x11
,
ev
);
}
}
}
}
}
}
...
@@ -259,6 +266,26 @@ struct wlr_backend *wlr_x11_backend_create(struct wl_display *display,
...
@@ -259,6 +266,26 @@ struct wlr_backend *wlr_x11_backend_create(struct wl_display *display,
}
}
}
}
const
xcb_query_extension_reply_t
*
ext
=
xcb_get_extension_data
(
x11
->
xcb
,
&
xcb_input_id
);
if
(
!
ext
||
!
ext
->
present
)
{
wlr_log
(
WLR_ERROR
,
"X11 does not support Xinput extension"
);
goto
error_display
;
}
x11
->
xinput_opcode
=
ext
->
major_opcode
;
xcb_input_xi_query_version_cookie_t
xi_cookie
=
xcb_input_xi_query_version
(
x11
->
xcb
,
2
,
0
);
xcb_input_xi_query_version_reply_t
*
xi_reply
=
xcb_input_xi_query_version_reply
(
x11
->
xcb
,
xi_cookie
,
NULL
);
if
(
!
xi_reply
||
xi_reply
->
major_version
<
2
)
{
wlr_log
(
WLR_ERROR
,
"X11 does not support required Xinput version"
);
free
(
xi_reply
);
goto
error_display
;
}
free
(
xi_reply
);
int
fd
=
xcb_get_file_descriptor
(
x11
->
xcb
);
int
fd
=
xcb_get_file_descriptor
(
x11
->
xcb
);
struct
wl_event_loop
*
ev
=
wl_display_get_event_loop
(
display
);
struct
wl_event_loop
*
ev
=
wl_display_get_event_loop
(
display
);
uint32_t
events
=
WL_EVENT_READABLE
|
WL_EVENT_ERROR
|
WL_EVENT_HANGUP
;
uint32_t
events
=
WL_EVENT_READABLE
|
WL_EVENT_ERROR
|
WL_EVENT_HANGUP
;
...
...
backend/x11/meson.build
View file @
88b2d6fe
x11_libs = []
x11_libs = []
x11_required = [
x11_required = [
'xcb',
'x11-xcb',
'x11-xcb',
'xcb',
'xcb-xinput',
]
]
x11_optional = [
x11_optional = [
'xcb-xkb',
'xcb-xkb',
...
...
include/backend/x11.h
View file @
88b2d6fe
...
@@ -67,6 +67,8 @@ struct wlr_x11_backend {
...
@@ -67,6 +67,8 @@ struct wlr_x11_backend {
// A blank cursor
// A blank cursor
xcb_cursor_t
cursor
;
xcb_cursor_t
cursor
;
uint8_t
xinput_opcode
;
#if WLR_HAS_XCB_XKB
#if WLR_HAS_XCB_XKB
bool
xkb_supported
;
bool
xkb_supported
;
uint8_t
xkb_base_event
;
uint8_t
xkb_base_event
;
...
...
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