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
e25049e8
Commit
e25049e8
authored
May 21, 2010
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winex11: Create X11 cursors on demand when the cursor is set to a window.
parent
875ca461
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
64 deletions
+28
-64
mouse.c
dlls/winex11.drv/mouse.c
+28
-62
winex11.drv.spec
dlls/winex11.drv/winex11.drv.spec
+0
-1
x11drv.h
dlls/winex11.drv/x11drv.h
+0
-1
No files found.
dlls/winex11.drv/mouse.c
View file @
e25049e8
...
...
@@ -39,7 +39,6 @@ MAKE_FUNCPTR(XcursorImageLoadCursor);
#define NONAMELESSSTRUCT
#include "windef.h"
#include "winbase.h"
#include "wine/winuser16.h"
#include "x11drv.h"
#include "wine/server.h"
...
...
@@ -90,6 +89,7 @@ static HWND cursor_window;
static
DWORD
last_time_modified
;
static
RECT
cursor_clip
;
/* Cursor clipping rect */
static
XContext
cursor_context
;
static
Cursor
create_cursor
(
HANDLE
handle
);
BOOL
CDECL
X11DRV_SetCursorPos
(
INT
x
,
INT
y
);
...
...
@@ -195,38 +195,42 @@ static Cursor get_empty_cursor(void)
}
/***********************************************************************
* get_x11_cursor
*/
Cursor
get_x11_cursor
(
HCURSOR
handle
)
{
Cursor
cursor
;
if
(
!
handle
)
return
get_empty_cursor
();
if
(
cursor_context
&&
!
XFindContext
(
gdi_display
,
(
XID
)
handle
,
cursor_context
,
(
char
**
)
&
cursor
))
return
cursor
;
return
0
;
}
/***********************************************************************
* set_window_cursor
*/
void
set_window_cursor
(
HWND
hwnd
,
HCURSOR
handle
)
{
struct
x11drv_win_data
*
data
;
Cursor
cursor
;
Cursor
cursor
,
prev
;
if
(
!
(
data
=
X11DRV_get_win_data
(
hwnd
)))
return
;
wine_tsx11_lock
();
if
((
cursor
=
get_x11_cursor
(
handle
)))
if
(
!
handle
)
cursor
=
get_empty_cursor
();
else
if
(
!
cursor_context
||
XFindContext
(
gdi_display
,
(
XID
)
handle
,
cursor_context
,
(
char
**
)
&
cursor
))
{
TRACE
(
"%p xid %lx
\n
"
,
handle
,
cursor
);
XDefineCursor
(
gdi_display
,
data
->
whole_window
,
cursor
);
/* Make the change take effect immediately */
XFlush
(
gdi_display
);
data
->
cursor
=
handle
;
/* try to create it */
wine_tsx11_unlock
();
if
(
!
(
cursor
=
create_cursor
(
handle
)))
return
;
wine_tsx11_lock
();
if
(
!
cursor_context
)
cursor_context
=
XUniqueContext
();
if
(
!
XFindContext
(
gdi_display
,
(
XID
)
handle
,
cursor_context
,
(
char
**
)
&
prev
))
{
/* someone else was here first */
XFreeCursor
(
gdi_display
,
cursor
);
cursor
=
prev
;
}
else
{
XSaveContext
(
gdi_display
,
(
XID
)
handle
,
cursor_context
,
(
char
*
)
cursor
);
TRACE
(
"cursor %p created %lx
\n
"
,
handle
,
cursor
);
}
}
XDefineCursor
(
gdi_display
,
data
->
whole_window
,
cursor
);
/* make the change take effect immediately */
XFlush
(
gdi_display
);
data
->
cursor
=
handle
;
wine_tsx11_unlock
();
}
...
...
@@ -327,16 +331,8 @@ static void queue_raw_mouse_message( UINT message, HWND hwnd, DWORD x, DWORD y,
if
(
hwnd
)
{
Cursor
xcursor
;
struct
x11drv_win_data
*
data
=
X11DRV_get_win_data
(
hwnd
);
if
(
data
&&
cursor
!=
data
->
cursor
)
{
wine_tsx11_lock
();
if
((
xcursor
=
get_x11_cursor
(
cursor
)))
XDefineCursor
(
gdi_display
,
data
->
whole_window
,
xcursor
);
data
->
cursor
=
cursor
;
wine_tsx11_unlock
();
}
if
(
data
&&
cursor
!=
data
->
cursor
)
set_window_cursor
(
hwnd
,
cursor
);
}
}
...
...
@@ -796,36 +792,6 @@ static Cursor create_cursor( HANDLE handle )
}
/***********************************************************************
* CreateCursorIcon (X11DRV.@)
*/
void
CDECL
X11DRV_CreateCursorIcon
(
HCURSOR
handle
,
CURSORICONINFO
*
info
)
{
static
const
WORD
ICON_HOTSPOT
=
0x4242
;
Cursor
cursor
,
prev
;
/* ignore icons (FIXME: shouldn't use magic hotspot value) */
if
(
info
->
ptHotSpot
.
x
==
ICON_HOTSPOT
&&
info
->
ptHotSpot
.
y
==
ICON_HOTSPOT
)
return
;
cursor
=
create_cursor
(
handle
);
if
(
cursor
)
{
wine_tsx11_lock
();
if
(
!
cursor_context
)
cursor_context
=
XUniqueContext
();
if
(
!
XFindContext
(
gdi_display
,
(
XID
)
handle
,
cursor_context
,
(
char
**
)
&
prev
))
{
/* someone else was here first */
XFreeCursor
(
gdi_display
,
cursor
);
cursor
=
prev
;
}
else
XSaveContext
(
gdi_display
,
(
XID
)
handle
,
cursor_context
,
(
char
*
)
cursor
);
wine_tsx11_unlock
();
TRACE
(
"cursor %p %ux%u, planes %u, bpp %u -> xid %lx
\n
"
,
handle
,
info
->
nWidth
,
info
->
nHeight
,
info
->
bPlanes
,
info
->
bBitsPerPixel
,
cursor
);
}
}
/***********************************************************************
* DestroyCursorIcon (X11DRV.@)
*/
void
CDECL
X11DRV_DestroyCursorIcon
(
HCURSOR
handle
)
...
...
@@ -833,7 +799,7 @@ void CDECL X11DRV_DestroyCursorIcon( HCURSOR handle )
Cursor
cursor
;
wine_tsx11_lock
();
if
(
(
cursor
=
get_x11_cursor
(
handle
)
))
if
(
cursor_context
&&
!
XFindContext
(
gdi_display
,
(
XID
)
handle
,
cursor_context
,
(
char
**
)
&
cursor
))
{
TRACE
(
"%p xid %lx
\n
"
,
handle
,
cursor
);
XFreeCursor
(
gdi_display
,
cursor
);
...
...
dlls/winex11.drv/winex11.drv.spec
View file @
e25049e8
...
...
@@ -73,7 +73,6 @@
@ cdecl ToUnicodeEx(long long ptr ptr long long long) X11DRV_ToUnicodeEx
@ cdecl UnloadKeyboardLayout(long) X11DRV_UnloadKeyboardLayout
@ cdecl VkKeyScanEx(long long) X11DRV_VkKeyScanEx
@ cdecl CreateCursorIcon(long ptr) X11DRV_CreateCursorIcon
@ cdecl DestroyCursorIcon(long) X11DRV_DestroyCursorIcon
@ cdecl SetCursor(long) X11DRV_SetCursor
@ cdecl GetCursorPos(ptr) X11DRV_GetCursorPos
...
...
dlls/winex11.drv/x11drv.h
View file @
e25049e8
...
...
@@ -781,7 +781,6 @@ extern int CDECL X11DRV_AcquireClipboard(HWND hWndClipWindow);
extern
void
X11DRV_Clipboard_Cleanup
(
void
);
extern
void
X11DRV_ResetSelectionOwner
(
void
);
extern
void
CDECL
X11DRV_SetFocus
(
HWND
hwnd
);
extern
Cursor
get_x11_cursor
(
HCURSOR
handle
);
extern
void
set_window_cursor
(
HWND
hwnd
,
HCURSOR
handle
);
extern
BOOL
CDECL
X11DRV_ClipCursor
(
LPCRECT
clip
);
extern
void
X11DRV_InitKeyboard
(
Display
*
display
);
...
...
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