Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
80f3e7ec
Commit
80f3e7ec
authored
Oct 26, 2023
by
Alexandros Frantzis
Committed by
Alexandre Julliard
Nov 14, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winewayland.drv: Refactor cursor code to prepare for scaling support.
parent
66ad0d0a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
14 deletions
+35
-14
wayland_pointer.c
dlls/winewayland.drv/wayland_pointer.c
+35
-14
No files found.
dlls/winewayland.drv/wayland_pointer.c
View file @
80f3e7ec
...
...
@@ -90,6 +90,8 @@ static void pointer_handle_motion(void *data, struct wl_pointer *wl_pointer,
__wine_send_input
(
hwnd
,
&
input
,
NULL
);
}
static
void
wayland_set_cursor
(
HWND
hwnd
,
HCURSOR
hcursor
,
BOOL
use_hcursor
);
static
void
pointer_handle_enter
(
void
*
data
,
struct
wl_pointer
*
wl_pointer
,
uint32_t
serial
,
struct
wl_surface
*
wl_surface
,
wl_fixed_t
sx
,
wl_fixed_t
sy
)
...
...
@@ -107,14 +109,11 @@ static void pointer_handle_enter(void *data, struct wl_pointer *wl_pointer,
pthread_mutex_lock
(
&
pointer
->
mutex
);
pointer
->
focused_hwnd
=
hwnd
;
pointer
->
enter_serial
=
serial
;
pthread_mutex_unlock
(
&
pointer
->
mutex
);
/* The cursor is undefined at every enter, so we set it again with
* the latest information we have. */
wl_pointer_set_cursor
(
pointer
->
wl_pointer
,
pointer
->
enter_serial
,
pointer
->
cursor
.
wl_surface
,
pointer
->
cursor
.
hotspot_x
,
pointer
->
cursor
.
hotspot_y
);
pthread_mutex_unlock
(
&
pointer
->
mutex
);
wayland_set_cursor
(
hwnd
,
NULL
,
FALSE
);
/* Handle the enter as a motion, to account for cases where the
* window first appears beneath the pointer and won't get a separate
...
...
@@ -418,7 +417,7 @@ static BOOL get_icon_info(HICON handle, ICONINFOEXW *ret)
return
TRUE
;
}
static
void
wayland_pointer_update_cursor
(
HCURSOR
hcursor
)
static
void
wayland_pointer_update_cursor
_buffer
(
HCURSOR
hcursor
)
{
struct
wayland_cursor
*
cursor
=
&
process_wayland
.
pointer
.
cursor
;
ICONINFOEXW
info
=
{
0
};
...
...
@@ -470,6 +469,22 @@ static void wayland_pointer_update_cursor(HCURSOR hcursor)
cursor
->
hotspot_y
=
cursor
->
shm_buffer
->
height
/
2
;
}
return
;
clear_cursor:
if
(
cursor
->
shm_buffer
)
{
wayland_shm_buffer_unref
(
cursor
->
shm_buffer
);
cursor
->
shm_buffer
=
NULL
;
}
}
static
void
wayland_pointer_update_cursor_surface
(
void
)
{
struct
wayland_cursor
*
cursor
=
&
process_wayland
.
pointer
.
cursor
;
if
(
!
cursor
->
shm_buffer
)
goto
clear_cursor
;
if
(
!
cursor
->
wl_surface
)
{
cursor
->
wl_surface
=
...
...
@@ -504,19 +519,15 @@ clear_cursor:
}
}
/***********************************************************************
* WAYLAND_SetCursor
*/
void
WAYLAND_SetCursor
(
HWND
hwnd
,
HCURSOR
hcursor
)
static
void
wayland_set_cursor
(
HWND
hwnd
,
HCURSOR
hcursor
,
BOOL
use_hcursor
)
{
struct
wayland_pointer
*
pointer
=
&
process_wayland
.
pointer
;
TRACE
(
"hwnd=%p hcursor=%p
\n
"
,
hwnd
,
hcursor
);
pthread_mutex_lock
(
&
pointer
->
mutex
);
if
(
pointer
->
focused_hwnd
==
hwnd
)
{
wayland_pointer_update_cursor
(
hcursor
);
if
(
use_hcursor
)
wayland_pointer_update_cursor_buffer
(
hcursor
);
wayland_pointer_update_cursor_surface
();
wl_pointer_set_cursor
(
pointer
->
wl_pointer
,
pointer
->
enter_serial
,
pointer
->
cursor
.
wl_surface
,
...
...
@@ -526,3 +537,13 @@ void WAYLAND_SetCursor(HWND hwnd, HCURSOR hcursor)
}
pthread_mutex_unlock
(
&
pointer
->
mutex
);
}
/***********************************************************************
* WAYLAND_SetCursor
*/
void
WAYLAND_SetCursor
(
HWND
hwnd
,
HCURSOR
hcursor
)
{
TRACE
(
"hwnd=%p hcursor=%p
\n
"
,
hwnd
,
hcursor
);
wayland_set_cursor
(
hwnd
,
hcursor
,
TRUE
);
}
Write
Preview
Markdown
is supported
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