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
Roman Gilg
xserver
Commits
61f2604e
Commit
61f2604e
authored
Jan 19, 2019
by
Roman Gilg
Browse files
Cursor and lock scaling
parent
4481f8f9
Pipeline
#15564
passed with stages
in 1 minute and 6 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
hw/xwayland/xwayland-cursor.c
View file @
61f2604e
...
...
@@ -125,6 +125,7 @@ static const struct wl_callback_listener frame_listener = {
void
xwl_seat_set_cursor
(
struct
xwl_seat
*
xwl_seat
)
{
struct
xwl_screen
*
xwl_screen
=
xwl_seat
->
xwl_screen
;
struct
xwl_cursor
*
xwl_cursor
=
&
xwl_seat
->
cursor
;
PixmapPtr
pixmap
;
CursorPtr
cursor
;
...
...
@@ -161,13 +162,13 @@ xwl_seat_set_cursor(struct xwl_seat *xwl_seat)
wl_pointer_set_cursor
(
xwl_seat
->
wl_pointer
,
xwl_seat
->
pointer_enter_serial
,
xwl_cursor
->
surface
,
xwl_seat
->
x_cursor
->
bits
->
xhot
,
xwl_seat
->
x_cursor
->
bits
->
yhot
);
xwl_scale_to
(
xwl_screen
,
xwl_seat
->
x_cursor
->
bits
->
xhot
)
,
xwl_scale_to
(
xwl_screen
,
xwl_seat
->
x_cursor
->
bits
->
yhot
)
)
;
wl_surface_attach
(
xwl_cursor
->
surface
,
xwl_shm_pixmap_get_wl_buffer
(
pixmap
),
0
,
0
);
wl_surface_damage
(
xwl_cursor
->
surface
,
0
,
0
,
xwl_seat
->
x_cursor
->
bits
->
width
,
xwl_seat
->
x_cursor
->
bits
->
height
);
xwl_scale_to
(
xwl_screen
,
xwl_seat
->
x_cursor
->
bits
->
width
)
,
xwl_scale_to
(
xwl_screen
,
xwl_seat
->
x_cursor
->
bits
->
height
)
)
;
xwl_cursor
->
frame_cb
=
wl_surface_frame
(
xwl_cursor
->
surface
);
wl_callback_add_listener
(
xwl_cursor
->
frame_cb
,
&
frame_listener
,
xwl_cursor
);
...
...
@@ -179,6 +180,7 @@ void
xwl_tablet_tool_set_cursor
(
struct
xwl_tablet_tool
*
xwl_tablet_tool
)
{
struct
xwl_seat
*
xwl_seat
=
xwl_tablet_tool
->
seat
;
struct
xwl_screen
*
xwl_screen
=
xwl_seat
->
xwl_screen
;
struct
xwl_cursor
*
xwl_cursor
=
&
xwl_tablet_tool
->
cursor
;
PixmapPtr
pixmap
;
CursorPtr
cursor
;
...
...
@@ -211,13 +213,13 @@ xwl_tablet_tool_set_cursor(struct xwl_tablet_tool *xwl_tablet_tool)
zwp_tablet_tool_v2_set_cursor
(
xwl_tablet_tool
->
tool
,
xwl_tablet_tool
->
proximity_in_serial
,
xwl_cursor
->
surface
,
xwl_seat
->
x_cursor
->
bits
->
xhot
,
xwl_seat
->
x_cursor
->
bits
->
yhot
);
xwl_scale_to
(
xwl_screen
,
xwl_seat
->
x_cursor
->
bits
->
xhot
)
,
xwl_scale_to
(
xwl_screen
,
xwl_seat
->
x_cursor
->
bits
->
yhot
)
)
;
wl_surface_attach
(
xwl_cursor
->
surface
,
xwl_shm_pixmap_get_wl_buffer
(
pixmap
),
0
,
0
);
wl_surface_damage
(
xwl_cursor
->
surface
,
0
,
0
,
xwl_seat
->
x_cursor
->
bits
->
width
,
xwl_seat
->
x_cursor
->
bits
->
height
);
xwl_scale_to
(
xwl_screen
,
xwl_seat
->
x_cursor
->
bits
->
width
)
,
xwl_scale_to
(
xwl_screen
,
xwl_seat
->
x_cursor
->
bits
->
height
)
)
;
xwl_cursor
->
frame_cb
=
wl_surface_frame
(
xwl_cursor
->
surface
);
wl_callback_add_listener
(
xwl_cursor
->
frame_cb
,
&
frame_listener
,
xwl_cursor
);
...
...
hw/xwayland/xwayland-input.c
View file @
61f2604e
...
...
@@ -519,13 +519,14 @@ pointer_handle_motion(void *data, struct wl_pointer *pointer,
uint32_t
time
,
wl_fixed_t
sx_w
,
wl_fixed_t
sy_w
)
{
struct
xwl_seat
*
xwl_seat
=
data
;
int32_t
scale
=
xwl_seat
->
xwl_screen
->
global_output_scale
;
if
(
!
xwl_seat
->
focus_window
)
return
;
xwl_seat
->
pending_pointer_event
.
has_absolute
=
TRUE
;
xwl_seat
->
pending_pointer_event
.
x
=
sx_w
*
xwl_seat
->
xwl_screen
->
global_output_
scale
;
xwl_seat
->
pending_pointer_event
.
y
=
sy_w
*
xwl_seat
->
xwl_screen
->
global_output_
scale
;
xwl_seat
->
pending_pointer_event
.
x
=
sx_w
*
scale
;
xwl_seat
->
pending_pointer_event
.
y
=
sy_w
*
scale
;
if
(
wl_proxy_get_version
((
struct
wl_proxy
*
)
xwl_seat
->
wl_pointer
)
<
5
)
dispatch_pointer_motion_event
(
xwl_seat
);
...
...
@@ -665,12 +666,13 @@ relative_pointer_handle_relative_motion(void *data,
wl_fixed_t
dy_unaccelf
)
{
struct
xwl_seat
*
xwl_seat
=
data
;
int32_t
scale
=
xwl_seat
->
xwl_screen
->
global_output_scale
;
xwl_seat
->
pending_pointer_event
.
has_relative
=
TRUE
;
xwl_seat
->
pending_pointer_event
.
dx
=
wl_fixed_to_double
(
dxf
)
*
xwl_seat
->
xwl_screen
->
global_output_
scale
;
xwl_seat
->
pending_pointer_event
.
dy
=
wl_fixed_to_double
(
dyf
)
*
xwl_seat
->
xwl_screen
->
global_output_
scale
;
xwl_seat
->
pending_pointer_event
.
dx_unaccel
=
wl_fixed_to_double
(
dx_unaccelf
)
*
xwl_seat
->
xwl_screen
->
global_output_
scale
;
xwl_seat
->
pending_pointer_event
.
dy_unaccel
=
wl_fixed_to_double
(
dy_unaccelf
)
*
xwl_seat
->
xwl_screen
->
global_output_
scale
;
xwl_seat
->
pending_pointer_event
.
dx
=
wl_fixed_to_double
(
dxf
)
*
scale
;
xwl_seat
->
pending_pointer_event
.
dy
=
wl_fixed_to_double
(
dyf
)
*
scale
;
xwl_seat
->
pending_pointer_event
.
dx_unaccel
=
wl_fixed_to_double
(
dx_unaccelf
)
*
scale
;
xwl_seat
->
pending_pointer_event
.
dy_unaccel
=
wl_fixed_to_double
(
dy_unaccelf
)
*
scale
;
if
(
!
xwl_seat
->
focus_window
)
return
;
...
...
@@ -2582,6 +2584,7 @@ xwl_pointer_warp_emulator_set_fake_pos(struct xwl_pointer_warp_emulator *warp_em
int
x
,
int
y
)
{
struct
xwl_screen
*
xwl_screen
;
struct
zwp_locked_pointer_v1
*
locked_pointer
=
warp_emulator
->
locked_pointer
;
WindowPtr
window
;
...
...
@@ -2593,6 +2596,7 @@ xwl_pointer_warp_emulator_set_fake_pos(struct xwl_pointer_warp_emulator *warp_em
if
(
!
warp_emulator
->
xwl_seat
->
focus_window
)
return
;
xwl_screen
=
warp_emulator
->
xwl_seat
->
xwl_screen
;
window
=
warp_emulator
->
xwl_seat
->
focus_window
->
window
;
if
(
x
>=
window
->
drawable
.
x
||
y
>=
window
->
drawable
.
y
||
...
...
@@ -2601,8 +2605,8 @@ xwl_pointer_warp_emulator_set_fake_pos(struct xwl_pointer_warp_emulator *warp_em
sx
=
x
-
window
->
drawable
.
x
;
sy
=
y
-
window
->
drawable
.
y
;
zwp_locked_pointer_v1_set_cursor_position_hint
(
locked_pointer
,
wl_fixed_from_int
(
sx
),
wl_fixed_from_int
(
sy
));
wl_fixed_from_int
(
xwl_scale_to
(
xwl_screen
,
sx
)
)
,
wl_fixed_from_int
(
xwl_scale_to
(
xwl_screen
,
sy
))
)
;
wl_surface_commit
(
warp_emulator
->
xwl_seat
->
focus_window
->
surface
);
}
}
...
...
hw/xwayland/xwayland.c
View file @
61f2604e
...
...
@@ -133,7 +133,7 @@ static DevPrivateKeyRec xwl_window_private_key;
static
DevPrivateKeyRec
xwl_screen_private_key
;
static
DevPrivateKeyRec
xwl_pixmap_private_key
;
static
int
int
xwl_scale_to
(
struct
xwl_screen
*
xwl_screen
,
int
value
)
{
return
value
/
(
double
)
xwl_screen
->
global_output_scale
+
0
.
5
;
...
...
hw/xwayland/xwayland.h
View file @
61f2604e
...
...
@@ -420,6 +420,8 @@ struct xwl_pixmap *xwl_pixmap_get(PixmapPtr pixmap);
struct
xwl_window
*
xwl_window_from_window
(
WindowPtr
window
);
int
xwl_scale_to
(
struct
xwl_screen
*
xwl_screen
,
int
value
);
Bool
xwl_shm_create_screen_resources
(
ScreenPtr
screen
);
PixmapPtr
xwl_shm_create_pixmap
(
ScreenPtr
screen
,
int
width
,
int
height
,
int
depth
,
unsigned
int
hint
);
...
...
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