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
ed8a41c7
Commit
ed8a41c7
authored
May 28, 2004
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only allocate even-numbered window handles, MS Project depends on that
(found by Dmitry Timoshkov).
parent
a8877ba6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
8 deletions
+9
-8
user.c
server/user.c
+4
-4
win.c
windows/win.c
+5
-4
No files found.
server/user.c
View file @
ed8a41c7
...
...
@@ -35,7 +35,7 @@ static int allocated_handles;
static
struct
user_handle
*
handle_to_entry
(
user_handle_t
handle
)
{
int
index
=
((
unsigned
int
)
handle
&
0xffff
)
-
FIRST_USER_HANDLE
;
int
index
=
((
(
unsigned
int
)
handle
&
0xffff
)
-
FIRST_USER_HANDLE
)
>>
1
;
if
(
index
<
0
||
index
>=
nb_handles
)
return
NULL
;
if
(
!
handles
[
index
].
type
)
return
NULL
;
if
(((
unsigned
int
)
handle
>>
16
)
&&
((
unsigned
int
)
handle
>>
16
!=
handles
[
index
].
generation
))
...
...
@@ -46,7 +46,7 @@ static struct user_handle *handle_to_entry( user_handle_t handle )
inline
static
user_handle_t
entry_to_handle
(
struct
user_handle
*
ptr
)
{
int
index
=
ptr
-
handles
;
return
(
user_handle_t
)((
index
+
FIRST_USER_HANDLE
)
+
(
ptr
->
generation
<<
16
));
return
(
user_handle_t
)((
(
index
<<
1
)
+
FIRST_USER_HANDLE
)
+
(
ptr
->
generation
<<
16
));
}
inline
static
struct
user_handle
*
alloc_user_entry
(
void
)
...
...
@@ -64,7 +64,7 @@ inline static struct user_handle *alloc_user_entry(void)
struct
user_handle
*
new_handles
;
/* grow array by 50% (but at minimum 32 entries) */
int
growth
=
max
(
32
,
allocated_handles
/
2
);
int
new_size
=
min
(
allocated_handles
+
growth
,
LAST_USER_HANDLE
-
FIRST_USER_HANDLE
+
1
);
int
new_size
=
min
(
allocated_handles
+
growth
,
(
LAST_USER_HANDLE
-
FIRST_USER_HANDLE
+
1
)
>>
1
);
if
(
new_size
<=
allocated_handles
)
return
NULL
;
if
(
!
(
new_handles
=
realloc
(
handles
,
new_size
*
sizeof
(
*
handles
)
)))
return
NULL
;
...
...
@@ -147,7 +147,7 @@ void *next_user_handle( user_handle_t *handle, enum user_object type )
if
(
!*
handle
)
entry
=
handles
;
else
{
int
index
=
((
unsigned
int
)
*
handle
&
0xffff
)
-
FIRST_USER_HANDLE
;
int
index
=
((
(
unsigned
int
)
*
handle
&
0xffff
)
-
FIRST_USER_HANDLE
)
>>
1
;
if
(
index
<
0
||
index
>=
nb_handles
)
return
NULL
;
entry
=
handles
+
index
+
1
;
/* start from the next one */
}
...
...
windows/win.c
View file @
ed8a41c7
...
...
@@ -45,7 +45,8 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
win
);
WINE_DECLARE_DEBUG_CHANNEL
(
msg
);
#define NB_USER_HANDLES (LAST_USER_HANDLE - FIRST_USER_HANDLE + 1)
#define NB_USER_HANDLES ((LAST_USER_HANDLE - FIRST_USER_HANDLE + 1) >> 1)
#define USER_HANDLE_TO_INDEX(hwnd) ((LOWORD(hwnd) - FIRST_USER_HANDLE) >> 1)
/**********************************************************************/
...
...
@@ -110,7 +111,7 @@ static WND *create_window_handle( HWND parent, HWND owner, ATOM atom,
USER_Lock
();
index
=
LOWORD
(
handle
)
-
FIRST_USER_HANDLE
;
index
=
USER_HANDLE_TO_INDEX
(
handle
)
;
assert
(
index
<
NB_USER_HANDLES
);
user_handles
[
index
]
=
win
;
win
->
hwndSelf
=
handle
;
...
...
@@ -131,7 +132,7 @@ static WND *create_window_handle( HWND parent, HWND owner, ATOM atom,
static
WND
*
free_window_handle
(
HWND
hwnd
)
{
WND
*
ptr
;
WORD
index
=
LOWORD
(
hwnd
)
-
FIRST_USER_HANDLE
;
WORD
index
=
USER_HANDLE_TO_INDEX
(
hwnd
)
;
if
(
index
>=
NB_USER_HANDLES
)
return
NULL
;
USER_Lock
();
...
...
@@ -234,7 +235,7 @@ static void get_server_window_text( HWND hwnd, LPWSTR text, INT count )
WND
*
WIN_GetPtr
(
HWND
hwnd
)
{
WND
*
ptr
;
WORD
index
=
LOWORD
(
hwnd
)
-
FIRST_USER_HANDLE
;
WORD
index
=
USER_HANDLE_TO_INDEX
(
hwnd
)
;
if
(
index
>=
NB_USER_HANDLES
)
return
NULL
;
...
...
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