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
f7303cf7
Commit
f7303cf7
authored
Jan 27, 2024
by
Rémi Bernon
Committed by
Alexandre Julliard
Feb 28, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
server: Keep a list of threads connected to each desktop.
parent
496eed7a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
22 deletions
+33
-22
thread.h
server/thread.h
+1
-0
user.h
server/user.h
+1
-0
winstation.c
server/winstation.c
+31
-22
No files found.
server/thread.h
View file @
f7303cf7
...
...
@@ -51,6 +51,7 @@ struct thread
struct
object
obj
;
/* object header */
struct
list
entry
;
/* entry in system-wide thread list */
struct
list
proc_entry
;
/* entry in per-process thread list */
struct
list
desktop_entry
;
/* entry in per-desktop thread list */
struct
process
*
process
;
thread_id_t
id
;
/* thread id */
struct
list
mutex_list
;
/* list of currently owned mutexes */
...
...
server/user.h
View file @
f7303cf7
...
...
@@ -70,6 +70,7 @@ struct desktop
struct
winstation
*
winstation
;
/* winstation this desktop belongs to */
timeout_t
input_time
;
/* last time this desktop had the input */
struct
list
entry
;
/* entry in winstation list of desktops */
struct
list
threads
;
/* list of threads connected to this desktop */
struct
window
*
top_window
;
/* desktop window for this desktop */
struct
window
*
msg_window
;
/* HWND_MESSAGE top window */
struct
hook_table
*
global_hooks
;
/* table of global hooks on this desktop */
...
...
server/winstation.c
View file @
f7303cf7
...
...
@@ -273,6 +273,7 @@ static struct desktop *create_desktop( const struct unicode_str *name, unsigned
desktop
->
close_timeout
=
NULL
;
desktop
->
foreground_input
=
NULL
;
desktop
->
users
=
0
;
list_init
(
&
desktop
->
threads
);
memset
(
&
desktop
->
cursor
,
0
,
sizeof
(
desktop
->
cursor
)
);
memset
(
desktop
->
keystate
,
0
,
sizeof
(
desktop
->
keystate
)
);
list_add_tail
(
&
winstation
->
desktops
,
&
desktop
->
entry
);
...
...
@@ -362,26 +363,37 @@ static void close_desktop_timeout( void *private )
}
/* add a user of the desktop and cancel the close timeout */
static
void
add_desktop_
user
(
struct
desktop
*
desktop
)
static
void
add_desktop_
thread
(
struct
desktop
*
desktop
,
struct
thread
*
thread
)
{
desktop
->
users
++
;
if
(
desktop
->
close_timeout
)
list_add_tail
(
&
desktop
->
threads
,
&
thread
->
desktop_entry
);
if
(
!
thread
->
process
->
is_system
)
{
remove_timeout_user
(
desktop
->
close_timeout
);
desktop
->
close_timeout
=
NULL
;
desktop
->
users
++
;
if
(
desktop
->
close_timeout
)
{
remove_timeout_user
(
desktop
->
close_timeout
);
desktop
->
close_timeout
=
NULL
;
}
}
}
/* remove a user of the desktop and start the close timeout if necessary */
static
void
remove_desktop_
user
(
struct
desktop
*
desktop
)
static
void
remove_desktop_
thread
(
struct
desktop
*
desktop
,
struct
thread
*
thread
)
{
struct
process
*
process
;
assert
(
desktop
->
users
>
0
);
desktop
->
users
--
;
/* if we have one remaining user, it has to be the manager of the desktop window */
if
((
process
=
get_top_window_owner
(
desktop
))
&&
desktop
->
users
==
process
->
running_threads
&&
!
desktop
->
close_timeout
)
desktop
->
close_timeout
=
add_timeout_user
(
-
TICKS_PER_SEC
,
close_desktop_timeout
,
desktop
);
list_remove
(
&
thread
->
desktop_entry
);
if
(
!
thread
->
process
->
is_system
)
{
assert
(
desktop
->
users
>
0
);
desktop
->
users
--
;
/* if we have one remaining user, it has to be the manager of the desktop window */
if
((
process
=
get_top_window_owner
(
desktop
))
&&
desktop
->
users
==
process
->
running_threads
&&
!
desktop
->
close_timeout
)
desktop
->
close_timeout
=
add_timeout_user
(
-
TICKS_PER_SEC
,
close_desktop_timeout
,
desktop
);
}
}
/* set the thread default desktop handle */
...
...
@@ -390,7 +402,7 @@ void set_thread_default_desktop( struct thread *thread, struct desktop *desktop,
if
(
thread
->
desktop
)
return
;
/* nothing to do */
thread
->
desktop
=
handle
;
if
(
!
thread
->
process
->
is_system
)
add_desktop_user
(
desktop
);
add_desktop_thread
(
desktop
,
thread
);
}
/* set the process default desktop handle */
...
...
@@ -500,14 +512,11 @@ void release_thread_desktop( struct thread *thread, int close )
if
(
!
(
handle
=
thread
->
desktop
))
return
;
if
(
!
thread
->
process
->
is_system
)
if
(
!
(
desktop
=
get_desktop_obj
(
thread
->
process
,
handle
,
0
)))
clear_error
();
/* ignore errors */
else
{
if
(
!
(
desktop
=
get_desktop_obj
(
thread
->
process
,
handle
,
0
)))
clear_error
();
/* ignore errors */
else
{
remove_desktop_user
(
desktop
);
release_object
(
desktop
);
}
remove_desktop_thread
(
desktop
,
thread
);
release_object
(
desktop
);
}
if
(
close
)
...
...
@@ -730,10 +739,10 @@ DECL_HANDLER(set_thread_desktop)
else
{
current
->
desktop
=
req
->
handle
;
/* FIXME: should we close the old one? */
if
(
!
current
->
process
->
is_system
&&
old_desktop
!=
new_desktop
)
if
(
old_desktop
!=
new_desktop
)
{
add_desktop_user
(
new_desktop
);
if
(
old_desktop
)
remove_desktop_user
(
old_desktop
);
if
(
old_desktop
)
remove_desktop_thread
(
old_desktop
,
current
);
add_desktop_thread
(
new_desktop
,
current
);
}
}
...
...
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