Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
00663792
Commit
00663792
authored
May 03, 2023
by
Alexandros Frantzis
Committed by
Alexandre Julliard
Jun 29, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winewayland.drv: Introduce per-window driver data.
Create and manage an internal driver data structure for each non-desktop, non-message window.
parent
6942d7a0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
146 additions
and
1 deletion
+146
-1
waylanddrv.h
dlls/winewayland.drv/waylanddrv.h
+4
-0
waylanddrv_main.c
dlls/winewayland.drv/waylanddrv_main.c
+3
-1
window.c
dlls/winewayland.drv/window.c
+139
-0
No files found.
dlls/winewayland.drv/waylanddrv.h
View file @
00663792
...
...
@@ -111,8 +111,12 @@ void wayland_output_use_xdg_extension(struct wayland_output *output) DECLSPEC_HI
*/
LRESULT
WAYLAND_DesktopWindowProc
(
HWND
hwnd
,
UINT
msg
,
WPARAM
wp
,
LPARAM
lp
)
DECLSPEC_HIDDEN
;
void
WAYLAND_DestroyWindow
(
HWND
hwnd
)
DECLSPEC_HIDDEN
;
BOOL
WAYLAND_UpdateDisplayDevices
(
const
struct
gdi_device_manager
*
device_manager
,
BOOL
force
,
void
*
param
)
DECLSPEC_HIDDEN
;
LRESULT
WAYLAND_WindowMessage
(
HWND
hwnd
,
UINT
msg
,
WPARAM
wp
,
LPARAM
lp
)
DECLSPEC_HIDDEN
;
BOOL
WAYLAND_WindowPosChanging
(
HWND
hwnd
,
HWND
insert_after
,
UINT
swp_flags
,
const
RECT
*
window_rect
,
const
RECT
*
client_rect
,
RECT
*
visible_rect
,
struct
window_surface
**
surface
)
DECLSPEC_HIDDEN
;
#endif
/* __WINE_WAYLANDDRV_H */
dlls/winewayland.drv/waylanddrv_main.c
View file @
00663792
...
...
@@ -32,8 +32,10 @@
static
const
struct
user_driver_funcs
waylanddrv_funcs
=
{
.
pDesktopWindowProc
=
WAYLAND_DesktopWindowProc
,
.
pDestroyWindow
=
WAYLAND_DestroyWindow
,
.
pUpdateDisplayDevices
=
WAYLAND_UpdateDisplayDevices
,
.
pWindowMessage
=
WAYLAND_WindowMessage
.
pWindowMessage
=
WAYLAND_WindowMessage
,
.
pWindowPosChanging
=
WAYLAND_WindowPosChanging
};
static
NTSTATUS
waylanddrv_unix_init
(
void
*
arg
)
...
...
dlls/winewayland.drv/window.c
View file @
00663792
...
...
@@ -24,12 +24,151 @@
#include "config.h"
#include <assert.h>
#include <stdlib.h>
#include "waylanddrv.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
waylanddrv
);
/* private window data */
struct
wayland_win_data
{
struct
rb_entry
entry
;
/* hwnd that this private data belongs to */
HWND
hwnd
;
};
static
int
wayland_win_data_cmp_rb
(
const
void
*
key
,
const
struct
rb_entry
*
entry
)
{
HWND
key_hwnd
=
(
HWND
)
key
;
/* cast to work around const */
const
struct
wayland_win_data
*
entry_win_data
=
RB_ENTRY_VALUE
(
entry
,
const
struct
wayland_win_data
,
entry
);
if
(
key_hwnd
<
entry_win_data
->
hwnd
)
return
-
1
;
if
(
key_hwnd
>
entry_win_data
->
hwnd
)
return
1
;
return
0
;
}
static
pthread_mutex_t
win_data_mutex
=
PTHREAD_MUTEX_INITIALIZER
;
static
struct
rb_tree
win_data_rb
=
{
wayland_win_data_cmp_rb
};
/***********************************************************************
* wayland_win_data_create
*
* Create a data window structure for an existing window.
*/
static
struct
wayland_win_data
*
wayland_win_data_create
(
HWND
hwnd
)
{
struct
wayland_win_data
*
data
;
struct
rb_entry
*
rb_entry
;
HWND
parent
;
/* Don't create win data for desktop or HWND_MESSAGE windows. */
if
(
!
(
parent
=
NtUserGetAncestor
(
hwnd
,
GA_PARENT
)))
return
NULL
;
if
(
parent
!=
NtUserGetDesktopWindow
()
&&
!
NtUserGetAncestor
(
parent
,
GA_PARENT
))
return
NULL
;
if
(
!
(
data
=
calloc
(
1
,
sizeof
(
*
data
))))
return
NULL
;
data
->
hwnd
=
hwnd
;
pthread_mutex_lock
(
&
win_data_mutex
);
/* Check that another thread hasn't already created the wayland_win_data. */
if
((
rb_entry
=
rb_get
(
&
win_data_rb
,
hwnd
)))
{
free
(
data
);
return
RB_ENTRY_VALUE
(
rb_entry
,
struct
wayland_win_data
,
entry
);
}
rb_put
(
&
win_data_rb
,
hwnd
,
&
data
->
entry
);
TRACE
(
"hwnd=%p
\n
"
,
data
->
hwnd
);
return
data
;
}
/***********************************************************************
* wayland_win_data_destroy
*/
static
void
wayland_win_data_destroy
(
struct
wayland_win_data
*
data
)
{
TRACE
(
"hwnd=%p
\n
"
,
data
->
hwnd
);
rb_remove
(
&
win_data_rb
,
&
data
->
entry
);
pthread_mutex_unlock
(
&
win_data_mutex
);
free
(
data
);
}
/***********************************************************************
* wayland_win_data_get
*
* Lock and return the data structure associated with a window.
*/
static
struct
wayland_win_data
*
wayland_win_data_get
(
HWND
hwnd
)
{
struct
rb_entry
*
rb_entry
;
pthread_mutex_lock
(
&
win_data_mutex
);
if
((
rb_entry
=
rb_get
(
&
win_data_rb
,
hwnd
)))
return
RB_ENTRY_VALUE
(
rb_entry
,
struct
wayland_win_data
,
entry
);
pthread_mutex_unlock
(
&
win_data_mutex
);
return
NULL
;
}
/***********************************************************************
* wayland_win_data_release
*
* Release the data returned by wayland_win_data_get.
*/
static
void
wayland_win_data_release
(
struct
wayland_win_data
*
data
)
{
assert
(
data
);
pthread_mutex_unlock
(
&
win_data_mutex
);
}
/***********************************************************************
* WAYLAND_DestroyWindow
*/
void
WAYLAND_DestroyWindow
(
HWND
hwnd
)
{
struct
wayland_win_data
*
data
;
TRACE
(
"%p
\n
"
,
hwnd
);
if
(
!
(
data
=
wayland_win_data_get
(
hwnd
)))
return
;
wayland_win_data_destroy
(
data
);
}
/***********************************************************************
* WAYLAND_WindowPosChanging
*/
BOOL
WAYLAND_WindowPosChanging
(
HWND
hwnd
,
HWND
insert_after
,
UINT
swp_flags
,
const
RECT
*
window_rect
,
const
RECT
*
client_rect
,
RECT
*
visible_rect
,
struct
window_surface
**
surface
)
{
struct
wayland_win_data
*
data
=
wayland_win_data_get
(
hwnd
);
TRACE
(
"hwnd %p window %s client %s visible %s after %p flags %08x
\n
"
,
hwnd
,
wine_dbgstr_rect
(
window_rect
),
wine_dbgstr_rect
(
client_rect
),
wine_dbgstr_rect
(
visible_rect
),
insert_after
,
swp_flags
);
if
(
!
data
&&
!
(
data
=
wayland_win_data_create
(
hwnd
)))
return
TRUE
;
wayland_win_data_release
(
data
);
return
TRUE
;
}
static
void
wayland_resize_desktop
(
void
)
{
RECT
virtual_rect
=
NtUserGetVirtualScreenRect
();
...
...
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